wait() & negative values
Walter Mecky
walter at mecky.UUCP
Sun Aug 26 00:29:00 AEST 1990
In article <70400015 at m.cs.uiuc.edu> carroll at m.cs.uiuc.edu writes:
<
< I've
< recently tracked at least some of the crashes down to the fact that wait(loc)
< sometimes returns negative values in *loc, e.g. 0xFFFFxxyy where xx and yy
< are the values you'd normally expect in the bottom 16 bits of the return value.
< TFM specifies the contents of the bottom 16 bits of *loc, but says absolutely
< nothing about the top 16 bits.
As others noted, only the bottom 16 bits are defined and it's possible,
that the high order bit is propagated. I had to learn hard, that wait(2)
is indeed giving an int some years ago. I thought "He gives me 16
bits, so a short is enough", defined the "loc" variable as short
and had a hard time to find the mysterious changing of another variable ...
BTW: X/OPEN and Posix defined macros in <sys/wait> to access the parts
of "loc". SCO-UNIX has them too.
--
Walter Mecky [ walter at mecky.uucp or ...uunet!unido!mecky!walter ]
More information about the Comp.unix.i386
mailing list