Merge pull request #12 from vbatts/vbatts-fix_setns_rhel6

nsenter: fix setns() for rhel6 (glibc-2.12)
This commit is contained in:
Victor Marmol 2014-06-12 11:44:52 -07:00
commit dae62af4d2
1 changed files with 10 additions and 0 deletions

View File

@ -51,6 +51,16 @@ void get_args(int *argc, char ***argv) {
(*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() {
int argc;
char **argv;