UST support: release session handle on destroy
[lttng-tools.git] / lttng-sessiond / lttng-ust-ctl.h
CommitLineData
2bdd86d4
MD
1/*
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; only version 2
8 * of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19
20#ifndef _LTTNG_UST_CTL_H
21#define _LTTNG_UST_CTL_H
22
9df8df5e 23#include "lttng-ust-abi.h"
2bdd86d4 24
13161846
DG
25int ustctl_register_done(int sock);
26int ustctl_create_session(int sock);
2bdd86d4
MD
27int ustctl_open_metadata(int sock, int session_handle,
28 struct lttng_ust_channel_attr *chops,
13161846 29 struct lttng_ust_object_data **metadata_data);
2bdd86d4
MD
30int ustctl_create_channel(int sock, int session_handle,
31 struct lttng_ust_channel_attr *chops,
13161846
DG
32 struct lttng_ust_object_data **channel_data);
33int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data,
34 struct lttng_ust_object_data **stream_data);
2bdd86d4 35int ustctl_create_event(int sock, struct lttng_ust_event *ev,
13161846
DG
36 struct lttng_ust_object_data *channel_data,
37 struct lttng_ust_object_data **event_data);
2bdd86d4 38int ustctl_add_context(int sock, struct lttng_ust_context *ctx,
13161846
DG
39 struct lttng_ust_object_data *obj_data,
40 struct lttng_ust_object_data **context_data);
2bdd86d4 41
13161846
DG
42int ustctl_enable(int sock, struct lttng_ust_object_data *object);
43int ustctl_disable(int sock, struct lttng_ust_object_data *object);
44int ustctl_start_session(int sock, int handle);
45int ustctl_stop_session(int sock, int handle);
2bdd86d4 46
8ec2d32a
MD
47/*
48 * ustctl_tracepoint_list returns a tracepoint list handle, or negative
49 * error value.
50 */
51int ustctl_tracepoint_list(int sock);
52/*
53 * ustctl_tracepoint_list_get is used to iterate on the tp list
54 * handle. End is iteration is reached when -ENOENT is returned.
55 */
56int ustctl_tracepoint_list_get(int sock, int tp_list_handle,
177f8533 57 struct lttng_ust_tracepoint_iter *iter);
8ec2d32a 58
13161846
DG
59int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v);
60int ustctl_wait_quiescent(int sock);
2bdd86d4 61
6d3686da
DG
62int ustctl_sock_flush_buffer(int sock, struct lttng_ust_object_data *object);
63
2bdd86d4
MD
64/* not implemented yet */
65struct lttng_ust_calibrate;
13161846 66int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate);
2bdd86d4
MD
67
68/*
13161846 69 * Map channel lttng_ust_shm_handle and add streams. Typically performed by the
2bdd86d4
MD
70 * consumer to map the objects into its memory space.
71 */
13161846
DG
72struct lttng_ust_shm_handle *ustctl_map_channel(struct lttng_ust_object_data *chan_data);
73int ustctl_add_stream(struct lttng_ust_shm_handle *lttng_ust_shm_handle,
74 struct lttng_ust_object_data *stream_data);
2bdd86d4 75/*
13161846 76 * Note: the lttng_ust_object_data from which the lttng_ust_shm_handle is derived can only
2bdd86d4
MD
77 * be released after unmapping the handle.
78 */
13161846 79void ustctl_unmap_channel(struct lttng_ust_shm_handle *lttng_ust_shm_handle);
2bdd86d4
MD
80
81/* Buffer operations */
82
13161846
DG
83struct lttng_ust_shm_handle;
84struct lttng_ust_lib_ring_buffer;
2bdd86d4
MD
85
86/* Open/close stream buffers for read */
13161846
DG
87struct lttng_ust_lib_ring_buffer *ustctl_open_stream_read(struct lttng_ust_shm_handle *handle,
88 int cpu);
89void ustctl_close_stream_read(struct lttng_ust_shm_handle *handle,
90 struct lttng_ust_lib_ring_buffer *buf);
2bdd86d4
MD
91
92/* For mmap mode, readable without "get" operation */
13161846
DG
93int ustctl_get_mmap_len(struct lttng_ust_shm_handle *handle,
94 struct lttng_ust_lib_ring_buffer *buf,
95 unsigned long *len);
96int ustctl_get_max_subbuf_size(struct lttng_ust_shm_handle *handle,
97 struct lttng_ust_lib_ring_buffer *buf,
98 unsigned long *len);
2bdd86d4
MD
99
100/*
101 * For mmap mode, operate on the current packet (between get/put or
102 * get_next/put_next).
103 */
13161846
DG
104void *ustctl_get_mmap_base(struct lttng_ust_shm_handle *handle,
105 struct lttng_ust_lib_ring_buffer *buf);
106int ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle *handle,
107 struct lttng_ust_lib_ring_buffer *buf, unsigned long *off);
108int ustctl_get_subbuf_size(struct lttng_ust_shm_handle *handle,
109 struct lttng_ust_lib_ring_buffer *buf, unsigned long *len);
110int ustctl_get_padded_subbuf_size(struct lttng_ust_shm_handle *handle,
111 struct lttng_ust_lib_ring_buffer *buf, unsigned long *len);
112int ustctl_get_next_subbuf(struct lttng_ust_shm_handle *handle,
113 struct lttng_ust_lib_ring_buffer *buf);
114int ustctl_put_next_subbuf(struct lttng_ust_shm_handle *handle,
115 struct lttng_ust_lib_ring_buffer *buf);
2bdd86d4
MD
116
117/* snapshot */
118
13161846
DG
119int ustctl_snapshot(struct lttng_ust_shm_handle *handle,
120 struct lttng_ust_lib_ring_buffer *buf);
121int ustctl_snapshot_get_consumed(struct lttng_ust_shm_handle *handle,
122 struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos);
123int ustctl_snapshot_get_produced(struct lttng_ust_shm_handle *handle,
124 struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos);
125int ustctl_get_subbuf(struct lttng_ust_shm_handle *handle,
126 struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos);
127int ustctl_put_subbuf(struct lttng_ust_shm_handle *handle,
128 struct lttng_ust_lib_ring_buffer *buf);
2bdd86d4 129
8ec2d32a
MD
130void ustctl_flush_buffer(struct lttng_ust_shm_handle *handle,
131 struct lttng_ust_lib_ring_buffer *buf,
132 int producer_active);
133
2bdd86d4 134/* Release object created by members of this API */
177f8533 135int ustctl_release_object(int sock, struct lttng_ust_object_data *data);
2bdd86d4
MD
136
137#endif /* _LTTNG_UST_CTL_H */
This page took 0.028043 seconds and 4 git commands to generate.