Problems with semaphores under SunOS4.1

Gregor Bautz gregor at cip-s01.informatik.rwth-aachen.de
Thu Jan 24 10:19:48 AEST 1991


Has anybody experience using semaphores with SunOS 4.1. I've got the
following problems:

First, I create the semaphore using the semget() function with flag =
IPC_CREAT|IPC_EXCL|0666 in process, let's call it proc1. After that the
semaphore is initialised with the value 1 by semctl(); the value is set
correctly, showed by a following semctl(GETVAL);

Then, in a second process (proc2) I tried to access the semaphores with
'sem_id = semget(key,1,0);' No error occurs, even the shell command ipcs
shows the semaphore.

But, and that's the question the value of the semaphore is zero, although
it has been initialised with 1.  Could anybody explain this behaviour or
could show me a way to get rid of this problem.

Thanx!

   Gregor

P.S. If you can help me, please Re, or send  a mail to:
gregor at cip-s01.informatik.rwth-aachen.de



More information about the Comp.sys.sun mailing list