[comp.sys.sun] Fourth argument to semctl when third argument is GETVAL

sim@mdtf11.fnal.gov (James Sim) (06/28/91)

The man page for semctl on SunOS identifies what the fourth argument to the 
semctl call needs to be when the third argument is SETVAL, GETALL, 
SETALL, IPC_STAT, IPC_SET.  For the remaining values of the third argument,
GETVAL, GETPID, GETNCNT, and GETZCNT, the man page does not identify what
should be passed for the fourth argument.  I inferred from this that I could
pass 0 as the fourth argument when passing GETVAL as the third argument, and 
in fact, on another flavor of Unix (Concurrent RTU), such a calling sequence 
works.  However, on SunOS 4.1.1, it does not work -- it results in a
segmentation fault and core dump.  Passing 1 for the fourth argument also 
produces a segmentation fault.  I would not expect semctl to use the fourth
argument when the third argument is GETVAL, since the fourth argument appears
to serve the function of passing additional information that is dependent on 
what the third argument is, and for GETVAL, semid and semnum are the only 
items of information needed to return the semaphore value.

Does anyone know what the fourth argument to semctl should be when the third
argument is GETVAL?