source: rtems/c/src/exec/posix/include/rtems/posix/semaphore.h @ 32ba727

4.104.114.84.95
Last change on this file since 32ba727 was 32ba727, checked in by Joel Sherrill <joel.sherrill@…>, on 01/22/01 at 13:46:28

2001-01-22 Michael Hamel <mhamel@…>

  • include/rtems/posix/semaphore.h, inline/rtems/posix/semaphore.inl, src/ptimer1.c, include/rtems/posix/semaphore.h, inline/rtems/posix/semaphore.inl, src/alarm.c, src/ptimer1.c, src/semaphorenametoid.c, src/semopen.c, src/semunlink.c: Modifications to make CodeWarrior? happy.
  • Property mode set to 100644
File size: 3.8 KB
Line 
1/*  rtems/posix/semaphore.h
2 *
3 *  This include file contains all the private support information for
4 *  POSIX Semaphores.
5 *
6 *  COPYRIGHT (c) 1989-1999.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15 
16#ifndef __RTEMS_POSIX_SEMAPHORE_h
17#define __RTEMS_POSIX_SEMAPHORE_h
18 
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23#include <semaphore.h>
24#include <rtems/score/coresem.h>
25
26#define SEM_FAILED (sem_t *) -1
27
28/*
29 *  Data Structure used to manage a POSIX semaphore
30 */
31 
32typedef struct {
33   Objects_Control         Object;
34   int                     process_shared;
35   boolean                 named;
36   boolean                 linked;
37   unsigned32              open_count;
38   CORE_semaphore_Control  Semaphore;
39}  POSIX_Semaphore_Control;
40
41/*
42 *  The following defines the information control block used to manage
43 *  this class of objects.
44 */
45 
46POSIX_EXTERN Objects_Information  _POSIX_Semaphore_Information;
47 
48/*
49 *  _POSIX_Semaphore_Manager_initialization
50 *
51 *  DESCRIPTION:
52 *
53 *  This routine performs the initialization necessary for this manager.
54 */
55 
56void _POSIX_Semaphore_Manager_initialization(
57  unsigned32 maximum_semaphorees
58);
59 
60/*
61 *  _POSIX_Semaphore_Allocate
62 *
63 *  DESCRIPTION:
64 *
65 *  This function allocates a semaphore control block from
66 *  the inactive chain of free semaphore control blocks.
67 */
68 
69RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void );
70 
71/*
72 *  _POSIX_Semaphore_Free
73 *
74 *  DESCRIPTION:
75 *
76 *  This routine frees a semaphore control block to the
77 *  inactive chain of free semaphore control blocks.
78 */
79 
80RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free (
81  POSIX_Semaphore_Control *the_semaphore
82);
83 
84/*
85 *  _POSIX_Semaphore_Get
86 *
87 *  DESCRIPTION:
88 *
89 *  This function maps semaphore IDs to semaphore control blocks.
90 *  If ID corresponds to a local semaphore, then it returns
91 *  the_semaphore control pointer which maps to ID and location
92 *  is set to OBJECTS_LOCAL.  if the semaphore ID is global and
93 *  resides on a remote node, then location is set to OBJECTS_REMOTE,
94 *  and the_semaphore is undefined.  Otherwise, location is set
95 *  to OBJECTS_ERROR and the_semaphore is undefined.
96 */
97 
98RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
99  sem_t        *id,
100  Objects_Locations *location
101);
102 
103/*
104 *  _POSIX_Semaphore_Is_null
105 *
106 *  DESCRIPTION:
107 *
108 *  This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
109 */
110 
111RTEMS_INLINE_ROUTINE boolean _POSIX_Semaphore_Is_null (
112  POSIX_Semaphore_Control *the_semaphore
113);
114
115/*
116 *  _POSIX_Semaphore_Create_support
117 *
118 *  DESCRIPTION:
119 *
120 *  This routine supports the sem_init and sem_open routines.
121 */
122
123int _POSIX_Semaphore_Create_support(
124  const char                *name,
125  int                        pshared,
126  unsigned int               value,
127  POSIX_Semaphore_Control  **the_sem
128);
129
130/*
131 *  _POSIX_Semaphore_Delete
132 *
133 *  DESCRIPTION:
134 *
135 *  This routine supports the sem_close and sem_unlink routines.
136 */
137
138void _POSIX_Semaphore_Delete(
139  POSIX_Semaphore_Control *the_semaphore
140);
141
142/*
143 *  _POSIX_Semaphore_Wait_support
144 *
145 *  DESCRIPTION:
146 *
147 *  This routine supports the sem_wait, sem_trywait, and sem_timedwait
148 *  services.
149 */
150
151int _POSIX_Semaphore_Wait_support(
152  sem_t              *sem,
153  boolean             blocking,
154  Watchdog_Interval   timeout
155);
156
157/*
158 *  _POSIX_Semaphore_Name_to_id
159 *
160 *  DESCRIPTION:
161 *
162 *  This routine performs name to id translation.
163 */
164
165int _POSIX_Semaphore_Name_to_id(
166  const char          *name,
167  sem_t          *id
168);
169
170#include <rtems/posix/semaphore.inl>
171#if defined(RTEMS_MULTIPROCESSING)
172#include <rtems/posix/semaphoremp.h>
173#endif
174
175#ifdef __cplusplus
176}
177#endif
178 
179#endif
180/*  end of include file */
181
Note: See TracBrowser for help on using the repository browser.