source: rtems/cpukit/include/rtems/posix/shm.h @ 55b69ed

5
Last change on this file since 55b69ed was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 4.8 KB
Line 
1/**
2 * @file
3 *
4 * @brief Internal Support for POSIX Shared Memory
5 */
6
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/object.h>
19#include <rtems/score/threadq.h>
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/**
26 * @defgroup POSIXShmPrivate POSIX Shared Memory Private Support
27 *
28 * @ingroup POSIXAPI
29 *
30 * Internal implementation support for POSIX shared memory.
31 * @{
32 */
33typedef struct POSIX_Shm_Object_operations POSIX_Shm_Object_operations;
34extern const POSIX_Shm_Object_operations _POSIX_Shm_Object_operations;
35
36/**
37 * @brief Encapsulation for the storage and manipulation of shm objects.
38 */
39typedef struct {
40  /**
41   * @brief The handle is private for finding object storage.
42   */
43  void                               *handle;
44
45  /**
46   * @brief The number of bytes allocated to the object. A size of 0 with
47   * a handle of NULL means no object is allocated.
48   */
49  size_t                              size;
50
51  /**
52   * @brief Implementation-specific operations on shm objects.
53   */
54  const POSIX_Shm_Object_operations  *ops;
55} POSIX_Shm_Object;
56
57/**
58 * @brief Operations on POSIX Shared Memory Objects.
59 */
60struct POSIX_Shm_Object_operations {
61  /**
62   * @brief Allocates a new @a shm_obj with initial @a size.
63   *
64   * New shared memory is initialized to zeroes.
65   *
66   * Returns 0 for success.
67   */
68  int ( *object_create ) ( POSIX_Shm_Object *shm_obj, size_t size );
69
70  /**
71   * @brief Changes the @a shm_obj size to @a size.
72   *
73   * Zeroes out the portion of the shared memory object that shrinks or grows.
74   *
75   * Returns 0 for success.
76   */
77  int ( *object_resize ) ( POSIX_Shm_Object *shm_obj, size_t size );
78
79  /**
80   * @brief Deletes the @a shm_obj.
81   *
82   * Zeroes out the memory.
83   *
84   * Returns 0 for success.
85   */
86  int ( *object_delete ) ( POSIX_Shm_Object *shm_obj );
87
88  /**
89   * @brief Copies up to @count bytes of the @a shm_obj data into @a buf.
90   *
91   * Returns the number of bytes read (copied) into @a buf.
92   */
93  int ( *object_read ) ( POSIX_Shm_Object *shm_obj, void *buf, size_t count );
94
95  /**
96   * @brief Maps a shared memory object.
97   *
98   * Establishes a memory mapping between the shared memory object and the
99   * caller.
100   *
101   * Returns the mapped address of the object.
102   */
103  void * ( *object_mmap ) ( POSIX_Shm_Object *shm_obj, size_t len, int prot, off_t off);
104};
105
106/**
107 * @brief Control for a POSIX Shared Memory Object
108 */
109typedef struct {
110   Objects_Control      Object;
111   Thread_queue_Control Wait_queue;
112
113   int                  reference_count;
114
115   POSIX_Shm_Object     shm_object;
116
117   uid_t                uid;
118   gid_t                gid;
119   mode_t               mode;
120   int                  oflag;
121
122   time_t               atime;
123   time_t               mtime;
124   time_t               ctime;
125} POSIX_Shm_Control;
126
127/**
128 * @brief object_create operation for shm objects stored in RTEMS Workspace.
129 */
130extern int _POSIX_Shm_Object_create_from_workspace(
131  POSIX_Shm_Object *shm_obj,
132  size_t size
133);
134
135/**
136 * @brief object_delete operation for shm objects stored in RTEMS Workspace.
137 */
138extern int _POSIX_Shm_Object_delete_from_workspace( POSIX_Shm_Object *shm_obj );
139
140/**
141 * @brief object_resize operation for shm objects stored in RTEMS Workspace.
142 */
143extern int _POSIX_Shm_Object_resize_from_workspace(
144  POSIX_Shm_Object *shm_obj,
145  size_t size
146);
147
148/**
149 * @brief object_read operation for shm objects stored in RTEMS Workspace.
150 */
151extern int _POSIX_Shm_Object_read_from_workspace(
152  POSIX_Shm_Object *shm_obj,
153  void *buf,
154  size_t count
155);
156
157/**
158 * @brief object_mmap operation for shm objects stored in RTEMS Workspace.
159 */
160extern void * _POSIX_Shm_Object_mmap_from_workspace(
161  POSIX_Shm_Object *shm_obj,
162  size_t len,
163  int prot,
164  off_t off
165);
166
167/**
168 * @brief object_create operation for shm objects stored in C program heap.
169 */
170extern int _POSIX_Shm_Object_create_from_heap(
171  POSIX_Shm_Object *shm_obj,
172  size_t size
173);
174
175/**
176 * @brief object_delete operation for shm objects stored in C program heap.
177 */
178extern int _POSIX_Shm_Object_delete_from_heap( POSIX_Shm_Object *shm_obj );
179
180/**
181 * @brief object_resize operation for shm objects stored in C program heap.
182 */
183extern int _POSIX_Shm_Object_resize_from_heap(
184  POSIX_Shm_Object *shm_obj,
185  size_t size
186);
187
188/**
189 * @brief object_read operation for shm objects stored in C program heap.
190 */
191extern int _POSIX_Shm_Object_read_from_heap(
192  POSIX_Shm_Object *shm_obj,
193  void *buf,
194  size_t count
195);
196
197/**
198 * @brief object_mmap operation for shm objects stored in C program heap.
199 */
200extern void * _POSIX_Shm_Object_mmap_from_heap(
201  POSIX_Shm_Object *shm_obj,
202  size_t len,
203  int prot,
204  off_t off
205);
206
207/** @} */
208
209#ifdef __cplusplus
210}
211#endif
212
213#endif
Note: See TracBrowser for help on using the repository browser.