Skip to content

Commit 2845ab9

Browse files
authored
Compile sys::mman on Redox (#2637)
This fixes compilation of sys::mman on Redox and allows it to be enabled with the mman feature
1 parent fccb4ab commit 2845ab9

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/sys/mman.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ libc_bitflags! {
3838
/// Additional parameters for [`mmap`].
3939
pub struct MapFlags: c_int {
4040
/// Compatibility flag. Ignored.
41-
#[cfg(not(target_os = "solaris"))]
41+
#[cfg(not(any(target_os = "solaris", target_os = "redox")))]
4242
MAP_FILE;
4343
/// Share this mapping. Mutually exclusive with `MAP_PRIVATE`.
4444
MAP_SHARED;
@@ -82,7 +82,7 @@ libc_bitflags! {
8282
/// Do not reserve swap space for this mapping.
8383
///
8484
/// This was removed in FreeBSD 11 and is unused in DragonFlyBSD.
85-
#[cfg(not(any(freebsdlike, target_os = "aix", target_os = "hurd")))]
85+
#[cfg(not(any(freebsdlike, target_os = "aix", target_os = "hurd", target_os = "redox")))]
8686
MAP_NORESERVE;
8787
/// Populate page tables for a mapping.
8888
#[cfg(linux_android)]
@@ -281,7 +281,7 @@ libc_enum! {
281281
#[cfg(linux_android)]
282282
MADV_DODUMP,
283283
/// Specify that the application no longer needs the pages in the given range.
284-
#[cfg(not(any(target_os = "aix", target_os = "hurd", target_os = "cygwin")))]
284+
#[cfg(not(any(target_os = "aix", target_os = "hurd", target_os = "cygwin", target_os = "redox")))]
285285
MADV_FREE,
286286
/// Request that the system not flush the current range to disk unless it needs to.
287287
#[cfg(freebsdlike)]
@@ -357,7 +357,7 @@ libc_bitflags! {
357357
}
358358
}
359359

360-
#[cfg(not(any(target_os = "haiku", target_os = "cygwin")))]
360+
#[cfg(not(any(target_os = "haiku", target_os = "cygwin", target_os = "redox")))]
361361
libc_bitflags! {
362362
/// Flags for [`mlockall`].
363363
pub struct MlockAllFlags: c_int {
@@ -400,7 +400,7 @@ pub unsafe fn munlock(addr: NonNull<c_void>, length: size_t) -> Result<()> {
400400
/// Locked pages never move to the swap area. For more information, see [`mlockall(2)`].
401401
///
402402
/// [`mlockall(2)`]: https://man7.org/linux/man-pages/man2/mlockall.2.html
403-
#[cfg(not(any(target_os = "haiku", target_os = "cygwin")))]
403+
#[cfg(not(any(target_os = "haiku", target_os = "cygwin", target_os = "redox")))]
404404
pub fn mlockall(flags: MlockAllFlags) -> Result<()> {
405405
unsafe { Errno::result(libc::mlockall(flags.bits())) }.map(drop)
406406
}
@@ -410,7 +410,7 @@ pub fn mlockall(flags: MlockAllFlags) -> Result<()> {
410410
/// For more information, see [`munlockall(2)`].
411411
///
412412
/// [`munlockall(2)`]: https://man7.org/linux/man-pages/man2/munlockall.2.html
413-
#[cfg(not(any(target_os = "haiku", target_os = "cygwin")))]
413+
#[cfg(not(any(target_os = "haiku", target_os = "cygwin", target_os = "redox")))]
414414
pub fn munlockall() -> Result<()> {
415415
unsafe { Errno::result(libc::munlockall()) }.map(drop)
416416
}

src/sys/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ feature! {
5252
pub mod memfd;
5353
}
5454

55-
#[cfg(not(target_os = "redox"))]
5655
feature! {
5756
#![feature = "mman"]
5857
pub mod mman;

0 commit comments

Comments
 (0)