[lsb-discuss] stat(), lstat() and fstat()

Craig.Scott at csiro.au Craig.Scott at csiro.au
Wed Jan 26 01:10:50 PST 2011

And LSB navigator doesn't even know about fstatat(), but does at least know about stat(), lstat() and fstat() - strange that the binary functions these forward to are in the LSB, but navigator claims that the macros stat(), lstat() and fstat() are not and never have been....

From: Scott, Craig (CMIS, Clayton)
Sent: Wednesday, 26 January 2011 8:08 PM
To: LSB mailing list
Subject: RE: stat(), lstat() and fstat()

Actually, the same situation exists for fstatat() as well:


Since there appears to be a family of these functions (there are also ...64 versions for large file support), so not sure how many others there will be as well.

From: Scott, Craig (CMIS, Clayton)
Sent: Wednesday, 26 January 2011 8:03 PM
To: LSB mailing list
Subject: stat(), lstat() and fstat()

I suspect these three function macros are missing from the LSB headers, but details are a bit hard to find. Here's a link to the relevant LSB page:


In particular, the last line says:

"stat(), lstat(), and fstat() are not in the binary standard; they are only in the source standard."

These three function macros should result in calls to the functions __xstat(), __lxstat() and __fxstat() respectively, all of which do have extern prototypes in the sys/stat.h headers for the LSB 4.1 packages (I'm using the ones that appeared in the LSB yum repo as of 21st Jan). It would seem to be an oversight not to provide the three stat(), lstat() and fstat() macros since without them, code would need to call  __stat() and friends which looks like it's not how these were meant to be used in source code. Or am I misunderstanding the way these are intended to be called?

For motivation, this is likely to appear as a problem in fixing an issue in the libarchive project, which is an upstream component of CMake.

Dr Craig Scott
Computational Software Engineering Team Leader, CSIRO (CMIS)
Melbourne, Australia

More information about the lsb-discuss mailing list