mirror of
https://github.com/troglobit/finit.git
synced 2026-11-20 19:41:51 +00:00
watchdog: Kick one last time before handover to external watchdogd
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
2d2807bc65
commit
7f499ed1d0
1 file changed
+7
-5
+7
-5
@@ -51,20 +51,20 @@ static int notify(void)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (connect(sd, (struct sockaddr*)&sun, sizeof(sun)) == -1)
|
if (connect(sd, (struct sockaddr*)&sun, sizeof(sun)) == -1)
|
||||||
goto exit;
|
goto bye;
|
||||||
|
|
||||||
rq.cmd = INIT_CMD_WDOG_HELLO;
|
rq.cmd = INIT_CMD_WDOG_HELLO;
|
||||||
rq.magic = INIT_MAGIC;
|
rq.magic = INIT_MAGIC;
|
||||||
rq.runlevel = getpid();
|
rq.runlevel = getpid();
|
||||||
len = sizeof(rq);
|
len = sizeof(rq);
|
||||||
if (write(sd, &rq, len) != len)
|
if (write(sd, &rq, len) != len)
|
||||||
goto exit;
|
goto bye;
|
||||||
|
|
||||||
if (read(sd, &rq, len) != len)
|
if (read(sd, &rq, len) != len)
|
||||||
goto exit;
|
goto bye;
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
exit:
|
bye:
|
||||||
close(sd);
|
close(sd);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -105,8 +105,10 @@ static int loop(int fd)
|
|||||||
done = 1;
|
done = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handover)
|
if (handover) {
|
||||||
|
ioctl(fd, WDIOC_KEEPALIVE, &done);
|
||||||
return !write(fd, "V", 1);
|
return !write(fd, "V", 1);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user