Remove session daemon kernel list events command
[lttng-tools.git] / libkernelctl / libkernelctl.c
CommitLineData
ee0326c0 1/*
16421f6e
DG
2 * Copyright (C) 2011 - Julien Desfossez <julien.desfossez@polymtl.ca>
3 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ee0326c0
DG
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
82a3637f
DG
7 * as published by the Free Software Foundation; only version 2
8 * of the License.
ee0326c0
DG
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 */
16421f6e
DG
19
20#include <sys/ioctl.h>
21
22#include "kernel-ioctl.h"
23#include "libkernelctl.h"
16421f6e 24
d65106b1
DG
25int kernctl_add_context(int fd, struct lttng_kernel_context *ctx)
26{
27 return ioctl(fd, LTTNG_KERNEL_CONTEXT, ctx);
28}
29
f3ed775e
DG
30int kernctl_buffer_flush(int fd)
31{
32 return ioctl(fd, RING_BUFFER_FLUSH);
33}
34
35int kernctl_create_channel(int fd, struct lttng_channel_attr *chops)
16421f6e 36{
9cb98350 37 return ioctl(fd, LTTNG_KERNEL_CHANNEL, chops);
16421f6e
DG
38}
39
9cb98350 40int kernctl_create_event(int fd, struct lttng_kernel_event *ev)
16421f6e 41{
9cb98350 42 return ioctl(fd, LTTNG_KERNEL_EVENT, ev);
16421f6e
DG
43}
44
45int kernctl_create_session(int fd)
46{
9cb98350 47 return ioctl(fd, LTTNG_KERNEL_SESSION);
16421f6e
DG
48}
49
50int kernctl_create_stream(int fd)
51{
9cb98350 52 return ioctl(fd, LTTNG_KERNEL_STREAM);
16421f6e
DG
53}
54
f3ed775e
DG
55/* Enable event, channel and session ioctl */
56int kernctl_enable(int fd)
57{
58 return ioctl(fd, LTTNG_KERNEL_ENABLE);
59}
60
61/* Disable event, channel and session ioctl */
62int kernctl_disable(int fd)
63{
64 return ioctl(fd, LTTNG_KERNEL_DISABLE);
65}
66
16421f6e
DG
67/* returns the maximum size for sub-buffers. */
68int kernctl_get_max_subbuf_size(int fd, unsigned long *len)
69{
70 return ioctl(fd, RING_BUFFER_GET_MAX_SUBBUF_SIZE, len);
71}
72
73/* returns the length to mmap. */
74int kernctl_get_mmap_len(int fd, unsigned long *len)
75{
76 return ioctl(fd, RING_BUFFER_GET_MMAP_LEN, len);
77}
78
79/* returns the offset of the subbuffer belonging to the mmap reader. */
80int kernctl_get_mmap_read_offset(int fd, unsigned long *off)
81{
82 return ioctl(fd, RING_BUFFER_GET_MMAP_READ_OFFSET, off);
83}
84
85/* Get exclusive read access to the next sub-buffer that can be read. */
86int kernctl_get_next_subbuf(int fd)
87{
88 return ioctl(fd, RING_BUFFER_GET_NEXT_SUBBUF);
89}
90
91/* returns the size of the current sub-buffer, without padding (for mmap). */
92int kernctl_get_padded_subbuf_size(int fd, unsigned long *len)
93{
94 return ioctl(fd, RING_BUFFER_GET_PADDED_SUBBUF_SIZE, len);
95}
96
97/* Get exclusive read access to the specified sub-buffer position */
98int kernctl_get_subbuf(int fd, unsigned long *len)
99{
100 return ioctl(fd, RING_BUFFER_GET_SUBBUF, len);
101}
102
103/* returns the size of the current sub-buffer, without padding (for mmap). */
104int kernctl_get_subbuf_size(int fd, unsigned long *len)
105{
106 return ioctl(fd, RING_BUFFER_GET_SUBBUF_SIZE, len);
107}
108
d4a1283e 109/* open the metadata global channel */
f3ed775e 110int kernctl_open_metadata(int fd, struct lttng_channel_attr *chops)
d4a1283e 111{
9cb98350 112 return ioctl(fd, LTTNG_KERNEL_METADATA, chops);
d4a1283e
JD
113}
114
16421f6e
DG
115/* Release exclusive sub-buffer access, move consumer forward. */
116int kernctl_put_next_subbuf(int fd)
117{
118 return ioctl(fd, RING_BUFFER_PUT_NEXT_SUBBUF);
119}
120
121/* Release exclusive sub-buffer access */
122int kernctl_put_subbuf(int fd)
123{
124 return ioctl(fd, RING_BUFFER_PUT_SUBBUF);
125}
126
127/* Get a snapshot of the current ring buffer producer and consumer positions */
128int kernctl_snapshot(int fd)
129{
130 return ioctl(fd, RING_BUFFER_SNAPSHOT);
131}
132
133/* Get the consumer position (iteration start) */
134int kernctl_snapshot_get_consumed(int fd, unsigned long *pos)
135{
136 return ioctl(fd, RING_BUFFER_SNAPSHOT_GET_CONSUMED, pos);
137}
138
139/* Get the producer position (iteration end) */
140int kernctl_snapshot_get_produced(int fd, unsigned long *pos)
141{
142 return ioctl(fd, RING_BUFFER_SNAPSHOT_GET_PRODUCED, pos);
143}
144
145int kernctl_start_session(int fd)
146{
9cb98350 147 return ioctl(fd, LTTNG_KERNEL_SESSION_START);
16421f6e
DG
148}
149
150int kernctl_stop_session(int fd)
151{
9cb98350 152 return ioctl(fd, LTTNG_KERNEL_SESSION_STOP);
16421f6e
DG
153}
154
8d609afd
JD
155int kernctl_tracepoint_list(int fd)
156{
157 return ioctl(fd, LTTNG_KERNEL_TRACEPOINT_LIST);
158}
159
160int kernctl_tracer_version(int fd, struct lttng_kernel_tracer_version *v)
161{
162 return ioctl(fd, LTTNG_KERNEL_TRACER_VERSION, v);
163}
f3ed775e
DG
164
165int kernctl_wait_quiescent(int fd)
166{
167 return ioctl(fd, LTTNG_KERNEL_WAIT_QUIESCENT);
168}
This page took 0.03012 seconds and 4 git commands to generate.