source: rtems/cpukit/posix/include/rtems/posix/semaphore.h @ 2b295183

4.104.114.84.9
Last change on this file since 2b295183 was 2b295183, checked in by Joel Sherrill <joel.sherrill@…>, on Nov 3, 1999 at 12:47:16 PM

Added prototype of _POSIX_Semaphore_Delete to avoid warnings.

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