Moxa V2616A-C8-CT-W7E [56/111] Examples

Moxa V2616A-C8-W7E [56/111] Examples
V2616A Linux Programming Guide
4-7
Input None
Output (int *)arg
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_GETBOOTSTATUS
Description
This returns the status of the card that was reported at bootup.
Input None
Output (int *)arg)
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_SETOPTIONS
Description
This lets you set the options of the card. You can either enable or disable the card this way.
Input None
Output (int *)arg)
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_KEEPALIVE
Description
This pings the card to tell it not to reset your computer.
Input
None
Output None
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_SETTIMEOUT
Description Set the watchdog timeout
Input arg: 1 ~ 255 seconds
Output None
Return On success, return 0. Otherwise, return < 0 value.
IOCTL WDIOC_GETTIMEOUT
Description
Get the current watchdog timeout.
Input
None
Output arg: 1 ~ 255 seconds
Return On success, return 0. Otherwise, return < 0 value.
Examples
The example file watchdog-simple.c acks the watchdog every 10 seconds.
#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);
}

Содержание

Похожие устройства

Скачать