chiark / gitweb /
bus: expose priority field of messages, in preparation for prioq support
authorLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2014 19:01:23 +0000 (20:01 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 22 Jan 2014 19:01:23 +0000 (20:01 +0100)
src/libsystemd/libsystemd.sym
src/libsystemd/sd-bus/bus-dump.c
src/libsystemd/sd-bus/bus-kernel.c
src/libsystemd/sd-bus/bus-message.c
src/libsystemd/sd-bus/bus-message.h
src/systemd/sd-bus.h

index 0337e4e..fc9c4f8 100644 (file)
@@ -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;
index a2b6358..0e41549 100644 (file)
@@ -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 */
index f547ebf..77ad5ca 100644 (file)
@@ -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;
index 2c25b3f..b42c491 100644 (file)
@@ -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;
+}
index 0c90e72..5fbe3e6 100644 (file)
@@ -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;
index 9992888..6f9443a 100644 (file)
@@ -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);