OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [sempost.c] - Blame information for rev 773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: sempost.c,v 1.2 2001-09-27 11:59:17 chris Exp $
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
/*PAGE
20
 *
21
 *  11.2.7 Unlock a Semaphore, P1003.1b-1993, p.227
22
 */
23
 
24
int sem_post(
25
  sem_t  *sem
26
)
27
{
28
  register POSIX_Semaphore_Control *the_semaphore;
29
  Objects_Locations                 location;
30
 
31
  the_semaphore = _POSIX_Semaphore_Get( sem, &location );
32
  switch ( location ) {
33
    case OBJECTS_ERROR:
34
      set_errno_and_return_minus_one( EINVAL );
35
    case OBJECTS_REMOTE:
36
      _Thread_Dispatch();
37
      return POSIX_MP_NOT_IMPLEMENTED();
38
      set_errno_and_return_minus_one( EINVAL );
39
    case OBJECTS_LOCAL:
40
      _CORE_semaphore_Surrender(
41
        &the_semaphore->Semaphore,
42
        the_semaphore->Object.id,
43
#if defined(RTEMS_MULTIPROCESSING)
44
        NULL         /* XXX need to define a routine to handle this case */
45
#else
46
        NULL
47
#endif
48
      );
49
      _Thread_Enable_dispatch();
50
      return 0;
51
  }
52
  return POSIX_BOTTOM_REACHED();
53
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.