LIBCx is the kLIBC extension library which provides some enhanced features to OS/2 kLIBC.
It provides its own waitpid() to support its spawn2(). Use it if possible. * lib/wait-process.c (klibc_waitpid) [kLIBC]: New function. (waitpid) [kLIBC]: Define it to klibc_waitpid. --- lib/wait-process.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/wait-process.c b/lib/wait-process.c index afb88ebe23..daddc932db 100644 --- a/lib/wait-process.c +++ b/lib/wait-process.c @@ -194,6 +194,33 @@ unregister_slave_subprocess (pid_t child) s->used = 0; } +#ifdef __KLIBC__ +# include <dlfcn.h> + +# undef waitpid + +static pid_t +klibc_waitpid (pid_t pid, int *statusp, int options) +{ + static pid_t (*waitpid_pfn) (pid_t, int *, int) = NULL; + + if (waitpid_pfn == NULL) + { + void *libcx_handle; + + libcx_handle = dlopen ("libcx0", RTLD_LAZY); + if (libcx_handle != NULL) + waitpid_pfn = dlsym (libcx_handle, "_waitpid"); + if (waitpid_pfn == NULL) + waitpid_pfn = waitpid; + } + + return waitpid_pfn (pid, statusp, options); +} + +# define waitpid klibc_waitpid +#endif + /* Wait for a subprocess to finish. Return its exit code. If it didn't terminate correctly, exit if exit_on_error is true, otherwise -- 2.42.0