system(3) && open file descriptors

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


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


More information about the freebsd-questions mailing list