summaryrefslogtreecommitdiff
path: root/src/sleep/sleep.c
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2018-08-20 09:32:10 +0200
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit347760af00d87762b3809111d8975023912ed7cc (patch)
tree84e9df7ff0cac68c6ef50fd1006607292e054aaa /src/sleep/sleep.c
parent6655bb15f39fd491516671932c867864aca20869 (diff)
Prep v239: Fix sleep-config.[hc] and sleep/sleep.c to utilize upstream updates.
Diffstat (limited to 'src/sleep/sleep.c')
-rw-r--r--src/sleep/sleep.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c
index 455c14825..cf5f49bec 100644
--- a/src/sleep/sleep.c
+++ b/src/sleep/sleep.c
@@ -11,15 +11,15 @@
#include "sd-messages.h"
-//#include "parse-util.h"
+#include "parse-util.h"
#include "def.h"
#include "exec-util.h"
#include "fd-util.h"
#include "fileio.h"
//#include "log.h"
-//#include "sleep-config.h"
-//#include "stdio-util.h"
-//#include "string-util.h"
+#include "sleep-config.h"
+#include "stdio-util.h"
+#include "string-util.h"
#include "strv.h"
//#include "util.h"
@@ -219,6 +219,7 @@ static int execute_s2h(usec_t hibernate_delay_sec) {
char time_str[DECIMAL_STR_MAX(uint64_t)];
int r;
+#if 0 /// Already parsed by elogind config
r = parse_sleep_config("suspend", &suspend_modes, &suspend_states,
NULL);
if (r < 0)
@@ -228,6 +229,7 @@ static int execute_s2h(usec_t hibernate_delay_sec) {
&hibernate_states, NULL);
if (r < 0)
return r;
+#endif // 0
r = read_wakealarm(&orig_time);
if (r < 0)
@@ -347,17 +349,21 @@ int main(int argc, char *argv[]) {
if (r < 0)
goto finish;
+#else
+int do_sleep(const char *verb, char **modes, char **states, usec_t delay) {
+ int r;
+
+ assert(verb);
+ arg_verb = (char*)verb;
+#endif // 0
if (streq(arg_verb, "suspend-then-hibernate"))
r = execute_s2h(delay);
else
r = execute(modes, states);
+#if 0 /// In elogind we give the result back, no interpretation here.
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-}
#else
-int do_sleep(const char *verb, char **modes, char **states) {
- assert(verb);
- arg_verb = (char*)verb;
- return execute(modes, states);
+ return r;
}
#endif // 0