diff options
author | Holger Schurig <holgerschurig@gmail.com> | 2014-02-20 14:39:13 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-02-21 03:06:29 +0100 |
commit | 3b794314149e40afaf3c456285e1e529747b6560 (patch) | |
tree | 90c1b0327fc514c8a56a41292772a427ddf7aea4 /src | |
parent | d9d93745cd2efcdfca8f82d798e61e0ee70cef5c (diff) |
build-sys: Add setns() functions if not in the C library.
Debian Stable is still using glibc 2.13, which doesn't provide the setns().
So we detect this and provide a tiny wrapper that issues the setns syscall
towards the kernel.
Diffstat (limited to 'src')
-rw-r--r-- | src/shared/missing.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/missing.h b/src/shared/missing.h index 2661285a22..3142306e35 100644 --- a/src/shared/missing.h +++ b/src/shared/missing.h @@ -28,6 +28,7 @@ #include <fcntl.h> #include <stdlib.h> #include <unistd.h> +#include <errno.h> #include <linux/oom.h> #include <linux/input.h> #include <linux/if_link.h> @@ -353,3 +354,19 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle #endif #endif + +#ifndef __NR_setns +# if defined(__x86_64__) +# define __NR_setns 308 +# elif defined(__i386__) +# define __NR_setns 346 +# else +# error "__NR_setns is not defined" +# endif +#endif + +#if !HAVE_DECL_SETNS +static inline int setns(int fd, int nstype) { + return syscall(__NR_setns, fd, nstype); +} +#endif |