Linux Manual Pages development
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: linux-man@vger.kernel.org
Cc: Michael Kerrisk <mtk.manpages@gmail.com>,
	Alejandro Colomar <alx.manpages@gmail.com>
Subject: Why does stat(2) say <unistd.h> is needed?
Date: Tue, 9 Feb 2021 11:09:12 +0000	[thread overview]
Message-ID: <20210209110912.GX3008@redhat.com> (raw)

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.


             reply	other threads:[~2021-02-09 11:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 11:09 Jonathan Wakely [this message]
2021-02-09 11:27 ` Why does stat(2) say <unistd.h> is needed? Alejandro Colomar (man-pages)
2021-02-09 11:53   ` Jonathan Wakely
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=20210209110912.GX3008@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