Commit | Line | Data |
---|---|---|
2bdd86d4 MD |
1 | /* |
2 | * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca> | |
3 | * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
4 | * | |
d14d33bf AM |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License, version 2 only, | |
7 | * as published by the Free Software Foundation. | |
2bdd86d4 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 | * | |
d14d33bf AM |
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. | |
2bdd86d4 MD |
17 | */ |
18 | ||
19 | #ifndef _LTTNG_UST_CTL_H | |
20 | #define _LTTNG_UST_CTL_H | |
21 | ||
9df8df5e | 22 | #include "lttng-ust-abi.h" |
2bdd86d4 | 23 | |
13161846 DG |
24 | int ustctl_register_done(int sock); |
25 | int ustctl_create_session(int sock); | |
2bdd86d4 MD |
26 | int ustctl_open_metadata(int sock, int session_handle, |
27 | struct lttng_ust_channel_attr *chops, | |
13161846 | 28 | struct lttng_ust_object_data **metadata_data); |
2bdd86d4 MD |
29 | int ustctl_create_channel(int sock, int session_handle, |
30 | struct lttng_ust_channel_attr *chops, | |
13161846 DG |
31 | struct lttng_ust_object_data **channel_data); |
32 | int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data, | |
33 | struct lttng_ust_object_data **stream_data); | |
2bdd86d4 | 34 | int ustctl_create_event(int sock, struct lttng_ust_event *ev, |
13161846 DG |
35 | struct lttng_ust_object_data *channel_data, |
36 | struct lttng_ust_object_data **event_data); | |
2bdd86d4 | 37 | int ustctl_add_context(int sock, struct lttng_ust_context *ctx, |
13161846 DG |
38 | struct lttng_ust_object_data *obj_data, |
39 | struct lttng_ust_object_data **context_data); | |
2bdd86d4 | 40 | |
13161846 DG |
41 | int ustctl_enable(int sock, struct lttng_ust_object_data *object); |
42 | int ustctl_disable(int sock, struct lttng_ust_object_data *object); | |
43 | int ustctl_start_session(int sock, int handle); | |
44 | int ustctl_stop_session(int sock, int handle); | |
2bdd86d4 | 45 | |
8ec2d32a MD |
46 | /* |
47 | * ustctl_tracepoint_list returns a tracepoint list handle, or negative | |
48 | * error value. | |
49 | */ | |
50 | int 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 | */ | |
55 | int ustctl_tracepoint_list_get(int sock, int tp_list_handle, | |
177f8533 | 56 | struct lttng_ust_tracepoint_iter *iter); |
8ec2d32a | 57 | |
f37d259d MD |
58 | /* |
59 | * ustctl_tracepoint_field_list returns a tracepoint field list handle, | |
60 | * or negative error value. | |
61 | */ | |
62 | int ustctl_tracepoint_field_list(int sock); | |
63 | ||
64 | /* | |
65 | * ustctl_tracepoint_field_list_get is used to iterate on the tp field | |
66 | * list handle. End is iteration is reached when -ENOENT is returned. | |
67 | */ | |
68 | int ustctl_tracepoint_field_list_get(int sock, int tp_field_list_handle, | |
69 | struct lttng_ust_field_iter *iter); | |
70 | ||
13161846 DG |
71 | int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v); |
72 | int ustctl_wait_quiescent(int sock); | |
2bdd86d4 | 73 | |
6d3686da DG |
74 | int ustctl_sock_flush_buffer(int sock, struct lttng_ust_object_data *object); |
75 | ||
2bdd86d4 | 76 | /* not implemented yet */ |
13161846 | 77 | int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); |
2bdd86d4 MD |
78 | |
79 | /* | |
13161846 | 80 | * Map channel lttng_ust_shm_handle and add streams. Typically performed by the |
2bdd86d4 MD |
81 | * consumer to map the objects into its memory space. |
82 | */ | |
13161846 DG |
83 | struct lttng_ust_shm_handle *ustctl_map_channel(struct lttng_ust_object_data *chan_data); |
84 | int ustctl_add_stream(struct lttng_ust_shm_handle *lttng_ust_shm_handle, | |
85 | struct lttng_ust_object_data *stream_data); | |
2bdd86d4 | 86 | /* |
13161846 | 87 | * Note: the lttng_ust_object_data from which the lttng_ust_shm_handle is derived can only |
2bdd86d4 MD |
88 | * be released after unmapping the handle. |
89 | */ | |
13161846 | 90 | void ustctl_unmap_channel(struct lttng_ust_shm_handle *lttng_ust_shm_handle); |
2bdd86d4 MD |
91 | |
92 | /* Buffer operations */ | |
93 | ||
13161846 DG |
94 | struct lttng_ust_shm_handle; |
95 | struct lttng_ust_lib_ring_buffer; | |
2bdd86d4 MD |
96 | |
97 | /* Open/close stream buffers for read */ | |
13161846 DG |
98 | struct lttng_ust_lib_ring_buffer *ustctl_open_stream_read(struct lttng_ust_shm_handle *handle, |
99 | int cpu); | |
100 | void ustctl_close_stream_read(struct lttng_ust_shm_handle *handle, | |
101 | struct lttng_ust_lib_ring_buffer *buf); | |
2bdd86d4 MD |
102 | |
103 | /* For mmap mode, readable without "get" operation */ | |
13161846 DG |
104 | int ustctl_get_mmap_len(struct lttng_ust_shm_handle *handle, |
105 | struct lttng_ust_lib_ring_buffer *buf, | |
106 | unsigned long *len); | |
107 | int ustctl_get_max_subbuf_size(struct lttng_ust_shm_handle *handle, | |
108 | struct lttng_ust_lib_ring_buffer *buf, | |
109 | unsigned long *len); | |
2bdd86d4 MD |
110 | |
111 | /* | |
112 | * For mmap mode, operate on the current packet (between get/put or | |
113 | * get_next/put_next). | |
114 | */ | |
13161846 DG |
115 | void *ustctl_get_mmap_base(struct lttng_ust_shm_handle *handle, |
116 | struct lttng_ust_lib_ring_buffer *buf); | |
117 | int ustctl_get_mmap_read_offset(struct lttng_ust_shm_handle *handle, | |
118 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *off); | |
119 | int ustctl_get_subbuf_size(struct lttng_ust_shm_handle *handle, | |
120 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *len); | |
121 | int ustctl_get_padded_subbuf_size(struct lttng_ust_shm_handle *handle, | |
122 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *len); | |
123 | int ustctl_get_next_subbuf(struct lttng_ust_shm_handle *handle, | |
124 | struct lttng_ust_lib_ring_buffer *buf); | |
125 | int ustctl_put_next_subbuf(struct lttng_ust_shm_handle *handle, | |
126 | struct lttng_ust_lib_ring_buffer *buf); | |
2bdd86d4 MD |
127 | |
128 | /* snapshot */ | |
129 | ||
13161846 DG |
130 | int ustctl_snapshot(struct lttng_ust_shm_handle *handle, |
131 | struct lttng_ust_lib_ring_buffer *buf); | |
132 | int ustctl_snapshot_get_consumed(struct lttng_ust_shm_handle *handle, | |
133 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos); | |
134 | int ustctl_snapshot_get_produced(struct lttng_ust_shm_handle *handle, | |
135 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos); | |
136 | int ustctl_get_subbuf(struct lttng_ust_shm_handle *handle, | |
137 | struct lttng_ust_lib_ring_buffer *buf, unsigned long *pos); | |
138 | int ustctl_put_subbuf(struct lttng_ust_shm_handle *handle, | |
139 | struct lttng_ust_lib_ring_buffer *buf); | |
2bdd86d4 | 140 | |
8ec2d32a MD |
141 | void ustctl_flush_buffer(struct lttng_ust_shm_handle *handle, |
142 | struct lttng_ust_lib_ring_buffer *buf, | |
143 | int producer_active); | |
144 | ||
2bdd86d4 | 145 | /* Release object created by members of this API */ |
177f8533 | 146 | int ustctl_release_object(int sock, struct lttng_ust_object_data *data); |
c3fd7e61 DG |
147 | /* Release handle returned by create session. */ |
148 | int ustctl_release_handle(int sock, int handle); | |
2bdd86d4 MD |
149 | |
150 | #endif /* _LTTNG_UST_CTL_H */ |