MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / bind

Method bind

net/kernel_socket.cpp:469–480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

467class SMCSocketServer : public KernelSocketServer {
468public:
469 int bind(const EndPoint& ep) override {
470 auto s = sockaddr_storage(ep);
471 if (m_listen_fd < 0) {
472 int ver = (s.get_sockaddr()->sa_family == AF_INET6);
473 m_listen_fd = socket(AF_SMC, ver);
474 if (m_listen_fd < 0) return -1;
475 }
476 int ret = ::bind(m_listen_fd, s.get_sockaddr(), s.get_socklen());
477 if (ret < 0)
478 LOG_ERRNO_RETURN(0, ret, "failed to bind to ", s.to_endpoint());
479 return 0;
480 }
481
482 UNIMPLEMENTED(int bind(const char* path, size_t count));
483};

Callers

nothing calls this directly

Calls 5

sockaddr_storageClass · 0.70
socketFunction · 0.70
get_sockaddrMethod · 0.45
get_socklenMethod · 0.45
to_endpointMethod · 0.45

Tested by

no test coverage detected