summaryrefslogtreecommitdiff
path: root/libc/misc/sysvipc/sem.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/misc/sysvipc/sem.c')
-rw-r--r--libc/misc/sysvipc/sem.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/libc/misc/sysvipc/sem.c b/libc/misc/sysvipc/sem.c
index 46b4821a4..a3eaca7be 100644
--- a/libc/misc/sysvipc/sem.c
+++ b/libc/misc/sysvipc/sem.c
@@ -26,13 +26,13 @@
/* Return identifier for array of NSEMS semaphores associated with
KEY. */
#include <stdarg.h>
-/* Define a `union semun' suitable for Linux here. */
-union semun
-{
+/* arg for semctl system calls. */
+union semun {
int val; /* value for SETVAL */
struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short int *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
+ unsigned short *array; /* array for GETALL & SETALL */
+ struct seminfo *__buf; /* buffer for IPC_INFO */
+ void *__pad;
};
@@ -41,18 +41,15 @@ union semun
static inline _syscall4(int, __semctl, int, semid, int, semnum, int, cmd, union semun *, arg);
#endif
-int semctl (int semid, int semnum, int cmd, ...)
+int semctl(int semid, int semnum, int cmd, ...)
{
union semun arg;
- va_list ap;
-
- va_start (ap, cmd);
+ va_list ap;
/* Get the argument. */
+ va_start (ap, cmd);
arg = va_arg (ap, union semun);
-
va_end (ap);
-
#ifdef __NR_semctl
return __semctl(semid, semnum, cmd, &arg);
#else