1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef APPSPAWN_KICKDOG_H 17 #define APPSPAWN_KICKDOG_H 18 19 #include <fcntl.h> 20 #include <stdio.h> 21 #include <sys/utsname.h> 22 #include "loop_event.h" 23 #include "appspawn_utils.h" 24 #include "appspawn_server.h" 25 #include "appspawn_modulemgr.h" 26 #include "appspawn_manager.h" 27 28 #ifdef __cplusplus 29 extern "C" { 30 #endif 31 32 #ifdef APPSPAWN_TEST //macro for test 33 #define LINUX_APPSPAWN_WATCHDOG_FILE "./TestDataFile.txt" 34 #define HM_APPSPAWN_WATCHDOG_FILE "./TestDataFile.txt" 35 #else 36 #define LINUX_APPSPAWN_WATCHDOG_FILE "/sys/kernel/hungtask/userlist" 37 #define HM_APPSPAWN_WATCHDOG_FILE "/proc/sys/hguard/user_list" 38 #endif 39 40 #define LINUX_APPSPAWN_WATCHDOG_ON "on,30" 41 #define LINUX_APPSPAWN_WATCHDOG_KICK "kick" 42 #define HM_APPSPAWN_WATCHDOG_ON "on,10,appspawn" 43 #define HM_APPSPAWN_WATCHDOG_KICK "kick,appspawn" 44 #define HM_NWEBSPAWN_WATCHDOG_ON "on,10,nwebspawn" 45 #define HM_NWEBSPAWN_WATCHDOG_KICK "kick,nwebspawn" 46 #define HM_HYBRIDSPAWN_WATCHDOG_ON "on,10,hybridspawn" 47 #define HM_HYBRIDSPAWN_WATCHDOG_KICK "kick,hybridspawn" 48 49 #define APPSPAWN_WATCHDOG_KICKTIME (10 * 1000) //10s 50 51 #ifdef __cplusplus 52 } 53 #endif 54 #endif //APPSPAWN_KICKDOG_H