chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Prep v239: Fix sleep-config.[hc] and sleep/sleep.c to utilize upstream updates.
[elogind.git]
/
src
/
sleep
/
sleep.c
diff --git
a/src/sleep/sleep.c
b/src/sleep/sleep.c
index 455c14825ac42f75b692e39a778233915279ce19..cf5f49bec65b003c763720921a2ece6f61521cec 100644
(file)
--- a/
src/sleep/sleep.c
+++ b/
src/sleep/sleep.c
@@
-11,15
+11,15
@@
#include "sd-messages.h"
#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 "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"
#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;
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)
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;
&hibernate_states, NULL);
if (r < 0)
return r;
+#endif // 0
r = read_wakealarm(&orig_time);
if (r < 0)
r = read_wakealarm(&orig_time);
if (r < 0)
@@
-347,17
+349,21
@@
int main(int argc, char *argv[]) {
if (r < 0)
goto finish;
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 (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;
finish:
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
-}
#else
#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
}
#endif // 0