[LTP] [PATCH v2 02/10] lapi: add setxattrat() fallback definition

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

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

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

diff --git a/configure.ac b/configure.ac
index c32d9992c..827a8e6eb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,7 @@ AC_CHECK_FUNCS_ONCE([ \
sendmmsg \
sethostid \
setns \
+ setxattrat \
sigpending \
splice \
statx \
diff --git a/include/lapi/xattr.h b/include/lapi/xattr.h
index 8bd2d45e4..8ab7e51d5 100644
--- a/include/lapi/xattr.h
+++ b/include/lapi/xattr.h
@@ -7,7 +7,9 @@
#define LAPI_XATTR_H__

#include <stdint.h>
+#include <stddef.h>
#include "config.h"
+#include "lapi/syscalls.h"

#ifdef HAVE_LINUX_XATTR_H
# include <linux/xattr.h>
@@ -29,4 +31,14 @@ struct xattr_args {
};
#endif

+#ifndef HAVE_FUNC_SETXATTRAT
+static inline int setxattrat(int dfd, const char *pathname,
+ unsigned int at_flags, const char *name,
+ const struct xattr_args *uargs, size_t usize)
+{
+ return tst_syscall(__NR_setxattrat, dfd, pathname, at_flags, name,
+ uargs, usize);
+}
+#endif
+
#endif /* LAPI_XATTR_H__ */

--
2.51.0