diff options
author | Ron Yorston <rmy@pobox.com> | 2021-05-14 08:17:12 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-05-14 08:17:12 +0100 |
commit | a3f5a1b7f4275f713acf22f534f95c0da8392e53 (patch) | |
tree | 49b65422a3e9c33f508da9ccf3ae79d324bd9e96 /miscutils | |
parent | 375cda9a88024135d630ca8990d9aff4ea414e89 (diff) | |
parent | 7de0ab21d939a5a304157f75918d0318a95261a3 (diff) | |
download | busybox-w32-a3f5a1b7f4275f713acf22f534f95c0da8392e53.tar.gz busybox-w32-a3f5a1b7f4275f713acf22f534f95c0da8392e53.tar.bz2 busybox-w32-a3f5a1b7f4275f713acf22f534f95c0da8392e53.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/bc.c | 4 | ||||
-rw-r--r-- | miscutils/dc.c | 1 | ||||
-rw-r--r-- | miscutils/time.c | 7 | ||||
-rw-r--r-- | miscutils/watchdog.c | 26 |
4 files changed, 31 insertions, 7 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 4eb0f2d30..d74ab1da2 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c | |||
@@ -108,14 +108,14 @@ | |||
108 | 108 | ||
109 | //See www.gnu.org/software/bc/manual/bc.html | 109 | //See www.gnu.org/software/bc/manual/bc.html |
110 | //usage:#define bc_trivial_usage | 110 | //usage:#define bc_trivial_usage |
111 | //usage: "[-sqlw] FILE..." | 111 | //usage: "[-sqlw] [FILE...]" |
112 | //usage: | 112 | //usage: |
113 | //usage:#define bc_full_usage "\n" | 113 | //usage:#define bc_full_usage "\n" |
114 | //usage: "\nArbitrary precision calculator" | 114 | //usage: "\nArbitrary precision calculator" |
115 | //usage: "\n" | 115 | //usage: "\n" |
116 | ///////: "\n -i Interactive" - has no effect for now | 116 | ///////: "\n -i Interactive" - has no effect for now |
117 | //usage: "\n -q Quiet" | 117 | //usage: "\n -q Quiet" |
118 | //usage: "\n -l Load standard math library" | 118 | //usage: "\n -l Load standard library" |
119 | //usage: "\n -s Be POSIX compatible" | 119 | //usage: "\n -s Be POSIX compatible" |
120 | //usage: "\n -w Warn if extensions are used" | 120 | //usage: "\n -w Warn if extensions are used" |
121 | ///////: "\n -v Version" | 121 | ///////: "\n -v Version" |
diff --git a/miscutils/dc.c b/miscutils/dc.c index 918f2b5c8..d6369fd15 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c | |||
@@ -229,6 +229,7 @@ static void stack_machine(const char *argument) | |||
229 | const struct op *o; | 229 | const struct op *o; |
230 | 230 | ||
231 | next: | 231 | next: |
232 | //TODO: needs setlocale(LC_NUMERIC, "C")? | ||
232 | number = strtod(argument, &end); | 233 | number = strtod(argument, &end); |
233 | if (end != argument) { | 234 | if (end != argument) { |
234 | argument = end; | 235 | argument = end; |
diff --git a/miscutils/time.c b/miscutils/time.c index 12c540211..ac37a1375 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
@@ -42,6 +42,13 @@ | |||
42 | 42 | ||
43 | #include "libbb.h" | 43 | #include "libbb.h" |
44 | 44 | ||
45 | #ifndef HAVE_WAIT3 | ||
46 | static pid_t wait3(int *status, int options, struct rusage *rusage) | ||
47 | { | ||
48 | return wait4(-1, status, options, rusage); | ||
49 | } | ||
50 | #endif | ||
51 | |||
45 | /* Information on the resources used by a child process. */ | 52 | /* Information on the resources used by a child process. */ |
46 | typedef struct { | 53 | typedef struct { |
47 | int waitstatus; | 54 | int waitstatus; |
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index 0ed10bcf1..d8e9c78f5 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c | |||
@@ -18,6 +18,21 @@ | |||
18 | //config: watchdog applet ever fails to write the magic character within a | 18 | //config: watchdog applet ever fails to write the magic character within a |
19 | //config: certain amount of time, the watchdog device assumes the system has | 19 | //config: certain amount of time, the watchdog device assumes the system has |
20 | //config: hung, and will cause the hardware to reboot. | 20 | //config: hung, and will cause the hardware to reboot. |
21 | //config: | ||
22 | //config:config FEATURE_WATCHDOG_OPEN_TWICE | ||
23 | //config: bool "Open watchdog device twice, closing it gracefully in between" | ||
24 | //config: depends on WATCHDOG | ||
25 | //config: default n # this behavior was essentially a hack for a broken driver | ||
26 | //config: help | ||
27 | //config: When enabled, the watchdog device is opened and then immediately | ||
28 | //config: magic-closed, before being opened a second time. This may be necessary | ||
29 | //config: for some watchdog devices, but can cause spurious warnings in the | ||
30 | //config: kernel log if the nowayout feature is enabled. If this workaround | ||
31 | //config: is really needed for you machine to work properly, consider whether | ||
32 | //config: it should be fixed in the kernel driver instead. Even when disabled, | ||
33 | //config: the behaviour is easily emulated with a "printf 'V' > /dev/watchdog" | ||
34 | //config: immediately before starting the busybox watchdog daemon. Say n unless | ||
35 | //config: you know that you absolutely need this. | ||
21 | 36 | ||
22 | //applet:IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, BB_SUID_DROP)) | 37 | //applet:IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, BB_SUID_DROP)) |
23 | 38 | ||
@@ -50,10 +65,6 @@ | |||
50 | # define WDIOS_ENABLECARD 2 | 65 | # define WDIOS_ENABLECARD 2 |
51 | #endif | 66 | #endif |
52 | 67 | ||
53 | #define OPT_FOREGROUND (1 << 0) | ||
54 | #define OPT_STIMER (1 << 1) | ||
55 | #define OPT_HTIMER (1 << 2) | ||
56 | |||
57 | static void shutdown_watchdog(void) | 68 | static void shutdown_watchdog(void) |
58 | { | 69 | { |
59 | static const char V = 'V'; | 70 | static const char V = 'V'; |
@@ -73,6 +84,7 @@ static void watchdog_open(const char* device) | |||
73 | /* Use known fd # - avoid needing global 'int fd' */ | 84 | /* Use known fd # - avoid needing global 'int fd' */ |
74 | xmove_fd(xopen(device, O_WRONLY), 3); | 85 | xmove_fd(xopen(device, O_WRONLY), 3); |
75 | 86 | ||
87 | #if ENABLE_FEATURE_WATCHDOG_OPEN_TWICE | ||
76 | /* If the watchdog driver can do something other than cause a reboot | 88 | /* If the watchdog driver can do something other than cause a reboot |
77 | * on a timeout, then it's possible this program may be starting from | 89 | * on a timeout, then it's possible this program may be starting from |
78 | * a state when the watchdog hadn't been previously stopped with | 90 | * a state when the watchdog hadn't been previously stopped with |
@@ -82,6 +94,7 @@ static void watchdog_open(const char* device) | |||
82 | shutdown_watchdog(); | 94 | shutdown_watchdog(); |
83 | 95 | ||
84 | xmove_fd(xopen(device, O_WRONLY), 3); | 96 | xmove_fd(xopen(device, O_WRONLY), 3); |
97 | #endif | ||
85 | } | 98 | } |
86 | 99 | ||
87 | int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 100 | int watchdog_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
@@ -100,6 +113,9 @@ int watchdog_main(int argc UNUSED_PARAM, char **argv) | |||
100 | char *st_arg; | 113 | char *st_arg; |
101 | char *ht_arg; | 114 | char *ht_arg; |
102 | 115 | ||
116 | #define OPT_FOREGROUND (1 << 0) | ||
117 | #define OPT_STIMER (1 << 1) | ||
118 | #define OPT_HTIMER (1 << 2) | ||
103 | opts = getopt32(argv, "^" "Ft:T:" "\0" "=1"/*must have exactly 1 arg*/, | 119 | opts = getopt32(argv, "^" "Ft:T:" "\0" "=1"/*must have exactly 1 arg*/, |
104 | &st_arg, &ht_arg | 120 | &st_arg, &ht_arg |
105 | ); | 121 | ); |
@@ -132,7 +148,7 @@ int watchdog_main(int argc UNUSED_PARAM, char **argv) | |||
132 | #if 0 | 148 | #if 0 |
133 | ioctl_or_warn(3, WDIOC_GETTIMEOUT, &htimer_duration); | 149 | ioctl_or_warn(3, WDIOC_GETTIMEOUT, &htimer_duration); |
134 | printf("watchdog: SW timer is %dms, HW timer is %ds\n", | 150 | printf("watchdog: SW timer is %dms, HW timer is %ds\n", |
135 | stimer_duration, htimer_duration * 1000); | 151 | stimer_duration, htimer_duration); |
136 | #endif | 152 | #endif |
137 | 153 | ||
138 | write_pidfile_std_path_and_ext("watchdog"); | 154 | write_pidfile_std_path_and_ext("watchdog"); |