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