1 | /* |
---|
2 | * Semaphore Manager |
---|
3 | * |
---|
4 | * DESCRIPTION: |
---|
5 | * |
---|
6 | * This package is the implementation of the Semaphore Manager. |
---|
7 | * This manager utilizes standard Dijkstra counting semaphores to provide |
---|
8 | * synchronization and mutual exclusion capabilities. |
---|
9 | * |
---|
10 | * Directives provided are: |
---|
11 | * |
---|
12 | * + create a semaphore |
---|
13 | * + get an ID of a semaphore |
---|
14 | * + delete a semaphore |
---|
15 | * + acquire a semaphore |
---|
16 | * + release a semaphore |
---|
17 | * |
---|
18 | * COPYRIGHT (c) 1989-1998. |
---|
19 | * On-Line Applications Research Corporation (OAR). |
---|
20 | * Copyright assigned to U.S. Government, 1994. |
---|
21 | * |
---|
22 | * The license and distribution terms for this file may be |
---|
23 | * found in the file LICENSE in this distribution or at |
---|
24 | * http://www.OARcorp.com/rtems/license.html. |
---|
25 | * |
---|
26 | * $Id$ |
---|
27 | */ |
---|
28 | |
---|
29 | #include <rtems/system.h> |
---|
30 | #include <rtems/rtems/status.h> |
---|
31 | #include <rtems/rtems/support.h> |
---|
32 | #include <rtems/rtems/attr.h> |
---|
33 | #include <rtems/score/isr.h> |
---|
34 | #include <rtems/score/object.h> |
---|
35 | #include <rtems/rtems/options.h> |
---|
36 | #include <rtems/rtems/sem.h> |
---|
37 | #include <rtems/score/coremutex.h> |
---|
38 | #include <rtems/score/coresem.h> |
---|
39 | #include <rtems/score/states.h> |
---|
40 | #include <rtems/score/thread.h> |
---|
41 | #include <rtems/score/threadq.h> |
---|
42 | #if defined(RTEMS_MULTIPROCESSING) |
---|
43 | #include <rtems/score/mpci.h> |
---|
44 | #endif |
---|
45 | #include <rtems/score/sysstate.h> |
---|
46 | |
---|
47 | #include <rtems/score/interr.h> |
---|
48 | |
---|
49 | /*PAGE |
---|
50 | * |
---|
51 | * rtems_semaphore_ident |
---|
52 | * |
---|
53 | * This directive returns the system ID associated with |
---|
54 | * the semaphore name. |
---|
55 | * |
---|
56 | * Input parameters: |
---|
57 | * name - user defined semaphore name |
---|
58 | * node - node(s) to be searched |
---|
59 | * id - pointer to semaphore id |
---|
60 | * |
---|
61 | * Output parameters: |
---|
62 | * *id - semaphore id |
---|
63 | * RTEMS_SUCCESSFUL - if successful |
---|
64 | * error code - if unsuccessful |
---|
65 | */ |
---|
66 | |
---|
67 | rtems_status_code rtems_semaphore_ident( |
---|
68 | rtems_name name, |
---|
69 | unsigned32 node, |
---|
70 | Objects_Id *id |
---|
71 | ) |
---|
72 | { |
---|
73 | Objects_Name_to_id_errors status; |
---|
74 | |
---|
75 | status = _Objects_Name_to_id( &_Semaphore_Information, &name, node, id ); |
---|
76 | |
---|
77 | return _Status_Object_name_errors_to_status[ status ]; |
---|
78 | } |
---|