diff options
Diffstat (limited to 'libc/misc/sysvipc/sem.c')
-rw-r--r-- | libc/misc/sysvipc/sem.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c index 2cb85a83e..46b4821a4 100644 --- a/libc/misc/sysvipc/sem.c +++ b/libc/misc/sysvipc/sem.c @@ -21,6 +21,7 @@ #include <sys/sem.h> #include "ipc.h" + #ifdef L_semctl /* Return identifier for array of NSEMS semaphores associated with KEY. */ @@ -35,8 +36,12 @@ union semun }; -int -semctl (int semid, int semnum, int cmd, ...) +#ifdef __NR_semctl +#define __NR___semctl __NR_semctl +static inline _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, union semun *, arg); +#endif + +int semctl (int semid, int semnum, int cmd, ...) { union semun arg; va_list ap; @@ -48,32 +53,41 @@ semctl (int semid, int semnum, int cmd, ...) va_end (ap); +#ifdef __NR_semctl + return __semctl(semid, semnum, cmd, &arg); +#else return __ipc(IPCOP_semctl, semid, semnum, cmd, &arg); +#endif } #endif #ifdef L_semget -#include <stdlib.h> /* for definition of NULL */ -/* Return identifier for array of NSEMS semaphores associated with - KEY. */ -int -semget (key, nsems, semflg) - key_t key; - int nsems; - int semflg; +/* for definition of NULL */ +#include <stdlib.h> + +#ifdef __NR_semget +_syscall3(int, semget, key_t, key, int, nsems, int, semflg); + +#else +/* Return identifier for array of NSEMS semaphores associated + * with KEY. */ +int semget (key_t key, int nsems, int semflg) { return __ipc(IPCOP_semget, key, nsems, semflg, NULL); } #endif +#endif #ifdef L_semop + +#ifdef __NR_semop +_syscall3(int, semop, int, semid, struct sembuf *, sops, size_t, nsops); + +#else /* Perform user-defined atomical operation of array of semaphores. */ -int -semop (semid, sops, nsops) - int semid; - struct sembuf *sops; - size_t nsops; +int semop (int semid, struct sembuf *sops, size_t nsops) { return __ipc(IPCOP_semop, semid, (int) nsops, 0, sops); } #endif +#endif |