Skip to content

Commit f997707

Browse files
Merge pull request #4913 from kateinoigakukun/pr-f6022e0721b057fdae9a44e9299afba97392ce2d
2 parents f7d3cde + 90c1832 commit f997707

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@
6666
#include <termios.h>
6767
#elif TARGET_OS_WASI
6868
#include <fcntl.h>
69+
// Define _WASI_EMULATED_MMAN here to use the emulated mman functions in
70+
// Foundation-side without requiring transitive clients to define it.
71+
#undef _WASI_EMULATED_MMAN
72+
#define _WASI_EMULATED_MMAN
73+
#include <sys/mman.h>
6974
#elif TARGET_OS_LINUX
7075
#include <errno.h>
7176
#include <features.h>

Sources/Foundation/Data.swift

-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
@usableFromInline let memcpy = Musl.memcpy
3737
@usableFromInline let memcmp = Musl.memcmp
3838
#elseif canImport(WASILibc)
39-
#if swift(>=6.0)
40-
private import wasi_emulated_mman
41-
#else
42-
import wasi_emulated_mman
43-
#endif
4439
@usableFromInline let calloc = WASILibc.calloc
4540
@usableFromInline let malloc = WASILibc.malloc
4641
@usableFromInline let free = WASILibc.free

Sources/Foundation/FileHandle.swift

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ fileprivate let _write = Musl.write(_:_:_:)
2929
fileprivate let _close = Musl.close(_:)
3030
#elseif canImport(WASILibc)
3131
import WASILibc
32-
@_implementationOnly import wasi_emulated_mman
3332
fileprivate let _read = WASILibc.read(_:_:_:)
3433
fileprivate let _write = WASILibc.write(_:_:_:)
3534
fileprivate let _close = WASILibc.close(_:)

0 commit comments

Comments
 (0)