From: Thomas Devoogdt Date: Mon, 7 Apr 2025 12:20:12 +0000 (+0200) Subject: namespace.h: fix compilation on Linux < 4.10 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10ee66ed1b08586bde42582e34355418eef33ef5;p=thirdparty%2Futil-linux.git namespace.h: fix compilation on Linux < 4.10 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 --- diff --git a/include/namespace.h b/include/namespace.h index 2d0a56e02..d7a078ec1 100644 --- a/include/namespace.h +++ b/include/namespace.h @@ -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 # 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 */