diff options
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r-- | src/libsystemd-bus/bus-util.c | 24 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-util.h | 16 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-util.c b/src/libsystemd-bus/bus-util.c index ae9733d01f..2cf718b096 100644 --- a/src/libsystemd-bus/bus-util.c +++ b/src/libsystemd-bus/bus-util.c @@ -958,3 +958,27 @@ int bus_log_parse_error(int r) { log_error("Failed to parse message: %s", strerror(-r)); return r; } + +int bus_log_create_error(int r) { + log_error("Failed to create message: %s", strerror(-r)); + return r; +} + +int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u) { + assert(message); + assert(u); + + return sd_bus_message_read( + message, + "(ssssssouso)", + &u->id, + &u->description, + &u->load_state, + &u->active_state, + &u->sub_state, + &u->following, + &u->unit_path, + &u->job_id, + &u->job_type, + &u->job_path); +} diff --git a/src/libsystemd-bus/bus-util.h b/src/libsystemd-bus/bus-util.h index 5f0a0b3ffa..21a483fb01 100644 --- a/src/libsystemd-bus/bus-util.h +++ b/src/libsystemd-bus/bus-util.h @@ -76,6 +76,22 @@ int bus_property_get_uid(sd_bus *bus, const char *path, const char *interface, c #define bus_property_get_pid bus_property_get_uid int bus_log_parse_error(int r); +int bus_log_create_error(int r); + +typedef struct UnitInfo { + const char *id; + const char *description; + const char *load_state; + const char *active_state; + const char *sub_state; + const char *following; + const char *unit_path; + uint32_t job_id; + const char *job_type; + const char *job_path; +} UnitInfo; + +int bus_parse_unit_info(sd_bus_message *message, UnitInfo *u); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus*, sd_bus_unref); DEFINE_TRIVIAL_CLEANUP_FUNC(sd_bus_message*, sd_bus_message_unref); |