Fix: don't flush-final for offset 0 if reader is on sub-buffer
[lttng-ust.git] / include / ust-comm.h
CommitLineData
b35d179d
MD
1#ifndef _LTTNG_UST_COMM_H
2#define _LTTNG_UST_COMM_H
67c5b804
MD
3
4/*
5 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
6 * Julien Desfossez <julien.desfossez@polymtl.ca>
7 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 *
15f672f9
MD
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; only
12 * version 2.1 of the License.
13 *
14 * This library is distributed in the hope that it will be useful,
67c5b804 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15f672f9
MD
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
67c5b804
MD
22 */
23
24/*
25 * This header is meant for liblttng and libust internal use ONLY.
26 * These declarations should NOT be considered stable API.
27 */
28
29#include <limits.h>
57773204 30#include <unistd.h>
4318ae1b 31#include <lttng/ust-abi.h>
7bc53e94 32#include <lttng/ust-error.h>
b3f60bbf 33#include <lttng/ust-compiler.h>
67c5b804 34
11ff9c7d 35/*
cf12a773
MD
36 * Default timeout the application waits for the sessiond to send its
37 * "register done" command. Can be overridden with the environment
69400ac4 38 * variable "LTTNG_UST_REGISTER_TIMEOUT". Note that if the sessiond is not
cf12a773 39 * found, the application proceeds directly without any delay.
11ff9c7d 40 */
cf12a773 41#define LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS 3000
11ff9c7d 42
67c5b804 43#define LTTNG_RUNDIR "/var/run/lttng"
6a47c1fb 44#define LTTNG_HOME_RUNDIR "%s/.lttng"
67c5b804
MD
45
46/* Default unix socket path */
8d1dae7c
MD
47#define DEFAULT_GLOBAL_CLIENT_UNIX_SOCK LTTNG_RUNDIR "/client-lttng-sessiond"
48#define DEFAULT_GLOBAL_APPS_UNIX_SOCK LTTNG_RUNDIR "/apps-lttng-sessiond"
6a47c1fb
DG
49#define DEFAULT_HOME_APPS_UNIX_SOCK LTTNG_HOME_RUNDIR "/apps-lttng-sessiond"
50#define DEFAULT_HOME_CLIENT_UNIX_SOCK LTTNG_HOME_RUNDIR "/client-lttng-sessiond"
67c5b804 51
7fc90dca 52#define DEFAULT_GLOBAL_APPS_WAIT_SHM_PATH "/lttng-ust-apps-wait"
58d4b2a2 53#define DEFAULT_HOME_APPS_WAIT_SHM_PATH "/lttng-ust-apps-wait-%u"
7fc90dca 54
67c5b804 55/* Queue size of listen(2) */
e41474be 56#define LTTNG_UST_COMM_MAX_LISTEN 10
67c5b804 57
67c5b804 58/*
e7723462 59 * Data structure for the commands sent from sessiond to UST.
67c5b804 60 */
57773204 61struct ustcomm_ust_msg {
1ece9766 62 uint32_t handle;
46050b1a 63 uint32_t cmd;
67c5b804 64 union {
1ece9766 65 struct lttng_ust_channel channel;
381c0f1e 66 struct lttng_ust_stream stream;
1ece9766
MD
67 struct lttng_ust_event event;
68 struct lttng_ust_context context;
57773204 69 struct lttng_ust_tracer_version version;
cbef6901 70 struct lttng_ust_tracepoint_iter tracepoint;
2d78951a 71 struct {
2734ca65
CB
72 uint32_t data_size; /* following filter data */
73 uint32_t reloc_offset;
3f6fd224 74 uint64_t seqnum;
b3f60bbf 75 } LTTNG_PACKED filter;
67c5b804 76 } u;
b3f60bbf 77} LTTNG_PACKED;
67c5b804 78
9eb62b9c
MD
79/*
80 * Data structure for the response from UST to the session daemon.
81 * cmd_type is sent back in the reply for validation.
82 */
57773204 83struct ustcomm_ust_reply {
46050b1a
MD
84 uint32_t handle;
85 uint32_t cmd;
57773204 86 uint32_t ret_code; /* enum enum ustcomm_return_code */
1ece9766 87 uint32_t ret_val; /* return value */
9eb62b9c 88 union {
193183fb
MD
89 struct {
90 uint64_t memory_map_size;
b3f60bbf 91 } LTTNG_PACKED channel;
381c0f1e
MD
92 struct {
93 uint64_t memory_map_size;
b3f60bbf 94 } LTTNG_PACKED stream;
57773204 95 struct lttng_ust_tracer_version version;
cbef6901 96 struct lttng_ust_tracepoint_iter tracepoint;
9eb62b9c 97 } u;
b3f60bbf 98} LTTNG_PACKED;
9eb62b9c 99
40003310
MD
100/*
101 * LTTNG_UST_TRACEPOINT_FIELD_LIST reply is followed by a
102 * struct lttng_ust_field_iter field.
103 */
104
57773204
MD
105extern int ustcomm_create_unix_sock(const char *pathname);
106extern int ustcomm_connect_unix_sock(const char *pathname);
107extern int ustcomm_accept_unix_sock(int sock);
108extern int ustcomm_listen_unix_sock(int sock);
109extern int ustcomm_close_unix_sock(int sock);
74d81a6c 110
57773204
MD
111extern ssize_t ustcomm_recv_unix_sock(int sock, void *buf, size_t len);
112extern ssize_t ustcomm_send_unix_sock(int sock, void *buf, size_t len);
74d81a6c
MD
113extern ssize_t ustcomm_send_fds_unix_sock(int sock, int *fds, size_t nb_fd);
114extern ssize_t ustcomm_recv_fds_unix_sock(int sock, int *fds, size_t nb_fd);
115
57773204
MD
116extern const char *ustcomm_get_readable_code(int code);
117extern int ustcomm_send_app_msg(int sock, struct ustcomm_ust_msg *lum);
118extern int ustcomm_recv_app_reply(int sock, struct ustcomm_ust_reply *lur,
119 uint32_t expected_handle, uint32_t expected_cmd);
120extern int ustcomm_send_app_cmd(int sock,
121 struct ustcomm_ust_msg *lum,
122 struct ustcomm_ust_reply *lur);
123int ustcomm_recv_fd(int sock);
67c5b804 124
74d81a6c
MD
125ssize_t ustcomm_recv_channel_from_sessiond(int sock,
126 void **chan_data, uint64_t len);
127int ustcomm_recv_stream_from_sessiond(int sock,
128 uint64_t *memory_map_size,
129 int *shm_fd, int *wakeup_fd);
130
b35d179d 131#endif /* _LTTNG_UST_COMM_H */
This page took 0.032372 seconds and 4 git commands to generate.