dbus-sysdeps-unix.h

Havoc Pennington hp at redhat.com
Wed Sep 13 06:53:53 PDT 2006


Thiago Macieira wrote:
> 
> On Unix, it's used for anything file descriptor. On D-Bus, I think we use 
> it for pipes only.
> 

Essentially all fd's need to be close on exec (it should have been the 
default really) or when you fork/exec you get a bunch of fd leaks.

The glib g_spawn_ functions have an option to do this for you:
  for (i = 3; i < max_fds; ++i) {
     set_close_on_exec(i); /* ignore errors, most of these numbers are
                              not valid fds obviously */
  }

since dbus sets everything close on exec on creation, it doesn't have to 
do this gross hack though.

I think set_close_on_exec could be a no-op on windows ? depends on how 
dbus-spawn.c is replaced on windows.

Havoc



More information about the dbus mailing list