source: rtems/cpukit/posix/include/rtems/posix/semaphore.h @ 6c2675d

4.104.114.84.95
Last change on this file since 6c2675d was 6c2675d, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/21/04 at 06:27:15

Add doxygen preamble.

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