diff options
author | 1998-06-10 08:46:18 +0000 | |
---|---|---|
committer | 1998-06-10 08:46:18 +0000 | |
commit | 84dc39af93c5ea3518f91166f80e398462f4f995 (patch) | |
tree | a2d6544f05516702aa543a641f7935bee26adbcd /lib/libc/sys/semctl.c | |
parent | identd should be nowait. (diff) | |
download | wireguard-openbsd-84dc39af93c5ea3518f91166f80e398462f4f995.tar.xz wireguard-openbsd-84dc39af93c5ea3518f91166f80e398462f4f995.zip |
XPG says 4th arg is optional
Diffstat (limited to 'lib/libc/sys/semctl.c')
-rw-r--r-- | lib/libc/sys/semctl.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/lib/libc/sys/semctl.c b/lib/libc/sys/semctl.c index 49d1c0a0da9..7a933897d66 100644 --- a/lib/libc/sys/semctl.c +++ b/lib/libc/sys/semctl.c @@ -30,21 +30,42 @@ */ #if defined(SYSLIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: semctl.c,v 1.4 1997/07/25 20:30:14 mickey Exp $"; +static char rcsid[] = "$OpenBSD: semctl.c,v 1.5 1998/06/10 08:46:22 deraadt Exp $"; #endif /* SYSLIBC_SCCS and not lint */ #include <sys/types.h> #include <sys/ipc.h> #include <sys/sem.h> +#if __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include <stdlib.h> -#ifdef __STDC__ -int semctl(int semid, int semnum, int cmd, union semun semun) +#if __STDC__ +int semctl(int semid, int semnum, int cmd, ...) #else -int semctl(semid, int semnum, cmd, semun) +int semctl(semid, semnum, cmd, va_alist) int semid, semnum; int cmd; - union semun semun; + va_dcl #endif { - return (__semctl(semid, semnum, cmd, &semun)); + va_list ap; + union semun semun; + union semun *semun_ptr = NULL; +#if __STDC__ + va_start(ap, cmd); +#else + va_start(ap); +#endif + if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL || + cmd == SETVAL || cmd == SETALL) { + semun = va_arg(ap, union semun); + semun_ptr = &semun; + } + va_end(ap); + + return (__semctl(semid, semnum, cmd, semun_ptr)); } |