Re: g_spawn



Michael Meeks <michael ximian com> writes:
> 
> 	I was looking at g_spawn (as used by GConf AFAIR), and it seems to do
> some quite antisocial things ( like set FD_CLOEXEC on all file
> descriptors from 0 -> sysconf (_SC_OPEN_MAX), which in many cases is
> hundreds of (redundant and possibly incorrect) syscalls per spawn.
> 
> 	I hope we're not using that variant in gnome2-settings-daemon.
> 

There's a flag to turn that off, but it's certainly the safest thing
on average. We had several bugs caused by lack of this in GNOME 1
which is why gnome_execute_async did it.

If you aren't setting the flag to turn it off, you almost certainly
are not expecting the child to be inheriting any descriptors.  In fact
aside from pipes set up right before the fork, I can't think of cases
where people _do_ want descriptors inherited. (In essence UNIX should
have defaulted to FD_CLOEXEC for all new descriptors - oh well. In the
absence of that people should be manually setting it every time they
open a descriptor. But they are not generally doing so.)

Havoc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]