forked from pool/systemd
39 lines
1.5 KiB
Diff
39 lines
1.5 KiB
Diff
Stop flooding the kernel's message ring buffer with useless
|
|
messages on dual_timestamp_is_set is failed. This is a backport
|
|
from upstream code.
|
|
|
|
---
|
|
src/libsystemd/sd-event/sd-event.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
--- systemd-210/src/libsystemd/sd-event/sd-event.c
|
|
+++ systemd-210/src/libsystemd/sd-event/sd-event.c 2014-05-02 10:01:23.366235185 +0000
|
|
@@ -2191,9 +2191,12 @@ _public_ int sd_event_exit(sd_event *e,
|
|
_public_ int sd_event_get_now_realtime(sd_event *e, uint64_t *usec) {
|
|
assert_return(e, -EINVAL);
|
|
assert_return(usec, -EINVAL);
|
|
- assert_return(dual_timestamp_is_set(&e->timestamp), -ENODATA);
|
|
assert_return(!event_pid_changed(e), -ECHILD);
|
|
|
|
+ /* If we haven't run yet, just get the actual time */
|
|
+ if (!dual_timestamp_is_set(&e->timestamp))
|
|
+ return -ENODATA;
|
|
+
|
|
*usec = e->timestamp.realtime;
|
|
return 0;
|
|
}
|
|
@@ -2201,9 +2204,12 @@ _public_ int sd_event_get_now_realtime(s
|
|
_public_ int sd_event_get_now_monotonic(sd_event *e, uint64_t *usec) {
|
|
assert_return(e, -EINVAL);
|
|
assert_return(usec, -EINVAL);
|
|
- assert_return(dual_timestamp_is_set(&e->timestamp), -ENODATA);
|
|
assert_return(!event_pid_changed(e), -ECHILD);
|
|
|
|
+ /* If we haven't run yet, just get the actual time */
|
|
+ if (!dual_timestamp_is_set(&e->timestamp))
|
|
+ return -ENODATA;
|
|
+
|
|
*usec = e->timestamp.monotonic;
|
|
return 0;
|
|
}
|