mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
core: move CrashAction enum def to crash-handler.[ch]
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "raw-clone.h"
|
||||
#include "rlimit-util.h"
|
||||
#include "signal-util.h"
|
||||
#include "string-table.h"
|
||||
#include "terminal-util.h"
|
||||
#include "virt.h"
|
||||
|
||||
@@ -188,3 +189,11 @@ void install_crash_handler(void) {
|
||||
if (r < 0)
|
||||
log_debug_errno(r, "I had trouble setting up the crash handler, ignoring: %m");
|
||||
}
|
||||
|
||||
static const char* const crash_action_table[_CRASH_ACTION_MAX] = {
|
||||
[CRASH_FREEZE] = "freeze",
|
||||
[CRASH_REBOOT] = "reboot",
|
||||
[CRASH_POWEROFF] = "poweroff",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(crash_action, CrashAction);
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "macro.h"
|
||||
|
||||
typedef enum CrashAction {
|
||||
CRASH_FREEZE,
|
||||
CRASH_REBOOT,
|
||||
CRASH_POWEROFF,
|
||||
_CRASH_ACTION_MAX,
|
||||
_CRASH_ACTION_INVALID = -EINVAL,
|
||||
} CrashAction;
|
||||
|
||||
const char* crash_action_to_string(CrashAction action);
|
||||
CrashAction crash_action_from_string(const char *action);
|
||||
|
||||
_noreturn_ void freeze_or_exit_or_reboot(void);
|
||||
void install_crash_handler(void);
|
||||
|
||||
@@ -93,7 +93,6 @@
|
||||
#include "special.h"
|
||||
#include "stat-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-table.h"
|
||||
#include "strv.h"
|
||||
#include "switch-root.h"
|
||||
#include "sysctl-util.h"
|
||||
@@ -168,14 +167,6 @@ static char **saved_env = NULL;
|
||||
static int parse_configuration(const struct rlimit *saved_rlimit_nofile,
|
||||
const struct rlimit *saved_rlimit_memlock);
|
||||
|
||||
static const char* const crash_action_table[_CRASH_ACTION_MAX] = {
|
||||
[CRASH_FREEZE] = "freeze",
|
||||
[CRASH_REBOOT] = "reboot",
|
||||
[CRASH_POWEROFF] = "poweroff",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(crash_action, CrashAction);
|
||||
|
||||
static DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_crash_action, crash_action, CrashAction, CRASH_FREEZE);
|
||||
|
||||
static int manager_find_user_config_paths(char ***ret_files, char ***ret_dirs) {
|
||||
|
||||
@@ -1,20 +1,8 @@
|
||||
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
||||
#pragma once
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef enum CrashAction {
|
||||
CRASH_FREEZE,
|
||||
CRASH_REBOOT,
|
||||
CRASH_POWEROFF,
|
||||
_CRASH_ACTION_MAX,
|
||||
_CRASH_ACTION_INVALID = -EINVAL,
|
||||
} CrashAction;
|
||||
|
||||
const char* crash_action_to_string(CrashAction action);
|
||||
CrashAction crash_action_from_string(const char *action);
|
||||
|
||||
extern bool arg_dump_core;
|
||||
extern int arg_crash_chvt;
|
||||
extern bool arg_crash_shell;
|
||||
|
||||
Reference in New Issue
Block a user