From: Jonathan Wakely <jwakely@redhat.com>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: linux-man@vger.kernel.org, Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: Why does stat(2) say <unistd.h> is needed?
Date: Tue, 9 Feb 2021 11:53:35 +0000 [thread overview]
Message-ID: <20210209115335.GB3008@redhat.com> (raw)
In-Reply-To: <6d13f96f-d42b-7748-21f2-da5e7c88345d@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]
On 09/02/21 12:27 +0100, Alejandro Colomar (man-pages) wrote:
>Hello Jonathan,
>
>On 2/9/21 12:09 PM, Jonathan Wakely wrote:
>>The stat(2) man page says:
>>
>>SYNOPSIS
>> #include <sys/types.h>
>> #include <sys/stat.h>
>> #include <unistd.h>
>>
>> int stat(const char *pathname, struct stat *statbuf);
>> int fstat(int fd, struct stat *statbuf);
>> int lstat(const char *pathname, struct stat *statbuf);
>>
>>But I don't see anything there that would require <unistd.h>. POSIX
>>doesn't require it (and since POSIX.1-2001 no longer requires
>><sys/types.h>, saying "Although <sys/types.h> was required for
>>conforming implementations of previous POSIX specifications, it was
>>not required for UNIX applications.")
>>
>>Is the inclusion of <unistd.h> there a mistake?
>>
>>I've been trying to track down why a libstdc++ header includes
>><unistd.h> for no apparent reason, and my best guess is that it's a
>>result of this man page saying to do it.
>>
>As far as we can tell, there's no reason to include it. See <https://lore.kernel.org/linux-man/97457bf2-2b29-af4b-c910-2391c69c4134@gmail.com/>.
>
>We haven't fixed it yet, because I'd like to fix all of the pages, and
>that's likely to take months (reading through every manual page in
>senctions 2 & 3, reading thorugh every included header, checking POSIX
>requirements, asking Michael if there may be historical reasons for a
>specific case, ...), but I'll do it some day.
>
>For now, if you submit a patch, I'll merge it.
Attached, thanks.
[-- Attachment #2: 0001-stat.2-Remove-unistd.h-from-synopsis.patch --]
[-- Type: text/plain, Size: 779 bytes --]
From d5b66a6b83302bd4070e3c83fb1dab341b76b728 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Tue, 9 Feb 2021 11:46:02 +0000
Subject: [PATCH] stat.2: Remove <unistd.h> from synopsis
There seems to be no reason <unistd.h> is shown here, so remove it.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
---
man2/stat.2 | 1 -
1 file changed, 1 deletion(-)
diff --git a/man2/stat.2 b/man2/stat.2
index 734c74b04..fed926715 100644
--- a/man2/stat.2
+++ b/man2/stat.2
@@ -43,7 +43,6 @@ stat, fstat, lstat, fstatat \- get file status
.nf
.B #include <sys/types.h>
.B #include <sys/stat.h>
-.B #include <unistd.h>
.PP
.BI "int stat(const char *" pathname ", struct stat *" statbuf );
.BI "int fstat(int " fd ", struct stat *" statbuf );
--
2.29.2
next prev parent reply other threads:[~2021-02-09 11:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 11:09 Why does stat(2) say <unistd.h> is needed? Jonathan Wakely
2021-02-09 11:27 ` Alejandro Colomar (man-pages)
2021-02-09 11:53 ` Jonathan Wakely [this message]
2021-02-09 12:07 ` Alejandro Colomar (man-pages)
2021-02-09 12:27 ` Michael Kerrisk (man-pages)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210209115335.GB3008@redhat.com \
--to=jwakely@redhat.com \
--cc=alx.manpages@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox