* [LTP] [PATCH] statx: fix compile errors with glibc<2.28
@ 2018-09-19 4:48 Li Wang
2018-09-19 7:48 ` Cyril Hrubis
2018-09-26 14:15 ` [LTP] [PATCH v2] statx: fix compile errors Thadeu Lima de Souza Cascardo
0 siblings, 2 replies; 6+ messages in thread
From: Li Wang @ 2018-09-19 4:48 UTC (permalink / raw)
To: ltp
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’
---
include/lapi/stat.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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 {
--
2.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH] statx: fix compile errors with glibc<2.28
2018-09-19 4:48 [LTP] [PATCH] statx: fix compile errors with glibc<2.28 Li Wang
@ 2018-09-19 7:48 ` Cyril Hrubis
2018-09-19 9:44 ` Li Wang
2018-09-26 14:15 ` [LTP] [PATCH v2] statx: fix compile errors Thadeu Lima de Souza Cascardo
1 sibling, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2018-09-19 7:48 UTC (permalink / raw)
To: ltp
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?
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH] statx: fix compile errors with glibc<2.28
2018-09-19 7:48 ` Cyril Hrubis
@ 2018-09-19 9:44 ` Li Wang
2018-09-19 11:40 ` Cyril Hrubis
0 siblings, 1 reply; 6+ messages in thread
From: Li Wang @ 2018-09-19 9:44 UTC (permalink / raw)
To: ltp
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)
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20180919/37a50c7f/attachment.html>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH] statx: fix compile errors with glibc<2.28
2018-09-19 9:44 ` Li Wang
@ 2018-09-19 11:40 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2018-09-19 11:40 UTC (permalink / raw)
To: ltp
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.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2] statx: fix compile errors
2018-09-19 4:48 [LTP] [PATCH] statx: fix compile errors with glibc<2.28 Li Wang
2018-09-19 7:48 ` Cyril Hrubis
@ 2018-09-26 14:15 ` Thadeu Lima de Souza Cascardo
2018-09-26 14:48 ` Cyril Hrubis
1 sibling, 1 reply; 6+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2018-09-26 14:15 UTC (permalink / raw)
To: ltp
struct statx is only defined in sys/stat.h when _GNU_SOURCE is defined.
The testcases do define _GNU_SOURCE, but not the m4 struct check.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
m4/ltp-statx.m4 | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/m4/ltp-statx.m4 b/m4/ltp-statx.m4
index 44303d3..5f79a94 100644
--- a/m4/ltp-statx.m4
+++ b/m4/ltp-statx.m4
@@ -23,6 +23,11 @@ dnl
AC_DEFUN([LTP_CHECK_STATX],[
AC_CHECK_FUNCS(statx,,,[[#include <sys/stat.h>]])
AC_CHECK_HEADER(linux/fs.h,,,)
-AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]])
-AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]])
+AC_CHECK_TYPES([struct statx],,,[[
+ #define _GNU_SOURCE
+ #include <sys/stat.h>
+]])
+AC_CHECK_TYPES([struct statx_timestamp],,,[[
+ #define _GNU_SOURCE
+ #include <sys/stat.h>]])
])
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v2] statx: fix compile errors
2018-09-26 14:15 ` [LTP] [PATCH v2] statx: fix compile errors Thadeu Lima de Souza Cascardo
@ 2018-09-26 14:48 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2018-09-26 14:48 UTC (permalink / raw)
To: ltp
Hi!
> struct statx is only defined in sys/stat.h when _GNU_SOURCE is defined.
> The testcases do define _GNU_SOURCE, but not the m4 struct check.
Ah, that is the missing bit, good catch, applied.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-09-26 14:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 4:48 [LTP] [PATCH] statx: fix compile errors with glibc<2.28 Li Wang
2018-09-19 7:48 ` Cyril Hrubis
2018-09-19 9:44 ` Li Wang
2018-09-19 11:40 ` Cyril Hrubis
2018-09-26 14:15 ` [LTP] [PATCH v2] statx: fix compile errors Thadeu Lima de Souza Cascardo
2018-09-26 14:48 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.