Re: Introduce posix_spawn

2018-09-10 Thread Eric Blake
On 09/08/2018 02:24 AM, Bernhard Voelker wrote: On 09/08/18 00:15, Eric Blake wrote: Adding posix_spawn_file_actions_addchdir() is what avoids the need to lock in the parent, because now you do: A thought WRT the naming: while ..._addopen() can be called for more file descriptors, there's only

Re: Introduce posix_spawn

2018-09-08 Thread Bernhard Voelker
On 09/08/18 00:15, Eric Blake wrote: > Adding posix_spawn_file_actions_addchdir() is what avoids the need to > lock in the parent, because now you do: A thought WRT the naming: while ..._addopen() can be called for more file descriptors, there's only one working directory for the spawned process.

Re: Introduce posix_spawn

2018-09-07 Thread Eric Blake
On 09/07/2018 05:06 PM, Bruno Haible wrote: Eric Blake wrote: Although it gets prohibitively expensive in a multi-threaded process to ensure proper locking between all threads that might want to use posix_spawn Why locking? posix_spawn uses fork() - the vfork() optimization is not possible in

Re: Introduce posix_spawn

2018-09-07 Thread Bruno Haible
Eric Blake wrote: > Although it gets prohibitively expensive in a multi-threaded process to > ensure proper locking between all threads that might want to use > posix_spawn Why locking? posix_spawn uses fork() - the vfork() optimization is not possible in the case when there are file actions -,

Re: Introduce posix_spawn

2018-09-07 Thread Eric Blake
On 09/07/2018 02:17 PM, Barath Aron wrote: 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 Good to hear, I'm looking forward to this. It seems you have a typo in it: > int posix_spawn_file_actions_addch

Re: Introduce posix_spawn

2018-09-07 Thread Barath Aron
On 9/7/18 8:59 PM, Eric Blake wrote: 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 thi

Re: Introduce posix_spawn

2018-09-07 Thread Eric Blake
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 expen

Re: Introduce posix_spawn

2018-09-07 Thread Eric Blake
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. Alternatively, one could direct the spawned process to run a program that would