source: rtems/cpukit/posix/include/rtems/posix/semaphore.h @ 8e36f29

4.104.114.84.9
Last change on this file since 8e36f29 was 8e36f29, checked in by Joel Sherrill <joel.sherrill@…>, on Sep 4, 2003 at 6:54:26 PM

2003-09-04 Joel Sherrill <joel@…>

  • include/rtems/posix/cond.h, include/rtems/posix/condmp.h, include/rtems/posix/config.h, include/rtems/posix/intr.h, include/rtems/posix/key.h, include/rtems/posix/mqueue.h, include/rtems/posix/mqueuemp.h, include/rtems/posix/mutex.h, include/rtems/posix/mutexmp.h, include/rtems/posix/posixapi.h, include/rtems/posix/pthread.h, include/rtems/posix/pthreadmp.h, include/rtems/posix/ptimer.h, include/rtems/posix/semaphore.h, include/rtems/posix/semaphoremp.h, inline/rtems/posix/cond.inl, inline/rtems/posix/intr.inl, inline/rtems/posix/key.inl, inline/rtems/posix/mqueue.inl, inline/rtems/posix/mutex.inl, inline/rtems/posix/pthread.inl, inline/rtems/posix/semaphore.inl, inline/rtems/posix/timer.inl, macros/rtems/posix/cond.inl, macros/rtems/posix/intr.inl, macros/rtems/posix/key.inl, macros/rtems/posix/mqueue.inl, macros/rtems/posix/mutex.inl, macros/rtems/posix/pthread.inl, macros/rtems/posix/semaphore.inl, macros/rtems/posix/timer.inl, src/alarm.c, src/kill.c, src/killinfo.c, src/mqueuetranslatereturncode.c, src/pause.c, src/pthreadattrdestroy.c, src/pthreadattrgetdetachstate.c, src/pthreadattrgetinheritsched.c, src/pthreadattrgetschedparam.c, src/pthreadattrgetschedpolicy.c, src/pthreadattrgetscope.c, src/pthreadattrgetstackaddr.c, src/pthreadattrgetstacksize.c, src/pthreadattrinit.c, src/pthreadattrsetdetachstate.c, src/pthreadattrsetinheritsched.c, src/pthreadattrsetschedparam.c, src/pthreadattrsetschedpolicy.c, src/pthreadattrsetscope.c, src/pthreadattrsetstackaddr.c, src/pthreadattrsetstacksize.c, src/pthreadcreate.c, src/pthreaddetach.c, src/pthreadequal.c, src/pthreadexit.c, src/pthreadgetcpuclockid.c, src/pthreadgetcputime.c, src/pthreadgetschedparam.c, src/pthreadjoin.c, src/pthreadkill.c, src/pthreadonce.c, src/pthreadself.c, src/pthreadsetcputime.c, src/pthreadsetschedparam.c, src/pthreadsigmask.c, src/sigaction.c, src/sigaddset.c, src/sigdelset.c, src/sigemptyset.c, src/sigfillset.c, src/sigismember.c, src/signal_2.c, src/sigpending.c, src/sigprocmask.c, src/sigqueue.c, src/sigsuspend.c, src/sigtimedwait.c, src/sigwait.c, src/sigwaitinfo.c, src/ualarm.c: URL for license changed.
  • 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.rtems.com/license/LICENSE.
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.