]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal/journald.h
man: throw in an example of timedatectl output
[thirdparty/systemd.git] / src / journal / journald.h
CommitLineData
e6960940
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
c2f1db8f 3#pragma once
e6960940
LP
4
5/***
6 This file is part of systemd.
7
8 Copyright 2011 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
e6960940
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
e6960940 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
e6960940
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
24#include <inttypes.h>
e6960940 25#include <stdbool.h>
b1bafc00
ZJS
26#include <sys/types.h>
27#include <sys/socket.h>
e6960940
LP
28
29#include "journal-file.h"
30#include "hashmap.h"
31#include "util.h"
d7832d2c 32#include "audit.h"
d2bd7630 33#include "journald-rate-limit.h"
e6960940
LP
34#include "list.h"
35
e156d769
LP
36typedef enum Storage {
37 STORAGE_AUTO,
38 STORAGE_VOLATILE,
205c4d1d 39 STORAGE_PERSISTENT,
e156d769
LP
40 STORAGE_NONE,
41 _STORAGE_MAX,
42 _STORAGE_INVALID = -1
43} Storage;
44
182b858f
LP
45typedef enum SplitMode {
46 SPLIT_LOGIN,
47 SPLIT_UID,
48 SPLIT_NONE,
49 _SPLIT_MAX,
50 _SPLIT_INVALID = -1
51} SplitMode;
52
e6960940
LP
53typedef struct StdoutStream StdoutStream;
54
55typedef struct Server {
56 int epoll_fd;
57 int signal_fd;
58 int syslog_fd;
59 int native_fd;
60 int stdout_fd;
51abe64c 61 int dev_kmsg_fd;
e6960940
LP
62
63 JournalFile *runtime_journal;
64 JournalFile *system_journal;
65 Hashmap *user_journals;
66
67 uint64_t seqnum;
68
69 char *buffer;
70 size_t buffer_size;
71
72 JournalRateLimit *rate_limit;
73 usec_t rate_limit_interval;
74 unsigned rate_limit_burst;
75
76 JournalMetrics runtime_metrics;
77 JournalMetrics system_metrics;
78
79 bool compress;
eb53b74f 80 bool seal;
e6960940 81
224f2ee2
LP
82 bool forward_to_kmsg;
83 bool forward_to_syslog;
84 bool forward_to_console;
85
178cc770
LP
86 unsigned n_forward_syslog_missed;
87 usec_t last_warn_forward_syslog_missed;
88
e6960940
LP
89 uint64_t cached_available_space;
90 usec_t cached_available_space_timestamp;
91
92 uint64_t var_available_timestamp;
93
fb0951b0
LP
94 usec_t max_retention_usec;
95 usec_t max_file_usec;
96 usec_t oldest_file_usec;
97
5e41cfec
LP
98 gid_t file_gid;
99 bool file_gid_valid;
100
e6960940
LP
101 LIST_HEAD(StdoutStream, stdout_streams);
102 unsigned n_stdout_streams;
0d9243f0
LP
103
104 char *tty_path;
213ba152
LP
105
106 int max_level_store;
107 int max_level_syslog;
108 int max_level_kmsg;
109 int max_level_console;
e156d769
LP
110
111 Storage storage;
182b858f 112 SplitMode split_mode;
51abe64c 113
16e9f408
LP
114 MMapCache *mmap;
115
51abe64c 116 bool dev_kmsg_readable;
cee5e9a7
LP
117
118 uint64_t *kernel_seqnum;
bdfb9e7f
LP
119
120 struct udev *udev;
e6960940
LP
121} Server;
122
ef63833d
LP
123#define N_IOVEC_META_FIELDS 17
124#define N_IOVEC_KERNEL_FIELDS 64
125#define N_IOVEC_UDEV_FIELDS 32
126
127void server_dispatch_message(Server *s, struct iovec *iovec, unsigned n, unsigned m, struct ucred *ucred, struct timeval *tv, const char *label, size_t label_len, const char *unit_id, int priority);
ef63833d
LP
128void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...);
129
e6960940
LP
130/* gperf lookup function */
131const struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length);
132
e156d769
LP
133int config_parse_storage(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
134
135const char *storage_to_string(Storage s);
136Storage storage_from_string(const char *s);
182b858f
LP
137
138int config_parse_split_mode(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
139
140const char *split_mode_to_string(SplitMode s);
141SplitMode split_mode_from_string(const char *s);