diff --git a/build.rs b/build.rs index b9a8305918518..da2fbe3544302 100644 --- a/build.rs +++ b/build.rs @@ -131,6 +131,11 @@ fn main() { } } + let uclibc_use_time64 = env_flag("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64"); + if target_env == "uclibc" && uclibc_use_time64 { + set_cfg("linux_time_bits64"); + } + let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok(); println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64"); if linux_time_bits64 { diff --git a/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile b/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile index 284389360ac2c..96a12e148cdc1 100644 --- a/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile +++ b/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile @@ -14,11 +14,9 @@ RUN sed -i -E 's/(archive|security)\.ubuntu\.com/old-releases.ubuntu.com/g' \ qemu-user \ xz-utils -RUN mkdir /toolchain - -RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2021.11-1.tar.bz2 | \ - tar xjf - -C /toolchain --strip-components=1 -RUN /toolchain/relocate-sdk.sh +ARG TEST_UCLIBC_TIIME64 +COPY install-uclibc.sh / +RUN /install-uclibc.sh "$TEST_UCLIBC_TIIME64" ENV PATH=$PATH:/rust/bin:/toolchain/bin \ STAGING_DIR=/toolchain/armv7-buildroot-linux-uclibceabihf/sysroot \ diff --git a/ci/install-uclibc.sh b/ci/install-uclibc.sh new file mode 100644 index 0000000000000..d4cd6593af628 --- /dev/null +++ b/ci/install-uclibc.sh @@ -0,0 +1,20 @@ +#!/usr/bin/bash +# +# Installs the appropriate uclibc toolchain into /toolchain + +set -eux + +time64="$1" + +if [ "${time64:-0}" != "0" ]; then + version='bleeding-edge-2025.08-1' +else + version='bleeding-edge-2024.05-1' # last version with 32-bit time_t +fi + +mkdir /toolchain + +curl --retry 5 -L "https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--${version}.tar.xz" | \ +tar xjf - -C /toolchain --strip-components=1 + +/toolchain/relocate-sdk.sh diff --git a/ci/run-docker.sh b/ci/run-docker.sh index 838ba10543a7f..31e27c11faf80 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -44,6 +44,11 @@ run() { fi fi + if [ -n "${TEST_UCLIBC_TIIME64:-}" ]; then + build_args+=("--build-arg=TEST_UCLIBC_TIIME64=1") + export RUSTFLAGS="$RUSTFLAGS --cfg=libc_unstable_uclibc_time64" + fi + # use -f so we can use ci/ as build context docker build "${build_args[@]}" diff --git a/libc-test/build.rs b/libc-test/build.rs index 3d5fd89d34478..c0a5b8f70bcfb 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3736,6 +3736,12 @@ fn test_linux(target: &str) { cfg.cfg("musl_redir_time64", None); } } + let uclibc_use_time64 = env::var("CARGO_CFG_LIBC_UNSTABLE_UCLIBC_TIME64") + .map(|val| val != "0") + .unwrap_or(false); + if uclibc && uclibc_use_time64 { + cfg.cfg("linux_time_bits64", None); + } cfg.define("_GNU_SOURCE", None) // This macro re-defines fscanf,scanf,sscanf to link to the symbols that are // deprecated since glibc >= 2.29. This allows Rust binaries to link against @@ -3939,9 +3945,14 @@ fn test_linux(target: &str) { "linux/wait.h", "linux/wireless.h", "sys/fanotify.h", - // is not present on uclibc - (!uclibc, "sys/auxv.h"), + "sys/auxv.h", (gnu || musl, "linux/close_range.h"), + (uclibc, "linux/fanotify.h"), + (uclibc, "linux/auxvec.h"), + (uclibc, "linux/close_range.h"), + (uclibc, "linux/if_packet.h"), + (uclibc, "linux/elf-em.h"), + (uclibc, "sys/resource.h"), ); } @@ -4177,6 +4188,18 @@ fn test_linux(target: &str) { // On 64 bits the size did not change, skip only for 32 bits. "ptrace_syscall_info" if pointer_width == 32 => true, + "canxl_frame" + | "fanotify_event_info_header" // not in sys/fanotify.h in uclibc + | "fanotify_event_info_fid" // not in sys/fanotify.h in uclibc + | "tls12_crypto_info_sm4_gcm" + | "tls12_crypto_info_sm4_ccm" + | "tls12_crypto_info_aria_gcm_128" + | "tls12_crypto_info_aria_gcm_256" + if uclibc => + { + true + } + _ => false, } }); @@ -4302,6 +4325,170 @@ fn test_linux(target: &str) { } } + if uclibc { + match name { + // The canonical uClibc toolchain, bootlin bleeding-edge-2024.02-1, + // uses linux 5.15, so several constants are not available. + + // requires linux 5.16 + "PR_SCHED_CORE_SCOPE_PROCESS_GROUP" + | "PR_SCHED_CORE_SCOPE_THREAD_GROUP" + | "PR_SCHED_CORE_SCOPE_THREAD" + | "NF_NETDEV_EGRESS" + | "SO_RESERVE_MEM" => return true, + + // TLS_CIPHER_SM4_[GC]CM requires linux 5.16 + "TLS_CIPHER_SM4_CCM_IV_SIZE" + | "TLS_CIPHER_SM4_CCM_KEY_SIZE" + | "TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE" + | "TLS_CIPHER_SM4_CCM_SALT_SIZE" + | "TLS_CIPHER_SM4_CCM_TAG_SIZE" + | "TLS_CIPHER_SM4_CCM" + | "TLS_CIPHER_SM4_GCM_IV_SIZE" + | "TLS_CIPHER_SM4_GCM_KEY_SIZE" + | "TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE" + | "TLS_CIPHER_SM4_GCM_SALT_SIZE" + | "TLS_CIPHER_SM4_GCM_TAG_SIZE" + | "TLS_CIPHER_SM4_GCM" => return true, + + // requires linux 5.17 + "PR_SET_VMA_ANON_NAME" + | "PR_SET_VMA" + | "RTNLGRP_MCTP_IFADDR" => return true, + + // requires linux 5.18 + "RTNLGRP_STATS" + | "RTNLGRP_TUNNEL" + | "TLS_TX_ZEROCOPY_RO" + | "MADV_DONTNEED_LOCKED" + | "NFQA_PRIORITY" + | "SO_TXREHASH" => return true, + + // requires linux 5.19 + "SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV" + | "NLM_F_BULK" + | "SO_RCVMARK" + | "TLS_INFO_ZC_RO_TX" => return true, + + // CAN_* consts requiring linux 6.0 + "CAN_BUS_OFF_THRESHOLD" + | "CAN_CTRLMODE_TDC_AUTO" + | "CAN_CTRLMODE_TDC_MANUAL" + | "CAN_ERR_CNT" + | "CAN_ERROR_PASSIVE_THRESHOLD" + | "CAN_ERROR_WARNING_THRESHOLD" => return true, + + // requires linux 6.0 + "IFF_NO_CARRIER" + | "TLS_INFO_RX_NO_PAD" + | "TLS_RX_EXPECT_NO_PAD" => return true, + + // CAN_* consts requiring linux 6.1 + "CAN_RAW_XL_FRAMES" + | "CANXL_HDR_SIZE" + | "CANXL_MAX_DLC_MASK" + | "CANXL_MAX_DLC" + | "CANXL_MAX_DLEN" + | "CANXL_MAX_MTU" + | "CANXL_MIN_DLC" + | "CANXL_MIN_DLEN" + | "CANXL_MIN_MTU" + | "CANXL_MTU" + | "CANXL_PRIO_BITS" + | "CANXL_PRIO_MASK" + | "CANXL_SEC" + | "CANXL_XLF" => return true, + + // TLS_CIPHER_ARIA_GCM_* requires linux 6.1 + "TLS_CIPHER_ARIA_GCM_128_IV_SIZE" + | "TLS_CIPHER_ARIA_GCM_128_KEY_SIZE" + | "TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE" + | "TLS_CIPHER_ARIA_GCM_128_SALT_SIZE" + | "TLS_CIPHER_ARIA_GCM_128_TAG_SIZE" + | "TLS_CIPHER_ARIA_GCM_128" + | "TLS_CIPHER_ARIA_GCM_256_IV_SIZE" + | "TLS_CIPHER_ARIA_GCM_256_KEY_SIZE" + | "TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE" + | "TLS_CIPHER_ARIA_GCM_256_SALT_SIZE" + | "TLS_CIPHER_ARIA_GCM_256_TAG_SIZE" + | "TLS_CIPHER_ARIA_GCM_256" => return true, + + // requires linux 6.2 + "ALG_SET_KEY_BY_KEY_SERIAL" + | "PACKET_FANOUT_FLAG_IGNORE_OUTGOING" + | "SOF_TIMESTAMPING_OPT_ID_TCP" + | "TUN_F_USO4" + | "TUN_F_USO6" => return true, + + // FAN_* consts require kernel 6.3 + "FAN_INFO" + | "FAN_RESPONSE_INFO_AUDIT_RULE" + | "FAN_RESPONSE_INFO_NONE" => return true, + + // requires linux 6.3 + "MFD_EXEC" + | "MFD_NOEXEC_SEAL" + | "PR_GET_MDWE" + | "PR_SET_MDWE" => return true, + + // requires linux 6.4 + "PACKET_VNET_HDR_SZ" => return true, + + // requires linux 6.5 + "SO_PASSPIDFD" + | "SO_PEERPIDFD" => return true, + + // requires linux 6.6 + "PR_MDWE_NO_INHERIT" + | "PR_MDWE_REFUSE_EXEC_GAIN" => return true, + + // defined as a synonym for EM_ARC_COMPACT in gnu but not uclibc + "EM_ARC_A5" => return true, + + /* + Here are a list of kernel UAPI constants which appear in linux/ headers, + but cannot be imported due to conflicts with the uclibc headers. + The conflicting linux/ header is noted. + */ + // linux/signal.h + "BUS_MCEERR_AO" + | "BUS_MCEERR_AR" + // linux/termios.h + | "EXTPROC" + // linux/inotify.h + | "IN_MASK_CREATE" + // linux/in.h + | "IPPROTO_BEETPH" + | "IPPROTO_ETHERNET" + | "IPPROTO_MPLS" + | "IPPROTO_MPTCP" + // linux/in6.h + | "IPV6_HDRINCL" + | "IPV6_MULTICAST_ALL" + | "IPV6_PMTUDISC_INTERFACE" + | "IPV6_PMTUDISC_OMIT" + | "IPV6_ROUTER_ALERT_ISOLATE" + // linux/elf.h + | "NT_PRFPREG" + // linux/sem.h + | "SEM_STAT_ANY" + // linux/shm.h + | "SHM_EXEC" + // linux/signal.h + | "SI_DETHREAD" + | "TRAP_BRANCH" + | "TRAP_HWBKPT" + | "TRAP_UNK" + // linux/timerfd.h + | "TFD_TIMER_CANCEL_ON_SET" + // linux/udp.h + | "UDP_GRO" + | "UDP_SEGMENT" => return true, + + _ => (), + } + } + match name { // These constants are not available if gnu headers have been included // and can therefore not be tested here @@ -4365,25 +4552,6 @@ fn test_linux(target: &str) { // Skip as this signal codes and trap reasons need newer headers "TRAP_PERF" => true, - // kernel constants not available in uclibc 1.0.34 - "EXTPROC" - | "IPPROTO_BEETPH" - | "IPPROTO_MPLS" - | "IPV6_HDRINCL" - | "IPV6_MULTICAST_ALL" - | "IPV6_PMTUDISC_INTERFACE" - | "IPV6_PMTUDISC_OMIT" - | "IPV6_ROUTER_ALERT_ISOLATE" - | "PACKET_MR_UNICAST" - | "RUSAGE_THREAD" - | "SHM_EXEC" - | "UDP_GRO" - | "UDP_SEGMENT" - if uclibc => - { - true - } - // headers conflicts with linux/pidfd.h "PIDFD_NONBLOCK" => true, // Linux >= 6.9 @@ -4424,6 +4592,10 @@ fn test_linux(target: &str) { // value changed "NF_NETDEV_NUMHOOKS" if sparc64 => true, + // Canonical uclibc latest from toolchains.bootlin.com is based on kernel 5.15, + // so opt out of tests for constants which are different in later kernels. + "NF_NETDEV_NUMHOOKS" | "RLIM_NLIMITS" | "NFT_MSG_MAX" if uclibc => true, + // kernel 6.9 minimum "RWF_NOAPPEND" => true, @@ -4633,8 +4805,9 @@ fn test_linux(target: &str) { // Needs glibc 2.33 or later. "mallinfo2" => true, - // Not defined in uclibc as of 1.0.34 + // Not defined in uclibc as of 1.0.45 "gettid" if uclibc => true, + "getauxval" if uclibc => true, // There are two versions of basename(3) on Linux with glibc, see // @@ -4766,7 +4939,7 @@ fn test_linux(target: &str) { // FIXME(linux): `max_phase_adj` requires >= 5.19 kernel headers // the rsv field shrunk when those fields got added, so is omitted too ("ptp_clock_caps", "adjust_phase" | "max_phase_adj" | "rsv") - if loongarch64 || sparc64 => + if loongarch64 || sparc64 || uclibc => { true } @@ -4783,7 +4956,7 @@ fn test_linux(target: &str) { ("bcm_msg_head", "frames") => true, // FAM ("af_alg_iv", "iv") => true, - ("file_handle", "f_handle") if musl => true, + ("file_handle", "f_handle") if musl || uclibc => true, // FIXME(ctest): ctest does not translate the rust code which computes the padding size ("pthread_cond_t", "__padding") if l4re => true, _ => false, diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 6f1261972e9f3..dd7f33db923b4 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1386,6 +1386,7 @@ s_no_extra_traits! { } pub const POSIX_SPAWN_USEVFORK: c_short = 64; +#[cfg(not(target_env = "uclibc"))] pub const POSIX_SPAWN_SETSID: c_short = 128; pub const F_SEAL_FUTURE_WRITE: c_int = 0x0010; diff --git a/src/unix/linux_like/linux/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs index 26dd49b24465b..1c09954cc834d 100644 --- a/src/unix/linux_like/linux/uclibc/arm/mod.rs +++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs @@ -2,7 +2,17 @@ use crate::off64_t; use crate::prelude::*; pub type wchar_t = c_uint; -pub type time_t = c_long; + +cfg_if! { + // Set cfg(libc_unstable_uclibc_time64) in rustflags if your uclibc has 64-bit time + if #[cfg(linux_time_bits64)] { + pub type time_t = c_longlong; + pub type suseconds_t = c_longlong; + } else { + pub type time_t = c_long; + pub type suseconds_t = c_long; + } +} pub type clock_t = c_long; pub type fsblkcnt_t = c_ulong; @@ -10,7 +20,6 @@ pub type fsfilcnt_t = c_ulong; pub type ino_t = c_ulong; pub type off_t = c_long; pub type pthread_t = c_ulong; -pub type suseconds_t = c_long; pub type nlink_t = c_uint; pub type blksize_t = c_long; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index f70e0c41aeed1..a90c87bbf4d53 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -87,37 +87,6 @@ s! { pub nr: crate::__s32, } - #[cfg_attr( - any( - target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64" - ), - repr(align(4)) - )] - #[cfg_attr( - not(any( - target_pointer_width = "32", - target_arch = "x86_64", - target_arch = "powerpc64", - target_arch = "mips64", - target_arch = "s390x", - target_arch = "sparc64" - )), - repr(align(8)) - )] - pub struct pthread_mutexattr_t { - size: [u8; crate::__SIZEOF_PTHREAD_MUTEXATTR_T], - } - - #[repr(align(4))] - pub struct pthread_condattr_t { - size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T], - } - pub struct tcp_info { pub tcpi_state: u8, pub tcpi_ca_state: u8, @@ -297,64 +266,6 @@ pub const ENOTSUP: c_int = EOPNOTSUPP; pub const IPV6_JOIN_GROUP: c_int = 20; pub const IPV6_LEAVE_GROUP: c_int = 21; -// These are different from GNU -pub const ABDAY_1: crate::nl_item = 0x300; -pub const ABDAY_2: crate::nl_item = 0x301; -pub const ABDAY_3: crate::nl_item = 0x302; -pub const ABDAY_4: crate::nl_item = 0x303; -pub const ABDAY_5: crate::nl_item = 0x304; -pub const ABDAY_6: crate::nl_item = 0x305; -pub const ABDAY_7: crate::nl_item = 0x306; -pub const DAY_1: crate::nl_item = 0x307; -pub const DAY_2: crate::nl_item = 0x308; -pub const DAY_3: crate::nl_item = 0x309; -pub const DAY_4: crate::nl_item = 0x30A; -pub const DAY_5: crate::nl_item = 0x30B; -pub const DAY_6: crate::nl_item = 0x30C; -pub const DAY_7: crate::nl_item = 0x30D; -pub const ABMON_1: crate::nl_item = 0x30E; -pub const ABMON_2: crate::nl_item = 0x30F; -pub const ABMON_3: crate::nl_item = 0x310; -pub const ABMON_4: crate::nl_item = 0x311; -pub const ABMON_5: crate::nl_item = 0x312; -pub const ABMON_6: crate::nl_item = 0x313; -pub const ABMON_7: crate::nl_item = 0x314; -pub const ABMON_8: crate::nl_item = 0x315; -pub const ABMON_9: crate::nl_item = 0x316; -pub const ABMON_10: crate::nl_item = 0x317; -pub const ABMON_11: crate::nl_item = 0x318; -pub const ABMON_12: crate::nl_item = 0x319; -pub const MON_1: crate::nl_item = 0x31A; -pub const MON_2: crate::nl_item = 0x31B; -pub const MON_3: crate::nl_item = 0x31C; -pub const MON_4: crate::nl_item = 0x31D; -pub const MON_5: crate::nl_item = 0x31E; -pub const MON_6: crate::nl_item = 0x31F; -pub const MON_7: crate::nl_item = 0x320; -pub const MON_8: crate::nl_item = 0x321; -pub const MON_9: crate::nl_item = 0x322; -pub const MON_10: crate::nl_item = 0x323; -pub const MON_11: crate::nl_item = 0x324; -pub const MON_12: crate::nl_item = 0x325; -pub const AM_STR: crate::nl_item = 0x326; -pub const PM_STR: crate::nl_item = 0x327; -pub const D_T_FMT: crate::nl_item = 0x328; -pub const D_FMT: crate::nl_item = 0x329; -pub const T_FMT: crate::nl_item = 0x32A; -pub const T_FMT_AMPM: crate::nl_item = 0x32B; -pub const ERA: crate::nl_item = 0x32C; -pub const ERA_D_FMT: crate::nl_item = 0x32E; -pub const ALT_DIGITS: crate::nl_item = 0x32F; -pub const ERA_D_T_FMT: crate::nl_item = 0x330; -pub const ERA_T_FMT: crate::nl_item = 0x331; -pub const CODESET: crate::nl_item = 10; -pub const CRNCYSTR: crate::nl_item = 0x215; -pub const RADIXCHAR: crate::nl_item = 0x100; -pub const THOUSEP: crate::nl_item = 0x101; -pub const NOEXPR: crate::nl_item = 0x501; -pub const YESSTR: crate::nl_item = 0x502; -pub const NOSTR: crate::nl_item = 0x503; - // Different than Gnu. pub const FILENAME_MAX: c_uint = 4095; @@ -418,7 +329,6 @@ pub const SOCK_PACKET: c_int = 10; pub const TCP_COOKIE_TRANSACTIONS: c_int = 15; pub const UDP_GRO: c_int = 104; pub const UDP_SEGMENT: c_int = 103; -pub const YESEXPR: c_int = ((5) << 8) | (0); extern "C" { pub fn gettimeofday(tp: *mut crate::timeval, tz: *mut crate::timezone) -> c_int; diff --git a/src/unix/linux_like/linux_l4re_shared.rs b/src/unix/linux_like/linux_l4re_shared.rs index cf76b3966ffac..b9d7c0774c2be 100644 --- a/src/unix/linux_like/linux_l4re_shared.rs +++ b/src/unix/linux_like/linux_l4re_shared.rs @@ -805,11 +805,9 @@ pub const EM_M32R: u16 = 88; pub const EM_MN10300: u16 = 89; pub const EM_MN10200: u16 = 90; pub const EM_PJ: u16 = 91; -#[cfg(not(target_env = "uclibc"))] pub const EM_OPENRISC: u16 = 92; #[cfg(target_env = "uclibc")] pub const EM_OR1K: u16 = 92; -#[cfg(not(target_env = "uclibc"))] pub const EM_ARC_A5: u16 = 93; pub const EM_XTENSA: u16 = 94; pub const EM_AARCH64: u16 = 183; @@ -884,7 +882,6 @@ pub const AT_EXECFN: c_ulong = 31; // defined in arch//include/uapi/asm/auxvec.h but has the same value // wherever it is defined. pub const AT_SYSINFO_EHDR: c_ulong = 33; -#[cfg(not(target_env = "uclibc"))] pub const AT_MINSIGSTKSZ: c_ulong = 51; pub const GLOB_ERR: c_int = 1 << 0; @@ -939,21 +936,16 @@ pub const PTHREAD_MUTEX_NORMAL: c_int = 0; pub const PTHREAD_MUTEX_RECURSIVE: c_int = 1; pub const PTHREAD_MUTEX_ERRORCHECK: c_int = 2; pub const PTHREAD_MUTEX_DEFAULT: c_int = PTHREAD_MUTEX_NORMAL; -#[cfg(not(target_env = "uclibc"))] pub const PTHREAD_MUTEX_STALLED: c_int = 0; -#[cfg(not(target_env = "uclibc"))] pub const PTHREAD_MUTEX_ROBUST: c_int = 1; -#[cfg(not(target_env = "uclibc"))] pub const PTHREAD_PRIO_NONE: c_int = 0; -#[cfg(not(target_env = "uclibc"))] pub const PTHREAD_PRIO_INHERIT: c_int = 1; -#[cfg(not(target_env = "uclibc"))] pub const PTHREAD_PRIO_PROTECT: c_int = 2; pub const PTHREAD_PROCESS_PRIVATE: c_int = 0; pub const PTHREAD_PROCESS_SHARED: c_int = 1; pub const PTHREAD_INHERIT_SCHED: c_int = 0; pub const PTHREAD_EXPLICIT_SCHED: c_int = 1; -#[cfg(not(all(target_os = "l4re", target_env = "uclibc")))] +#[cfg(not(target_os = "l4re"))] pub const __SIZEOF_PTHREAD_COND_T: usize = 48; // netinet/in.h @@ -1196,26 +1188,22 @@ pub const CMSPAR: crate::tcflag_t = 0o10000000000; pub const MFD_CLOEXEC: c_uint = 0x0001; pub const MFD_ALLOW_SEALING: c_uint = 0x0002; pub const MFD_HUGETLB: c_uint = 0x0004; -cfg_if! { - if #[cfg(not(target_env = "uclibc"))] { - pub const MFD_NOEXEC_SEAL: c_uint = 0x0008; - pub const MFD_EXEC: c_uint = 0x0010; - pub const MFD_HUGE_64KB: c_uint = 0x40000000; - pub const MFD_HUGE_512KB: c_uint = 0x4c000000; - pub const MFD_HUGE_1MB: c_uint = 0x50000000; - pub const MFD_HUGE_2MB: c_uint = 0x54000000; - pub const MFD_HUGE_8MB: c_uint = 0x5c000000; - pub const MFD_HUGE_16MB: c_uint = 0x60000000; - pub const MFD_HUGE_32MB: c_uint = 0x64000000; - pub const MFD_HUGE_256MB: c_uint = 0x70000000; - pub const MFD_HUGE_512MB: c_uint = 0x74000000; - pub const MFD_HUGE_1GB: c_uint = 0x78000000; - pub const MFD_HUGE_2GB: c_uint = 0x7c000000; - pub const MFD_HUGE_16GB: c_uint = 0x88000000; - pub const MFD_HUGE_MASK: c_uint = 63; - pub const MFD_HUGE_SHIFT: c_uint = 26; - } -} +pub const MFD_NOEXEC_SEAL: c_uint = 0x0008; +pub const MFD_EXEC: c_uint = 0x0010; +pub const MFD_HUGE_64KB: c_uint = 0x40000000; +pub const MFD_HUGE_512KB: c_uint = 0x4c000000; +pub const MFD_HUGE_1MB: c_uint = 0x50000000; +pub const MFD_HUGE_2MB: c_uint = 0x54000000; +pub const MFD_HUGE_8MB: c_uint = 0x5c000000; +pub const MFD_HUGE_16MB: c_uint = 0x60000000; +pub const MFD_HUGE_32MB: c_uint = 0x64000000; +pub const MFD_HUGE_256MB: c_uint = 0x70000000; +pub const MFD_HUGE_512MB: c_uint = 0x74000000; +pub const MFD_HUGE_1GB: c_uint = 0x78000000; +pub const MFD_HUGE_2GB: c_uint = 0x7c000000; +pub const MFD_HUGE_16GB: c_uint = 0x88000000; +pub const MFD_HUGE_MASK: c_uint = 63; +pub const MFD_HUGE_SHIFT: c_uint = 26; // linux/if_packet.h pub const PACKET_HOST: c_uchar = 0; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 2cfa9784a5e84..1929fcac37a48 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -805,11 +805,8 @@ pub const IP_TRANSPARENT: c_int = 19; pub const IP_ORIGDSTADDR: c_int = 20; pub const IP_RECVORIGDSTADDR: c_int = IP_ORIGDSTADDR; pub const IP_MINTTL: c_int = 21; -#[cfg(not(target_env = "uclibc"))] pub const IP_NODEFRAG: c_int = 22; -#[cfg(not(target_env = "uclibc"))] pub const IP_CHECKSUM: c_int = 23; -#[cfg(not(target_env = "uclibc"))] pub const IP_BIND_ADDRESS_NO_PORT: c_int = 24; pub const IP_MULTICAST_IF: c_int = 32; pub const IP_MULTICAST_TTL: c_int = 33; @@ -831,9 +828,7 @@ pub const IP_PMTUDISC_DONT: c_int = 0; pub const IP_PMTUDISC_WANT: c_int = 1; pub const IP_PMTUDISC_DO: c_int = 2; pub const IP_PMTUDISC_PROBE: c_int = 3; -#[cfg(not(target_env = "uclibc"))] pub const IP_PMTUDISC_INTERFACE: c_int = 4; -#[cfg(not(target_env = "uclibc"))] pub const IP_PMTUDISC_OMIT: c_int = 5; // IPPROTO_IP defined in src/unix/mod.rs @@ -943,32 +938,25 @@ pub const IPV6_RECVRTHDR: c_int = 56; pub const IPV6_RTHDR: c_int = 57; pub const IPV6_RECVDSTOPTS: c_int = 58; pub const IPV6_DSTOPTS: c_int = 59; -#[cfg(not(target_env = "uclibc"))] pub const IPV6_RECVPATHMTU: c_int = 60; -#[cfg(not(target_env = "uclibc"))] pub const IPV6_PATHMTU: c_int = 61; -#[cfg(not(target_env = "uclibc"))] pub const IPV6_DONTFRAG: c_int = 62; pub const IPV6_RECVTCLASS: c_int = 66; pub const IPV6_TCLASS: c_int = 67; -cfg_if! { - if #[cfg(not(target_env = "uclibc"))] { - pub const IPV6_AUTOFLOWLABEL: c_int = 70; - pub const IPV6_ADDR_PREFERENCES: c_int = 72; - pub const IPV6_MINHOPCOUNT: c_int = 73; - pub const IPV6_ORIGDSTADDR: c_int = 74; - pub const IPV6_RECVORIGDSTADDR: c_int = IPV6_ORIGDSTADDR; - pub const IPV6_TRANSPARENT: c_int = 75; - pub const IPV6_UNICAST_IF: c_int = 76; - pub const IPV6_PREFER_SRC_TMP: c_int = 0x0001; - pub const IPV6_PREFER_SRC_PUBLIC: c_int = 0x0002; - pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT: c_int = 0x0100; - pub const IPV6_PREFER_SRC_COA: c_int = 0x0004; - pub const IPV6_PREFER_SRC_HOME: c_int = 0x0400; - pub const IPV6_PREFER_SRC_CGA: c_int = 0x0008; - pub const IPV6_PREFER_SRC_NONCGA: c_int = 0x0800; - } -} +pub const IPV6_AUTOFLOWLABEL: c_int = 70; +pub const IPV6_ADDR_PREFERENCES: c_int = 72; +pub const IPV6_MINHOPCOUNT: c_int = 73; +pub const IPV6_ORIGDSTADDR: c_int = 74; +pub const IPV6_RECVORIGDSTADDR: c_int = IPV6_ORIGDSTADDR; +pub const IPV6_TRANSPARENT: c_int = 75; +pub const IPV6_UNICAST_IF: c_int = 76; +pub const IPV6_PREFER_SRC_TMP: c_int = 0x0001; +pub const IPV6_PREFER_SRC_PUBLIC: c_int = 0x0002; +pub const IPV6_PREFER_SRC_PUBTMP_DEFAULT: c_int = 0x0100; +pub const IPV6_PREFER_SRC_COA: c_int = 0x0004; +pub const IPV6_PREFER_SRC_HOME: c_int = 0x0400; +pub const IPV6_PREFER_SRC_CGA: c_int = 0x0008; +pub const IPV6_PREFER_SRC_NONCGA: c_int = 0x0800; pub const IPV6_PMTUDISC_DONT: c_int = 0; pub const IPV6_PMTUDISC_WANT: c_int = 1; @@ -1219,14 +1207,10 @@ pub const __WNOTHREAD: c_int = 0x20000000; pub const __WALL: c_int = 0x40000000; pub const __WCLONE: c_int = 0x80000000; -cfg_if! { - if #[cfg(not(target_env = "uclibc"))] { - pub const SPLICE_F_MOVE: c_uint = 0x01; - pub const SPLICE_F_NONBLOCK: c_uint = 0x02; - pub const SPLICE_F_MORE: c_uint = 0x04; - pub const SPLICE_F_GIFT: c_uint = 0x08; - } -} +pub const SPLICE_F_MOVE: c_uint = 0x01; +pub const SPLICE_F_NONBLOCK: c_uint = 0x02; +pub const SPLICE_F_MORE: c_uint = 0x04; +pub const SPLICE_F_GIFT: c_uint = 0x08; pub const RTLD_LOCAL: c_int = 0; pub const RTLD_LAZY: c_int = 1;