X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.cpp;fp=src%2Flib%2Flttng-ctl%2Flttng-ctl.cpp;h=22823d344bd1d556a3248ab63c0f093cd7cd7ac7;hp=15a699e24f3fd63837edbc6b11dccfa3ac5b1a10;hb=49cddecdbb1e042877ca3855b177ade68151030f;hpb=c1896e2d809e0d32d2d9b8a840755de6d5d70eaf diff --git a/src/lib/lttng-ctl/lttng-ctl.cpp b/src/lib/lttng-ctl/lttng-ctl.cpp index 15a699e24..22823d344 100644 --- a/src/lib/lttng-ctl/lttng-ctl.cpp +++ b/src/lib/lttng-ctl/lttng-ctl.cpp @@ -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.