watchdog timer boot status always returns zero

Hi,

I need to check if the reboot was because of a watchdog timeout but it seems that the beaglebone watchdog timer does not have support of boot status.
Is that true?

I’m running a simple program to test this feature and, independent of what reason (power failure, watchdog timeout, normal reboot), the IOCLT always return zero.

the code bellow forces a watchdog timeout:

int ret = 0;
int fd = open("/dev/watchdog", O_WRONLY);

if (fd == -1) {
exit(EXIT_FAILURE);
}
ret = ioctl(fd, WDIOC_GETBOOTSTATUS);
printf(“boot status: %d\n”, ret);
while (1) {
ret = write(fd, “\0”, 1);
if (ret != 1) {
ret = -1;
break;
}
sleep(100000);
}
close(fd);