sessiond: lttng: Add command to check kernel tracer status
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl.cpp
index 15a699e24f3fd63837edbc6b11dccfa3ac5b1a10..22823d344bd1d556a3248ab63c0f093cd7cd7ac7 100644 (file)
@@ -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.022825 seconds and 4 git commands to generate.