chase: Use openat2() if available

Let's make use of openat2() if we can in chaseat().
This commit is contained in:
Daan De Meyer
2026-05-12 14:43:39 +02:00
committed by Daan De Meyer
parent 452214c09b
commit 8b81e3b751
5 changed files with 123 additions and 0 deletions
+9
View File
@@ -2,6 +2,8 @@
#pragma once
#include_next <fcntl.h> /* IWYU pragma: export */
#include <linux/openat2.h> /* IWYU pragma: export */
#include <stddef.h>
/* This is defined since glibc-2.41. */
#ifndef F_DUPFD_QUERY
@@ -22,3 +24,10 @@
#ifndef AT_HANDLE_MNT_ID_UNIQUE
#define AT_HANDLE_MNT_ID_UNIQUE 0x001 /* Return the u64 unique mount ID. */
#endif
/* Defined since glibc-2.42.
* Supported since kernel v5.6 (fddb5d430ad9fa91b49b1d34d0202ffe2fa0e179). */
#if !HAVE_OPENAT2
int missing_openat2(int dfd, const char *filename, const struct open_how *how, size_t usize);
# define openat2 missing_openat2
#endif