Selaa lähdekoodia

Cope with systems that don't glob all these together, but use
separate syscalls.
-Erik

Eric Andersen 22 vuotta sitten
vanhempi
commit
f3c41bf8b6
3 muutettua tiedostoa jossa 48 lisäystä ja 17 poistoa
  1. 17 0
      libc/misc/sysvipc/msgq.c
  2. 29 15
      libc/misc/sysvipc/sem.c
  3. 2 2
      libc/misc/sysvipc/shm.c

+ 17 - 0
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
 

+ 29 - 15
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

+ 2 - 2
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)
 {