+ * lttng_enable_event
+ */
+int lttng_enable_event(struct lttng_domain *domain,
+ struct lttng_event *ev, const char *channel_name)
+{
+ int ret;
+
+ if (channel_name == NULL) {
+ strncpy(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME, NAME_MAX);
+ } else {
+ strncpy(lsm.u.enable.channel_name, channel_name, NAME_MAX);
+ }
+
+ switch (domain->type) {
+ case LTTNG_DOMAIN_KERNEL:
+ if (ev == NULL) {
+ ret = ask_sessiond(LTTNG_KERNEL_ENABLE_ALL_EVENT, NULL);
+ } else {
+ memcpy(&lsm.u.enable.event, ev, sizeof(struct lttng_event));
+ ret = ask_sessiond(LTTNG_KERNEL_ENABLE_EVENT, NULL);
+ }
+ break;
+ case LTTNG_DOMAIN_UST:
+ ret = LTTCOMM_NOT_IMPLEMENTED;
+ break;
+ default:
+ ret = LTTCOMM_UNKNOWN_DOMAIN;
+ break;
+ };
+
+ return ret;
+}
+
+/*
+ * Disable an event in the kernel tracer.
+ */
+int lttng_disable_event(struct lttng_domain *domain, const char *name,
+ const char *channel_name)
+{
+ int ret;
+
+ if (channel_name == NULL) {
+ strncpy(lsm.u.disable.channel_name, DEFAULT_CHANNEL_NAME, NAME_MAX);
+ } else {
+ strncpy(lsm.u.disable.channel_name, channel_name, NAME_MAX);
+ }
+
+ switch (domain->type) {
+ case LTTNG_DOMAIN_KERNEL:
+ if (name == NULL) {
+ ret = ask_sessiond(LTTNG_KERNEL_DISABLE_ALL_EVENT, NULL);
+ } else {
+ strncpy(lsm.u.disable.name, name, NAME_MAX);
+ ret = ask_sessiond(LTTNG_KERNEL_DISABLE_EVENT, NULL);
+ }
+ break;
+ case LTTNG_DOMAIN_UST:
+ ret = LTTCOMM_NOT_IMPLEMENTED;
+ break;
+ default:
+ ret = LTTCOMM_UNKNOWN_DOMAIN;
+ break;
+ };
+
+ return ret;
+}
+
+/*
+ * Enable recording for a channel for the kernel tracer.
+ */
+int lttng_enable_channel(struct lttng_domain *domain,
+ struct lttng_channel *chan)
+{
+ int ret;
+
+ memcpy(&lsm.u.channel.chan, chan, sizeof(struct lttng_channel));
+
+ switch (domain->type) {
+ case LTTNG_DOMAIN_KERNEL:
+ ret = ask_sessiond(LTTNG_KERNEL_ENABLE_CHANNEL, NULL);
+ break;
+ case LTTNG_DOMAIN_UST:
+ ret = LTTCOMM_NOT_IMPLEMENTED;
+ break;
+ default:
+ ret = LTTCOMM_UNKNOWN_DOMAIN;
+ break;
+ };
+
+ return ret;
+}
+
+/*
+ * Disable recording for the channel for the kernel tracer.
+ */
+int lttng_disable_channel(struct lttng_domain *domain, const char *name)
+{
+ int ret;
+
+ strncpy(lsm.u.disable.channel_name, name, NAME_MAX);
+
+ switch (domain->type) {
+ case LTTNG_DOMAIN_KERNEL:
+ ret = ask_sessiond(LTTNG_KERNEL_DISABLE_CHANNEL, NULL);
+ break;
+ case LTTNG_DOMAIN_UST:
+ ret = LTTCOMM_NOT_IMPLEMENTED;
+ break;
+ default:
+ ret = LTTCOMM_UNKNOWN_DOMAIN;
+ break;
+ };
+
+ return ret;
+}
+
+/*
+ * List all available kernel events.