2 * Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 * Copyright (C) 2020 Jérémie Galarneau <jeremie.galarneau@efficios.com>
5 * SPDX-License-Identifier: LGPL-2.1-only
9 #ifndef LTTNG_TRACKER_H
10 #define LTTNG_TRACKER_H
12 #include <lttng/constant.h>
13 #include <lttng/domain.h>
14 #include <lttng/lttng-error.h>
15 #include <lttng/lttng-export.h>
16 #include <lttng/session.h>
18 #include <sys/types.h>
25 * Process attribute tracked by a tracker.
27 enum lttng_process_attr
{
28 /* Kernel space domain only. */
29 LTTNG_PROCESS_ATTR_PROCESS_ID
= 0,
30 /* Kernel and user space domains. */
31 LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID
= 1,
32 /* Kernel space domain only. */
33 LTTNG_PROCESS_ATTR_USER_ID
= 2,
34 /* Kernel and user space domains. */
35 LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID
= 3,
36 /* Kernel space domain only. */
37 LTTNG_PROCESS_ATTR_GROUP_ID
= 4,
38 /* Kernel and user space domains. */
39 LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID
= 5,
43 * Tracking (filtering) policy of a process attribute tracker.
45 enum lttng_tracking_policy
{
47 * Track all possible process attribute value of a given type
48 * (i.e. no filtering).
49 * This is the default state of a process attribute tracker.
51 LTTNG_TRACKING_POLICY_INCLUDE_ALL
= 0,
52 /* Exclude all possible process attribute values of a given type. */
53 LTTNG_TRACKING_POLICY_EXCLUDE_ALL
= 1,
54 /* Track a set of specific process attribute values. */
55 LTTNG_TRACKING_POLICY_INCLUDE_SET
= 2,
59 * Type of a process attribute value.
61 * This allows the use of the matching accessor given the type of a value.
63 enum lttng_process_attr_value_type
{
64 LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID
= -1,
65 LTTNG_PROCESS_ATTR_VALUE_TYPE_PID
= 0,
66 LTTNG_PROCESS_ATTR_VALUE_TYPE_UID
= 1,
67 LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME
= 2,
68 LTTNG_PROCESS_ATTR_VALUE_TYPE_GID
= 3,
69 LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME
= 4,
72 enum lttng_process_attr_tracker_handle_status
{
73 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_GROUP_NOT_FOUND
= -7,
74 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_USER_NOT_FOUND
= -6,
75 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID_TRACKING_POLICY
= -5,
76 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_SESSION_DOES_NOT_EXIST
= -4,
77 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_ERROR
= -3,
78 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_COMMUNICATION_ERROR
= -2,
79 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID
= -1,
80 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK
= 0,
81 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS
= 1,
82 LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_MISSING
= 2,
85 enum lttng_process_attr_values_status
{
86 LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE
= -2,
87 LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID
= -1,
88 LTTNG_PROCESS_ATTR_VALUES_STATUS_OK
= 0,
92 * A process attribute tracker handle.
94 * A process attribute tracker is an _inclusion set_ of process
95 * attribute values. Tracked processes are allowed to emit events,
96 * provided those events are targeted by enabled event rules.
98 * An LTTng session is created with a number of process attribute
99 * trackers by default. The process attributes that can be tracked vary by
100 * domain (see enum lttng_process_attr).
102 * Trackers are per-domain (user and kernel space) and allow the filtering
103 * of events based on a process's attributes.
105 struct lttng_process_attr_tracker_handle
;
107 /* A set of process attribute values. */
108 struct lttng_process_attr_values
;
111 * Get a handle to one of the process attribute trackers of a session's domain.
113 * Returns LTTNG_OK and a process attribute tracker handle on success,
114 * or an lttng_error_code on error.
116 * The tracker's ownership is transfered to the caller. Use
117 * lttng_process_attr_tracker_handle_destroy() to dispose of it.
119 LTTNG_EXPORT
extern enum lttng_error_code
120 lttng_session_get_tracker_handle(const char *session_name
,
121 enum lttng_domain_type domain
,
122 enum lttng_process_attr process_attr
,
123 struct lttng_process_attr_tracker_handle
**out_tracker_handle
);
126 * Destroy a process attribute tracker handle.
128 LTTNG_EXPORT
extern void
129 lttng_process_attr_tracker_handle_destroy(struct lttng_process_attr_tracker_handle
*tracker_handle
);
132 * Get the tracking policy of a process attribute tracker.
134 * Returns the LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK and the tracking
135 * policy of a process attribute tracker on success,
136 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID on error.
138 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
139 lttng_process_attr_tracker_handle_get_tracking_policy(
140 const struct lttng_process_attr_tracker_handle
*tracker_handle
,
141 enum lttng_tracking_policy
*policy
);
144 * Set the tracking policy of a process attribute tracker.
146 * Setting the tracking policy to the current tracking policy has no effect.
148 * Returns the LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success,
149 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID on error.
151 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
152 lttng_process_attr_tracker_handle_set_tracking_policy(
153 const struct lttng_process_attr_tracker_handle
*tracker_handle
,
154 enum lttng_tracking_policy policy
);
157 * Add a numerical PID to the process ID process attribute tracker inclusion
160 * Returns LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success,
161 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_EXISTS if it was already
162 * present in the inclusion set, and
163 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID if an invalid tracker
164 * argument was provided.
166 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
167 lttng_process_attr_process_id_tracker_handle_add_pid(
168 const struct lttng_process_attr_tracker_handle
*process_id_tracker
, pid_t pid
);
171 * Remove a numerical PID from the process ID process attribute tracker include
174 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
175 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
176 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
177 * an invalid tracker argument was provided.
179 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
180 lttng_process_attr_process_id_tracker_handle_remove_pid(
181 const struct lttng_process_attr_tracker_handle
*process_id_tracker
, pid_t pid
);
184 * Add a numerical PID to the virtual process ID process attribute tracker
187 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
188 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
189 * present in the inclusion set, and
190 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
191 * argument was provided.
193 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
194 lttng_process_attr_virtual_process_id_tracker_handle_add_pid(
195 const struct lttng_process_attr_tracker_handle
*process_id_tracker
, pid_t vpid
);
198 * Remove a numerical PID from the virtual process ID process attribute tracker
201 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
202 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
203 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
204 * an invalid tracker argument was provided.
206 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
207 lttng_process_attr_virtual_process_id_tracker_handle_remove_pid(
208 const struct lttng_process_attr_tracker_handle
*process_id_tracker
, pid_t vpid
);
211 * Add a numerical UID to the user ID process attribute tracker inclusion set.
213 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
214 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
215 * present in the inclusion set, and
216 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
217 * argument was provided.
219 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
220 lttng_process_attr_user_id_tracker_handle_add_uid(
221 const struct lttng_process_attr_tracker_handle
*user_id_tracker
, uid_t uid
);
224 * Remove a numerical UID from the user ID process attribute tracker include
227 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
228 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
229 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
230 * an invalid tracker argument was provided.
232 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
233 lttng_process_attr_user_id_tracker_handle_remove_uid(
234 const struct lttng_process_attr_tracker_handle
*user_id_tracker
, uid_t uid
);
237 * Add a user name to the user ID process attribute tracker inclusion set.
239 * The user name resolution is performed by the session daemon on addition to
240 * the user ID inclusion set.
242 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
243 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
244 * present in the inclusion set, and
245 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
246 * argument was provided.
248 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
249 lttng_process_attr_user_id_tracker_handle_add_user_name(
250 const struct lttng_process_attr_tracker_handle
*user_id_tracker
, const char *user_name
);
253 * Remove a user name from the user ID process attribute tracker include
256 * No name resolution is performed; the user name will be matched against the
257 * names in the inclusion set.
259 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
260 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
261 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
262 * an invalid tracker argument was provided.
264 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
265 lttng_process_attr_user_id_tracker_handle_remove_user_name(
266 const struct lttng_process_attr_tracker_handle
*user_id_tracker
, const char *user_name
);
269 * Add a numerical UID to the virtual user ID process attribute tracker
272 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
273 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
274 * present in the inclusion set, and
275 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
276 * argument was provided.
278 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
279 lttng_process_attr_virtual_user_id_tracker_handle_add_uid(
280 const struct lttng_process_attr_tracker_handle
*user_id_tracker
, uid_t vuid
);
283 * Remove a numerical UID from the virtual user ID process attribute tracker
286 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
287 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
288 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
289 * an invalid tracker argument was provided.
291 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
292 lttng_process_attr_virtual_user_id_tracker_handle_remove_uid(
293 const struct lttng_process_attr_tracker_handle
*user_id_tracker
, uid_t vuid
);
296 * Add a user name to the virtual user ID process attribute tracker include
299 * The user name resolution is performed by the session daemon on addition to
300 * the virtual user ID inclusion set.
302 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
303 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
304 * present in the inclusion set, and
305 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
306 * argument was provided.
308 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
309 lttng_process_attr_virtual_user_id_tracker_handle_add_user_name(
310 const struct lttng_process_attr_tracker_handle
*user_id_tracker
,
311 const char *virtual_user_name
);
314 * Remove a user name from the virtual user ID process attribute tracker
317 * No name resolution is performed; the user name will be matched against the
318 * names in the inclusion set.
320 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
321 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
322 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
323 * an invalid tracker argument was provided.
325 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
326 lttng_process_attr_virtual_user_id_tracker_handle_remove_user_name(
327 const struct lttng_process_attr_tracker_handle
*user_id_tracker
,
328 const char *virtual_user_name
);
331 * Add a numerical GID to the group ID process attribute tracker inclusion set.
333 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
334 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
335 * present in the inclusion set, and
336 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
337 * argument was provided.
339 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
340 lttng_process_attr_group_id_tracker_handle_add_gid(
341 const struct lttng_process_attr_tracker_handle
*group_id_tracker
, gid_t gid
);
344 * Remove a numerical GID from the group ID process attribute tracker include
347 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
348 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
349 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
350 * an invalid tracker argument was provided.
352 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
353 lttng_process_attr_group_id_tracker_handle_remove_gid(
354 const struct lttng_process_attr_tracker_handle
*group_id_tracker
, gid_t gid
);
357 * Add a group name to the group ID process attribute tracker inclusion set.
359 * The group name resolution is performed by the session daemon on addition to
360 * the group ID inclusion set.
362 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
363 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
364 * present in the inclusion set, and
365 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
366 * argument was provided.
368 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
369 lttng_process_attr_group_id_tracker_handle_add_group_name(
370 const struct lttng_process_attr_tracker_handle
*group_id_tracker
, const char *group_name
);
373 * Remove a group name from the group ID process attribute tracker include
376 * No name resolution is performed; the user name will be matched against the
377 * names in the inclusion set.
379 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
380 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
381 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
382 * an invalid tracker argument was provided.
384 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
385 lttng_process_attr_group_id_tracker_handle_remove_group_name(
386 const struct lttng_process_attr_tracker_handle
*group_id_tracker
, const char *group_name
);
389 * Add a numerical GID to the virtual group ID process attribute tracker
392 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
393 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
394 * present in the inclusion set, and
395 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
396 * argument was provided.
398 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
399 lttng_process_attr_virtual_group_id_tracker_handle_add_gid(
400 const struct lttng_process_attr_tracker_handle
*group_id_tracker
, gid_t vgid
);
403 * Remove a numerical GID from the virtual group ID process attribute tracker
406 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
407 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
408 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
409 * an invalid tracker argument was provided.
411 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
412 lttng_process_attr_virtual_group_id_tracker_handle_remove_gid(
413 const struct lttng_process_attr_tracker_handle
*group_id_tracker
, gid_t vgid
);
416 * Add a group name to the virtual group ID process attribute tracker include
419 * The group name resolution is performed by the session daemon on addition to
420 * the virtual group ID inclusion set.
422 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
423 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_EXISTS if it was already
424 * present in the inclusion set, and
425 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if an invalid tracker
426 * argument was provided.
428 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
429 lttng_process_attr_virtual_group_id_tracker_handle_add_group_name(
430 const struct lttng_process_attr_tracker_handle
*group_id_tracker
,
431 const char *virtual_group_name
);
434 * Remove a group name from the virtual group ID process attribute tracker
437 * No name resolution is performed; the user name will be matched against the
438 * names in the inclusion set.
440 * Returns LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_OK on success,
441 * LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_MISSING if it was not present
442 * in the inclusion set, and LTTNG_PROCESS_ATTR_TRACKED_HANDLE_STATUS_INVALID if
443 * an invalid tracker argument was provided.
445 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
446 lttng_process_attr_virtual_group_id_tracker_handle_remove_group_name(
447 const struct lttng_process_attr_tracker_handle
*group_id_tracker
,
448 const char *virtual_group_name
);
451 * Get the process attribute values that are part of a tracker's inclusion set.
453 * The values returned are a snapshot of the values that are part of the
454 * tracker's inclusion set at the moment of the invocation; it is not updated
455 * as entries are added or removed.
457 * The values remain valid until the tracker is destroyed.
459 * Returns LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_OK on success,
460 * LTTNG_PROCESS_ATTR_TRACKER_HANDLE_STATUS_INVALID if the tracker's policy is
461 * not LTTNG_POLICY_INCLUDE_SET.
463 LTTNG_EXPORT
extern enum lttng_process_attr_tracker_handle_status
464 lttng_process_attr_tracker_handle_get_inclusion_set(
465 struct lttng_process_attr_tracker_handle
*tracker_handle
,
466 const struct lttng_process_attr_values
**values
);
469 * Get the count of values within a set of process attribute values.
471 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
472 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID if an invalid argument is provided.
474 LTTNG_EXPORT
extern enum lttng_process_attr_values_status
475 lttng_process_attr_values_get_count(const struct lttng_process_attr_values
*values
,
476 unsigned int *count
);
479 * Get the type of a process attribute value at a given index.
481 * Returns a process attribute value type on success,
482 * LTTNG_PROCESS_ATTR_VALUE_TYPE_INVALID if an invalid argument is provided.
484 LTTNG_EXPORT
extern enum lttng_process_attr_value_type
485 lttng_process_attr_values_get_type_at_index(const struct lttng_process_attr_values
*values
,
489 * Get a process ID process attribute value.
491 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
492 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
493 * is not a process ID.
495 LTTNG_EXPORT
extern enum lttng_process_attr_values_status
496 lttng_process_attr_values_get_pid_at_index(const struct lttng_process_attr_values
*values
,
501 * Get a user ID process attribute value.
503 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
504 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
507 LTTNG_EXPORT
extern enum lttng_process_attr_values_status
508 lttng_process_attr_values_get_uid_at_index(const struct lttng_process_attr_values
*values
,
513 * Get a user name process attribute value.
515 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
516 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
517 * is not a user name.
519 LTTNG_EXPORT
extern enum lttng_process_attr_values_status
520 lttng_process_attr_values_get_user_name_at_index(const struct lttng_process_attr_values
*values
,
522 const char **user_name
);
525 * Get a group ID process attribute value.
527 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
528 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
531 LTTNG_EXPORT
extern enum lttng_process_attr_values_status
532 lttng_process_attr_values_get_gid_at_index(const struct lttng_process_attr_values
*values
,
537 * Get a group name process attribute value.
539 * Returns LTTNG_PROCESS_ATTR_VALUES_STATUS_OK on success,
540 * LTTNG_PROCESS_ATTR_VALUES_STATUS_INVALID_TYPE if the process attribute value
541 * is not a group name.
543 LTTNG_EXPORT
extern enum lttng_process_attr_values_status
544 lttng_process_attr_values_get_group_name_at_index(const struct lttng_process_attr_values
*values
,
546 const char **group_name
);
548 /* The following entry points are deprecated. */
551 * Deprecated: see `lttng_process_attr_tracker_handle_get_inclusion_set` and
552 * `lttng_process_tracker_handle_get_tracking_policy`.
556 * `enabled` indicates whether or not the PID tracker is enabled.
558 * `pids` is set to an allocated array of PIDs currently being tracked. On
559 * success, `pids` must be freed by the caller.
561 * `nr_pids` is set to the number of entries contained in the `pids` array.
563 * Returns 0 on success, else a negative LTTng error code.
565 LTTNG_EXPORT
extern int
566 lttng_list_tracker_pids(struct lttng_handle
*handle
, int *enabled
, int32_t **pids
, size_t *nr_pids
);
569 * Deprecated: see `lttng_process_attr_process_id_tracker_handle_add_pid`.
571 * Add PID to session tracker.
573 * A pid argument >= 0 adds the PID to the session's PID tracker.
574 * A pid argument of -1 means "track all PIDs".
576 * Note on 'real' PIDs vs 'virtual' VPIDs:
577 * - With the user space domain specified, this function will add a VPID
578 * value to the virtual process ID process attribute tracker's inclusion
580 * - With the kernel space domain specified, this function will add a PID
581 * value to the process ID process attribute tracker's inclusion set.
583 * Returns 0 on success, else a negative LTTng error code.
585 LTTNG_EXPORT
extern int lttng_track_pid(struct lttng_handle
*handle
, int pid
);
588 * Deprecated: see `lttng_process_attr_process_id_tracker_handle_remove_pid`.
590 * Remove PID from session tracker.
592 * A pid argument >= 0 removes the PID from the session's PID tracker.
593 * A pid argument of -1 means "untrack all PIDs".
595 * Note on 'real' PIDs vs 'virtual' VPIDs:
596 * - With the user space domain specified, this function will remove a VPID
597 * value from the virtual process ID process attribute tracker's inclusion
599 * - With the kernel space domain specified, this function will remove a PID
600 * value from the process ID process attribute tracker's inclusion set.
602 * Returns 0 on success, else a negative LTTng error code.
604 LTTNG_EXPORT
extern int lttng_untrack_pid(struct lttng_handle
*handle
, int pid
);
610 #endif /* LTTNG_TRACKER_H */