journald-server.h revision 0a244b8ecb6dfcb381fe831dc2aa9bacb2c12975
5785N/A/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
5785N/A
5785N/A#pragma once
5785N/A
5785N/A/***
5785N/A This file is part of systemd.
5785N/A
5785N/A Copyright 2011 Lennart Poettering
5785N/A
5785N/A systemd is free software; you can redistribute it and/or modify it
5785N/A under the terms of the GNU Lesser General Public License as published by
5785N/A the Free Software Foundation; either version 2.1 of the License, or
5785N/A (at your option) any later version.
5785N/A
5785N/A systemd is distributed in the hope that it will be useful, but
5785N/A WITHOUT ANY WARRANTY; without even the implied warranty of
5785N/A MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5785N/A Lesser General Public License for more details.
5785N/A
5785N/A You should have received a copy of the GNU Lesser General Public License
5785N/A along with systemd; If not, see <http://www.gnu.org/licenses/>.
5785N/A***/
5785N/A
5785N/A#include <inttypes.h>
5785N/A#include <stdbool.h>
5785N/A#include <sys/epoll.h>
5785N/A#include <sys/types.h>
5785N/A#include <sys/socket.h>
5785N/A
5785N/A#include "journal-file.h"
5785N/A#include "hashmap.h"
5785N/A#include "util.h"
5785N/A#include "audit.h"
5785N/A#include "journald-rate-limit.h"
5785N/A#include "list.h"
5785N/A
5785N/Atypedef enum Storage {
5785N/A STORAGE_AUTO,
5785N/A STORAGE_VOLATILE,
5785N/A STORAGE_PERSISTENT,
5785N/A STORAGE_NONE,
5785N/A _STORAGE_MAX,
5785N/A _STORAGE_INVALID = -1
5785N/A} Storage;
5785N/A
5785N/Atypedef enum SplitMode {
5785N/A SPLIT_LOGIN,
5785N/A SPLIT_UID,
5785N/A SPLIT_NONE,
5785N/A _SPLIT_MAX,
5785N/A _SPLIT_INVALID = -1
5785N/A} SplitMode;
5785N/A
5785N/Atypedef struct StdoutStream StdoutStream;
5785N/A
5785N/Atypedef struct Server {
5785N/A int epoll_fd;
5785N/A int signal_fd;
5785N/A int syslog_fd;
5785N/A int native_fd;
5785N/A int stdout_fd;
5785N/A int dev_kmsg_fd;
5785N/A
5785N/A JournalFile *runtime_journal;
5785N/A JournalFile *system_journal;
5785N/A Hashmap *user_journals;
5785N/A
5785N/A uint64_t seqnum;
5785N/A
5785N/A char *buffer;
5785N/A size_t buffer_size;
5785N/A
5785N/A JournalRateLimit *rate_limit;
5785N/A usec_t sync_interval_usec;
5785N/A usec_t rate_limit_interval;
5785N/A unsigned rate_limit_burst;
5785N/A
5785N/A JournalMetrics runtime_metrics;
5785N/A JournalMetrics system_metrics;
5785N/A
5785N/A bool compress;
5785N/A bool seal;
5785N/A
5785N/A bool forward_to_kmsg;
5785N/A bool forward_to_syslog;
5785N/A bool forward_to_console;
5785N/A
5785N/A unsigned n_forward_syslog_missed;
5785N/A usec_t last_warn_forward_syslog_missed;
5785N/A
5785N/A uint64_t cached_available_space;
5785N/A usec_t cached_available_space_timestamp;
5785N/A
5785N/A uint64_t var_available_timestamp;
5785N/A
5785N/A usec_t max_retention_usec;
5785N/A usec_t max_file_usec;
5785N/A usec_t oldest_file_usec;
5785N/A
5785N/A gid_t file_gid;
5785N/A bool file_gid_valid;
5785N/A
5785N/A LIST_HEAD(StdoutStream, stdout_streams);
5785N/A unsigned n_stdout_streams;
5785N/A
5785N/A char *tty_path;
5785N/A
5785N/A int max_level_store;
5785N/A int max_level_syslog;
5785N/A int max_level_kmsg;
5785N/A int max_level_console;
5785N/A
5785N/A Storage storage;
5785N/A SplitMode split_mode;
5785N/A
5785N/A MMapCache *mmap;
5785N/A
5785N/A bool dev_kmsg_readable;
5785N/A
5785N/A uint64_t *kernel_seqnum;
5785N/A
5785N/A struct udev *udev;
5785N/A
5785N/A int sync_timer_fd;
5785N/A bool sync_scheduled;
5785N/A} Server;
5785N/A
5785N/A#define N_IOVEC_META_FIELDS 20
5785N/A#define N_IOVEC_KERNEL_FIELDS 64
5785N/A#define N_IOVEC_UDEV_FIELDS 32
5785N/A#define N_IOVEC_OBJECT_FIELDS 11
5785N/A
5785N/Avoid 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, pid_t object_pid);
5785N/Avoid server_driver_message(Server *s, sd_id128_t message_id, const char *format, ...) _printf_attr_(3,4);
5785N/A
5785N/A/* gperf lookup function */
5785N/Aconst struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length);
5785N/A
5785N/Aint config_parse_storage(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
5785N/A
5785N/Aconst char *storage_to_string(Storage s) _const_;
5785N/AStorage storage_from_string(const char *s) _pure_;
5785N/A
5785N/Aint config_parse_split_mode(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
5785N/A
5785N/Aconst char *split_mode_to_string(SplitMode s) _const_;
5785N/ASplitMode split_mode_from_string(const char *s) _pure_;
5785N/A
5785N/Avoid server_fix_perms(Server *s, JournalFile *f, uid_t uid);
5785N/Abool shall_try_append_again(JournalFile *f, int r);
5785N/Aint server_init(Server *s);
5785N/Avoid server_done(Server *s);
5785N/Avoid server_sync(Server *s);
5785N/Avoid server_vacuum(Server *s);
5785N/Avoid server_rotate(Server *s);
5785N/Aint server_schedule_sync(Server *s, int priority);
5785N/Aint server_flush_to_var(Server *s);
5785N/Aint process_event(Server *s, struct epoll_event *ev);
5785N/Avoid server_maybe_append_tags(Server *s);
5785N/A