sd-bus: add new sd_bus_pending_method_calls() call
This commit is contained in:
committed by
Luca Boccassi
parent
ec8bbd8adb
commit
48ce0824dc
@@ -843,3 +843,8 @@ global:
|
||||
sd_journal_stream_fd_with_namespace;
|
||||
sd_event_source_get_inotify_path;
|
||||
} LIBSYSTEMD_255;
|
||||
|
||||
LIBSYSTEMD_257 {
|
||||
global:
|
||||
sd_bus_pending_method_calls;
|
||||
} LIBSYSTEMD_256;
|
||||
|
||||
@@ -4471,3 +4471,21 @@ _public_ int sd_bus_enqueue_for_read(sd_bus *bus, sd_bus_message *m) {
|
||||
bus->rqueue[bus->rqueue_size++] = bus_message_ref_queued(m, bus);
|
||||
return 0;
|
||||
}
|
||||
|
||||
_public_ int sd_bus_pending_method_calls(sd_bus *bus) {
|
||||
|
||||
/* Returns the number of currently pending asynchronous method calls. This is graceful, i.e. an
|
||||
* unallocated (i.e. NULL) bus connection has no method calls pending. */
|
||||
|
||||
if (!bus)
|
||||
return 0;
|
||||
|
||||
assert_return(bus = bus_resolve(bus), -ENOPKG);
|
||||
|
||||
if (!BUS_IS_OPEN(bus->state))
|
||||
return 0;
|
||||
|
||||
size_t n = ordered_hashmap_size(bus->reply_callbacks);
|
||||
|
||||
return n > INT_MAX ? INT_MAX : (int) n; /* paranoid overflow check */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user