source: rtems/c/src/exec/posix/include/rtems/posix/semaphore.h @ 733a248

4.104.114.84.95
Last change on this file since 733a248 was 733a248, checked in by Joel Sherrill <joel.sherrill@…>, on 11/02/99 at 15:27:38

Added #define for SEM_FAILED.

  • Property mode set to 100644
File size: 3.0 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 <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  Objects_Id        *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_Name_to_id
117 *
118 *  DESCRIPTION:
119 *
120 *  XXX
121 */
122
123int _POSIX_Semaphore_Name_to_id(
124  const char          *name,
125  Objects_Id          *id
126);
127
128#include <rtems/posix/semaphore.inl>
129#if defined(RTEMS_MULTIPROCESSING)
130#include <rtems/posix/semaphoremp.h>
131#endif
132
133#ifdef __cplusplus
134}
135#endif
136 
137#endif
138/*  end of include file */
139
Note: See TracBrowser for help on using the repository browser.