2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-27 15:18:06 +00:00

netlink-socket: New function for draining the receive buffer.

This will be used in an upcoming patch.

Reviewed by Justin Pettit.
This commit is contained in:
Ben Pfaff
2011-01-11 16:05:37 -08:00
parent cceb11f5b1
commit 6b7c12fdc1
2 changed files with 10 additions and 0 deletions

View File

@@ -28,6 +28,7 @@
#include "netlink-protocol.h" #include "netlink-protocol.h"
#include "ofpbuf.h" #include "ofpbuf.h"
#include "poll-loop.h" #include "poll-loop.h"
#include "socket-util.h"
#include "stress.h" #include "stress.h"
#include "vlog.h" #include "vlog.h"
@@ -446,6 +447,13 @@ recv:
return 0; 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 /* Starts a Netlink "dump" operation, by sending 'request' to the kernel via
* 'sock', and initializes 'dump' to reflect the state of the operation. * 'sock', and initializes 'dump' to reflect the state of the operation.
* *

View File

@@ -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, int nl_sock_transact(struct nl_sock *, const struct ofpbuf *request,
struct ofpbuf **reply); struct ofpbuf **reply);
int nl_sock_drain(struct nl_sock *);
void nl_sock_wait(const struct nl_sock *, short int events); void nl_sock_wait(const struct nl_sock *, short int events);
/* Table dumping. */ /* Table dumping. */