static int recvmsgs(struct nl_sock *sk, struct nl_cb *cb)
{
- int n, err = 0, multipart = 0, interrupted = 0;
+ int n, err = 0, multipart = 0, interrupted = 0, nrecv = 0;
unsigned char *buf = NULL;
struct nlmsghdr *hdr;
struct sockaddr_nl nla = {0};
if (creds)
nlmsg_set_creds(msg, creds);
+ nrecv++;
+
/* Raw callback is the first, it gives the most control
* to the user and he can do his very own parsing. */
if (cb->cb_set[NL_CB_MSG_IN])
if (interrupted)
err = -NLE_DUMP_INTR;
+ if (!err)
+ err = nrecv;
+
return err;
}
* A non-blocking sockets causes the function to return immediately if
* no data is available.
*
- * @return 0 on success or a negative error code from nl_recv().
+ * @return Number of received messages or a negative error code from nl_recv().
*/
int nl_recvmsgs(struct nl_sock *sk, struct nl_cb *cb)
{