repo.or.cz
/
linux
/
fpc-iii.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Linux 4.19.133
[linux/fpc-iii.git]
/
samples
/
watchdog
/
watchdog-simple.c
blob
9ce66d2ca2a9c02e56bb338ff1cdf7a4ca24e702
1
// SPDX-License-Identifier: GPL-2.0
2
#include <stdio.h>
3
#include <stdlib.h>
4
#include <unistd.h>
5
#include <fcntl.h>
6
7
int
main
(
void
)
8
{
9
int
fd
=
open
(
"/dev/watchdog"
,
O_WRONLY
);
10
int
ret
=
0
;
11
if
(
fd
== -
1
) {
12
perror
(
"watchdog"
);
13
exit
(
EXIT_FAILURE
);
14
}
15
while
(
1
) {
16
ret
=
write
(
fd
,
"\0"
,
1
);
17
if
(
ret
!=
1
) {
18
ret
= -
1
;
19
break
;
20
}
21
sleep
(
10
);
22
}
23
close
(
fd
);
24
return
ret
;
25
}