mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-30 23:46:40 +07:00
071bf69a02
Move watchdog examples to samples and remove it from Documentation Makefile. Create a new Makefile to build watchdog. It can be built from top level directory or from watchdog directory: Run make -C samples/watchdog or cd samples/watchdog; make Acked-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
25 lines
346 B
C
25 lines
346 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
|
|
int main(void)
|
|
{
|
|
int fd = open("/dev/watchdog", O_WRONLY);
|
|
int ret = 0;
|
|
if (fd == -1) {
|
|
perror("watchdog");
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
while (1) {
|
|
ret = write(fd, "\0", 1);
|
|
if (ret != 1) {
|
|
ret = -1;
|
|
break;
|
|
}
|
|
sleep(10);
|
|
}
|
|
close(fd);
|
|
return ret;
|
|
}
|