Merge branch 'verify-sysmman-includes' into 'master'

verify sys_mman header includes

See merge request redox-os/relibc!1234
This commit is contained in:
Jeremy Soller
2026-04-27 12:27:28 -06:00
2 changed files with 13 additions and 5 deletions
+9 -1
View File
@@ -1,4 +1,10 @@
sys_includes = ["stdarg.h", "stdint.h", "sys/types.h"]
# POSIX header spec: https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/sys_mman.h.html
#
# Spec quotations relating to includes:
# - "The <sys/mman.h> header shall define the mode_t, off_t, and size_t types as described in <sys/types.h>."
# - "The <sys/mman.h> header shall define the following symbolic constants as described in <fcntl.h>"
# - "Inclusion of the <sys/mman.h> header may make visible all symbols from the <fcntl.h> header."
sys_includes = ["sys/types.h", "fcntl.h"]
include_guard = "_RELIBC_SYS_MMAN_H"
after_includes = """
@@ -8,6 +14,8 @@ language = "C"
style = "Tag"
no_includes = true
cpp_compat = true
# make size_t actually size_t instead of uintptr_t (which would require stdint.h)
usize_is_size_t = true
[enum]
prefix_with_name = true
+4 -4
View File
@@ -62,7 +62,7 @@ pub unsafe extern "C" fn madvise(addr: *mut c_void, len: size_t, flags: c_int) -
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mlock.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn mlock(addr: *const c_void, len: usize) -> c_int {
pub unsafe extern "C" fn mlock(addr: *const c_void, len: size_t) -> c_int {
unsafe { Sys::mlock(addr, len) }
.map(|()| 0)
.or_minus_one_errno()
@@ -107,8 +107,8 @@ pub unsafe extern "C" fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -
#[unsafe(no_mangle)]
pub unsafe extern "C" fn mremap(
old_address: *mut c_void,
old_size: usize,
new_size: usize,
old_size: size_t,
new_size: size_t,
flags: c_int,
mut __valist: ...
) -> *mut c_void {
@@ -132,7 +132,7 @@ pub unsafe extern "C" fn msync(addr: *mut c_void, len: size_t, flags: c_int) ->
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/mlock.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn munlock(addr: *const c_void, len: usize) -> c_int {
pub unsafe extern "C" fn munlock(addr: *const c_void, len: size_t) -> c_int {
unsafe { Sys::munlock(addr, len) }
.map(|()| 0)
.or_minus_one_errno()