From owner-freebsd-current Thu May 2 0: 8:24 2002 Delivered-To: freebsd-current@freebsd.org Received: from relay1.macomnet.ru (relay1.macomnet.ru [195.128.64.10]) by hub.freebsd.org (Postfix) with ESMTP id 904BF37B419 for ; Thu, 2 May 2002 00:08:16 -0700 (PDT) Received: from news1.macomnet.ru (news1.macomnet.ru [195.128.64.14]) by relay1.macomnet.ru (8.11.6/8.11.6) with ESMTP id g4278DX11466897; Thu, 2 May 2002 11:08:13 +0400 (MSD) Date: Thu, 2 May 2002 11:08:13 +0400 (MSD) From: Maxim Konovalov To: Terry Lambert Cc: current@freebsd.org Subject: Re: newsyslog(8) should wait(2) for children In-Reply-To: <3CD0D898.A1A8B96D@mindspring.com> Message-ID: <20020502110414.T15883-100000@news1.macomnet.ru> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Terry, On 23:11-0700, May 1, 2002, Terry Lambert wrote: > Maxim Konovalov wrote: > > [ ... patch to wait for children, but do nothing with the result ... ] > > Yes. > > 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. 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. 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. -- 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