fjhenigman@watcgl.waterloo.edu (Frank J. Henigman) (05/25/89)
Can someone from SGI answer this? I scoured the documentation with no luck. Are semaphores created with semget(2) initialized to some value (like zero)? -- fjhenigman@watcgl.uwaterloo.ca Computer Graphics Lab fjhenigman@watcgl.waterloo.edu Frank J. Henigman University of Waterloo ...!watmath!watcgl!fjhenigman Waterloo, Ontario, Canada
jmb@patton.sgi.com (Jim Barton) (05/26/89)
In article <9893@watcgl.waterloo.edu>, fjhenigman@watcgl.waterloo.edu (Frank J. Henigman) writes: > Can someone from SGI answer this? I scoured the documentation with no luck. > Are semaphores created with semget(2) initialized to some value (like zero)? > -- > fjhenigman@watcgl.uwaterloo.ca Computer Graphics Lab > fjhenigman@watcgl.waterloo.edu Frank J. Henigman University of Waterloo > ...!watmath!watcgl!fjhenigman Waterloo, Ontario, Canada I perused sem.c (the semaphore code) and it appears that semaphores are not initialized each time they are allocated. The kernel uses a static area for the semaphores (thus those wonderful SEM* constants in master.d/kernel) and a chunk of them is allocated for each semget with no initialization. One could argue (rightly) that this is a bug (especially for a secure system), but this is what AT&T ships us. I'll turn in a bug report locally, so we remember to set them to something like zero. If you wish to write portable code, however, you should always assume that they are not initialized. -- Jim Barton Silicon Graphics Computer Systems "UNIX: Live Free Or Die!" jmb@sgi.sgi.com, sgi!jmb@decwrl.dec.com, ...{decwrl,sun}!sgi!jmb "I used to be disgusted, now I'm just amused." - Elvis Costello, 'Red Shoes' --