From 4179b2cce50ec130857543bab03ded8952ef34b4 Mon Sep 17 00:00:00 2001 From: Jonathan Flat Date: Mon, 12 Oct 2026 19:33:46 -0600 Subject: [PATCH] Remove CSystemFreeBSD.h, too --- Sources/CSystem/CMakeLists.txt | 1 - Sources/CSystem/include/CSystemFreeBSD.h | 20 -------------------- Sources/CSystem/include/module.modulemap | 3 +-- Sources/CSystem/shims.c | 4 ---- Sources/System/Internals/Constants.swift | 11 ++++------- 5 files changed, 5 insertions(+), 34 deletions(-) delete mode 100644 Sources/CSystem/include/CSystemFreeBSD.h diff --git a/Sources/CSystem/CMakeLists.txt b/Sources/CSystem/CMakeLists.txt index 49fbd6a..7f0a79f 100644 --- a/Sources/CSystem/CMakeLists.txt +++ b/Sources/CSystem/CMakeLists.txt @@ -16,7 +16,6 @@ install(FILES include/CSystemLinux.h include/CSystemShared.h include/CSystemWASI.h - include/CSystemFreeBSD.h include/io_uring.h include/module.modulemap DESTINATION include/CSystem) diff --git a/Sources/CSystem/include/CSystemFreeBSD.h b/Sources/CSystem/include/CSystemFreeBSD.h deleted file mode 100644 index d90c343..0000000 --- a/Sources/CSystem/include/CSystemFreeBSD.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - This source file is part of the Swift System open source project - - Copyright (c) 2026 Apple Inc. and the Swift System project authors - Licensed under Apache License v2.0 with Runtime Library Exception - - See https://swift.org/LICENSE.txt for license information -*/ - -#if defined(__FreeBSD__) - -#include - -#ifdef O_CLOFORK -#define COMPATIBILITY_O_CLOFORK O_CLOFORK -#else -#define COMPATIBILITY_O_CLOFORK 0 -#endif - -#endif // defined(__FreeBSD__) diff --git a/Sources/CSystem/include/module.modulemap b/Sources/CSystem/include/module.modulemap index 07a52bf..64a5c41 100644 --- a/Sources/CSystem/include/module.modulemap +++ b/Sources/CSystem/include/module.modulemap @@ -2,12 +2,11 @@ // the platform's C module also includes: CSystem would then co-own its // declarations, so Swift would limit them to CSystem's import access level and // could credit their members to CSystem under MemberImportVisibility. -// (CSystemWASI.h and CSystemFreeBSD.h still do; see Constants.swift.) +// (CSystemWASI.h still does; see Constants.swift.) module CSystem { header "CSystemShared.h" header "CSystemLinux.h" header "CSystemWASI.h" - header "CSystemFreeBSD.h" export * } diff --git a/Sources/CSystem/shims.c b/Sources/CSystem/shims.c index 9ba0eb2..b0425ad 100644 --- a/Sources/CSystem/shims.c +++ b/Sources/CSystem/shims.c @@ -14,10 +14,6 @@ #include #endif -#if defined(__FreeBSD__) -#include -#endif - #ifdef __linux__ #define _GNU_SOURCE #include diff --git a/Sources/System/Internals/Constants.swift b/Sources/System/Internals/Constants.swift index 2a3989f..f74d784 100644 --- a/Sources/System/Internals/Constants.swift +++ b/Sources/System/Internals/Constants.swift @@ -28,9 +28,8 @@ import Android #error("Unsupported Platform") #endif -// Some WASI and FreeBSD constants come from CSystem and are inlined into -// clients. -#if os(WASI) || os(FreeBSD) +// Some WASI constants come from CSystem and are inlined into clients. +#if os(WASI) public import CSystem #endif @@ -634,10 +633,8 @@ internal var _O_CLOEXEC: CInt { #if !os(Windows) @_alwaysEmitIntoClient internal var _O_CLOFORK: CInt { - #if SYSTEM_PACKAGE_DARWIN - 0x0800_0000 // O_CLOFORK, which SDKs before macOS 27 lack - #elseif os(FreeBSD) - COMPATIBILITY_O_CLOFORK + #if SYSTEM_PACKAGE_DARWIN || os(FreeBSD) + 0x0800_0000 // O_CLOFORK, which SDKs before macOS 27 and older FreeBSD lack #elseif !os(WASI) && !os(Linux) && !os(Android) O_CLOFORK #else