diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-01-22 20:01:23 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-01-22 20:01:23 +0100 |
commit | ca7b42c81652c342288a3e0a10abd885c66ac5b2 (patch) | |
tree | 25af7e6df93701499016b8c24170b883684ffb57 | |
parent | aa575ef8dec6fe74c9fdf27960125dd214511202 (diff) |
bus: expose priority field of messages, in preparation for prioq support
-rw-r--r-- | src/libsystemd/libsystemd.sym | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-dump.c | 5 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-kernel.c | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.c | 16 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-message.h | 1 | ||||
-rw-r--r-- | src/systemd/sd-bus.h | 2 |
6 files changed, 25 insertions, 2 deletions
diff --git a/src/libsystemd/libsystemd.sym b/src/libsystemd/libsystemd.sym index 0337e4eb0c..fc9c4f830c 100644 --- a/src/libsystemd/libsystemd.sym +++ b/src/libsystemd/libsystemd.sym @@ -86,6 +86,7 @@ global: sd_bus_message_get_reply_cookie; sd_bus_message_get_no_reply; sd_bus_message_get_no_auto_start; + sd_bus_message_get_priority; sd_bus_message_get_signature; sd_bus_message_get_path; sd_bus_message_get_interface; @@ -104,6 +105,7 @@ global: sd_bus_message_set_no_reply; sd_bus_message_set_no_auto_start; sd_bus_message_set_destination; + sd_bus_message_set_priority; sd_bus_message_append; sd_bus_message_append_basic; sd_bus_message_append_array; diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c index a2b6358215..0e41549737 100644 --- a/src/libsystemd/sd-bus/bus-dump.c +++ b/src/libsystemd/sd-bus/bus-dump.c @@ -54,14 +54,15 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) { if (with_header) { fprintf(f, - "%s%s%sType=%s%s%s Endian=%c Flags=%u Version=%u", + "%s%s%sType=%s%s%s Endian=%c Flags=%u Version=%u Priority=%lli", m->header->type == SD_BUS_MESSAGE_METHOD_ERROR ? ansi_highlight_red() : m->header->type == SD_BUS_MESSAGE_METHOD_RETURN ? ansi_highlight_green() : m->header->type != SD_BUS_MESSAGE_SIGNAL ? ansi_highlight() : "", draw_special_char(DRAW_TRIANGULAR_BULLET), ansi_highlight_off(), ansi_highlight(), bus_message_type_to_string(m->header->type), ansi_highlight_off(), m->header->endian, m->header->flags, - m->header->version); + m->header->version, + (long long) m->priority); /* Display synthetic message serial number in a more readable * format than (uint32_t) -1 */ diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c index f547ebf134..77ad5ca506 100644 --- a/src/libsystemd/sd-bus/bus-kernel.c +++ b/src/libsystemd/sd-bus/bus-kernel.c @@ -260,6 +260,7 @@ static int bus_message_setup_kmsg(sd_bus *b, sd_bus_message *m) { m->destination ? unique : KDBUS_DST_ID_BROADCAST; m->kdbus->payload_type = KDBUS_PAYLOAD_DBUS; m->kdbus->cookie = m->header->serial; + m->kdbus->priority = m->priority; if (m->header->flags & BUS_MESSAGE_NO_REPLY_EXPECTED) m->kdbus->cookie_reply = m->reply_cookie; diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c index 2c25b3f5f1..b42c4915ea 100644 --- a/src/libsystemd/sd-bus/bus-message.c +++ b/src/libsystemd/sd-bus/bus-message.c @@ -5548,3 +5548,19 @@ int bus_message_append_sender(sd_bus_message *m, const char *sender) { return message_append_field_string(m, BUS_MESSAGE_HEADER_SENDER, SD_BUS_TYPE_STRING, sender, &m->sender); } + +_public_ int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority) { + assert_return(m, -EINVAL); + assert_return(priority, -EINVAL); + + *priority = m->priority; + return 0; +} + +_public_ int sd_bus_message_set_priority(sd_bus_message *m, int64_t priority) { + assert_return(m, -EINVAL); + assert_return(!m->sealed, -EPERM); + + m->priority = priority; + return 0; +} diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h index 0c90e726de..5fbe3e6030 100644 --- a/src/libsystemd/sd-bus/bus-message.h +++ b/src/libsystemd/sd-bus/bus-message.h @@ -99,6 +99,7 @@ struct sd_bus_message { usec_t monotonic; usec_t realtime; uint64_t seqnum; + int64_t priority; bool sealed:1; bool dont_send:1; diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index 99928882f2..6f9443aa37 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -193,6 +193,7 @@ int sd_bus_message_get_cookie(sd_bus_message *m, uint64_t *cookie); int sd_bus_message_get_reply_cookie(sd_bus_message *m, uint64_t *cookie); int sd_bus_message_get_no_reply(sd_bus_message *m); int sd_bus_message_get_no_auto_start(sd_bus_message *m); +int sd_bus_message_get_priority(sd_bus_message *m, int64_t *priority); const char *sd_bus_message_get_signature(sd_bus_message *m, int complete); const char *sd_bus_message_get_path(sd_bus_message *m); @@ -216,6 +217,7 @@ 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_set_priority(sd_bus_message *m, int64_t priority); int sd_bus_message_append(sd_bus_message *m, const char *types, ...); int sd_bus_message_append_basic(sd_bus_message *m, char type, const void *p); |