]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/emergency-action.h
Merge pull request #29458 from poettering/serialize-pidref
[thirdparty/systemd.git] / src / core / emergency-action.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2928b0a8
LP
2#pragma once
3
2d93c20e
ZJS
4#include <errno.h>
5
4870133b
LP
6#include "runtime-scope.h"
7
87a47f99
LN
8typedef enum EmergencyAction {
9 EMERGENCY_ACTION_NONE,
10 EMERGENCY_ACTION_REBOOT,
11 EMERGENCY_ACTION_REBOOT_FORCE,
12 EMERGENCY_ACTION_REBOOT_IMMEDIATE,
13 EMERGENCY_ACTION_POWEROFF,
14 EMERGENCY_ACTION_POWEROFF_FORCE,
15 EMERGENCY_ACTION_POWEROFF_IMMEDIATE,
54fcb619
ZJS
16 EMERGENCY_ACTION_EXIT,
17 _EMERGENCY_ACTION_FIRST_USER_ACTION = EMERGENCY_ACTION_EXIT,
18 EMERGENCY_ACTION_EXIT_FORCE,
13ffc607
LP
19 EMERGENCY_ACTION_SOFT_REBOOT,
20 EMERGENCY_ACTION_SOFT_REBOOT_FORCE,
3cf848f6
DDM
21 EMERGENCY_ACTION_KEXEC,
22 EMERGENCY_ACTION_KEXEC_FORCE,
23 EMERGENCY_ACTION_HALT,
24 EMERGENCY_ACTION_HALT_FORCE,
25 EMERGENCY_ACTION_HALT_IMMEDIATE,
87a47f99 26 _EMERGENCY_ACTION_MAX,
2d93c20e 27 _EMERGENCY_ACTION_INVALID = -EINVAL,
87a47f99 28} EmergencyAction;
2928b0a8 29
1710d4be
ZJS
30typedef enum EmergencyActionFlags {
31 EMERGENCY_ACTION_IS_WATCHDOG = 1 << 0,
c7adcb1a 32 EMERGENCY_ACTION_WARN = 1 << 1,
1710d4be
ZJS
33} EmergencyActionFlags;
34
2928b0a8
LP
35#include "macro.h"
36#include "manager.h"
37
36c4dc08
LP
38void emergency_action(Manager *m,
39 EmergencyAction action, EmergencyActionFlags options,
40 const char *reboot_arg, int exit_status, const char *reason);
2928b0a8 41
87a47f99
LN
42const char* emergency_action_to_string(EmergencyAction i) _const_;
43EmergencyAction emergency_action_from_string(const char *s) _pure_;
54fcb619 44
4870133b 45int parse_emergency_action(const char *value, RuntimeScope runtime_scope, EmergencyAction *ret);