RTEMS  5.0.0
shm.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (c) 2016 Gedare Bloom.
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
15 #ifndef _RTEMS_POSIX_SHM_H
16 #define _RTEMS_POSIX_SHM_H
17 
18 #include <rtems/score/objectdata.h>
19 #include <rtems/score/threadq.h>
20 
21 #include <sys/types.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
36 extern const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations;
37 
41 typedef struct {
45  void *handle;
46 
51  size_t size;
52 
58 
70  int ( *object_create ) ( POSIX_Shm_Object *shm_obj, size_t size );
71 
79  int ( *object_resize ) ( POSIX_Shm_Object *shm_obj, size_t size );
80 
88  int ( *object_delete ) ( POSIX_Shm_Object *shm_obj );
89 
95  int ( *object_read ) ( POSIX_Shm_Object *shm_obj, void *buf, size_t count );
96 
105  void * ( *object_mmap ) ( POSIX_Shm_Object *shm_obj, size_t len, int prot, off_t off);
106 };
107 
111 typedef struct {
112  Objects_Control Object;
113  Thread_queue_Control Wait_queue;
114 
115  int reference_count;
116 
117  POSIX_Shm_Object shm_object;
118 
119  uid_t uid;
120  gid_t gid;
121  mode_t mode;
122  int oflag;
123 
124  time_t atime;
125  time_t mtime;
126  time_t ctime;
128 
133 
143 #define POSIX_SHM_INFORMATION_DEFINE( max ) \
144  OBJECTS_INFORMATION_DEFINE( \
145  _POSIX_Shm, \
146  OBJECTS_POSIX_API, \
147  OBJECTS_POSIX_SHMS, \
148  POSIX_Shm_Control, \
149  max, \
150  _POSIX_PATH_MAX, \
151  NULL \
152  )
153 
158  POSIX_Shm_Object *shm_obj,
159  size_t size
160 );
161 
166 
171  POSIX_Shm_Object *shm_obj,
172  size_t size
173 );
174 
179  POSIX_Shm_Object *shm_obj,
180  void *buf,
181  size_t count
182 );
183 
188  POSIX_Shm_Object *shm_obj,
189  size_t len,
190  int prot,
191  off_t off
192 );
193 
198  POSIX_Shm_Object *shm_obj,
199  size_t size
200 );
201 
206 
211  POSIX_Shm_Object *shm_obj,
212  size_t size
213 );
214 
219  POSIX_Shm_Object *shm_obj,
220  void *buf,
221  size_t count
222 );
223 
228  POSIX_Shm_Object *shm_obj,
229  size_t len,
230  int prot,
231  off_t off
232 );
233 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif
void * _POSIX_Shm_Object_mmap_from_heap(POSIX_Shm_Object *shm_obj, size_t len, int prot, off_t off)
object_mmap operation for shm objects stored in C program heap.
Definition: shmheap.c:94
int _POSIX_Shm_Object_resize_from_workspace(POSIX_Shm_Object *shm_obj, size_t size)
object_resize operation for shm objects stored in RTEMS Workspace.
Definition: shmwkspace.c:43
Definition: objectdata.h:39
int(* object_resize)(POSIX_Shm_Object *shm_obj, size_t size)
Changes the shm_obj size to size.
Definition: shm.h:79
void * _POSIX_Shm_Object_mmap_from_workspace(POSIX_Shm_Object *shm_obj, size_t len, int prot, off_t off)
object_mmap operation for shm objects stored in RTEMS Workspace.
Definition: shmwkspace.c:79
Definition: threadq.h:547
int _POSIX_Shm_Object_resize_from_heap(POSIX_Shm_Object *shm_obj, size_t size)
object_resize operation for shm objects stored in C program heap.
Definition: shmheap.c:47
Constants and Structures Needed to Declare a Thread Queue.
Control for a POSIX Shared Memory Object.
Definition: shm.h:111
int(* object_delete)(POSIX_Shm_Object *shm_obj)
Deletes the shm_obj.
Definition: shm.h:88
Operations on POSIX Shared Memory Objects.
Definition: shm.h:62
Object Handler Data Structures.
int _POSIX_Shm_Object_read_from_workspace(POSIX_Shm_Object *shm_obj, void *buf, size_t count)
object_read operation for shm objects stored in RTEMS Workspace.
Definition: shmwkspace.c:61
int(* object_create)(POSIX_Shm_Object *shm_obj, size_t size)
Allocates a new shm_obj with initial size.
Definition: shm.h:70
Objects_Information _POSIX_Shm_Information
The POSIX Shared Memory objects information.
int _POSIX_Shm_Object_read_from_heap(POSIX_Shm_Object *shm_obj, void *buf, size_t count)
object_read operation for shm objects stored in C program heap.
Definition: shmheap.c:75
int _POSIX_Shm_Object_create_from_heap(POSIX_Shm_Object *shm_obj, size_t size)
object_create operation for shm objects stored in C program heap.
Definition: shmheap.c:22
void * handle
The handle is private for finding object storage.
Definition: shm.h:45
int _POSIX_Shm_Object_delete_from_workspace(POSIX_Shm_Object *shm_obj)
object_delete operation for shm objects stored in RTEMS Workspace.
Definition: shmwkspace.c:33
The information structure used to manage each API class of objects.
Definition: objectdata.h:160
int _POSIX_Shm_Object_create_from_workspace(POSIX_Shm_Object *shm_obj, size_t size)
object_create operation for shm objects stored in RTEMS Workspace.
Definition: shmwkspace.c:22
int(* object_read)(POSIX_Shm_Object *shm_obj, void *buf, size_t count)
Copies up to bytes of the shm_obj data into buf.
Definition: shm.h:95
size_t size
The number of bytes allocated to the object. A size of 0 with a handle of NULL means no object is all...
Definition: shm.h:51
int _POSIX_Shm_Object_delete_from_heap(POSIX_Shm_Object *shm_obj)
object_delete operation for shm objects stored in C program heap.
Definition: shmheap.c:37
unsigned size
Definition: tte.h:74
const POSIX_Shm_Object_operations * ops
Implementation-specific operations on shm objects.
Definition: shm.h:56
Encapsulation for the storage and manipulation of shm objects.
Definition: shm.h:41