On Wed, Apr 18, 2001 at 11:43:40PM +0200, Peter van Dijk wrote:
> On Wed, Apr 18, 2001 at 11:40:38PM +0200, Markus Stumpf wrote:
> > On Wed, Apr 18, 2001 at 02:28:10PM -0700, Michael Werneke wrote:
> > > Apr 17 18:36:05 alpha pop3d: 987557765.365642 tcpserver: end 2010 status 256
> > This is no abnormal termination.
> status 256 is abnormal.

Aehm ...
qmail-pop3d: 987544742.033581 tcpserver: end 65447 status 256

ALL my tcpservers that handle pop3 conns exit like that. They work
fine and without problems for years ...

Startup via:
exec /usr/local/bin/tcpserver -R -v -c 150              \
        -l popmail.space.net                            \
        195.30.0.14 pop3                                \
        /var/qmail/bin/qmail-popup popmail.space.net    \
        /var/qmail/contrib/checkpassword                \
        /var/qmail/bin/qmail-pop3d Maildir 2>&1         \
        | /var/qmail/bin/splogger qmail-pop3d 17 &

Unmodified qmail-1.03.
Unmodified ucspi-tcp-0.88
FreeBSD 4.2-RELEASE

I have digged through the code, manpages and include files.
Anyone not interested in C code may press 'd' now ;-)


I think the "256" is due to the fact that  qmail-popup does:
  switch(child = fork()) {
    case -1:
      die_fork();
    case 0:
      close(pi[1]);
      sig_pipedefault();
      execvp(*childargs,childargs);
      _exit(1);
  }

And also the die() in qmail-popup.c does an _exit(1).

So I'd say that qmail-popup *always* exits with a value of 1 which
maps to a code 256 returned via status by waitpid() (at least on my
system).
Of course unless it receives some signal.

tcpserver.c:
   while ((pid = wait_nohang(&wstat)) > 0) {

wait_nohang.c:
   return waitpid(-1,wstat,WNOHANG);

from the manpage to waitpid()

pid_t
waitpid(pid_t wpid, int *status, int options)

WIFEXITED(status)
    True if the process terminated normally by a call to _exit(2) or
    exit(3).
WEXITSTATUS(status)
    If WIFEXITED(status) is true, evaluates to the low-order 8 bits
    of the argument passed to _exit(2) or exit(3) by the child.

from /usr/include/sys/wait.h
#define _W_INT(i)       (i)
#define _WSTATUS(x)     (_W_INT(x) & 0177)
#define WIFEXITED(x)    (_WSTATUS(x) == 0)
#define WEXITSTATUS(x)  (_W_INT(x) >> 8)

So, status 256 would have a WIFEXITED() of true and WEXITSTATUS() should
be "1".

        \Maex

-- 
SpaceNet AG            | Joseph-Dollinger-Bogen 14 | Fon: +49 (89) 32356-0
Research & Development |       D-80807 Muenchen    | Fax: +49 (89) 32356-299
Stress is when you wake up screaming and you realize you haven't fallen
asleep yet.

Reply via email to