From 1fee9de5096fe9955b89523aedecf8962ab0e8c5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 11 Nov 2013 23:42:00 +0100 Subject: bus: add api to control auto start message flag --- src/libsystemd-bus/bus-message.c | 18 ++++++++++++++++++ src/libsystemd-bus/libsystemd-bus.sym | 2 ++ src/systemd/sd-bus.h | 2 ++ 3 files changed, 22 insertions(+) diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index b26d446578..d7774db09a 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -777,6 +777,12 @@ _public_ int sd_bus_message_get_no_reply(sd_bus_message *m) { return m->header->type == SD_BUS_MESSAGE_METHOD_CALL ? !!(m->header->flags & SD_BUS_MESSAGE_NO_REPLY_EXPECTED) : 0; } +_public_ int sd_bus_message_get_no_auto_start(sd_bus_message *m) { + assert_return(m, -EINVAL); + + return !!(m->header->flags & SD_BUS_MESSAGE_NO_AUTO_START); +} + _public_ const char *sd_bus_message_get_path(sd_bus_message *m) { assert_return(m, NULL); @@ -1100,6 +1106,18 @@ _public_ int sd_bus_message_set_no_reply(sd_bus_message *m, int b) { return 0; } +_public_ int sd_bus_message_set_no_auto_start(sd_bus_message *m, int b) { + assert_return(m, -EINVAL); + assert_return(!m->sealed, -EPERM); + + if (b) + m->header->flags |= SD_BUS_MESSAGE_NO_AUTO_START; + else + m->header->flags &= ~SD_BUS_MESSAGE_NO_AUTO_START; + + return 0; +} + static struct bus_container *message_get_container(sd_bus_message *m) { assert(m); diff --git a/src/libsystemd-bus/libsystemd-bus.sym b/src/libsystemd-bus/libsystemd-bus.sym index b6ad84b98b..8f1dba2489 100644 --- a/src/libsystemd-bus/libsystemd-bus.sym +++ b/src/libsystemd-bus/libsystemd-bus.sym @@ -85,6 +85,7 @@ global: sd_bus_message_get_serial; sd_bus_message_get_reply_serial; sd_bus_message_get_no_reply; + sd_bus_message_get_no_auto_start; sd_bus_message_get_signature; sd_bus_message_get_path; sd_bus_message_get_interface; @@ -117,6 +118,7 @@ global: sd_bus_message_is_method_call; sd_bus_message_is_method_error; sd_bus_message_set_no_reply; + sd_bus_message_set_no_auto_start; sd_bus_message_set_destination; sd_bus_message_append; sd_bus_message_append_basic; diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index ef5984f45b..61f232c79b 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -149,6 +149,7 @@ int sd_bus_message_get_type(sd_bus_message *m, uint8_t *type); int sd_bus_message_get_serial(sd_bus_message *m, uint64_t *serial); int sd_bus_message_get_reply_serial(sd_bus_message *m, uint64_t *serial); int sd_bus_message_get_no_reply(sd_bus_message *m); +int sd_bus_message_get_no_auto_start(sd_bus_message *m); const char *sd_bus_message_get_signature(sd_bus_message *m, int complete); const char *sd_bus_message_get_path(sd_bus_message *m); @@ -185,6 +186,7 @@ int sd_bus_message_is_method_call(sd_bus_message *m, const char *interface, cons int sd_bus_message_is_method_error(sd_bus_message *m, const char *name); int sd_bus_message_set_no_reply(sd_bus_message *m, int b); +int sd_bus_message_set_no_auto_start(sd_bus_message *m, int b); int sd_bus_message_set_destination(sd_bus_message *m, const char *destination); int sd_bus_message_append(sd_bus_message *m, const char *types, ...); -- cgit v1.2.3-54-g00ecf