⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wdt_test.c

📁 linux 看门狗程序
💻 C
字号:
#include <stdio.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <sys/ioctl.h>#include <asm/types.h>#include "watchdog.h"/*******************************************************************/int main(int argc,const char * argv[]){  	int fd,timeoutvalue;	int c;  	printf("Enable watchdog\n");  	fd=watchdog_enable();	watchdog_get_timeout(&timeoutvalue);  	printf("Get watchdog timeout =>%d second\n",timeoutvalue);  	watchdog_set_timeout(10);  	printf("Set watchdog new timeout => 10 seconds\n");		for(;;){		printf("Press any key to feed watchdog, else to reboot after 10 seconds\n");		c=getchar();		if(c==27)break;		watchdog_feed();   		}	printf("\nDisable watchdog\n");	watchdog_disable(); 	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -