Fix message argument type
[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
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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"
24#include "lttngerr.h"
25
9cb98350 26int kernctl_create_channel(int fd, struct lttng_kernel_channel *chops)
16421f6e 27{
9cb98350 28 return ioctl(fd, LTTNG_KERNEL_CHANNEL, chops);
16421f6e
DG
29}
30
9cb98350 31int kernctl_create_event(int fd, struct lttng_kernel_event *ev)
16421f6e 32{
9cb98350 33 return ioctl(fd, LTTNG_KERNEL_EVENT, ev);
16421f6e
DG
34}
35
36int kernctl_create_session(int fd)
37{
9cb98350 38 return ioctl(fd, LTTNG_KERNEL_SESSION);
16421f6e
DG
39}
40
41int kernctl_create_stream(int fd)
42{
9cb98350 43 return ioctl(fd, LTTNG_KERNEL_STREAM);
16421f6e
DG
44}
45
46/* returns the maximum size for sub-buffers. */
47int kernctl_get_max_subbuf_size(int fd, unsigned long *len)
48{
49 return ioctl(fd, RING_BUFFER_GET_MAX_SUBBUF_SIZE, len);
50}
51
52/* returns the length to mmap. */
53int kernctl_get_mmap_len(int fd, unsigned long *len)
54{
55 return ioctl(fd, RING_BUFFER_GET_MMAP_LEN, len);
56}
57
58/* returns the offset of the subbuffer belonging to the mmap reader. */
59int kernctl_get_mmap_read_offset(int fd, unsigned long *off)
60{
61 return ioctl(fd, RING_BUFFER_GET_MMAP_READ_OFFSET, off);
62}
63
64/* Get exclusive read access to the next sub-buffer that can be read. */
65int kernctl_get_next_subbuf(int fd)
66{
67 return ioctl(fd, RING_BUFFER_GET_NEXT_SUBBUF);
68}
69
70/* returns the size of the current sub-buffer, without padding (for mmap). */
71int kernctl_get_padded_subbuf_size(int fd, unsigned long *len)
72{
73 return ioctl(fd, RING_BUFFER_GET_PADDED_SUBBUF_SIZE, len);
74}
75
76/* Get exclusive read access to the specified sub-buffer position */
77int kernctl_get_subbuf(int fd, unsigned long *len)
78{
79 return ioctl(fd, RING_BUFFER_GET_SUBBUF, len);
80}
81
82/* returns the size of the current sub-buffer, without padding (for mmap). */
83int kernctl_get_subbuf_size(int fd, unsigned long *len)
84{
85 return ioctl(fd, RING_BUFFER_GET_SUBBUF_SIZE, len);
86}
87
d4a1283e 88/* open the metadata global channel */
9cb98350 89int kernctl_open_metadata(int fd, struct lttng_kernel_channel *chops)
d4a1283e 90{
9cb98350 91 return ioctl(fd, LTTNG_KERNEL_METADATA, chops);
d4a1283e
JD
92}
93
16421f6e
DG
94/* Release exclusive sub-buffer access, move consumer forward. */
95int kernctl_put_next_subbuf(int fd)
96{
97 return ioctl(fd, RING_BUFFER_PUT_NEXT_SUBBUF);
98}
99
100/* Release exclusive sub-buffer access */
101int kernctl_put_subbuf(int fd)
102{
103 return ioctl(fd, RING_BUFFER_PUT_SUBBUF);
104}
105
106/* Get a snapshot of the current ring buffer producer and consumer positions */
107int kernctl_snapshot(int fd)
108{
109 return ioctl(fd, RING_BUFFER_SNAPSHOT);
110}
111
112/* Get the consumer position (iteration start) */
113int kernctl_snapshot_get_consumed(int fd, unsigned long *pos)
114{
115 return ioctl(fd, RING_BUFFER_SNAPSHOT_GET_CONSUMED, pos);
116}
117
118/* Get the producer position (iteration end) */
119int kernctl_snapshot_get_produced(int fd, unsigned long *pos)
120{
121 return ioctl(fd, RING_BUFFER_SNAPSHOT_GET_PRODUCED, pos);
122}
123
124int kernctl_start_session(int fd)
125{
9cb98350 126 return ioctl(fd, LTTNG_KERNEL_SESSION_START);
16421f6e
DG
127}
128
129int kernctl_stop_session(int fd)
130{
9cb98350 131 return ioctl(fd, LTTNG_KERNEL_SESSION_STOP);
16421f6e
DG
132}
133
8d609afd
JD
134int kernctl_tracepoint_list(int fd)
135{
136 return ioctl(fd, LTTNG_KERNEL_TRACEPOINT_LIST);
137}
138
139int kernctl_tracer_version(int fd, struct lttng_kernel_tracer_version *v)
140{
141 return ioctl(fd, LTTNG_KERNEL_TRACER_VERSION, v);
142}
This page took 0.04042 seconds and 4 git commands to generate.