Subject: Porting moo to SVR3 - results

From: Doug Sewell <[email-masked]>
Date: Tue, 4 Feb 1992 14:50:20 -0800

In short, no go.

I covered the filename-length restriction, special includes for WIN/TCP,
variations on include names from BSD to SysV.

I built "unproto" to strip the prototypes out on-the-fly.  Worked well,
but I had to redefine const to null.   

Then I got to the "wait3" call.  No dice, doesn't appear to be any
easy way to do it based on my experience either.

Oh well... it was an interesting learning experience.
--
-- 
Doug Sewell, Tech Support, Computer Center, Youngstown State University
[email-masked] [email-masked] uunet!cc.ysu.edu!doug
cat core | uuencode bunny.dropping | mail [email-masked]

---

From: Pavel Curtis <pavel>
Date: Tue, 4 Feb 1992 17:38:16 -0800

> In short, no go.

Don't give up yet!

> easy way to do it based on my experience either.

I think there's a way.  I just spent some time tracking down some SVR3
documentation and found the following loophole, but I'm not able to test it,
since I don't have access to any SVR3 machines.

In SVR3, there is a signal named SIGCLD (or, maybe, the same as in BSD:
SIGCHLD; my sources were inconsistent).  It is raised in a parent process
whenever a child process terminates.  The default behavior is that it is
ignored by the parent process and the child process becomes a `zombie' process,
which must be wait()ed for in order to get cleared from the process table.

If you do signal(SIGCLD, SIG_IGN), this is *different* than the default.  As
before, the signal is ignored by the parent, but in this case the child *does
not* become a zombie; it just goes away.

Right now, I catch SIGCHLD with child_completed_signal(), which does the wait()
call.  The problem with using this strategy in SVR3 is that it's possible to
have more than one child terminate sufficiently simultaneously that the parent
sees only *one* signal.  On BSD or POSIX, I can simply use the NOHANG option to
wait3() or waitpid() to loop doing waits until there're no more children.

On SVR3, you could signal(SIGCLD, SIG_IGN) instead, and simply excise the
function child_completed_signal() completely, solving your problem.

	Pavel