projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix pointer type mismatch and misplacement of const
[musl]
/
src
/
ipc
/
semctl.c
diff --git
a/src/ipc/semctl.c
b/src/ipc/semctl.c
index
df05ec7
..
673a9a8
100644
(file)
--- a/
src/ipc/semctl.c
+++ b/
src/ipc/semctl.c
@@
-3,16
+3,26
@@
#include "syscall.h"
#include "ipc.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, ...)
{
int semctl(int id, int num, int cmd, ...)
{
-
long arg
;
+
union semun arg = {0}
;
va_list ap;
va_list ap;
- va_start(ap, cmd);
- arg = va_arg(ap, long);
- va_end(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
#ifdef SYS_semctl
- return syscall(SYS_semctl, id, num, cmd
, arg
);
+ return syscall(SYS_semctl, id, num, cmd
| IPC_64, arg.buf
);
#else
#else
- return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd |
0x100, &arg
);
+ return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd |
IPC_64, &arg.buf
);
#endif
}
#endif
}