return to first page linux journal archive
keywordscontents
*** watchdog.c-dist     Wed Aug 28 23:24:08 1996
--- watchdog.c  Tue Feb  4 17:36:24 1997
***************
*** 10,15 ****
--- 10,17 ----
  #include <fcntl.h>
  #include <sys/ioctl.h>
  #include <linux/pcwd.h>
+ #include <sys/types.h>
+ #include <sys/wait.h>
  
  #define       WD_DRIVER_VER   "0.22"
  
***************
*** 22,29 ****
      printf("PC Watchdog %s running.\n", WD_DRIVER_VER);
  
      while(1) {
!       ioctl(fd, WDIOC_KEEPALIVE, &dummy);
!       sleep(loop_time);
      }
  }
  
--- 24,36 ----
      printf("PC Watchdog %s running.\n", WD_DRIVER_VER);
  
      while(1) {
!       if (fork() == 0) {
!           ioctl(fd, WDIOC_KEEPALIVE, &dummy);
!           exit(0);
!       } else {
!           wait(&dummy);
!           sleep(loop_time);
!       }
      }
  }