summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2008-01-05 06:47:30 +0000
committerMike Frysinger <vapier@gentoo.org>2008-01-05 06:47:30 +0000
commitee438a1eb65d4092116df23ce029fa98bc5ea162 (patch)
tree4939a48b641510e6dea85c2b475c41349cd6e101 /libc
parent29c5e0adf13a96a0247e79d352168548c8c83fdf (diff)
implement semtimedop for #927
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/sysvipc/Makefile.in4
-rw-r--r--libc/misc/sysvipc/__syscall_ipc.c (renamed from libc/sysdeps/linux/common/__syscall_ipc.c)6
-rw-r--r--libc/misc/sysvipc/ipc.h5
-rw-r--r--libc/misc/sysvipc/msgq.c8
-rw-r--r--libc/misc/sysvipc/sem.c21
-rw-r--r--libc/misc/sysvipc/semtimedop.c8
-rw-r--r--libc/misc/sysvipc/shm.c8
7 files changed, 42 insertions, 18 deletions
diff --git a/libc/misc/sysvipc/Makefile.in b/libc/misc/sysvipc/Makefile.in
index 4c865dc49..6b88ad6f0 100644
--- a/libc/misc/sysvipc/Makefile.in
+++ b/libc/misc/sysvipc/Makefile.in
@@ -5,10 +5,10 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := ftok.c
+CSRC := ftok.c __syscall_ipc.c
# multi source sem.c
-CSRC += semget.c semctl.c semop.c
+CSRC += semget.c semctl.c semop.c semtimedop.c
# multi source shm.c
CSRC += shmat.c shmctl.c shmdt.c shmget.c
diff --git a/libc/sysdeps/linux/common/__syscall_ipc.c b/libc/misc/sysvipc/__syscall_ipc.c
index d46b142fb..99dfbf49f 100644
--- a/libc/sysdeps/linux/common/__syscall_ipc.c
+++ b/libc/misc/sysvipc/__syscall_ipc.c
@@ -11,7 +11,7 @@
#ifdef __NR_ipc
#define __NR___syscall_ipc __NR_ipc
-#include "../../../misc/sysvipc/ipc.h"
-_syscall5(int, __syscall_ipc, unsigned int, call, int, first, int, second, int,
- third, void *, ptr);
+#include "ipc.h"
+_syscall6(int, __syscall_ipc, unsigned int, call, long, first, long, second, long,
+ third, void *, ptr, void *, fifth);
#endif
diff --git a/libc/misc/sysvipc/ipc.h b/libc/misc/sysvipc/ipc.h
index 5bdbe6471..339d1364b 100644
--- a/libc/misc/sysvipc/ipc.h
+++ b/libc/misc/sysvipc/ipc.h
@@ -12,14 +12,15 @@
#ifdef __NR_ipc
/* The actual system call: all functions are multiplexed by this. */
-extern int __syscall_ipc (unsigned int __call, int __first, int __second,
- int __third, void *__ptr) attribute_hidden;
+extern int __syscall_ipc (unsigned int __call, long __first, long __second,
+ long __third, void *__ptr, void *__fifth) attribute_hidden;
/* The codes for the functions to use the multiplexer `__syscall_ipc'. */
#define IPCOP_semop 1
#define IPCOP_semget 2
#define IPCOP_semctl 3
+#define IPCOP_semtimedop 4
#define IPCOP_msgsnd 11
#define IPCOP_msgrcv 12
#define IPCOP_msgget 13
diff --git a/libc/misc/sysvipc/msgq.c b/libc/misc/sysvipc/msgq.c
index f56bb4e8a..c1ab27626 100644
--- a/libc/misc/sysvipc/msgq.c
+++ b/libc/misc/sysvipc/msgq.c
@@ -15,7 +15,7 @@ int msgctl(int msqid, int cmd, struct msqid_ds *buf)
#ifdef __NR_msgctl
return __libc_msgctl(msqid, cmd | __IPC_64, buf);
#else
- return __syscall_ipc(IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf);
+ return __syscall_ipc(IPCOP_msgctl, msqid, cmd | __IPC_64, 0, buf, 0);
#endif
}
#endif
@@ -28,7 +28,7 @@ _syscall2(int, msgget, key_t, key, int, msgflg)
/* Get messages queue. */
int msgget (key_t key, int msgflg)
{
- return __syscall_ipc(IPCOP_msgget ,key ,msgflg ,0 ,0);
+ return __syscall_ipc(IPCOP_msgget ,key ,msgflg ,0 ,0, 0);
}
#endif
#endif
@@ -52,7 +52,7 @@ int msgrcv (int msqid, void *msgp, size_t msgsz,
temp.r_msgtyp = msgtyp;
temp.oldmsg = msgp;
- return __syscall_ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp);
+ return __syscall_ipc(IPCOP_msgrcv ,msqid ,msgsz ,msgflg ,&temp, 0);
}
#endif
#endif
@@ -66,7 +66,7 @@ _syscall4(int, msgsnd, int, msqid, const void *, msgp, size_t, msgsz, int, msgfl
/* Send message to message queue. */
int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg)
{
- return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp);
+ return __syscall_ipc(IPCOP_msgsnd, msqid, msgsz, msgflg, (void *)msgp, 0);
}
#endif
#endif
diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c
index ccbe25b46..ce259a10e 100644
--- a/libc/misc/sysvipc/sem.c
+++ b/libc/misc/sysvipc/sem.c
@@ -53,7 +53,7 @@ int semctl(int semid, int semnum, int cmd, ...)
#ifdef __NR_semctl
return __semctl(semid, semnum, cmd | __IPC_64, arg.__pad);
#else
- return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg);
+ return __syscall_ipc(IPCOP_semctl, semid, semnum, cmd | __IPC_64, &arg, 0);
#endif
}
#endif
@@ -70,7 +70,7 @@ _syscall3(int, semget, key_t, key, int, nsems, int, semflg);
* with KEY. */
int semget (key_t key, int nsems, int semflg)
{
- return __syscall_ipc(IPCOP_semget, key, nsems, semflg, NULL);
+ return __syscall_ipc(IPCOP_semget, key, nsems, semflg, NULL, 0);
}
#endif
#endif
@@ -84,7 +84,22 @@ _syscall3(int, semop, int, semid, struct sembuf *, sops, size_t, nsops);
/* Perform user-defined atomical operation of array of semaphores. */
int semop (int semid, struct sembuf *sops, size_t nsops)
{
- return __syscall_ipc(IPCOP_semop, semid, (int) nsops, 0, sops);
+ return __syscall_ipc(IPCOP_semop, semid, (int) nsops, 0, sops, 0);
+}
+#endif
+#endif
+
+#ifdef L_semtimedop
+
+#ifdef __NR_semtimedop
+_syscall6(int, semtimedop, int, semid, struct sembuf *, sops, size_t, nsops, const struct timespec *, timeout);
+
+#else
+
+int semtimedop(int semid, struct sembuf *sops, size_t nsops,
+ const struct timespec *timeout)
+{
+ return __syscall_ipc(IPCOP_semtimedop, semid, nsops, 0, sops, timeout);
}
#endif
#endif
diff --git a/libc/misc/sysvipc/semtimedop.c b/libc/misc/sysvipc/semtimedop.c
new file mode 100644
index 000000000..ecd0438f5
--- /dev/null
+++ b/libc/misc/sysvipc/semtimedop.c
@@ -0,0 +1,8 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+
+#define L_semtimedop
+#include "sem.c"
diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c
index a466de921..9f76a12ed 100644
--- a/libc/misc/sysvipc/shm.c
+++ b/libc/misc/sysvipc/shm.c
@@ -45,7 +45,7 @@ void * shmat (int shmid, const void *shmaddr, int shmflg)
int retval;
unsigned long raddr;
- retval = __syscall_ipc(IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr);
+ retval = __syscall_ipc(IPCOP_shmat, shmid, shmflg, (int) &raddr, (void *) shmaddr, 0);
return ((unsigned long int) retval > -(unsigned long int) SHMLBA
? (void *) retval : (void *) raddr);
}
@@ -63,7 +63,7 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
#ifdef __NR_shmctl
return __libc_shmctl(shmid, cmd | __IPC_64, buf);
#else
- return __syscall_ipc(IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf);
+ return __syscall_ipc(IPCOP_shmctl, shmid, cmd | __IPC_64, 0, buf, 0);
#endif
}
#endif
@@ -77,7 +77,7 @@ _syscall1(int, shmdt, const void *, shmaddr);
#else
int shmdt (const void *shmaddr)
{
- return __syscall_ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr);
+ return __syscall_ipc(IPCOP_shmdt, 0, 0, 0, (void *) shmaddr, 0);
}
#endif
#endif
@@ -90,7 +90,7 @@ _syscall3(int, shmget, key_t, key, size_t, size, int, shmflg);
#else
int shmget (key_t key, size_t size, int shmflg)
{
- return __syscall_ipc(IPCOP_shmget, key, size, shmflg, NULL);
+ return __syscall_ipc(IPCOP_shmget, key, size, shmflg, NULL, 0);
}
#endif
#endif