| 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 _LIBCOUNTER_SHM_TYPES_H |
| 8 | #define _LIBCOUNTER_SHM_TYPES_H |
| 9 | |
| 10 | #include <stdint.h> |
| 11 | #include <stddef.h> |
| 12 | #include <limits.h> |
| 13 | #include "shm_internal.h" |
| 14 | |
| 15 | enum lttng_counter_shm_object_type { |
| 16 | LTTNG_COUNTER_SHM_OBJECT_SHM, |
| 17 | LTTNG_COUNTER_SHM_OBJECT_MEM, |
| 18 | }; |
| 19 | |
| 20 | struct lttng_counter_shm_object { |
| 21 | enum lttng_counter_shm_object_type type; |
| 22 | size_t index; /* within the object table */ |
| 23 | int shm_fd; /* shm fd */ |
| 24 | char *memory_map; |
| 25 | size_t memory_map_size; |
| 26 | uint64_t allocated_len; |
| 27 | int shm_fd_ownership; |
| 28 | }; |
| 29 | |
| 30 | struct lttng_counter_shm_object_table { |
| 31 | size_t size; |
| 32 | size_t allocated_len; |
| 33 | struct lttng_counter_shm_object objects[]; |
| 34 | }; |
| 35 | |
| 36 | struct lttng_counter_shm_handle { |
| 37 | struct lttng_counter_shm_object_table *table; |
| 38 | }; |
| 39 | |
| 40 | #endif /* _LIBCOUNTER_SHM_TYPES_H */ |