Linux Manual Pages development
 help / color / mirror / Atom feed
* Why does stat(2) say <unistd.h> is needed?
@ 2021-02-09 11:09 Jonathan Wakely
  2021-02-09 11:27 ` Alejandro Colomar (man-pages)
  2021-02-09 12:27 ` Michael Kerrisk (man-pages)
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Wakely @ 2021-02-09 11:09 UTC (permalink / raw)
  To: linux-man; +Cc: Michael Kerrisk, Alejandro Colomar

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-09 12:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2021-02-09 12:07     ` Alejandro Colomar (man-pages)
2021-02-09 12:27 ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox