summaryrefslogtreecommitdiff
path: root/libc/misc/sysvipc
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/sysvipc')
-rw-r--r--libc/misc/sysvipc/msgq.c17
-rw-r--r--libc/misc/sysvipc/sem.c44
-rw-r--r--libc/misc/sysvipc/shm.c4
3 files changed, 48 insertions, 17 deletions
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 <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
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)
{