Skip to content
This repository has been archived by the owner on Dec 3, 2019. It is now read-only.

Commit

Permalink
Support glibc version<2.14 without setns api(centos6)
Browse files Browse the repository at this point in the history
  • Loading branch information
faicker authored and eklitzke committed Jul 13, 2017
1 parent ff79abe commit 909b91a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/netns.h
@@ -0,0 +1,15 @@
#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 14
/* Define setns() if missing from the C library */
#include <error.h>
static inline int setns(int fd, int nstype)
{
#ifdef __NR_setns
return syscall(__NR_setns, fd, nstype);
#elif defined(__NR_set_ns)
return syscall(__NR_set_ns, fd, nstype);
#else
errno = ENOSYS;
return -1;
#endif
}
#endif
1 change: 1 addition & 0 deletions src/posix.cc
Expand Up @@ -24,6 +24,7 @@
#include <sstream>

#include "./exc.h"
#include "./netns.h"

namespace pyflame {
int OpenRdonly(const char *path) {
Expand Down

0 comments on commit 909b91a

Please sign in to comment.