Skip to contentSkip to conversation

sys/prctl.h differences vs man page

musl Alejandro Colomar 1 participant 1 message Jun 12, 2025 6 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAJgzZoou1wBNK8qHAheR7_haHf1njaTgRZwXnPGX+19qUAbwLg@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): plmtyslnimcvytuclnm4pqdhdz5tsdjwwgjkflxodjrzumgeh5@3wldhlt4pysu

Alejandro Colomar

author maintainer
#6 lore raw

[CC += linux-man@, libc-help@]

Hi Rich,

Quoted 15 lines · Alejandro Colomar

Hi Rich,

Quoted 11 lines · Rich Felker
Quoted 8 lines · A. Wilcox
Quoted 5 lines · Rich Felker

I don't see where it's documented that one should include <linux/prctl.h> to use the prctl API. It's not in my copy of the man page.

Rich

https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man/man2/prctl.2?id=ae31bd15b65ce03a143860e8f4daa99fcd5125a4

CC'ing commit author on this breakage.

Quoted 7 lines

I'd say I only changed the formatting of the information, but the manual page already claimed you should include both <sys/prctl.h> and <linux/prctl.h>; it just dit it in a weird way.

So, should we consider <sys/prctl.h> to be the provider of PR_* constants? I'd be happy to update the manual page, but libc maintainers should state what is the official header for the PR_* constants.

Here's some research about the history of this manual page:

	alx@devuan:~/src/linux/man-pages/man-pages/master$ git blame -- man/man2/prctl.2 | grep 'linux/prctl.h'
	ae31bd15b6 man/man2/prctl.2 (Alejandro Colomar 2024-05-31 21:47:29 +0200  15) .BR "#include <linux/prctl.h>" "  /* Definition of " PR_* " constants */"
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git show ae31bd15b6 -- man/man2/prctl.2 | grep -e ^diff -e linux/prctl.h | grep -v -B1 ^d
	    prctl.2, PR_*.2const: SYNOPSIS: #include <linux/prctl.h> for the PR_* constants
	diff --git a/man/man2/prctl.2 b/man/man2/prctl.2
	+.BR "#include <linux/prctl.h>" "  /* Definition of " PR_* " constants */"
	-(with values defined in \fI<linux/prctl.h>\fP), and further
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git blame ae31bd15b6^ -- man/man2/prctl.2 | grep 'linux/prctl.h'
	1a329b567a man2/prctl.2     (Michael Kerrisk   2007-12-10 07:16:56 +0000  35) (with values defined in \fI<linux/prctl.h>\fP), and further
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git show 1a329b567a -- man2/prctl.2 | grep -e ^diff -e linux/prctl.h | grep -v -B1 ^d
	diff --git a/man2/prctl.2 b/man2/prctl.2
	-(with values defined in <\fIlinux/prctl.h\fP>), and further
	+(with values defined in \fI<linux/prctl.h>\fP), and further
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git blame 1a329b567a^ -- man2/prctl.2 | grep 'linux/prctl.h'
	^fea681daf (Michael Kerrisk 2004-11-03 13:51:07 +0000  50) (with values defined in <\fIlinux/prctl.h\fP>), and further
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git blame korg/prehistory -- man2/prctl.2 | grep 'linux/prctl.h'
	3b676b1346 (Krónos          1998-04-19 23:53:00 +0200  44) (with values defined in <\fIlinux/prctl.h\fP>), and further
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git show 3b676b1346 -- man2/prctl.2 | grep -e ^diff -e linux/prctl.h | grep -v -B1 ^d
	diff --git a/man2/prctl.2 b/man2/prctl.2
	+.B #include <linux/prctl.h>
	+(with values defined in <\fIlinux/prctl.h\fP>), and further
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git log --pretty=fuller -1 3b676b1346 | head
	commit 3b676b1346f336fd0e9841365689f2dde1dff528
	Author:     Krónos <Krónos@Sāturnus>
	AuthorDate: Sun Apr 19 23:53:00 1998 +0200
	Commit:     Alejandro Colomar <[email protected]>
	CommitDate: Mon Dec 19 21:01:33 2022 +0100
	    man-pages 1.19
	    
	    Link: <https://www.win.tue.nl/~aeb/ftpdocs/linux-local/manpages.archive/>
	    Signed-off-by: Alejandro Colomar <[email protected]>

In man-pages-1.19, the text saying that <linux/prctl.h> provides PR_* was added. It also included the header in the SYNOPSIS.

	alx@devuan:~/src/linux/man-pages/man-pages/master$ git blame -- man/man2/prctl.2 | grep 'sys/prctl.h'
	^fea681daf man2/prctl.2     (Michael Kerrisk   2004-11-03 13:51:07 +0000  16) .B #include <sys/prctl.h>
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git blame korg/prehistory -- man2/prctl.2 | grep 'sys/prctl.h'
	1205550985 (Krónos          2000-03-06 01:54:00 +0100  37) .B #include <sys/prctl.h>
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git show 1205550985 -- man2/prctl.2 | grep -e ^diff -e /prctl.h | grep -v -B1 ^d
	diff --git a/man2/prctl.2 b/man2/prctl.2
	-.B #include <linux/prctl.h>
	+.B #include <sys/prctl.h>
	alx@devuan:~/src/linux/man-pages/man-pages/master$ git log --pretty=fuller -1 1205550985 | head
	commit 1205550985885436f2554b2ed38c6c565118c979
	Author:     Krónos <Krónos@Sāturnus>
	AuthorDate: Mon Mar 6 01:54:00 2000 +0100
	Commit:     Alejandro Colomar <[email protected]>
	CommitDate: Mon Dec 19 21:01:34 2022 +0100
	    man-pages 1.29
	    
	    Link: <https://www.win.tue.nl/~aeb/ftpdocs/linux-local/manpages.archive/>
	    Signed-off-by: Alejandro Colomar <[email protected]>

In man-pages-1.29, the SYNOPSIS was updated to show <sys/prctl.h>, but the text within the DESCRIPTION saying that <linux/prctl.h> was the provider of these macros wasn't removed.

I don't know if it should have been removed back then and they forgot, or if something has changed in the meantime and nobody documented it.

Please suggest what changes should be applied to the manual page.

Have a lovely night!
Alex

Signature · 1 line
<https://www.alejandro-colomar.es/>