From 1867ac1c46d33c932d62c4e60b719f71786cdb63 Mon Sep 17 00:00:00 2001 From: xionglei6 Date: Fri, 11 Mar 2022 19:14:57 +0800 Subject: [PATCH] init: fix bugs Signed-off-by: xionglei6 --- watchdog/BUILD.gn | 5 ++++- watchdog/init_watchdog.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/watchdog/BUILD.gn b/watchdog/BUILD.gn index 395d2214..1fafd7a1 100755 --- a/watchdog/BUILD.gn +++ b/watchdog/BUILD.gn @@ -23,7 +23,10 @@ if (defined(ohos_lite)) { "//base/startup/init_lite/interfaces/innerkits/include", ] deps = [ "//base/startup/init_lite/services/log:init_log" ] - defines = [ "_GNU_SOURCE" ] + defines = [ + "_GNU_SOURCE", + "OHOS_LITE_WATCHDOG" + ] if (ohos_kernel_type == "linux") { defines += [ "LINUX_WATCHDOG" ] } diff --git a/watchdog/init_watchdog.c b/watchdog/init_watchdog.c index 277ee7bc..19294cff 100755 --- a/watchdog/init_watchdog.c +++ b/watchdog/init_watchdog.c @@ -79,9 +79,13 @@ int main(int argc, const char *argv[]) gap = (gap > 0) ? gap : DEFAULT_GAP; INIT_LOGI("watchdoge started (interval %d, margin %d), fd = %d\n", interval, gap, fd); +#ifdef OHOS_LITE_WATCHDOG +#ifndef LINUX_WATCHDOG if (setpriority(PRIO_PROCESS, 0, 14) != 0) { // 14 is process priority INIT_LOGE("setpriority failed err=%d\n", errno); } +#endif +#endif int timeoutSet = interval + gap; int timeoutGet = 0; int ret = ioctl(fd, WDIOC_SETTIMEOUT, &timeoutSet); -- GitLab