summaryrefslogtreecommitdiffstats
path: root/src/basic/fileio.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-05-11 16:23:36 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-05-11 16:23:36 +0200
commit39c38d773fbe2b4f76ff29ecd3344640efb9a86c (patch)
treefcdb651664382d4696f35ece2ab836084529ac30 /src/basic/fileio.h
parentexecute: Properly log errors considering socket fds (#5910) (diff)
downloadsystemd-39c38d773fbe2b4f76ff29ecd3344640efb9a86c.tar.xz
systemd-39c38d773fbe2b4f76ff29ecd3344640efb9a86c.zip
basic/fileio: extend atomic file writing with timestamp setting
There should be no functional change.
Diffstat (limited to 'src/basic/fileio.h')
-rw-r--r--src/basic/fileio.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/basic/fileio.h b/src/basic/fileio.h
index e547614cc4..6098562265 100644
--- a/src/basic/fileio.h
+++ b/src/basic/fileio.h
@@ -35,8 +35,14 @@ typedef enum {
WRITE_STRING_FILE_VERIFY_ON_FAILURE = 8,
} WriteStringFileFlags;
-int write_string_stream(FILE *f, const char *line, bool enforce_newline);
-int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags);
+int write_string_stream_ts(FILE *f, const char *line, bool enforce_newline, struct timespec *ts);
+static inline int write_string_stream(FILE *f, const char *line, bool enforce_newline) {
+ return write_string_stream_ts(f, line, enforce_newline, NULL);
+}
+int write_string_file_ts(const char *fn, const char *line, WriteStringFileFlags flags, struct timespec *ts);
+static inline int write_string_file(const char *fn, const char *line, WriteStringFileFlags flags) {
+ return write_string_file_ts(fn, line, flags, NULL);
+}
int read_one_line_file(const char *fn, char **line);
int read_full_file(const char *fn, char **contents, size_t *size);