Skip to contentSkip to conversation

Document _Fork(3); update fork(2) for POSIX.1-2024

PATCH New Alejandro Colomar 1 participant 3 messages May 17, 2025 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

Alejandro Colomar

author maintainer
#0 lore raw

cover Document _Fork(3); update fork(2) for POSIX.1-2024

Hi!

I just realized about the existence of _Fork(). I've written a page documenting it, and updated the existing documentation about fork(2).

Please check.

Have a lovely day!
Alex

Alejandro Colomar (2):
man/man3/_Fork.3: Document _Fork()
man/: Update references to fork(2), and add references to _Fork(3),

    for POSIX.1-2024
 man/man2/fork.2          |  7 ++++++-
 man/man2/vfork.2         |  1 +
 man/man3/_Fork.3         | 29 +++++++++++++++++++++++++++++
 man/man7/signal-safety.7 | 14 +-------------
 4 files changed, 37 insertions(+), 14 deletions(-)
 create mode 100644 man/man3/_Fork.3

Range-diff against v0:

-:  --------- > 1:  a90d0f4c8 man/man3/_Fork.3: Document _Fork()
-:  --------- > 2:  2e5dd2415 man/: Update references to fork(2), and add references to _Fork(3), for POSIX.1-2024
Signature · 1 line
2.49.0
author maintainer
#1 lore raw

PATCH 1/2 man/man3/_Fork.3: Document _Fork()

---
 man/man3/_Fork.3 | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 man/man3/_Fork.3
man/man3/_Fork.3 new file +29 -0
new file mode 100644
index 000000000..95b0bc61b
@@ -0,0 +1,29 @@
+.\" Copyright, The authors of the Linux man-pages project
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH _Fork 3 (date) "Linux man-pages (unreleased)"
+.SH NAME
+_Fork \- create a child process
+.SH LIBRARY
+Standard C library
+.RI ( libc ,\~ \-lc )
+.SH SYNOPSIS
+.nf
+.B #include <unistd.h>
+.P
+.B pid_t _Fork(void);
+.fi
+.SH DESCRIPTION
+This function is equivalent to
+.BR fork (2),
+except that fork handlers registered with
+.BR pthread_atfork (3)
+are not called.
+.SH STANDARDS
+POSIX.1-2024.
+.SH HISTORY
+POSIX.1-2024.
+.SH SEE ALSO
+.BR fork (2),
+.BR vfork (2)
Signature · 1 line
2.49.0
author maintainer
#2 lore raw

PATCH 2/2 man/: Update references to fork(2), and add references to _Fork(3), for POSIX.1-2024

In reply to Alejandro Colomar
---
 man/man2/fork.2          |  7 ++++++-
 man/man2/vfork.2         |  1 +
 man/man7/signal-safety.7 | 14 +-------------
 3 files changed, 8 insertions(+), 14 deletions(-)
man/man2/fork.2 +6 -1
index b30c5af88..b70ec35b1 100644
@@ -270,8 +270,12 @@ .SS C library/kernel differences
 established using
 .BR pthread_atfork (3).
 .\" and does some magic to ensure that getpid(2) returns the right value.
+.SS Async-signal safety
+.BR _Fork (3)
+is an async-signal safe variant of
+.BR fork (2).
 .SH STANDARDS
-POSIX.1-2008.
+POSIX.1-2024.
 .SH HISTORY
 POSIX.1-2001, SVr4, 4.3BSD.
 .SH NOTES
@@ -332,6 +336,7 @@ .SH SEE ALSO
 .BR vfork (2),
 .BR wait (2),
 .BR daemon (3),
+.BR _Fork (3),
 .BR pthread_atfork (3),
 .BR capabilities (7),
 .BR credentials (7)
man/man2/vfork.2 +1 -0
index 868538612..5e5ef0458 100644
@@ -308,5 +308,6 @@ .SH SEE ALSO
 .BR execve (2),
 .BR _exit (2),
 .BR fork (2),
+.BR _Fork (2),
 .BR unshare (2),
 .BR wait (2)
man/man7/signal-safety.7 +1 -13
index 251a319f4..08563293a 100644
@@ -115,7 +115,7 @@ .SH DESCRIPTION
 \f[B]fdatasync\f[](2)
 \f[B]fexecve\f[](3)	Added in POSIX.1-2008
 \f[B]ffs\f[](3)	Added in POSIX.1-2008 TC2
-\f[B]fork\f[](2)	See notes below
+\f[B]_Fork\f[](3)
 \f[B]fstat\f[](2)
 \f[B]fstatat\f[](2)	Added in POSIX.1-2008
 \f[B]fsync\f[](2)
@@ -295,18 +295,6 @@ .SH DESCRIPTION
 .BR siglongjmp (3)
 and the program subsequently calls an unsafe function,
 then the behavior of the program is undefined.
-.IP \[bu]
-POSIX.1-2001 TC1 clarified
-that if an application calls
-.BR fork (2)
-from a signal handler and any of the fork handlers registered by
-.BR pthread_atfork (3)
-calls a function that is not async-signal-safe, the behavior is undefined.
-A future revision of the standard
-.\" http://www.opengroup.org/austin/aardvark/latest/xshbug3.txt
-is likely to remove
-.BR fork (2)
-from the list of async-signal-safe functions.
 .\"
 .IP \[bu]
 Asynchronous signal handlers that call functions which are cancelation
Signature · 1 line
2.49.0