1 /* 2 * Copyright (c) 2021 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 #ifndef HIVIEWDFX_HIVIEW_FAULTLOGGER_FAULTLOG_DATABASE_H 16 #define HIVIEWDFX_HIVIEW_FAULTLOGGER_FAULTLOG_DATABASE_H 17 18 #include <cstdint> 19 #include <ctime> 20 #include <list> 21 #include <memory> 22 #include <mutex> 23 #include <string> 24 25 #include "faultlog_info.h" 26 #include "sys_event.h" 27 28 namespace OHOS { 29 namespace HiviewDFX { 30 class FaultLogDatabase { 31 public: FaultLogDatabase()32 FaultLogDatabase() {}; ~FaultLogDatabase()33 ~FaultLogDatabase(){}; 34 void SaveFaultLogInfo(FaultLogInfo& info); 35 std::list<FaultLogInfo> GetFaultInfoList( 36 const std::string& module, int32_t id, int32_t faultType, int32_t maxNum); 37 bool IsFaultExist(int32_t pid, int32_t uid, int32_t faultType); 38 private: 39 std::mutex mutex_; 40 }; 41 } // namespace HiviewDFX 42 } // namespace OHOS 43 #endif // HIVIEWDFX_HIVIEW_FAULTLOGGER_FAULTLOG_DATABASE_H