semget(2) - value of newly created semaphores?

Johannes Sjogren sgren at dynas.se
Thu Oct 18 09:00:25 AEST 1990


I have a question about the behaviour of the semget(2) system call.

If I do

	semid = semget(SEMKEY, 1, 0777|IPC_CREAT);

and a new semaphore is created, is the value  of a newly created
semaphore guaranteed to be initialized to 0?

On DG/UX 4.30 the manual page for semget says this is the case.
On most other systems however the manual page says the value is undefined.
Is there any reason why the semaphore value shouldn't be reset to 0 
on creation? 
Maybe the (I suppose) system V derived "normal" manual pages are wrong?

-- 
  Johannes Sjogren				sgren at dynas.se
  DynaSoft, Dynamic Software AB			Phone: +46-8-726 85 60
  Liljeholmsv 10, S-117 43 STOCKHOLM, SWEDEN	Fax: +46-8-18 11 45



More information about the Comp.unix.programmer mailing list