]>
Commit | Line | Data |
---|---|---|
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> | |
25 | #include <sys/types.h> | |
26 | #include <stdbool.h> | |
27 | ||
28 | #include "journal-file.h" | |
29 | #include "hashmap.h" | |
30 | #include "util.h" | |
d7832d2c | 31 | #include "audit.h" |
d2bd7630 | 32 | #include "journald-rate-limit.h" |
e6960940 LP |
33 | #include "list.h" |
34 | ||
e156d769 LP |
35 | typedef enum Storage { |
36 | STORAGE_AUTO, | |
37 | STORAGE_VOLATILE, | |
205c4d1d | 38 | STORAGE_PERSISTENT, |
e156d769 LP |
39 | STORAGE_NONE, |
40 | _STORAGE_MAX, | |
41 | _STORAGE_INVALID = -1 | |
42 | } Storage; | |
43 | ||
182b858f LP |
44 | typedef enum SplitMode { |
45 | SPLIT_LOGIN, | |
46 | SPLIT_UID, | |
47 | SPLIT_NONE, | |
48 | _SPLIT_MAX, | |
49 | _SPLIT_INVALID = -1 | |
50 | } SplitMode; | |
51 | ||
e6960940 LP |
52 | typedef struct StdoutStream StdoutStream; |
53 | ||
54 | typedef struct Server { | |
55 | int epoll_fd; | |
56 | int signal_fd; | |
57 | int syslog_fd; | |
58 | int native_fd; | |
59 | int stdout_fd; | |
51abe64c | 60 | int dev_kmsg_fd; |
e6960940 LP |
61 | |
62 | JournalFile *runtime_journal; | |
63 | JournalFile *system_journal; | |
64 | Hashmap *user_journals; | |
65 | ||
66 | uint64_t seqnum; | |
67 | ||
68 | char *buffer; | |
69 | size_t buffer_size; | |
70 | ||
71 | JournalRateLimit *rate_limit; | |
72 | usec_t rate_limit_interval; | |
73 | unsigned rate_limit_burst; | |
74 | ||
75 | JournalMetrics runtime_metrics; | |
76 | JournalMetrics system_metrics; | |
77 | ||
78 | bool compress; | |
eb53b74f | 79 | bool seal; |
e6960940 | 80 | |
224f2ee2 LP |
81 | bool forward_to_kmsg; |
82 | bool forward_to_syslog; | |
83 | bool forward_to_console; | |
84 | ||
e6960940 LP |
85 | uint64_t cached_available_space; |
86 | usec_t cached_available_space_timestamp; | |
87 | ||
88 | uint64_t var_available_timestamp; | |
89 | ||
5e41cfec LP |
90 | gid_t file_gid; |
91 | bool file_gid_valid; | |
92 | ||
e6960940 LP |
93 | LIST_HEAD(StdoutStream, stdout_streams); |
94 | unsigned n_stdout_streams; | |
0d9243f0 LP |
95 | |
96 | char *tty_path; | |
213ba152 LP |
97 | |
98 | int max_level_store; | |
99 | int max_level_syslog; | |
100 | int max_level_kmsg; | |
101 | int max_level_console; | |
e156d769 LP |
102 | |
103 | Storage storage; | |
182b858f | 104 | SplitMode split_mode; |
51abe64c | 105 | |
16e9f408 LP |
106 | MMapCache *mmap; |
107 | ||
51abe64c | 108 | bool dev_kmsg_readable; |
cee5e9a7 LP |
109 | |
110 | uint64_t *kernel_seqnum; | |
bdfb9e7f LP |
111 | |
112 | struct udev *udev; | |
e6960940 LP |
113 | } Server; |
114 | ||
ef63833d LP |
115 | #define N_IOVEC_META_FIELDS 17 |
116 | #define N_IOVEC_KERNEL_FIELDS 64 | |
117 | #define N_IOVEC_UDEV_FIELDS 32 | |
118 | ||
119 | void 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 |
120 | void server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...); |
121 | ||
e6960940 LP |
122 | /* gperf lookup function */ |
123 | const struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length); | |
124 | ||
e156d769 LP |
125 | int config_parse_storage(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); |
126 | ||
127 | const char *storage_to_string(Storage s); | |
128 | Storage storage_from_string(const char *s); | |
182b858f LP |
129 | |
130 | int config_parse_split_mode(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); | |
131 | ||
132 | const char *split_mode_to_string(SplitMode s); | |
133 | SplitMode split_mode_from_string(const char *s); |