bug-gnulib
[Top][All Lists]
Advanced

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

posix_spawn[p]: implement for native Windows


From: Bruno Haible
Subject: posix_spawn[p]: implement for native Windows
Date: Thu, 24 Dec 2020 23:03:16 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

The attached patches implement posix_spawn and posix_spawnp for native
Windows.

To my knowledge, it's a world's first. While the posix_spawn facility
was designed to be portable to other operating systems [1], the mingw
people did not and do not provide it.

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html
    section "RATIONALE"


2020-12-24  Bruno Haible  <bruno@clisp.org>

        posix_spawn-internal: Implement for native Windows.
        * lib/spawni.c (grow_inheritable_handles, shrink_inheritable_handles,
        close_inheritable_handles, memiszero, sigisempty, open_handle, do_open,
        do_dup2, do_close): New functions.
        (__spawni): Implement on native Windows.
        * modules/posix_spawn-internal (Depends-on): Add filename,
        concat-filename, findprog-in, malloca, windows-spawn.
        * doc/posix-functions/posix_spawn.texi: Update.
        * doc/posix-functions/posix_spawnp.texi: Likewise.

2020-12-24  Bruno Haible  <bruno@clisp.org>

        windows-spawn: Export another auxiliary function.
        * lib/windows-spawn.h (convert_CreateProcess_error): New declaration.
        * lib/windows-spawn.c (convert_CreateProcess_error): New function,
        extracted from spawnpvech.
        (spawnpvech): Use it.

2020-12-24  Bruno Haible  <bruno@clisp.org>

        windows-spawn: Export some more auxiliary functions.
        * lib/windows-spawn.h: Include <stdbool.h>.
        (struct inheritable_handles): New type.
        (init_inheritable_handles, compose_handles_block,
        free_inheritable_handles): New declarations.
        * lib/windows-spawn.c (init_inheritable_handles, compose_handles_block):
        New functions, based on spawnvech.
        (free_inheritable_handles): New function.
        (spawnpvech): Use them.

2020-12-24  Bruno Haible  <bruno@clisp.org>

        windows-spawn: Export another auxiliary function.
        * lib/windows-spawn.h (compose_envblock): New declaration.
        * lib/windows-spawn.c (compose_envblock): New function, extracted from
        spawnpvech.
        (spawnpvech): Use it.

2020-12-24  Bruno Haible  <bruno@clisp.org>

        windows-spawn: Export an auxiliary function.
        * lib/windows-spawn.h (compose_command): New declaration.
        * lib/windows-spawn.c (compose_command): New function, extracted from
        spawnpvech.
        (spawnpvech): Use it.

2020-12-24  Bruno Haible  <bruno@clisp.org>

        posix_spawn* tests: Add support for native Windows.
        * tests/test-posix_spawn-open1.c (DATA_FILENAME): Treat native Windows
        like Cygwin.
        * tests/test-posix_spawn-dup2-stdin.c (main): Don't assume the signals
        SIGHUP and SIGPIPE. On native Windows, don't call
        posix_spawnattr_setsigmask.
        * tests/test-posix_spawn-dup2-stdout.c (main): Likewise.
        * tests/test-posix_spawn-fchdir.c (main): Likewise.
        * tests/test-posix_spawn-chdir.c (test): Likewise. Accept the child
        output from Cygwin's 'pwd' program.
        * tests/test-posix_spawn-script.c (main): On native Windows, skip the
        executable-shell-script part of the test.
        * tests/test-posix_spawnp-script.c (main): Likewise.
        * modules/posix_spawn-tests (Depends-on): Add freopen, waitpid.
        (configure.ac): Don't define the POSIX_SPAWN_PORTED conditional.
        (Makefile.am): Don't test the POSIX_SPAWN_PORTED conditional.
        * modules/posix_spawnp-tests (Depends-on): Add  waitpid.
        (configure.ac): Don't define the POSIX_SPAWN_PORTED conditional.
        (Makefile.am): Don't test the POSIX_SPAWN_PORTED conditional.
        * modules/posix_spawn_file_actions_addchdir-tests (Makefile.am): Don't
        test the POSIX_SPAWN_PORTED conditional.
        * modules/posix_spawn_file_actions_addfchdir-tests (configure.ac):
        Define the POSIX_SPAWN_PORTED conditional here.

2020-12-24  Bruno Haible  <bruno@clisp.org>

        sh-filename: Add support for native Windows.
        * m4/sh-filename.m4 (gl_SH_FILENAME): Treat native Windows like Cygwin.

Attachment: 0001-sh-filename-Add-support-for-native-Windows.patch
Description: Text Data

Attachment: 0002-posix_spawn-tests-Add-support-for-native-Windows.patch
Description: Text Data

Attachment: 0003-windows-spawn-Export-an-auxiliary-function.patch
Description: Text Data

Attachment: 0004-windows-spawn-Export-another-auxiliary-function.patch
Description: Text Data

Attachment: 0005-windows-spawn-Export-some-more-auxiliary-functions.patch
Description: Text Data

Attachment: 0006-windows-spawn-Export-another-auxiliary-function.patch
Description: Text Data

Attachment: 0007-posix_spawn-internal-Implement-for-native-Windows.patch
Description: Text Data


reply via email to

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