system(3) && open file descriptors

Charles Swiger cswiger at mac.com
Tue Apr 29 21:41:30 UTC 2014


Hi--

On Apr 29, 2014, at 11:43 AM, Matthias Apitz <guru at 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



More information about the freebsd-questions mailing list