[LTP] [PATCH] openat2: Move includes to lapi, remove _GNU_SOURCE
Li Wang
liwang@redhat.com
Thu Feb 5 07:08:42 CET 2026
On Wed, Feb 04, 2026 at 01:43:23PM +0100, Petr Vorel wrote:
> Improve 767b3e519e. struct open_how is also used in lapi/openat2.h,
> which is used by all openat2*.c tests. Therefore move <fcntl.h> to the
> lapi header (and use lapi/fcntl.h instead).
>
> Also remove _GNU_SOURCE which should not be needed.
>
> While at it, move include "config.h" to the top.
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi Li,
>
> my points from the original patchset why not use _GNU_SOURCE:
>
> glibc test tst-openat2.c [1] which includes <fcntl.h>, uses struct
Interesting, I haven't figure out why it can be built within glibc itself.
> open_how and test openat2() does not define it. Neither openat2() nor
> struct open_how [2] are guarded by #ifdef __USE_GNU.
>
> O_DIRECTORY is guarded by #ifdef __USE_XOPEN2K8 but this should be safe as we
> compile with -std=gnu99.
In glibc-2.43, things have changed, only define __USE_GNU can contain the
<bits/openat2.h> header file, that's why after applying this patch still
fails to complie on Fedora-Rawhide.
<fcntl.h> -> <bits/fcntl.h> -> <bits/fcntl-linux.h> -> <bits/openat2.h>
# cat bits/fcntl-linux.h
396 #ifdef __USE_GNU
...
473 #include <bits/openat2.h>
489 #endif /* use GNU */
See: https://github.com/bminor/glibc/commit/0f0a5cd338998f4b603f52f3ce2163df0db7b814#diff-a4fc1e1b56b60a2598e320a232e6f631d08e0dafcfe3dd9607dde4bc8ee31eb8R473
--
Regards,
Li Wang
More information about the ltp
mailing list