From 1cbc523e50d7dd37f13330d3ef5b80d84b76705e Mon Sep 17 00:00:00 2001 From: gnzlbg <gonzalobg88@gmail.com> Date: Mon, 27 May 2019 14:09:40 +0200 Subject: [PATCH] [breaking change] MADV_SOFT_OFFLINE is undefined on MIPS --- libc-test/build.rs | 27 ++++++++++++++++++--- src/unix/notbsd/android/mod.rs | 1 + src/unix/notbsd/emscripten/mod.rs | 1 + src/unix/notbsd/linux/mips/mod.rs | 2 +- src/unix/notbsd/linux/musl/b32/arm.rs | 1 + src/unix/notbsd/linux/musl/b32/powerpc.rs | 1 + src/unix/notbsd/linux/musl/b32/x86.rs | 1 + src/unix/notbsd/linux/musl/b64/aarch64.rs | 1 + src/unix/notbsd/linux/musl/b64/powerpc64.rs | 1 + src/unix/notbsd/linux/musl/b64/x86_64.rs | 1 + src/unix/notbsd/linux/other/mod.rs | 1 + src/unix/notbsd/linux/s390x/mod.rs | 1 + src/unix/notbsd/mod.rs | 1 - 13 files changed, 34 insertions(+), 6 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 9600c727..987ff9dd 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1995,6 +1995,10 @@ fn test_linux(target: &str) { ), } + let arm = target.contains("arm"); + let x86_64 = target.contains("x86_64"); + let x86_32 = target.contains("i686"); + let x32 = target.contains("x32"); let mips = target.contains("mips"); let mips32 = mips && !target.contains("64"); @@ -2046,7 +2050,6 @@ fn test_linux(target: &str) { "stdio.h", "stdlib.h", "string.h", - "sys/sysctl.h", "sys/epoll.h", "sys/eventfd.h", "sys/file.h", @@ -2097,15 +2100,27 @@ fn test_linux(target: &str) { // `sys/io.h` is only available on x86*, Alpha, IA64, and 32-bit ARM: // https://bugzilla.redhat.com/show_bug.cgi?id=1116162 - if target.contains("x86") || target.contains("arm") { + if x86_64 || x86_32 || arm { headers! { cfg: "sys/io.h" } } // `sys/reg.h` is only available on x86 and x86_64 - if target.contains("x86") { + if x86_64 || x86_32 { headers! { cfg: "sys/reg.h" } } + // sysctl system call is deprecated and not available on musl + // It is also unsupported in x32: + if !(x32 || musl) { + headers! { cfg: "sys/sysctl.h"} + } + + // <execinfo.h> is not supported by musl: + // https://www.openwall.com/lists/musl/2015/04/09/3 + if !musl { + headers! { cfg: "execinfo.h" } + } + // Include linux headers at the end: headers! { cfg: @@ -2115,7 +2130,6 @@ fn test_linux(target: &str) { "linux/fs.h", "linux/futex.h", "linux/genetlink.h", - "linux/if.h", "linux/if_addr.h", "linux/if_alg.h", "linux/if_ether.h", @@ -2138,6 +2152,11 @@ fn test_linux(target: &str) { "sys/auxv.h", } + // FIXME: https://github.com/sabotage-linux/kernel-headers/issues/16 + if !musl { + headers!{ cfg: "linux/if.h" } + } + // note: aio.h must be included before sys/mount.h headers! { cfg: "sys/xattr.h", diff --git a/src/unix/notbsd/android/mod.rs b/src/unix/notbsd/android/mod.rs index 05d49002..e4dfa1f6 100644 --- a/src/unix/notbsd/android/mod.rs +++ b/src/unix/notbsd/android/mod.rs @@ -548,6 +548,7 @@ cfg_if! { } } +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MS_NOUSER: ::c_ulong = 0xffffffff80000000; pub const MS_RMT_MASK: ::c_ulong = 0x02800051; diff --git a/src/unix/notbsd/emscripten/mod.rs b/src/unix/notbsd/emscripten/mod.rs index f1ab424b..da4edea5 100644 --- a/src/unix/notbsd/emscripten/mod.rs +++ b/src/unix/notbsd/emscripten/mod.rs @@ -574,6 +574,7 @@ cfg_if! { } } +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MS_NOUSER: ::c_ulong = 0x80000000; pub const MS_RMT_MASK: ::c_ulong = 0x800051; diff --git a/src/unix/notbsd/linux/mips/mod.rs b/src/unix/notbsd/linux/mips/mod.rs index c5253acc..d645fdaa 100644 --- a/src/unix/notbsd/linux/mips/mod.rs +++ b/src/unix/notbsd/linux/mips/mod.rs @@ -894,7 +894,7 @@ pub const NFT_NG_INCREMENTAL: ::c_int = 0; pub const NFT_NG_RANDOM: ::c_int = 1; #[doc(hidden)] -pub const AF_MAX: ::c_int = 42; +pub const AF_MAX: ::c_int = 45; #[doc(hidden)] pub const PF_MAX: ::c_int = AF_MAX; diff --git a/src/unix/notbsd/linux/musl/b32/arm.rs b/src/unix/notbsd/linux/musl/b32/arm.rs index 94f1a80f..c5feafc1 100644 --- a/src/unix/notbsd/linux/musl/b32/arm.rs +++ b/src/unix/notbsd/linux/musl/b32/arm.rs @@ -182,6 +182,7 @@ pub const RLIMIT_NPROC: ::c_int = 6; pub const RLIMIT_MEMLOCK: ::c_int = 8; pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; pub const CBAUD: ::tcflag_t = 0o0010017; diff --git a/src/unix/notbsd/linux/musl/b32/powerpc.rs b/src/unix/notbsd/linux/musl/b32/powerpc.rs index d0f2d682..f62cf629 100644 --- a/src/unix/notbsd/linux/musl/b32/powerpc.rs +++ b/src/unix/notbsd/linux/musl/b32/powerpc.rs @@ -166,6 +166,7 @@ s! { } } +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const SIGSTKSZ: ::size_t = 10240; pub const MINSIGSTKSZ: ::size_t = 4096; diff --git a/src/unix/notbsd/linux/musl/b32/x86.rs b/src/unix/notbsd/linux/musl/b32/x86.rs index 0f620fe5..95395f0a 100644 --- a/src/unix/notbsd/linux/musl/b32/x86.rs +++ b/src/unix/notbsd/linux/musl/b32/x86.rs @@ -242,6 +242,7 @@ pub const RLIMIT_NPROC: ::c_int = 6; pub const RLIMIT_MEMLOCK: ::c_int = 8; pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MCL_CURRENT: ::c_int = 0x0001; pub const MCL_FUTURE: ::c_int = 0x0002; pub const CBAUD: ::tcflag_t = 0o0010017; diff --git a/src/unix/notbsd/linux/musl/b64/aarch64.rs b/src/unix/notbsd/linux/musl/b64/aarch64.rs index 018aaa9b..af654e31 100644 --- a/src/unix/notbsd/linux/musl/b64/aarch64.rs +++ b/src/unix/notbsd/linux/musl/b64/aarch64.rs @@ -75,6 +75,7 @@ pub const PF_MAX: ::c_int = 45; #[doc(hidden)] pub const AF_MAX: ::c_int = PF_MAX; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const SYS_io_setup: ::c_long = 0; pub const SYS_io_destroy: ::c_long = 1; pub const SYS_io_submit: ::c_long = 2; diff --git a/src/unix/notbsd/linux/musl/b64/powerpc64.rs b/src/unix/notbsd/linux/musl/b64/powerpc64.rs index 8f16047e..42306690 100644 --- a/src/unix/notbsd/linux/musl/b64/powerpc64.rs +++ b/src/unix/notbsd/linux/musl/b64/powerpc64.rs @@ -60,6 +60,7 @@ s! { } } +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_32BIT: ::c_int = 0x0040; pub const O_DIRECT: ::c_int = 0x20000; pub const O_DIRECTORY: ::c_int = 0x4000; diff --git a/src/unix/notbsd/linux/musl/b64/x86_64.rs b/src/unix/notbsd/linux/musl/b64/x86_64.rs index 3a908354..3e2f1a43 100644 --- a/src/unix/notbsd/linux/musl/b64/x86_64.rs +++ b/src/unix/notbsd/linux/musl/b64/x86_64.rs @@ -483,6 +483,7 @@ pub const ES: ::c_int = 24; pub const FS: ::c_int = 25; pub const GS: ::c_int = 26; +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MAP_32BIT: ::c_int = 0x0040; pub const O_DIRECT: ::c_int = 0x4000; pub const O_DIRECTORY: ::c_int = 0x10000; diff --git a/src/unix/notbsd/linux/other/mod.rs b/src/unix/notbsd/linux/other/mod.rs index 2ebb2acb..351995e1 100644 --- a/src/unix/notbsd/linux/other/mod.rs +++ b/src/unix/notbsd/linux/other/mod.rs @@ -309,6 +309,7 @@ cfg_if! { } } +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MS_RMT_MASK: ::c_ulong = 0x02800051; pub const __UT_LINESIZE: usize = 32; diff --git a/src/unix/notbsd/linux/s390x/mod.rs b/src/unix/notbsd/linux/s390x/mod.rs index 7785f9d5..ba8bc3a8 100644 --- a/src/unix/notbsd/linux/s390x/mod.rs +++ b/src/unix/notbsd/linux/s390x/mod.rs @@ -353,6 +353,7 @@ cfg_if! { } } +pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const MS_RMT_MASK: ::c_ulong = 0x02800051; pub const SFD_CLOEXEC: ::c_int = 0x080000; diff --git a/src/unix/notbsd/mod.rs b/src/unix/notbsd/mod.rs index 2b6d6637..fcf1299d 100644 --- a/src/unix/notbsd/mod.rs +++ b/src/unix/notbsd/mod.rs @@ -643,7 +643,6 @@ pub const MADV_NOHUGEPAGE: ::c_int = 15; pub const MADV_DONTDUMP: ::c_int = 16; pub const MADV_DODUMP: ::c_int = 17; pub const MADV_HWPOISON: ::c_int = 100; -pub const MADV_SOFT_OFFLINE: ::c_int = 101; pub const IFF_UP: ::c_int = 0x1; pub const IFF_BROADCAST: ::c_int = 0x2; -- GitLab