1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2012 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 #include "sleep-config.h"
29 static void test_sleep(void) {
30 _cleanup_strv_free_ char
31 **standby = strv_new("standby", NULL),
32 **mem = strv_new("mem", NULL),
33 **disk = strv_new("disk", NULL),
34 **suspend = strv_new("suspend", NULL),
35 **reboot = strv_new("reboot", NULL),
36 **platform = strv_new("platform", NULL),
37 **shutdown = strv_new("shutdown", NULL),
38 **freez = strv_new("freeze", NULL);
40 log_info("Standby configured: %s", yes_no(can_sleep_state(standby) > 0));
41 log_info("Suspend configured: %s", yes_no(can_sleep_state(mem) > 0));
42 log_info("Hibernate configured: %s", yes_no(can_sleep_state(disk) > 0));
43 log_info("Hibernate+Suspend (Hybrid-Sleep) configured: %s", yes_no(can_sleep_disk(suspend) > 0));
44 log_info("Hibernate+Reboot configured: %s", yes_no(can_sleep_disk(reboot) > 0));
45 log_info("Hibernate+Platform configured: %s", yes_no(can_sleep_disk(platform) > 0));
46 log_info("Hibernate+Shutdown configured: %s", yes_no(can_sleep_disk(shutdown) > 0));
47 log_info("Freeze configured: %s", yes_no(can_sleep_state(freez) > 0));
49 log_info("Suspend configured and possible: %s", yes_no(can_sleep("suspend") > 0));
50 log_info("Hibernation configured and possible: %s", yes_no(can_sleep("hibernate") > 0));
51 log_info("Hybrid-sleep configured and possible: %s", yes_no(can_sleep("hybrid-sleep") > 0));
54 int main(int argc, char* argv[]) {
55 log_parse_environment();
59 log_warning("This program is unlikely to work for unpriviledged users");