mirror of
https://github.com/sheumann/hush.git
synced 2025-01-12 14:30:54 +00:00
fix watchdog on no-mmu systems by adding -F option for rexec
This commit is contained in:
parent
42705abc28
commit
cd68a2e1a8
@ -3372,11 +3372,12 @@ USE_FEATURE_START_STOP_DAEMON_FANCY( \
|
|||||||
"Mon Dec 17 10:31:44 GMT 2000"
|
"Mon Dec 17 10:31:44 GMT 2000"
|
||||||
|
|
||||||
#define watchdog_trivial_usage \
|
#define watchdog_trivial_usage \
|
||||||
"[-t <seconds>] DEV"
|
"[-t <seconds>] [-F] DEV"
|
||||||
#define watchdog_full_usage \
|
#define watchdog_full_usage \
|
||||||
"Periodically write to watchdog device DEV.\n" \
|
"Periodically write to watchdog device DEV.\n" \
|
||||||
"Options:\n" \
|
"Options:\n" \
|
||||||
"\t-t\tTimer period in seconds - default is 30"
|
"\t-t\tTimer period in seconds - default is 30\n" \
|
||||||
|
"\t-F\tStay in the foreground and don't fork"
|
||||||
|
|
||||||
#define wc_trivial_usage \
|
#define wc_trivial_usage \
|
||||||
"[OPTION]... [FILE]..."
|
"[OPTION]... [FILE]..."
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
|
#define OPT_FOREGROUND 0x01
|
||||||
|
#define OPT_TIMER 0x02
|
||||||
|
|
||||||
/* Watchdog file descriptor */
|
/* Watchdog file descriptor */
|
||||||
static int fd;
|
static int fd;
|
||||||
|
|
||||||
@ -27,10 +30,13 @@ static void watchdog_shutdown(int ATTRIBUTE_UNUSED unused)
|
|||||||
|
|
||||||
int watchdog_main(int argc, char **argv)
|
int watchdog_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
unsigned long opts;
|
||||||
unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
|
unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
|
||||||
char *t_arg;
|
char *t_arg;
|
||||||
|
|
||||||
if (bb_getopt_ulflags(argc, argv, "t:", &t_arg))
|
opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg);
|
||||||
|
|
||||||
|
if (opts & OPT_TIMER)
|
||||||
timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);
|
timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);
|
||||||
|
|
||||||
/* We're only interested in the watchdog device .. */
|
/* We're only interested in the watchdog device .. */
|
||||||
@ -38,7 +44,8 @@ int watchdog_main(int argc, char **argv)
|
|||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
|
||||||
#ifdef BB_NOMMU
|
#ifdef BB_NOMMU
|
||||||
vfork_daemon(0, 1);
|
if (!(opts & OPT_FOREGROUND))
|
||||||
|
vfork_daemon_rexec(0, 1, argc, argv, "-F");
|
||||||
#else
|
#else
|
||||||
bb_xdaemon(0, 1);
|
bb_xdaemon(0, 1);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user