diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-09-27 20:53:58 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1995-09-27 20:53:58 +0000 |
commit | 37f4c2d99fbf09142aeafe3a9908a81e283f8186 (patch) | |
tree | 04dc487b28113dc17f1c3c9ab2241390b4ed95ea /c/src/lib/libbsp/unix/posix/shmsupp/lock.c | |
parent | Fixed typo (diff) | |
download | rtems-37f4c2d99fbf09142aeafe3a9908a81e283f8186.tar.bz2 |
Modified UNIX simulator port so all references to native unix
stuff is in the executive source proper in the file cpu.c. This
should help avoid conflicts between RTEMS POSIX files and UNIX files.
Diffstat (limited to 'c/src/lib/libbsp/unix/posix/shmsupp/lock.c')
-rw-r--r-- | c/src/lib/libbsp/unix/posix/shmsupp/lock.c | 60 |
1 files changed, 8 insertions, 52 deletions
diff --git a/c/src/lib/libbsp/unix/posix/shmsupp/lock.c b/c/src/lib/libbsp/unix/posix/shmsupp/lock.c index 0dd0cbd8b3..76a57d0a06 100644 --- a/c/src/lib/libbsp/unix/posix/shmsupp/lock.c +++ b/c/src/lib/libbsp/unix/posix/shmsupp/lock.c @@ -17,18 +17,9 @@ * $Id$ */ -#include <rtems.h> - #include <bsp.h> #include <shm.h> -#include <errno.h> -#include <stdio.h> -#include <unistd.h> -#include <sys/ipc.h> -#include <sys/shm.h> -#include <sys/sem.h> - extern int semid; /* @@ -55,30 +46,13 @@ void Shm_Lock( Shm_Locked_queue_Control *lq_cb ) { - rtems_unsigned32 isr_level; - struct sembuf sb; - int status; - - sb.sem_num = lq_cb->lock; - sb.sem_op = -1; - sb.sem_flg = 0; + rtems_unsigned32 isr_level; - rtems_interrupt_disable( isr_level ); + rtems_interrupt_disable( isr_level ); - Shm_isrstat = isr_level; + Shm_isrstat = isr_level; - while (1) { - status = semop(semid, &sb, 1); - if ( status >= 0 ) - break; - if ( status == -1 ) { - fix_syscall_errno(); /* in case of newlib */ - if (errno == EINTR) - continue; - perror("shm lock"); - rtems_fatal_error_occurred(RTEMS_UNSATISFIED); - } - } + _CPU_SHM_Lock( lq_cb->lock ); } /* @@ -91,28 +65,10 @@ void Shm_Unlock( Shm_Locked_queue_Control *lq_cb ) { - rtems_unsigned32 isr_level; - struct sembuf sb; - int status; - - sb.sem_num = lq_cb->lock; - sb.sem_op = 1; - sb.sem_flg = 0; - - while (1) { - status = semop(semid, &sb, 1); - if ( status >= 0 ) - break; + rtems_unsigned32 isr_level; - if ( status == -1 ) { - fix_syscall_errno(); /* in case of newlib */ - if (errno == EINTR) - continue; - perror("shm unlock"); - rtems_fatal_error_occurred(RTEMS_UNSATISFIED); - } - } + _CPU_SHM_Unlock( lq_cb->lock ); - isr_level = Shm_isrstat; - rtems_interrupt_enable( isr_level ); + isr_level = Shm_isrstat; + rtems_interrupt_enable( isr_level ); } |