Prepare for '-Wunused-parameter'
[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
cac3069d 16/* Copy helper functions. */
cac3069d
DG
17void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst,
18 struct lttng_domain *src);
19
20/*
c2d69327 21 * Sends the lttcomm message to the session daemon and fills buf if the
cac3069d
DG
22 * returned data is not NULL.
23 *
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.
26 */
a04d53fc
FD
27int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
28 const int *fds, size_t nb_fd,
795a978d
PP
29 const void *vardata, size_t vardata_len,
30 void **user_payload_buf, void **user_cmd_header_buf,
31 size_t *user_cmd_header_len);
32
e368fb43
JG
33/*
34 * Sends the lttcomm message to the session daemon and fills the reply payload.
35 *
36 * Return the size of the received data on success or else a negative lttng
37 * error code.
38 */
e368fb43
JG
39int lttng_ctl_ask_sessiond_payload(struct lttng_payload_view *message,
40 struct lttng_payload *reply);
41
795a978d 42/*
a04d53fc 43 * Calls lttng_ctl_ask_sessiond_fds_varlen() with no expected command header.
795a978d 44 */
159b042f
JG
45static inline int lttng_ctl_ask_sessiond_varlen_no_cmd_header(
46 struct lttcomm_session_msg *lsm,
47 const void *vardata,
48 size_t vardata_len,
49 void **user_payload_buf)
795a978d 50{
a04d53fc 51 return lttng_ctl_ask_sessiond_fds_varlen(lsm, NULL, 0, vardata,
795a978d
PP
52 vardata_len, user_payload_buf, NULL, NULL);
53}
cac3069d 54
a04d53fc
FD
55/*
56 * Calls lttng_ctl_ask_sessiond_fds_varlen() with fds and no expected command header.
57 */
58static inline
59int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm,
f46376a1 60 const int *fds, size_t nb_fd, void **buf __attribute__((unused)))
a04d53fc
FD
61{
62 return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL,
63 0, NULL, NULL, NULL);
64}
cac3069d
DG
65/*
66 * Use this if no variable length data needs to be sent.
67 */
68static inline
69int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf)
70{
795a978d 71 return lttng_ctl_ask_sessiond_varlen_no_cmd_header(lsm, NULL, 0, buf);
cac3069d
DG
72}
73
6c71277b
MD
74int lttng_check_tracing_group(void);
75
3e3665b8
JG
76int connect_sessiond(void);
77
cac3069d 78#endif /* LTTNG_CTL_HELPER_H */
This page took 0.049275 seconds and 4 git commands to generate.