From f3c41bf8b6dbc12644d2ff38e6f316f2d6a2066e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 30 May 2002 00:41:03 +0000 Subject: Cope with systems that don't glob all these together, but use separate syscalls. -Erik --- libc/misc/sysvipc/msgq.c | 17 +++++++++++++++++ libc/misc/sysvipc/sem.c | 44 +++++++++++++++++++++++++++++--------------- libc/misc/sysvipc/shm.c | 4 ++-- 3 files changed, 48 insertions(+), 17 deletions(-) (limited to 'libc/misc/sysvipc') diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c index f373c1611..ffd58df05 100644 --- a/libc/misc/sysvipc/msgq.c +++ b/libc/misc/sysvipc/msgq.c @@ -4,21 +4,30 @@ #ifdef L_msgctl + +#ifdef __NR_msgctl +_syscall3(int, msgctl, int, msqid, int, cmd, struct msqid_ds *, buf); +#else /* Message queue control operation. */ int msgctl (int msqid, int cmd, struct msqid_ds *buf) { return __ipc(IPCOP_msgctl ,msqid ,cmd ,0 ,buf); } #endif +#endif #ifdef L_msgget +#ifdef __NR_msgget +_syscall2(int, msgget, key_t, key, int, msgflg) +#else /* Get messages queue. */ int msgget (key_t key, int msgflg) { return __ipc(IPCOP_msgget ,key ,msgflg ,0 ,0); } #endif +#endif struct new_msg_buf{ @@ -29,6 +38,9 @@ struct new_msg_buf{ #ifdef L_msgrcv +#ifdef __NR_msgrcv +_syscall5(int, msgrcv, int, msqid, void *, msgp, size_t, msgsz, long int, msgtyp, int, msgflg); +#else int msgrcv (int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) { @@ -39,14 +51,19 @@ int msgrcv (int msqid, void *msgp, size_t msgsz, return __ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp); } #endif +#endif #ifdef L_msgsnd +#ifdef __NR_msgsnd +_syscall4(int, msgsnd, int, msqid, const void *, msgp, size_t, msgsz, int, msgflg); +#else /* Send message to message queue. */ int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) { return __ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp); } #endif +#endif 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 #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 /* 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 + +#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 diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c index 7ac7d35b0..553c1203e 100644 --- a/libc/misc/sysvipc/shm.c +++ b/libc/misc/sysvipc/shm.c @@ -47,8 +47,8 @@ void * shmat (int shmid, const void *shmaddr, int shmflg) #ifdef L_shmctl /* Provide operations to control over shared memory segments. */ -#ifdef __NR_shctl -_syscall3(int, shmctl, int shmid, int, cmd, struct shmid_ds *, buf); +#ifdef __NR_shmctl +_syscall3(int, shmctl, int, shmid, int, cmd, struct shmid_ds *, buf); #else int shmctl (int shmid, int cmd, struct shmid_ds *buf) { -- cgit v1.2.3