Message ID | 20180919044813.22875-1-liwang@redhat.com |
---|---|
State | Rejected |
Headers | show |
Series | statx: fix compile errors with glibc<2.28 | expand |
Hi! > glibc 2.28 has shipped with a wrapper for the statx() system call. > Currently the build is broken against it, because sys/stat.h suddenly > declares all the same types that lapi/stat.h does. Fix it by taking > the sys/stat.h ones if glibc>=2.28. > > include/lapi/stat.h:26:8: error: redefinition of ???struct statx_timestamp??? > include/lapi/stat.h:73:8: error: redefinition of ???struct statx??? What's wrong with the configure checks we do have? See m4/ltp-statx.m4: AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]]) AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]]) That should check exactly if these structures are defined and export the HAVE_STRUCT_* macros?
On Wed, Sep 19, 2018 at 3:48 PM, Cyril Hrubis <chrubis@suse.cz> wrote: > Hi! > > glibc 2.28 has shipped with a wrapper for the statx() system call. > > Currently the build is broken against it, because sys/stat.h suddenly > > declares all the same types that lapi/stat.h does. Fix it by taking > > the sys/stat.h ones if glibc>=2.28. > > > > include/lapi/stat.h:26:8: error: redefinition of ???struct > statx_timestamp??? > > include/lapi/stat.h:73:8: error: redefinition of ???struct statx??? > > What's wrong with the configure checks we do have? > > See m4/ltp-statx.m4: > > AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]]) > AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]]) > > That should check exactly if these structures are defined and export the > HAVE_STRUCT_* macros? > Confusing... It does not works for me. I checked the LTP "include/config.h" file after performing ./configure, the HAVE_STRUCT_* macros undefined. # cat include/config.h |grep -i statx /* Define to 1 if you have the `statx' function. */ #define HAVE_STATX 1 /* Define to 1 if the system has the type `struct statx'. */ /* #undef HAVE_STRUCT_STATX */ /* Define to 1 if the system has the type `struct statx_timestamp'. */ /* #undef HAVE_STRUCT_STATX_TIMESTAMP */ And I also confirmed the struct statx has been defined in "bits/statx.h" which was included by "sys/stat.h" on my platform(glibc>=2.28). # grep "struct statx" /usr/include/bits/statx.h struct statx_timestamp struct statx struct statx_timestamp stx_atime; struct statx_timestamp stx_btime; struct statx_timestamp stx_ctime; struct statx_timestamp stx_mtime; unsigned int __mask, struct statx *__restrict __buf)
Hi! > > > glibc 2.28 has shipped with a wrapper for the statx() system call. > > > Currently the build is broken against it, because sys/stat.h suddenly > > > declares all the same types that lapi/stat.h does. Fix it by taking > > > the sys/stat.h ones if glibc>=2.28. > > > > > > include/lapi/stat.h:26:8: error: redefinition of ???struct > > statx_timestamp??? > > > include/lapi/stat.h:73:8: error: redefinition of ???struct statx??? > > > > What's wrong with the configure checks we do have? > > > > See m4/ltp-statx.m4: > > > > AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]]) > > AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]]) > > > > That should check exactly if these structures are defined and export the > > HAVE_STRUCT_* macros? > > > Check the config.log somewhere there is a test program that failed the compilation that tests for the struct statx and struct statx_timestamp.
diff --git a/include/lapi/stat.h b/include/lapi/stat.h index 979e42d..7ba8618 100644 --- a/include/lapi/stat.h +++ b/include/lapi/stat.h @@ -20,7 +20,7 @@ * * __reserved is held in case we need a yet finer resolution. */ -#if defined(HAVE_STRUCT_STATX_TIMESTAMP) +#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28) #include <sys/stat.h> #else struct statx_timestamp { @@ -66,7 +66,7 @@ struct statx_timestamp { * will have values installed for compatibility purposes so that stat() and * co. can be emulated in userspace. */ -#if defined(HAVE_STRUCT_STATX) +#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28) #include <sys/stat.h> #else struct statx {