chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d29ae29
)
sd-bus: when we synthesize messages, initialize timestamps ourselves
author
Lennart Poettering
<lennart@poettering.net>
Wed, 7 Jan 2015 19:36:23 +0000
(20:36 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 7 Jan 2015 19:36:23 +0000
(20:36 +0100)
src/libsystemd/sd-bus/sd-bus.c
patch
|
blob
|
history
diff --git
a/src/libsystemd/sd-bus/sd-bus.c
b/src/libsystemd/sd-bus/sd-bus.c
index 4b1c60edac449233913e76cac382eb13f8c2d48d..15180d042354621bff69831dcd8c41879d301e2b 100644
(file)
--- a/
src/libsystemd/sd-bus/sd-bus.c
+++ b/
src/libsystemd/sd-bus/sd-bus.c
@@
-1528,6
+1528,16
@@
int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) {
assert(b);
assert(m);
assert(b);
assert(m);
+ /* Fake some timestamps, if they were requested, and not
+ * already initialized */
+ if (b->attach_flags & KDBUS_ATTACH_TIMESTAMP) {
+ if (m->realtime <= 0)
+ m->realtime = now(CLOCK_REALTIME);
+
+ if (m->monotonic <= 0)
+ m->monotonic = now(CLOCK_MONOTONIC);
+ }
+
/* The bus specification says the serial number cannot be 0,
* hence let's fill something in for synthetic messages. Since
* synthetic messages might have a fake sender and we don't
/* The bus specification says the serial number cannot be 0,
* hence let's fill something in for synthetic messages. Since
* synthetic messages might have a fake sender and we don't
@@
-1535,7
+1545,6
@@
int bus_seal_synthetic_message(sd_bus *b, sd_bus_message *m) {
* pick a fixed, artificial one. We use (uint32_t) -1 rather
* than (uint64_t) -1 since dbus1 only had 32bit identifiers,
* even though kdbus can do 64bit. */
* pick a fixed, artificial one. We use (uint32_t) -1 rather
* than (uint64_t) -1 since dbus1 only had 32bit identifiers,
* even though kdbus can do 64bit. */
-
return bus_message_seal(m, 0xFFFFFFFFULL, 0);
}
return bus_message_seal(m, 0xFFFFFFFFULL, 0);
}
@@
-2237,6
+2246,11
@@
static int process_reply(sd_bus *bus, sd_bus_message *m) {
if (r < 0)
return r;
if (r < 0)
return r;
+ /* Copy over original timestamp */
+ synthetic_reply->realtime = m->realtime;
+ synthetic_reply->monotonic = m->monotonic;
+ synthetic_reply->seqnum = m->seqnum;
+
r = bus_seal_synthetic_message(bus, synthetic_reply);
if (r < 0)
return r;
r = bus_seal_synthetic_message(bus, synthetic_reply);
if (r < 0)
return r;