/***********************************************************************
* Linux Watchdog Test Program
* 说明:
* 由于之前的reset一直没有得到解决,所以这个Watchdog功能一直没有处理,
* 现在问题解决了,于是需要加入这个测试程序。
*
* 2016-4-15 深圳 南山平山村 曾剑锋
**********************************************************************/ #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/watchdog.h> // watchdog 只要一直打开设备节点不喂,然后等待设定的时间结束引发reset。
int main(void)
{ int fd;
fd = open("/dev/watchdog", O_WRONLY); if (fd == -) {
fprintf(stderr, "Watchdog device not enabled.\n");
fflush(stderr);
exit(-);
} int timeout = ;
ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
printf("The timeout was set to %d seconds\n", timeout); int timeleft = timeout;
while((timeleft--) >= ) {
printf("The timeout left %d seconds\n", timeleft);
sleep();
}
}

Linux Watchdog Test Program的更多相关文章

  1. linux watchdog demo hacking

    /********************************************************************** * linux watchdog demo hackin ...

  2. Linux watchdog

    使用 watchdog 构建高可用性的 Linux 系统及应用https://www.ibm.com/developerworks/cn/linux/l-cn-watchdog/index.html ...

  3. Linux watchdog 关闭退出功能

    Linux 程序退出的时候,程序是会把 watchdog 调用 release 功能.

  4. Linux watchdog 6300esb

     基本原理: Linux 自带了一个 watchdog 的实现,用于监视系统的执行,包含一个内核 watchdog module 和一个用户空间的 watchdog 程序.内核 watchdog ...

  5. 基于S3C2440的嵌入式Linux驱动——看门狗(watchdog)驱动解读

    本文将介绍看门狗驱动的实现. 目标平台:TQ2440 CPU:s3c2440 内核版本:2.6.30 1. 看门狗概述 看门狗其实就是一个定时器,当该定时器溢出前必须对看门狗进行"喂狗“,如 ...

  6. am335x watchdog

    am335x watchdog 内核文档kernel/Documentation/watchdog Qt@aplex:~/kernel/7109/linux-3.2.0/Documentation/w ...

  7. watchdog机制

    转自:http://blog.sina.com.cn/s/blog_4dff871201012yzh.html 什么是Watchdog? Watchdog,又称watchdog timer,是计算机可 ...

  8. Qt 控制watchdog app hacking

    /************************************************************************** * Qt 控制watchdog app hack ...

  9. xrdp远程 & watchdog 启用与测试 & WebRTC

    sudo apt-get install xrdp sudo apt-get install vnc4server tightvncserver echo "xfce4-session&qu ...

随机推荐

  1. input点击删除默认value,以及只能输入数字,删除,tab

    /*inputhastip类绑定事件*/ $('.inputhastip').css("color", "#999"); $('.inputhastip').b ...

  2. NHibernate 基础

    install-package nhibernate install-package nunit Customer.cs public class Customer { public virtual ...

  3. 【转载】错误 CS0016: 未能写入输出文件“c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/.........dll”--“拒绝访问。 ”

    win7中安装asp.net的问题 编译器错误信息: CS0016: 未能写入输出文件问题解决办法 编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地 ...

  4. 【转载】struct和typedef struct彻底明白了

    分三块来讲述: 1 首先://注意在C和C++里不同 在C中定义一个结构体类型要用typedef: typedef struct Student { int a; }Stu; 于是在声明变量的时候就可 ...

  5. curPos和tgtPos

    curpos tgtpos 乍一看以为是当前位置和目标位置,但在项目里面这两个位置有点坑 当客户端玩家移动或者AI里面的位置,会把获得的位置付给tgtpos 而以前的tgtpos会付给curpos 所 ...

  6. Chpater 10: Sorting

    Internal Sort: Bubble  O(n2) Selection O(n2) Insertion O(n2) Shell O(nlogn) Merge O(nlogn) Heap O(nl ...

  7. crontab定时运行git命令 更新代码库

    Q:  http://stackoverflow.com/questions/7994663/git-push-via-cron    I'm trying to run a git push fro ...

  8. 用cxSelect插件补充一下回显过滤项功能

    这个在DJANGO里,最好在过滤之后,让用户知道自己过滤的选择.所以要定位默认值. 1,在HTML文件里显示默认值: <form class="uk-form" name=& ...

  9. hdu 2837 Calculation

    公式:a^b%p=a^(b%phi(p)+phi(p))%p   b>=phi(p) #include<iostream> #include<stdio.h> #incl ...

  10. hdu 1376 Octal Fractions

    刚开始做这题时,用的是0.75[8]=(7/8+5/64)[10]这个,但是总是WA…………无语了…… 后来看别人的解题报告,知道了另外一个就是0.75[8]=((5/8+7)/8)[10],从低位向 ...