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 };
24 
25 struct FdTableOverflow {
26     size_t len;
27     struct FdEntry entries[];
28 };
29 
30 struct FdTable {
31     _Atomic(enum fdsan_error_level) error_level;
32     struct FdEntry entries[FD_TABLE_SIZE];
33     _Atomic(struct FdTableOverflow*) overflow;
34 };
35 
36 struct FDInfo {
37     std::string path;
38     uint64_t fdsanOwner;
39 };
40 
41 #endif