Merge "init: Fix logging stutter"
This commit is contained in:
commit
93adb524bc
1 changed files with 7 additions and 6 deletions
|
|
@ -38,29 +38,30 @@ int watchdogd_main(int argc, char **argv) {
|
||||||
int margin = 10;
|
int margin = 10;
|
||||||
if (argc >= 3) margin = atoi(argv[2]);
|
if (argc >= 3) margin = atoi(argv[2]);
|
||||||
|
|
||||||
NOTICE("watchdogd started (interval %d, margin %d)!\n", interval, margin);
|
NOTICE("started (interval %d, margin %d)!\n", interval, margin);
|
||||||
|
|
||||||
int fd = open(DEV_NAME, O_RDWR|O_CLOEXEC);
|
int fd = open(DEV_NAME, O_RDWR|O_CLOEXEC);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
ERROR("watchdogd: Failed to open %s: %s\n", DEV_NAME, strerror(errno));
|
ERROR("Failed to open %s: %s\n", DEV_NAME, strerror(errno));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int timeout = interval + margin;
|
int timeout = interval + margin;
|
||||||
int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
|
int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeout);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ERROR("watchdogd: Failed to set timeout to %d: %s\n", timeout, strerror(errno));
|
ERROR("Failed to set timeout to %d: %s\n", timeout, strerror(errno));
|
||||||
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
|
ret = ioctl(fd, WDIOC_GETTIMEOUT, &timeout);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ERROR("watchdogd: Failed to get timeout: %s\n", strerror(errno));
|
ERROR("Failed to get timeout: %s\n", strerror(errno));
|
||||||
} else {
|
} else {
|
||||||
if (timeout > margin) {
|
if (timeout > margin) {
|
||||||
interval = timeout - margin;
|
interval = timeout - margin;
|
||||||
} else {
|
} else {
|
||||||
interval = 1;
|
interval = 1;
|
||||||
}
|
}
|
||||||
ERROR("watchdogd: Adjusted interval to timeout returned by driver: timeout %d, interval %d, margin %d\n",
|
WARNING("Adjusted interval to timeout returned by driver:"
|
||||||
timeout, interval, margin);
|
" timeout %d, interval %d, margin %d\n",
|
||||||
|
timeout, interval, margin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue