Split out of #37344.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <getopt.h>
#include <linux/vt.h>
#include <stdio.h>
#include <sys/ioctl.h>
-#include "sd-id128.h"
#include "sd-journal.h"
#include "alloc-util.h"
#include "pretty-print.h"
#include "qrcode-util.h"
#include "signal-util.h"
-#include "sysctl-util.h"
+#include "stdio-util.h"
#include "terminal-util.h"
static bool arg_continuous = false;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <stdio.h>
-#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include "log.h"
#include "main-func.h"
#include "parse-argument.h"
-#include "parse-util.h"
#include "pretty-print.h"
#include "string-util.h"
#include "syslog-util.h"
-#include "terminal-util.h"
static const char *arg_identifier = NULL;
static const char *arg_namespace = NULL;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "fd-util.h"
-#include "fs-util.h"
#include "fuzz.h"
#include "fuzz-journald.h"
#include "journald-native.h"
#include <sys/ioctl.h>
#include <unistd.h>
+#include "sd-event.h"
+
#include "fd-util.h"
#include "fuzz.h"
#include "fuzz-journald.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <unistd.h>
+
#include "sd-json.h"
+#include "alloc-util.h"
#include "ansi-color.h"
#include "chattr-util.h"
#include "errno-util.h"
#include "hostname-setup.h"
#include "hostname-util.h"
#include "io-util.h"
-#include "journal-authenticate.h"
+#include "journal-def.h"
#include "journalctl.h"
#include "journalctl-authenticate.h"
#include "log.h"
#include "qrcode-util.h"
#include "random-util.h"
#include "stat-util.h"
+#include "string-util.h"
#include "terminal-util.h"
+#include "time-util.h"
#include "tmpfile-util.h"
#if HAVE_GCRYPT
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <stdlib.h>
+
#include "alloc-util.h"
#include "catalog.h"
#include "journalctl.h"
#include "journalctl-catalog.h"
#include "log.h"
+#include "pager.h"
#include "path-util.h"
int action_update_catalog(void) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-device.h"
+#include "sd-journal.h"
#include "alloc-util.h"
#include "chase.h"
#include "logs-show.h"
#include "missing_sched.h"
#include "path-util.h"
+#include "set.h"
+#include "stat-util.h"
+#include "string-util.h"
#include "strv.h"
#include "unit-name.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-journal.h"
+#include "forward.h"
int add_filters(sd_journal *j, char **matches);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "sd-journal.h"
+
#include "alloc-util.h"
#include "dirent-util.h"
#include "fd-util.h"
#include "format-table.h"
#include "format-util.h"
+#include "hashmap.h"
#include "journal-internal.h"
#include "journal-verify.h"
#include "journalctl.h"
#include "logs-show.h"
#include "strv.h"
#include "syslog-util.h"
+#include "time-util.h"
int action_print_header(void) {
_cleanup_(sd_journal_closep) sd_journal *j = NULL;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
+#include "forward.h"
int action_print_header(void);
int action_verify(void);
#include "sd-daemon.h"
#include "sd-event.h"
-#include "sd-varlink.h"
+#include "sd-journal.h"
+#include "alloc-util.h"
#include "ansi-color.h"
#include "fileio.h"
#include "journalctl.h"
#include "journalctl-show.h"
#include "journalctl-util.h"
#include "journalctl-varlink.h"
+#include "log.h"
#include "logs-show.h"
+#include "pager.h"
+#include "string-util.h"
#include "terminal-util.h"
+#include "time-util.h"
#define PROCESS_INOTIFY_INTERVAL 1024 /* Every 1024 messages processed */
#include "log.h"
#include "logs-show.h"
#include "nulstr-util.h"
-#include "rlimit-util.h"
+#include "set.h"
+#include "string-util.h"
#include "strv.h"
-#include "terminal-util.h"
+#include "time-util.h"
#include "unit-name.h"
char* format_timestamp_maybe_utc(char *buf, size_t l, usec_t t) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-journal.h"
-
+#include "forward.h"
#include "logs-show.h"
-#include "set.h"
-#include "time-util.h"
/* The lists below are supposed to return the superset of unit names possibly matched by rules added with
* add_matches_for_unit() and add_matches_for_user_unit(). */
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <unistd.h>
+
+#include "sd-journal.h"
#include "sd-varlink.h"
#include "errno-util.h"
+#include "hashmap.h"
#include "journal-internal.h"
#include "journal-vacuum.h"
#include "journalctl.h"
#include "journalctl-util.h"
#include "journalctl-varlink.h"
#include "log.h"
+#include "string-util.h"
#include "varlink-util.h"
int varlink_connect_journal(sd_varlink **ret) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <getopt.h>
+#include <locale.h>
#include "sd-journal.h"
#include "build.h"
+#include "dissect-image.h"
+#include "extract-word.h"
#include "glob-util.h"
#include "id128-print.h"
#include "image-policy.h"
#include "journalctl-misc.h"
#include "journalctl-show.h"
#include "journalctl-varlink.h"
-#include "locale-util.h"
+#include "log.h"
+#include "loop-util.h"
#include "main-func.h"
#include "mount-util.h"
#include "mountpoint-util.h"
+#include "output-mode.h"
+#include "pager.h"
#include "parse-argument.h"
#include "parse-util.h"
+#include "pcre2-util.h"
#include "pretty-print.h"
+#include "set.h"
#include "static-destruct.h"
#include "string-table.h"
+#include "string-util.h"
+#include "strv.h"
#include "syslog-util.h"
+#include "time-util.h"
#define DEFAULT_FSS_INTERVAL_USEC (15*USEC_PER_MINUTE)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <inttypes.h>
-#include <stdbool.h>
-
-#include "sd-id128.h"
-#include "sd-json.h"
-
-#include "image-policy.h"
-#include "output-mode.h"
-#include "pager.h"
+#include "forward.h"
#include "pcre2-util.h"
-#include "set.h"
-#include "time-util.h"
typedef enum JournalctlAction {
ACTION_SHOW,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <malloc.h>
+#include "sd-event.h"
#include "alloc-util.h"
#include "audit-type.h"
#include "journal-internal.h"
#include "journald-audit.h"
#include "journald-manager.h"
+#include "log.h"
#include "missing_audit.h"
+#include "stdio-util.h"
#include "string-util.h"
+#include "time-util.h"
typedef struct MapField {
const char *audit_field;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "socket-util.h"
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
void manager_process_audit_message(Manager *m, const void *buffer, size_t buffer_size, const struct ucred *ucred, const union sockaddr_union *sa, socklen_t salen);
#include "log.h"
#include "nulstr-util.h"
#include "pcre2-util.h"
+#include "set.h"
#include "strv.h"
/* This consumes both `allow_list` and `deny_list` arguments. Hence, those arguments are not owned by the
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stddef.h>
-
-typedef struct ClientContext ClientContext;
+#include "journald-forward.h"
int client_context_read_log_filter_patterns(ClientContext *c, const char *cgroup);
int client_context_check_keep_log(ClientContext *c, const char *message, size_t len);
#include "iovec-util.h"
#include "journald-console.h"
#include "journald-manager.h"
+#include "log.h"
#include "parse-util.h"
#include "process-util.h"
#include "stdio-util.h"
#include "terminal-util.h"
+#include "time-util.h"
static bool prefix_timestamp(void) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <sys/socket.h>
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
void manager_forward_console(Manager *m, int priority, const char *identifier, const char *message, const struct ucred *ucred);
#include <selinux/selinux.h>
#endif
+#include <sys/stat.h>
+
#include "alloc-util.h"
#include "audit-util.h"
#include "cgroup-util.h"
#include "fs-util.h"
#include "iovec-util.h"
#include "journal-internal.h"
-#include "journal-util.h"
#include "journald-client.h"
#include "journald-context.h"
#include "journald-manager.h"
+#include "log.h"
#include "parse-util.h"
#include "path-util.h"
+#include "pidref.h"
+#include "prioq.h"
#include "process-util.h"
#include "procfs-util.h"
+#include "set.h"
#include "string-util.h"
#include "syslog-util.h"
+#include "time-util.h"
#include "unaligned.h"
#include "user-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <inttypes.h>
-#include <sys/socket.h>
-#include <sys/types.h>
#include <syslog.h>
#include "sd-id128.h"
#include "capability-util.h"
-#include "set.h"
-#include "time-util.h"
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
typedef struct ClientContext {
unsigned n_ref;
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#pragma once
+
+#include "conf-parser-forward.h" /* IWYU pragma: export */
+#include "forward.h" /* IWYU pragma: export */
+
+typedef struct Manager Manager;
+typedef struct StreamSyncReq StreamSyncReq;
+typedef struct SyncReq SyncReq;
+typedef struct ClientContext ClientContext;
+typedef struct StdoutStream StdoutStream;
_Pragma("GCC diagnostic ignored \"-Wzero-as-null-pointer-constant\"")
#endif
#include <stddef.h>
-#include <sys/socket.h>
#include "conf-parser.h"
#include "journald-manager.h"
%}
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <fcntl.h>
-#include <sys/epoll.h>
#include <sys/mman.h>
#include <sys/socket.h>
#include <unistd.h>
#include "sd-device.h"
+#include "sd-event.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "device-util.h"
+#include "errno-util.h"
#include "escape.h"
#include "fd-util.h"
#include "format-util.h"
-#include "fs-util.h"
#include "iovec-util.h"
#include "journal-internal.h"
#include "journald-kmsg.h"
#include "journald-manager.h"
+#include "journald-sync.h"
#include "journald-syslog.h"
#include "log.h"
#include "parse-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stddef.h>
-#include <sys/socket.h>
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
int manager_open_dev_kmsg(Manager *m);
int manager_flush_dev_kmsg(Manager *m);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <linux/sockios.h>
-#if HAVE_SELINUX
-#include <selinux/selinux.h>
-#endif
+#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/signalfd.h>
#include "sd-daemon.h"
#include "sd-journal.h"
#include "sd-messages.h"
+#include "sd-varlink.h"
#include "acl-util.h"
#include "alloc-util.h"
#include "creds-util.h"
#include "daemon-util.h"
#include "dirent-util.h"
+#include "errno-util.h"
#include "event-util.h"
-#include "extract-word.h"
#include "fd-util.h"
#include "fdset.h"
#include "fileio.h"
#include "fs-util.h"
#include "hashmap.h"
#include "hostname-setup.h"
-#include "hostname-util.h"
-#include "id128-util.h"
#include "initrd-util.h"
#include "iovec-util.h"
#include "journal-authenticate.h"
#include "journald-rate-limit.h"
#include "journald-socket.h"
#include "journald-stream.h"
+#include "journald-sync.h"
#include "journald-syslog.h"
#include "journald-varlink.h"
#include "log.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
+#include "prioq.h"
#include "proc-cmdline.h"
#include "process-util.h"
#include "rm-rf.h"
-#include "selinux-util.h"
-#include "signal-util.h"
+#include "set.h"
#include "socket-netlink.h"
#include "socket-util.h"
#include "stdio-util.h"
#include "string-table.h"
#include "string-util.h"
+#include "strv.h"
#include "syslog-util.h"
+#include "time-util.h"
#include "uid-classification.h"
#include "user-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stdbool.h>
-#include <sys/types.h>
-
-#include "sd-event.h"
-#include "sd-varlink.h"
-
#include "common-signal.h"
-#include "conf-parser.h"
-#include "hashmap.h"
#include "journal-file.h"
-#include "journald-context.h"
-#include "journald-stream.h"
-#include "journald-sync.h"
+#include "journald-forward.h"
#include "list.h"
-#include "prioq.h"
#include "ratelimit.h"
#include "socket-util.h"
-#include "time-util.h"
typedef enum Storage {
STORAGE_AUTO,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <stddef.h>
-#include <sys/epoll.h>
#include <sys/mman.h>
#include <sys/statvfs.h>
#include <unistd.h>
+#include "sd-event.h"
+
#include "alloc-util.h"
#include "fd-util.h"
-#include "fs-util.h"
+#include "format-util.h"
#include "iovec-util.h"
#include "journal-importer.h"
#include "journal-internal.h"
-#include "journal-util.h"
#include "journald-client.h"
#include "journald-console.h"
+#include "journald-context.h"
#include "journald-kmsg.h"
#include "journald-manager.h"
#include "journald-native.h"
#include "journald-syslog.h"
#include "journald-wall.h"
+#include "log.h"
#include "memfd-util.h"
#include "memory-util.h"
#include "parse-util.h"
#include "socket-util.h"
#include "stat-util.h"
#include "string-util.h"
-#include "strv.h"
#include "unaligned.h"
static bool allow_object_pid(const struct ucred *ucred) {
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <stddef.h>
-#include <sys/socket.h>
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
void manager_process_native_message(
Manager *m,
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <syslog.h>
+
#include "alloc-util.h"
#include "hashmap.h"
#include "journald-rate-limit.h"
-#include "log.h"
#include "logarithm.h"
-#include "string-util.h"
#include "time-util.h"
#define POOLS_MAX 5
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <inttypes.h>
-
-#include "hashmap.h"
-#include "time-util.h"
+#include "journald-forward.h"
int journal_ratelimit_test(
OrderedHashmap **groups_by_id,
#include <sys/socket.h>
#include <sys/uio.h>
+#include "alloc-util.h"
#include "fd-util.h"
#include "iovec-util.h"
#include "journald-manager.h"
#include "journald-socket.h"
#include "log.h"
-#include "macro.h"
-#include "process-util.h"
+#include "stdio-util.h"
#include "socket-util.h"
#include "sparse-endian.h"
+#include "time-util.h"
static int manager_open_forward_socket(Manager *m) {
_cleanup_close_ int socket_fd = -EBADF;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <sys/socket.h>
-
-#include "time-util.h"
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
int manager_forward_socket(Manager *m, const struct iovec *iovec, size_t n, const dual_timestamp *ts, int priority);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <stddef.h>
#include <unistd.h>
+#include <sys/stat.h>
-#if HAVE_SELINUX
-#include <selinux/selinux.h>
-#endif
-
-#include "sd-daemon.h"
#include "sd-event.h"
#include "alloc-util.h"
#include "journald-kmsg.h"
#include "journald-manager.h"
#include "journald-stream.h"
+#include "journald-sync.h"
#include "journald-syslog.h"
#include "journald-wall.h"
+#include "log.h"
#include "mkdir.h"
#include "parse-util.h"
#include "process-util.h"
#include "syslog-util.h"
#include "tmpfile-util.h"
#include "unit-name.h"
-#include "user-util.h"
#define STDOUT_STREAMS_MAX (64*1024)
#include <sys/socket.h>
-#include "sd-event.h"
#include "sd-id128.h"
-#include "fdset.h"
+#include "journald-forward.h"
#include "list.h"
-typedef struct ClientContext ClientContext;
-typedef struct Manager Manager;
-typedef struct StdoutStream StdoutStream;
-typedef struct StreamSyncReq StreamSyncReq;
-
typedef enum StdoutStreamState {
STDOUT_STREAM_IDENTIFIER,
STDOUT_STREAM_UNIT_ID,
STDOUT_STREAM_RUNNING,
} StdoutStreamState;
-struct StdoutStream {
+typedef struct StdoutStream {
Manager *manager;
StdoutStreamState state;
char id_field[STRLEN("_STREAM_ID=") + SD_ID128_STRING_MAX];
LIST_HEAD(StreamSyncReq, stream_sync_reqs);
-};
+} StdoutStream;
int manager_open_stdout_socket(Manager *m, const char *stdout_socket);
int manager_restore_streams(Manager *m, FDSet *fds);
#include <linux/sockios.h>
#include <sys/ioctl.h>
+#include <sys/poll.h>
#include "sd-varlink.h"
+#include "alloc-util.h"
#include "io-util.h"
#include "journald-manager.h"
#include "journald-stream.h"
#include "journald-sync.h"
#include "journald-varlink.h"
+#include "log.h"
+#include "prioq.h"
#include "socket-netlink.h"
#include "time-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "sd-varlink.h"
-
-#include "journald-stream.h"
+#include "journald-forward.h"
#include "list.h"
-#include "macro.h"
-
-typedef struct Manager Manager;
-typedef struct StreamSyncReq StreamSyncReq;
-typedef struct SyncReq SyncReq;
/* Encapsulates the synchronization request data we need to keep per STDOUT stream. Primarily a byte counter
* to count down. */
-struct StreamSyncReq {
+typedef struct StreamSyncReq {
SyncReq *req;
StdoutStream *stream;
LIST_FIELDS(StreamSyncReq, by_sync_req);
LIST_FIELDS(StreamSyncReq, by_stdout_stream);
-};
+} StreamSyncReq;
/* Encapsulates a synchronization request */
-struct SyncReq {
+typedef struct SyncReq {
Manager *manager;
sd_varlink *link;
unsigned realtime_prioq_idx;
unsigned boottime_prioq_idx;
-};
+} SyncReq;
StreamSyncReq *stream_sync_req_free(StreamSyncReq *ssr);
DEFINE_TRIVIAL_CLEANUP_FUNC(StreamSyncReq*, stream_sync_req_free);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include <stddef.h>
-#include <sys/epoll.h>
+#include <sys/stat.h>
#include <unistd.h>
+#include "sd-event.h"
#include "sd-messages.h"
#include "alloc-util.h"
#include "journal-internal.h"
#include "journald-client.h"
#include "journald-console.h"
+#include "journald-context.h"
#include "journald-kmsg.h"
#include "journald-manager.h"
#include "journald-syslog.h"
#include "journald-wall.h"
+#include "log.h"
#include "process-util.h"
#include "selinux-util.h"
#include "socket-util.h"
#include "stdio-util.h"
#include "string-util.h"
#include "syslog-util.h"
+#include "time-util.h"
/* Warn once every 30s if we missed syslog message */
#define WARN_FORWARD_SYSLOG_MISSED_USEC (30 * USEC_PER_SEC)
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <sys/socket.h>
-
-#include "macro.h"
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
int syslog_fixup_facility(int priority) _const_;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "sd-event.h"
+
#include "journald-manager.h"
#include "journald-sync.h"
#include "journald-varlink.h"
+#include "log.h"
#include "varlink-io.systemd.Journal.h"
#include "varlink-io.systemd.service.h"
#include "varlink-util.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include "journald-manager.h"
-#include "journald-sync.h"
+#include "journald-forward.h"
int manager_open_varlink(Manager *m, const char *socket, int fd);
#include "format-util.h"
#include "journald-manager.h"
#include "journald-wall.h"
+#include "log.h"
#include "process-util.h"
#include "string-util.h"
#include "wall.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
-#include <sys/socket.h>
-
-typedef struct Manager Manager;
+#include "journald-forward.h"
void manager_forward_wall(Manager *m, int priority, const char *identifier, const char *message, const struct ucred *ucred);
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include <sys/stat.h>
#include <unistd.h>
-#include "sd-daemon.h"
+#include "sd-event.h"
#include "sd-messages.h"
#include "format-util.h"
#include "journald-kmsg.h"
#include "journald-manager.h"
#include "journald-syslog.h"
+#include "log.h"
#include "main-func.h"
#include "process-util.h"
#include "sigbus.h"
+#include "string-util.h"
#include "terminal-util.h"
+#include "time-util.h"
static int run(int argc, char *argv[]) {
_cleanup_(manager_freep) Manager *m = NULL;
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include <netinet/in.h>
-#include <stdbool.h>
#include <string.h>
#include <sys/un.h>
+#include "alloc-util.h"
#include "journald-manager.h"
#include "log.h"
-#include "path-util.h"
#include "socket-util.h"
#include "sparse-endian.h"
#include "tests.h"
/* SPDX-License-Identifier: LGPL-2.1-or-later */
+#include "hashmap.h"
#include "journald-rate-limit.h"
#include "tests.h"
+#include "time-util.h"
TEST(journal_ratelimit_test) {
_cleanup_ordered_hashmap_free_ OrderedHashmap *rl = NULL;
#include "alloc-util.h"
#include "journald-syslog.h"
-#include "macro.h"
-#include "string-util.h"
#include "syslog-util.h"
#include "tests.h"