Merge from vendor branch BZIP:
[dragonfly.git] / lib / libc / gen / semctl.c
CommitLineData
eb318baa 1/* $DragonFly: src/lib/libc/gen/semctl.c,v 1.3 2005/04/26 06:08:42 joerg Exp $ */
e4c94154 2
984263bc
MD
3#include <sys/types.h>
4#include <sys/ipc.h>
5#include <sys/sem.h>
984263bc 6#include <stdarg.h>
984263bc
MD
7#include <stdlib.h>
8
eb318baa
JS
9int
10semctl(int semid, int semnum, int cmd, ...)
984263bc
MD
11{
12 va_list ap;
13 union semun semun;
14 union semun *semun_ptr;
984263bc 15 va_start(ap, cmd);
984263bc
MD
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;
22 }
23 va_end(ap);
24
984263bc 25 return (semsys(0, semid, semnum, cmd, semun_ptr));
984263bc 26}