-
Notifications
You must be signed in to change notification settings - Fork 666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use upstream libc definitions in mman module #731
Conversation
8031ab0
to
2e332c6
Compare
src/sys/mman.rs
Outdated
MAP_ANON, | ||
/// The mapping is not backed by any file. | ||
#[cfg(any(target_os = "linux", target_os = "android"))] | ||
MAP_ANONYMOUS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FreeBSD has this one too, though it seems nobody has added it to libc yet.
src/sys/mman.rs
Outdated
MAP_PRIVATE, | ||
/// Place the mapping at exactly the address specified in `addr`. | ||
MAP_FIXED, | ||
/// Synonym for `MAP_ANONYMOUS`. Deprecated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAP_ANON
can't very well be deprecated on platforms where its synonym is undefined, can it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably only deprecated on Linux platforms. In fact it appears that on FreeBSD MAP_ANON
is the "correct" constant and MAP_ANONYMOUS
is just there for compatibility. I'll just remove the deprecation notice.
src/sys/mman.rs
Outdated
/// The mapping is not backed by any file. | ||
#[cfg(any(target_os = "linux", target_os = "android"))] | ||
MAP_ANONYMOUS, | ||
/// Put the mapping the first 2GB of the process address space. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/mapping/mapping into/
src/sys/mman.rs
Outdated
/// Put the mapping the first 2GB of the process address space. | ||
#[cfg(any(target_os = "linux", target_os = "android"))] | ||
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] | ||
MAP_32BIT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Present on FreeBSD also.
src/sys/mman.rs
Outdated
#[cfg(any(target_os = "linux", target_os = "android"))] | ||
MAP_LOCKED, | ||
/// Do not reserve swap space for this mapping. | ||
MAP_NORESERVE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAP_NORESERVE
and MAP_RENAME
were dropped in FreeBSD 11. For compatibility, they're still supported in older binaries. But there are no older binaries using these symbols from Nix. So we should drop the symbols too, at least on FreeBSD.
src/sys/mman.rs
Outdated
/// Free up a given range of pages and its associated backing store. | ||
#[cfg(any(target_os = "android", target_os = "linux"))] | ||
MADV_REMOVE, | ||
/// Do not make pages in this rage available to the child after a fork(2). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/rage/range/
src/sys/mman.rs
Outdated
pub fn madvise (addr: *const c_void, len: size_t, advice: c_int) -> c_int; | ||
pub fn msync (addr: *const c_void, len: size_t, flags: c_int) -> c_int; | ||
libc_bitflags!{ | ||
/// Configuration flags for `msync'. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/'/`/
Cargo.toml
Outdated
@@ -15,7 +15,7 @@ exclude = [ | |||
] | |||
|
|||
[dependencies] | |||
libc = { git = "https://github.com/rust-lang/libc" } | |||
libc = { git = "https://github.com/susurrus/libc", branch = "mman_constants" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to undo this part before merging.
15e401b
to
5c25f60
Compare
@asomers I think everything should be ready for merge now that |
bors r+ |
No description provided.