Systemd/src/libsystemd
Lennart Poettering 38a03f06a7 sd-event: make sure sd_event_now() cannot fail
Previously, if the event loop never ran before sd_event_now() would
fail. With this change it will instead fall back to invoking now(). This
way, the function cannot fail anymore, except for programming error when
invoking it with wrong parameters.

This takes into account the fact that many callers did not handle the
error condition correctly, and if the callers did, then they kept simply
invoking now() as fall back on their own. Hence let's shorten the code
using this call, and make things more robust, and let's just fall back
to now() internally.

Whether now() is used or the cache timestamp may still be detected via
the return value of sd_event_now(). If > 0 is returned, then the fall
back to now() was used, if == 0 is returned, then the cached value was
returned.

This patch also simplifies many of the invocations of sd_event_now():
the manual fall back to now() can be removed. Also, in cases where the
call is invoked withing void functions we can now protect the invocation
via assert_se(), acknowledging the fact that the call cannot fail
anymore except for programming errors with the parameters.

This change is inspired by #841.
2015-08-03 17:34:49 +02:00
..
sd-bus sd-bus: cleanup bus_reset_parsed_address() 2015-08-02 23:12:08 +09:00
sd-daemon sd-daemon: simplify sd_pid_notify_with_fds 2015-03-13 23:42:17 -04:00
sd-device tree-wide: port everything over to fflush_and_check() 2015-07-29 20:31:07 +02:00
sd-event sd-event: make sure sd_event_now() cannot fail 2015-08-03 17:34:49 +02:00
sd-hwdb hashmap: fix iterators to not skip entries 2015-06-14 16:56:02 +02:00
sd-id128 build-sys: add all source files and no built files to the tar ball 2015-06-23 12:43:15 +02:00
sd-login build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
sd-netlink tree-wide: introduce mfree() 2015-07-31 19:56:38 +02:00
sd-network sd-network: fix CID 1306198 2015-06-11 14:08:56 +05:30
sd-path tree-wide: there is no ENOTSUP on linux 2015-03-13 14:10:39 +01:00
sd-resolve Add (void) where we don't care about return value 2015-03-15 17:26:58 -04:00
sd-utf8 libsystemd: split up into subdirs 2014-01-21 14:41:35 +01:00
.gitignore libsystemd: remove list of symbols to export only in the future 2015-06-17 16:21:13 +02:00
libsystemd.pc.in build-sys: update .pc.in files 2014-01-25 18:55:58 -05:00
libsystemd.sym sd-bus: introduce new sd_bus_flush_close_unref() call 2015-07-03 19:49:03 +02:00
Makefile libsystemd-bus: rename to libsystemd 2014-01-13 18:54:19 +01:00