Import complex arithmetic functions from {Net,Free}BSD.
[dragonfly.git] / lib / libc / gen / semctl.c
blobeb25e30b1f44abc7d8ab5c598ba3bc68ce315d11
1 /* $DragonFly: src/lib/libc/gen/semctl.c,v 1.3 2005/04/26 06:08:42 joerg Exp $ */
3 #include <sys/types.h>
4 #include <sys/ipc.h>
5 #include <sys/sem.h>
6 #include <stdarg.h>
7 #include <stdlib.h>
9 int
10 semctl(int semid, int semnum, int cmd, ...)
12 va_list ap;
13 union semun semun;
14 union semun *semun_ptr;
15 va_start(ap, cmd);
16 if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL
17 || cmd == SETVAL || cmd == SETALL) {
18 semun = va_arg(ap, union semun);
19 semun_ptr = &semun;
20 } else {
21 semun_ptr = NULL;
23 va_end(ap);
25 return (semsys(0, semid, semnum, cmd, semun_ptr));