diff --git a/watchdog/BUILD.gn b/watchdog/BUILD.gn index d6d9a142c427450ae1b4fb99e7cacf2e197fb294..1a39ddc481b30d8d271f5858cb69615f4600f8d8 100755 --- a/watchdog/BUILD.gn +++ b/watchdog/BUILD.gn @@ -12,11 +12,26 @@ # limitations under the License. group("watchdog") { - if (defined(ohos_lite)) { + deps = [ ":watchdog_service" ] +} + +if (defined(ohos_lite)) { + executable("watchdog_service") { + sources = [ "init_watchdog.c" ] + include_dirs = [ "//base/startup/init_lite/services/log" ] + deps = [ "//base/startup/init_lite/services/log:init_log" ] if (ohos_kernel_type == "linux") { - deps = [ "//base/startup/init_lite/watchdog/linux:linux_watchdog" ] + defines = [ "LINUX_WATCHDOG" ] } - } else { - deps = [ "//base/startup/init_lite/watchdog/linux:linux_watchdog" ] + } +} else { + import("//build/ohos.gni") + ohos_executable("watchdog_service") { + sources = [ "init_watchdog.c" ] + include_dirs = [ "//base/startup/init_lite/services/log" ] + deps = [ "//base/startup/init_lite/services/log:init_log" ] + defines = [ "LINUX_WATCHDOG" ] + install_enable = true + part_name = "init" } } diff --git a/watchdog/linux/init_linux_watchdog.c b/watchdog/init_watchdog.c similarity index 92% rename from watchdog/linux/init_linux_watchdog.c rename to watchdog/init_watchdog.c index 51a420543daa2c3851543158523e639e057f168d..90589513b151033cdb89e36cca267e2857c69997 100755 --- a/watchdog/linux/init_linux_watchdog.c +++ b/watchdog/init_watchdog.c @@ -23,7 +23,15 @@ #include #include +#ifdef LINUX_WATCHDOG #include +#else +#include +#define WDIOC_KEEPALIVE _IO('W', 5) +#define WDIOC_SETTIMEOUT _IOWR('W', 6, int) +#define WDIOC_GETTIMEOUT _IOR('W', 7, int) +#endif + #include "init_log.h" #define WAIT_MAX_COUNT 10 diff --git a/watchdog/linux/BUILD.gn b/watchdog/linux/BUILD.gn deleted file mode 100755 index 9cd4d1ee7f17df49462f160d4e968df156f95683..0000000000000000000000000000000000000000 --- a/watchdog/linux/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -group("linux_watchdog") { - deps = [ ":watchdog_service" ] -} - -if (defined(ohos_lite)) { - executable("watchdog_service") { - sources = [ "init_linux_watchdog.c" ] - include_dirs = [ "//base/startup/init_lite/services/log" ] - deps = [ "//base/startup/init_lite/services/log:init_log" ] - } -} else { - import("//build/ohos.gni") - ohos_executable("watchdog_service") { - sources = [ "init_linux_watchdog.c" ] - include_dirs = [ "//base/startup/init_lite/services/log" ] - deps = [ "//base/startup/init_lite/services/log:init_log" ] - install_enable = true - part_name = "init" - } -}