Lines Matching refs:sock
35 int sock = socket(AF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, protocol); in openNetlinkSocket() local
36 if (sock == -1) { in openNetlinkSocket()
39 if (connect(sock, reinterpret_cast<const sockaddr*>(&KERNEL_NLADDR), in openNetlinkSocket()
43 return sock; in openNetlinkSocket()
46 int recvNetlinkAck(int sock) { in recvNetlinkAck() argument
52 int ret = recv(sock, &response, sizeof(response), 0); in recvNetlinkAck()
97 int sock = openNetlinkSocket(NETLINK_ROUTE); in sendNetlinkRequest() local
98 if (sock < 0) { in sendNetlinkRequest()
99 return sock; in sendNetlinkRequest()
104 if (writev(sock, iov, iovlen) == -1) { in sendNetlinkRequest()
107 close(sock); in sendNetlinkRequest()
112 ret = recvNetlinkAck(sock); in sendNetlinkRequest()
114 ret = processNetlinkDump(sock, *callback); in sendNetlinkRequest()
117 close(sock); in sendNetlinkRequest()
126 int processNetlinkDump(int sock, const NetlinkDumpCallback& callback) { in processNetlinkDump() argument
131 bytesread = read(sock, buf, sizeof(buf)); in processNetlinkDump()