[PATCH] Cygwin: add _Fork() system call per POSIX.1-2024

Jon Turney jon.turney@dronecode.org.uk
Mon Mar 30 20:29:01 GMT 2026


On 30/03/2026 15:41, Corinna Vinschen wrote:
> From: Corinna Vinschen <corinna@vinschen.de>
> 
> The _Fork() function shall be equivalent to fork(), except that fork
> handlers established by means of the pthread_atfork() function shall
> not be called and _Fork() shall be async-signal-safe.  Our fork()
> already is async-signal-safe, so just make sure the pthread_atfork()
> handlers are not called.

Nice.

[...]
> diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
> index 48e8b7557d00..82ad3aaf0899 100644
> --- a/winsup/cygwin/fork.cc
> +++ b/winsup/cygwin/fork.cc
> @@ -31,7 +31,7 @@ details. */
>   /* FIXME: Once things stabilize, bump up to a few minutes.  */
>   #define FORK_WAIT_TIMEOUT (300 * 1000)     /* 300 seconds */
>   
> -static int dofork (void **proc, bool *with_forkables);
> +static int dofork (void **proc, bool is__Fork, bool *with_forkables);

This looks fine.

Maybe the new parameter should be named to indicate what extra step it 
enables, rather than what API we're executing? (So, like, 
do_atfork_handlers or something? Or maybe that's less clear)


If you have a STC you used to test this you want to share, maybe I can 
look at adding that to testsuite.



More information about the Cygwin-patches mailing list