[PATCH] tests: Include linux/stat.h

Khem Raj raj.khem at gmail.com
Sun Aug 5 15:14:34 UTC 2018


On Sat, Aug 4, 2018 at 1:33 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
>
> On Sat, Aug 04, 2018 at 01:20:10PM -0700, Khem Raj wrote:
> > Starting with glibc 2.28, sys/stat.h header will have the
>
> s/will have/has/ as glibc 2.28 has already been released.
> In fact, starting with glibc commit glibc-2.28~105.
>

thats right, I will change the wording.

> > definition for struct statx, in which case including linux/stat.h should be
> > avoided, in order to prevent a duplicate definition.
>
> Why linux/stat.h should be avoided in the test?

it complains otherwise of duplicate definitions

> Have you tried the latest HEAD from strace.git?

I have been using 4.23 release not latest master

> In particular, what do you think about commit v4.23-37-g3dbffb7?

Can you point to exact commit on master?

>
> > Signed-off-by: Khem Raj <raj.khem at gmail.com>
> > ---
> >  tests-m32/statx.c  | 7 +++++++
> >  tests-mx32/statx.c | 8 +++++++-
> >  tests/statx.c      | 8 +++++++-
> >  3 files changed, 21 insertions(+), 2 deletions(-)
>
> tests-m32 and tests-mx32 are copies, no need to touch them.

OK

> In strace.git you can see that
> $ grep tests .gitignore
> /tests-m32
> /tests-mx32
> I wonder what kind of git repository are you working with?

I am using openembedded and strace in it is based out of release tarball

>
> > diff --git a/tests/statx.c b/tests/statx.c
> > index 816b7eb..e9f9993 100644
> > --- a/tests/statx.c
> > +++ b/tests/statx.c
> > @@ -30,7 +30,13 @@
> >
> >  #ifdef __NR_statx
> >
> > -# include <linux/stat.h>
> > +# if defined(__GLIBC__)
> > +#  if !__GLIBC_PREREQ(2,28)
>
> Are you absolutely sure that every glibc that provides __GLIBC__ macro
> also provides __GLIBC_PREREQ?  I bet __GLIBC_PREREQ is not for public use.
>

its part of /usr/include/feature.h and it does seem to not intended
for public use give the leading double underscores
I do see it being used in other packages e.g. boost, libstdc++,lttng etc.
however using this seemed a straight forward approach for such kind of
change, other option would be to do some
poking at headers in configure to assess where statx is defined and
then use that information to define the conditional


More information about the Strace-devel mailing list