MCPcopy Create free account
hub / github.com/apache/mesos / nstype

Function nstype

src/linux/ns.cpp:58–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56namespace ns {
57
58Try<int> nstype(const string& ns)
59{
60 const hashmap<string, int> nstypes = {
61 {"mnt", CLONE_NEWNS},
62 {"uts", CLONE_NEWUTS},
63 {"ipc", CLONE_NEWIPC},
64 {"net", CLONE_NEWNET},
65 {"user", CLONE_NEWUSER},
66 {"pid", CLONE_NEWPID},
67 {"cgroup", CLONE_NEWCGROUP}
68 };
69
70 Option<int> nstype = nstypes.get(ns);
71
72 if (nstype.isNone()) {
73 return Error("Unknown namespace '" + ns + "'");
74 }
75
76 return nstype.get();
77}
78
79
80Try<string> nsname(int nsType)

Callers 3

TESTFunction · 0.85
foreachFunction · 0.85
setnsFunction · 0.85

Calls 3

ErrorFunction · 0.50
getMethod · 0.45
isNoneMethod · 0.45

Tested by 1

TESTFunction · 0.68