diff options
author | Simon Rettberg | 2020-08-26 15:36:04 +0200 |
---|---|---|
committer | Simon Rettberg | 2020-08-26 15:36:04 +0200 |
commit | 784b6581d9478ce2cc73f47317350a596bb08cc3 (patch) | |
tree | 904019bf87ab35dab0a85f4c6086b6e87a7f7d63 /core/modules/busybox/rtcwake-compat.patch | |
parent | [run-virt] Fix load order of includes (diff) | |
download | mltk-784b6581d9478ce2cc73f47317350a596bb08cc3.tar.gz mltk-784b6581d9478ce2cc73f47317350a596bb08cc3.tar.xz mltk-784b6581d9478ce2cc73f47317350a596bb08cc3.zip |
[busybox] Fix rtcwake patch, add timeout backwars compat patch
Diffstat (limited to 'core/modules/busybox/rtcwake-compat.patch')
-rw-r--r-- | core/modules/busybox/rtcwake-compat.patch | 59 |
1 files changed, 28 insertions, 31 deletions
diff --git a/core/modules/busybox/rtcwake-compat.patch b/core/modules/busybox/rtcwake-compat.patch index 5b6ca615..54cb02d7 100644 --- a/core/modules/busybox/rtcwake-compat.patch +++ b/core/modules/busybox/rtcwake-compat.patch @@ -1,8 +1,8 @@ diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c -index 8aee0cf..6d6e168 100644 +index 29c440b..1bdf906 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c -@@ -122,7 +122,7 @@ int rtcwake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; +@@ -132,7 +132,7 @@ int rtcwake_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int rtcwake_main(int argc UNUSED_PARAM, char **argv) { unsigned opt; @@ -11,7 +11,7 @@ index 8aee0cf..6d6e168 100644 const char *suspend = "standby"; const char *opt_seconds; const char *opt_time; -@@ -134,6 +134,9 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) +@@ -144,6 +144,9 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) int utc = -1; int fd; @@ -21,19 +21,16 @@ index 8aee0cf..6d6e168 100644 #if ENABLE_LONG_OPTS static const char rtcwake_longopts[] ALIGN1 = "auto\0" No_argument "a" -@@ -147,9 +150,10 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) - applet_long_options = rtcwake_longopts; +@@ -157,7 +160,7 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) #endif - /* Must have -s or -t, exclusive */ -- opt_complementary = "s:t:s--t:t--s"; -+ opt_complementary = "s--t:t--s"; - opt = getopt32(argv, "alud:m:s:t:", &rtcname, &suspend, &opt_seconds, &opt_time); + opt = getopt32long(argv, + /* Must have -s or -t, exclusive */ +- "^alud:m:s:t:" "\0" "s:t:s--t:t--s", rtcwake_longopts, ++ "^alud:m:s:t:" "\0" "s--t:t--s", rtcwake_longopts, + &rtcname, &suspend, &opt_seconds, &opt_time); -+ /* this is the default - if (opt & RTCWAKE_OPT_AUTO) - utc = -1; -@@ -159,13 +163,16 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) +@@ -169,13 +172,16 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) if (opt & RTCWAKE_OPT_SECONDS) { /* alarm time, seconds-to-sleep (relative) */ seconds = xatou(opt_seconds); @@ -52,7 +49,7 @@ index 8aee0cf..6d6e168 100644 } if (utc == -1) -@@ -177,43 +184,51 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) +@@ -187,43 +193,51 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) /* this RTC must exist and (if we'll sleep) be wakeup-enabled */ fd = rtc_xopen(&rtcname, O_RDONLY); @@ -71,7 +68,21 @@ index 8aee0cf..6d6e168 100644 + if (strcmp(suspend, "on") != 0) + if (!may_wakeup(rtcname)) + bb_error_msg_and_die("%s not enabled for wakeup events", rtcname); -+ + +- if (opt & RTCWAKE_OPT_TIME) { +- /* Correct for RTC<->system clock difference */ +- alarm_time += rtc_time - sys_time; +- if (alarm_time < rtc_time) +- /* +- * Compat message text. +- * I'd say "RTC time is already ahead of ..." instead. +- */ +- bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); +- } else +- alarm_time = rtc_time + seconds + 1; +- +- setup_alarm(fd, &alarm_time, rtc_time); +- sync(); + /* relative or absolute alarm time, normalized to time_t */ + sys_time = time(NULL); + { @@ -93,21 +104,7 @@ index 8aee0cf..6d6e168 100644 + alarm_time = rtc_time + seconds + 1; + + is_general_alarm = (rtc_time + (24 * 60 * 60)) > alarm_time; - -- if (opt & RTCWAKE_OPT_TIME) { -- /* Correct for RTC<->system clock difference */ -- alarm_time += rtc_time - sys_time; -- if (alarm_time < rtc_time) -- /* -- * Compat message text. -- * I'd say "RTC time is already ahead of ..." instead. -- */ -- bb_error_msg_and_die("time doesn't go backward to %s", ctime(&alarm_time)); -- } else -- alarm_time = rtc_time + seconds + 1; -- -- setup_alarm(fd, &alarm_time, rtc_time); -- sync(); ++ + setup_alarm(fd, &alarm_time, rtc_time); + sync(); #if 0 /*debug*/ @@ -136,7 +133,7 @@ index 8aee0cf..6d6e168 100644 /* "fake" suspend ... we'll do the delay ourselves */ unsigned long data; -@@ -224,10 +239,27 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) +@@ -234,10 +248,27 @@ int rtcwake_main(int argc UNUSED_PARAM, char **argv) break; } } while (!(data & RTC_AF)); |