Merge remote-tracking branch 'upstream/master' into fix3

This commit is contained in:
proller 2018-08-21 19:14:45 +03:00
commit 169d9d3540

View File

@ -156,9 +156,16 @@ void TaskStatsInfoGetter::init()
if (netlink_socket_fd >= 0)
return;
struct timeval tv;
tv.tv_sec = 0;
tv.tv_usec = 50000;
netlink_socket_fd = ::socket(PF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
if (netlink_socket_fd < 0)
throwFromErrno("Can't create PF_NETLINK socket");
if (0 != ::setsockopt(netlink_socket_fd, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast<const char *>(&tv), sizeof(tv)))
throwFromErrno("Can't set timeout on PF_NETLINK socket");
::sockaddr_nl addr{};
addr.nl_family = AF_NETLINK;