aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-01-25 23:40:32 +0000
committerEric Andersen <andersen@codepoet.org>2001-01-25 23:40:32 +0000
commitffde8673fe8b2c32076aa3e01eab1fefc5f08e86 (patch)
treeca0bf058a242ffb3d2f10d8f862d47a6557cd8eb
parent8ba1b1120ee08b281f8bae2837c8f3307d166872 (diff)
downloadbusybox-w32-ffde8673fe8b2c32076aa3e01eab1fefc5f08e86.tar.gz
busybox-w32-ffde8673fe8b2c32076aa3e01eab1fefc5f08e86.tar.bz2
busybox-w32-ffde8673fe8b2c32076aa3e01eab1fefc5f08e86.zip
Add in spoon's watchdog timer app.
-Erik
-rw-r--r--Config.h13
-rw-r--r--applets.h3
-rw-r--r--applets/usage.c9
-rw-r--r--docs/busybox.pod18
-rw-r--r--docs/busybox.sgml12
-rw-r--r--include/applets.h3
-rw-r--r--miscutils/watchdog.c45
-rw-r--r--usage.c9
-rw-r--r--watchdog.c45
9 files changed, 146 insertions, 11 deletions
diff --git a/Config.h b/Config.h
index 1df72f301..667612cb5 100644
--- a/Config.h
+++ b/Config.h
@@ -103,12 +103,6 @@
103//#define BB_TR 103//#define BB_TR
104#define BB_TRUE_FALSE 104#define BB_TRUE_FALSE
105#define BB_TTY 105#define BB_TTY
106#define BB_UPTIME
107//#define BB_USLEEP
108#define BB_WC
109//#define BB_WGET
110#define BB_WHICH
111#define BB_WHOAMI
112//#define BB_UUENCODE 106//#define BB_UUENCODE
113//#define BB_UUDECODE 107//#define BB_UUDECODE
114#define BB_UMOUNT 108#define BB_UMOUNT
@@ -116,6 +110,13 @@
116#define BB_UNAME 110#define BB_UNAME
117//#define BB_UNIX2DOS 111//#define BB_UNIX2DOS
118//#define BB_UPDATE 112//#define BB_UPDATE
113#define BB_UPTIME
114//#define BB_USLEEP
115//#define BB_WATCHDOG
116#define BB_WC
117//#define BB_WGET
118#define BB_WHICH
119#define BB_WHOAMI
119#define BB_XARGS 120#define BB_XARGS
120#define BB_YES 121#define BB_YES
121// End of Applications List 122// End of Applications List
diff --git a/applets.h b/applets.h
index 4837cb564..80ff1feb3 100644
--- a/applets.h
+++ b/applets.h
@@ -362,6 +362,9 @@ const struct BB_applet applets[] = {
362#ifdef BB_UUENCODE 362#ifdef BB_UUENCODE
363 APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage) 363 APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
364#endif 364#endif
365#ifdef BB_WATCHDOG
366 APPLET("watchdog", watchdog_main, _BB_DIR_SBIN, watchdog_usage)
367#endif
365#ifdef BB_WC 368#ifdef BB_WC
366 APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage) 369 APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
367#endif 370#endif
diff --git a/applets/usage.c b/applets/usage.c
index 534958e7d..a27ff92e2 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -1487,6 +1487,15 @@ const char uuencode_usage[] =
1487 ; 1487 ;
1488#endif 1488#endif
1489 1489
1490#if defined BB_WATCHDOG
1491const char watchdog_usage[] =
1492 "watchdog dev\n"
1493#ifndef BB_FEATURE_TRIVIAL_HELP
1494 "\nPeriodically write to watchdog device \"dev\".\n"
1495#endif
1496 ;
1497#endif
1498
1490#if defined BB_WC 1499#if defined BB_WC
1491const char wc_usage[] = 1500const char wc_usage[] =
1492 "wc [OPTION]... [FILE]..." 1501 "wc [OPTION]... [FILE]..."
diff --git a/docs/busybox.pod b/docs/busybox.pod
index e3da284f1..4c0810234 100644
--- a/docs/busybox.pod
+++ b/docs/busybox.pod
@@ -62,10 +62,10 @@ gunzip, gzip, halt, head, hostid, hostname, id, init, insmod, kill, killall,
62length, ln, loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs, 62length, ln, loadacm, loadfont, loadkmap, logger, logname, ls, lsmod, makedevs,
63mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc, 63mkdir, mkfifo, mkfs.minix, mknod, mkswap, mktemp, more, mount, mt, mv, nc,
64nslookup, ping, poweroff, printf, ps, pwd, rdate, reboot, renice, reset, rm, 64nslookup, ping, poweroff, printf, ps, pwd, rdate, reboot, renice, reset, rm,
65rmdir, rmmod, sed, setkeycodes, sh, sleep, sort, swapoff, swapon, sync, syslogd, 65rmdir, rmmod, sed, setkeycodes, sh, sleep, sort, swapoff, swapon, sync,
66tail, tar, tee, telnet, test, touch, tr, true, tty, umount, uname, uniq, 66syslogd, tail, tar, tee, telnet, test, touch, tr, true, tty, umount, uname,
67unix2dos, unrpm, update, uptime, usleep, uudecode, uuencode, wc, which, whoami, 67uniq, unix2dos, unrpm, update, uptime, usleep, uudecode, uuencode, watchdog,
68xargs, yes, zcat, [ 68wc, which, whoami, xargs, yes, zcat, [
69 69
70------------------------------- 70-------------------------------
71 71
@@ -2095,6 +2095,14 @@ Example:
2095 2095
2096------------------------------- 2096-------------------------------
2097 2097
2098=item watchdog
2099
2100Usage: watchdog device
2101
2102Periodically writes to watchdog device B<device>.
2103
2104-------------------------------
2105
2098=item wc 2106=item wc
2099 2107
2100Usage: wc [OPTION]... [FILE]... 2108Usage: wc [OPTION]... [FILE]...
@@ -2322,4 +2330,4 @@ Enrique Zanardi <ezanardi@ull.es>
2322 2330
2323=cut 2331=cut
2324 2332
2325# $Id: busybox.pod,v 1.88 2001/01/25 05:12:02 andersen Exp $ 2333# $Id: busybox.pod,v 1.89 2001/01/25 23:40:32 andersen Exp $
diff --git a/docs/busybox.sgml b/docs/busybox.sgml
index 58d7df859..017d0d1f5 100644
--- a/docs/busybox.sgml
+++ b/docs/busybox.sgml
@@ -3660,6 +3660,18 @@
3660 </para> 3660 </para>
3661 </sect1> 3661 </sect1>
3662 3662
3663 <sect1 id="watchdog">
3664 <title>watchdog</title>
3665
3666 <para>
3667 Usage: watchdog device
3668 </para>
3669
3670 <para>
3671 Periodically writes to watchdog device B<device>.
3672 </para>
3673 </sect1>
3674
3663 <sect1 id="wc"> 3675 <sect1 id="wc">
3664 <title>wc</title> 3676 <title>wc</title>
3665 3677
diff --git a/include/applets.h b/include/applets.h
index 4837cb564..80ff1feb3 100644
--- a/include/applets.h
+++ b/include/applets.h
@@ -362,6 +362,9 @@ const struct BB_applet applets[] = {
362#ifdef BB_UUENCODE 362#ifdef BB_UUENCODE
363 APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage) 363 APPLET("uuencode", uuencode_main, _BB_DIR_USR_BIN, uuencode_usage)
364#endif 364#endif
365#ifdef BB_WATCHDOG
366 APPLET("watchdog", watchdog_main, _BB_DIR_SBIN, watchdog_usage)
367#endif
365#ifdef BB_WC 368#ifdef BB_WC
366 APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage) 369 APPLET("wc", wc_main, _BB_DIR_USR_BIN, wc_usage)
367#endif 370#endif
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
new file mode 100644
index 000000000..d297afa02
--- /dev/null
+++ b/miscutils/watchdog.c
@@ -0,0 +1,45 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini watchdog implementation for busybox
4 *
5 * Copyright (C) 2000 spoon <spoon@ix.netcom.com>.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include "busybox.h"
24#include <stdio.h>
25#include <fcntl.h>
26
27extern int watchdog_main(int argc, char **argv)
28{
29 int fd;
30
31 if (argc != 2) {
32 usage(watchdog_usage);
33 }
34
35 if ((fd=open(argv[1], O_WRONLY)) == -1) {
36 perror_msg_and_die(argv[1]);
37 }
38
39 while (1) {
40 sleep(30);
41 write(fd, "\0", 1);
42 }
43
44 return EXIT_FAILURE;
45}
diff --git a/usage.c b/usage.c
index 534958e7d..a27ff92e2 100644
--- a/usage.c
+++ b/usage.c
@@ -1487,6 +1487,15 @@ const char uuencode_usage[] =
1487 ; 1487 ;
1488#endif 1488#endif
1489 1489
1490#if defined BB_WATCHDOG
1491const char watchdog_usage[] =
1492 "watchdog dev\n"
1493#ifndef BB_FEATURE_TRIVIAL_HELP
1494 "\nPeriodically write to watchdog device \"dev\".\n"
1495#endif
1496 ;
1497#endif
1498
1490#if defined BB_WC 1499#if defined BB_WC
1491const char wc_usage[] = 1500const char wc_usage[] =
1492 "wc [OPTION]... [FILE]..." 1501 "wc [OPTION]... [FILE]..."
diff --git a/watchdog.c b/watchdog.c
new file mode 100644
index 000000000..d297afa02
--- /dev/null
+++ b/watchdog.c
@@ -0,0 +1,45 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini watchdog implementation for busybox
4 *
5 * Copyright (C) 2000 spoon <spoon@ix.netcom.com>.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#include "busybox.h"
24#include <stdio.h>
25#include <fcntl.h>
26
27extern int watchdog_main(int argc, char **argv)
28{
29 int fd;
30
31 if (argc != 2) {
32 usage(watchdog_usage);
33 }
34
35 if ((fd=open(argv[1], O_WRONLY)) == -1) {
36 perror_msg_and_die(argv[1]);
37 }
38
39 while (1) {
40 sleep(30);
41 write(fd, "\0", 1);
42 }
43
44 return EXIT_FAILURE;
45}