1 /* 2 * Copyright (c) 2025 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 ARKCOMPILER_TOOLCHAIN_PLATFORM_FILE_H 17 #define ARKCOMPILER_TOOLCHAIN_PLATFORM_FILE_H 18 19 #ifdef WINDOWS_PLATFORM 20 #include <windows.h> 21 #else 22 #include <stdio.h> 23 #include <unistd.h> 24 #endif 25 26 namespace OHOS::ArkCompiler::Toolchain { 27 #ifdef WINDOWS_PLATFORM 28 using fd_t = HANDLE; 29 #define INVALID_FD INVALID_HANDLE_VALUE 30 31 #ifdef ERROR 32 #undef ERROR 33 #endif 34 35 #ifdef VOID 36 #undef VOID 37 #endif 38 39 #ifdef CONST 40 #undef CONST 41 #endif 42 #else 43 using fd_t = int; 44 #define INVALID_FD (-1) 45 #endif 46 47 void FdsanExchangeOwnerTag(fd_t fd); 48 void FdsanClose(fd_t fd); 49 } // namespace OHOS::ArkCompiler::Toolchain 50 51 #endif // ARKCOMPILER_TOOLCHAIN_PLATFORM_FILE_H