static bool shutdown_health_management_thread(void *data) { struct thread_notifiers *notifiers = data; const int write_fd = lttng_pipe_get_writefd(notifiers->quit_pipe); return notify_thread_pipe(write_fd) == 1; }
/* * Create kernel channel of the kernel session and notify kernel thread. */ int channel_kernel_create(struct ltt_kernel_session *ksession, struct lttng_channel *attr, int kernel_pipe) { int ret; struct lttng_channel *defattr = NULL; assert(ksession); /* Creating channel attributes if needed */ if (attr == NULL) { defattr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL, LTTNG_BUFFER_GLOBAL); if (defattr == NULL) { ret = LTTNG_ERR_FATAL; goto error; } attr = defattr; } /* * Set the overwrite mode for this channel based on the session * type unless the client explicitly overrides the channel mode. */ if (attr->attr.overwrite == DEFAULT_CHANNEL_OVERWRITE) { attr->attr.overwrite = !!ksession->snapshot_mode; } /* Enforce mmap output for snapshot sessions. */ if (ksession->snapshot_mode) { attr->attr.output = LTTNG_EVENT_MMAP; } /* Validate common channel properties. */ if (channel_validate(attr) < 0) { ret = LTTNG_ERR_INVALID; goto error; } if (channel_validate_kernel(attr) < 0) { ret = LTTNG_ERR_INVALID; goto error; } /* Channel not found, creating it */ ret = kernel_create_channel(ksession, attr); if (ret < 0) { ret = LTTNG_ERR_KERN_CHAN_FAIL; goto error; } /* Notify kernel thread that there is a new channel */ ret = notify_thread_pipe(kernel_pipe); if (ret < 0) { ret = LTTNG_ERR_FATAL; goto error; } ret = LTTNG_OK; error: channel_attr_destroy(defattr); return ret; }
int sessiond_notify_quit_pipe(void) { return notify_thread_pipe(thread_quit_pipe[1]); }