Fix: wait for the completion of implicit session rotations
[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 *
4 * This library is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License, version 2.1 only,
6 * as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
11 * for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this library; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17
18#ifndef LTTNG_CTL_HELPER_H
19#define LTTNG_CTL_HELPER_H
20
cac3069d
DG
21#include <stdio.h>
22
23#include <common/sessiond-comm/sessiond-comm.h>
24#include <lttng/lttng.h>
25
26/*
27 * NOTE: Every symbol in this helper header MUST be set to hidden so not to
28 * polute the library name space. Use LTTNG_HIDDEN macro before declaring the
29 * function in the C file.
30 */
31
32/* Copy helper functions. */
33void lttng_ctl_copy_string(char *dst, const char *src, size_t len);
34void lttng_ctl_copy_lttng_domain(struct lttng_domain *dst,
35 struct lttng_domain *src);
36
37/*
c2d69327 38 * Sends the lttcomm message to the session daemon and fills buf if the
cac3069d
DG
39 * returned data is not NULL.
40 *
41 * Return the size of the received data on success or else a negative lttng
42 * error code. If buf is NULL, 0 is returned on success.
43 */
a04d53fc
FD
44int lttng_ctl_ask_sessiond_fds_varlen(struct lttcomm_session_msg *lsm,
45 const int *fds, size_t nb_fd,
795a978d
PP
46 const void *vardata, size_t vardata_len,
47 void **user_payload_buf, void **user_cmd_header_buf,
48 size_t *user_cmd_header_len);
49
50/*
a04d53fc 51 * Calls lttng_ctl_ask_sessiond_fds_varlen() with no expected command header.
795a978d
PP
52 */
53static inline
54int lttng_ctl_ask_sessiond_varlen_no_cmd_header(struct lttcomm_session_msg *lsm,
55 void *vardata, size_t vardata_len, void **user_payload_buf)
56{
a04d53fc 57 return lttng_ctl_ask_sessiond_fds_varlen(lsm, NULL, 0, vardata,
795a978d
PP
58 vardata_len, user_payload_buf, NULL, NULL);
59}
cac3069d 60
a04d53fc
FD
61/*
62 * Calls lttng_ctl_ask_sessiond_fds_varlen() with fds and no expected command header.
63 */
64static inline
65int lttng_ctl_ask_sessiond_fds_no_cmd_header(struct lttcomm_session_msg *lsm,
66 const int *fds, size_t nb_fd, void **buf)
67{
68 return lttng_ctl_ask_sessiond_fds_varlen(lsm, fds, nb_fd, NULL,
69 0, NULL, NULL, NULL);
70}
cac3069d
DG
71/*
72 * Use this if no variable length data needs to be sent.
73 */
74static inline
75int lttng_ctl_ask_sessiond(struct lttcomm_session_msg *lsm, void **buf)
76{
795a978d 77 return lttng_ctl_ask_sessiond_varlen_no_cmd_header(lsm, NULL, 0, buf);
cac3069d
DG
78}
79
6c71277b
MD
80int lttng_check_tracing_group(void);
81
3e3665b8
JG
82int connect_sessiond(void);
83
cac3069d 84#endif /* LTTNG_CTL_HELPER_H */
This page took 0.070695 seconds and 5 git commands to generate.