On Fri, Nov 13, 2009 at 11:17 PM, Kevin Wolf <kw...@redhat.com> wrote: > We're leaking file descriptors to child processes. Set FD_CLOEXEC on file > descriptors that don't need to be passed to children to stop this > misbehaviour.
Since qemu is a multi threaded program, how about opening those file descriptors with the equivalent of O_CLOEXEC set to avoid the race condition when a fork comes between the 'open/socket/accept' operation and the 'fcntl'? We could create helper functions like 'qemu_socket_cloexec'. The implementation of qemu_socket_cloexec would use the new system calls and flags listed in: http://udrepper.livejournal.com/20407.html if available and fall back to separate 'open' and 'fcnt' operations when not building with a new enough glibc.