git: 49ad342cc10c - main - Add _Fork()

Jessica Clarke jrtc27 at freebsd.org
Thu Sep 9 23:19:40 UTC 2021


On 3 Aug 2021, at 19:19, Konstantin Belousov <kib at FreeBSD.org> wrote:
> 
> The branch main has been updated by kib:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=49ad342cc10cba14b3a40ba26cf8bb2150e2925a
> 
> commit 49ad342cc10cba14b3a40ba26cf8bb2150e2925a
> Author:     Konstantin Belousov <kib at FreeBSD.org>
> AuthorDate: 2021-08-02 09:50:32 +0000
> Commit:     Konstantin Belousov <kib at FreeBSD.org>
> CommitDate: 2021-08-03 18:19:32 +0000
> 
>    Add _Fork()
> 
>    Current POSIX standard requires fork() to be async-signal safe.  Neither
>    our implementation, nor implementations in other operating systems are,
>    and practically it is impossible to make fork() async-signal safe without
>    too much efforts.  Also, that would put undue requirement that all atfork
>    handlers should be async-signal safe as well, which contradicts its main
>    use.
> 
>    As result, Austin Group dropped the requirement, and added a new function
>    _Fork() that should be async-signal safe, but it does not call atfork
>    handlers.  Basically, _Fork() can be implemented as a raw syscall.
> 
>    Release of glibc 2.34 added _Fork(), do the same for FreeBSD.
>    Clarify threading behavior for fork() in the manpage.
> 
>    Reviewed by:    markj
>    Sponsored by:   The FreeBSD Foundation
>    MFC after:      2 weeks
>    Differential revision:  https://reviews.freebsd.org/D31378

This breaks the build on case-insensitive filesystems like macOS has,
since _Fork.o for this C file and _fork.o for __sys_fork and _fork
conflict, leading to either build failures (because _fork.o gets
replaced and __sys_fork is undefined) or silently not including _Fork
(because _Fork.o gets replaced) in the library, with it being
non-deterministic based on whichever order the files happen to be built
in, and potentially varying between the three different libraries as
the .o, .pico and .nossppico files are independent.

Jess



More information about the dev-commits-src-all mailing list