Skip to content

Commit

Permalink
nsenter: fix setns() for rhel6 (glibc-2.12)
Browse files Browse the repository at this point in the history
Docker-DCO-1.1-Signed-off-by: Vincent Batts <vbatts@redhat.com> (github: vbatts)
  • Loading branch information
vbatts committed Jun 12, 2014
1 parent 8f74c29 commit c43dd7b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions namespaces/nsenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,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;
Expand Down

0 comments on commit c43dd7b

Please sign in to comment.