Changeset cb3c1718 in rtems for c/src/exec/posix/src/semunlink.c
- Timestamp:
- Nov 22, 1999, 4:13:22 PM (21 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- 101e9b0
- Parents:
- 2545646
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/posix/src/semunlink.c
r2545646 rcb3c1718 19 19 /*PAGE 20 20 * 21 * sem_unlink 22 * 23 * Unlinks a named semaphore, sem_close must also be called to remove 24 * the semaphore. 25 * 21 26 * 11.2.5 Remove a Named Semaphore, P1003.1b-1993, p.225 22 27 */ … … 31 36 Objects_Locations location; 32 37 38 _Thread_Disable_dispatch(); 39 33 40 status = _POSIX_Semaphore_Name_to_id( name, &the_semaphore_id ); 34 if ( status != 0 ) 41 if ( status != 0 ) { 42 _Thread_Enable_dispatch(); 35 43 set_errno_and_return_minus_one( status ); 44 } 36 45 37 the_semaphore = _POSIX_Semaphore_Get( &the_semaphore_id, &location ); 38 switch ( location ) { 39 case OBJECTS_ERROR: 40 set_errno_and_return_minus_one( EINVAL ); 41 case OBJECTS_REMOTE: 42 _Thread_Dispatch(); 43 return POSIX_MP_NOT_IMPLEMENTED(); 44 set_errno_and_return_minus_one( EINVAL ); 45 case OBJECTS_LOCAL: 46 /* 47 * Don't support unlinking a remote semaphore. 48 */ 46 49 50 if ( !_Objects_Is_local_id(the_semaphore_id) ) { 51 _Thread_Enable_dispatch(); 52 set_errno_and_return_minus_one( ENOSYS ); 53 } 54 55 the_semaphore = _Objects_Get_local_object( 56 &_POSIX_Semaphore_Information, 57 _Objects_Get_index( the_semaphore_id ) 58 ); 59 47 60 #if defined(RTEMS_MULTIPROCESSING) 48 if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) { 49 _Objects_MP_Close( 50 &_POSIX_Semaphore_Information, 51 the_semaphore->Object.id 52 ); 53 } 61 if ( the_semaphore->process_shared == PTHREAD_PROCESS_SHARED ) { 62 _Objects_MP_Close( &_POSIX_Semaphore_Information, the_semaphore_id ); 63 } 54 64 #endif 55 65 56 57 58 66 the_semaphore->linked = FALSE; 67 _POSIX_Semaphore_Namespace_remove( the_semaphore ); 68 _POSIX_Semaphore_Delete( the_semaphore ); 59 69 60 _Thread_Enable_dispatch(); 61 return 0; 62 } 63 return POSIX_BOTTOM_REACHED(); 70 _Thread_Enable_dispatch(); 71 return 0; 64 72 }
Note: See TracChangeset
for help on using the changeset viewer.