#include <common/filter/filter-ast.hpp>
#include <common/filter/filter-parser.hpp>
#include <common/filter/memstream.hpp>
+#include <common/make-unique-wrapper.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
#include <common/sessiond-comm/sessiond-comm.hpp>
#include <string.h>
#include <unistd.h>
-#define COPY_DOMAIN_PACKED(dst, src) \
- do { \
- struct lttng_domain _tmp_domain; \
- \
- lttng_ctl_copy_lttng_domain(&_tmp_domain, &src); \
- dst = _tmp_domain; \
+#define COPY_DOMAIN_PACKED(dst, src) \
+ do { \
+ struct lttng_domain _tmp_domain; \
+ \
+ lttng_ctl_copy_lttng_domain(&_tmp_domain, &(src)); \
+ (dst) = _tmp_domain; \
} while (0)
/* Socket to session daemon for communication */
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 *out_status)
+{
+ if (out_status == nullptr) {
+ return LTTNG_ERR_INVALID;
+ }
+
+ struct lttcomm_session_msg lsm = {};
+ lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_KERNEL_TRACER_STATUS;
+
+ uint32_t *raw_tracer_status = nullptr;
+ const auto ask_ret = lttng_ctl_ask_sessiond(&lsm, (void **) &raw_tracer_status);
+
+ const auto tracer_status =
+ lttng::make_unique_wrapper<uint32_t, lttng::memory::free>(raw_tracer_status);
+
+ if (ask_ret != 4) {
+ return LTTNG_ERR_INVALID;
+ }
+
+ *out_status = (enum lttng_kernel_tracer_status) * tracer_status;
+ return LTTNG_OK;
+}
+
/*
* Regenerate the metadata for a session.
* Return 0 on success, a negative error code on error.