uprobe: transmit binary file descritptor through lttng_payload
[lttng-tools.git] / src / lib / lttng-ctl / lttng-ctl-helper.h
CommitLineData
cac3069d
DG
1/*
2 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
3 *
ab5be9fa 4 * SPDX-License-Identifier: LGPL-2.1-only
cac3069d 5 *
cac3069d
DG
6 */
7
8#ifndef LTTNG_CTL_HELPER_H
9#define LTTNG_CTL_HELPER_H
10
cac3069d
DG
11#include <stdio.h>
12
13#include <common/sessiond-comm/sessiond-comm.h>
14#include <lttng/lttng.h>
15
16/*
17 * NOTE: Every symbol in this helper header MUST be set to hidden so not to
18 * polute the library name space. Use LTTNG_HIDDEN macro before declaring the
19 * function in the C file.
20 */
21
22/* Copy helper functions. */
23void lttng_ctl_copy_string(char *dst, const char *src, size_t len);
24void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst,
25 struct lttng_domain *src);
26
27/*
c2d69327 28 * Sends the lttcomm message to the session daemon and fills buf if the
cac3069d
DG
29 * returned data is not NULL.
30 *
31 * Return the size of the received data on success or else a negative lttng
32 * error code. If buf is NULL, 0 is returned on success.
33 */
a04d53fc
FD
34int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
35 const int *fds, size_t nb_fd,
795a978d
PP
36 const void *vardata, size_t vardata_len,
37 void **user_payload_buf, void **user_cmd_header_buf,
38 size_t *user_cmd_header_len);
39
e368fb43
JG
40/*
41 * Sends the lttcomm message to the session daemon and fills the reply payload.
42 *
43 * Return the size of the received data on success or else a negative lttng
44 * error code.
45 */
46LTTNG_HIDDEN
47int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
48 struct lttng_payload *reply);
49
795a978d 50/*
a04d53fc 51 * Calls lttng_ctl_ask_sessiond_fds_varlen() with no expected command header.
795a978d 52 */
159b042f
JG
53static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header(
54 struct lttcomm_session_msg *lsm,
55 const void *vardata,
56 size_t vardata_len,
57 void **user_payload_buf)
795a978d 58{
a04d53fc 59 return lttng_ctl_ask_sessiond_fds_varlen(lsm, NULL, 0, vardata,
795a978d
PP
60 vardata_len, user_payload_buf, NULL, NULL);
61}
cac3069d 62
a04d53fc
FD
63/*
64 * Calls lttng_ctl_ask_sessiond_fds_varlen() with fds and no expected command header.
65 */
66static inline
67int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm,
68 const int *fds, size_t nb_fd, void **buf)
69{
70 return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL,
71 0, NULL, NULL, NULL);
72}
cac3069d
DG
73/*
74 * Use this if no variable length data needs to be sent.
75 */
76static inline
77int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf)
78{
795a978d 79 return lttng_ctl_ask_sessiond_varlen_no_cmd_header(lsm, NULL, 0, buf);
cac3069d
DG
80}
81
6c71277b
MD
82int lttng_check_tracing_group(void);
83
3e3665b8
JG
84int connect_sessiond(void);
85
cac3069d 86#endif /* LTTNG_CTL_HELPER_H */
This page took 0.065416 seconds and 4 git commands to generate.