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

Function create

src/linux/routing/link/veth.cpp:35–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33namespace veth {
34
35Try<bool> create(
36 const string& veth,
37 const string& peer,
38 const Option<pid_t>& pid)
39{
40 Try<Netlink<struct nl_sock>> socket = routing::socket();
41 if (socket.isError()) {
42 return Error(socket.error());
43 }
44
45 int error = rtnl_link_veth_add(
46 socket->get(),
47 veth.c_str(),
48 peer.c_str(),
49 (pid.isNone() ? getpid() : pid.get()));
50
51 if (error != 0) {
52 if (error == -NLE_EXIST) {
53 return false;
54 }
55 return Error(nl_geterror(error));
56 }
57
58 return true;
59}
60
61} // namespace veth {
62} // namespace link {

Callers 2

parseProfileDataFunction · 0.50
tableFunction · 0.50

Calls 6

errorMethod · 0.65
socketFunction · 0.50
ErrorFunction · 0.50
isErrorMethod · 0.45
getMethod · 0.45
isNoneMethod · 0.45

Tested by

no test coverage detected