Subject: Re: CVS commit: src/usr.sbin/rpc.lockd
To: None <>
From: Ben Harris <>
List: tech-userlevel
Date: 03/14/2003 15:32:12
In article <> you write:
>In article <>,
>YAMAMOTO Takashi <> wrote:
>>Module Name:	src
>>Committed By:	yamt
>>Date:		Fri Mar 14 13:53:08 UTC 2003
>>Modified Files:
>>	src/usr.sbin/rpc.lockd: lockd_lock.c
>>Log Message:
>>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                                                   <>
Portmaster, NetBSD/acorn26           <URL:>