nsenter: fix setns() for rhel6 (glibc-2.12)

Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
This commit is contained in:
Vincent Batts 2014-06-12 13:09:04 -04:00
parent 8f74c29bc5
commit c43dd7b50d
1 changed files with 10 additions and 0 deletions

View File

@ -49,6 +49,16 @@ void get_args(int *argc, char ***argv) {
(*argv)[*argc] = NULL; (*argv)[*argc] = NULL;
} }
// Use raw setns syscall for versions of glibc that don't include it (namely glibc-2.12)
#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 14 && defined(SYS_setns)
#define _GNU_SOURCE
#include <sched.h>
#include "syscall.h"
int setns(int fd, int nstype) {
return syscall(SYS_setns, fd, nstype);
}
#endif
void nsenter() { void nsenter() {
int argc; int argc;
char **argv; char **argv;