summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-01-22 10:57:12 +0100
committerLennart Poettering <lennart@poettering.net>2014-01-22 11:19:26 +0100
commit6a0e376c1cd303ff09777e5d18f070fe43e6b915 (patch)
tree04001242fbab20b73eb24971b93111c3065cc077 /src/libsystemd/sd-bus
parentd6f116a7b18f8bd3c6507c803217991235c7f1bb (diff)
bus: add API for querying the kdbus message sequence number
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-dump.c4
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd/sd-bus/bus-message.c9
-rw-r--r--src/libsystemd/sd-bus/bus-message.h1
4 files changed, 14 insertions, 1 deletions
diff --git a/src/libsystemd/sd-bus/bus-dump.c b/src/libsystemd/sd-bus/bus-dump.c
index 78e7597ed5..d2c0684448 100644
--- a/src/libsystemd/sd-bus/bus-dump.c
+++ b/src/libsystemd/sd-bus/bus-dump.c
@@ -100,8 +100,10 @@ int bus_message_dump(sd_bus_message *m, FILE *f, bool with_header) {
fprintf(f, " Monotonic=%llu", (unsigned long long) m->monotonic);
if (m->realtime != 0)
fprintf(f, " Realtime=%llu", (unsigned long long) m->realtime);
+ if (m->seqnum != 0)
+ fprintf(f, " SequenceNumber=%llu", (unsigned long long) m->seqnum);
- if (m->monotonic != 0 || m->realtime != 0)
+ if (m->monotonic != 0 || m->realtime != 0 || m->seqnum != 0)
fputs("\n", f);
bus_creds_dump(&m->creds, f);
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 99ac5b1ed3..fdb4dab2da 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -501,6 +501,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
case KDBUS_ITEM_TIMESTAMP:
m->realtime = d->timestamp.realtime_ns / NSEC_PER_USEC;
m->monotonic = d->timestamp.monotonic_ns / NSEC_PER_USEC;
+ m->seqnum = d->timestamp.seqnum;
break;
case KDBUS_ITEM_PID_COMM:
diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c
index 1a2039b8cd..0c3913e2b0 100644
--- a/src/libsystemd/sd-bus/bus-message.c
+++ b/src/libsystemd/sd-bus/bus-message.c
@@ -898,6 +898,15 @@ _public_ int sd_bus_message_get_realtime_timestamp(sd_bus_message *m, uint64_t *
return 0;
}
+_public_ int sd_bus_message_get_seqnum(sd_bus_message *m, uint64_t *seqnum) {
+ assert_return(m, -EINVAL);
+ assert_return(seqnum, -EINVAL);
+ assert_return(m->seqnum > 0, -ENODATA);
+
+ *seqnum = m->seqnum;
+ return 0;
+}
+
_public_ sd_bus_creds *sd_bus_message_get_creds(sd_bus_message *m) {
assert_return(m, NULL);
diff --git a/src/libsystemd/sd-bus/bus-message.h b/src/libsystemd/sd-bus/bus-message.h
index 5322375ef1..0c90e726de 100644
--- a/src/libsystemd/sd-bus/bus-message.h
+++ b/src/libsystemd/sd-bus/bus-message.h
@@ -98,6 +98,7 @@ struct sd_bus_message {
usec_t monotonic;
usec_t realtime;
+ uint64_t seqnum;
bool sealed:1;
bool dont_send:1;