about summary refs log tree commit diff
path: root/src/ipc/semctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipc/semctl.c')
-rw-r--r--src/ipc/semctl.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ipc/semctl.c b/src/ipc/semctl.c
new file mode 100644
index 00000000..7ada116b
--- /dev/null
+++ b/src/ipc/semctl.c
@@ -0,0 +1,18 @@
+#include <sys/sem.h>
+#include <stdarg.h>
+#include "syscall.h"
+#include "ipc.h"
+
+int semctl(int id, int num, int cmd, ...)
+{
+	long arg;
+	va_list ap;
+	va_start(ap, cmd);
+	arg = va_arg(ap, long);
+	va_end(ap);
+#ifdef __NR_semctl
+	return syscall4(__NR_semctl, id, num, cmd, arg);
+#else
+	return syscall5(__NR_ipc, IPCOP_semctl, id, num, cmd | 0x100, (long)&arg);
+#endif
+}