This repository has been archived by the owner on Dec 3, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support glibc version<2.14 without setns api(centos6)
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters