2 * Copyright (C) 2011 EfficiOS Inc.
4 * SPDX-License-Identifier: GPL-2.0-only
8 #include "bin/lttng-sessiond/tracker.h"
9 #include "common/tracker.h"
10 #include "common/utils.h"
11 #include "lttng/event.h"
12 #include "lttng/lttng-error.h"
13 #include "lttng/tracker.h"
21 #include <sys/types.h>
23 #include <common/common.h>
24 #include <common/trace-chunk.h>
25 #include <common/kernel-ctl/kernel-ctl.h>
26 #include <common/kernel-ctl/kernel-ioctl.h>
27 #include <common/sessiond-comm/sessiond-comm.h>
29 #include "lttng-sessiond.h"
30 #include "lttng-syscall.h"
33 #include "kernel-consumer.h"
34 #include "kern-modules.h"
40 * Key used to reference a channel between the sessiond and the consumer. This
41 * is only read and updated with the session_list lock held.
43 static uint64_t next_kernel_channel_key
;
45 static const char *module_proc_lttng
= "/proc/lttng";
47 static int kernel_tracer_fd
= -1;
49 #include <lttng/userspace-probe.h>
50 #include <lttng/userspace-probe-internal.h>
52 * On some architectures, calling convention details are embedded in the symbol
53 * addresses. Uprobe requires a "clean" symbol offset (or at least, an address
54 * where an instruction boundary would be legal) to add
55 * instrumentation. sanitize_uprobe_offset implements that sanitization logic on
56 * a per-architecture basis.
58 #if defined(__arm__) || defined(__aarch64__)
59 static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset
)
62 * The least significant bit is used when branching to switch to thumb
63 * ISA. However, it's an invalid address for us; mask the least
66 return raw_offset
&= ~0b1;
68 #else /* defined(__arm__) || defined(__aarch64__) */
69 static inline uint64_t sanitize_uprobe_offset(uint64_t raw_offset
)
76 * Add context on a kernel channel.
78 * Assumes the ownership of ctx.
80 int kernel_add_channel_context(struct ltt_kernel_channel
*chan
,
81 struct ltt_kernel_context
*ctx
)
88 DBG("Adding context to channel %s", chan
->channel
->name
);
89 ret
= kernctl_add_context(chan
->fd
, &ctx
->ctx
);
93 /* Exists but not available for this kernel */
94 ret
= LTTNG_ERR_KERN_CONTEXT_UNAVAILABLE
;
97 /* If EEXIST, we just ignore the error */
101 PERROR("add context ioctl");
102 ret
= LTTNG_ERR_KERN_CONTEXT_FAIL
;
109 cds_list_add_tail(&ctx
->list
, &chan
->ctx_list
);
114 trace_kernel_destroy_context(ctx
);
120 * Create a new kernel session, register it to the kernel tracer and add it to
121 * the session daemon session.
123 int kernel_create_session(struct ltt_session
*session
)
126 struct ltt_kernel_session
*lks
;
130 /* Allocate data structure */
131 lks
= trace_kernel_create_session();
137 /* Kernel tracer session creation */
138 ret
= kernctl_create_session(kernel_tracer_fd
);
140 PERROR("ioctl kernel create session");
145 /* Prevent fd duplication after execlp() */
146 ret
= fcntl(lks
->fd
, F_SETFD
, FD_CLOEXEC
);
148 PERROR("fcntl session fd");
151 lks
->id
= session
->id
;
152 lks
->consumer_fds_sent
= 0;
153 session
->kernel_session
= lks
;
155 DBG("Kernel session created (fd: %d)", lks
->fd
);
158 * This is necessary since the creation time is present in the session
159 * name when it is generated.
161 if (session
->has_auto_generated_name
) {
162 ret
= kernctl_session_set_name(lks
->fd
, DEFAULT_SESSION_NAME
);
164 ret
= kernctl_session_set_name(lks
->fd
, session
->name
);
167 WARN("Could not set kernel session name for session %" PRIu64
" name: %s",
168 session
->id
, session
->name
);
171 ret
= kernctl_session_set_creation_time(lks
->fd
, session
->creation_time
);
173 WARN("Could not set kernel session creation time for session %" PRIu64
" name: %s",
174 session
->id
, session
->name
);
181 trace_kernel_destroy_session(lks
);
182 trace_kernel_free_session(lks
);
188 * Create a kernel channel, register it to the kernel tracer and add it to the
191 int kernel_create_channel(struct ltt_kernel_session
*session
,
192 struct lttng_channel
*chan
)
195 struct ltt_kernel_channel
*lkc
;
200 /* Allocate kernel channel */
201 lkc
= trace_kernel_create_channel(chan
);
206 DBG3("Kernel create channel %s with attr: %d, %" PRIu64
", %" PRIu64
", %u, %u, %d, %d",
207 chan
->name
, lkc
->channel
->attr
.overwrite
,
208 lkc
->channel
->attr
.subbuf_size
, lkc
->channel
->attr
.num_subbuf
,
209 lkc
->channel
->attr
.switch_timer_interval
, lkc
->channel
->attr
.read_timer_interval
,
210 lkc
->channel
->attr
.live_timer_interval
, lkc
->channel
->attr
.output
);
212 /* Kernel tracer channel creation */
213 ret
= kernctl_create_channel(session
->fd
, &lkc
->channel
->attr
);
215 PERROR("ioctl kernel create channel");
219 /* Setup the channel fd */
221 /* Prevent fd duplication after execlp() */
222 ret
= fcntl(lkc
->fd
, F_SETFD
, FD_CLOEXEC
);
224 PERROR("fcntl session fd");
227 /* Add channel to session */
228 cds_list_add(&lkc
->list
, &session
->channel_list
.head
);
229 session
->channel_count
++;
230 lkc
->session
= session
;
231 lkc
->key
= ++next_kernel_channel_key
;
233 DBG("Kernel channel %s created (fd: %d, key: %" PRIu64
")",
234 lkc
->channel
->name
, lkc
->fd
, lkc
->key
);
247 * Compute the offset of the instrumentation byte in the binary based on the
248 * function probe location using the ELF lookup method.
250 * Returns 0 on success and set the offset out parameter to the offset of the
252 * Returns -1 on error
255 int extract_userspace_probe_offset_function_elf(
256 const struct lttng_userspace_probe_location
*probe_location
,
257 struct ltt_kernel_session
*session
, uint64_t *offset
)
261 const char *symbol
= NULL
;
262 const struct lttng_userspace_probe_location_lookup_method
*lookup
= NULL
;
263 enum lttng_userspace_probe_location_lookup_method_type lookup_method_type
;
265 assert(lttng_userspace_probe_location_get_type(probe_location
) ==
266 LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION
);
268 lookup
= lttng_userspace_probe_location_get_lookup_method(
276 lttng_userspace_probe_location_lookup_method_get_type(lookup
);
278 assert(lookup_method_type
==
279 LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF
);
281 symbol
= lttng_userspace_probe_location_function_get_function_name(
288 fd
= lttng_userspace_probe_location_function_get_binary_fd(probe_location
);
294 ret
= run_as_extract_elf_symbol_offset(fd
, symbol
, session
->uid
,
295 session
->gid
, offset
);
297 DBG("userspace probe offset calculation failed for "
298 "function %s", symbol
);
302 DBG("userspace probe elf offset for %s is 0x%jd", symbol
, (intmax_t)(*offset
));
308 * Compute the offsets of the instrumentation bytes in the binary based on the
309 * tracepoint probe location using the SDT lookup method. This function
310 * allocates the offsets buffer, the caller must free it.
312 * Returns 0 on success and set the offset out parameter to the offsets of the
314 * Returns -1 on error.
317 int extract_userspace_probe_offset_tracepoint_sdt(
318 const struct lttng_userspace_probe_location
*probe_location
,
319 struct ltt_kernel_session
*session
, uint64_t **offsets
,
320 uint32_t *offsets_count
)
322 enum lttng_userspace_probe_location_lookup_method_type lookup_method_type
;
323 const struct lttng_userspace_probe_location_lookup_method
*lookup
= NULL
;
324 const char *probe_name
= NULL
, *provider_name
= NULL
;
328 assert(lttng_userspace_probe_location_get_type(probe_location
) ==
329 LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT
);
331 lookup
= lttng_userspace_probe_location_get_lookup_method(probe_location
);
338 lttng_userspace_probe_location_lookup_method_get_type(lookup
);
340 assert(lookup_method_type
==
341 LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT
);
344 probe_name
= lttng_userspace_probe_location_tracepoint_get_probe_name(
351 provider_name
= lttng_userspace_probe_location_tracepoint_get_provider_name(
353 if (!provider_name
) {
358 fd
= lttng_userspace_probe_location_tracepoint_get_binary_fd(probe_location
);
364 ret
= run_as_extract_sdt_probe_offsets(fd
, provider_name
, probe_name
,
365 session
->uid
, session
->gid
, offsets
, offsets_count
);
367 DBG("userspace probe offset calculation failed for sdt "
368 "probe %s:%s", provider_name
, probe_name
);
372 if (*offsets_count
== 0) {
373 DBG("no userspace probe offset found");
377 DBG("%u userspace probe SDT offsets found for %s:%s at:",
378 *offsets_count
, provider_name
, probe_name
);
379 for (i
= 0; i
< *offsets_count
; i
++) {
380 DBG("\t0x%jd", (intmax_t)((*offsets
)[i
]));
387 * Extract the offsets of the instrumentation point for the different lookup
391 int userspace_probe_add_callsites(struct lttng_event
*ev
,
392 struct ltt_kernel_session
*session
, int fd
)
394 const struct lttng_userspace_probe_location_lookup_method
*lookup_method
= NULL
;
395 enum lttng_userspace_probe_location_lookup_method_type type
;
396 const struct lttng_userspace_probe_location
*location
= NULL
;
400 assert(ev
->type
== LTTNG_EVENT_USERSPACE_PROBE
);
402 location
= lttng_event_get_userspace_probe_location(ev
);
408 lttng_userspace_probe_location_get_lookup_method(location
);
409 if (!lookup_method
) {
414 type
= lttng_userspace_probe_location_lookup_method_get_type(lookup_method
);
416 case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF
:
418 struct lttng_kernel_event_callsite callsite
;
421 ret
= extract_userspace_probe_offset_function_elf(location
, session
, &offset
);
423 ret
= LTTNG_ERR_PROBE_LOCATION_INVAL
;
427 callsite
.u
.uprobe
.offset
= sanitize_uprobe_offset(offset
);
428 ret
= kernctl_add_callsite(fd
, &callsite
);
430 WARN("Adding callsite to userspace probe "
431 "event %s failed.", ev
->name
);
432 ret
= LTTNG_ERR_KERN_ENABLE_FAIL
;
437 case LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT
:
440 uint64_t *offsets
= NULL
;
441 uint32_t offsets_count
;
442 struct lttng_kernel_event_callsite callsite
;
445 * This call allocates the offsets buffer. This buffer must be freed
448 ret
= extract_userspace_probe_offset_tracepoint_sdt(location
, session
,
449 &offsets
, &offsets_count
);
451 ret
= LTTNG_ERR_PROBE_LOCATION_INVAL
;
454 for (i
= 0; i
< offsets_count
; i
++) {
455 callsite
.u
.uprobe
.offset
= sanitize_uprobe_offset(offsets
[i
]);
456 ret
= kernctl_add_callsite(fd
, &callsite
);
458 WARN("Adding callsite to userspace probe "
459 "event %s failed.", ev
->name
);
460 ret
= LTTNG_ERR_KERN_ENABLE_FAIL
;
469 ret
= LTTNG_ERR_PROBE_LOCATION_INVAL
;
477 * Create a kernel event, enable it to the kernel tracer and add it to the
478 * channel event list of the kernel session.
479 * We own filter_expression and filter.
481 int kernel_create_event(struct lttng_event
*ev
,
482 struct ltt_kernel_channel
*channel
,
483 char *filter_expression
,
484 struct lttng_filter_bytecode
*filter
)
487 enum lttng_error_code ret
;
488 struct ltt_kernel_event
*event
;
493 /* We pass ownership of filter_expression and filter */
494 ret
= trace_kernel_create_event(ev
, filter_expression
,
496 if (ret
!= LTTNG_OK
) {
500 fd
= kernctl_create_event(channel
->fd
, event
->event
);
504 ret
= LTTNG_ERR_KERN_EVENT_EXIST
;
507 WARN("Event type not implemented");
508 ret
= LTTNG_ERR_KERN_EVENT_ENOSYS
;
511 WARN("Event %s not found!", ev
->name
);
512 ret
= LTTNG_ERR_KERN_ENABLE_FAIL
;
515 ret
= LTTNG_ERR_KERN_ENABLE_FAIL
;
516 PERROR("create event ioctl");
521 event
->type
= ev
->type
;
523 /* Prevent fd duplication after execlp() */
524 err
= fcntl(event
->fd
, F_SETFD
, FD_CLOEXEC
);
526 PERROR("fcntl session fd");
530 err
= kernctl_filter(event
->fd
, filter
);
534 ret
= LTTNG_ERR_FILTER_NOMEM
;
537 ret
= LTTNG_ERR_FILTER_INVAL
;
544 if (ev
->type
== LTTNG_EVENT_USERSPACE_PROBE
) {
545 ret
= userspace_probe_add_callsites(ev
, channel
->session
, event
->fd
);
547 goto add_callsite_error
;
551 err
= kernctl_enable(event
->fd
);
555 ret
= LTTNG_ERR_KERN_EVENT_EXIST
;
558 PERROR("enable kernel event");
559 ret
= LTTNG_ERR_KERN_ENABLE_FAIL
;
565 /* Add event to event list */
566 cds_list_add(&event
->list
, &channel
->events_list
.head
);
567 channel
->event_count
++;
569 DBG("Event %s created (fd: %d)", ev
->name
, event
->fd
);
579 closeret
= close(event
->fd
);
581 PERROR("close event fd");
591 * Disable a kernel channel.
593 int kernel_disable_channel(struct ltt_kernel_channel
*chan
)
599 ret
= kernctl_disable(chan
->fd
);
601 PERROR("disable chan ioctl");
606 DBG("Kernel channel %s disabled (fd: %d, key: %" PRIu64
")",
607 chan
->channel
->name
, chan
->fd
, chan
->key
);
616 * Enable a kernel channel.
618 int kernel_enable_channel(struct ltt_kernel_channel
*chan
)
624 ret
= kernctl_enable(chan
->fd
);
625 if (ret
< 0 && ret
!= -EEXIST
) {
626 PERROR("Enable kernel chan");
631 DBG("Kernel channel %s enabled (fd: %d, key: %" PRIu64
")",
632 chan
->channel
->name
, chan
->fd
, chan
->key
);
641 * Enable a kernel event.
643 int kernel_enable_event(struct ltt_kernel_event
*event
)
649 ret
= kernctl_enable(event
->fd
);
653 ret
= LTTNG_ERR_KERN_EVENT_EXIST
;
656 PERROR("enable kernel event");
663 DBG("Kernel event %s enabled (fd: %d)", event
->event
->name
, event
->fd
);
672 * Disable a kernel event.
674 int kernel_disable_event(struct ltt_kernel_event
*event
)
680 ret
= kernctl_disable(event
->fd
);
682 PERROR("Failed to disable kernel event: name = '%s', fd = %d",
683 event
->event
->name
, event
->fd
);
688 DBG("Kernel event %s disabled (fd: %d)", event
->event
->name
, event
->fd
);
697 struct process_attr_tracker
*_kernel_get_process_attr_tracker(
698 struct ltt_kernel_session
*session
,
699 enum lttng_process_attr process_attr
)
701 switch (process_attr
) {
702 case LTTNG_PROCESS_ATTR_PROCESS_ID
:
703 return session
->tracker_pid
;
704 case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID
:
705 return session
->tracker_vpid
;
706 case LTTNG_PROCESS_ATTR_USER_ID
:
707 return session
->tracker_uid
;
708 case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID
:
709 return session
->tracker_vuid
;
710 case LTTNG_PROCESS_ATTR_GROUP_ID
:
711 return session
->tracker_gid
;
712 case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID
:
713 return session
->tracker_vgid
;
719 const struct process_attr_tracker
*kernel_get_process_attr_tracker(
720 struct ltt_kernel_session
*session
,
721 enum lttng_process_attr process_attr
)
723 return (const struct process_attr_tracker
*)
724 _kernel_get_process_attr_tracker(session
, process_attr
);
727 enum lttng_error_code
kernel_process_attr_tracker_set_tracking_policy(
728 struct ltt_kernel_session
*session
,
729 enum lttng_process_attr process_attr
,
730 enum lttng_tracking_policy policy
)
733 enum lttng_error_code ret_code
= LTTNG_OK
;
734 struct process_attr_tracker
*tracker
=
735 _kernel_get_process_attr_tracker(session
, process_attr
);
736 enum lttng_tracking_policy previous_policy
;
739 ret_code
= LTTNG_ERR_INVALID
;
743 previous_policy
= process_attr_tracker_get_tracking_policy(tracker
);
744 ret
= process_attr_tracker_set_tracking_policy(tracker
, policy
);
746 ret_code
= LTTNG_ERR_UNK
;
750 if (previous_policy
== policy
) {
755 case LTTNG_TRACKING_POLICY_INCLUDE_ALL
:
756 if (process_attr
== LTTNG_PROCESS_ATTR_PROCESS_ID
) {
758 * Maintain a special case for the process ID process
759 * attribute tracker as it was the only supported
760 * attribute prior to 2.12.
762 ret
= kernctl_track_pid(session
->fd
, -1);
764 ret
= kernctl_track_id(session
->fd
, process_attr
, -1);
767 case LTTNG_TRACKING_POLICY_EXCLUDE_ALL
:
768 case LTTNG_TRACKING_POLICY_INCLUDE_SET
:
770 if (process_attr
== LTTNG_PROCESS_ATTR_PROCESS_ID
) {
772 * Maintain a special case for the process ID process
773 * attribute tracker as it was the only supported
774 * attribute prior to 2.12.
776 ret
= kernctl_untrack_pid(session
->fd
, -1);
778 ret
= kernctl_untrack_id(session
->fd
, process_attr
, -1);
784 /* kern-ctl error handling */
790 ret_code
= LTTNG_ERR_INVALID
;
793 ret_code
= LTTNG_ERR_NOMEM
;
796 ret_code
= LTTNG_ERR_PROCESS_ATTR_EXISTS
;
799 ret_code
= LTTNG_ERR_UNK
;
806 enum lttng_error_code
kernel_process_attr_tracker_inclusion_set_add_value(
807 struct ltt_kernel_session
*session
,
808 enum lttng_process_attr process_attr
,
809 const struct process_attr_value
*value
)
811 int ret
, integral_value
;
812 enum lttng_error_code ret_code
;
813 struct process_attr_tracker
*tracker
;
814 enum process_attr_tracker_status status
;
817 * Convert process attribute tracker value to the integral
818 * representation required by the kern-ctl API.
820 switch (process_attr
) {
821 case LTTNG_PROCESS_ATTR_PROCESS_ID
:
822 case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID
:
823 integral_value
= (int) value
->value
.pid
;
825 case LTTNG_PROCESS_ATTR_USER_ID
:
826 case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID
:
827 if (value
->type
== LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME
) {
830 ret_code
= utils_user_id_from_name(
831 value
->value
.user_name
, &uid
);
832 if (ret_code
!= LTTNG_OK
) {
835 integral_value
= (int) uid
;
837 integral_value
= (int) value
->value
.uid
;
840 case LTTNG_PROCESS_ATTR_GROUP_ID
:
841 case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID
:
842 if (value
->type
== LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME
) {
845 ret_code
= utils_group_id_from_name(
846 value
->value
.group_name
, &gid
);
847 if (ret_code
!= LTTNG_OK
) {
850 integral_value
= (int) gid
;
852 integral_value
= (int) value
->value
.gid
;
856 ret_code
= LTTNG_ERR_INVALID
;
860 tracker
= _kernel_get_process_attr_tracker(session
, process_attr
);
862 ret_code
= LTTNG_ERR_INVALID
;
866 status
= process_attr_tracker_inclusion_set_add_value(tracker
, value
);
867 if (status
!= PROCESS_ATTR_TRACKER_STATUS_OK
) {
869 case PROCESS_ATTR_TRACKER_STATUS_EXISTS
:
870 ret_code
= LTTNG_ERR_PROCESS_ATTR_EXISTS
;
872 case PROCESS_ATTR_TRACKER_STATUS_INVALID_TRACKING_POLICY
:
873 ret_code
= LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY
;
875 case PROCESS_ATTR_TRACKER_STATUS_ERROR
:
877 ret_code
= LTTNG_ERR_UNK
;
883 DBG("Kernel track %s %d for session id %" PRIu64
,
884 lttng_process_attr_to_string(process_attr
),
885 integral_value
, session
->id
);
886 if (process_attr
== LTTNG_PROCESS_ATTR_PROCESS_ID
) {
888 * Maintain a special case for the process ID process attribute
889 * tracker as it was the only supported attribute prior to 2.12.
891 ret
= kernctl_track_pid(session
->fd
, integral_value
);
893 ret
= kernctl_track_id(
894 session
->fd
, process_attr
, integral_value
);
901 kernel_wait_quiescent();
903 /* kern-ctl error handling */
909 ret_code
= LTTNG_ERR_INVALID
;
912 ret_code
= LTTNG_ERR_NOMEM
;
915 ret_code
= LTTNG_ERR_PROCESS_ATTR_EXISTS
;
918 ret_code
= LTTNG_ERR_UNK
;
922 /* Attempt to remove the value from the tracker. */
923 status
= process_attr_tracker_inclusion_set_remove_value(
925 if (status
!= PROCESS_ATTR_TRACKER_STATUS_OK
) {
926 ERR("Failed to roll-back the tracking of kernel %s process attribute %d while handling a kern-ctl error",
927 lttng_process_attr_to_string(process_attr
),
934 enum lttng_error_code
kernel_process_attr_tracker_inclusion_set_remove_value(
935 struct ltt_kernel_session
*session
,
936 enum lttng_process_attr process_attr
,
937 const struct process_attr_value
*value
)
939 int ret
, integral_value
;
940 enum lttng_error_code ret_code
;
941 struct process_attr_tracker
*tracker
;
942 enum process_attr_tracker_status status
;
945 * Convert process attribute tracker value to the integral
946 * representation required by the kern-ctl API.
948 switch (process_attr
) {
949 case LTTNG_PROCESS_ATTR_PROCESS_ID
:
950 case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID
:
951 integral_value
= (int) value
->value
.pid
;
953 case LTTNG_PROCESS_ATTR_USER_ID
:
954 case LTTNG_PROCESS_ATTR_VIRTUAL_USER_ID
:
955 if (value
->type
== LTTNG_PROCESS_ATTR_VALUE_TYPE_USER_NAME
) {
958 ret_code
= utils_user_id_from_name(
959 value
->value
.user_name
, &uid
);
960 if (ret_code
!= LTTNG_OK
) {
963 integral_value
= (int) uid
;
965 integral_value
= (int) value
->value
.uid
;
968 case LTTNG_PROCESS_ATTR_GROUP_ID
:
969 case LTTNG_PROCESS_ATTR_VIRTUAL_GROUP_ID
:
970 if (value
->type
== LTTNG_PROCESS_ATTR_VALUE_TYPE_GROUP_NAME
) {
973 ret_code
= utils_group_id_from_name(
974 value
->value
.group_name
, &gid
);
975 if (ret_code
!= LTTNG_OK
) {
978 integral_value
= (int) gid
;
980 integral_value
= (int) value
->value
.gid
;
984 ret_code
= LTTNG_ERR_INVALID
;
988 tracker
= _kernel_get_process_attr_tracker(session
, process_attr
);
990 ret_code
= LTTNG_ERR_INVALID
;
994 status
= process_attr_tracker_inclusion_set_remove_value(
996 if (status
!= PROCESS_ATTR_TRACKER_STATUS_OK
) {
998 case PROCESS_ATTR_TRACKER_STATUS_MISSING
:
999 ret_code
= LTTNG_ERR_PROCESS_ATTR_MISSING
;
1001 case PROCESS_ATTR_TRACKER_STATUS_INVALID_TRACKING_POLICY
:
1002 ret_code
= LTTNG_ERR_PROCESS_ATTR_TRACKER_INVALID_TRACKING_POLICY
;
1004 case PROCESS_ATTR_TRACKER_STATUS_ERROR
:
1006 ret_code
= LTTNG_ERR_UNK
;
1012 DBG("Kernel track %s %d for session id %" PRIu64
,
1013 lttng_process_attr_to_string(process_attr
),
1014 integral_value
, session
->id
);
1015 if (process_attr
== LTTNG_PROCESS_ATTR_PROCESS_ID
) {
1017 * Maintain a special case for the process ID process attribute
1018 * tracker as it was the only supported attribute prior to 2.12.
1020 ret
= kernctl_untrack_pid(session
->fd
, integral_value
);
1022 ret
= kernctl_untrack_id(
1023 session
->fd
, process_attr
, integral_value
);
1026 ret_code
= LTTNG_OK
;
1029 kernel_wait_quiescent();
1031 /* kern-ctl error handling */
1034 ret_code
= LTTNG_OK
;
1037 ret_code
= LTTNG_ERR_INVALID
;
1040 ret_code
= LTTNG_ERR_NOMEM
;
1043 ret_code
= LTTNG_ERR_PROCESS_ATTR_MISSING
;
1046 ret_code
= LTTNG_ERR_UNK
;
1050 /* Attempt to add the value to the tracker. */
1051 status
= process_attr_tracker_inclusion_set_add_value(
1053 if (status
!= PROCESS_ATTR_TRACKER_STATUS_OK
) {
1054 ERR("Failed to roll-back the tracking of kernel %s process attribute %d while handling a kern-ctl error",
1055 lttng_process_attr_to_string(process_attr
),
1063 * Create kernel metadata, open from the kernel tracer and add it to the
1066 int kernel_open_metadata(struct ltt_kernel_session
*session
)
1069 struct ltt_kernel_metadata
*lkm
= NULL
;
1073 /* Allocate kernel metadata */
1074 lkm
= trace_kernel_create_metadata();
1079 /* Kernel tracer metadata creation */
1080 ret
= kernctl_open_metadata(session
->fd
, &lkm
->conf
->attr
);
1086 lkm
->key
= ++next_kernel_channel_key
;
1087 /* Prevent fd duplication after execlp() */
1088 ret
= fcntl(lkm
->fd
, F_SETFD
, FD_CLOEXEC
);
1090 PERROR("fcntl session fd");
1093 session
->metadata
= lkm
;
1095 DBG("Kernel metadata opened (fd: %d)", lkm
->fd
);
1100 trace_kernel_destroy_metadata(lkm
);
1106 * Start tracing session.
1108 int kernel_start_session(struct ltt_kernel_session
*session
)
1114 ret
= kernctl_start_session(session
->fd
);
1116 PERROR("ioctl start session");
1120 DBG("Kernel session started");
1129 * Make a kernel wait to make sure in-flight probe have completed.
1131 void kernel_wait_quiescent(void)
1134 int fd
= kernel_tracer_fd
;
1136 DBG("Kernel quiescent wait on %d", fd
);
1138 ret
= kernctl_wait_quiescent(fd
);
1140 PERROR("wait quiescent ioctl");
1141 ERR("Kernel quiescent wait failed");
1146 * Force flush buffer of metadata.
1148 int kernel_metadata_flush_buffer(int fd
)
1152 DBG("Kernel flushing metadata buffer on fd %d", fd
);
1154 ret
= kernctl_buffer_flush(fd
);
1156 ERR("Fail to flush metadata buffers %d (ret: %d)", fd
, ret
);
1163 * Force flush buffer for channel.
1165 int kernel_flush_buffer(struct ltt_kernel_channel
*channel
)
1168 struct ltt_kernel_stream
*stream
;
1172 DBG("Flush buffer for channel %s", channel
->channel
->name
);
1174 cds_list_for_each_entry(stream
, &channel
->stream_list
.head
, list
) {
1175 DBG("Flushing channel stream %d", stream
->fd
);
1176 ret
= kernctl_buffer_flush(stream
->fd
);
1179 ERR("Fail to flush buffer for stream %d (ret: %d)",
1188 * Stop tracing session.
1190 int kernel_stop_session(struct ltt_kernel_session
*session
)
1196 ret
= kernctl_stop_session(session
->fd
);
1201 DBG("Kernel session stopped");
1210 * Open stream of channel, register it to the kernel tracer and add it
1211 * to the stream list of the channel.
1213 * Note: given that the streams may appear in random order wrt CPU
1214 * number (e.g. cpu hotplug), the index value of the stream number in
1215 * the stream name is not necessarily linked to the CPU number.
1217 * Return the number of created stream. Else, a negative value.
1219 int kernel_open_channel_stream(struct ltt_kernel_channel
*channel
)
1222 struct ltt_kernel_stream
*lks
;
1226 while ((ret
= kernctl_create_stream(channel
->fd
)) >= 0) {
1227 lks
= trace_kernel_create_stream(channel
->channel
->name
,
1228 channel
->stream_count
);
1238 /* Prevent fd duplication after execlp() */
1239 ret
= fcntl(lks
->fd
, F_SETFD
, FD_CLOEXEC
);
1241 PERROR("fcntl session fd");
1244 lks
->tracefile_size
= channel
->channel
->attr
.tracefile_size
;
1245 lks
->tracefile_count
= channel
->channel
->attr
.tracefile_count
;
1247 /* Add stream to channel stream list */
1248 cds_list_add(&lks
->list
, &channel
->stream_list
.head
);
1249 channel
->stream_count
++;
1251 DBG("Kernel stream %s created (fd: %d, state: %d)", lks
->name
, lks
->fd
,
1255 return channel
->stream_count
;
1262 * Open the metadata stream and set it to the kernel session.
1264 int kernel_open_metadata_stream(struct ltt_kernel_session
*session
)
1270 ret
= kernctl_create_stream(session
->metadata
->fd
);
1272 PERROR("kernel create metadata stream");
1276 DBG("Kernel metadata stream created (fd: %d)", ret
);
1277 session
->metadata_stream_fd
= ret
;
1278 /* Prevent fd duplication after execlp() */
1279 ret
= fcntl(session
->metadata_stream_fd
, F_SETFD
, FD_CLOEXEC
);
1281 PERROR("fcntl session fd");
1291 * Get the event list from the kernel tracer and return the number of elements.
1293 ssize_t
kernel_list_events(struct lttng_event
**events
)
1297 size_t nbmem
, count
= 0;
1299 struct lttng_event
*elist
;
1303 fd
= kernctl_tracepoint_list(kernel_tracer_fd
);
1305 PERROR("kernel tracepoint list");
1309 fp
= fdopen(fd
, "r");
1311 PERROR("kernel tracepoint list fdopen");
1316 * Init memory size counter
1317 * See kernel-ctl.h for explanation of this value
1319 nbmem
= KERNEL_EVENT_INIT_LIST_SIZE
;
1320 elist
= zmalloc(sizeof(struct lttng_event
) * nbmem
);
1321 if (elist
== NULL
) {
1322 PERROR("alloc list events");
1327 while (fscanf(fp
, "event { name = %m[^;]; };\n", &event
) == 1) {
1328 if (count
>= nbmem
) {
1329 struct lttng_event
*new_elist
;
1332 new_nbmem
= nbmem
<< 1;
1333 DBG("Reallocating event list from %zu to %zu bytes",
1335 new_elist
= realloc(elist
, new_nbmem
* sizeof(struct lttng_event
));
1336 if (new_elist
== NULL
) {
1337 PERROR("realloc list events");
1343 /* Zero the new memory */
1344 memset(new_elist
+ nbmem
, 0,
1345 (new_nbmem
- nbmem
) * sizeof(struct lttng_event
));
1349 strncpy(elist
[count
].name
, event
, LTTNG_SYMBOL_NAME_LEN
);
1350 elist
[count
].name
[LTTNG_SYMBOL_NAME_LEN
- 1] = '\0';
1351 elist
[count
].enabled
= -1;
1357 DBG("Kernel list events done (%zu events)", count
);
1359 ret
= fclose(fp
); /* closes both fp and fd */
1375 * Get kernel version and validate it.
1377 int kernel_validate_version(struct lttng_kernel_tracer_version
*version
,
1378 struct lttng_kernel_tracer_abi_version
*abi_version
)
1382 ret
= kernctl_tracer_version(kernel_tracer_fd
, version
);
1384 ERR("Failed to retrieve the lttng-modules version");
1388 /* Validate version */
1389 if (version
->major
!= VERSION_MAJOR
) {
1390 ERR("Kernel tracer major version (%d) is not compatible with lttng-tools major version (%d)",
1391 version
->major
, VERSION_MAJOR
);
1394 ret
= kernctl_tracer_abi_version(kernel_tracer_fd
, abi_version
);
1396 ERR("Failed to retrieve lttng-modules ABI version");
1399 if (abi_version
->major
!= LTTNG_MODULES_ABI_MAJOR_VERSION
) {
1400 ERR("Kernel tracer ABI version (%d.%d) does not match the expected ABI major version (%d.*)",
1401 abi_version
->major
, abi_version
->minor
,
1402 LTTNG_MODULES_ABI_MAJOR_VERSION
);
1405 DBG2("Kernel tracer version validated (%d.%d, ABI %d.%d)",
1406 version
->major
, version
->minor
,
1407 abi_version
->major
, abi_version
->minor
);
1414 ERR("Kernel tracer version check failed; kernel tracing will not be available");
1419 * Kernel work-arounds called at the start of sessiond main().
1421 int init_kernel_workarounds(void)
1427 * boot_id needs to be read once before being used concurrently
1428 * to deal with a Linux kernel race. A fix is proposed for
1429 * upstream, but the work-around is needed for older kernels.
1431 fp
= fopen("/proc/sys/kernel/random/boot_id", "r");
1438 ret
= fread(buf
, 1, sizeof(buf
), fp
);
1440 /* Ignore error, we don't really care */
1452 * Teardown of a kernel session, keeping data required by destroy notifiers.
1454 void kernel_destroy_session(struct ltt_kernel_session
*ksess
)
1456 struct lttng_trace_chunk
*trace_chunk
;
1458 if (ksess
== NULL
) {
1459 DBG3("No kernel session when tearing down session");
1463 DBG("Tearing down kernel session");
1464 trace_chunk
= ksess
->current_trace_chunk
;
1467 * Destroy channels on the consumer if at least one FD has been sent and we
1468 * are in no output mode because the streams are in *no* monitor mode so we
1469 * have to send a command to clean them up or else they leaked.
1471 if (!ksess
->output_traces
&& ksess
->consumer_fds_sent
) {
1473 struct consumer_socket
*socket
;
1474 struct lttng_ht_iter iter
;
1476 /* For each consumer socket. */
1478 cds_lfht_for_each_entry(ksess
->consumer
->socks
->ht
, &iter
.iter
,
1479 socket
, node
.node
) {
1480 struct ltt_kernel_channel
*chan
;
1482 /* For each channel, ask the consumer to destroy it. */
1483 cds_list_for_each_entry(chan
, &ksess
->channel_list
.head
, list
) {
1484 ret
= kernel_consumer_destroy_channel(socket
, chan
);
1486 /* Consumer is probably dead. Use next socket. */
1494 /* Close any relayd session */
1495 consumer_output_send_destroy_relayd(ksess
->consumer
);
1497 trace_kernel_destroy_session(ksess
);
1498 lttng_trace_chunk_put(trace_chunk
);
1501 /* Teardown of data required by destroy notifiers. */
1502 void kernel_free_session(struct ltt_kernel_session
*ksess
)
1504 if (ksess
== NULL
) {
1507 trace_kernel_free_session(ksess
);
1511 * Destroy a kernel channel object. It does not do anything on the tracer side.
1513 void kernel_destroy_channel(struct ltt_kernel_channel
*kchan
)
1515 struct ltt_kernel_session
*ksess
= NULL
;
1518 assert(kchan
->channel
);
1520 DBG3("Kernel destroy channel %s", kchan
->channel
->name
);
1522 /* Update channel count of associated session. */
1523 if (kchan
->session
) {
1524 /* Keep pointer reference so we can update it after the destroy. */
1525 ksess
= kchan
->session
;
1528 trace_kernel_destroy_channel(kchan
);
1531 * At this point the kernel channel is not visible anymore. This is safe
1532 * since in order to work on a visible kernel session, the tracing session
1533 * lock (ltt_session.lock) MUST be acquired.
1536 ksess
->channel_count
--;
1541 * Take a snapshot for a given kernel session.
1543 * Return LTTNG_OK on success or else return a LTTNG_ERR code.
1545 enum lttng_error_code
kernel_snapshot_record(
1546 struct ltt_kernel_session
*ksess
,
1547 const struct consumer_output
*output
, int wait
,
1548 uint64_t nb_packets_per_stream
)
1550 int err
, ret
, saved_metadata_fd
;
1551 enum lttng_error_code status
= LTTNG_OK
;
1552 struct consumer_socket
*socket
;
1553 struct lttng_ht_iter iter
;
1554 struct ltt_kernel_metadata
*saved_metadata
;
1555 char *trace_path
= NULL
;
1556 size_t consumer_path_offset
= 0;
1559 assert(ksess
->consumer
);
1562 DBG("Kernel snapshot record started");
1564 /* Save current metadata since the following calls will change it. */
1565 saved_metadata
= ksess
->metadata
;
1566 saved_metadata_fd
= ksess
->metadata_stream_fd
;
1570 ret
= kernel_open_metadata(ksess
);
1572 status
= LTTNG_ERR_KERN_META_FAIL
;
1576 ret
= kernel_open_metadata_stream(ksess
);
1578 status
= LTTNG_ERR_KERN_META_FAIL
;
1579 goto error_open_stream
;
1582 trace_path
= setup_channel_trace_path(ksess
->consumer
,
1583 "", &consumer_path_offset
);
1585 status
= LTTNG_ERR_INVALID
;
1588 /* Send metadata to consumer and snapshot everything. */
1589 cds_lfht_for_each_entry(output
->socks
->ht
, &iter
.iter
,
1590 socket
, node
.node
) {
1591 struct ltt_kernel_channel
*chan
;
1593 pthread_mutex_lock(socket
->lock
);
1594 /* This stream must not be monitored by the consumer. */
1595 ret
= kernel_consumer_add_metadata(socket
, ksess
, 0);
1596 pthread_mutex_unlock(socket
->lock
);
1598 status
= LTTNG_ERR_KERN_META_FAIL
;
1599 goto error_consumer
;
1602 /* For each channel, ask the consumer to snapshot it. */
1603 cds_list_for_each_entry(chan
, &ksess
->channel_list
.head
, list
) {
1604 status
= consumer_snapshot_channel(socket
, chan
->key
, output
, 0,
1605 ksess
->uid
, ksess
->gid
,
1606 &trace_path
[consumer_path_offset
], wait
,
1607 nb_packets_per_stream
);
1608 if (status
!= LTTNG_OK
) {
1609 (void) kernel_consumer_destroy_metadata(socket
,
1611 goto error_consumer
;
1615 /* Snapshot metadata, */
1616 status
= consumer_snapshot_channel(socket
, ksess
->metadata
->key
, output
,
1617 1, ksess
->uid
, ksess
->gid
, &trace_path
[consumer_path_offset
],
1619 if (status
!= LTTNG_OK
) {
1620 goto error_consumer
;
1624 * The metadata snapshot is done, ask the consumer to destroy it since
1625 * it's not monitored on the consumer side.
1627 (void) kernel_consumer_destroy_metadata(socket
, ksess
->metadata
);
1631 /* Close newly opened metadata stream. It's now on the consumer side. */
1632 err
= close(ksess
->metadata_stream_fd
);
1634 PERROR("close snapshot kernel");
1638 trace_kernel_destroy_metadata(ksess
->metadata
);
1640 /* Restore metadata state.*/
1641 ksess
->metadata
= saved_metadata
;
1642 ksess
->metadata_stream_fd
= saved_metadata_fd
;
1649 * Get the syscall mask array from the kernel tracer.
1651 * Return 0 on success else a negative value. In both case, syscall_mask should
1654 int kernel_syscall_mask(int chan_fd
, char **syscall_mask
, uint32_t *nr_bits
)
1656 assert(syscall_mask
);
1659 return kernctl_syscall_mask(chan_fd
, syscall_mask
, nr_bits
);
1663 * Check for the support of the RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS via abi
1666 * Return 1 on success, 0 when feature is not supported, negative value in case
1669 int kernel_supports_ring_buffer_snapshot_sample_positions(void)
1671 int ret
= 0; // Not supported by default
1672 struct lttng_kernel_tracer_abi_version abi
;
1674 ret
= kernctl_tracer_abi_version(kernel_tracer_fd
, &abi
);
1676 ERR("Failed to retrieve lttng-modules ABI version");
1681 * RING_BUFFER_SNAPSHOT_SAMPLE_POSITIONS was introduced in 2.3
1683 if (abi
.major
>= 2 && abi
.minor
>= 3) {
1695 * Check for the support of the packet sequence number via abi version number.
1697 * Return 1 on success, 0 when feature is not supported, negative value in case
1700 int kernel_supports_ring_buffer_packet_sequence_number(void)
1702 int ret
= 0; // Not supported by default
1703 struct lttng_kernel_tracer_abi_version abi
;
1705 ret
= kernctl_tracer_abi_version(kernel_tracer_fd
, &abi
);
1707 ERR("Failed to retrieve lttng-modules ABI version");
1712 * Packet sequence number was introduced in LTTng 2.8,
1713 * lttng-modules ABI 2.1.
1715 if (abi
.major
>= 2 && abi
.minor
>= 1) {
1727 * Rotate a kernel session.
1729 * Return LTTNG_OK on success or else an LTTng error code.
1731 enum lttng_error_code
kernel_rotate_session(struct ltt_session
*session
)
1734 enum lttng_error_code status
= LTTNG_OK
;
1735 struct consumer_socket
*socket
;
1736 struct lttng_ht_iter iter
;
1737 struct ltt_kernel_session
*ksess
= session
->kernel_session
;
1740 assert(ksess
->consumer
);
1742 DBG("Rotate kernel session %s started (session %" PRIu64
")",
1743 session
->name
, session
->id
);
1748 * Note that this loop will end after one iteration given that there is
1749 * only one kernel consumer.
1751 cds_lfht_for_each_entry(ksess
->consumer
->socks
->ht
, &iter
.iter
,
1752 socket
, node
.node
) {
1753 struct ltt_kernel_channel
*chan
;
1755 /* For each channel, ask the consumer to rotate it. */
1756 cds_list_for_each_entry(chan
, &ksess
->channel_list
.head
, list
) {
1757 DBG("Rotate kernel channel %" PRIu64
", session %s",
1758 chan
->key
, session
->name
);
1759 ret
= consumer_rotate_channel(socket
, chan
->key
,
1760 ksess
->uid
, ksess
->gid
, ksess
->consumer
,
1761 /* is_metadata_channel */ false);
1763 status
= LTTNG_ERR_ROTATION_FAIL_CONSUMER
;
1769 * Rotate the metadata channel.
1771 ret
= consumer_rotate_channel(socket
, ksess
->metadata
->key
,
1772 ksess
->uid
, ksess
->gid
, ksess
->consumer
,
1773 /* is_metadata_channel */ true);
1775 status
= LTTNG_ERR_ROTATION_FAIL_CONSUMER
;
1785 enum lttng_error_code
kernel_create_channel_subdirectories(
1786 const struct ltt_kernel_session
*ksess
)
1788 enum lttng_error_code ret
= LTTNG_OK
;
1789 enum lttng_trace_chunk_status chunk_status
;
1792 assert(ksess
->current_trace_chunk
);
1795 * Create the index subdirectory which will take care
1796 * of implicitly creating the channel's path.
1798 chunk_status
= lttng_trace_chunk_create_subdirectory(
1799 ksess
->current_trace_chunk
,
1800 DEFAULT_KERNEL_TRACE_DIR
"/" DEFAULT_INDEX_DIR
);
1801 if (chunk_status
!= LTTNG_TRACE_CHUNK_STATUS_OK
) {
1802 ret
= LTTNG_ERR_CREATE_DIR_FAIL
;
1811 * Setup necessary data for kernel tracer action.
1814 int init_kernel_tracer(void)
1817 bool is_root
= !getuid();
1819 /* Modprobe lttng kernel modules */
1820 ret
= modprobe_lttng_control();
1825 /* Open debugfs lttng */
1826 kernel_tracer_fd
= open(module_proc_lttng
, O_RDWR
);
1827 if (kernel_tracer_fd
< 0) {
1828 DBG("Failed to open %s", module_proc_lttng
);
1832 /* Validate kernel version */
1833 ret
= kernel_validate_version(&kernel_tracer_version
,
1834 &kernel_tracer_abi_version
);
1839 ret
= modprobe_lttng_data();
1844 ret
= kernel_supports_ring_buffer_snapshot_sample_positions();
1850 WARN("Kernel tracer does not support buffer monitoring. "
1851 "The monitoring timer of channels in the kernel domain "
1852 "will be set to 0 (disabled).");
1855 DBG("Kernel tracer fd %d", kernel_tracer_fd
);
1857 ret
= syscall_init_table(kernel_tracer_fd
);
1859 ERR("Unable to populate syscall table. Syscall tracing won't "
1860 "work for this session daemon.");
1865 modprobe_remove_lttng_control();
1866 ret
= close(kernel_tracer_fd
);
1870 kernel_tracer_fd
= -1;
1871 return LTTNG_ERR_KERN_VERSION
;
1874 ret
= close(kernel_tracer_fd
);
1880 modprobe_remove_lttng_control();
1883 WARN("No kernel tracer available");
1884 kernel_tracer_fd
= -1;
1886 return LTTNG_ERR_NEED_ROOT_SESSIOND
;
1888 return LTTNG_ERR_KERN_NA
;
1893 void cleanup_kernel_tracer(void)
1897 DBG2("Closing kernel fd");
1898 if (kernel_tracer_fd
>= 0) {
1899 ret
= close(kernel_tracer_fd
);
1903 kernel_tracer_fd
= -1;
1905 DBG("Unloading kernel modules");
1906 modprobe_remove_lttng_all();
1907 free(syscall_table
);
1911 bool kernel_tracer_is_initialized(void)
1913 return kernel_tracer_fd
>= 0;
1917 * Clear a kernel session.
1919 * Return LTTNG_OK on success or else an LTTng error code.
1921 enum lttng_error_code
kernel_clear_session(struct ltt_session
*session
)
1924 enum lttng_error_code status
= LTTNG_OK
;
1925 struct consumer_socket
*socket
;
1926 struct lttng_ht_iter iter
;
1927 struct ltt_kernel_session
*ksess
= session
->kernel_session
;
1930 assert(ksess
->consumer
);
1932 DBG("Clear kernel session %s (session %" PRIu64
")",
1933 session
->name
, session
->id
);
1937 if (ksess
->active
) {
1938 ERR("Expecting inactive session %s (%" PRIu64
")", session
->name
, session
->id
);
1939 status
= LTTNG_ERR_FATAL
;
1944 * Note that this loop will end after one iteration given that there is
1945 * only one kernel consumer.
1947 cds_lfht_for_each_entry(ksess
->consumer
->socks
->ht
, &iter
.iter
,
1948 socket
, node
.node
) {
1949 struct ltt_kernel_channel
*chan
;
1951 /* For each channel, ask the consumer to clear it. */
1952 cds_list_for_each_entry(chan
, &ksess
->channel_list
.head
, list
) {
1953 DBG("Clear kernel channel %" PRIu64
", session %s",
1954 chan
->key
, session
->name
);
1955 ret
= consumer_clear_channel(socket
, chan
->key
);
1961 if (!ksess
->metadata
) {
1963 * Nothing to do for the metadata.
1964 * This is a snapshot session.
1965 * The metadata is genererated on the fly.
1971 * Clear the metadata channel.
1972 * Metadata channel is not cleared per se but we still need to
1973 * perform a rotation operation on it behind the scene.
1975 ret
= consumer_clear_channel(socket
, ksess
->metadata
->key
);
1984 case LTTCOMM_CONSUMERD_RELAYD_CLEAR_DISALLOWED
:
1985 status
= LTTNG_ERR_CLEAR_RELAY_DISALLOWED
;
1988 status
= LTTNG_ERR_CLEAR_FAIL_CONSUMER
;