4.115
Last change
on this file since e633f3b was
e633f3b,
checked in by Joel Sherrill <joel.sherrill@…>, on 01/31/14 at 17:03:24
|
posix/*.c: Remove use of register keyword
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Remove a Named Semaphore |
---|
5 | * @ingroup POSIX_SEMAPHORE |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-2014. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.com/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <stdarg.h> |
---|
22 | |
---|
23 | #include <errno.h> |
---|
24 | #include <fcntl.h> |
---|
25 | #include <pthread.h> |
---|
26 | #include <semaphore.h> |
---|
27 | #include <limits.h> |
---|
28 | |
---|
29 | #include <rtems/system.h> |
---|
30 | #include <rtems/posix/semaphoreimpl.h> |
---|
31 | #include <rtems/posix/time.h> |
---|
32 | #include <rtems/seterr.h> |
---|
33 | |
---|
34 | int sem_unlink( |
---|
35 | const char *name |
---|
36 | ) |
---|
37 | { |
---|
38 | int status; |
---|
39 | POSIX_Semaphore_Control *the_semaphore; |
---|
40 | Objects_Id the_semaphore_id; |
---|
41 | size_t name_len; |
---|
42 | |
---|
43 | _Thread_Disable_dispatch(); |
---|
44 | |
---|
45 | status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id, &name_len ); |
---|
46 | if ( status != 0 ) { |
---|
47 | _Thread_Enable_dispatch(); |
---|
48 | rtems_set_errno_and_return_minus_one( status ); |
---|
49 | } |
---|
50 | |
---|
51 | the_semaphore = (POSIX_Semaphore_Control *) _Objects_Get_local_object( |
---|
52 | &_POSIX_Semaphore_Information, |
---|
53 | _Objects_Get_index( the_semaphore_id ) |
---|
54 | ); |
---|
55 | |
---|
56 | the_semaphore->linked = false; |
---|
57 | _POSIX_Semaphore_Namespace_remove( the_semaphore ); |
---|
58 | _POSIX_Semaphore_Delete( the_semaphore ); |
---|
59 | |
---|
60 | _Thread_Enable_dispatch(); |
---|
61 | return 0; |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.