sessiond: lttng: Add command to check kernel tracer status
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.cpp
index 03ed2aa10a4459891018fe038b7a8cbdbaf50c75..22823d344bd1d556a3248ab63c0f093cd7cd7ac7 100644 (file)
@@ -1180,7 +1180,7 @@ int lttng_enable_event_with_exclusions(struct lttng_handle *handle,
 serialize:
        ret = lttng_event_serialize(ev,
                                    exclusion_count,
-                                   const_cast<const char **>(exclusion_list),
+                                   exclusion_list,
                                    filter_expression,
                                    bytecode_len,
                                    (ctx && bytecode_len) ? &ctx->bytecode->b : nullptr,
@@ -2877,6 +2877,35 @@ end:
        return ret;
 }
 
+/*
+ * Get the status of the kernel tracer
+ *
+ * Sets the value of the argument
+ */
+enum lttng_error_code lttng_get_kernel_tracer_status(enum lttng_kernel_tracer_status *status)
+{
+       enum lttng_error_code ret = LTTNG_ERR_INVALID;
+
+       if (status == nullptr) {
+               return LTTNG_ERR_INVALID;
+       }
+
+       struct lttcomm_session_msg lsm = {};
+       lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_KERNEL_TRACER_STATUS;
+
+       uint32_t *u_status = nullptr;
+       const auto ask_ret = lttng_ctl_ask_sessiond(&lsm, (void **) &u_status);
+       if (ask_ret != 4) {
+               goto end;
+       }
+
+       *status = (enum lttng_kernel_tracer_status) * u_status;
+       ret = LTTNG_OK;
+end:
+       free(u_status);
+       return ret;
+}
+
 /*
  * Regenerate the metadata for a session.
  * Return 0 on success, a negative error code on error.
This page took 0.023468 seconds and 4 git commands to generate.