[LTP] [PATCH 2/8] lapi: Add a configure check and fallback for setns
Cyril Hrubis
chrubis@suse.cz
Thu Mar 5 14:48:28 CET 2020
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
configure.ac | 1 +
include/lapi/setns.h | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
create mode 100644 include/lapi/setns.h
diff --git a/configure.ac b/configure.ac
index c9ec39fce..cd52806de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,7 @@ AC_CHECK_FUNCS([ \
renameat2 \
sched_getcpu \
sendmmsg \
+ setns \
sigpending \
splice \
statx \
diff --git a/include/lapi/setns.h b/include/lapi/setns.h
new file mode 100644
index 000000000..7b0a7afc4
--- /dev/null
+++ b/include/lapi/setns.h
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ Copyright (c) 2020 Cyril Hrubis <chrubis@suse.cz>
+ */
+
+#ifndef LAPI_SETNS_H__
+#define LAPI_SETNS_H__
+
+#include "config.h"
+#include "lapi/syscalls.h"
+#include <sched.h>
+
+#ifndef HAVE_SETNS
+int setns(int fd, int nstype)
+{
+ return tst_syscall(__NR_setns, fd, nstype);
+}
+#endif
+
+#endif /* LAPI_SETNS_H__ */
--
2.23.0
More information about the ltp
mailing list