RTEMS 6.1-rc4
Loading...
Searching...
No Matches
shm.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
9/*
10 * Copyright (c) 2016 Gedare Bloom.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _RTEMS_POSIX_SHM_H
35#define _RTEMS_POSIX_SHM_H
36
38#include <rtems/score/threadq.h>
39
40#include <sys/types.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
55extern const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations;
56
60typedef struct {
64 void *handle;
65
70 size_t size;
71
77
89 int ( *object_create ) ( POSIX_Shm_Object *shm_obj, size_t size );
90
98 int ( *object_resize ) ( POSIX_Shm_Object *shm_obj, size_t size );
99
107 int ( *object_delete ) ( POSIX_Shm_Object *shm_obj );
108
114 int ( *object_read ) ( POSIX_Shm_Object *shm_obj, void *buf, size_t count );
115
124 void * ( *object_mmap ) ( POSIX_Shm_Object *shm_obj, size_t len, int prot, off_t off);
125};
126
130typedef struct {
131 Objects_Control Object;
132 Thread_queue_Control Wait_queue;
133
134 int reference_count;
135
136 POSIX_Shm_Object shm_object;
137
138 uid_t uid;
139 gid_t gid;
140 mode_t mode;
141 int oflag;
142
143 time_t atime;
144 time_t mtime;
145 time_t ctime;
147
152
162#define POSIX_SHM_INFORMATION_DEFINE( max ) \
163 OBJECTS_INFORMATION_DEFINE( \
164 _POSIX_Shm, \
165 OBJECTS_POSIX_API, \
166 OBJECTS_POSIX_SHMS, \
167 POSIX_Shm_Control, \
168 max, \
169 _POSIX_PATH_MAX, \
170 NULL \
171 )
172
177 POSIX_Shm_Object *shm_obj,
178 size_t size
179);
180
185
190 POSIX_Shm_Object *shm_obj,
191 size_t size
192);
193
198 POSIX_Shm_Object *shm_obj,
199 void *buf,
200 size_t count
201);
202
207 POSIX_Shm_Object *shm_obj,
208 size_t len,
209 int prot,
210 off_t off
211);
212
217 POSIX_Shm_Object *shm_obj,
218 size_t size
219);
220
225
230 POSIX_Shm_Object *shm_obj,
231 size_t size
232);
233
238 POSIX_Shm_Object *shm_obj,
239 void *buf,
240 size_t count
241);
242
247 POSIX_Shm_Object *shm_obj,
248 size_t len,
249 int prot,
250 off_t off
251);
252
255#ifdef __cplusplus
256}
257#endif
258
259#endif
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:41
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:84
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:66
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:113
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:94
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:56
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:41
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:66
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:56
Objects_Information _POSIX_Shm_Information
The POSIX Shared Memory objects information.
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:102
This header file provides data structures used by the implementation and the Application Configuratio...
Definition: objectdata.h:61
The information structure used to manage each API class of objects.
Definition: objectdata.h:198
Control for a POSIX Shared Memory Object.
Definition: shm.h:130
Operations on POSIX Shared Memory Objects.
Definition: shm.h:81
int(* object_resize)(POSIX_Shm_Object *shm_obj, size_t size)
Changes the shm_obj size to size.
Definition: shm.h:98
int(* object_create)(POSIX_Shm_Object *shm_obj, size_t size)
Allocates a new shm_obj with initial size.
Definition: shm.h:89
int(* object_read)(POSIX_Shm_Object *shm_obj, void *buf, size_t count)
Copies up to @count bytes of the shm_obj data into buf.
Definition: shm.h:114
int(* object_delete)(POSIX_Shm_Object *shm_obj)
Deletes the shm_obj.
Definition: shm.h:107
Encapsulation for the storage and manipulation of shm objects.
Definition: shm.h:60
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:70
void * handle
The handle is private for finding object storage.
Definition: shm.h:64
const POSIX_Shm_Object_operations * ops
Implementation-specific operations on shm objects.
Definition: shm.h:75
Definition: threadq.h:609
This header file provides interfaces of the Thread Queue Handler which are used by the implementation...