2 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_CTL_HELPER_H
9 #define LTTNG_CTL_HELPER_H
11 #include <common/sessiond-comm/sessiond-comm.hpp>
13 #include <lttng/lttng.h>
17 /* Copy helper functions. */
18 void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst, struct lttng_domain *src);
21 * Sends the lttcomm message to the session daemon and fills buf if the
22 * returned data is not NULL.
24 * Return the size of the received data on success or else a negative lttng
25 * error code. If buf is NULL, 0 is returned on success.
27 int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
32 void **user_payload_buf,
33 void **user_cmd_header_buf,
34 size_t *user_cmd_header_len);
37 * Sends the lttcomm message to the session daemon and fills the reply payload.
39 * Return the size of the received data on success or else a negative lttng
42 int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message, struct lttng_payload *reply);
45 * Calls lttng_ctl_ask_sessiond_fds_varlen() with no expected command header.
47 static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header(struct lttcomm_session_msg *lsm,
50 void **user_payload_buf)
52 return lttng_ctl_ask_sessiond_fds_varlen(
53 lsm, NULL, 0, vardata, vardata_len, user_payload_buf, NULL, NULL);
57 * Calls lttng_ctl_ask_sessiond_fds_varlen() with fds and no expected command header.
59 static inline int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm,
62 void **buf __attribute__((unused)))
64 return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL, 0, NULL, NULL, NULL);
67 * Use this if no variable length data needs to be sent.
69 static inline int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf)
71 return lttng_ctl_ask_sessiond_varlen_no_cmd_header(lsm, NULL, 0, buf);
74 int lttng_check_tracing_group(void);
76 int connect_sessiond(void);
78 #endif /* LTTNG_CTL_HELPER_H */