File: tracker.h

package info (click to toggle)
ltt-control 2.15.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,744 kB
  • sloc: cpp: 207,706; sh: 28,837; python: 18,952; ansic: 11,636; makefile: 3,362; java: 109; xml: 46
file content (610 lines) | stat: -rw-r--r-- 23,580 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
/*
 * SPDX-FileCopyrightText: 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
 * SPDX-FileCopyrightText: 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
 *
 * SPDX-License-Identifier: LGPL-2.1-only
 *
 */

#ifndef LTTNG_TRACKER_H
#define LTTNG_TRACKER_H

#include <lttng/constant.h>
#include <lttng/domain.h>
#include <lttng/lttng-error.h>
#include <lttng/lttng-export.h>
#include <lttng/session.h>

#include <sys/types.h>

#ifdef __cplusplus
extern "C" {
#endif

/*
 * Process attribute tracked by a tracker.
 */
enum lttng_process_attr {
	/* Kernel space domain only. */
	LTTNG_PROCESS_ATTR_PROCESS_ID = 0,
	/* Kernel and user space domains. */
	LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID = 1,
	/* Kernel space domain only. */
	LTTNG_PROCESS_ATTR_USER_ID = 2,
	/* Kernel and user space domains. */
	LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID = 3,
	/* Kernel space domain only. */
	LTTNG_PROCESS_ATTR_GROUP_ID = 4,
	/* Kernel and user space domains. */
	LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID = 5,
};

/*
 * Tracking (filtering) policy of a process attribute tracker.
 */
enum lttng_tracking_policy {
	/*
	 * Track all possible process attribute value of a given type
	 * (i.e. no filtering).
	 * This is the default state of a process attribute tracker.
	 */
	LTTNG_TRACKING_POLICY_INCLUDE_ALL = 0,
	/* Exclude all possible process attribute values of a given type. */
	LTTNG_TRACKING_POLICY_EXCLUDE_ALL = 1,
	/* Track a set of specific process attribute values. */
	LTTNG_TRACKING_POLICY_INCLUDE_SET = 2,
};

/*
 * Type of a process attribute value.
 *
 * This allows the use of the matching accessor given the type of a value.
 */
enum lttng_process_attr_value_type {
	LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID = -1,
	LTTNG_PROCESS_ATTR_VALUE_TYPE_PID = 0,
	LTTNG_PROCESS_ATTR_VALUE_TYPE_UID = 1,
	LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME = 2,
	LTTNG_PROCESS_ATTR_VALUE_TYPE_GID = 3,
	LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME = 4,
};

enum lttng_process_attr_tracker_handle_status {
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_GROUP_NOT_FOUND = -7,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_USER_NOT_FOUND = -6,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY = -5,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST = -4,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR = -3,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_COMMUNICATION_ERROR = -2,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID = -1,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK = 0,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS = 1,
	LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING = 2,
};

enum lttng_process_attr_values_status {
	LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE = -2,
	LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID = -1,
	LTTNG_PROCESS_ATTR_VALUES_STATUS_OK = 0,
};

/*
 * A process attribute tracker handle.
 *
 * A process attribute tracker is an _inclusion set_ of process
 * attribute values. Tracked processes are allowed to emit events,
 * provided those events are targeted by enabled event rules.
 *
 * An LTTng session is created with a number of process attribute
 * trackers by default. The process attributes that can be tracked vary by
 * domain (see enum lttng_process_attr).
 *
 * Trackers are per-domain (user and kernel space) and allow the filtering
 * of events based on a process's attributes.
 */
struct lttng_process_attr_tracker_handle;

/* A set of process attribute values. */
struct lttng_process_attr_values;

/*
 * Get a handle to one of the process attribute trackers of a session's domain.
 *
 * Returns LTTNG_OK and a process attribute tracker handle on success,
 * or an lttng_error_code on error.
 *
 * The tracker's ownership is transfered to the caller. Use
 * lttng_process_attr_tracker_handle_destroy() to dispose of it.
 */
LTTNG_EXPORT extern enum lttng_error_code
lttng_session_get_tracker_handle(const char *session_name,
				 enum lttng_domain_type domain,
				 enum lttng_process_attr process_attr,
				 struct lttng_process_attr_tracker_handle **out_tracker_handle);

/*
 * Destroy a process attribute tracker handle.
 */
LTTNG_EXPORT extern void
lttng_process_attr_tracker_handle_destroy(struct lttng_process_attr_tracker_handle *tracker_handle);

/*
 * Get the tracking policy of a process attribute tracker.
 *
 * Returns the LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK and the tracking
 * policy of a process attribute tracker on success,
 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID on error.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_tracker_handle_get_tracking_policy(
	const struct lttng_process_attr_tracker_handle *tracker_handle,
	enum lttng_tracking_policy *policy);

/*
 * Set the tracking policy of a process attribute tracker.
 *
 * Setting the tracking policy to the current tracking policy has no effect.
 *
 * Returns the LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID on error.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_tracker_handle_set_tracking_policy(
	const struct lttng_process_attr_tracker_handle *tracker_handle,
	enum lttng_tracking_policy policy);

/*
 * Add a numerical PID to the process ID process attribute tracker inclusion
 * set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_process_id_tracker_handle_add_pid(
	const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t pid);

/*
 * Remove a numerical PID from the process ID process attribute tracker include
 * set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_process_id_tracker_handle_remove_pid(
	const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t pid);

/*
 * Add a numerical PID to the virtual process ID process attribute tracker
 * inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
	const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t vpid);

/*
 * Remove a numerical PID from the virtual process ID process attribute tracker
 * inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(
	const struct lttng_process_attr_tracker_handle *process_id_tracker, pid_t vpid);

/*
 * Add a numerical UID to the user ID process attribute tracker inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_user_id_tracker_handle_add_uid(
	const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid);

/*
 * Remove a numerical UID from the user ID process attribute tracker include
 * set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_user_id_tracker_handle_remove_uid(
	const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t uid);

/*
 * Add a user name to the user ID process attribute tracker inclusion set.
 *
 * The user name resolution is performed by the session daemon on addition to
 * the user ID inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_user_id_tracker_handle_add_user_name(
	const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name);

/*
 * Remove a user name from the user ID process attribute tracker include
 * set.
 *
 * No name resolution is performed; the user name will be matched against the
 * names in the inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_user_id_tracker_handle_remove_user_name(
	const struct lttng_process_attr_tracker_handle *user_id_tracker, const char *user_name);

/*
 * Add a numerical UID to the virtual user ID process attribute tracker
 * inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
	const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid);

/*
 * Remove a numerical UID from the virtual user ID process attribute tracker
 * inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_user_id_tracker_handle_remove_uid(
	const struct lttng_process_attr_tracker_handle *user_id_tracker, uid_t vuid);

/*
 * Add a user name to the virtual user ID process attribute tracker include
 * set.
 *
 * The user name resolution is performed by the session daemon on addition to
 * the virtual user ID inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
	const struct lttng_process_attr_tracker_handle *user_id_tracker,
	const char *virtual_user_name);

/*
 * Remove a user name from the virtual user ID process attribute tracker
 * inclusion set.
 *
 * No name resolution is performed; the user name will be matched against the
 * names in the inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name(
	const struct lttng_process_attr_tracker_handle *user_id_tracker,
	const char *virtual_user_name);

/*
 * Add a numerical GID to the group ID process attribute tracker inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_group_id_tracker_handle_add_gid(
	const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid);

/*
 * Remove a numerical GID from the group ID process attribute tracker include
 * set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_group_id_tracker_handle_remove_gid(
	const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t gid);

/*
 * Add a group name to the group ID process attribute tracker inclusion set.
 *
 * The group name resolution is performed by the session daemon on addition to
 * the group ID inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_group_id_tracker_handle_add_group_name(
	const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name);

/*
 * Remove a group name from the group ID process attribute tracker include
 * set.
 *
 * No name resolution is performed; the user name will be matched against the
 * names in the inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_group_id_tracker_handle_remove_group_name(
	const struct lttng_process_attr_tracker_handle *group_id_tracker, const char *group_name);

/*
 * Add a numerical GID to the virtual group ID process attribute tracker
 * inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
	const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid);

/*
 * Remove a numerical GID from the virtual group ID process attribute tracker
 * inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_group_id_tracker_handle_remove_gid(
	const struct lttng_process_attr_tracker_handle *group_id_tracker, gid_t vgid);

/*
 * Add a group name to the virtual group ID process attribute tracker include
 * set.
 *
 * The group name resolution is performed by the session daemon on addition to
 * the virtual group ID inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
 * present in the inclusion set, and
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
 * argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
	const struct lttng_process_attr_tracker_handle *group_id_tracker,
	const char *virtual_group_name);

/*
 * Remove a group name from the virtual group ID process attribute tracker
 * inclusion set.
 *
 * No name resolution is performed; the user name will be matched against the
 * names in the inclusion set.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
 * an invalid tracker argument was provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name(
	const struct lttng_process_attr_tracker_handle *group_id_tracker,
	const char *virtual_group_name);

/*
 * Get the process attribute values that are part of a tracker's inclusion set.
 *
 * The values returned are a snapshot of the values that are part of the
 * tracker's inclusion set at the moment of the invocation; it is not updated
 * as entries are added or removed.
 *
 * The values remain valid until the tracker is destroyed.
 *
 * Returns LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID if the tracker's policy is
 * not LTTNG_POLICY_INCLUDE_SET.
 */
LTTNG_EXPORT extern enum lttng_process_attr_tracker_handle_status
lttng_process_attr_tracker_handle_get_inclusion_set(
	struct lttng_process_attr_tracker_handle *tracker_handle,
	const struct lttng_process_attr_values **values);

/*
 * Get the count of values within a set of process attribute values.
 *
 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID if an invalid argument is provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_values_status
lttng_process_attr_values_get_count(const struct lttng_process_attr_values *values,
				    unsigned int *count);

/*
 * Get the type of a process attribute value at a given index.
 *
 * Returns a process attribute value type on success,
 * LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID if an invalid argument is provided.
 */
LTTNG_EXPORT extern enum lttng_process_attr_value_type
lttng_process_attr_values_get_type_at_index(const struct lttng_process_attr_values *values,
					    unsigned int index);

/*
 * Get a process ID process attribute value.
 *
 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
 * is not a process ID.
 */
LTTNG_EXPORT extern enum lttng_process_attr_values_status
lttng_process_attr_values_get_pid_at_index(const struct lttng_process_attr_values *values,
					   unsigned int index,
					   pid_t *pid);

/*
 * Get a user ID process attribute value.
 *
 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
 * is not a user ID.
 */
LTTNG_EXPORT extern enum lttng_process_attr_values_status
lttng_process_attr_values_get_uid_at_index(const struct lttng_process_attr_values *values,
					   unsigned int index,
					   uid_t *uid);

/*
 * Get a user name process attribute value.
 *
 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
 * is not a user name.
 */
LTTNG_EXPORT extern enum lttng_process_attr_values_status
lttng_process_attr_values_get_user_name_at_index(const struct lttng_process_attr_values *values,
						 unsigned int index,
						 const char **user_name);

/*
 * Get a group ID process attribute value.
 *
 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
 * is not a group ID.
 */
LTTNG_EXPORT extern enum lttng_process_attr_values_status
lttng_process_attr_values_get_gid_at_index(const struct lttng_process_attr_values *values,
					   unsigned int index,
					   gid_t *gid);

/*
 * Get a group name process attribute value.
 *
 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
 * is not a group name.
 */
LTTNG_EXPORT extern enum lttng_process_attr_values_status
lttng_process_attr_values_get_group_name_at_index(const struct lttng_process_attr_values *values,
						  unsigned int index,
						  const char **group_name);

/* The following entry points are deprecated. */

/*
 * Deprecated: see `lttng_process_attr_tracker_handle_get_inclusion_set` and
 * `lttng_process_tracker_handle_get_tracking_policy`.
 *
 * List tracked PIDs.
 *
 * `enabled` indicates whether or not the PID tracker is enabled.
 *
 * `pids` is set to an allocated array of PIDs currently being tracked. On
 * success, `pids` must be freed by the caller.
 *
 * `nr_pids` is set to the number of entries contained in the `pids` array.
 *
 * Returns 0 on success, else a negative LTTng error code.
 */
LTTNG_EXPORT extern int
lttng_list_tracker_pids(struct lttng_handle *handle, int *enabled, int32_t **pids, size_t *nr_pids);

/*
 * Deprecated: see `lttng_process_attr_process_id_tracker_handle_add_pid`.
 *
 * Add PID to session tracker.
 *
 * A pid argument >= 0 adds the PID to the session's PID tracker.
 * A pid argument of -1 means "track all PIDs".
 *
 * Note on 'real' PIDs vs 'virtual' VPIDs:
 *   - With the user space domain specified, this function will add a VPID
 *     value to the virtual process ID process attribute tracker's inclusion
 *     set.
 *   - With the kernel space domain specified, this function will add a PID
 *     value to the process ID process attribute tracker's inclusion set.
 *
 * Returns 0 on success, else a negative LTTng error code.
 */
LTTNG_EXPORT extern int lttng_track_pid(struct lttng_handle *handle, int pid);

/*
 * Deprecated: see `lttng_process_attr_process_id_tracker_handle_remove_pid`.
 *
 * Remove PID from session tracker.
 *
 * A pid argument >= 0 removes the PID from the session's PID tracker.
 * A pid argument of -1 means "untrack all PIDs".
 *
 * Note on 'real' PIDs vs 'virtual' VPIDs:
 *   - With the user space domain specified, this function will remove a VPID
 *     value from the virtual process ID process attribute tracker's inclusion
 *     set.
 *   - With the kernel space domain specified, this function will remove a PID
 *     value from the process ID process attribute tracker's inclusion set.
 *
 * Returns 0 on success, else a negative LTTng error code.
 */
LTTNG_EXPORT extern int lttng_untrack_pid(struct lttng_handle *handle, int pid);

#ifdef __cplusplus
}
#endif

#endif /* LTTNG_TRACKER_H */