Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!uunet!mcsun!unido!mikros!mwtech!mecky!walter From: walter@mecky.UUCP (Walter Mecky) Newsgroups: comp.unix.i386 Subject: Re: wait() & negative values Message-ID: <754@mecky.UUCP> Date: 25 Aug 90 14:29:00 GMT References: <70400015@m.cs.uiuc.edu> Reply-To: walter@mecky.UUCP (Walter Mecky) Organization: MIKROS Systemware, Buettelborn/W-Germany Lines: 19 In article <70400015@m.cs.uiuc.edu> carroll@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 to access the parts of "loc". SCO-UNIX has them too. -- Walter Mecky [ walter@mecky.uucp or ...uunet!unido!mecky!walter ]