| 1 | /* |
| 2 | * SPDX-License-Identifier: LGPL-2.1-only |
| 3 | * |
| 4 | * Copyright (C) 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | #ifndef _LIBRINGBUFFER_SHM_TYPES_H |
| 8 | #define _LIBRINGBUFFER_SHM_TYPES_H |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include <stddef.h> |
| 12 | #include <limits.h> |
| 13 | #include "shm_internal.h" |
| 14 | |
| 15 | struct lttng_ust_lib_ring_buffer_channel; |
| 16 | |
| 17 | enum shm_object_type { |
| 18 | SHM_OBJECT_SHM, |
| 19 | SHM_OBJECT_MEM, |
| 20 | }; |
| 21 | |
| 22 | struct shm_object { |
| 23 | enum shm_object_type type; |
| 24 | size_t index; /* within the object table */ |
| 25 | int shm_fd; /* shm fd */ |
| 26 | int wait_fd[2]; /* fd for wait/wakeup */ |
| 27 | char *memory_map; |
| 28 | size_t memory_map_size; |
| 29 | uint64_t allocated_len; |
| 30 | int shm_fd_ownership; |
| 31 | }; |
| 32 | |
| 33 | struct shm_object_table { |
| 34 | size_t size; |
| 35 | size_t allocated_len; |
| 36 | struct shm_object objects[]; |
| 37 | }; |
| 38 | |
| 39 | struct lttng_ust_shm_handle { |
| 40 | struct shm_object_table *table; |
| 41 | DECLARE_SHMP(struct lttng_ust_lib_ring_buffer_channel, chan); |
| 42 | }; |
| 43 | |
| 44 | #endif /* _LIBRINGBUFFER_SHM_TYPES_H */ |