Date: Fri, 22 Dec 1995 09:14:02 -0500 From: tsingle@sunland.gsfc.nasa.gov (Tim Singletary) To: hackers@freebsd.org Subject: Re: semctl() portability issue and fix Message-ID: <199512221414.JAA07674@sunland.gsfc.nasa.gov>
next in thread | raw e-mail | index | archive | help
I inadvertently inserted the wrong version of semctl() in my previous
version. What I'm actually using is:
-begin--------------
#include <stdarg.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
int semctl(int semid, int semnum, int cmd, ...)
{
va_list ap;
union semun fourth_arg;
union semun *fourth_arg_ptr;
va_start(ap,cmd);
if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL
|| cmd == SETVAL || cmd == SETALL) {
fourth_arg = va_arg(ap, union semun);
}
fourth_arg_ptr = &fourth_arg;
va_end(ap);
return (semsys(0, semid, semnum, cmd, fourth_arg_ptr));
}
-end----------------
tim
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512221414.JAA07674>
