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 DFX_FDSAN_H 17 #define DFX_FDSAN_H 18 19 #define FD_TABLE_SIZE 128 20 21 struct FdEntry { 22 _Atomic(uint64_t) close_tag; 23 _Atomic(char) signal_flag; 24 }; 25 26 struct FdTableOverflow { 27 size_t len; 28 struct FdEntry entries[]; 29 }; 30 31 struct FdTable { 32 _Atomic(enum fdsan_error_level) error_level; 33 struct FdEntry entries[FD_TABLE_SIZE]; 34 _Atomic(struct FdTableOverflow*) overflow; 35 }; 36 37 struct FDInfo { 38 std::string path; 39 uint64_t fdsanOwner; 40 }; 41 42 #endif 43