Move to kernel style SPDX license identifiers
[lttng-ust.git] / include / lttng / ringbuffer-abi.h
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2005-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * Wait-free ring buffer ABI.
7 */
8
9 #ifndef _LTTNG_RING_BUFFER_ABI_H
10 #define _LTTNG_RING_BUFFER_ABI_H
11
12 #define _UST_CMD(minor) (minor)
13 #define _UST_CMDR(minor, type) (minor)
14 #define _UST_CMDW(minor, type) (minor)
15
16 /*
17 * Use RING_BUFFER_GET_NEXT_SUBBUF / RING_BUFFER_PUT_NEXT_SUBBUF to read and
18 * consume sub-buffers sequentially.
19 *
20 * Reading sub-buffers without consuming them can be performed with:
21 *
22 * RING_BUFFER_SNAPSHOT
23 * RING_BUFFER_SNAPSHOT_GET_CONSUMED
24 * RING_BUFFER_SNAPSHOT_GET_PRODUCED
25 *
26 * to get the offset range to consume, and then by passing each sub-buffer
27 * offset to RING_BUFFER_GET_SUBBUF, read the sub-buffer, and then release it
28 * with RING_BUFFER_PUT_SUBBUF.
29 *
30 * Note that the "snapshot" API can be used to read the sub-buffer in reverse
31 * order, which is useful for flight recorder snapshots.
32 */
33
34 /* Get a snapshot of the current ring buffer producer and consumer positions */
35 #define RING_BUFFER_SNAPSHOT _UST_CMD(0x00)
36 /* Get the consumer position (iteration start) */
37 #define RING_BUFFER_SNAPSHOT_GET_CONSUMED _UST_CMDR(0x01, unsigned long)
38 /* Get the producer position (iteration end) */
39 #define RING_BUFFER_SNAPSHOT_GET_PRODUCED _UST_CMDR(0x02, unsigned long)
40 /* Get exclusive read access to the specified sub-buffer position */
41 #define RING_BUFFER_GET_SUBBUF _UST_CMDW(0x03, unsigned long)
42 /* Release exclusive sub-buffer access */
43 #define RING_BUFFER_PUT_SUBBUF _UST_CMD(0x04)
44
45 /* Get exclusive read access to the next sub-buffer that can be read. */
46 #define RING_BUFFER_GET_NEXT_SUBBUF _UST_CMD(0x05)
47 /* Release exclusive sub-buffer access, move consumer forward. */
48 #define RING_BUFFER_PUT_NEXT_SUBBUF _UST_CMD(0x06)
49 /* returns the size of the current sub-buffer, without padding (for mmap). */
50 #define RING_BUFFER_GET_SUBBUF_SIZE _UST_CMDR(0x07, unsigned long)
51 /* returns the size of the current sub-buffer, with padding (for splice). */
52 #define RING_BUFFER_GET_PADDED_SUBBUF_SIZE _UST_CMDR(0x08, unsigned long)
53 /* returns the maximum size for sub-buffers. */
54 #define RING_BUFFER_GET_MAX_SUBBUF_SIZE _UST_CMDR(0x09, unsigned long)
55 /* returns the length to mmap. */
56 #define RING_BUFFER_GET_MMAP_LEN _UST_CMDR(0x0A, unsigned long)
57 /* returns the offset of the subbuffer belonging to the mmap reader. */
58 #define RING_BUFFER_GET_MMAP_READ_OFFSET _UST_CMDR(0x0B, unsigned long)
59 /* flush the current sub-buffer */
60 #define RING_BUFFER_FLUSH _UST_CMD(0x0C)
61
62 #endif /* _LTTNG_RING_BUFFER_ABI_H */
This page took 0.029611 seconds and 4 git commands to generate.