Qmail
[Top] [All Lists]

Re: tcpserver+recordio logging issue

To: qmail@list.cr.yp.to, mrd@alkemio.org
Subject: Re: tcpserver+recordio logging issue
From: "d tbsky" <tbskyd@gmail.com>
Date: Wed, 29 Nov 2006 18:21:36 +0800
Delivered-to: sp-com-lists@consult.net
Delivered-to: gmail-qmail@securepoint.com
Delivered-to: sp.com.list@gmail.com
Delivered-to: mailing list qmail@list.cr.yp.to
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Mk534Ib3lGc+nos3mNULK9sCVwpGToCI7u6hpiYNsNOIspZPKhmFSdb2OcTsmB5mZbVg78jPKnw8AtdWM/H4oHxuSktIVM2seWjILtYQURtC0j5wiQlFXm7AIUa0M4RjvCPVmEtJm/lSkcdJSBMdjb7Wh8HAK7qO1ixMQ9Q+dJc=
Domainkey-status: good (test mode)
In-reply-to: <20061128145926.GA32655@odin.dempsky.org>
Mailing-list: contact qmail-help@list.cr.yp.to; run by ezmlm
References: <49002b820611280512j344e63d7i57d9339faf778a11@mail.gmail.com> <20061128145926.GA32655@odin.dempsky.org>
hi:
  your code works great!!
  i try it to log about 6 hours. and every smtp-session is ending with
tcpserver message.
  thanks a lot for your help!!
 and a stupid question, your code compile cleanly in mandriva 2007
with gcc 4.1, but in old version(mandriva 2006 or 2005),it give errors below:
  sorry for my little understanding in c.

wait-recordio.c: In function `main':
wait-recordio.c:6: error: `pid_t' undeclared (first use in this function)
wait-recordio.c:6: error: (Each undeclared identifier is reported only once
wait-recordio.c:6: error: for each function it appears in.)
wait-recordio.c:6: error: syntax error before "pid"
wait-recordio.c:8: error: `pid' undeclared (first use in this function)

Regards,
tbskyd

2006/11/28, Matthew R. Dempsky <mrd@alkemio.org>:
 On Tue, Nov 28, 2006 at 09:12:00PM +0800, d tbsky wrote:
> but somtimes that message is not the last. like this:
> tcpserver: end 5165 status 256
> tcpserver: status: 5/40
> 5165 > 220 xxxxxxxxxxxxxxxx
> 5165 > [EOF]

Process 5165 wrote to stdout, exited, and was reaped by tcpserver
before recordio received a time slice.

> anyway i can make it  allways the last message?

You need to ensure that recordio exits before tcpserver's child
process exits.  Below is a quick blahwait program I threw together as
proof of concept; it forks and runs the passed program, waits for it
to return, then waits for one more process to exit (hopefully,
recordio) before returning itself.

You can then replace ``recordio foo...'' with ``recordio blahwait
foo...''.  (Patching recordio or writing your own replacement would
probably be more robust.)

#include <unistd.h>
#include <sys/wait.h>

int main(int argc,char *argv[])
{
  pid_t pid;
  int status;
  switch (pid = fork()) {
    case -1: return 111;
    case 0: execvp(argv[1],argv + 1); return 111;
  }
  close(0);
  close(1);
  waitpid(pid,&status,0);
  wait(0);
  if (!WIFEXITED(status)) return 111;
  return WEXITSTATUS(status);
}


<Prev in Thread] Current Thread [Next in Thread>