source: rtems/c/src/exec/posix/src/semclose.c @ 3fb8909a

4.104.114.84.95
Last change on this file since 3fb8909a was 3fb8909a, checked in by Joel Sherrill <joel.sherrill@…>, on 11/09/99 at 13:39:42

sem_close was accidentally lost in the split.

  • Property mode set to 100644
File size: 993 bytes
Line 
1/*
2 *  $Id$
3 */
4
5#include <stdarg.h>
6
7#include <errno.h>
8#include <fcntl.h>
9#include <pthread.h>
10#include <semaphore.h>
11#include <limits.h>
12
13#include <rtems/system.h>
14#include <rtems/score/object.h>
15#include <rtems/posix/semaphore.h>
16#include <rtems/posix/time.h>
17#include <rtems/posix/seterr.h>
18
19
20/*PAGE
21 *
22 *  11.2.4 Close a Named Semaphore, P1003.1b-1993, p.224
23 */
24
25int sem_close(
26  sem_t *sem
27)
28{
29  register POSIX_Semaphore_Control *the_semaphore;
30  Objects_Locations                 location;
31 
32  the_semaphore = _POSIX_Semaphore_Get( sem, &location );
33  switch ( location ) {
34    case OBJECTS_ERROR:
35      set_errno_and_return_minus_one( EINVAL );
36    case OBJECTS_REMOTE:
37      _Thread_Dispatch();
38      return POSIX_MP_NOT_IMPLEMENTED();
39      set_errno_and_return_minus_one( EINVAL );
40    case OBJECTS_LOCAL:
41      the_semaphore->open_count -= 1;
42      _POSIX_Semaphore_Delete( the_semaphore );
43      _Thread_Enable_dispatch();
44      return 0;
45  }
46  return POSIX_BOTTOM_REACHED();
47}
Note: See TracBrowser for help on using the repository browser.