1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include <errno.h>
5 
6 typedef enum EmergencyAction {
7         EMERGENCY_ACTION_NONE,
8         EMERGENCY_ACTION_REBOOT,
9         EMERGENCY_ACTION_REBOOT_FORCE,
10         EMERGENCY_ACTION_REBOOT_IMMEDIATE,
11         EMERGENCY_ACTION_POWEROFF,
12         EMERGENCY_ACTION_POWEROFF_FORCE,
13         EMERGENCY_ACTION_POWEROFF_IMMEDIATE,
14         EMERGENCY_ACTION_EXIT,
15         _EMERGENCY_ACTION_FIRST_USER_ACTION = EMERGENCY_ACTION_EXIT,
16         EMERGENCY_ACTION_EXIT_FORCE,
17         _EMERGENCY_ACTION_MAX,
18         _EMERGENCY_ACTION_INVALID = -EINVAL,
19 } EmergencyAction;
20 
21 typedef enum EmergencyActionFlags {
22         EMERGENCY_ACTION_IS_WATCHDOG = 1 << 0,
23         EMERGENCY_ACTION_WARN        = 1 << 1,
24 } EmergencyActionFlags;
25 
26 #include "macro.h"
27 #include "manager.h"
28 
29 void emergency_action(Manager *m,
30                       EmergencyAction action, EmergencyActionFlags options,
31                       const char *reboot_arg, int exit_status, const char *reason);
32 
33 const char* emergency_action_to_string(EmergencyAction i) _const_;
34 EmergencyAction emergency_action_from_string(const char *s) _pure_;
35 
36 int parse_emergency_action(const char *value, bool system, EmergencyAction *ret);
37