[comp.unix.questions] initial value of semaphores

schmidt@indetech.com (Doug Schmidt) (07/01/90)

After a successful system call to

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

is the result of 

	semctl (sem_id, 0, GETVAL, 0);

guaranteed to be 0? (assuming there are no errors, etc.).  In otherwords,
what is the semval field of semaphores initialized to?  TFM doesn't 
seem to indicate this, and neither do Bach's or Rochkind's books.

	thanks,

		Doug
-- 
____*_  Douglas C. Schmidt          schmidt@indetech.com
\  / /  Independence Technologies   {sun,sharkey,pacbell}!indetech!schmidt
 \/ /   42705 Lawrence Place        FAX: 415 438-2034
  \/    Fremont, CA 94538           Voice: 415 438-2023

walter@mecky.UUCP (Walter Mecky) (07/08/90)

In article <1990Jun30.221024.2060@indetech.com> schmidt@indetech.UUCP (Doug Schmidt) writes:
+ After a successful system call to
+ 
+ 	sem_id = semget (SEMKEY, 1, 0777 | IPC_CREAT);
+ 
+ is the result of 
+ 
+ 	semctl (sem_id, 0, GETVAL, 0);
+ 
+ guaranteed to be 0? (assuming there are no errors, etc.).  In otherwords,
+ what is the semval field of semaphores initialized to?  TFM doesn't 
+ seem to indicate this, and neither do Bach's or Rochkind's books.

My FM seems to indicate this (it's SCO UNIX):

	  The data structure associated	with each semaphore in the set
	  is not initialized.  The function semctl with	the command
	  setval or setall can be used to initialize each semaphore.
-- 
Walter Mecky	[ walter@mecky	or  ...uunet!unido!mecky!walter ]