17 #ifndef __LINUX_NS_HPP__
18 #define __LINUX_NS_HPP__
22 #error "linux/ns.hpp is only available on Linux systems."
27 #include <sys/syscall.h>
38 #define CLONE_NEWNS 0x00020000
42 #define CLONE_NEWUTS 0x04000000
46 #define CLONE_NEWIPC 0x08000000
50 #define CLONE_NEWPID 0x20000000
54 #define CLONE_NEWNET 0x40000000
58 #define CLONE_NEWUSER 0x10000000
61 #ifndef CLONE_NEWCGROUP
62 #define CLONE_NEWCGROUP 0x02000000
70 return ::syscall(SYS_setns, fd, nstype);
71 #elif defined(__x86_64__)
75 return ::syscall(308, fd, nstype);
77 #error "setns is not available"
103 const std::string& path,
104 const std::string& ns,
105 bool checkMultithreaded =
true);
161 const lambda::function<
int()>&
f,
171 #endif // __LINUX_NS_HPP__
Try< pid_t > clone(pid_t target, int nstypes, const lambda::function< int()> &f, int flags)
Performs an os::clone after entering a set of namespaces for the specified target process...
F && f
Definition: defer.hpp:270
int setns(int fd, int nstype)
Definition: ns.hpp:67
Try< Nothing > setns(const std::string &path, const std::string &ns, bool checkMultithreaded=true)
Definition: result.hpp:40
std::set< int > nstypes()
DWORD pid_t
Definition: windows.hpp:187
std::set< std::string > namespaces()
#define flags
Definition: decoder.hpp:18
Result< ino_t > getns(pid_t pid, const std::string &ns)
Try< int > nstype(const std::string &ns)
std::string stringify(int flags)