Re: g_spawn



Michael Meeks <michael ximian com> writes:
> On Sat, 2002-03-23 at 16:05, Havoc Pennington wrote:
> > 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.
> 
> 	Well - fair enough; but it's ~1000 syscalls per exec, which seems a
> fairly high cost to pay (to me), especially in gnome-session which AFAIK
> tends to just sit there forking / execing things. It doesn't seem
> particularly impossible to get gnome-session to set the options on the
> few descriptors it keeps open, but perhaps I'm mistaken ?
> 

If someone goes through and does the work to be sure gnome-session
sets cloexec on its extra descriptors (e.g. the libICE connection),
then sure, you then pass G_SPAWN_DO_NOT_CLOSE_DESCRIPTORS or whatever
it's called to g_spawn_, inside gnome-session.

The point is, if you've thought about this problem then you can easily
make g_spawn do the efficient thing, but if you haven't thought about
it then g_spawn defaults to something safe. Think of
G_SPAWN_DO_NOT_CLOSE_DESCRIPTORS as
G_SPAWN_YES_I_UNDERSTAND_THIS_ISSUE_AND_FIXED_MY_CODE.

Havoc



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