watchdog-api / documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Wim,

I noticed, that the IOCTL WDIOC_SETOPTIONS behaves differently between watchdog drivers.
For w83697hf_wdt the argument to the IOCTL is "by-reference" but for pcwd (it seems to me) 
and according to the watchdog-documentation
- Documentation/watchdog/src/watchdog-test.c
- Documentation/watchdog/watchdog-api.txt
it is "by-value". Which one is correct? I adjusted the watchdog-test.c (see patch) to work for me.

Regards,
Dominik


--- linux-2.6.25.3.orig/Documentation/watchdog/src/watchdog-test.c	2008-05-14 23:58:37.000000000 +0100
+++ linux-2.6.25.3/Documentation/watchdog/src/watchdog-test.c	2008-05-17 00:19:14.000000000 +0200
@@ -31,6 +31,7 @@
  */
 int main(int argc, char *argv[])
 {
+    int options;
     fd = open("/dev/watchdog", O_WRONLY);
 
     if (fd == -1) {
@@ -41,12 +42,14 @@
 
     if (argc > 1) {
 	if (!strncasecmp(argv[1], "-d", 2)) {
-	    ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);
+	    options = WDIOS_DISABLECARD;
+	    ioctl(fd, WDIOC_SETOPTIONS, &options);
 	    fprintf(stderr, "Watchdog card disabled.\n");
 	    fflush(stderr);
 	    exit(0);
 	} else if (!strncasecmp(argv[1], "-e", 2)) {
-	    ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
+	    options = WDIOS_ENABLECARD;
+	    ioctl(fd, WDIOC_SETOPTIONS, &options);
 	    fprintf(stderr, "Watchdog card enabled.\n");
 	    fflush(stderr);
 	    exit(0);
--- linux-2.6.25.3.orig/Documentation/watchdog/src/watchdog-test.c	2008-05-14 23:58:37.000000000 +0100
+++ linux-2.6.25.3/Documentation/watchdog/src/watchdog-test.c	2008-05-17 00:19:14.000000000 +0200
@@ -31,6 +31,7 @@
  */
 int main(int argc, char *argv[])
 {
+    int options;
     fd = open("/dev/watchdog", O_WRONLY);
 
     if (fd == -1) {
@@ -41,12 +42,14 @@
 
     if (argc > 1) {
 	if (!strncasecmp(argv[1], "-d", 2)) {
-	    ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);
+	    options = WDIOS_DISABLECARD;
+	    ioctl(fd, WDIOC_SETOPTIONS, &options);
 	    fprintf(stderr, "Watchdog card disabled.\n");
 	    fflush(stderr);
 	    exit(0);
 	} else if (!strncasecmp(argv[1], "-e", 2)) {
-	    ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
+	    options = WDIOS_ENABLECARD;
+	    ioctl(fd, WDIOC_SETOPTIONS, &options);
 	    fprintf(stderr, "Watchdog card enabled.\n");
 	    fflush(stderr);
 	    exit(0);

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux