1 | @c |
---|
2 | @c This is the chapter from the RTEMS ITRON User's Guide that |
---|
3 | @c documents the services provided by the semaphore |
---|
4 | @c manager. |
---|
5 | @c |
---|
6 | @c $Id$ |
---|
7 | @c |
---|
8 | |
---|
9 | @chapter Semaphore Manager |
---|
10 | |
---|
11 | @section Introduction |
---|
12 | |
---|
13 | The semaphore manager provides functions to allocate, delete, and |
---|
14 | control counting semaphores. This manager is based on the |
---|
15 | ITRON 3.0 standard. |
---|
16 | |
---|
17 | The services provided by the semaphore manager are: |
---|
18 | |
---|
19 | @itemize @bullet |
---|
20 | @item @code{cre_sem} - Create Semaphore |
---|
21 | @item @code{del_sem} - Delete Semaphore |
---|
22 | @item @code{sig_sem} - Signal Semaphore |
---|
23 | @item @code{wai_sem} - Wait on Semaphore |
---|
24 | @item @code{preq_sem} - Poll and Request Semaphore |
---|
25 | @item @code{twai_sem} - Wait on Semaphore with Timeout |
---|
26 | @item @code{ref_sem} - Reference Semaphore Status |
---|
27 | @end itemize |
---|
28 | |
---|
29 | @section Background |
---|
30 | |
---|
31 | @subsection Theory |
---|
32 | |
---|
33 | Semaphores are used for synchronization and mutual exclusion by indicating |
---|
34 | the availability and number of resources. The task (the task which is |
---|
35 | returning resources) notifying other tasks of an event increases the number |
---|
36 | of resources held by the semaphore by one. The task (the task which |
---|
37 | will obtain resources) waiting for the event decreases the number of |
---|
38 | resources held by the semaphore by one. If the number of resources held by a |
---|
39 | semaphore is insufficient (namely 0), the task requiring resources will |
---|
40 | wait until the next time resources are returned to the semaphore. If there is |
---|
41 | more than one task waiting for a semaphore, the tasks will be placed in the |
---|
42 | queue. |
---|
43 | |
---|
44 | |
---|
45 | @subsection T_CSEM Structure |
---|
46 | |
---|
47 | The T_CSEM structure is used to define the characteristics of a semaphore |
---|
48 | and passed an as argument to the @code{cre_sem} service. The structure |
---|
49 | is defined as follows: |
---|
50 | |
---|
51 | @example |
---|
52 | @group |
---|
53 | /* |
---|
54 | * Create Semaphore (cre_sem) Structure |
---|
55 | */ |
---|
56 | |
---|
57 | typedef struct t_csem @{ |
---|
58 | VP exinf; /* extended information */ |
---|
59 | ATR sematr; /* semaphore attributes */ |
---|
60 | /* Following is the extended function for [level X]. */ |
---|
61 | INT isemcnt; /* initial semaphore count */ |
---|
62 | INT maxsem; /* maximum semaphore count */ |
---|
63 | /* additional information may be included depending on the implementation */ |
---|
64 | @} T_CSEM; |
---|
65 | |
---|
66 | /* |
---|
67 | * sematr - Semaphore Attribute Values |
---|
68 | */ |
---|
69 | |
---|
70 | #define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ |
---|
71 | #define TA_TPRI 0x01 /* waiting tasks are handled by priority */ |
---|
72 | |
---|
73 | @end group |
---|
74 | @end example |
---|
75 | |
---|
76 | where the meaning of each field is: |
---|
77 | |
---|
78 | @table @b |
---|
79 | @item exinf |
---|
80 | is for any extended information that the implementation may define. |
---|
81 | This implementation does not use this field. |
---|
82 | |
---|
83 | @item sematr |
---|
84 | is the attributes for this semaphore. The only attributed |
---|
85 | which can be specified is whether tasks wait in FIFO (@code{TA_TFIFO}) |
---|
86 | or priority (@code{TA_TPRI}) order. |
---|
87 | |
---|
88 | @item isemcnt |
---|
89 | is the initial count of the semaphore. |
---|
90 | |
---|
91 | @item maxsem |
---|
92 | is the maximum count the semaphore may have. It places an upper |
---|
93 | limit on the value taken by the semaphore. |
---|
94 | |
---|
95 | @end table |
---|
96 | |
---|
97 | @subsection Building a Semaphore Attribute Set |
---|
98 | |
---|
99 | In general, an attribute set is built by a bitwise OR |
---|
100 | of the desired attribute components. The following table lists |
---|
101 | the set of valid semaphore attributes: |
---|
102 | |
---|
103 | @itemize @bullet |
---|
104 | @item @code{TA_TFIFO} - tasks wait by FIFO |
---|
105 | |
---|
106 | @item @code{TA_TPRI} - tasks wait by priority |
---|
107 | |
---|
108 | @end itemize |
---|
109 | |
---|
110 | Attribute values are specifically designed to be |
---|
111 | mutually exclusive, therefore bitwise OR and addition operations |
---|
112 | are equivalent as long as each attribute appears exactly once in |
---|
113 | the component list. |
---|
114 | |
---|
115 | @subsection T_RSEM Structure |
---|
116 | |
---|
117 | The T_RSEM structure is filled in by the @code{ref_sem} service with |
---|
118 | status and state information on a semaphore. The structure |
---|
119 | is defined as follows: |
---|
120 | |
---|
121 | @example |
---|
122 | @group |
---|
123 | /* |
---|
124 | * Reference Semaphore (ref_sem) Structure |
---|
125 | */ |
---|
126 | |
---|
127 | typedef struct t_rsem @{ |
---|
128 | VP exinf; /* extended information */ |
---|
129 | BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ |
---|
130 | INT semcnt; /* current semaphore count */ |
---|
131 | /* additional information may be included depending on the implementation */ |
---|
132 | @} T_RSEM; |
---|
133 | @end group |
---|
134 | @end example |
---|
135 | |
---|
136 | @table @b |
---|
137 | |
---|
138 | @item exinf |
---|
139 | is for any extended information that the implementation may define. |
---|
140 | This implementation does not use this field. |
---|
141 | |
---|
142 | @item wtsk |
---|
143 | is TRUE when there is one or more task waiting on the semaphore. |
---|
144 | It is FALSE if no tasks are currently waiting. The meaning of this |
---|
145 | field is allowed to vary between ITRON implementations. It may have |
---|
146 | the ID of a waiting task, the number of tasks waiting, or a boolean |
---|
147 | indication that one or more tasks are waiting. |
---|
148 | |
---|
149 | @item semcnt |
---|
150 | is the current semaphore count. |
---|
151 | |
---|
152 | @end table |
---|
153 | |
---|
154 | The information in this table is very volatile and should be used |
---|
155 | with caution in an application. |
---|
156 | |
---|
157 | @section Operations |
---|
158 | |
---|
159 | @subsection Using as a Binary Semaphore |
---|
160 | |
---|
161 | Creating a semaphore with a limit on the count of 1 effectively |
---|
162 | restricts the semaphore to being a binary semaphore. When the |
---|
163 | binary semaphore is available, the count is 1. When the binary |
---|
164 | semaphore is unavailable, the count is 0. |
---|
165 | |
---|
166 | Since this does not result in a true binary semaphore, advanced |
---|
167 | binary features like the Priority Inheritance and Priority |
---|
168 | Ceiling Protocols are not available. |
---|
169 | |
---|
170 | @section System Calls |
---|
171 | |
---|
172 | This section details the semaphore manager's services. |
---|
173 | A subsection is dedicated to each of this manager's services |
---|
174 | and describes the calling sequence, related constants, usage, |
---|
175 | and status codes. |
---|
176 | |
---|
177 | |
---|
178 | @c |
---|
179 | @c cre_sem |
---|
180 | @c |
---|
181 | |
---|
182 | @page |
---|
183 | @subsection cre_sem - Create Semaphore |
---|
184 | |
---|
185 | @subheading CALLING SEQUENCE: |
---|
186 | |
---|
187 | @ifset is-C |
---|
188 | @example |
---|
189 | ER cre_sem( |
---|
190 | ID semid, |
---|
191 | T_CSEM *pk_csem |
---|
192 | ); |
---|
193 | @end example |
---|
194 | @end ifset |
---|
195 | |
---|
196 | @ifset is-Ada |
---|
197 | @end ifset |
---|
198 | |
---|
199 | @subheading STATUS CODES: |
---|
200 | |
---|
201 | @code{E_OK} - Normal Completion |
---|
202 | |
---|
203 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
204 | |
---|
205 | @code{E_NOMEM} - Insufficient memory (Memory for control block cannot be |
---|
206 | allocated) |
---|
207 | |
---|
208 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
209 | specified from a user task.) |
---|
210 | |
---|
211 | @code{E_RSATR} - Reserved attribute (sematr was invalid or could not be |
---|
212 | used) |
---|
213 | |
---|
214 | @code{E_OBJ} - Invalid object state (a semaphore of the same ID already |
---|
215 | exists) |
---|
216 | |
---|
217 | @code{E_PAR} - Parameter error (pk_csem is invalid and/or isemcnt or |
---|
218 | maxsem is negative or invalid) |
---|
219 | |
---|
220 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
221 | target node is specified. |
---|
222 | |
---|
223 | @code{EN_CTXID} - Specified an object on another node when the system call |
---|
224 | was issued from a task in dispatch disabled state or from a task- |
---|
225 | independent portion |
---|
226 | |
---|
227 | @code{EN_PAR} - A value outside the range supported by the target node |
---|
228 | and/or transmission packet format was specified as a parameter (a value |
---|
229 | outside supported range was specified for exinf, sematr, isemcnt and/or |
---|
230 | maxsem) |
---|
231 | |
---|
232 | @subheading DESCRIPTION: |
---|
233 | |
---|
234 | This routine creates a semaphore that resides on the local node. The |
---|
235 | semaphore is initialized based on the attributes specified in the |
---|
236 | @code{pk_csem} structure. The initial and maximum counts of the |
---|
237 | semaphore are set based on the @code{isemcnt} and @code{maxsem} fields |
---|
238 | in this structure. |
---|
239 | |
---|
240 | Specifying @code{TA_TPRI} in the @code{sematr} field of the |
---|
241 | semaphore attributes structure causes tasks |
---|
242 | waiting for a semaphore to be serviced according to task |
---|
243 | priority. When @code{TA_TFIFO} is selected, tasks are serviced in First |
---|
244 | In-First Out order. |
---|
245 | |
---|
246 | @subheading NOTES: |
---|
247 | |
---|
248 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
249 | will be returned. |
---|
250 | |
---|
251 | All memory is preallocated for RTEMS ITRON objects. Thus, no dynamic |
---|
252 | memory allocation is performed by @code{cre_sem} and the @code{E_NOMEM} |
---|
253 | error can not be returned. |
---|
254 | |
---|
255 | This directive will not cause the running task to be preempted. |
---|
256 | |
---|
257 | The following semaphore attribute constants are |
---|
258 | defined by RTEMS: |
---|
259 | |
---|
260 | @itemize @bullet |
---|
261 | @item @code{TA_TFIFO} - tasks wait by FIFO |
---|
262 | |
---|
263 | @item @code{TA_TPRI} - tasks wait by priority |
---|
264 | |
---|
265 | @end itemize |
---|
266 | |
---|
267 | @c |
---|
268 | @c del_sem |
---|
269 | @c |
---|
270 | |
---|
271 | @page |
---|
272 | @subsection del_sem - Delete Semaphore |
---|
273 | |
---|
274 | @subheading CALLING SEQUENCE: |
---|
275 | |
---|
276 | @ifset is-C |
---|
277 | @example |
---|
278 | ER del_sem( |
---|
279 | ID semid |
---|
280 | ); |
---|
281 | @end example |
---|
282 | @end ifset |
---|
283 | |
---|
284 | @ifset is-Ada |
---|
285 | @end ifset |
---|
286 | |
---|
287 | @subheading STATUS CODES: |
---|
288 | |
---|
289 | @code{E_OK} - Normal Completion |
---|
290 | |
---|
291 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
292 | |
---|
293 | @code{E_NOEXS} - Object does not exist (the semaphore specified by semid |
---|
294 | does not exist) |
---|
295 | |
---|
296 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
297 | specified from a user task. This is implementation dependent.) |
---|
298 | |
---|
299 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
300 | target node is specified. |
---|
301 | |
---|
302 | @code{EN_CTXID} - Specified an object on another node when the system call |
---|
303 | was issued from a task in dispatch disabled state or from a |
---|
304 | task-independent portion |
---|
305 | |
---|
306 | @subheading DESCRIPTION: |
---|
307 | |
---|
308 | This routine deletes the semaphore specified by @code{semid}. |
---|
309 | All tasks blocked waiting to acquire the semaphore will be |
---|
310 | readied and returned a status code which indicates that the |
---|
311 | semaphore was deleted. The control block for this semaphore |
---|
312 | is reclaimed by RTEMS. |
---|
313 | |
---|
314 | |
---|
315 | @subheading NOTES: |
---|
316 | |
---|
317 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
318 | will be returned. |
---|
319 | |
---|
320 | The calling task will be preempted if it is enabled |
---|
321 | by the task's execution mode and a higher priority local task is |
---|
322 | waiting on the deleted semaphore. The calling task will NOT be |
---|
323 | preempted if all of the tasks that are waiting on the semaphore |
---|
324 | are remote tasks. |
---|
325 | |
---|
326 | The calling task does not have to be the task that |
---|
327 | created the semaphore. Any local task that knows the semaphore |
---|
328 | id can delete the semaphore. |
---|
329 | |
---|
330 | |
---|
331 | @c |
---|
332 | @c sig_sem |
---|
333 | @c |
---|
334 | |
---|
335 | @page |
---|
336 | @subsection sig_sem - Signal Semaphore |
---|
337 | |
---|
338 | @subheading CALLING SEQUENCE: |
---|
339 | |
---|
340 | @ifset is-C |
---|
341 | @example |
---|
342 | ER sig_sem( |
---|
343 | ID semid |
---|
344 | ); |
---|
345 | @end example |
---|
346 | @end ifset |
---|
347 | |
---|
348 | @ifset is-Ada |
---|
349 | @end ifset |
---|
350 | |
---|
351 | @subheading STATUS CODES: |
---|
352 | |
---|
353 | @code{E_OK} - Normal Completion |
---|
354 | |
---|
355 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
356 | |
---|
357 | @code{E_NOEXS} - Object does not exist (the semaphore specified by semid |
---|
358 | does not exist) |
---|
359 | |
---|
360 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
361 | specified from a user task. This is implementation dependent.) |
---|
362 | |
---|
363 | @code{E_QOVR} - Queuing or nesting overflow (the queuing count given by |
---|
364 | semcnt went over the maximum allowed) |
---|
365 | |
---|
366 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
367 | target node is specified. |
---|
368 | |
---|
369 | @code{EN_CTXID} - Specified an object on another node when the system call |
---|
370 | was issued from a task in dispatch disabled state or from a |
---|
371 | task-independent portion |
---|
372 | |
---|
373 | @subheading DESCRIPTION: |
---|
374 | |
---|
375 | @subheading NOTES: |
---|
376 | |
---|
377 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
378 | will be returned. |
---|
379 | |
---|
380 | @c |
---|
381 | @c wai_sem |
---|
382 | @c |
---|
383 | |
---|
384 | @page |
---|
385 | @subsection wai_sem - Wait on Semaphore |
---|
386 | |
---|
387 | @subheading CALLING SEQUENCE: |
---|
388 | |
---|
389 | @ifset is-C |
---|
390 | @example |
---|
391 | ER wai_sem( |
---|
392 | ID semid |
---|
393 | ); |
---|
394 | @end example |
---|
395 | @end ifset |
---|
396 | |
---|
397 | @ifset is-Ada |
---|
398 | @end ifset |
---|
399 | |
---|
400 | @subheading STATUS CODES: |
---|
401 | |
---|
402 | @code{E_OK} - Normal Completion |
---|
403 | |
---|
404 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
405 | |
---|
406 | @code{E_NOEXS} - Object does not exist (the semaphore specified by semid |
---|
407 | does not exist) |
---|
408 | |
---|
409 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
410 | specified from a user task. This is implementation dependent.) |
---|
411 | |
---|
412 | @code{E_DLT} - The object being waited for was deleted (the specified |
---|
413 | semaphore was deleted while waiting) |
---|
414 | |
---|
415 | @code{E_RLWAI} - Wait state was forcibly released (rel_wai was received |
---|
416 | while waiting) |
---|
417 | |
---|
418 | @code{E_CTX} - Context error (issued from task-independent portions or a |
---|
419 | task in dispatch disabled state) |
---|
420 | |
---|
421 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
422 | target node is specified. |
---|
423 | |
---|
424 | @code{EN_PAR} - A value outside the range supported by the target node |
---|
425 | and/or transmission packet format was specified as a parameter (a value |
---|
426 | outside supported range was specified for tmout) |
---|
427 | |
---|
428 | @subheading DESCRIPTION: |
---|
429 | |
---|
430 | This routine attempts to acquire the semaphore specified by @code{semid}. |
---|
431 | If the semaphore is available (i.e. positive semaphore count), then the |
---|
432 | semaphore count is decremented and the calling task returns immediately. |
---|
433 | Otherwise the calling tasking is blocked until the semaphore is released |
---|
434 | by a subsequent invocation of @code{sig_sem}. |
---|
435 | |
---|
436 | @subheading NOTES: |
---|
437 | |
---|
438 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
439 | will be returned. |
---|
440 | |
---|
441 | If the semaphore is not available, then the calling task will be blocked. |
---|
442 | |
---|
443 | @c |
---|
444 | @c preq_sem |
---|
445 | @c |
---|
446 | |
---|
447 | @page |
---|
448 | @subsection preq_sem - Poll and Request Semaphore |
---|
449 | |
---|
450 | @subheading CALLING SEQUENCE: |
---|
451 | |
---|
452 | @ifset is-C |
---|
453 | @example |
---|
454 | ER preq_sem( |
---|
455 | ID semid |
---|
456 | ); |
---|
457 | @end example |
---|
458 | @end ifset |
---|
459 | |
---|
460 | @ifset is-Ada |
---|
461 | @end ifset |
---|
462 | |
---|
463 | @subheading STATUS CODES: |
---|
464 | |
---|
465 | @code{E_OK} - Normal Completion |
---|
466 | |
---|
467 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
468 | |
---|
469 | @code{E_NOEXS} - Object does not exist (the semaphore specified by semid |
---|
470 | does not exist) |
---|
471 | |
---|
472 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
473 | specified from a user task. This is implementation dependent.) |
---|
474 | |
---|
475 | @code{E_TMOUT} - Polling failure or timeout exceeded |
---|
476 | |
---|
477 | @code{E_CTX} - Context error (issued from task-independent portions or a |
---|
478 | task in dispatch disabled state) |
---|
479 | |
---|
480 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
481 | target node is specified. |
---|
482 | |
---|
483 | @code{EN_PAR} - A value outside the range supported by the target node |
---|
484 | and/or transmission packet format was specified as a parameter (a value |
---|
485 | outside supported range was specified for tmout) |
---|
486 | |
---|
487 | @subheading DESCRIPTION: |
---|
488 | |
---|
489 | This routine attempts to acquire the semaphore specified by @code{semid}. |
---|
490 | If the semaphore is available (i.e. positive semaphore count), then the |
---|
491 | semaphore count is decremented and the calling task returns immediately. |
---|
492 | Otherwise, the @code{E_TMOUT} error is returned to the calling task to |
---|
493 | indicate the semaphore is unavailable. |
---|
494 | |
---|
495 | @subheading NOTES: |
---|
496 | |
---|
497 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
498 | will be returned. |
---|
499 | |
---|
500 | This routine will not cause the running task to be preempted. |
---|
501 | |
---|
502 | @c |
---|
503 | @c twai_sem |
---|
504 | @c |
---|
505 | |
---|
506 | @page |
---|
507 | @subsection twai_sem - Wait on Semaphore with Timeout |
---|
508 | |
---|
509 | @subheading CALLING SEQUENCE: |
---|
510 | |
---|
511 | @ifset is-C |
---|
512 | @example |
---|
513 | ER twai_sem( |
---|
514 | ID semid, |
---|
515 | TMO tmout |
---|
516 | ); |
---|
517 | @end example |
---|
518 | @end ifset |
---|
519 | |
---|
520 | @ifset is-Ada |
---|
521 | @end ifset |
---|
522 | |
---|
523 | @subheading STATUS CODES: |
---|
524 | |
---|
525 | @code{E_OK} - Normal Completion |
---|
526 | |
---|
527 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
528 | |
---|
529 | @code{E_NOEXS} - Object does not exist (the semaphore specified by semid |
---|
530 | does not exist) |
---|
531 | |
---|
532 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
533 | specified from a user task. This is implementation dependent.) |
---|
534 | |
---|
535 | @code{E_PAR} - Parameter error (tmout is -2 or less) |
---|
536 | |
---|
537 | @code{E_DLT} - The object being waited for was deleted (the specified |
---|
538 | semaphore was deleted while waiting) |
---|
539 | |
---|
540 | @code{E_RLWAI} - Wait state was forcibly released (rel_wai was received |
---|
541 | while waiting) |
---|
542 | |
---|
543 | @code{E_TMOUT} - Polling failure or timeout exceeded |
---|
544 | |
---|
545 | @code{E_CTX} - Context error (issued from task-independent portions or a |
---|
546 | task in dispatch disabled state) |
---|
547 | |
---|
548 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
549 | target node is specified. |
---|
550 | |
---|
551 | @code{EN_PAR} - A value outside the range supported by the target node |
---|
552 | and/or transmission packet format was specified as a parameter (a value |
---|
553 | outside supported range was specified for tmout) |
---|
554 | |
---|
555 | @subheading DESCRIPTION: |
---|
556 | |
---|
557 | This routine attempts to acquire the semaphore specified by @code{semid}. |
---|
558 | If the semaphore is available (i.e. positive semaphore count), then the |
---|
559 | semaphore count is decremented and the calling task returns immediately. |
---|
560 | Otherwise the calling tasking is blocked until the semaphore is released |
---|
561 | by a subsequent invocation of @code{sig_sem} or the timeout period specified |
---|
562 | by @code{tmout} milliseconds is exceeded. If the timeout period is exceeded, |
---|
563 | then the @code{E_TMOUT} error is returned. |
---|
564 | |
---|
565 | By specifiying @code{tmout} as @code{TMO_FEVR}, this routine has the same |
---|
566 | behavior as @code{wai_sem}. Similarly, by specifiying @code{tmout} as |
---|
567 | @code{TMO_POL}, this routine has the same behavior as @code{preq_sem}. |
---|
568 | |
---|
569 | @subheading NOTES: |
---|
570 | |
---|
571 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
572 | will be returned. |
---|
573 | |
---|
574 | This routine may cause the calling task to block. |
---|
575 | |
---|
576 | A clock tick is required to support the timeout functionality of |
---|
577 | this routine. |
---|
578 | |
---|
579 | @c |
---|
580 | @c ref_sem |
---|
581 | @c |
---|
582 | |
---|
583 | @page |
---|
584 | @subsection ref_sem - Reference Semaphore Status |
---|
585 | |
---|
586 | @subheading CALLING SEQUENCE: |
---|
587 | |
---|
588 | @ifset is-C |
---|
589 | @example |
---|
590 | ER ref_sem( |
---|
591 | T_RSEM *pk_rsem, |
---|
592 | ID semid |
---|
593 | ); |
---|
594 | @end example |
---|
595 | @end ifset |
---|
596 | |
---|
597 | @ifset is-Ada |
---|
598 | @end ifset |
---|
599 | |
---|
600 | @subheading STATUS CODES: |
---|
601 | |
---|
602 | @code{E_OK} - Normal Completion |
---|
603 | |
---|
604 | @code{E_ID} - Invalid ID number (semid was invalid or could not be used) |
---|
605 | |
---|
606 | @code{E_NOEXS} - Object does not exist (the semaphore specified by semid |
---|
607 | does not exist) |
---|
608 | |
---|
609 | @code{E_OACV} - Object access violation (A semid less than -4 was |
---|
610 | specified from a user task. This is implementation dependent.) |
---|
611 | |
---|
612 | @code{E_PAR} - Parameter error (the packet address for the return |
---|
613 | parameters could not be used) |
---|
614 | |
---|
615 | @code{EN_OBJNO} - An object number which could not be accessed on the |
---|
616 | target node is specified. |
---|
617 | |
---|
618 | @code{EN_CTXID} - Specified an object on another node when the system call |
---|
619 | was issued from a task in dispatch disabled state or from a |
---|
620 | task-independent portion |
---|
621 | |
---|
622 | @code{EN_RPAR} - A value outside the range supported by the requesting |
---|
623 | node and/or transmission packet format was returned as a parameter (a |
---|
624 | value outside supported range was specified for exinf, wtsk or semcnt) |
---|
625 | |
---|
626 | @subheading DESCRIPTION: |
---|
627 | |
---|
628 | This routine returns status information on the semaphore specified |
---|
629 | by @code{semid}. The @code{pk_rsem} structure is filled in by |
---|
630 | this service call. |
---|
631 | |
---|
632 | @subheading NOTES: |
---|
633 | |
---|
634 | Multiprocessing is not supported. Thus none of the "EN_" status codes |
---|
635 | will be returned. |
---|
636 | |
---|
637 | This routine will not cause the running task to be preempted. |
---|
638 | |
---|