[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: posix_spawn_file_actions_addchdir
From: |
Bruno Haible |
Subject: |
Re: posix_spawn_file_actions_addchdir |
Date: |
Fri, 07 Sep 2018 23:53:35 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-134-generic; KDE/5.18.0; x86_64; ; ) |
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 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)
I agree. It is useful
1) for findutils, as explained [1],
2) for Java implementations [2],
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
same semantics or same prototype.
- Gnulib has fewer backward compatibility requirements, in case we need
to change the prototype in order to conform to some future POSIX standard.
Note: In the source code, you can switch to use posix_spawn instead of fork(),
but that does not provide portability to native Windows, because gnulib does
not implement posix_spawn for native Windows so far. But the new API will not
cause problems, since the native Windows CreateProcess() function supports
providing a directory [4].
Note: There was already some proposed experimental support in glibc [5].
Bruno
[1] https://lists.gnu.org/archive/html/bug-findutils/2018-09/msg00002.html
[2] https://docs.oracle.com/cd/E53394_01/html/E54847/golbg.html
[3]
https://docs.oracle.com/cd/E86824_01/html/E54766/posix-spawn-file-actions-addchdir-np-3c.html
[4]
https://docs.microsoft.com/en-us/windows/desktop/api/processthreadsapi/nf-processthreadsapi-createprocessw
[5] https://sourceware.org/ml/libc-alpha/2010-08/msg00109.html
0001-posix_spawn_file_actions_addchdir-New-module.patch
Description: Text Data
0002-posix_spawn_file_actions_addchdir-Add-tests.patch
Description: Text Data
Re: posix_spawn_file_actions_addchdir,
Bruno Haible <=