Subject: Re: CVS commit: src/usr.sbin/rpc.lockd
To: None <email@example.com>
From: Ben Harris <firstname.lastname@example.org>
Date: 03/14/2003 15:32:12
In article <HBqw4r.email@example.com> you write:
>In article <20030314135309.AB5CAB004@cvs.netbsd.org>,
>YAMAMOTO Takashi <firstname.lastname@example.org> wrote:
>>Module Name: src
>>Committed By: yamt
>>Date: Fri Mar 14 13:53:08 UTC 2003
>> src/usr.sbin/rpc.lockd: lockd_lock.c
>>for fork'ed children, use _exit instead of exit.
>Is there a reason for that change? Using _exit() avoids doing the
>stdio cleanup and the atexit calls. It is recommended for vfork()
>where the address space of the parent and the child are shared
>after the vfork() and before the exec(). There is no reason to do
>it for fork(), right?
If there's pending output in the stdio buffers before the fork, it'll end up
in the stdio buffers of both the parent and the child afterwards. Flushing
both is bad, so you usually only call exit() in the parent, and call _exit()
in the child. The same thing applies to most other things that exit() does
and _exit() doesn't.
Ben Harris <email@example.com>
Portmaster, NetBSD/acorn26 <URL:http://www.netbsd.org/Ports/acorn26/>