Commit | Line | Data |
---|---|---|
e92f3e28 MD |
1 | #ifndef _LTTNG_RING_BUFFER_ABI_H |
2 | #define _LTTNG_RING_BUFFER_ABI_H | |
9f3fdbc6 MD |
3 | |
4 | /* | |
e92f3e28 | 5 | * lttng/ringbuffer-abi.h |
9f3fdbc6 | 6 | * |
e92f3e28 | 7 | * (C) Copyright 2005-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
9f3fdbc6 MD |
8 | * |
9 | * Wait-free ring buffer ABI. | |
10 | * | |
11 | * Author: | |
12 | * Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
13 | * | |
e92f3e28 MD |
14 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
15 | * of this software and associated documentation files (the "Software"), to deal | |
16 | * in the Software without restriction, including without limitation the rights | |
17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
18 | * copies of the Software, and to permit persons to whom the Software is | |
19 | * furnished to do so, subject to the following conditions: | |
a60d70e6 | 20 | * |
e92f3e28 MD |
21 | * The above copyright notice and this permission notice shall be included in |
22 | * all copies or substantial portions of the Software. | |
9f3fdbc6 MD |
23 | */ |
24 | ||
25 | #define _UST_CMD(minor) (minor) | |
26 | #define _UST_CMDR(minor, type) (minor) | |
27 | #define _UST_CMDW(minor, type) (minor) | |
28 | ||
29 | /* | |
30 | * Use RING_BUFFER_GET_NEXT_SUBBUF / RING_BUFFER_PUT_NEXT_SUBBUF to read and | |
31 | * consume sub-buffers sequentially. | |
32 | * | |
33 | * Reading sub-buffers without consuming them can be performed with: | |
34 | * | |
35 | * RING_BUFFER_SNAPSHOT | |
36 | * RING_BUFFER_SNAPSHOT_GET_CONSUMED | |
37 | * RING_BUFFER_SNAPSHOT_GET_PRODUCED | |
38 | * | |
39 | * to get the offset range to consume, and then by passing each sub-buffer | |
40 | * offset to RING_BUFFER_GET_SUBBUF, read the sub-buffer, and then release it | |
41 | * with RING_BUFFER_PUT_SUBBUF. | |
42 | * | |
43 | * Note that the "snapshot" API can be used to read the sub-buffer in reverse | |
44 | * order, which is useful for flight recorder snapshots. | |
45 | */ | |
46 | ||
47 | /* Get a snapshot of the current ring buffer producer and consumer positions */ | |
48 | #define RING_BUFFER_SNAPSHOT _UST_CMD(0x00) | |
49 | /* Get the consumer position (iteration start) */ | |
50 | #define RING_BUFFER_SNAPSHOT_GET_CONSUMED _UST_CMDR(0x01, unsigned long) | |
51 | /* Get the producer position (iteration end) */ | |
52 | #define RING_BUFFER_SNAPSHOT_GET_PRODUCED _UST_CMDR(0x02, unsigned long) | |
53 | /* Get exclusive read access to the specified sub-buffer position */ | |
54 | #define RING_BUFFER_GET_SUBBUF _UST_CMDW(0x03, unsigned long) | |
55 | /* Release exclusive sub-buffer access */ | |
56 | #define RING_BUFFER_PUT_SUBBUF _UST_CMD(0x04) | |
57 | ||
58 | /* Get exclusive read access to the next sub-buffer that can be read. */ | |
59 | #define RING_BUFFER_GET_NEXT_SUBBUF _UST_CMD(0x05) | |
60 | /* Release exclusive sub-buffer access, move consumer forward. */ | |
61 | #define RING_BUFFER_PUT_NEXT_SUBBUF _UST_CMD(0x06) | |
62 | /* returns the size of the current sub-buffer, without padding (for mmap). */ | |
63 | #define RING_BUFFER_GET_SUBBUF_SIZE _UST_CMDR(0x07, unsigned long) | |
64 | /* returns the size of the current sub-buffer, with padding (for splice). */ | |
65 | #define RING_BUFFER_GET_PADDED_SUBBUF_SIZE _UST_CMDR(0x08, unsigned long) | |
66 | /* returns the maximum size for sub-buffers. */ | |
67 | #define RING_BUFFER_GET_MAX_SUBBUF_SIZE _UST_CMDR(0x09, unsigned long) | |
68 | /* returns the length to mmap. */ | |
69 | #define RING_BUFFER_GET_MMAP_LEN _UST_CMDR(0x0A, unsigned long) | |
70 | /* returns the offset of the subbuffer belonging to the mmap reader. */ | |
71 | #define RING_BUFFER_GET_MMAP_READ_OFFSET _UST_CMDR(0x0B, unsigned long) | |
72 | /* flush the current sub-buffer */ | |
73 | #define RING_BUFFER_FLUSH _UST_CMD(0x0C) | |
74 | ||
e92f3e28 | 75 | #endif /* _LTTNG_RING_BUFFER_ABI_H */ |