[PATCH] Fix for [f]statfs64/[f]statfs aliasing patch
Steve Ellcey
sellcey@caviumnetworks.com
Wed Nov 23 18:21:00 GMT 2016
This patch is a fix to my earlier statfs patchÂ
(https://sourceware.org/ml/libc-alpha/2016-11/msg00360.html) that allowed
statfs/fstatfs to be aliases of statfs64/fstatfs64 but broke the alpha
build.  When doing this aliasing it is necessary that the prototypes of
[f]statfs not be seen because they differ from that of [f]statfs64.  They
have the same structures but different names, so GCC will complain when
doing the aliasing. My initial patch used a #define to hide the prototypes
of [f]statfs and __[f]statfs when defining [f]statfs64 but I hadn't noticed
that when __ASSUME_STATFS64 is 0, the [f]statfs64 function calls __[f]statfs
and if we have changed the name of this with a define then [f]statfs64 will
call the wrong (and undefined) function.  This only happens on alpha which is
the only platform where __ASSUME_STATFS64 is 0.
This patch fixes the problem by only hiding the [f]statfs definitions if
STATFS_IS_STATFS64 is set to non-zero, which is also the only time we do the
aliasing.  To do this I had to change the order of the includes because we
cannot check STATFS_IS_STATFS64 until after we have included kernel_stat.h
but we must do it before including sys/stat.h which is where the [f]statfs
prototypes are defined.
I have tested this and verified that it builds for alpha (using the
build-many-glibcs.py script) and also verified it builds and has no testsuite
regressions on x86 and aarch64.
OK to checkin?
Steve Ellcey
sellcey@caviumnetworks.com
2016-11-23  Steve Ellcey  <sellcey@caviumnetworks.com>
* sysdeps/unix/sysv/linux/fstatfs64.c: Reorder include files,
only alias fstatfs and __fstatfs if STATFS_IS_STATFS64 is non-zero.
* sysdeps/unix/sysv/linux/statfs64.c: Ditto for statfs and __statfs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: statfs-fix.patch
Type: text/x-patch
Size: 2160 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20161123/6b23e062/attachment.bin>
More information about the Libc-alpha
mailing list