Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1161)

Unified Diff: fusl/src/ipc/semctl.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fusl/src/ipc/msgsnd.c ('k') | fusl/src/ipc/semget.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/ipc/semctl.c
diff --git a/fusl/src/ipc/semctl.c b/fusl/src/ipc/semctl.c
new file mode 100644
index 0000000000000000000000000000000000000000..673a9a8c996b2bd18657b1dff7f6934ec34b2d69
--- /dev/null
+++ b/fusl/src/ipc/semctl.c
@@ -0,0 +1,28 @@
+#include <sys/sem.h>
+#include <stdarg.h>
+#include "syscall.h"
+#include "ipc.h"
+
+union semun {
+ int val;
+ struct semid_ds *buf;
+ unsigned short *array;
+};
+
+int semctl(int id, int num, int cmd, ...)
+{
+ union semun arg = {0};
+ va_list ap;
+ switch (cmd) {
+ case SETVAL: case GETALL: case SETALL: case IPC_STAT: case IPC_SET:
+ case IPC_INFO: case SEM_INFO: case SEM_STAT:
+ va_start(ap, cmd);
+ arg = va_arg(ap, union semun);
+ va_end(ap);
+ }
+#ifdef SYS_semctl
+ return syscall(SYS_semctl, id, num, cmd | IPC_64, arg.buf);
+#else
+ return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg.buf);
+#endif
+}
« no previous file with comments | « fusl/src/ipc/msgsnd.c ('k') | fusl/src/ipc/semget.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698