Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!petunia!news From: jdudeck@polyslo.CalPoly.EDU (John R. Dudeck) Newsgroups: comp.sys.hp Subject: About wait(2)... Message-ID: <281737c1.49d2@petunia.CalPoly.EDU> Date: 25 Apr 91 20:10:41 GMT Distribution: usa Organization: Cal Poly State Univ,CSC Dept,San Luis Obispo,CA 93407 Lines: 49 I am porting an application (the PP X.400 system) from bsd to HP/UX, on a system running HP/UX ver. 6.5B. The code includes three daemons. I am having problems that seem to be related to the wait(2) call. The original code defines a wait structure: struct wait w; then later on does a fork and a wait, etc, in the normal fashion. Then there is a line such as if (WIFEXITED(w)) return w.w_retcode; This does not compile under HP/UX, with an "operands of cast have incompatible types" error. The sys/wait.h file defines WIFEXITED using a cast of struct to int, as opposed to bsd which does not. So I changed the above line to if (WIFEXITED(w.w_status)) return w.w_retcode; which compiles ok. This same scenario exists 5 places in the package. Now I am at a point were different parts of the packgage crash with a Bus Error at certain points in the code. It doesn't crash in this code, but since this is the part I changed, I tend to suspect a problem here. I suspect that if the code returns the wrong status here, it could provoke a crash elsewhere in the system. Furthermore, the daemon isn't cleaning up its zombies like it should. There also are a couple of wait3() calls in the system, which I didn't make any changes to. In the man page for wait(2), there is a line which says: "The third parameter to wait3 is currently unused, and must always be a null pointer". In one place this is not null in my code. My questions are these: 1. Did I do something wrong in the changes I made? 2. Is there a difference in the way wait() works on HP/UX? 3. What happens if the third parameter to wait3 isn't a null pointer? -- John Dudeck "You can only push jdudeck@Polyslo.CalPoly.Edu simplicity so far." ESL: 62013975 Tel: 805-545-9549 -- AT&T promotional brochure