[ovs-dev] [netlink v4 08/52] netlink-socket: New function for draining the receive buffer.

Justin Pettit jpettit at nicira.com
Tue Jan 18 08:44:18 UTC 2011


Looks good.

--Justin


On Jan 11, 2011, at 9:49 PM, Ben Pfaff wrote:

> This will be used in an upcoming patch.
> ---
> lib/netlink-socket.c |    8 ++++++++
> lib/netlink-socket.h |    2 ++
> 2 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
> index 8e81da9..9e3dd97 100644
> --- a/lib/netlink-socket.c
> +++ b/lib/netlink-socket.c
> @@ -28,6 +28,7 @@
> #include "netlink-protocol.h"
> #include "ofpbuf.h"
> #include "poll-loop.h"
> +#include "socket-util.h"
> #include "stress.h"
> #include "vlog.h"
> 
> @@ -446,6 +447,13 @@ recv:
>     return 0;
> }
> 
> +/* Drain all the messages currently in 'sock''s receive queue. */
> +int
> +nl_sock_drain(struct nl_sock *sock)
> +{
> +    return drain_rcvbuf(sock->fd);
> +}
> +
> /* Starts a Netlink "dump" operation, by sending 'request' to the kernel via
>  * 'sock', and initializes 'dump' to reflect the state of the operation.
>  *
> diff --git a/lib/netlink-socket.h b/lib/netlink-socket.h
> index ad06d81..6ed4880 100644
> --- a/lib/netlink-socket.h
> +++ b/lib/netlink-socket.h
> @@ -58,6 +58,8 @@ int nl_sock_recv(struct nl_sock *, struct ofpbuf **, bool wait);
> int nl_sock_transact(struct nl_sock *, const struct ofpbuf *request,
>                      struct ofpbuf **reply);
> 
> +int nl_sock_drain(struct nl_sock *);
> +
> void nl_sock_wait(const struct nl_sock *, short int events);
> 
> /* Table dumping. */
> -- 
> 1.7.1
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list