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

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 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 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: posix_spawn_file_actions_addchdir

2018-09-07 Thread Bruno Haible
Eric Blake wrote: > > 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 t

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 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: posix_spawn_file_actions_addchdir

2018-09-07 Thread Eric Blake
On 09/07/2018 04:53 PM, Bruno Haible wrote: Implemented as follows. The prototype is as in [3], except that I dropped the suffix '_np', because - Functions with suffix '_np' are in the system's namespace, that is, there is no requirement that different systems implement them with the

Re: posix_spawn_file_actions_addchdir

2018-09-07 Thread Bruno Haible
Eric Blake wrote: > http://austingroupbugs.net/view.php?id=1208 > > There, I argue that we also need posix_spawn_file_actions_addfchdir(), > in part because it lets us get the same power as openat() in determining > how relative file names are resolved in relation to an fd. The use-case is, AFA