Commit | Line | Data |
---|---|---|
f3105c67 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 | ||
23 | #include <ust/lttng-ust-abi.h> | |
24 | ||
1c5e467e | 25 | int ustctl_register_done(int sock); |
f3105c67 MD |
26 | int ustctl_create_session(int sock); |
27 | int ustctl_open_metadata(int sock, int session_handle, | |
28 | struct lttng_ust_channel_attr *chops, | |
61f02aea | 29 | struct lttng_ust_object_data **metadata_data); |
f3105c67 MD |
30 | int ustctl_create_channel(int sock, int session_handle, |
31 | struct lttng_ust_channel_attr *chops, | |
61f02aea MD |
32 | struct lttng_ust_object_data **channel_data); |
33 | int ustctl_create_stream(int sock, struct lttng_ust_object_data *channel_data, | |
34 | struct lttng_ust_object_data **stream_data); | |
f3105c67 | 35 | int ustctl_create_event(int sock, struct lttng_ust_event *ev, |
61f02aea MD |
36 | struct lttng_ust_object_data *channel_data, |
37 | struct lttng_ust_object_data **event_data); | |
f3105c67 | 38 | int ustctl_add_context(int sock, struct lttng_ust_context *ctx, |
61f02aea MD |
39 | struct lttng_ust_object_data *obj_data, |
40 | struct lttng_ust_object_data **context_data); | |
f3105c67 | 41 | |
61f02aea MD |
42 | int ustctl_enable(int sock, struct lttng_ust_object_data *object); |
43 | int ustctl_disable(int sock, struct lttng_ust_object_data *object); | |
4a6ca058 MD |
44 | int ustctl_start_session(int sock, int handle); |
45 | int ustctl_stop_session(int sock, int handle); | |
f3105c67 MD |
46 | |
47 | int ustctl_tracepoint_list(int sock); /* not implemented yet */ | |
48 | int ustctl_tracer_version(int sock, struct lttng_ust_tracer_version *v); | |
49 | int ustctl_wait_quiescent(int sock); | |
50 | ||
43861eab | 51 | /* Flush each buffers in this channel */ |
61f02aea | 52 | int ustctl_flush_buffer(int sock, struct lttng_ust_object_data *channel_data); |
43861eab | 53 | |
f3105c67 MD |
54 | /* not implemented yet */ |
55 | struct lttng_ust_calibrate; | |
56 | int ustctl_calibrate(int sock, struct lttng_ust_calibrate *calibrate); | |
57 | ||
f3105c67 MD |
58 | /* |
59 | * Map channel shm_handle and add streams. Typically performed by the | |
60 | * consumer to map the objects into its memory space. | |
61 | */ | |
61f02aea | 62 | struct shm_handle *ustctl_map_channel(struct lttng_ust_object_data *chan_data); |
f3105c67 | 63 | int ustctl_add_stream(struct shm_handle *shm_handle, |
61f02aea | 64 | struct lttng_ust_object_data *stream_data); |
5224b5c8 | 65 | /* |
61f02aea | 66 | * Note: the lttng_ust_object_data from which the shm_handle is derived can only |
5224b5c8 MD |
67 | * be released after unmapping the handle. |
68 | */ | |
69 | void ustctl_unmap_channel(struct shm_handle *shm_handle); | |
f3105c67 MD |
70 | |
71 | /* Buffer operations */ | |
72 | ||
73 | struct shm_handle; | |
74 | struct lib_ring_buffer; | |
75 | ||
6e922b24 MD |
76 | /* Open/close stream buffers for read */ |
77 | struct lib_ring_buffer *ustctl_open_stream_read(struct shm_handle *handle, | |
78 | int cpu); | |
79 | void ustctl_close_stream_read(struct shm_handle *handle, | |
80 | struct lib_ring_buffer *buf); | |
81 | ||
f3105c67 MD |
82 | /* For mmap mode, readable without "get" operation */ |
83 | int ustctl_get_mmap_len(struct shm_handle *handle, | |
84 | struct lib_ring_buffer *buf, | |
85 | unsigned long *len); | |
86 | int ustctl_get_max_subbuf_size(struct shm_handle *handle, | |
87 | struct lib_ring_buffer *buf, | |
88 | unsigned long *len); | |
89 | ||
90 | /* | |
91 | * For mmap mode, operate on the current packet (between get/put or | |
92 | * get_next/put_next). | |
93 | */ | |
9095efe9 MD |
94 | void *ustctl_get_mmap_base(struct shm_handle *handle, |
95 | struct lib_ring_buffer *buf); | |
f3105c67 MD |
96 | int ustctl_get_mmap_read_offset(struct shm_handle *handle, |
97 | struct lib_ring_buffer *buf, unsigned long *off); | |
98 | int ustctl_get_subbuf_size(struct shm_handle *handle, | |
99 | struct lib_ring_buffer *buf, unsigned long *len); | |
100 | int ustctl_get_padded_subbuf_size(struct shm_handle *handle, | |
101 | struct lib_ring_buffer *buf, unsigned long *len); | |
102 | int ustctl_get_next_subbuf(struct shm_handle *handle, | |
103 | struct lib_ring_buffer *buf); | |
104 | int ustctl_put_next_subbuf(struct shm_handle *handle, | |
105 | struct lib_ring_buffer *buf); | |
106 | ||
107 | /* snapshot */ | |
108 | ||
109 | int ustctl_snapshot(struct shm_handle *handle, | |
110 | struct lib_ring_buffer *buf); | |
111 | int ustctl_snapshot_get_consumed(struct shm_handle *handle, | |
112 | struct lib_ring_buffer *buf, unsigned long *pos); | |
113 | int ustctl_snapshot_get_produced(struct shm_handle *handle, | |
114 | struct lib_ring_buffer *buf, unsigned long *pos); | |
115 | int ustctl_get_subbuf(struct shm_handle *handle, | |
116 | struct lib_ring_buffer *buf, unsigned long *pos); | |
117 | int ustctl_put_subbuf(struct shm_handle *handle, | |
118 | struct lib_ring_buffer *buf); | |
119 | ||
120 | /* Release object created by members of this API */ | |
61f02aea | 121 | void release_object(int sock, struct lttng_ust_object_data *data); |
f3105c67 MD |
122 | |
123 | #endif /* _LTTNG_UST_CTL_H */ |