Hi 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 do not know the reasons for it, but it has been there in the manual page since 1993, and the reasons are thus lost in the mists of the VCS and mailing list that the project did not have back then :-}. By now, I'm prepared to classify it as a mistake. Thanks, Michael > 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. > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/