Skip to content

Commit 39c45bc

Browse files
committed
feat: add some condition for mman
1 parent 805aabc commit 39c45bc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/sys/mman.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ libc_bitflags! {
2626
/// Pages can be executed
2727
PROT_EXEC;
2828
/// Apply protection up to the end of a mapping that grows upwards.
29-
#[cfg(linux_android)]
29+
#[cfg(any(linux_android, target_env="ohos"))]
3030
PROT_GROWSDOWN;
3131
/// Apply protection down to the beginning of a mapping that grows downwards.
32-
#[cfg(linux_android)]
32+
#[cfg(any(linux_android, target_env="ohos"))]
3333
PROT_GROWSUP;
3434
}
3535
}
@@ -68,30 +68,30 @@ libc_bitflags! {
6868
all(target_os = "freebsd", target_pointer_width = "64")))]
6969
MAP_32BIT;
7070
/// Used for stacks; indicates to the kernel that the mapping should extend downward in memory.
71-
#[cfg(linux_android)]
71+
#[cfg(any(linux_android, target_env="ohos"))]
7272
MAP_GROWSDOWN;
7373
/// Compatibility flag. Ignored.
74-
#[cfg(linux_android)]
74+
#[cfg(any(linux_android, target_env="ohos"))]
7575
MAP_DENYWRITE;
7676
/// Compatibility flag. Ignored.
77-
#[cfg(linux_android)]
77+
#[cfg(any(linux_android, target_env="ohos"))]
7878
MAP_EXECUTABLE;
7979
/// Mark the mmaped region to be locked in the same way as `mlock(2)`.
80-
#[cfg(linux_android)]
80+
#[cfg(any(linux_android, target_env="ohos"))]
8181
MAP_LOCKED;
8282
/// Do not reserve swap space for this mapping.
8383
///
8484
/// This was removed in FreeBSD 11 and is unused in DragonFlyBSD.
8585
#[cfg(not(any(freebsdlike, target_os = "aix", target_os = "hurd")))]
8686
MAP_NORESERVE;
8787
/// Populate page tables for a mapping.
88-
#[cfg(linux_android)]
88+
#[cfg(any(linux_android, target_env="ohos"))]
8989
MAP_POPULATE;
9090
/// Only meaningful when used with `MAP_POPULATE`. Don't perform read-ahead.
91-
#[cfg(linux_android)]
91+
#[cfg(any(linux_android, target_env="ohos"))]
9292
MAP_NONBLOCK;
9393
/// Allocate the mapping using "huge pages."
94-
#[cfg(linux_android)]
94+
#[cfg(any(linux_android, target_env="ohos"))]
9595
MAP_HUGETLB;
9696
/// Make use of 64KB huge page (must be supported by the system)
9797
#[cfg(target_os = "linux")]
@@ -145,7 +145,7 @@ libc_bitflags! {
145145
#[cfg(any(freebsdlike, netbsdlike))]
146146
MAP_HASSEMAPHORE;
147147
/// Region grows down, like a stack.
148-
#[cfg(any(linux_android, freebsdlike, netbsdlike))]
148+
#[cfg(any(linux_android, freebsdlike, netbsdlike, target_env="ohos"))]
149149
MAP_STACK;
150150
/// Do not write through the page caches, write directly to the file. Used for Direct Access (DAX) enabled file systems.
151151
// Available on Linux glibc and musl, MIPS* target excluded.

0 commit comments

Comments
 (0)