1 #ifndef _LTTNG_RING_BUFFER_ABI_H
2 #define _LTTNG_RING_BUFFER_ABI_H
5 * lttng/ringbuffer-abi.h
7 * (C) Copyright 2005-2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Wait-free ring buffer ABI.
12 * Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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:
21 * The above copyright notice and this permission notice shall be included in
22 * all copies or substantial portions of the Software.
25 #define _UST_CMD(minor) (minor)
26 #define _UST_CMDR(minor, type) (minor)
27 #define _UST_CMDW(minor, type) (minor)
30 * Use RING_BUFFER_GET_NEXT_SUBBUF / RING_BUFFER_PUT_NEXT_SUBBUF to read and
31 * consume sub-buffers sequentially.
33 * Reading sub-buffers without consuming them can be performed with:
35 * RING_BUFFER_SNAPSHOT
36 * RING_BUFFER_SNAPSHOT_GET_CONSUMED
37 * RING_BUFFER_SNAPSHOT_GET_PRODUCED
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.
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.
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)
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)
75 #endif /* _LTTNG_RING_BUFFER_ABI_H */
This page took 0.029934 seconds and 4 git commands to generate.