Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: How to get Status of processes in C environment Message-ID: <26503@mimsy.umd.edu> Date: 12 Sep 90 07:30:38 GMT References: <25467.26e7ac6a@kuhub.cc.ukans.edu> <4049@auspex.auspex.com> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 23 In article <4049@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes: >If you just ignore "union wait" (and the "lint" complaints that doing so >will give you), and treat the "status" argument to "wait()" as an "int >*", even on BSD systems, your code will still work (unless the >implementor of your UNIX system screwed up badly), but will be more >portable and won't be polluted with #ifdefs. Right. Note, in 4.3BSD-reno the argument to wait (and wait3) has been changed back to `int *'. The W* macros in operate on `int' lvalues (and continue to work on `union wait's by the bletcherous hack of defining the W* macros as, e.g., #define _W_INT(w) (*(int *)&(w)) #define WEXITSTATUS(x) (_W_INT(x) >> 8) The funny _W_INT definition WILL GO AWAY someday, along with `union wait'.) If compiling with the (semi-nonexistent) `POSIX compiler', the W* macros operate on int expressions (because _W_INT(w) is defined is (w)). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 405 2750) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris