You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by James Ponder <ja...@squish.net> on 2002/11/25 00:03:13 UTC

other_child maintenance status

The maintenance function for "other" children has the prototype:
  void (*maintenance)(int reason, void *, int status)

however mod_cgid defines status differently (although apr_wait_t = int):
  static void cgid_maint(int reason, void *data, apr_wait_t status)

What is status?  Unless I'm completely wrong (which is always possible!), it
can be one of two things:

* The mpm's call ap_wait_or_timeout, which returns (via apr_proc_wait) an exit
  reason (APR_PROC_EXIT/APR_PROC_SIGNAL) and an exit code (actually exit code
  or signal code), and passes the exit code to apr_proc_other_child_read as
  the status parameter (which is then passed to the maintenance function).

This means the maintenance function gets the exit code or the signal code
as the status with no way of detecting which is which.

* However, on the other hand, apr_proc_other_child_check() calls waitpid() and
  passes the returned wait-style status to the maintenance function.  This
  means the maintenance function can call the standard Wxxxxx macros to decide
  what that meant.

This means the maintenance function gets the exit code in the top 8 bits,
the signal in the bottom 8 bits, etc. as per the wait() call.

The simplest solution would be to standarise on wait-style status, but how can
the mpm's get that back without calculating it from the apr-style status, which
seems a kludge?  It seems much better to standardise on the apr-style status,
but that seems impossible without breaking compat as an additional apr "why"
code needs to be passed to the maintenance functions.


Best wishes, James
-- 
James Ponder; www.squish.net; London, UK