summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-05-11 22:45:03 +0000
committerEric Andersen <andersen@codepoet.org>2002-05-11 22:45:03 +0000
commitb41ab2c139dfca6eafe17a1ca554091e673442e2 (patch)
treec4a64ea4b91fa5dc05e95372490aa208544893bb
parentacc78d5e947b72f27ac1b250a2c509e0d9fe91b8 (diff)
Fixup for architectures that do not supply the ipc system
call, but implement the ipc functions as separate system calls. -Erik
-rw-r--r--libc/misc/sysvipc/shm.c46
1 files changed, 24 insertions, 22 deletions
diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c
index c916993d0..3ac7e366b 100644
--- a/libc/misc/sysvipc/shm.c
+++ b/libc/misc/sysvipc/shm.c
@@ -20,18 +20,20 @@
#include <stdlib.h>
#include <errno.h>
#include <sys/shm.h>
+#include <syscall.h>
#include "ipc.h"
#ifdef L_shmat
/* Attach the shared memory segment associated with SHMID to the data
segment of the calling process. SHMADDR and SHMFLG determine how
and where the segment is attached. */
-
-void *
-shmat (shmid, shmaddr, shmflg)
- int shmid;
- const void *shmaddr;
- int shmflg;
+#if defined (__alpha__)
+#define __NR_osf_shmat __NR_shmat
+#endif
+#ifdef __NR_shmat
+_syscall3(void *, shmat, int shmid, const void *shmaddr, int shmflg);
+#else
+void * shmat (int shmid, const void *shmaddr, int shmflg)
{
int retval;
unsigned long raddr;
@@ -41,43 +43,43 @@ shmat (shmid, shmaddr, shmflg)
? (void *) retval : (void *) raddr);
}
#endif
+#endif
#ifdef L_shmctl
/* Provide operations to control over shared memory segments. */
-
-int
-shmctl (shmid, cmd, buf)
- int shmid;
- int cmd;
- struct shmid_ds *buf;
+#ifdef __NR_shctl
+_syscall3(int, shmctl, int shmid, int, cmd, struct shmid_ds *, buf);
+#else
+int shmctl (int shmid, int cmd, struct shmid_ds *buf)
{
return __ipc(IPCOP_shmctl, shmid, cmd, 0, buf);
}
#endif
+#endif
#ifdef L_shmdt
/* Detach shared memory segment starting at address specified by SHMADDR
from the caller's data segment. */
-
-int
-shmdt (shmaddr)
- const void *shmaddr;
+#ifdef __NR_shmdt
+_syscall1(int, shmdt, const void *, shmaddr);
+#else
+int shmdt (const void *shmaddr)
{
return __ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
}
#endif
+#endif
#ifdef L_shmget
/* Return an identifier for an shared memory segment of at least size SIZE
which is associated with KEY. */
-
-int
-shmget (key, size, shmflg)
- key_t key;
- size_t size;
- int shmflg;
+#ifdef __NR_shmget
+_syscall1(int, shmget, key_t, key, size_t, size, int, shmflg);
+#else
+int shmget (key_t key, size_t size, int shmflg)
{
return __ipc(IPCOP_shmget, key, size, shmflg, NULL);
}
#endif
+#endif