]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
namespace.h: fix compilation on Linux < 4.10
authorThomas Devoogdt <thomas@devoogdt.com>
Mon, 7 Apr 2025 12:20:12 +0000 (14:20 +0200)
committerThomas Devoogdt <thomas.devoogdt@barco.com>
Mon, 7 Apr 2025 12:22:04 +0000 (14:22 +0200)
sys-utils/lsns.c: In function ‘add_namespace_from_sock’:
sys-utils/lsns.c:580:19: error: ‘SIOCGSKNS’ undeclared (first use in this function)
  nsfd = ioctl(sk, SIOCGSKNS);
                   ^~~~~~~~~

SIOCGSKNS was added in https://github.com/torvalds/linux/commit/c62cce2caee558e18aa05c01c2fd3b40f07174f2.

Fixes: https://github.com/util-linux/util-linux/issues/3502
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
include/namespace.h

index 2d0a56e0222ae607bb28652e053c6afde2f53b77..d7a078ec18f660821c6ee7e2c7730828a080c099 100644 (file)
@@ -3,11 +3,15 @@
  * No copyright is claimed.  This code is in the public domain; do with
  * it what you wish.
  *
- * Compat code so unshare and setns can be used with older libcs
+ * Compat code to support older libcs.
  */
 #ifndef UTIL_LINUX_NAMESPACE_H
 # define UTIL_LINUX_NAMESPACE_H
 
+/*
+ * Compat code for sched.h (unshare and setns)
+ */
+
 # include <sched.h>
 
 # ifndef CLONE_NEWNS
@@ -53,4 +57,12 @@ static inline int setns(int fd, int nstype)
 }
 # endif
 
+/*
+ * Compat code for sockios.h
+ */
+
+# ifndef SIOCGSKNS
+#  define SIOCGSKNS 0x894C
+# endif
+
 #endif /* UTIL_LINUX_NAMESPACE_H */