]> Savannah Git Hosting - gnulib.git/commit
posix_spawn-internal: Optimize DuplicateHandle calls on native Windows.
authorBruno Haible <bruno@clisp.org>
Sat, 10 Sep 2022 00:31:20 +0000 (02:31 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 10 Sep 2022 00:36:15 +0000 (02:36 +0200)
commit71b603702b8cf7977dedd5f6b71ea0ffc1669894
treeaf6a7fa56a0b702ba82438efdbc5abf3e9479909
parent36be0df632e8bc5ad7ccfe2745ed3254c95642d1
posix_spawn-internal: Optimize DuplicateHandle calls on native Windows.

* lib/windows-spawn.h (DELAYED_DUP2_OLDFD, DELAYED_DUP2_NEWFD): New
macros.
(struct IHANDLE): Add a linked_fd field.
* lib/spawni.c (SPAWN_INTERNAL_OPTIMIZE_DUPLICATEHANDLE): New macro.
(do_delayed_dup2, do_remaining_delayed_dup2): New functions.
(close_inheritable_handles): Don't close handles in DELAYED_DUP2_NEWFD
entries.
(do_close): Add a third parameter. Optimize delayed dup2 calls.
(do_open): Use do_close.
(do_dup2): Likewise. Prepare for optimizing the DuplicateHandle call.
(__spawni): Do the remaining delayed dup2 invocations after the loop
over the actions.
ChangeLog
lib/spawni.c
lib/windows-spawn.h