[LTP] [PATCH v2 06/10] lapi: add getxattrat() fallback

Andrea Cervesato
2025-10-07T06:48:05Z

From: Andrea Cervesato <andrea.cervesato@suse.com>

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
configure.ac | 1 +
include/lapi/xattr.h | 10 ++++++++++
2 files changed, 11 insertions(+)

diff --git a/configure.ac b/configure.ac
index 827a8e6eb..e43e631ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -125,6 +125,7 @@ AC_CHECK_FUNCS_ONCE([ \
getcpu \
getdents \
getdents64 \
+ getxattrat \
io_pgetevents \
io_uring_setup \
io_uring_register \
diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h
index 8ab7e51d5..3b664e4e6 100644
--- a/include/lapi/xattr.h
+++ b/include/lapi/xattr.h
@@ -41,4 +41,14 @@ static inline int setxattrat(int dfd, const char *pathname,
}
#endif

+#ifndef HAVE_FUNC_GETXATTRAT
+static inline int getxattrat(int dfd, const char *pathname,
+ unsigned int at_flags, const char *name,
+ void *value, size_t size)
+{
+ return tst_syscall(__NR_getxattrat, dfd, pathname, at_flags, name,
+ value, size);
+}
+#endif
+
#endif /* LAPI_XATTR_H__ */

--
2.51.0