Ver código fonte

Fixup for architectures that do not supply the ipc system
call, but implement the ipc functions as separate system calls.
-Erik

Eric Andersen 23 anos atrás
pai
commit
b41ab2c139
1 arquivos alterados com 24 adições e 22 exclusões
  1. 24 22
      libc/misc/sysvipc/shm.c

+ 24 - 22
libc/misc/sysvipc/shm.c

@@ -20,18 +20,20 @@
 #include <stdlib.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <errno.h>
 #include <sys/shm.h>
 #include <sys/shm.h>
+#include <syscall.h>
 #include "ipc.h"
 #include "ipc.h"
 
 
 #ifdef L_shmat
 #ifdef L_shmat
 /* Attach the shared memory segment associated with SHMID to the data
 /* Attach the shared memory segment associated with SHMID to the data
    segment of the calling process.  SHMADDR and SHMFLG determine how
    segment of the calling process.  SHMADDR and SHMFLG determine how
    and where the segment is attached.  */
    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;
     int retval;
     unsigned long raddr;
     unsigned long raddr;
@@ -41,43 +43,43 @@ shmat (shmid, shmaddr, shmflg)
 	    ? (void *) retval : (void *) raddr);
 	    ? (void *) retval : (void *) raddr);
 }
 }
 #endif
 #endif
+#endif
 
 
 #ifdef L_shmctl
 #ifdef L_shmctl
 /* Provide operations to control over shared memory segments.  */
 /* 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);
     return __ipc(IPCOP_shmctl, shmid, cmd, 0, buf);
 }
 }
 #endif
 #endif
+#endif
 
 
 
 
 #ifdef L_shmdt
 #ifdef L_shmdt
 /* Detach shared memory segment starting at address specified by SHMADDR
 /* Detach shared memory segment starting at address specified by SHMADDR
    from the caller's data segment.  */
    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);
     return __ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
 }
 }
 #endif
 #endif
+#endif
 
 
 #ifdef L_shmget
 #ifdef L_shmget
 /* Return an identifier for an shared memory segment of at least size SIZE
 /* Return an identifier for an shared memory segment of at least size SIZE
    which is associated with KEY.  */
    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);
     return __ipc(IPCOP_shmget, key, size, shmflg, NULL);
 }
 }
 #endif
 #endif
+#endif