Are semaphores initialized?
Jim Barton
jmb at patton.sgi.com
Fri May 26 08:16:07 AEST 1989
In article <9893 at watcgl.waterloo.edu>, fjhenigman at 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 at watcgl.uwaterloo.ca Computer Graphics Lab
> fjhenigman at 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 at sgi.sgi.com, sgi!jmb at decwrl.dec.com, ...{decwrl,sun}!sgi!jmb
"I used to be disgusted, now I'm just amused."
- Elvis Costello, 'Red Shoes'
--
More information about the Comp.sys.sgi
mailing list