5
Last change
on this file since 04da96c7 was
c904df5,
checked in by Sebastian Huber <sebastian.huber@…>, on 03/18/16 at 06:25:23
|
score: Add _Objects_Get_by_name()
Replace _Objects_Name_to_id_string() with _Objects_Get_by_name() since
all users of this function are interested in the object itself and not
the identifier.
Use the object allocator lock to protect the search.
Update #2555.
|
-
Property mode set to
100644
|
File size:
1019 bytes
|
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.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <semaphore.h> |
---|
22 | |
---|
23 | #include <rtems/posix/semaphoreimpl.h> |
---|
24 | #include <rtems/seterr.h> |
---|
25 | |
---|
26 | int sem_unlink( |
---|
27 | const char *name |
---|
28 | ) |
---|
29 | { |
---|
30 | POSIX_Semaphore_Control *the_semaphore; |
---|
31 | Objects_Get_by_name_error error; |
---|
32 | |
---|
33 | _Objects_Allocator_lock(); |
---|
34 | |
---|
35 | the_semaphore = _POSIX_Semaphore_Get_by_name( name, NULL, &error ); |
---|
36 | if ( the_semaphore == NULL ) { |
---|
37 | _Objects_Allocator_unlock(); |
---|
38 | rtems_set_errno_and_return_minus_one( _POSIX_Get_by_name_error( error ) ); |
---|
39 | } |
---|
40 | |
---|
41 | the_semaphore->linked = false; |
---|
42 | _POSIX_Semaphore_Namespace_remove( the_semaphore ); |
---|
43 | _POSIX_Semaphore_Delete( the_semaphore ); |
---|
44 | |
---|
45 | _Objects_Allocator_unlock(); |
---|
46 | return 0; |
---|
47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.