• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 MUSL_FDSAN_H
17 #define MUSL_FDSAN_H
18 
19 #include <string.h>
20 #include <stdint.h>
21 #include <stdio.h>
22 
23 #include "stdatomic_impl.h"
24 
25 #define FdTableSize 128
26 
27 struct FdEntry {
28 	_Atomic(uint64_t) close_tag;
29 };
30 
31 struct FdTableOverflow {
32 	size_t len;
33 	struct FdEntry entries[];
34 };
35 
36 struct FdTable {
37 	_Atomic(enum fdsan_error_level) error_level;
38 	struct FdEntry entries[FdTableSize];
39 	_Atomic(struct FdTableOverflow*) overflow;
40 };
41 
42 void __init_fdsan();
43 
44 #endif