From 4256379d99ce74ecddcdf9725e896e093e6a4d6c Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 30 Nov 2023 19:04:37 +0900 Subject: [PATCH] sd-netlink: introduce netlink_get_reply_callback_count() --- src/libsystemd/sd-netlink/netlink-util.h | 2 ++ src/libsystemd/sd-netlink/sd-netlink.c | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/libsystemd/sd-netlink/netlink-util.h b/src/libsystemd/sd-netlink/netlink-util.h index 2f9f7e9..369f5d5 100644 --- a/src/libsystemd/sd-netlink/netlink-util.h +++ b/src/libsystemd/sd-netlink/netlink-util.h @@ -107,5 +107,7 @@ int rtattr_read_nexthop(const struct rtnexthop *rtnh, size_t size, int family, O void netlink_seal_message(sd_netlink *nl, sd_netlink_message *m); +size_t netlink_get_reply_callback_count(sd_netlink *nl); + /* TODO: to be exported later */ int sd_netlink_sendv(sd_netlink *nl, sd_netlink_message **messages, size_t msgcnt, uint32_t **ret_serial); diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c index 8b5c473..b6730b7 100644 --- a/src/libsystemd/sd-netlink/sd-netlink.c +++ b/src/libsystemd/sd-netlink/sd-netlink.c @@ -458,6 +458,12 @@ static int timeout_compare(const void *a, const void *b) { return CMP(x->timeout, y->timeout); } +size_t netlink_get_reply_callback_count(sd_netlink *nl) { + assert(nl); + + return hashmap_size(nl->reply_callbacks); +} + int sd_netlink_call_async( sd_netlink *nl, sd_netlink_slot **ret_slot, -- 2.7.4