Fix missing O_CLOFORK on older FreeBSD

This commit is contained in:
Kenta Kubo committed 2026-06-12 22:31:04 +09:00
1 parent e402d5fa38
commit 360e6f70f0
5 files changed
+30 -1

No files matched your search

+1
View File
@@ -16,6 +16,7 @@ install(FILES
include/CSystemLinux.h
include/CSystemShared.h
include/CSystemWindows.h
include/CSystemFreeBSD.h
include/module.modulemap
DESTINATION include/CSystem)
set_property(GLOBAL APPEND PROPERTY SWIFT_SYSTEM_EXPORTS CSystem)
+21
View File
@@ -0,0 +1,21 @@
/*
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 <fcntl.h>
#ifdef O_CLOFORK
#define FREEBSD_O_CLOFORK O_CLOFORK
#else
#define FREEBSD_O_CLOFORK 0
#endif
#endif
+1
View File
@@ -3,5 +3,6 @@ module CSystem {
header "CSystemLinux.h"
header "CSystemWASI.h"
header "CSystemWindows.h"
header "CSystemFreeBSD.h"
export *
}
+4
View File
@@ -12,6 +12,10 @@
#include <unistd.h>
#endif
#if defined(__FreeBSD__)
#include <CSystemFreeBSD.h>
#endif
#ifdef __linux__
#define _GNU_SOURCE
#include <CSystemLinux.h>
+3 -1
View File
@@ -631,8 +631,10 @@ internal var _O_CLOEXEC: CInt {
#if !os(Windows)
@_alwaysEmitIntoClient
internal var _O_CLOFORK: CInt {
#if !os(WASI) && !os(Linux) && !os(Android) && !canImport(Darwin)
#if !os(WASI) && !os(Linux) && !os(Android) && !canImport(Darwin) && !os(FreeBSD)
O_CLOFORK
#elseif os(FreeBSD)
FREEBSD_O_CLOFORK
#else
0
#endif