/* Watchdog fuer JENDATA ISA-Watchdog V0.0.2 */ /* 2001 Uwe Manzei - JENDATA Computersysteme GmbH Jena */ #include #include #include int main(int argc, char **argv) { u_char a; int ch; int fd; optarg = NULL; /* get parameters: v - version; h - help; u - unload */ while((ch=getopt(argc,argv,"huv"))!=-1) { switch(ch) { case 'v': printf("watchdog v 0.0.2\n"); exit(0); break; case 'h': printf("watchdog [-v][-h][-u]\n"); exit(0); break; case 'u': killit(); exit(0); break; } } /* set timer to 220s */ fd=open("/dev/port",O_WRONLY); if(fd==-1) { perror("port"); exit(1); } lseek(fd,0x443,SEEK_SET); a=220; write(fd,&a,1); close(fd); /* loop */ fd=open("/dev/port",O_RDONLY); if(fd==-1) { perror("port"); exit(1); } while(1) { lseek(fd,0x443,SEEK_SET); read(fd,&a,1); sleep(90); } exit(0); } /* disable timer */ killit() { int fd; u_char a; fd=open("/dev/port",O_RDONLY); if(fd==-1) { perror("port"); exit(1); } lseek(fd,0x843,SEEK_SET); read(fd,&a,1); return(0); }