summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-10-25 13:14:12 +0100
committerLennart Poettering <lennart@poettering.net>2015-10-25 13:19:18 +0100
commit3ffd4af22052963e7a29431721ee204e634bea75 (patch)
treefe60142dfddd37cfc02b7a135542107e772b36c3 /src/journal
parent04c0136989b7eb896bfb0fb176e11233d69e1453 (diff)
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them over.
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/cat.c1
-rw-r--r--src/journal/catalog.c1
-rw-r--r--src/journal/compress.c9
-rw-r--r--src/journal/coredump-vacuum.c3
-rw-r--r--src/journal/coredump.c1
-rw-r--r--src/journal/coredumpctl.c1
-rw-r--r--src/journal/journal-authenticate.c5
-rw-r--r--src/journal/journal-def.h5
-rw-r--r--src/journal/journal-file.c3
-rw-r--r--src/journal/journal-qrcode.h3
-rw-r--r--src/journal/journal-send.c1
-rw-r--r--src/journal/journal-vacuum.c4
-rw-r--r--src/journal/journal-verify.c9
-rw-r--r--src/journal/journalctl.c1
-rw-r--r--src/journal/journald-audit.c3
-rw-r--r--src/journal/journald-console.c1
-rw-r--r--src/journal/journald-kmsg.c3
-rw-r--r--src/journal/journald-native.c3
-rw-r--r--src/journal/journald-server.c3
-rw-r--r--src/journal/journald-stream.c3
-rw-r--r--src/journal/journald-syslog.c3
-rw-r--r--src/journal/sd-journal.c2
-rw-r--r--src/journal/stacktrace.c3
-rw-r--r--src/journal/test-catalog.c5
-rw-r--r--src/journal/test-compress.c3
-rw-r--r--src/journal/test-journal-init.c4
-rw-r--r--src/journal/test-journal-send.c3
-rw-r--r--src/journal/test-journal-verify.c7
-rw-r--r--src/journal/test-mmap-cache.c3
29 files changed, 60 insertions, 36 deletions
diff --git a/src/journal/cat.c b/src/journal/cat.c
index 7074552a15..ff1887604a 100644
--- a/src/journal/cat.c
+++ b/src/journal/cat.c
@@ -28,6 +28,7 @@
#include "sd-journal.h"
+#include "fd-util.h"
#include "string-util.h"
#include "util.h"
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index 32b851aea3..d5bc17b4b6 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -31,6 +31,7 @@
#include "catalog.h"
#include "conf-files.h"
+#include "fd-util.h"
#include "hashmap.h"
#include "log.h"
#include "mkdir.h"
diff --git a/src/journal/compress.c b/src/journal/compress.c
index 46a5410482..6c5078c110 100644
--- a/src/journal/compress.c
+++ b/src/journal/compress.c
@@ -25,20 +25,21 @@
#include <unistd.h>
#ifdef HAVE_XZ
-# include <lzma.h>
+#include <lzma.h>
#endif
#ifdef HAVE_LZ4
-# include <lz4.h>
-# include <lz4frame.h>
+#include <lz4.h>
+#include <lz4frame.h>
#endif
+#include "compress.h"
+#include "fd-util.h"
#include "journal-def.h"
#include "macro.h"
#include "sparse-endian.h"
#include "string-util.h"
#include "util.h"
-#include "compress.h"
#ifdef HAVE_LZ4
DEFINE_TRIVIAL_CLEANUP_FUNC(LZ4F_compressionContext_t, LZ4F_freeCompressionContext);
diff --git a/src/journal/coredump-vacuum.c b/src/journal/coredump-vacuum.c
index ba9994ac47..92259fd5ef 100644
--- a/src/journal/coredump-vacuum.c
+++ b/src/journal/coredump-vacuum.c
@@ -21,12 +21,13 @@
#include <sys/statvfs.h>
+#include "coredump-vacuum.h"
+#include "fd-util.h"
#include "hashmap.h"
#include "macro.h"
#include "string-util.h"
#include "time-util.h"
#include "util.h"
-#include "coredump-vacuum.h"
#define DEFAULT_MAX_USE_LOWER (uint64_t) (1ULL*1024ULL*1024ULL) /* 1 MiB */
#define DEFAULT_MAX_USE_UPPER (uint64_t) (4ULL*1024ULL*1024ULL*1024ULL) /* 4 GiB */
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index 5c1badd66d..3b87eb5355 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -41,6 +41,7 @@
#include "copy.h"
#include "coredump-vacuum.h"
#include "escape.h"
+#include "fd-util.h"
#include "fileio.h"
#include "journald-native.h"
#include "log.h"
diff --git a/src/journal/coredumpctl.c b/src/journal/coredumpctl.c
index 80f692e044..a497a4781b 100644
--- a/src/journal/coredumpctl.c
+++ b/src/journal/coredumpctl.c
@@ -29,6 +29,7 @@
#include "sd-journal.h"
#include "compress.h"
+#include "fd-util.h"
#include "journal-internal.h"
#include "log.h"
#include "macro.h"
diff --git a/src/journal/journal-authenticate.c b/src/journal/journal-authenticate.c
index cdc80e2d26..dc51a5ab2f 100644
--- a/src/journal/journal-authenticate.c
+++ b/src/journal/journal-authenticate.c
@@ -22,10 +22,11 @@
#include <fcntl.h>
#include <sys/mman.h>
+#include "fd-util.h"
+#include "fsprg.h"
+#include "journal-authenticate.h"
#include "journal-def.h"
#include "journal-file.h"
-#include "journal-authenticate.h"
-#include "fsprg.h"
static uint64_t journal_file_tag_seqnum(JournalFile *f) {
uint64_t r;
diff --git a/src/journal/journal-def.h b/src/journal/journal-def.h
index 39c9dd0dbf..c003ac05dd 100644
--- a/src/journal/journal-def.h
+++ b/src/journal/journal-def.h
@@ -21,11 +21,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "sparse-endian.h"
-
-#include "systemd/sd-id128.h"
+#include "sd-id128.h"
#include "macro.h"
+#include "sparse-endian.h"
/*
* If you change this file you probably should also change its documentation:
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index f0962faeb5..6256c8133c 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -30,12 +30,13 @@
#include "btrfs-util.h"
#include "compress.h"
+#include "fd-util.h"
#include "journal-authenticate.h"
#include "journal-def.h"
+#include "journal-file.h"
#include "lookup3.h"
#include "random-util.h"
#include "string-util.h"
-#include "journal-file.h"
#define DEFAULT_DATA_HASH_TABLE_SIZE (2047ULL*sizeof(HashItem))
#define DEFAULT_FIELD_HASH_TABLE_SIZE (333ULL*sizeof(HashItem))
diff --git a/src/journal/journal-qrcode.h b/src/journal/journal-qrcode.h
index 3ff6a3ad4a..7d14e8754b 100644
--- a/src/journal/journal-qrcode.h
+++ b/src/journal/journal-qrcode.h
@@ -21,8 +21,9 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
+#include <inttypes.h>
#include <stdio.h>
-#include "systemd/sd-id128.h"
+#include "sd-id128.h"
int print_qr_code(FILE *f, const void *seed, size_t seed_size, uint64_t start, uint64_t interval, const char *hn, sd_id128_t machine);
diff --git a/src/journal/journal-send.c b/src/journal/journal-send.c
index 79ef5b13d2..d42f8262a5 100644
--- a/src/journal/journal-send.c
+++ b/src/journal/journal-send.c
@@ -31,6 +31,7 @@
#include "sd-journal.h"
+#include "fd-util.h"
#include "memfd-util.h"
#include "socket-util.h"
#include "string-util.h"
diff --git a/src/journal/journal-vacuum.c b/src/journal/journal-vacuum.c
index 692b875fae..dca5bf5000 100644
--- a/src/journal/journal-vacuum.c
+++ b/src/journal/journal-vacuum.c
@@ -25,13 +25,13 @@
#include "sd-id128.h"
+#include "fd-util.h"
#include "journal-def.h"
#include "journal-file.h"
+#include "journal-vacuum.h"
#include "string-util.h"
#include "util.h"
-#include "journal-vacuum.h"
-
struct vacuum_info {
uint64_t usage;
char *filename;
diff --git a/src/journal/journal-verify.c b/src/journal/journal-verify.c
index 4f1d125bb9..de4f73a471 100644
--- a/src/journal/journal-verify.c
+++ b/src/journal/journal-verify.c
@@ -24,15 +24,16 @@
#include <fcntl.h>
#include <stddef.h>
-#include "util.h"
-#include "macro.h"
+#include "compress.h"
+#include "fd-util.h"
+#include "journal-authenticate.h"
#include "journal-def.h"
#include "journal-file.h"
-#include "journal-authenticate.h"
#include "journal-verify.h"
#include "lookup3.h"
-#include "compress.h"
+#include "macro.h"
#include "terminal-util.h"
+#include "util.h"
static void draw_progress(uint64_t p, usec_t *last_usec) {
unsigned n, i, j, k;
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index 1307bd5630..dbb05e0527 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -42,6 +42,7 @@
#include "bus-error.h"
#include "bus-util.h"
#include "catalog.h"
+#include "fd-util.h"
#include "fileio.h"
#include "fsprg.h"
#include "hostname-util.h"
diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c
index 58778a697a..4c102fd530 100644
--- a/src/journal/journald-audit.c
+++ b/src/journal/journald-audit.c
@@ -20,9 +20,10 @@
***/
#include "audit-type.h"
+#include "fd-util.h"
+#include "journald-audit.h"
#include "missing.h"
#include "string-util.h"
-#include "journald-audit.h"
typedef struct MapField {
const char *audit_field;
diff --git a/src/journal/journald-console.c b/src/journal/journald-console.c
index 307bdc3949..5f3eb05275 100644
--- a/src/journal/journald-console.c
+++ b/src/journal/journald-console.c
@@ -29,6 +29,7 @@
#include "formats-util.h"
#include "process-util.h"
#include "terminal-util.h"
+#include "fd-util.h"
static bool prefix_timestamp(void) {
diff --git a/src/journal/journald-kmsg.c b/src/journal/journald-kmsg.c
index a8be704716..5a05632e56 100644
--- a/src/journal/journald-kmsg.c
+++ b/src/journal/journald-kmsg.c
@@ -29,12 +29,13 @@
#include "sd-messages.h"
#include "escape.h"
+#include "fd-util.h"
#include "formats-util.h"
+#include "journald-kmsg.h"
#include "journald-server.h"
#include "journald-syslog.h"
#include "process-util.h"
#include "string-util.h"
-#include "journald-kmsg.h"
void server_forward_kmsg(
Server *s,
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index 7a514b2848..7d4aac687e 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -24,8 +24,10 @@
#include <sys/mman.h>
#include <unistd.h>
+#include "fd-util.h"
#include "journald-console.h"
#include "journald-kmsg.h"
+#include "journald-native.h"
#include "journald-server.h"
#include "journald-syslog.h"
#include "journald-wall.h"
@@ -34,7 +36,6 @@
#include "selinux-util.h"
#include "socket-util.h"
#include "string-util.h"
-#include "journald-native.h"
bool valid_user_field(const char *p, size_t l, bool allow_protected) {
const char *a;
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 2dfd309310..012970bad3 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -36,6 +36,7 @@
#include "acl-util.h"
#include "cgroup-util.h"
#include "conf-parser.h"
+#include "fd-util.h"
#include "formats-util.h"
#include "hashmap.h"
#include "hostname-util.h"
@@ -47,6 +48,7 @@
#include "journald-kmsg.h"
#include "journald-native.h"
#include "journald-rate-limit.h"
+#include "journald-server.h"
#include "journald-stream.h"
#include "journald-syslog.h"
#include "missing.h"
@@ -57,7 +59,6 @@
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"
-#include "journald-server.h"
#define USER_JOURNALS_MAX 1024
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index e06be6267f..0dd511519c 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -30,17 +30,18 @@
#include "sd-event.h"
#include "escape.h"
+#include "fd-util.h"
#include "fileio.h"
#include "journald-console.h"
#include "journald-kmsg.h"
#include "journald-server.h"
+#include "journald-stream.h"
#include "journald-syslog.h"
#include "journald-wall.h"
#include "mkdir.h"
#include "selinux-util.h"
#include "socket-util.h"
#include "string-util.h"
-#include "journald-stream.h"
#define STDOUT_STREAMS_MAX 4096
diff --git a/src/journal/journald-syslog.c b/src/journal/journald-syslog.c
index fc69cd7d9e..7e9ba12560 100644
--- a/src/journal/journald-syslog.c
+++ b/src/journal/journald-syslog.c
@@ -25,16 +25,17 @@
#include "sd-messages.h"
+#include "fd-util.h"
#include "formats-util.h"
#include "journald-console.h"
#include "journald-kmsg.h"
#include "journald-server.h"
+#include "journald-syslog.h"
#include "journald-wall.h"
#include "process-util.h"
#include "selinux-util.h"
#include "socket-util.h"
#include "string-util.h"
-#include "journald-syslog.h"
/* Warn once every 30s if we missed syslog message */
#define WARN_FORWARD_SYSLOG_MISSED_USEC (30 * USEC_PER_SEC)
diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c
index 442e352ae2..d39c0a900c 100644
--- a/src/journal/sd-journal.c
+++ b/src/journal/sd-journal.c
@@ -29,9 +29,9 @@
#include <unistd.h>
#include "sd-journal.h"
-
#include "catalog.h"
#include "compress.h"
+#include "fd-util.h"
#include "fileio.h"
#include "formats-util.h"
#include "hashmap.h"
diff --git a/src/journal/stacktrace.c b/src/journal/stacktrace.c
index c4ba9e3890..e32550d644 100644
--- a/src/journal/stacktrace.c
+++ b/src/journal/stacktrace.c
@@ -22,11 +22,12 @@
#include <dwarf.h>
#include <elfutils/libdwfl.h>
+#include "fd-util.h"
#include "formats-util.h"
#include "macro.h"
+#include "stacktrace.h"
#include "string-util.h"
#include "util.h"
-#include "stacktrace.h"
#define FRAMES_MAX 64
#define THREADS_MAX 64
diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c
index 222d6cc72a..72c1f60f02 100644
--- a/src/journal/test-catalog.c
+++ b/src/journal/test-catalog.c
@@ -27,11 +27,12 @@
#include "sd-messages.h"
-#include "util.h"
+#include "catalog.h"
+#include "fd-util.h"
#include "log.h"
#include "macro.h"
-#include "catalog.h"
#include "string-util.h"
+#include "util.h"
static const char *catalog_dirs[] = {
CATALOG_DIR,
diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c
index e51b12407f..e562fa1948 100644
--- a/src/journal/test-compress.c
+++ b/src/journal/test-compress.c
@@ -18,9 +18,10 @@
***/
#include "compress.h"
-#include "util.h"
+#include "fd-util.h"
#include "macro.h"
#include "random-util.h"
+#include "util.h"
#ifdef HAVE_XZ
# define XZ_OK 0
diff --git a/src/journal/test-journal-init.c b/src/journal/test-journal-init.c
index e6599f366d..717b703d19 100644
--- a/src/journal/test-journal-init.c
+++ b/src/journal/test-journal-init.c
@@ -19,11 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "systemd/sd-journal.h"
+#include "sd-journal.h"
#include "log.h"
-#include "util.h"
#include "rm-rf.h"
+#include "util.h"
int main(int argc, char *argv[]) {
sd_journal *j;
diff --git a/src/journal/test-journal-send.c b/src/journal/test-journal-send.c
index 81ca47ed8d..694376670d 100644
--- a/src/journal/test-journal-send.c
+++ b/src/journal/test-journal-send.c
@@ -19,10 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
-#include "systemd/sd-journal.h"
#include <stdlib.h>
#include <unistd.h>
+#include "sd-journal.h"
+
#include "log.h"
int main(int argc, char *argv[]) {
diff --git a/src/journal/test-journal-verify.c b/src/journal/test-journal-verify.c
index d89123dc64..887a83efe1 100644
--- a/src/journal/test-journal-verify.c
+++ b/src/journal/test-journal-verify.c
@@ -23,12 +23,13 @@
#include <unistd.h>
#include <fcntl.h>
-#include "util.h"
-#include "log.h"
-#include "rm-rf.h"
+#include "fd-util.h"
#include "journal-file.h"
#include "journal-verify.h"
+#include "log.h"
+#include "rm-rf.h"
#include "terminal-util.h"
+#include "util.h"
#define N_ENTRIES 6000
#define RANDOM_RANGE 77
diff --git a/src/journal/test-mmap-cache.c b/src/journal/test-mmap-cache.c
index 3258b22702..ac1239acc4 100644
--- a/src/journal/test-mmap-cache.c
+++ b/src/journal/test-mmap-cache.c
@@ -24,9 +24,10 @@
#include <unistd.h>
#include <fcntl.h>
+#include "fd-util.h"
#include "macro.h"
-#include "util.h"
#include "mmap-cache.h"
+#include "util.h"
int main(int argc, char *argv[]) {
int x, y, z, r;