mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
sem_close was accidentally lost in the split.
This commit is contained in:
@@ -68,7 +68,7 @@ PSIGNAL_C_PIECES = psignal alarm kill killinfo pause \
|
||||
sigwait sigwaitinfo signal_2
|
||||
|
||||
SEMAPHORE_C_PIECES= semaphore semaphorecreatesupp semaphoredeletesupp \
|
||||
semaphoremp semaphorenametoid semaphorewaitsupp semdestroy \
|
||||
semaphoremp semaphorenametoid semaphorewaitsupp semclose semdestroy \
|
||||
semgetvalue seminit semopen sempost semtimedwait semtrywait \
|
||||
semunlink semwait
|
||||
|
||||
|
||||
47
c/src/exec/posix/src/semclose.c
Normal file
47
c/src/exec/posix/src/semclose.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/posix/semaphore.h>
|
||||
#include <rtems/posix/time.h>
|
||||
#include <rtems/posix/seterr.h>
|
||||
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
|
||||
*/
|
||||
|
||||
int sem_close(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
case OBJECTS_LOCAL:
|
||||
the_semaphore->open_count -= 1;
|
||||
_POSIX_Semaphore_Delete( the_semaphore );
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
47
cpukit/posix/src/semclose.c
Normal file
47
cpukit/posix/src/semclose.c
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <semaphore.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/posix/semaphore.h>
|
||||
#include <rtems/posix/time.h>
|
||||
#include <rtems/posix/seterr.h>
|
||||
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* 11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
|
||||
*/
|
||||
|
||||
int sem_close(
|
||||
sem_t *sem
|
||||
)
|
||||
{
|
||||
register POSIX_Semaphore_Control *the_semaphore;
|
||||
Objects_Locations location;
|
||||
|
||||
the_semaphore = _POSIX_Semaphore_Get( sem, &location );
|
||||
switch ( location ) {
|
||||
case OBJECTS_ERROR:
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
case OBJECTS_REMOTE:
|
||||
_Thread_Dispatch();
|
||||
return POSIX_MP_NOT_IMPLEMENTED();
|
||||
set_errno_and_return_minus_one( EINVAL );
|
||||
case OBJECTS_LOCAL:
|
||||
the_semaphore->open_count -= 1;
|
||||
_POSIX_Semaphore_Delete( the_semaphore );
|
||||
_Thread_Enable_dispatch();
|
||||
return 0;
|
||||
}
|
||||
return POSIX_BOTTOM_REACHED();
|
||||
}
|
||||
Reference in New Issue
Block a user