implement semtimedop
authorRich Felker <dalias@aerifal.cx>
Sat, 9 Nov 2013 05:18:57 +0000 (00:18 -0500)
committerRich Felker <dalias@aerifal.cx>
Sat, 9 Nov 2013 05:18:57 +0000 (00:18 -0500)
this is a Linux-specific extension to the sysv semaphore api.

src/ipc/ipc.h
src/ipc/semtimedop.c [new file with mode: 0644]

index 548758237f65f7e6351be50acb50dd699076d2a1..30ab939ad6b9a2c4e4c9ebca7ec8cf3c6fc3cc38 100644 (file)
@@ -1,6 +1,7 @@
 #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/src/ipc/semtimedop.c b/src/ipc/semtimedop.c
new file mode 100644 (file)
index 0000000..a3b511b
--- /dev/null
@@ -0,0 +1,13 @@
+#define _GNU_SOURCE
+#include <sys/sem.h>
+#include "syscall.h"
+#include "ipc.h"
+
+int semtimedop(int id, struct sembuf *buf, size_t n, const struct timespec *ts)
+{
+#ifdef SYS_semop
+       return syscall(SYS_semtimedop, id, buf, n, ts);
+#else
+       return syscall(SYS_ipc, IPCOP_semtimedop, id, n, 0, buf, ts);
+#endif
+}