From 33d52ab92f2f0bfd706e6f343d172618d1e03f3d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 12 Nov 2015 11:17:01 +0100 Subject: journald: rework --sync/--rotate logic to use CLOCK_MONOTONIC timestamp files Previously, we'd rely on the mtime timestamps of the touch files to see if our sync/rotation requests were already suppressed. This means we rely on CLOCK_REALTIME timestamps. With this patch we instead store the CLOCK_MONOTONIC timestamp *in* the touch files, and avoid relying on mtime. This should make things more reliable when the clock or underlying mtime granularity is not very good. This also adds warning messages if writing any of the flag files fails. --- src/basic/fileio.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/basic/fileio.h') diff --git a/src/basic/fileio.h b/src/basic/fileio.h index fa7f192331..5f2c941498 100644 --- a/src/basic/fileio.h +++ b/src/basic/fileio.h @@ -28,6 +28,7 @@ #include #include "macro.h" +#include "time-util.h" typedef enum { WRITE_STRING_FILE_CREATE = 1, @@ -77,3 +78,6 @@ int open_tmpfile(const char *path, int flags); int tempfn_xxxxxx(const char *p, const char *extra, char **ret); int tempfn_random(const char *p, const char *extra, char **ret); int tempfn_random_child(const char *p, const char *extra, char **ret); + +int write_timestamp_file_atomic(const char *fn, usec_t n); +int read_timestamp_file(const char *fn, usec_t *ret); -- cgit v1.2.3-54-g00ecf