[LTP] [PATCH 1/2] lapi/fs: Include lapi/fcntl.h + define _GNU_SOURCE
Petr Vorel
pvorel@suse.cz
Thu Apr 25 17:38:46 CEST 2024
Hi Jan, all,
...
> > OK, this will work, just lapi/fs.h must be loaded before tst_test.h,
> > othewise it would fail on Alpine:
> So this is essentially:
> ------------------------------------------
> #include <fcntl.h> // from tst_test.h include chain
> #define _GNU_SOURCE // from lapi/fs.h
> #include <fcntl.h>
> int main(void)
> {
> loff_t asd;
> return 0;
> }
> ------------------------------------------
> and it doesn't compile. And same applies if you include first any of
> these first:
> include/lapi/fcntl.h:#include <fcntl.h>
> include/lapi/io_uring.h:#include <fcntl.h>
> include/lapi/pidfd.h:#include <fcntl.h>
> include/safe_macros_fn.h:#include <fcntl.h>
> include/tst_safe_macros.h:#include <fcntl.h>
> Do we really need for tst_max_lfs_filesize() to return loff_t? If we
> changed it to "long long",
> we'd avoid lot of issues with includes and _GNU_SOURCE for just single
> user of this function.
+1. We might get extra warning when there is 32 bit, but it would make things
much easier => I'll send another version.
Kind regards,
Petr
> > In file included from unlink09.c:20:
> > ../../../../include/lapi/fs.h:61:15: error: unknown type name 'loff_t'
> > 61 | static inline loff_t tst_max_lfs_filesize(void)
> > | ^~~~~~
> > ../../../../include/lapi/fs.h: In function 'tst_max_lfs_filesize':
> > ../../../../include/lapi/fs.h:64:17: error: 'loff_t' undeclared (first use in this function); did you mean 'off_t'?
> > 64 | return (loff_t)LLONG_MAX;
> > | ^~~~~~
> > | off_t
> > ../../../../include/lapi/fs.h:64:17: note: each undeclared identifier is reported only once for each function it appears in
> > ../../../../include/lapi/fs.h:64:24: error: expected ';' before numeric constant
> > 64 | return (loff_t)LLONG_MAX;
> > | ^
> > | ;
> > make: *** [../../../../include/mk/rules.mk:45: unlink09] Error 1
> > (glibc hides loff_t behind __USE_MISC, which I thought it it's in the end
> > _GNU_SOURCE, but obviously not).
...
More information about the ltp
mailing list