[Top][All Lists]

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

Re: [Qemu-devel] [PATCH] Don't leak file descriptors

From: Scott Tsai
Subject: Re: [Qemu-devel] [PATCH] Don't leak file descriptors
Date: Fri, 13 Nov 2009 23:36:05 +0800

On Fri, Nov 13, 2009 at 11:17 PM, Kevin Wolf <address@hidden> 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:
if available and fall back to separate 'open' and 'fcnt' operations
when not building with a new enough glibc.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]