summaryrefslogtreecommitdiffstats
path: root/Documentation/watchdog/src/watchdog-test.c
diff options
context:
space:
mode:
authorJames Hogan2010-04-05 12:31:29 +0200
committerWim Van Sebroeck2010-04-06 16:23:55 +0200
commitdfc333834cb86805485920dc77ee0f2fbb484462 (patch)
treefe89d56964d20d1584570018896f7131d2f4cea7 /Documentation/watchdog/src/watchdog-test.c
parent[WATCHDOG] doc: watchdog simple example: don't fail on fsync() (diff)
downloadkernel-qcow2-linux-dfc333834cb86805485920dc77ee0f2fbb484462.tar.gz
kernel-qcow2-linux-dfc333834cb86805485920dc77ee0f2fbb484462.tar.xz
kernel-qcow2-linux-dfc333834cb86805485920dc77ee0f2fbb484462.zip
[WATCHDOG] doc: Fix use of WDIOC_SETOPTIONS ioctl.
In the watchdog-test program and watchdog-api.txt, pass the values to the WDIOC_SETOPTIONS ioctl as a pointer to an integer containing the values intead of directly in the third ioctl argument. The actual watchdog drivers in drivers/watchdog don't read the options directly from the argument but use get_user and copy_from_user. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'Documentation/watchdog/src/watchdog-test.c')
-rw-r--r--Documentation/watchdog/src/watchdog-test.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Documentation/watchdog/src/watchdog-test.c b/Documentation/watchdog/src/watchdog-test.c
index a750532ffcf8..63fdc34ceb98 100644
--- a/Documentation/watchdog/src/watchdog-test.c
+++ b/Documentation/watchdog/src/watchdog-test.c
@@ -31,6 +31,8 @@ static void keep_alive(void)
*/
int main(int argc, char *argv[])
{
+ int flags;
+
fd = open("/dev/watchdog", O_WRONLY);
if (fd == -1) {
@@ -41,12 +43,14 @@ int main(int argc, char *argv[])
if (argc > 1) {
if (!strncasecmp(argv[1], "-d", 2)) {
- ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);
+ flags = WDIOS_DISABLECARD;
+ ioctl(fd, WDIOC_SETOPTIONS, &flags);
fprintf(stderr, "Watchdog card disabled.\n");
fflush(stderr);
exit(0);
} else if (!strncasecmp(argv[1], "-e", 2)) {
- ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
+ flags = WDIOS_ENABLECARD;
+ ioctl(fd, WDIOC_SETOPTIONS, &flags);
fprintf(stderr, "Watchdog card enabled.\n");
fflush(stderr);
exit(0);