blob: 3b9fbd0f79204e1c02379be8dd94ae16e46efe62 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*-
* Copyright (c) 2018 Ali Abdallah <ali@xfce.org>
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA.
*/
#ifndef __XFSM_SHUTDOWN_COMMON_H_
#define __XFSM_SHUTDOWN_COMMON_H_
#ifdef POWEROFF_CMD
#undef POWEROFF_CMD
#endif
#ifdef REBOOT_CMD
#undef REBOOT_CMD
#endif
#ifdef UP_BACKEND_SUSPEND_COMMAND
#undef UP_BACKEND_SUSPEND_COMMAND
#endif
#ifdef UP_BACKEND_HIBERNATE_COMMAND
#undef UP_BACKEND_HIBERNATE_COMMAND
#endif
/* On FreeBSD, NetBSD and DragonFly BSD users with write access to
* /dev/acpi can suspend/hibernate the system */
#define BSD_SLEEP_ACCESS_NODE "/dev/acpi"
/* On OpenBSD this is done via apmd, so we check /var/run/apmdev to see
* zzz and ZZZ commands can write to it*/
#ifdef BACKEND_TYPE_OPENBSD
#undef BSD_SLEEP_ACCESS_NODE
#define BSD_SLEEP_ACCESS_NODE "/var/run/apmdev"
#endif
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define POWEROFF_CMD "/sbin/shutdown -p now"
#define REBOOT_CMD "/sbin/shutdown -r now"
#elif defined(sun) || defined(__sun)
#define POWEROFF_CMD "/usr/sbin/shutdown -i 5 -g 0 -y"
#define REBOOT_CMD "/usr/sbin/shutdown -i 6 -g 0 -y"
#else
#define POWEROFF_CMD "/sbin/shutdown -h now"
#define REBOOT_CMD "/sbin/shutdown -r now"
#endif
#ifdef BACKEND_TYPE_FREEBSD
#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/acpiconf -s 3"
#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/acpiconf -s 4"
#endif
#ifdef BACKEND_TYPE_LINUX
#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend"
#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate"
#endif
#ifdef BACKEND_TYPE_OPENBSD
#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz"
#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/ZZZ"
#endif
#endif /* __XFSM_SHUTDOWN_COMMON_H_ */
|