bug-gnulib
[Top][All Lists]
Advanced

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

Re: Introduce posix_spawn


From: Eric Blake
Subject: Re: Introduce posix_spawn
Date: Fri, 7 Sep 2018 13:59:02 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 09/07/2018 09:44 AM, Eric Blake wrote:
Adding gnulib:

On 09/06/2018 11:37 PM, Barath Aron wrote:
On 9/7/18 4:54 AM, Dale R. Worley wrote:
Couldn't you change the w.d. to the correct target, spawn, and then
change the w.d. back?
Yes, one could do this.

Although it gets prohibitively expensive in a multi-threaded process to ensure proper locking between all threads that might want to use posix_spawn, since fchdir() affects global process state.

Actually, this particular problem can be easily solved on Threos, because the posix_spawn() API offers a function for this: int posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t* __restrict file_actions, const char* __restrict path);

Note the "np" at the end, it means "non portable". I also found references on Oracle's webpage [1].

It's useful enough that we may want to add support for this in gnulib, whether or not other systems pick up on it.  (gnulib is already able to overcome a lot of shortcomings in various platforms' posix_spawn)

In fact, it's so useful that I just proposed that POSIX standardize it, as well as fchdir:

http://austingroupbugs.net/view.php?id=1208

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



reply via email to

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