summaryrefslogtreecommitdiff
path: root/src/basic/fileio.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-12 11:17:01 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-12 11:17:01 +0100
commit33d52ab92f2f0bfd706e6f343d172618d1e03f3d (patch)
tree15f21659f2e23491ef6dd7d390fde2945d9302d4 /src/basic/fileio.h
parentb97e7fabaeaf12c88d6a10b2bfead54a77812105 (diff)
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.
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r--src/basic/fileio.h4
1 files changed, 4 insertions, 0 deletions
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 <sys/types.h>
#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);