summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-22 20:01:23 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-22 20:01:23 +0100
commitca7b42c81652c342288a3e0a10abd885c66ac5b2 (patch)
tree25af7e6df93701499016b8c24170b883684ffb57 /src/libsystemd/sd-bus
parentaa575ef8dec6fe74c9fdf27960125dd214511202 (diff)
bus: expose priority field of messages, in preparation for prioq support
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c5
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd/sd-bus/bus-message.c16
-rw-r--r--src/libsystemd/sd-bus/bus-message.h1
4 files changed, 21 insertions, 2 deletions
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;