Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2002 14:48:02 +0400 (MSD)
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        current@freebsd.org
Subject:   Re: newsyslog(8) should wait(2) for children
Message-ID:  <20020502143234.C56711-100000@news1.macomnet.ru>
In-Reply-To: <3CD0F321.546D0694@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 01:04-0700, May 2, 2002, Terry Lambert wrote:
> Maxim Konovalov wrote:
> > > [ ... patch to wait for children, but do nothing with the result ... ]
> > >
> > > Why not just set the signal handler for the child process
> > > termination to "ignore", so that the child processes do
> > > not become zombied in the first place, so it's not ever
> > > necessary to do a useless loop whose only purpose is to
> > > reap zombies without examining their exit status?
> >
> > There are two purposes:
> >
> > a) reap zombies,
> > b) exit after all children have done only.
> >
> > In the current implementation newsyslog(8) forks and execs gzip(1) or
> > bzip2(1) and exits immediately. If a log file(s) is big enough the
> > compress_log() process(es) will work after newsyslog's death and there
> > is no clear way to get know when it(they)'s done.
>
> Your (a) is statisfied with either approach.
>
> I don't understand why you think (b) is a requirement.

Let's imagine:

# /usr/sbin/newsyslog && ./make_something_with_compressed_log

newsyslog exited but there are several compress_log() processes are
still running and make_something_with_compressed_log will get a
half-compressed logs.

> > OpenBSD:
> >
> > a) SIGCHLD signal handler: waitpid(2) loop, do not examine "status",
> > b) the same waitpid(2) loop before exit(2).
> >
> > I do not think we need a) at all. newsyslog forks/execs all his
> > children and enters into the reap loop like SIGCHLD signal handler
> > does.
>
> The point of this is to not reap until you have to; the default
> case will be no reaping necessary, so you are adding overhead
> unnecessarily by atttempting to reap non-existant children.

As you see, OpenBSD has (a) *and* (b).

> > NetBSD:
> >
> > a) waitpid(2) for a child right after fork/exec,
> > b) examine "status" and print an exit code.
> >
> > As you see, NetBSD newsyslog serializes fork/exec and there is only
> > one gzip process at the same moment. We can take this way but IMHO it
> > will be a POLA violation.

[ NetBSD approach arguments ]

> There are arguments for both approaches, but if you want to
> wait for the operation to complete, the OpenBSD approach is
> better than a reap-loop.

Again, OpenBSD has a reap loop.

[...]

--
Maxim Konovalov, MAcomnet, Internet Dept., system engineer
phone: +7 (095) 796-9079, mailto:maxim@macomnet.ru


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020502143234.C56711-100000>