/***********************************************************************
* 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. js异步加载 defer和async 比较

    网上说法很多,很少一句话能总结清楚的,终于找到两句一针见血的描述,很到位: 相同点:都不阻塞DOM解析 defer  :顺序:保证先后顺序.解析:HTML 解析器遇到它们时,不阻塞(脚本将被异步下载) ...

  2. 阿里云CentOS6.3 安装MongoDB教程

    安装说明 系统环境:Centos-6.3安装软件:mongodb-linux-x86_64-2.2.2.tgz下载地址:http://www.mongodb.org/downloads安装机器:192 ...

  3. 【WCF--初入江湖】目录

    [WCF--初入江湖]目录 [WCF--初入江湖]01 WCF编程概述 [WCF--初入江湖]02 WCF契约 [WCF--初入江湖]03 配置服务 [WCF--初入江湖]04 WCF通信模式 [WC ...

  4. Building Plugins for iOS

    This page describes Native Code Plugins for the iOS platform. Building an Application with a Native ...

  5. 140227项目开发及上线过程遇到的10个问题(重点: FCK过滤替换)

    1.替换条件判断问题 String s = (String)map2.get("contentIntro"); if(s != null && s.length() ...

  6. Nginx配置一个自签名的SSL证书

    http://www.liaoxuefeng.com/article/0014189023237367e8d42829de24b6eaf893ca47df4fb5e000 要保证Web浏览器到服务器的 ...

  7. 关联式容器(associative containers)

    关联式容器(associative containers) 根据数据在容器中的排列特性,容器可分为序列式(sequence)和关联式(associative)两种. 标准的STL关联式容器分为set( ...

  8. [cocoapods] 如何卸载工程里的cocoapods

    1. 打开自己的工程所在文件夹 删除这4个文件 2. 打开工程,把红线的东西都删除掉 3. 只留下原来的4个,其余都删除掉

  9. List应用举例

    1.集合的嵌套遍历 学生类: package listexercise; /** * Created by gao on 15-12-9. */ public class Student { priv ...

  10. iptables配置——NAT地址转换

    iptables nat 原理同filter表一样,nat表也有三条缺省的"链"(chains): PREROUTING:目的DNAT规则 把从外来的访问重定向到其他的机子上,比如 ...