Skip to content

Commit 7e839b9

Browse files
authored
Merge pull request #157 from sinkingsugar/master
Add visionOS support
2 parents 05b2d0e + 1ab625b commit 7e839b9

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ jobs:
115115
- name: Run check
116116
run: cargo check --all-features --target wasm32-unknown-unknown
117117

118+
check-visionos:
119+
runs-on: ubuntu-latest
120+
steps:
121+
- name: Checkout
122+
uses: actions/checkout@v3
123+
124+
- name: Install toolchain
125+
uses: dtolnay/rust-toolchain@nightly
126+
with:
127+
components: rust-src
128+
129+
- name: Run check
130+
run: cargo check --all-features --target aarch64-apple-visionos -Zbuild-std
131+
118132
test-msrv:
119133
runs-on: ubuntu-latest
120134
steps:

src/advice.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pub enum Advice {
230230
/// zeroed out if the address range is deallocated without first unwiring the pages (i.e.
231231
/// a munmap(2) without a preceding munlock(2) or the application quits). This is used
232232
/// with `madvise()` system call.
233-
#[cfg(any(target_os = "macos", target_os = "ios"))]
233+
#[cfg(target_vendor = "apple")]
234234
ZeroWiredPages = libc::MADV_ZERO_WIRED_PAGES,
235235
}
236236

@@ -319,7 +319,7 @@ pub enum UncheckedAdvice {
319319
/// Using the returned value with conceptually write to the
320320
/// mapped pages, i.e. borrowing the mapping while the pages
321321
/// are still being freed results in undefined behaviour.
322-
#[cfg(any(target_os = "linux", target_os = "macos", target_os = "ios"))]
322+
#[cfg(any(target_os = "linux", target_vendor = "apple"))]
323323
Free = libc::MADV_FREE,
324324

325325
/// **MADV_REMOVE** - Linux only (since Linux 2.6.16)
@@ -358,7 +358,7 @@ pub enum UncheckedAdvice {
358358
/// Using the returned value with conceptually write to the
359359
/// mapped pages, i.e. borrowing the mapping while the pages
360360
/// are still being freed results in undefined behaviour.
361-
#[cfg(any(target_os = "macos", target_os = "ios"))]
361+
#[cfg(target_vendor = "apple")]
362362
FreeReusable = libc::MADV_FREE_REUSABLE,
363363

364364
/// **MADV_FREE_REUSE** - Darwin only
@@ -372,7 +372,7 @@ pub enum UncheckedAdvice {
372372
/// Using the returned value with conceptually write to the
373373
/// mapped pages, i.e. borrowing the mapping while the pages
374374
/// are still being freed results in undefined behaviour.
375-
#[cfg(any(target_os = "macos", target_os = "ios"))]
375+
#[cfg(target_vendor = "apple")]
376376
FreeReuse = libc::MADV_FREE_REUSE,
377377
}
378378

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ impl MmapOptions {
368368
/// This option requests that no swap space will be allocated for the memory map,
369369
/// which can be useful for extremely large maps that are only written to sparsely.
370370
///
371-
/// This option is currently supported on Linux, Android, macOS, iOS, NetBSD, Solaris and Illumos.
371+
/// This option is currently supported on Linux, Android, Apple platforms (macOS, iOS, visionOS, etc.), NetBSD, Solaris and Illumos.
372372
/// On those platforms, this option corresponds to the `MAP_NORESERVE` flag.
373373
/// On Linux, this option is ignored if [`vm.overcommit_memory`](https://www.kernel.org/doc/Documentation/vm/overcommit-accounting) is set to 2.
374374
///

src/unix.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const MAP_HUGE_SHIFT: libc::c_int = 0;
4545
#[cfg(any(
4646
target_os = "linux",
4747
target_os = "android",
48-
target_os = "macos",
48+
target_vendor = "apple",
4949
target_os = "netbsd",
5050
target_os = "solaris",
5151
target_os = "illumos",
@@ -55,7 +55,7 @@ const MAP_NORESERVE: libc::c_int = libc::MAP_NORESERVE;
5555
#[cfg(not(any(
5656
target_os = "linux",
5757
target_os = "android",
58-
target_os = "macos",
58+
target_vendor = "apple",
5959
target_os = "netbsd",
6060
target_os = "solaris",
6161
target_os = "illumos",

0 commit comments

Comments
 (0)