** Warning: Cannot open xref database.
1 #ifndef __jack_shm_h__
2 #define __jack_shm_h__
3
4 #include <limits.h>
5 #include <sys/types.h>
6 #include <jack/types.h>
7
8 #define MAX_SHM_ID 256 /* likely use is more like 16 per jackd */
9
10 #ifdef USE_POSIX_SHM
11 typedef shm_name_t jack_shm_id_t;
12 #else
13 typedef int jack_shm_id_t;
14 #endif /* !USE_POSIX_SHM */
15
16 typedef int16_t jack_shm_registry_index_t;
17
18 /**
19 * A structure holding information about shared memory
20 * allocated by JACK. this version persists across
21 * invocations of JACK, and can be used by multiple
22 * JACK servers. It contains no pointers and is valid
23 * across address spaces.
24 */
25 typedef struct _jack_shm_registry {
26 pid_t allocator; /* PID that created shm segment */
27 jack_shmsize_t size; /* needed for POSIX unattach */
28 jack_shm_registry_index_t index; /* offset into the registry */
29 jack_shm_id_t id; /* API specific, see above */
30 } jack_shm_registry_t;
31
32 /**
33 * a structure holding information about shared memory
34 * allocated by JACK. this version is valid only
35 * for a given address space. It contains a pointer
36 * indicating where the shared memory has been
37 * attached to the address space.
38 */
39 typedef struct _jack_shm_info {
40 jack_shm_registry_index_t index; /* offset into the registry */
41 char* attached_at; /* address where attached */
42 } jack_shm_info_t;
43
44 /* utility functions used only within JACK */
45
46 extern void jack_shm_copy_from_registry (jack_shm_info_t*,
47 jack_shm_registry_index_t);
48 extern void jack_shm_copy_to_registry (jack_shm_info_t*,
49 jack_shm_registry_index_t*);
50 extern void jack_release_shm_info (jack_shm_registry_index_t);
51
52 static inline char* jack_shm_addr (jack_shm_info_t* si) {
53 return si->attached_at;
54 }
55
56 /* here beginneth the API */
57
58 extern int jack_initialize_shm ();
59 extern void jack_cleanup_shm ();
60
61 extern int jack_shmalloc (const char *shm_name, jack_shmsize_t size, jack_shm_info_t* result);
62 extern void jack_release_shm (jack_shm_info_t*);
63 extern void jack_destroy_shm (jack_shm_info_t*);
64 extern int jack_attach_shm (jack_shm_info_t*);
65 extern int jack_resize_shm (jack_shm_info_t*, jack_shmsize_t size);
66
67 #endif /* __jack_shm_h__ */
68
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.