1994-09-13 14:52:45 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ipc.h>
|
|
|
|
#include <sys/sem.h>
|
1998-06-06 18:52:43 +00:00
|
|
|
#if __STDC__
|
1998-05-31 04:09:09 +00:00
|
|
|
#include <stdarg.h>
|
1998-06-06 18:52:43 +00:00
|
|
|
#else
|
|
|
|
#include <varargs.h>
|
|
|
|
#endif
|
1998-05-31 04:09:09 +00:00
|
|
|
#include <stdlib.h>
|
1994-09-13 14:52:45 +00:00
|
|
|
|
|
|
|
#if __STDC__
|
1998-05-31 04:09:09 +00:00
|
|
|
int semctl(int semid, int semnum, int cmd, ...)
|
1994-09-13 14:52:45 +00:00
|
|
|
#else
|
1998-05-31 04:09:09 +00:00
|
|
|
int semctl(semid, semnum, cmd, va_alist)
|
1994-09-13 14:52:45 +00:00
|
|
|
int semid, semnum;
|
|
|
|
int cmd;
|
1998-05-31 04:09:09 +00:00
|
|
|
va_dcl
|
1994-09-13 14:52:45 +00:00
|
|
|
#endif
|
|
|
|
{
|
1998-05-31 04:09:09 +00:00
|
|
|
va_list ap;
|
|
|
|
union semun semun;
|
|
|
|
union semun *semun_ptr;
|
1998-06-06 18:52:43 +00:00
|
|
|
#if __STDC__
|
1998-05-31 04:09:09 +00:00
|
|
|
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;
|
|
|
|
} else {
|
|
|
|
semun_ptr = NULL;
|
|
|
|
}
|
|
|
|
va_end(ap);
|
|
|
|
|
1998-03-09 04:39:13 +00:00
|
|
|
#ifdef __NETBSD_SYSCALLS
|
1998-05-31 04:09:09 +00:00
|
|
|
return (__semctl(semid, semnum, cmd, semun_ptr));
|
1998-03-09 04:39:13 +00:00
|
|
|
#else
|
1998-05-31 04:09:09 +00:00
|
|
|
return (semsys(0, semid, semnum, cmd, semun_ptr));
|
1998-03-09 04:39:13 +00:00
|
|
|
#endif
|
1994-09-13 14:52:45 +00:00
|
|
|
}
|