summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus/bus-kernel.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-12 01:57:53 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-12 01:57:53 +0200
commitacb5a3cb20d075782e088362d4ec9aa9f3996d90 (patch)
treeb9ec82bf6de0c438c02e2d1eee5cc56a9f7a60a4 /src/libsystemd-bus/bus-kernel.c
parent8323bc1f907ff558df5ccd6bdf1e14debed5cf2e (diff)
bus: parse and expose kdbus message timestamps
Diffstat (limited to 'src/libsystemd-bus/bus-kernel.c')
-rw-r--r--src/libsystemd-bus/bus-kernel.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 3d26f16cda..1b2297fbb4 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -225,6 +225,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
struct bus_header *h = NULL;
size_t total, n_bytes = 0, idx = 0;
struct kdbus_creds *creds = NULL;
+ uint64_t nsec = 0;
int r;
assert(bus);
@@ -266,6 +267,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
} else if (d->type == KDBUS_MSG_SRC_CREDS)
creds = &d->creds;
+ else if (d->type == KDBUS_MSG_TIMESTAMP)
+ nsec = d->ts_ns;
}
if (!h)
@@ -313,6 +316,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
m->uid_valid = m->gid_valid = true;
}
+ m->timestamp = nsec / NSEC_PER_USEC;
+
r = bus_message_parse_fields(m);
if (r < 0) {
sd_bus_message_unref(m);