From: Jesse Gross Date: Fri, 16 Sep 2011 16:37:16 +0000 (-0700) Subject: netlink: Expose method to get Netlink pid of a socket. X-Git-Tag: v1.3.0~223 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=50802adb0e00bbf381c31b9e32a7a6a3e920e7ac;p=sliver-openvswitch.git netlink: Expose method to get Netlink pid of a socket. In the future, the kernel will use unicast messages instead of multicast to send upcalls. As a result, we need to be able to tell it where to direct the traffic. This adds a function to expose the Netlink pid of a socket so it can be included in messages to the kernel. --- diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c index 8f9c3d503..3674bacbf 100644 --- a/lib/netlink-socket.c +++ b/lib/netlink-socket.c @@ -667,6 +667,13 @@ nl_sock_wait(const struct nl_sock *sock, short int events) { poll_fd_wait(sock->fd, events); } + +/* Returns the PID associated with this socket. */ +uint32_t +nl_sock_pid(const struct nl_sock *sock) +{ + return sock->pid; +} /* Miscellaneous. */ diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h index 3ea790cfd..ff2485837 100644 --- a/lib/netlink-socket.h +++ b/lib/netlink-socket.h @@ -60,6 +60,8 @@ int nl_sock_drain(struct nl_sock *); void nl_sock_wait(const struct nl_sock *, short int events); +uint32_t nl_sock_pid(const struct nl_sock *); + /* Table dumping. */ struct nl_dump { struct nl_sock *sock; /* Socket being dumped. */