Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Apr 2014 14:41:22 -0700
From:      Charles Swiger <cswiger@mac.com>
To:        Matthias Apitz <guru@unixarea.de>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: system(3) && open file descriptors
Message-ID:  <71BBF914-AA3A-4701-8395-0A5C49474948@mac.com>
In-Reply-To: <20140429184307.GA1114@tiny-r255948>
References:  <20140429184307.GA1114@tiny-r255948>

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

On Apr 29, 2014, at 11:43 AM, Matthias Apitz <guru@unixarea.de> wrote:
> It seems that the proc started by the C library call system(3), as
> /bin/sh -c string
> owns the same set of open file descriptors as its calling proc. Is this
> somewhere documented as a feature? 'man system" does not say anything
> about, while 'man fork' does.

At least my version of system(3) says that it invokes fork(2) and checks
the exit status of the shell via waitpid(2).  That plus listing fork(2)
in SEE ALSO section seems to be enough of a pointer to the detailed
behavior....

Regards,
-- 
-Chuck




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?71BBF914-AA3A-4701-8395-0A5C49474948>