Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <sawuky2aiv6qpeqcnimbljvpzjlk3vnpoebgmhfw5uszyx3g2d@rb2r3tbdstru>
Date: Fri, 13 Jun 2025 01:01:39 +0200
From: Alejandro Colomar <alx@...nel.org>
To: Rich Felker <dalias@...c.org>
Cc: "A. Wilcox" <AWilcox@...cox-tech.com>, musl@...ts.openwall.com, 
	linux-man@...r.kernel.org, libc-help@...rceware.org
Subject: Re: sys/prctl.h differences vs man page

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

Hi Rich,

On Thu, Jun 12, 2025 at 10:37:00PM +0200, Alejandro Colomar wrote:
> Hi Rich,
> 
> On Thu, Jun 12, 2025 at 12:38:48PM -0400, Rich Felker wrote:
> > On Thu, Jun 12, 2025 at 11:32:47AM -0500, A. Wilcox wrote:
> > > On Jun 12, 2025, at 11:26, Rich Felker <dalias@...c.org> wrote:
> > > > 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.
> 
> 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@...uan:~/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@...uan:~/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@...uan:~/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@...uan:~/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@...uan:~/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@...uan:~/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@...uan:~/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@...uan:~/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 <alx@...nel.org>
	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 <alx@...nel.org>

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@...uan:~/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@...uan:~/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@...uan:~/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@...uan:~/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 <alx@...nel.org>
	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 <alx@...nel.org>

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

-- 
<https://www.alejandro-colomar.es/>

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.