journald.h revision eb53b74f7e2f83d936b35107806a157fdffdbf5a
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd#pragma once
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd
fd9abdda70912b99b24e3bf1a38f26fde908a74cnd/***
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend This file is part of systemd.
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend Copyright 2011 Lennart Poettering
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
96ad5d81ee4a2cc66a4ae19893efc8aa6d06fae7jailletc systemd is free software; you can redistribute it and/or modify it
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend under the terms of the GNU Lesser General Public License as published by
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend the Free Software Foundation; either version 2.1 of the License, or
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen (at your option) any later version.
2e545ce2450a9953665f701bb05350f0d3f26275nd
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen systemd is distributed in the hope that it will be useful, but
d29d9ab4614ff992b0e8de6e2b88d52b6f1f153erbowen WITHOUT ANY WARRANTY; without even the implied warranty of
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend Lesser General Public License for more details.
af33a4994ae2ff15bc67d19ff1a7feb906745bf8rbowen
3f08db06526d6901aa08c110b5bc7dde6bc39905nd You should have received a copy of the GNU Lesser General Public License
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend along with systemd; If not, see <http://www.gnu.org/licenses/>.
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend***/
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh#include <inttypes.h>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd#include <sys/types.h>
f086b4b402fa9a2fefc7dda85de2a3cc1cd0a654rjung#include <stdbool.h>
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd
3b3b7fc78d1f5bfc2769903375050048ff41ff26nd#include "journal-file.h"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend#include "hashmap.h"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend#include "util.h"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend#include "audit.h"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend#include "journal-rate-limit.h"
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend#include "list.h"
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendtypedef enum Storage {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend STORAGE_AUTO,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend STORAGE_VOLATILE,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend STORAGE_PERSISTENT,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend STORAGE_NONE,
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend _STORAGE_MAX,
a99c5d4cc3cab6a62b04d52000dbc22ce1fa2d94coar _STORAGE_INVALID = -1
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh} Storage;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendtypedef struct StdoutStream StdoutStream;
dc06c0ac17fcd3d721bb865d7fc5d2cefe67c57ftrawick
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendtypedef struct Server {
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int epoll_fd;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int signal_fd;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int syslog_fd;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int native_fd;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int stdout_fd;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int dev_kmsg_fd;
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend JournalFile *runtime_journal;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend JournalFile *system_journal;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend Hashmap *user_journals;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend uint64_t seqnum;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend char *buffer;
30471a4650391f57975f60bbb6e4a90be7b284bfhumbedooh size_t buffer_size;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend JournalRateLimit *rate_limit;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend usec_t rate_limit_interval;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend unsigned rate_limit_burst;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend JournalMetrics runtime_metrics;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend JournalMetrics system_metrics;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend bool compress;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend bool seal;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
8b7e19de6d547ab1ad4256316fbf0d2497f724f8humbedooh bool forward_to_kmsg;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend bool forward_to_syslog;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend bool forward_to_console;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend uint64_t cached_available_space;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend usec_t cached_available_space_timestamp;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend uint64_t var_available_timestamp;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend gid_t file_gid;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend bool file_gid_valid;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend LIST_HEAD(StdoutStream, stdout_streams);
d8925e7b1eb8644294705d7132173f6fcfe0350ahumbedooh unsigned n_stdout_streams;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend char *tty_path;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int max_level_store;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int max_level_syslog;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int max_level_kmsg;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend int max_level_console;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend Storage storage;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend MMapCache *mmap;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend bool dev_kmsg_readable;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend uint64_t *kernel_seqnum;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend} Server;
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend/* gperf lookup function */
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendconst struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendint config_parse_storage(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendconst char *storage_to_string(Storage s);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aendStorage storage_from_string(const char *s);
38dd0bd0209a7e29ea44e66bfc3bec8edc03e9aend