OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [include/] [rtems/] [posix/] [semaphore.h] - Blame information for rev 593

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  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: semaphore.h,v 1.2 2001-09-27 11:59:14 chris Exp $
14
 */
15
 
16
#ifndef __RTEMS_POSIX_SEMAPHORE_h
17
#define __RTEMS_POSIX_SEMAPHORE_h
18
 
19
#ifdef __cplusplus
20
extern "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
 
32
typedef 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
 
46
POSIX_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
 
56
void _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
 
69
RTEMS_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
 
80
RTEMS_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
 
98
RTEMS_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
 
111
RTEMS_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
 
123
int _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
 
138
void _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
 
151
int _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
 
165
int _POSIX_Semaphore_Name_to_id(
166
  const char          *name,
167
  Objects_Id          *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
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.