From f54514f3542db9b1f1a6f7546472718ce0d02aae Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 May 2013 02:22:37 +0200 Subject: bus: keep kernel bus fd around during entire life-time of bus We need this since we might need to invoke the release ioctl for messages. Since we don't want to add any locking for that we simply keep a reference to the bus and then rely that the fd stays valid all the time. --- src/libsystemd-bus/bus-internal.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/libsystemd-bus/bus-internal.h') diff --git a/src/libsystemd-bus/bus-internal.h b/src/libsystemd-bus/bus-internal.h index 0edb09764a..5ba32ad8fd 100644 --- a/src/libsystemd-bus/bus-internal.h +++ b/src/libsystemd-bus/bus-internal.h @@ -68,9 +68,14 @@ enum bus_state { BUS_OPENING, BUS_AUTHENTICATING, BUS_HELLO, - BUS_RUNNING + BUS_RUNNING, + BUS_CLOSED }; +static inline bool BUS_IS_OPEN(enum bus_state state) { + return state > BUS_UNSET && state < BUS_CLOSED; +} + enum bus_auth { _BUS_AUTH_INVALID, BUS_AUTH_EXTERNAL, -- cgit v1.2.3-54-g00ecf