Re: pthread - system() blocking
Re: pthread - system() blocking
- Subject: Re: pthread - system() blocking
- From: Chris Suter <email@hidden>
- Date: Tue, 01 Mar 2011 20:54:47 +1100
Hi Greg,
On Tue, Mar 1, 2011 at 8:47 PM, Greg Parker <email@hidden> wrote:
> No.
> The problem is that there's no "close all but these" file action for
> posix_spawn(). There's no safe way for posix_spawn() to create a child
> process with all descriptors closed except a known set like stdin/out/err.
> You cannot safely use posix_spawn_file_actions_addclose() for every open
> descriptor in the parent, because other threads in the parent may be
> concurrently opening and closing those descriptors between the time you set
> up the file actions and the time you call posix_spawn().
But what if you added a close action for all possible file descriptors
except for stdin, stdout & stderr? i.e. looped over all 1024 (or
however many) file descriptors except for those three?
And how exactly would you close file descriptors between the fork and
exec? How do you know what file descriptors to close?
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden