Commit | Line | Data |
---|---|---|
1d498196 MD |
1 | #ifndef _LIBRINGBUFFER_SHM_TYPES_H |
2 | #define _LIBRINGBUFFER_SHM_TYPES_H | |
3 | ||
4 | /* | |
5 | * libringbuffer/shm_types.h | |
6 | * | |
7 | * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
8 | * | |
9 | * Dual LGPL v2.1/GPL v2 license. | |
10 | */ | |
11 | ||
12 | #include <stdint.h> | |
13 | #include "shm_internal.h" | |
14 | ||
15 | struct channel; | |
16 | ||
17 | struct shm_object { | |
18 | size_t index; /* within the object table */ | |
19 | int shm_fd; /* shm fd */ | |
20 | int wait_fd[2]; /* fd for wait/wakeup */ | |
21 | char *memory_map; | |
22 | size_t memory_map_size; | |
23 | size_t allocated_len; | |
24 | }; | |
25 | ||
26 | struct shm_object_table { | |
27 | size_t size; | |
28 | size_t allocated_len; | |
29 | struct shm_object objects[]; | |
30 | }; | |
31 | ||
32 | struct shm_handle { | |
33 | struct shm_object_table *table; | |
34 | DECLARE_SHMP(struct channel, chan); | |
35 | /* | |
36 | * In the consumer, chan points to a shadow copy, validated upon | |
37 | * reception. The chan object is overridden in the consumer to | |
38 | * point to this shadow copy. | |
39 | */ | |
40 | struct channel *shadow_chan; | |
41 | }; | |
42 | ||
43 | #endif /* _LIBRINGBUFFER_SHM_TYPES_H */ |