From 5316a1196df9670c513af992dc0ecb8ee66c08dc Mon Sep 17 00:00:00 2001 From: Dirreke Date: Thu, 1 Feb 2024 21:45:11 +0800 Subject: [PATCH 01/23] [Backport #3547] Add ioctl FS_IOC_{G,S}{ETVERSION,ETFLAGS} for CSKY --- src/unix/linux_like/linux/arch/generic/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/linux_like/linux/arch/generic/mod.rs b/src/unix/linux_like/linux/arch/generic/mod.rs index 83f97fbd9293..2f437e16db26 100644 --- a/src/unix/linux_like/linux/arch/generic/mod.rs +++ b/src/unix/linux_like/linux/arch/generic/mod.rs @@ -218,7 +218,7 @@ cfg_if! { // where S stands for size (int, long, struct...) // where T stands for type ('f','v','X'...) // where N stands for NR (NumbeR) - if #[cfg(any(target_arch = "x86", target_arch = "arm"))] { + if #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "csky"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80046601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40046602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x80047601; From 8bc1512c5f272b7478607e6be624f92527dc641d Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 18 Feb 2024 21:46:22 +0900 Subject: [PATCH 02/23] Fix CI on v0.2 --- .github/workflows/full_ci.yml | 8 ++++---- .github/workflows/main.yml | 8 ++++---- libc-test/build.rs | 5 +++++ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/full_ci.yml b/.github/workflows/full_ci.yml index 605802d3c930..f3067925da2b 100644 --- a/.github/workflows/full_ci.yml +++ b/.github/workflows/full_ci.yml @@ -63,10 +63,10 @@ jobs: ARCH_BITS: 64 ARCH: x86_64 - target: x86_64-pc-windows-msvc - - target: i686-pc-windows-gnu - env: - ARCH_BITS: 32 - ARCH: i686 + #- target: i686-pc-windows-gnu + # env: + # ARCH_BITS: 32 + # ARCH: i686 - target: i686-pc-windows-msvc steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c7784fc117df..d22a4a19cc56 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,10 +58,10 @@ jobs: ARCH_BITS: 64 ARCH: x86_64 - target: x86_64-pc-windows-msvc - - target: i686-pc-windows-gnu - env: - ARCH_BITS: 32 - ARCH: i686 + #- target: i686-pc-windows-gnu + # env: + # ARCH_BITS: 32 + # ARCH: i686 - target: i686-pc-windows-msvc steps: - uses: actions/checkout@v4 diff --git a/libc-test/build.rs b/libc-test/build.rs index 782a65b74915..77be86299ab1 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -312,6 +312,8 @@ fn test_apple(target: &str) { // it is a moving target, changing through versions // also contains bitfields members "tcp_connection_info" => true, + // FIXME: The size is changed in recent macOSes. + "malloc_introspection_t" => true, _ => false, } @@ -2468,6 +2470,9 @@ fn test_freebsd(target: &str) { true } + // FIXME: Removed in FreeBSD 15: + "LOCAL_CONNWAIT" if freebsd_ver >= Some(15) => true, + _ => false, } }); From 614cfe182c9cbdd49af447092fba136ea0e93392 Mon Sep 17 00:00:00 2001 From: Xeonacid Date: Sun, 11 Feb 2024 12:18:27 +0800 Subject: [PATCH 03/23] Add Linux riscv64 HWCAP defines From https://elixir.bootlin.com/linux/latest/source/arch/riscv/include/uapi/asm/hwcap.h Signed-off-by: Xeonacid --- libc-test/build.rs | 1 + libc-test/semver/linux-riscv64gc.txt | 7 +++++++ src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs | 8 ++++++++ 3 files changed, 16 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index 77be86299ab1..0d52a86053b8 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3448,6 +3448,7 @@ fn test_linux(target: &str) { // Include linux headers at the end: headers! { cfg: + [riscv64]: "asm/hwcap.h", "asm/mman.h", [gnu]: "linux/aio_abi.h", "linux/can.h", diff --git a/libc-test/semver/linux-riscv64gc.txt b/libc-test/semver/linux-riscv64gc.txt index cc4d97fe6fa5..4f270540cc3a 100644 --- a/libc-test/semver/linux-riscv64gc.txt +++ b/libc-test/semver/linux-riscv64gc.txt @@ -69,3 +69,10 @@ TIOCSRS485 flock64 fsblkcnt64_t fsfilcnt64_t +COMPAT_HWCAP_ISA_I +COMPAT_HWCAP_ISA_M +COMPAT_HWCAP_ISA_A +COMPAT_HWCAP_ISA_F +COMPAT_HWCAP_ISA_D +COMPAT_HWCAP_ISA_C +COMPAT_HWCAP_ISA_V diff --git a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs index 8e06a135baa4..64f5cf10f858 100644 --- a/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs @@ -540,6 +540,14 @@ pub const REG_A0: usize = 10; pub const REG_S2: usize = 18; pub const REG_NARGS: usize = 8; +pub const COMPAT_HWCAP_ISA_I: ::c_ulong = 1 << (b'I' - b'A'); +pub const COMPAT_HWCAP_ISA_M: ::c_ulong = 1 << (b'M' - b'A'); +pub const COMPAT_HWCAP_ISA_A: ::c_ulong = 1 << (b'A' - b'A'); +pub const COMPAT_HWCAP_ISA_F: ::c_ulong = 1 << (b'F' - b'A'); +pub const COMPAT_HWCAP_ISA_D: ::c_ulong = 1 << (b'D' - b'A'); +pub const COMPAT_HWCAP_ISA_C: ::c_ulong = 1 << (b'C' - b'A'); +pub const COMPAT_HWCAP_ISA_V: ::c_ulong = 1 << (b'V' - b'A'); + pub const SYS_read: ::c_long = 63; pub const SYS_write: ::c_long = 64; pub const SYS_close: ::c_long = 57; From 6630e098af043b694fe2bdc75c0bc22e84389aa0 Mon Sep 17 00:00:00 2001 From: Henry Chen Date: Sun, 18 Feb 2024 17:07:50 +0800 Subject: [PATCH 04/23] add missing MIPS R6 FS_IOC_* definitions --- src/unix/linux_like/linux/arch/mips/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/unix/linux_like/linux/arch/mips/mod.rs b/src/unix/linux_like/linux/arch/mips/mod.rs index 7699677026f2..6a96aa9c3b15 100644 --- a/src/unix/linux_like/linux/arch/mips/mod.rs +++ b/src/unix/linux_like/linux/arch/mips/mod.rs @@ -200,7 +200,7 @@ cfg_if! { // where S stands for size (int, long, struct...) // where T stands for type ('f','v','X'...) // where N stands for NR (NumbeR) - if #[cfg(target_arch = "mips")] { + if #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40046601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80046602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x40047601; @@ -209,7 +209,7 @@ cfg_if! { pub const FS_IOC32_SETFLAGS: ::Ioctl = 0x80046602; pub const FS_IOC32_GETVERSION: ::Ioctl = 0x40047601; pub const FS_IOC32_SETVERSION: ::Ioctl = 0x80047602; - } else if #[cfg(target_arch = "mips64")] { + } else if #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] { pub const FS_IOC_GETFLAGS: ::Ioctl = 0x40086601; pub const FS_IOC_SETFLAGS: ::Ioctl = 0x80086602; pub const FS_IOC_GETVERSION: ::Ioctl = 0x40087601; From a6707ab7462f293f155b8e5d250f415dba6fb5a6 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 27 Feb 2024 16:05:34 -0800 Subject: [PATCH 05/23] Support posix_spawn on Android Android exposes the same functions and constants as the other linux_like platforms, but its posix_spawnattr_t and posix_spawn_file_actions_t are opaque. See: https://github.com/aosp-mirror/platform_bionic/blob/2215ad406b253f12e270cdd0876e19e9df2aa6d4/libc/include/spawn.h Since the fields in the linux implementation are private, let's make it opaque on all linux_like platforms. --- libc-test/build.rs | 36 ++++++++-- src/unix/linux_like/linux/mod.rs | 105 ---------------------------- src/unix/linux_like/mod.rs | 116 +++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+), 110 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 0d52a86053b8..0d0c197ab2ea 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -1613,6 +1613,7 @@ fn test_android(target: &str) { "sched.h", "semaphore.h", "signal.h", + "spawn.h", "stddef.h", "stdint.h", "stdio.h", @@ -1979,14 +1980,30 @@ fn test_android(target: &str) { // Added in API level 28, but some tests use level 24. "getrandom" => true, - - // Added in API level 28, but some tests use level 24. "syncfs" => true, - - // Added in API level 28, but some tests use level 24. "pthread_attr_getinheritsched" | "pthread_attr_setinheritsched" => true, - // Added in API level 28, but some tests use level 24. "fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true, + "posix_spawn" + | "posix_spawnp" + | "posix_spawnattr_init" + | "posix_spawnattr_destroy" + | "posix_spawnattr_getsigdefault" + | "posix_spawnattr_setsigdefault" + | "posix_spawnattr_getsigmask" + | "posix_spawnattr_setsigmask" + | "posix_spawnattr_getflags" + | "posix_spawnattr_setflags" + | "posix_spawnattr_getpgroup" + | "posix_spawnattr_setpgroup" + | "posix_spawnattr_getschedpolicy" + | "posix_spawnattr_setschedpolicy" + | "posix_spawnattr_getschedparam" + | "posix_spawnattr_setschedparam" + | "posix_spawn_file_actions_init" + | "posix_spawn_file_actions_destroy" + | "posix_spawn_file_actions_addopen" + | "posix_spawn_file_actions_addclose" + | "posix_spawn_file_actions_adddup2" => true, // FIXME: bad function pointers: "isalnum" | "isalpha" | "iscntrl" | "isdigit" | "isgraph" | "islower" | "isprint" @@ -2706,6 +2723,7 @@ fn test_emscripten(target: &str) { "semaphore.h", "shadow.h", "signal.h", + "spawn.h", "stddef.h", "stdint.h", "stdio.h", @@ -3597,6 +3615,10 @@ fn test_linux(target: &str) { "priority_t" if musl => true, "name_t" if musl => true, + // These are intended to be opaque, but glibc and musl define them. + "posix_spawn_file_actions_t" => true, + "posix_spawnattr_t" => true, + t => { if musl { // LFS64 types have been removed in musl 1.2.4+ @@ -3745,6 +3767,10 @@ fn test_linux(target: &str) { // kernel so we can drop this and test the type once this new version is used in CI. "sched_attr" => true, + // These are intended to be opaque, but glibc and musl define them. + "posix_spawn_file_actions_t" => true, + "posix_spawnattr_t" => true, + _ => false, } }); diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index cbb3f7bdf5fe..e8fb33d2c40d 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -452,26 +452,6 @@ s! { pub mnt_passno: ::c_int, } - pub struct posix_spawn_file_actions_t { - __allocated: ::c_int, - __used: ::c_int, - __actions: *mut ::c_int, - __pad: [::c_int; 16], - } - - pub struct posix_spawnattr_t { - __flags: ::c_short, - __pgrp: ::pid_t, - __sd: ::sigset_t, - __ss: ::sigset_t, - #[cfg(any(target_env = "musl", target_env = "ohos"))] - __prio: ::c_int, - #[cfg(not(any(target_env = "musl", target_env = "ohos")))] - __sp: ::sched_param, - __policy: ::c_int, - __pad: [::c_int; 16], - } - pub struct genlmsghdr { pub cmd: u8, pub version: u8, @@ -1858,8 +1838,6 @@ pub const POSIX_MADV_NORMAL: ::c_int = 0; pub const POSIX_MADV_RANDOM: ::c_int = 1; pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2; pub const POSIX_MADV_WILLNEED: ::c_int = 3; -pub const POSIX_SPAWN_USEVFORK: ::c_int = 64; -pub const POSIX_SPAWN_SETSID: ::c_int = 128; pub const S_IEXEC: mode_t = 64; pub const S_IWRITE: mode_t = 128; @@ -2617,13 +2595,6 @@ pub const ETH_P_PHONET: ::c_int = 0x00F5; pub const ETH_P_IEEE802154: ::c_int = 0x00F6; pub const ETH_P_CAIF: ::c_int = 0x00F7; -pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; -pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; -pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04; -pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08; -pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10; -pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20; - pub const NLMSG_NOOP: ::c_int = 0x1; pub const NLMSG_ERROR: ::c_int = 0x2; pub const NLMSG_DONE: ::c_int = 0x3; @@ -5453,82 +5424,6 @@ extern "C" { pub fn endmntent(streamp: *mut ::FILE) -> ::c_int; pub fn hasmntopt(mnt: *const ::mntent, opt: *const ::c_char) -> *mut ::c_char; - pub fn posix_spawn( - pid: *mut ::pid_t, - path: *const ::c_char, - file_actions: *const ::posix_spawn_file_actions_t, - attrp: *const ::posix_spawnattr_t, - argv: *const *mut ::c_char, - envp: *const *mut ::c_char, - ) -> ::c_int; - pub fn posix_spawnp( - pid: *mut ::pid_t, - file: *const ::c_char, - file_actions: *const ::posix_spawn_file_actions_t, - attrp: *const ::posix_spawnattr_t, - argv: *const *mut ::c_char, - envp: *const *mut ::c_char, - ) -> ::c_int; - pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; - pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; - pub fn posix_spawnattr_getsigdefault( - attr: *const posix_spawnattr_t, - default: *mut ::sigset_t, - ) -> ::c_int; - pub fn posix_spawnattr_setsigdefault( - attr: *mut posix_spawnattr_t, - default: *const ::sigset_t, - ) -> ::c_int; - pub fn posix_spawnattr_getsigmask( - attr: *const posix_spawnattr_t, - default: *mut ::sigset_t, - ) -> ::c_int; - pub fn posix_spawnattr_setsigmask( - attr: *mut posix_spawnattr_t, - default: *const ::sigset_t, - ) -> ::c_int; - pub fn posix_spawnattr_getflags( - attr: *const posix_spawnattr_t, - flags: *mut ::c_short, - ) -> ::c_int; - pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int; - pub fn posix_spawnattr_getpgroup( - attr: *const posix_spawnattr_t, - flags: *mut ::pid_t, - ) -> ::c_int; - pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int; - pub fn posix_spawnattr_getschedpolicy( - attr: *const posix_spawnattr_t, - flags: *mut ::c_int, - ) -> ::c_int; - pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int; - pub fn posix_spawnattr_getschedparam( - attr: *const posix_spawnattr_t, - param: *mut ::sched_param, - ) -> ::c_int; - pub fn posix_spawnattr_setschedparam( - attr: *mut posix_spawnattr_t, - param: *const ::sched_param, - ) -> ::c_int; - - pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int; - pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int; - pub fn posix_spawn_file_actions_addopen( - actions: *mut posix_spawn_file_actions_t, - fd: ::c_int, - path: *const ::c_char, - oflag: ::c_int, - mode: ::mode_t, - ) -> ::c_int; - pub fn posix_spawn_file_actions_addclose( - actions: *mut posix_spawn_file_actions_t, - fd: ::c_int, - ) -> ::c_int; - pub fn posix_spawn_file_actions_adddup2( - actions: *mut posix_spawn_file_actions_t, - fd: ::c_int, - newfd: ::c_int, - ) -> ::c_int; pub fn fread_unlocked( buf: *mut ::c_void, size: ::size_t, diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 35c7598c911d..8f71782dce05 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -6,6 +6,13 @@ pub type timer_t = *mut ::c_void; pub type key_t = ::c_int; pub type id_t = ::c_uint; +cfg_if! { + if #[cfg(not(target_os = "emscripten"))] { + pub type posix_spawn_file_actions_t = *mut ::c_void; + pub type posix_spawnattr_t = *mut ::c_void; + } +} + missing! { #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum timezone {} @@ -1531,6 +1538,19 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(target_os = "emscripten"))] { + pub const POSIX_SPAWN_RESETIDS: ::c_int = 0x01; + pub const POSIX_SPAWN_SETPGROUP: ::c_int = 0x02; + pub const POSIX_SPAWN_SETSIGDEF: ::c_int = 0x04; + pub const POSIX_SPAWN_SETSIGMASK: ::c_int = 0x08; + pub const POSIX_SPAWN_SETSCHEDPARAM: ::c_int = 0x10; + pub const POSIX_SPAWN_SETSCHEDULER: ::c_int = 0x20; + pub const POSIX_SPAWN_USEVFORK: ::c_int = 0x40; + pub const POSIX_SPAWN_SETSID: ::c_int = 0x80; + } +} + const_fn! { {const} fn CMSG_ALIGN(len: usize) -> usize { len + ::mem::size_of::() - 1 & !(::mem::size_of::() - 1) @@ -1880,6 +1900,102 @@ cfg_if! { } } +cfg_if! { + if #[cfg(not(target_os = "emscripten"))] { + extern "C" { + pub fn posix_spawn( + pid: *mut ::pid_t, + path: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnp( + pid: *mut ::pid_t, + file: *const ::c_char, + file_actions: *const ::posix_spawn_file_actions_t, + attrp: *const ::posix_spawnattr_t, + argv: *const *mut ::c_char, + envp: *const *mut ::c_char, + ) -> ::c_int; + pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int; + pub fn posix_spawnattr_getsigdefault( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigdefault( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getsigmask( + attr: *const posix_spawnattr_t, + default: *mut ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_setsigmask( + attr: *mut posix_spawnattr_t, + default: *const ::sigset_t, + ) -> ::c_int; + pub fn posix_spawnattr_getflags( + attr: *const posix_spawnattr_t, + flags: *mut ::c_short, + ) -> ::c_int; + pub fn posix_spawnattr_setflags( + attr: *mut posix_spawnattr_t, + flags: ::c_short, + ) -> ::c_int; + pub fn posix_spawnattr_getpgroup( + attr: *const posix_spawnattr_t, + flags: *mut ::pid_t, + ) -> ::c_int; + pub fn posix_spawnattr_setpgroup( + attr: *mut posix_spawnattr_t, + flags: ::pid_t, + ) -> ::c_int; + pub fn posix_spawnattr_getschedpolicy( + attr: *const posix_spawnattr_t, + flags: *mut ::c_int, + ) -> ::c_int; + pub fn posix_spawnattr_setschedpolicy( + attr: *mut posix_spawnattr_t, + flags: ::c_int, + ) -> ::c_int; + pub fn posix_spawnattr_getschedparam( + attr: *const posix_spawnattr_t, + param: *mut ::sched_param, + ) -> ::c_int; + pub fn posix_spawnattr_setschedparam( + attr: *mut posix_spawnattr_t, + param: *const ::sched_param, + ) -> ::c_int; + + pub fn posix_spawn_file_actions_init( + actions: *mut posix_spawn_file_actions_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_destroy( + actions: *mut posix_spawn_file_actions_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_addopen( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + path: *const ::c_char, + oflag: ::c_int, + mode: ::mode_t, + ) -> ::c_int; + pub fn posix_spawn_file_actions_addclose( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + ) -> ::c_int; + pub fn posix_spawn_file_actions_adddup2( + actions: *mut posix_spawn_file_actions_t, + fd: ::c_int, + newfd: ::c_int, + ) -> ::c_int; + } + } +} + cfg_if! { if #[cfg(target_os = "emscripten")] { mod emscripten; From f94afd8b9594c36d5f849862d172cf4998037798 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Thu, 18 Jan 2024 14:17:02 +0800 Subject: [PATCH 06/23] Fix libc-tests for loongarch64 hwcaps --- libc-test/build.rs | 2 ++ .../linux/gnu/b64/loongarch64/mod.rs | 28 +++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index 0d0c197ab2ea..a156c2694e7c 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3344,6 +3344,7 @@ fn test_linux(target: &str) { let gnueabihf = target.contains("gnueabihf"); let x86_64_gnux32 = target.contains("gnux32") && x86_64; let riscv64 = target.contains("riscv64"); + let loongarch64 = target.contains("loongarch64"); let uclibc = target.contains("uclibc"); let mut cfg = ctest_cfg(); @@ -3466,6 +3467,7 @@ fn test_linux(target: &str) { // Include linux headers at the end: headers! { cfg: + [loongarch64]: "asm/hwcap.h", [riscv64]: "asm/hwcap.h", "asm/mman.h", [gnu]: "linux/aio_abi.h", diff --git a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs index 3e1719a76db7..ac3f88905f38 100644 --- a/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs +++ b/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs @@ -264,20 +264,20 @@ align_const! { }; } -pub const HWCAP_CPUCFG: ::c_ulong = 1 << 0; -pub const HWCAP_LAM: ::c_ulong = 1 << 1; -pub const HWCAP_UAL: ::c_ulong = 1 << 2; -pub const HWCAP_FPU: ::c_ulong = 1 << 3; -pub const HWCAP_LSX: ::c_ulong = 1 << 4; -pub const HWCAP_LASX: ::c_ulong = 1 << 5; -pub const HWCAP_CRC32: ::c_ulong = 1 << 6; -pub const HWCAP_COMPLEX: ::c_ulong = 1 << 7; -pub const HWCAP_CRYPTO: ::c_ulong = 1 << 8; -pub const HWCAP_LVZ: ::c_ulong = 1 << 9; -pub const HWCAP_LBT_X86: ::c_ulong = 1 << 10; -pub const HWCAP_LBT_ARM: ::c_ulong = 1 << 11; -pub const HWCAP_LBT_MIPS: ::c_ulong = 1 << 12; -pub const HWCAP_PTW: ::c_ulong = 1 << 13; +pub const HWCAP_LOONGARCH_CPUCFG: ::c_ulong = 1 << 0; +pub const HWCAP_LOONGARCH_LAM: ::c_ulong = 1 << 1; +pub const HWCAP_LOONGARCH_UAL: ::c_ulong = 1 << 2; +pub const HWCAP_LOONGARCH_FPU: ::c_ulong = 1 << 3; +pub const HWCAP_LOONGARCH_LSX: ::c_ulong = 1 << 4; +pub const HWCAP_LOONGARCH_LASX: ::c_ulong = 1 << 5; +pub const HWCAP_LOONGARCH_CRC32: ::c_ulong = 1 << 6; +pub const HWCAP_LOONGARCH_COMPLEX: ::c_ulong = 1 << 7; +pub const HWCAP_LOONGARCH_CRYPTO: ::c_ulong = 1 << 8; +pub const HWCAP_LOONGARCH_LVZ: ::c_ulong = 1 << 9; +pub const HWCAP_LOONGARCH_LBT_X86: ::c_ulong = 1 << 10; +pub const HWCAP_LOONGARCH_LBT_ARM: ::c_ulong = 1 << 11; +pub const HWCAP_LOONGARCH_LBT_MIPS: ::c_ulong = 1 << 12; +pub const HWCAP_LOONGARCH_PTW: ::c_ulong = 1 << 13; pub const SYS_io_setup: ::c_long = 0; pub const SYS_io_destroy: ::c_long = 1; From dc4090488b290caec2b3fe931eae1fb188452d68 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Thu, 18 Jan 2024 15:07:51 +0800 Subject: [PATCH 07/23] Fix libc-tests for loongarch64 syscall --- libc-test/semver/linux-aarch64.txt | 2 ++ libc-test/semver/linux-i686.txt | 2 ++ libc-test/semver/linux-mips.txt | 2 ++ libc-test/semver/linux-powerpc.txt | 2 ++ libc-test/semver/linux-powerpc64.txt | 2 ++ libc-test/semver/linux-powerpc64le.txt | 2 ++ libc-test/semver/linux-riscv64gc.txt | 2 ++ libc-test/semver/linux-s390x.txt | 2 ++ libc-test/semver/linux-sparc64.txt | 2 ++ libc-test/semver/linux-x86_64.txt | 2 ++ libc-test/semver/linux.txt | 2 -- 11 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libc-test/semver/linux-aarch64.txt b/libc-test/semver/linux-aarch64.txt index 5714299010e9..a4ab1b2e568e 100644 --- a/libc-test/semver/linux-aarch64.txt +++ b/libc-test/semver/linux-aarch64.txt @@ -66,6 +66,7 @@ SKF_NET_OFF SO_PRIORITY SO_PROTOCOL SYS_accept +SYS_fstat SYS_msgctl SYS_msgget SYS_msgrcv @@ -79,6 +80,7 @@ SYS_semctl SYS_semget SYS_semop SYS_semtimedop +SYS_setrlimit SYS_shmat SYS_shmctl SYS_shmdt diff --git a/libc-test/semver/linux-i686.txt b/libc-test/semver/linux-i686.txt index 97e9f741a892..a14498adc839 100644 --- a/libc-test/semver/linux-i686.txt +++ b/libc-test/semver/linux-i686.txt @@ -96,6 +96,7 @@ SYS_fadvise64_64 SYS_fchown32 SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -165,6 +166,7 @@ SYS_setregid32 SYS_setresgid32 SYS_setresuid32 SYS_setreuid32 +SYS_setrlimit SYS_setuid32 SYS_sgetmask SYS_sigaction diff --git a/libc-test/semver/linux-mips.txt b/libc-test/semver/linux-mips.txt index 80aa25a60bf8..62da7368b558 100644 --- a/libc-test/semver/linux-mips.txt +++ b/libc-test/semver/linux-mips.txt @@ -30,6 +30,7 @@ SYS_epoll_wait SYS_eventfd SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatfs64 SYS_ftime @@ -77,6 +78,7 @@ SYS_send SYS_sendfile SYS_sendfile64 SYS_set_thread_area +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-powerpc.txt b/libc-test/semver/linux-powerpc.txt index 1d162417608f..d9aacc973d97 100644 --- a/libc-test/semver/linux-powerpc.txt +++ b/libc-test/semver/linux-powerpc.txt @@ -54,6 +54,7 @@ SYS_fadvise64 SYS_fadvise64_64 SYS_fcntl64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -110,6 +111,7 @@ SYS_select SYS_send SYS_sendfile SYS_sendfile64 +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-powerpc64.txt b/libc-test/semver/linux-powerpc64.txt index 983c7e7d30c2..99be508e6bd5 100644 --- a/libc-test/semver/linux-powerpc64.txt +++ b/libc-test/semver/linux-powerpc64.txt @@ -66,6 +66,7 @@ SYS_epoll_create SYS_epoll_wait SYS_eventfd SYS_fork +SYS_fstat SYS_fstatfs64 SYS_ftime SYS_futimesat @@ -117,6 +118,7 @@ SYS_rtas SYS_select SYS_send SYS_sendfile +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-powerpc64le.txt b/libc-test/semver/linux-powerpc64le.txt index 983c7e7d30c2..99be508e6bd5 100644 --- a/libc-test/semver/linux-powerpc64le.txt +++ b/libc-test/semver/linux-powerpc64le.txt @@ -66,6 +66,7 @@ SYS_epoll_create SYS_epoll_wait SYS_eventfd SYS_fork +SYS_fstat SYS_fstatfs64 SYS_ftime SYS_futimesat @@ -117,6 +118,7 @@ SYS_rtas SYS_select SYS_send SYS_sendfile +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-riscv64gc.txt b/libc-test/semver/linux-riscv64gc.txt index 4f270540cc3a..269180151178 100644 --- a/libc-test/semver/linux-riscv64gc.txt +++ b/libc-test/semver/linux-riscv64gc.txt @@ -46,6 +46,7 @@ SO_TIMESTAMPNS SO_WIFI_STATUS SYS_accept SYS_fadvise64 +SYS_fstat SYS_msgctl SYS_msgget SYS_msgrcv @@ -59,6 +60,7 @@ SYS_semget SYS_semop SYS_semtimedop SYS_sendfile +SYS_setrlimit SYS_shmat SYS_shmctl SYS_shmdt diff --git a/libc-test/semver/linux-s390x.txt b/libc-test/semver/linux-s390x.txt index c2ffaf8d06f3..f5d089e3d5e5 100644 --- a/libc-test/semver/linux-s390x.txt +++ b/libc-test/semver/linux-s390x.txt @@ -44,6 +44,7 @@ SYS_epoll_wait SYS_eventfd SYS_fadvise64 SYS_fork +SYS_fstat SYS_fstatfs64 SYS_futimesat SYS_get_kernel_syms @@ -76,6 +77,7 @@ SYS_s390_pci_mmio_write SYS_s390_runtime_instr SYS_select SYS_sendfile +SYS_setrlimit SYS_sigaction SYS_signal SYS_signalfd diff --git a/libc-test/semver/linux-sparc64.txt b/libc-test/semver/linux-sparc64.txt index 956cd2aeda15..d6ae2f675f79 100644 --- a/libc-test/semver/linux-sparc64.txt +++ b/libc-test/semver/linux-sparc64.txt @@ -40,6 +40,7 @@ SYS_execv SYS_fadvise64 SYS_fadvise64_64 SYS_fork +SYS_fstat SYS_fstat64 SYS_fstatat64 SYS_fstatfs64 @@ -79,6 +80,7 @@ SYS_sched_set_affinity SYS_select SYS_sendfile SYS_sendfile64 +SYS_setrlimit SYS_sgetmask SYS_sigaction SYS_signal diff --git a/libc-test/semver/linux-x86_64.txt b/libc-test/semver/linux-x86_64.txt index 64126fbc841e..6ad111e7308c 100644 --- a/libc-test/semver/linux-x86_64.txt +++ b/libc-test/semver/linux-x86_64.txt @@ -93,6 +93,7 @@ SYS_epoll_wait SYS_eventfd SYS_fadvise64 SYS_fork +SYS_fstat SYS_futimesat SYS_getdents SYS_getpgrp @@ -120,6 +121,7 @@ SYS_renameat SYS_rmdir SYS_select SYS_sendfile +SYS_setrlimit SYS_signalfd SYS_stat SYS_symlink diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index f14476525db0..0ac88784343d 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -2876,7 +2876,6 @@ SYS_flistxattr SYS_flock SYS_fremovexattr SYS_fsetxattr -SYS_fstat SYS_fstatfs SYS_fsync SYS_ftruncate @@ -3031,7 +3030,6 @@ SYS_setregid SYS_setresgid SYS_setresuid SYS_setreuid -SYS_setrlimit SYS_setsid SYS_setsockopt SYS_settimeofday From b5b0f690a373e4615776413f68fccfc146179d02 Mon Sep 17 00:00:00 2001 From: Adam Gastineau Date: Sun, 25 Feb 2024 06:52:56 -0800 Subject: [PATCH 08/23] xrOS support Swapped to visionOS target_os --- build.rs | 2 +- src/unix/bsd/apple/mod.rs | 2 +- src/unix/bsd/mod.rs | 3 ++- src/unix/mod.rs | 8 ++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index ec932007ae69..40d4140e8f65 100644 --- a/build.rs +++ b/build.rs @@ -34,7 +34,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ // Extra values to allow for check-cfg. const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[ - ("target_os", &["switch", "aix", "ohos", "hurd"]), + ("target_os", &["switch", "aix", "ohos", "hurd", "visionos"]), ("target_env", &["illumos", "wasi", "aix", "ohos"]), ( "target_arch", diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 2e7827231e65..d53282402667 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -6475,7 +6475,7 @@ cfg_if! { } } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "visionos"))] { extern "C" { pub fn memmem( haystack: *const ::c_void, diff --git a/src/unix/bsd/mod.rs b/src/unix/bsd/mod.rs index 9a2e6c463d36..6ee2a3de4403 100644 --- a/src/unix/bsd/mod.rs +++ b/src/unix/bsd/mod.rs @@ -39,6 +39,7 @@ s! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "netbsd", target_os = "openbsd")))] pub pw_fields: ::c_int, @@ -917,7 +918,7 @@ extern "C" { } cfg_if! { - if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))] { + if #[cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos", target_os = "visionos"))] { mod apple; pub use self::apple::*; } else if #[cfg(any(target_os = "openbsd", target_os = "netbsd"))] { diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 3dca83305ad5..816bcae86ff3 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -369,6 +369,7 @@ cfg_if! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "android", target_os = "openbsd", target_os = "nto", @@ -1042,7 +1043,8 @@ extern "C" { target_os = "macos", target_os = "ios", target_os = "tvos", - target_os = "watchos" + target_os = "watchos", + target_os = "visionos" ), link_name = "realpath$DARWIN_EXTSN" )] @@ -1218,7 +1220,8 @@ extern "C" { target_os = "macos", target_os = "ios", target_os = "tvos", - target_os = "watchos" + target_os = "watchos", + target_os = "visionos" ), link_name = "res_9_init" )] @@ -1555,6 +1558,7 @@ cfg_if! { target_os = "ios", target_os = "tvos", target_os = "watchos", + target_os = "visionos", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", From b5f85fc72d82e0c404257dad7a48d98faa5ab169 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Tue, 16 Apr 2024 00:24:12 +0900 Subject: [PATCH 09/23] Ignore `sockstat` field on FreeBSD 15 CI --- libc-test/build.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index a156c2694e7c..ee211ebbf227 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2538,6 +2538,9 @@ fn test_freebsd(target: &str) { | "sctp_send_failed_event" | "sctp_stream_reset_event" => true, + // FIXME: Changed in FreeBSD 15 + "tcp_info" | "sockstat" if Some(15) >= freebsd_ver => true, + _ => false, } }); From 57b2f87fe3ad729991282414a1785ce0f4b1c270 Mon Sep 17 00:00:00 2001 From: Dirreke Date: Sat, 27 Apr 2024 14:52:34 +0800 Subject: [PATCH 10/23] update version to 0.2.154 --- Cargo.toml | 2 +- libc-test/Cargo.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b29a475a4d7b..48b8e189077c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc" -version = "0.2.153" +version = "0.2.154" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index a9ae85e857fa..eee6fe83da0b 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libc-test" -version = "0.2.153" +version = "0.2.154" authors = ["The Rust Project Developers"] license = "MIT OR Apache-2.0" build = "build.rs" @@ -12,7 +12,7 @@ A test crate for the libc crate. [dependencies.libc] path = ".." -version = "0.2.153" +version = "0.2.154" default-features = false [build-dependencies] From 3c68832597a59198258807324b95dd190acb75f9 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Tue, 14 Nov 2023 15:09:26 +0800 Subject: [PATCH 11/23] linux/musl: Add support for LoongArch64 --- .../linux/musl/b64/loongarch64/align.rs | 40 ++ .../linux/musl/b64/loongarch64/mod.rs | 669 ++++++++++++++++++ src/unix/linux_like/linux/musl/b64/mod.rs | 3 + src/unix/linux_like/linux/musl/mod.rs | 3 +- 4 files changed, 714 insertions(+), 1 deletion(-) create mode 100644 src/unix/linux_like/linux/musl/b64/loongarch64/align.rs create mode 100644 src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs new file mode 100644 index 000000000000..dc191f51fdb1 --- /dev/null +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/align.rs @@ -0,0 +1,40 @@ +s_no_extra_traits! { + #[allow(missing_debug_implementations)] + #[repr(align(16))] + pub struct max_align_t { + priv_: [f64; 4] + } +} + +s! { + pub struct ucontext_t { + pub uc_flags: ::c_ulong, + pub uc_link: *mut ucontext_t, + pub uc_stack: ::stack_t, + pub uc_sigmask: ::sigset_t, + pub uc_mcontext: mcontext_t, + } + + #[repr(align(16))] + pub struct mcontext_t { + pub __pc: ::c_ulonglong, + pub __gregs: [::c_ulonglong; 32], + pub __flags: ::c_uint, + pub __extcontext: [::c_ulonglong; 0], + } + + #[repr(align(8))] + pub struct clone_args { + pub flags: ::c_ulonglong, + pub pidfd: ::c_ulonglong, + pub child_tid: ::c_ulonglong, + pub parent_tid: ::c_ulonglong, + pub exit_signal: ::c_ulonglong, + pub stack: ::c_ulonglong, + pub stack_size: ::c_ulonglong, + pub tls: ::c_ulonglong, + pub set_tid: ::c_ulonglong, + pub set_tid_size: ::c_ulonglong, + pub cgroup: ::c_ulonglong, + } +} diff --git a/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs new file mode 100644 index 000000000000..59a824b23730 --- /dev/null +++ b/src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs @@ -0,0 +1,669 @@ +//! LoongArch-specific definitions for 64-bit linux-like values + +pub type c_char = i8; +pub type wchar_t = ::c_int; + +pub type nlink_t = ::c_uint; +pub type blksize_t = ::c_int; +pub type fsblkcnt64_t = ::c_ulong; +pub type fsfilcnt64_t = ::c_ulong; +pub type __u64 = ::c_ulonglong; +pub type __s64 = ::c_longlong; + +s! { + pub struct pthread_attr_t { + __size: [::c_ulong; 7], + } + + pub struct stat { + pub st_dev: ::dev_t, + pub st_ino: ::ino_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + __pad1: ::dev_t, + pub st_size: ::off_t, + pub st_blksize: ::blksize_t, + __pad2: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_int; 2usize], + } + + pub struct stat64 { + pub st_dev: ::dev_t, + pub st_ino: ::ino64_t, + pub st_mode: ::mode_t, + pub st_nlink: ::nlink_t, + pub st_uid: ::uid_t, + pub st_gid: ::gid_t, + pub st_rdev: ::dev_t, + pub __pad1: ::dev_t, + pub st_size: ::off64_t, + pub st_blksize: ::blksize_t, + pub __pad2: ::c_int, + pub st_blocks: ::blkcnt_t, + pub st_atime: ::time_t, + pub st_atime_nsec: ::c_long, + pub st_mtime: ::time_t, + pub st_mtime_nsec: ::c_long, + pub st_ctime: ::time_t, + pub st_ctime_nsec: ::c_long, + __unused: [::c_int; 2], + } + + pub struct statfs { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_blocks: ::fsblkcnt_t, + pub f_bfree: ::fsblkcnt_t, + pub f_bavail: ::fsblkcnt_t, + pub f_files: ::fsfilcnt_t, + pub f_ffree: ::fsfilcnt_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_long, + pub f_frsize: ::c_long, + pub f_flags: ::c_long, + pub f_spare: [::c_long; 4], + } + + pub struct statfs64 { + pub f_type: ::c_long, + pub f_bsize: ::c_long, + pub f_blocks: ::fsblkcnt64_t, + pub f_bfree: ::fsblkcnt64_t, + pub f_bavail: ::fsblkcnt64_t, + pub f_files: ::fsfilcnt64_t, + pub f_ffree: ::fsfilcnt64_t, + pub f_fsid: ::fsid_t, + pub f_namelen: ::c_long, + pub f_frsize: ::c_long, + pub f_flags: ::c_long, + pub f_spare: [::c_long; 4], + } + + pub struct ipc_perm { + pub __key: ::key_t, + pub uid: ::uid_t, + pub gid: ::gid_t, + pub cuid: ::uid_t, + pub cgid: ::gid_t, + pub mode: ::c_uint, + pub __seq: ::c_ushort, + __pad2: ::c_ushort, + __unused1: ::c_ulong, + __unused2: ::c_ulong, + } + + pub struct user_regs_struct { + pub regs: [u64; 32], + pub orig_a0: u64, + pub csr_era: u64, + pub csr_badv: u64, + pub reserved: [u64; 10], + + } + + pub struct user_fp_struct { + pub fpr: [u64; 32], + pub fcc: u64, + pub fcsr: u32, + } +} + +pub const SYS_io_setup: ::c_long = 0; +pub const SYS_io_destroy: ::c_long = 1; +pub const SYS_io_submit: ::c_long = 2; +pub const SYS_io_cancel: ::c_long = 3; +pub const SYS_io_getevents: ::c_long = 4; +pub const SYS_setxattr: ::c_long = 5; +pub const SYS_lsetxattr: ::c_long = 6; +pub const SYS_fsetxattr: ::c_long = 7; +pub const SYS_getxattr: ::c_long = 8; +pub const SYS_lgetxattr: ::c_long = 9; +pub const SYS_fgetxattr: ::c_long = 10; +pub const SYS_listxattr: ::c_long = 11; +pub const SYS_llistxattr: ::c_long = 12; +pub const SYS_flistxattr: ::c_long = 13; +pub const SYS_removexattr: ::c_long = 14; +pub const SYS_lremovexattr: ::c_long = 15; +pub const SYS_fremovexattr: ::c_long = 16; +pub const SYS_getcwd: ::c_long = 17; +pub const SYS_lookup_dcookie: ::c_long = 18; +pub const SYS_eventfd2: ::c_long = 19; +pub const SYS_epoll_create1: ::c_long = 20; +pub const SYS_epoll_ctl: ::c_long = 21; +pub const SYS_epoll_pwait: ::c_long = 22; +pub const SYS_dup: ::c_long = 23; +pub const SYS_dup3: ::c_long = 24; +pub const SYS_fcntl: ::c_long = 25; +pub const SYS_inotify_init1: ::c_long = 26; +pub const SYS_inotify_add_watch: ::c_long = 27; +pub const SYS_inotify_rm_watch: ::c_long = 28; +pub const SYS_ioctl: ::c_long = 29; +pub const SYS_ioprio_set: ::c_long = 30; +pub const SYS_ioprio_get: ::c_long = 31; +pub const SYS_flock: ::c_long = 32; +pub const SYS_mknodat: ::c_long = 33; +pub const SYS_mkdirat: ::c_long = 34; +pub const SYS_unlinkat: ::c_long = 35; +pub const SYS_symlinkat: ::c_long = 36; +pub const SYS_linkat: ::c_long = 37; +pub const SYS_umount2: ::c_long = 39; +pub const SYS_mount: ::c_long = 40; +pub const SYS_pivot_root: ::c_long = 41; +pub const SYS_nfsservctl: ::c_long = 42; +pub const SYS_statfs: ::c_long = 43; +pub const SYS_fstatfs: ::c_long = 44; +pub const SYS_truncate: ::c_long = 45; +pub const SYS_ftruncate: ::c_long = 46; +pub const SYS_fallocate: ::c_long = 47; +pub const SYS_faccessat: ::c_long = 48; +pub const SYS_chdir: ::c_long = 49; +pub const SYS_fchdir: ::c_long = 50; +pub const SYS_chroot: ::c_long = 51; +pub const SYS_fchmod: ::c_long = 52; +pub const SYS_fchmodat: ::c_long = 53; +pub const SYS_fchownat: ::c_long = 54; +pub const SYS_fchown: ::c_long = 55; +pub const SYS_openat: ::c_long = 56; +pub const SYS_close: ::c_long = 57; +pub const SYS_vhangup: ::c_long = 58; +pub const SYS_pipe2: ::c_long = 59; +pub const SYS_quotactl: ::c_long = 60; +pub const SYS_getdents64: ::c_long = 61; +pub const SYS_lseek: ::c_long = 62; +pub const SYS_read: ::c_long = 63; +pub const SYS_write: ::c_long = 64; +pub const SYS_readv: ::c_long = 65; +pub const SYS_writev: ::c_long = 66; +pub const SYS_pread64: ::c_long = 67; +pub const SYS_pwrite64: ::c_long = 68; +pub const SYS_preadv: ::c_long = 69; +pub const SYS_pwritev: ::c_long = 70; +pub const SYS_sendfile: ::c_long = 71; +pub const SYS_pselect6: ::c_long = 72; +pub const SYS_ppoll: ::c_long = 73; +pub const SYS_signalfd4: ::c_long = 74; +pub const SYS_vmsplice: ::c_long = 75; +pub const SYS_splice: ::c_long = 76; +pub const SYS_tee: ::c_long = 77; +pub const SYS_readlinkat: ::c_long = 78; +pub const SYS_sync: ::c_long = 81; +pub const SYS_fsync: ::c_long = 82; +pub const SYS_fdatasync: ::c_long = 83; +pub const SYS_sync_file_range: ::c_long = 84; +pub const SYS_timerfd_create: ::c_long = 85; +pub const SYS_timerfd_settime: ::c_long = 86; +pub const SYS_timerfd_gettime: ::c_long = 87; +pub const SYS_utimensat: ::c_long = 88; +pub const SYS_acct: ::c_long = 89; +pub const SYS_capget: ::c_long = 90; +pub const SYS_capset: ::c_long = 91; +pub const SYS_personality: ::c_long = 92; +pub const SYS_exit: ::c_long = 93; +pub const SYS_exit_group: ::c_long = 94; +pub const SYS_waitid: ::c_long = 95; +pub const SYS_set_tid_address: ::c_long = 96; +pub const SYS_unshare: ::c_long = 97; +pub const SYS_futex: ::c_long = 98; +pub const SYS_set_robust_list: ::c_long = 99; +pub const SYS_get_robust_list: ::c_long = 100; +pub const SYS_nanosleep: ::c_long = 101; +pub const SYS_getitimer: ::c_long = 102; +pub const SYS_setitimer: ::c_long = 103; +pub const SYS_kexec_load: ::c_long = 104; +pub const SYS_init_module: ::c_long = 105; +pub const SYS_delete_module: ::c_long = 106; +pub const SYS_timer_create: ::c_long = 107; +pub const SYS_timer_gettime: ::c_long = 108; +pub const SYS_timer_getoverrun: ::c_long = 109; +pub const SYS_timer_settime: ::c_long = 110; +pub const SYS_timer_delete: ::c_long = 111; +pub const SYS_clock_settime: ::c_long = 112; +pub const SYS_clock_gettime: ::c_long = 113; +pub const SYS_clock_getres: ::c_long = 114; +pub const SYS_clock_nanosleep: ::c_long = 115; +pub const SYS_syslog: ::c_long = 116; +pub const SYS_ptrace: ::c_long = 117; +pub const SYS_sched_setparam: ::c_long = 118; +pub const SYS_sched_setscheduler: ::c_long = 119; +pub const SYS_sched_getscheduler: ::c_long = 120; +pub const SYS_sched_getparam: ::c_long = 121; +pub const SYS_sched_setaffinity: ::c_long = 122; +pub const SYS_sched_getaffinity: ::c_long = 123; +pub const SYS_sched_yield: ::c_long = 124; +pub const SYS_sched_get_priority_max: ::c_long = 125; +pub const SYS_sched_get_priority_min: ::c_long = 126; +pub const SYS_sched_rr_get_interval: ::c_long = 127; +pub const SYS_restart_syscall: ::c_long = 128; +pub const SYS_kill: ::c_long = 129; +pub const SYS_tkill: ::c_long = 130; +pub const SYS_tgkill: ::c_long = 131; +pub const SYS_sigaltstack: ::c_long = 132; +pub const SYS_rt_sigsuspend: ::c_long = 133; +pub const SYS_rt_sigaction: ::c_long = 134; +pub const SYS_rt_sigprocmask: ::c_long = 135; +pub const SYS_rt_sigpending: ::c_long = 136; +pub const SYS_rt_sigtimedwait: ::c_long = 137; +pub const SYS_rt_sigqueueinfo: ::c_long = 138; +pub const SYS_rt_sigreturn: ::c_long = 139; +pub const SYS_setpriority: ::c_long = 140; +pub const SYS_getpriority: ::c_long = 141; +pub const SYS_reboot: ::c_long = 142; +pub const SYS_setregid: ::c_long = 143; +pub const SYS_setgid: ::c_long = 144; +pub const SYS_setreuid: ::c_long = 145; +pub const SYS_setuid: ::c_long = 146; +pub const SYS_setresuid: ::c_long = 147; +pub const SYS_getresuid: ::c_long = 148; +pub const SYS_setresgid: ::c_long = 149; +pub const SYS_getresgid: ::c_long = 150; +pub const SYS_setfsuid: ::c_long = 151; +pub const SYS_setfsgid: ::c_long = 152; +pub const SYS_times: ::c_long = 153; +pub const SYS_setpgid: ::c_long = 154; +pub const SYS_getpgid: ::c_long = 155; +pub const SYS_getsid: ::c_long = 156; +pub const SYS_setsid: ::c_long = 157; +pub const SYS_getgroups: ::c_long = 158; +pub const SYS_setgroups: ::c_long = 159; +pub const SYS_uname: ::c_long = 160; +pub const SYS_sethostname: ::c_long = 161; +pub const SYS_setdomainname: ::c_long = 162; +pub const SYS_getrusage: ::c_long = 165; +pub const SYS_umask: ::c_long = 166; +pub const SYS_prctl: ::c_long = 167; +pub const SYS_getcpu: ::c_long = 168; +pub const SYS_gettimeofday: ::c_long = 169; +pub const SYS_settimeofday: ::c_long = 170; +pub const SYS_adjtimex: ::c_long = 171; +pub const SYS_getpid: ::c_long = 172; +pub const SYS_getppid: ::c_long = 173; +pub const SYS_getuid: ::c_long = 174; +pub const SYS_geteuid: ::c_long = 175; +pub const SYS_getgid: ::c_long = 176; +pub const SYS_getegid: ::c_long = 177; +pub const SYS_gettid: ::c_long = 178; +pub const SYS_sysinfo: ::c_long = 179; +pub const SYS_mq_open: ::c_long = 180; +pub const SYS_mq_unlink: ::c_long = 181; +pub const SYS_mq_timedsend: ::c_long = 182; +pub const SYS_mq_timedreceive: ::c_long = 183; +pub const SYS_mq_notify: ::c_long = 184; +pub const SYS_mq_getsetattr: ::c_long = 185; +pub const SYS_msgget: ::c_long = 186; +pub const SYS_msgctl: ::c_long = 187; +pub const SYS_msgrcv: ::c_long = 188; +pub const SYS_msgsnd: ::c_long = 189; +pub const SYS_semget: ::c_long = 190; +pub const SYS_semctl: ::c_long = 191; +pub const SYS_semtimedop: ::c_long = 192; +pub const SYS_semop: ::c_long = 193; +pub const SYS_shmget: ::c_long = 194; +pub const SYS_shmctl: ::c_long = 195; +pub const SYS_shmat: ::c_long = 196; +pub const SYS_shmdt: ::c_long = 197; +pub const SYS_socket: ::c_long = 198; +pub const SYS_socketpair: ::c_long = 199; +pub const SYS_bind: ::c_long = 200; +pub const SYS_listen: ::c_long = 201; +pub const SYS_accept: ::c_long = 202; +pub const SYS_connect: ::c_long = 203; +pub const SYS_getsockname: ::c_long = 204; +pub const SYS_getpeername: ::c_long = 205; +pub const SYS_sendto: ::c_long = 206; +pub const SYS_recvfrom: ::c_long = 207; +pub const SYS_setsockopt: ::c_long = 208; +pub const SYS_getsockopt: ::c_long = 209; +pub const SYS_shutdown: ::c_long = 210; +pub const SYS_sendmsg: ::c_long = 211; +pub const SYS_recvmsg: ::c_long = 212; +pub const SYS_readahead: ::c_long = 213; +pub const SYS_brk: ::c_long = 214; +pub const SYS_munmap: ::c_long = 215; +pub const SYS_mremap: ::c_long = 216; +pub const SYS_add_key: ::c_long = 217; +pub const SYS_request_key: ::c_long = 218; +pub const SYS_keyctl: ::c_long = 219; +pub const SYS_clone: ::c_long = 220; +pub const SYS_execve: ::c_long = 221; +pub const SYS_mmap: ::c_long = 222; +pub const SYS_fadvise64: ::c_long = 223; +pub const SYS_swapon: ::c_long = 224; +pub const SYS_swapoff: ::c_long = 225; +pub const SYS_mprotect: ::c_long = 226; +pub const SYS_msync: ::c_long = 227; +pub const SYS_mlock: ::c_long = 228; +pub const SYS_munlock: ::c_long = 229; +pub const SYS_mlockall: ::c_long = 230; +pub const SYS_munlockall: ::c_long = 231; +pub const SYS_mincore: ::c_long = 232; +pub const SYS_madvise: ::c_long = 233; +pub const SYS_remap_file_pages: ::c_long = 234; +pub const SYS_mbind: ::c_long = 235; +pub const SYS_get_mempolicy: ::c_long = 236; +pub const SYS_set_mempolicy: ::c_long = 237; +pub const SYS_migrate_pages: ::c_long = 238; +pub const SYS_move_pages: ::c_long = 239; +pub const SYS_rt_tgsigqueueinfo: ::c_long = 240; +pub const SYS_perf_event_open: ::c_long = 241; +pub const SYS_accept4: ::c_long = 242; +pub const SYS_recvmmsg: ::c_long = 243; +pub const SYS_arch_specific_syscall: ::c_long = 244; +pub const SYS_wait4: ::c_long = 260; +pub const SYS_prlimit64: ::c_long = 261; +pub const SYS_fanotify_init: ::c_long = 262; +pub const SYS_fanotify_mark: ::c_long = 263; +pub const SYS_name_to_handle_at: ::c_long = 264; +pub const SYS_open_by_handle_at: ::c_long = 265; +pub const SYS_clock_adjtime: ::c_long = 266; +pub const SYS_syncfs: ::c_long = 267; +pub const SYS_setns: ::c_long = 268; +pub const SYS_sendmmsg: ::c_long = 269; +pub const SYS_process_vm_readv: ::c_long = 270; +pub const SYS_process_vm_writev: ::c_long = 271; +pub const SYS_kcmp: ::c_long = 272; +pub const SYS_finit_module: ::c_long = 273; +pub const SYS_sched_setattr: ::c_long = 274; +pub const SYS_sched_getattr: ::c_long = 275; +pub const SYS_renameat2: ::c_long = 276; +pub const SYS_seccomp: ::c_long = 277; +pub const SYS_getrandom: ::c_long = 278; +pub const SYS_memfd_create: ::c_long = 279; +pub const SYS_bpf: ::c_long = 280; +pub const SYS_execveat: ::c_long = 281; +pub const SYS_userfaultfd: ::c_long = 282; +pub const SYS_membarrier: ::c_long = 283; +pub const SYS_mlock2: ::c_long = 284; +pub const SYS_copy_file_range: ::c_long = 285; +pub const SYS_preadv2: ::c_long = 286; +pub const SYS_pwritev2: ::c_long = 287; +pub const SYS_pkey_mprotect: ::c_long = 288; +pub const SYS_pkey_alloc: ::c_long = 289; +pub const SYS_pkey_free: ::c_long = 290; +pub const SYS_statx: ::c_long = 291; +pub const SYS_io_pgetevents: ::c_long = 292; +pub const SYS_rseq: ::c_long = 293; +pub const SYS_kexec_file_load: ::c_long = 294; +pub const SYS_pidfd_send_signal: ::c_long = 424; +pub const SYS_io_uring_setup: ::c_long = 425; +pub const SYS_io_uring_enter: ::c_long = 426; +pub const SYS_io_uring_register: ::c_long = 427; +pub const SYS_open_tree: ::c_long = 428; +pub const SYS_move_mount: ::c_long = 429; +pub const SYS_fsopen: ::c_long = 430; +pub const SYS_fsconfig: ::c_long = 431; +pub const SYS_fsmount: ::c_long = 432; +pub const SYS_fspick: ::c_long = 433; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; +pub const SYS_close_range: ::c_long = 436; +pub const SYS_openat2: ::c_long = 437; +pub const SYS_pidfd_getfd: ::c_long = 438; +pub const SYS_faccessat2: ::c_long = 439; +pub const SYS_process_madvise: ::c_long = 440; +pub const SYS_epoll_pwait2: ::c_long = 441; +pub const SYS_mount_setattr: ::c_long = 442; +pub const SYS_quotactl_fd: ::c_long = 443; +pub const SYS_landlock_create_ruleset: ::c_long = 444; +pub const SYS_landlock_add_rule: ::c_long = 445; +pub const SYS_landlock_restrict_self: ::c_long = 446; +pub const SYS_process_mrelease: ::c_long = 448; +pub const SYS_futex_waitv: ::c_long = 449; +pub const SYS_set_mempolicy_home_node: ::c_long = 450; +pub const SYS_cachestat: ::c_long = 451; +pub const SYS_fchmodat2: ::c_long = 452; +pub const SYS_map_shadow_stack: ::c_long = 453; +pub const SYS_futex_wake: ::c_long = 454; +pub const SYS_futex_wait: ::c_long = 455; +pub const SYS_futex_requeue: ::c_long = 456; + +pub const O_APPEND: ::c_int = 1024; +pub const O_DIRECT: ::c_int = 0x4000; +pub const O_DIRECTORY: ::c_int = 0x10000; +pub const O_LARGEFILE: ::c_int = 0; +pub const O_NOFOLLOW: ::c_int = 0x20000; +pub const O_CREAT: ::c_int = 64; +pub const O_EXCL: ::c_int = 128; +pub const O_NOCTTY: ::c_int = 256; +pub const O_NONBLOCK: ::c_int = 2048; +pub const O_SYNC: ::c_int = 1052672; +pub const O_RSYNC: ::c_int = 1052672; +pub const O_DSYNC: ::c_int = 4096; +pub const O_ASYNC: ::c_int = 4096; + +pub const SIGSTKSZ: ::size_t = 16384; +pub const MINSIGSTKSZ: ::size_t = 4096; + +pub const ENAMETOOLONG: ::c_int = 36; +pub const ENOLCK: ::c_int = 37; +pub const ENOSYS: ::c_int = 38; +pub const ENOTEMPTY: ::c_int = 39; +pub const ELOOP: ::c_int = 40; +pub const ENOMSG: ::c_int = 42; +pub const EIDRM: ::c_int = 43; +pub const ECHRNG: ::c_int = 44; +pub const EL2NSYNC: ::c_int = 45; +pub const EL3HLT: ::c_int = 46; +pub const EL3RST: ::c_int = 47; +pub const ELNRNG: ::c_int = 48; +pub const EUNATCH: ::c_int = 49; +pub const ENOCSI: ::c_int = 50; +pub const EL2HLT: ::c_int = 51; +pub const EBADE: ::c_int = 52; +pub const EBADR: ::c_int = 53; +pub const EXFULL: ::c_int = 54; +pub const ENOANO: ::c_int = 55; +pub const EBADRQC: ::c_int = 56; +pub const EBADSLT: ::c_int = 57; +pub const EMULTIHOP: ::c_int = 72; +pub const EOVERFLOW: ::c_int = 75; +pub const ENOTUNIQ: ::c_int = 76; +pub const EBADFD: ::c_int = 77; +pub const EBADMSG: ::c_int = 74; +pub const EREMCHG: ::c_int = 78; +pub const ELIBACC: ::c_int = 79; +pub const ELIBBAD: ::c_int = 80; +pub const ELIBSCN: ::c_int = 81; +pub const ELIBMAX: ::c_int = 82; +pub const ELIBEXEC: ::c_int = 83; +pub const EILSEQ: ::c_int = 84; +pub const ERESTART: ::c_int = 85; +pub const ESTRPIPE: ::c_int = 86; +pub const EUSERS: ::c_int = 87; +pub const ENOTSOCK: ::c_int = 88; +pub const EDESTADDRREQ: ::c_int = 89; +pub const EMSGSIZE: ::c_int = 90; +pub const EPROTOTYPE: ::c_int = 91; +pub const ENOPROTOOPT: ::c_int = 92; +pub const EPROTONOSUPPORT: ::c_int = 93; +pub const ESOCKTNOSUPPORT: ::c_int = 94; +pub const EOPNOTSUPP: ::c_int = 95; +pub const ENOTSUP: ::c_int = EOPNOTSUPP; +pub const EPFNOSUPPORT: ::c_int = 96; +pub const EAFNOSUPPORT: ::c_int = 97; +pub const EADDRINUSE: ::c_int = 98; +pub const EADDRNOTAVAIL: ::c_int = 99; +pub const ENETDOWN: ::c_int = 100; +pub const ENETUNREACH: ::c_int = 101; +pub const ENETRESET: ::c_int = 102; +pub const ECONNABORTED: ::c_int = 103; +pub const ECONNRESET: ::c_int = 104; +pub const ENOBUFS: ::c_int = 105; +pub const EISCONN: ::c_int = 106; +pub const ENOTCONN: ::c_int = 107; +pub const ESHUTDOWN: ::c_int = 108; +pub const ETOOMANYREFS: ::c_int = 109; +pub const ETIMEDOUT: ::c_int = 110; +pub const ECONNREFUSED: ::c_int = 111; +pub const EHOSTDOWN: ::c_int = 112; +pub const EHOSTUNREACH: ::c_int = 113; +pub const EALREADY: ::c_int = 114; +pub const EINPROGRESS: ::c_int = 115; +pub const ESTALE: ::c_int = 116; +pub const EUCLEAN: ::c_int = 117; +pub const ENOTNAM: ::c_int = 118; +pub const ENAVAIL: ::c_int = 119; +pub const EISNAM: ::c_int = 120; +pub const EREMOTEIO: ::c_int = 121; +pub const EDQUOT: ::c_int = 122; +pub const ENOMEDIUM: ::c_int = 123; +pub const EMEDIUMTYPE: ::c_int = 124; +pub const ECANCELED: ::c_int = 125; +pub const ENOKEY: ::c_int = 126; +pub const EKEYEXPIRED: ::c_int = 127; +pub const EKEYREVOKED: ::c_int = 128; +pub const EKEYREJECTED: ::c_int = 129; +pub const EOWNERDEAD: ::c_int = 130; +pub const ENOTRECOVERABLE: ::c_int = 131; +pub const EHWPOISON: ::c_int = 133; +pub const ERFKILL: ::c_int = 132; + +pub const SA_ONSTACK: ::c_int = 0x08000000; +pub const SA_SIGINFO: ::c_int = 0x00000004; +pub const SA_NOCLDWAIT: ::c_int = 0x00000002; + +pub const SIGCHLD: ::c_int = 17; +pub const SIGBUS: ::c_int = 7; +pub const SIGTTIN: ::c_int = 21; +pub const SIGTTOU: ::c_int = 22; +pub const SIGXCPU: ::c_int = 24; +pub const SIGXFSZ: ::c_int = 25; +pub const SIGVTALRM: ::c_int = 26; +pub const SIGPROF: ::c_int = 27; +pub const SIGWINCH: ::c_int = 28; +pub const SIGUSR1: ::c_int = 10; +pub const SIGUSR2: ::c_int = 12; +pub const SIGCONT: ::c_int = 18; +pub const SIGSTOP: ::c_int = 19; +pub const SIGTSTP: ::c_int = 20; +pub const SIGURG: ::c_int = 23; +pub const SIGIO: ::c_int = 29; +pub const SIGSYS: ::c_int = 31; +pub const SIGSTKFLT: ::c_int = 16; +pub const SIGPOLL: ::c_int = 29; +pub const SIGPWR: ::c_int = 30; +pub const SIG_SETMASK: ::c_int = 2; +pub const SIG_BLOCK: ::c_int = 0; +pub const SIG_UNBLOCK: ::c_int = 1; + +pub const F_GETLK: ::c_int = 5; +pub const F_GETOWN: ::c_int = 9; +pub const F_SETLK: ::c_int = 6; +pub const F_SETLKW: ::c_int = 7; +pub const F_SETOWN: ::c_int = 8; + +pub const VEOF: usize = 4; + +pub const POLLWRNORM: ::c_short = 0x100; +pub const POLLWRBAND: ::c_short = 0x200; + +pub const SOCK_STREAM: ::c_int = 1; +pub const SOCK_DGRAM: ::c_int = 2; + +pub const MAP_ANON: ::c_int = 0x0020; +pub const MAP_GROWSDOWN: ::c_int = 0x0100; +pub const MAP_DENYWRITE: ::c_int = 0x0800; +pub const MAP_EXECUTABLE: ::c_int = 0x01000; +pub const MAP_LOCKED: ::c_int = 0x02000; +pub const MAP_NORESERVE: ::c_int = 0x04000; +pub const MAP_POPULATE: ::c_int = 0x08000; +pub const MAP_NONBLOCK: ::c_int = 0x010000; +pub const MAP_STACK: ::c_int = 0x020000; +pub const MAP_HUGETLB: ::c_int = 0x040000; +pub const MAP_SYNC: ::c_int = 0x080000; + +pub const MCL_CURRENT: ::c_int = 0x0001; +pub const MCL_FUTURE: ::c_int = 0x0002; +pub const MCL_ONFAULT: ::c_int = 0x0004; +pub const CBAUD: ::tcflag_t = 0o0010017; +pub const TAB1: ::c_int = 0x00000800; +pub const TAB2: ::c_int = 0x00001000; +pub const TAB3: ::c_int = 0x00001800; +pub const CR1: ::c_int = 0x00000200; +pub const CR2: ::c_int = 0x00000400; +pub const CR3: ::c_int = 0x00000600; +pub const FF1: ::c_int = 0x00008000; +pub const BS1: ::c_int = 0x00002000; +pub const VT1: ::c_int = 0x00004000; +pub const VWERASE: usize = 14; +pub const VREPRINT: usize = 12; +pub const VSUSP: usize = 10; +pub const VSTART: usize = 8; +pub const VSTOP: usize = 9; +pub const VDISCARD: usize = 13; +pub const VTIME: usize = 5; +pub const IXON: ::tcflag_t = 0x00000400; +pub const IXOFF: ::tcflag_t = 0x00001000; +pub const ONLCR: ::tcflag_t = 0x4; +pub const CSIZE: ::tcflag_t = 0x00000030; +pub const CS6: ::tcflag_t = 0x00000010; +pub const CS7: ::tcflag_t = 0x00000020; +pub const CS8: ::tcflag_t = 0x00000030; +pub const CSTOPB: ::tcflag_t = 0x00000040; +pub const CREAD: ::tcflag_t = 0x00000080; +pub const PARENB: ::tcflag_t = 0x00000100; +pub const PARODD: ::tcflag_t = 0x00000200; +pub const HUPCL: ::tcflag_t = 0x00000400; +pub const CLOCAL: ::tcflag_t = 0x00000800; +pub const ECHOKE: ::tcflag_t = 0x00000800; +pub const ECHOE: ::tcflag_t = 0x00000010; +pub const ECHOK: ::tcflag_t = 0x00000020; +pub const ECHONL: ::tcflag_t = 0x00000040; +pub const ECHOPRT: ::tcflag_t = 0x00000400; +pub const ECHOCTL: ::tcflag_t = 0x00000200; +pub const ISIG: ::tcflag_t = 0x00000001; +pub const ICANON: ::tcflag_t = 0x00000002; +pub const PENDIN: ::tcflag_t = 0x00004000; +pub const NOFLSH: ::tcflag_t = 0x00000080; +pub const CIBAUD: ::tcflag_t = 0o02003600000; +pub const CBAUDEX: ::tcflag_t = 0o010000; +pub const VSWTC: usize = 7; +pub const OLCUC: ::tcflag_t = 0o000002; +pub const NLDLY: ::tcflag_t = 0o000400; +pub const CRDLY: ::tcflag_t = 0o003000; +pub const TABDLY: ::tcflag_t = 0o014000; +pub const BSDLY: ::tcflag_t = 0o020000; +pub const FFDLY: ::tcflag_t = 0o100000; +pub const VTDLY: ::tcflag_t = 0o040000; +pub const XTABS: ::tcflag_t = 0o014000; +pub const B57600: ::speed_t = 0o010001; +pub const B115200: ::speed_t = 0o010002; +pub const B230400: ::speed_t = 0o010003; +pub const B460800: ::speed_t = 0o010004; +pub const B500000: ::speed_t = 0o010005; +pub const B576000: ::speed_t = 0o010006; +pub const B921600: ::speed_t = 0o010007; +pub const B1000000: ::speed_t = 0o010010; +pub const B1152000: ::speed_t = 0o010011; +pub const B1500000: ::speed_t = 0o010012; +pub const B2000000: ::speed_t = 0o010013; +pub const B2500000: ::speed_t = 0o010014; +pub const B3000000: ::speed_t = 0o010015; +pub const B3500000: ::speed_t = 0o010016; +pub const B4000000: ::speed_t = 0o010017; + +pub const EDEADLK: ::c_int = 35; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EXTPROC: ::tcflag_t = 0x00010000; +pub const VEOL: usize = 11; +pub const VEOL2: usize = 16; +pub const VMIN: usize = 6; +pub const IEXTEN: ::tcflag_t = 0x00008000; +pub const TOSTOP: ::tcflag_t = 0x00000100; +pub const FLUSHO: ::tcflag_t = 0x00001000; + +cfg_if! { + if #[cfg(libc_align)] { + mod align; + pub use self::align::*; + } +} diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs index 05586cdb44b6..d59343064c52 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/mod.rs @@ -157,6 +157,9 @@ cfg_if! { } else if #[cfg(any(target_arch = "riscv64"))] { mod riscv64; pub use self::riscv64::*; + } else if #[cfg(any(target_arch = "loongarch64"))] { + mod loongarch64; + pub use self::loongarch64::*; } else { // Unknown target_arch } diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index a4c1f708afd5..080c9ba8278b 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -912,7 +912,8 @@ cfg_if! { target_arch = "mips64", target_arch = "powerpc64", target_arch = "s390x", - target_arch = "riscv64"))] { + target_arch = "riscv64", + target_arch = "loongarch64"))] { mod b64; pub use self::b64::*; } else if #[cfg(any(target_arch = "x86", From 1b770a860d82f6d7069942e3c8d29455158068c9 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 24 Mar 2024 18:01:05 +0900 Subject: [PATCH 12/23] Fix c_char on AIX Refs: https://github.com/rust-lang/rust/issues/122985 --- src/unix/aix/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 0fc923d6072f..b3ce43a3722d 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -1,4 +1,4 @@ -pub type c_char = i8; +pub type c_char = u8; pub type caddr_t = *mut ::c_char; pub type clockid_t = ::c_longlong; pub type blkcnt_t = ::c_long; From 47a8927f197dd067a2c5696c97c84120b812a5e3 Mon Sep 17 00:00:00 2001 From: tevzi2 Date: Sun, 14 Apr 2024 19:25:16 +0200 Subject: [PATCH 13/23] Add SIGABRT const to newlib --- src/unix/newlib/mod.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index a572cc38bfda..ea6e791245e2 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -511,6 +511,8 @@ pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; pub const INET_ADDRSTRLEN: ::c_int = 16; +pub const SIGABRT: ::c_int = 1; + // https://github.com/bminor/newlib/blob/HEAD/newlib/libc/sys/linux/include/net/if.h#L121 pub const IFF_UP: ::c_int = 0x1; // interface is up pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid From 539ec751f337c784ff09ca17f7cf2be953d0ad3e Mon Sep 17 00:00:00 2001 From: tevzi2 Date: Sun, 14 Apr 2024 19:43:25 +0200 Subject: [PATCH 14/23] added missing signal constants for espidf --- src/unix/newlib/espidf/mod.rs | 10 ++++++++++ src/unix/newlib/mod.rs | 2 -- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/unix/newlib/espidf/mod.rs b/src/unix/newlib/espidf/mod.rs index 409d7ad9bd78..e2e98ee9c394 100644 --- a/src/unix/newlib/espidf/mod.rs +++ b/src/unix/newlib/espidf/mod.rs @@ -89,6 +89,16 @@ pub const MSG_EOR: ::c_int = 0x08; pub const PTHREAD_STACK_MIN: ::size_t = 768; +pub const SIGABRT: ::size_t = 1; +pub const SIGFPE: ::size_t = 1; +pub const SIGILL: ::size_t = 1; +pub const SIGINT: ::size_t = 1; +pub const SIGSEGV: ::size_t = 1; +pub const SIGTERM: ::size_t = 1; +pub const SIGHUP: ::size_t = 1; +pub const SIGQUIT: ::size_t = 1; +pub const NSIG: ::size_t = 2; + extern "C" { pub fn pthread_create( native: *mut ::pthread_t, diff --git a/src/unix/newlib/mod.rs b/src/unix/newlib/mod.rs index ea6e791245e2..a572cc38bfda 100644 --- a/src/unix/newlib/mod.rs +++ b/src/unix/newlib/mod.rs @@ -511,8 +511,6 @@ pub const SOCK_CLOEXEC: ::c_int = O_CLOEXEC; pub const INET_ADDRSTRLEN: ::c_int = 16; -pub const SIGABRT: ::c_int = 1; - // https://github.com/bminor/newlib/blob/HEAD/newlib/libc/sys/linux/include/net/if.h#L121 pub const IFF_UP: ::c_int = 0x1; // interface is up pub const IFF_BROADCAST: ::c_int = 0x2; // broadcast address valid From 316af61fa5847102324f6ef03126e911363cf1c1 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Thu, 4 Apr 2024 21:34:39 +0100 Subject: [PATCH 15/23] solarish adding SO_EXCLBIND constant. --- src/unix/solarish/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index c68cfba3c993..7ed00413dc7f 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -1829,6 +1829,7 @@ pub const SO_TYPE: ::c_int = 0x1008; pub const SO_PROTOTYPE: ::c_int = 0x1009; pub const SO_DOMAIN: ::c_int = 0x100c; pub const SO_TIMESTAMP: ::c_int = 0x1013; +pub const SO_EXCLBIND: ::c_int = 0x1015; pub const SCM_RIGHTS: ::c_int = 0x1010; pub const SCM_UCRED: ::c_int = 0x1012; From 34409aafe5d54a9b159eda10f44f3ab6c4be43d9 Mon Sep 17 00:00:00 2001 From: Frederick Mayle Date: Fri, 12 Apr 2024 17:00:40 -0700 Subject: [PATCH 16/23] add all android sysconf constants Source: https://cs.android.com/android/platform/superproject/main/+/main:bionic/libc/include/bits/sysconf.h Hex is used instead of decimal to match the source. No entries were removed (can be verified with `--word-diff`). --- libc-test/semver/android.txt | 16 ++ src/unix/linux_like/android/mod.rs | 283 +++++++++++++++-------------- 2 files changed, 165 insertions(+), 134 deletions(-) diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 901b7ca768d4..36f808fdce81 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -2920,6 +2920,21 @@ _SC_HOST_NAME_MAX _SC_IOV_MAX _SC_IPV6 _SC_JOB_CONTROL +_SC_LEVEL1_DCACHE_ASSOC +_SC_LEVEL1_DCACHE_LINESIZE +_SC_LEVEL1_DCACHE_SIZE +_SC_LEVEL1_ICACHE_ASSOC +_SC_LEVEL1_ICACHE_LINESIZE +_SC_LEVEL1_ICACHE_SIZE +_SC_LEVEL2_CACHE_ASSOC +_SC_LEVEL2_CACHE_LINESIZE +_SC_LEVEL2_CACHE_SIZE +_SC_LEVEL3_CACHE_ASSOC +_SC_LEVEL3_CACHE_LINESIZE +_SC_LEVEL3_CACHE_SIZE +_SC_LEVEL4_CACHE_ASSOC +_SC_LEVEL4_CACHE_LINESIZE +_SC_LEVEL4_CACHE_SIZE _SC_LINE_MAX _SC_LOGIN_NAME_MAX _SC_MAPPED_FILES @@ -2990,6 +3005,7 @@ _SC_TRACE_USER_EVENT_MAX _SC_TTY_NAME_MAX _SC_TYPED_MEMORY_OBJECTS _SC_TZNAME_MAX +_SC_UIO_MAXIOV _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFFBIG _SC_V7_LP64_OFF64 diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 2c1c1e9b91f2..8e5032aa8157 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1182,140 +1182,155 @@ pub const _PC_SYNC_IO: ::c_int = 19; pub const FIONBIO: ::c_int = 0x5421; -pub const _SC_ARG_MAX: ::c_int = 0; -pub const _SC_BC_BASE_MAX: ::c_int = 1; -pub const _SC_BC_DIM_MAX: ::c_int = 2; -pub const _SC_BC_SCALE_MAX: ::c_int = 3; -pub const _SC_BC_STRING_MAX: ::c_int = 4; -pub const _SC_CHILD_MAX: ::c_int = 5; -pub const _SC_CLK_TCK: ::c_int = 6; -pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 7; -pub const _SC_EXPR_NEST_MAX: ::c_int = 8; -pub const _SC_LINE_MAX: ::c_int = 9; -pub const _SC_NGROUPS_MAX: ::c_int = 10; -pub const _SC_OPEN_MAX: ::c_int = 11; -pub const _SC_PASS_MAX: ::c_int = 12; -pub const _SC_2_C_BIND: ::c_int = 13; -pub const _SC_2_C_DEV: ::c_int = 14; -pub const _SC_2_C_VERSION: ::c_int = 15; -pub const _SC_2_CHAR_TERM: ::c_int = 16; -pub const _SC_2_FORT_DEV: ::c_int = 17; -pub const _SC_2_FORT_RUN: ::c_int = 18; -pub const _SC_2_LOCALEDEF: ::c_int = 19; -pub const _SC_2_SW_DEV: ::c_int = 20; -pub const _SC_2_UPE: ::c_int = 21; -pub const _SC_2_VERSION: ::c_int = 22; -pub const _SC_JOB_CONTROL: ::c_int = 23; -pub const _SC_SAVED_IDS: ::c_int = 24; -pub const _SC_VERSION: ::c_int = 25; -pub const _SC_RE_DUP_MAX: ::c_int = 26; -pub const _SC_STREAM_MAX: ::c_int = 27; -pub const _SC_TZNAME_MAX: ::c_int = 28; -pub const _SC_XOPEN_CRYPT: ::c_int = 29; -pub const _SC_XOPEN_ENH_I18N: ::c_int = 30; -pub const _SC_XOPEN_SHM: ::c_int = 31; -pub const _SC_XOPEN_VERSION: ::c_int = 32; -pub const _SC_XOPEN_XCU_VERSION: ::c_int = 33; -pub const _SC_XOPEN_REALTIME: ::c_int = 34; -pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 35; -pub const _SC_XOPEN_LEGACY: ::c_int = 36; -pub const _SC_ATEXIT_MAX: ::c_int = 37; -pub const _SC_IOV_MAX: ::c_int = 38; -pub const _SC_PAGESIZE: ::c_int = 39; -pub const _SC_PAGE_SIZE: ::c_int = 40; -pub const _SC_XOPEN_UNIX: ::c_int = 41; -pub const _SC_XBS5_ILP32_OFF32: ::c_int = 42; -pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 43; -pub const _SC_XBS5_LP64_OFF64: ::c_int = 44; -pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 45; -pub const _SC_AIO_LISTIO_MAX: ::c_int = 46; -pub const _SC_AIO_MAX: ::c_int = 47; -pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 48; -pub const _SC_DELAYTIMER_MAX: ::c_int = 49; -pub const _SC_MQ_OPEN_MAX: ::c_int = 50; -pub const _SC_MQ_PRIO_MAX: ::c_int = 51; -pub const _SC_RTSIG_MAX: ::c_int = 52; -pub const _SC_SEM_NSEMS_MAX: ::c_int = 53; -pub const _SC_SEM_VALUE_MAX: ::c_int = 54; -pub const _SC_SIGQUEUE_MAX: ::c_int = 55; -pub const _SC_TIMER_MAX: ::c_int = 56; -pub const _SC_ASYNCHRONOUS_IO: ::c_int = 57; -pub const _SC_FSYNC: ::c_int = 58; -pub const _SC_MAPPED_FILES: ::c_int = 59; -pub const _SC_MEMLOCK: ::c_int = 60; -pub const _SC_MEMLOCK_RANGE: ::c_int = 61; -pub const _SC_MEMORY_PROTECTION: ::c_int = 62; -pub const _SC_MESSAGE_PASSING: ::c_int = 63; -pub const _SC_PRIORITIZED_IO: ::c_int = 64; -pub const _SC_PRIORITY_SCHEDULING: ::c_int = 65; -pub const _SC_REALTIME_SIGNALS: ::c_int = 66; -pub const _SC_SEMAPHORES: ::c_int = 67; -pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 68; -pub const _SC_SYNCHRONIZED_IO: ::c_int = 69; -pub const _SC_TIMERS: ::c_int = 70; -pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 71; -pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 72; -pub const _SC_LOGIN_NAME_MAX: ::c_int = 73; -pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 74; -pub const _SC_THREAD_KEYS_MAX: ::c_int = 75; -pub const _SC_THREAD_STACK_MIN: ::c_int = 76; -pub const _SC_THREAD_THREADS_MAX: ::c_int = 77; -pub const _SC_TTY_NAME_MAX: ::c_int = 78; -pub const _SC_THREADS: ::c_int = 79; -pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 80; -pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 81; -pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 82; -pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 83; -pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 84; -pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 85; -pub const _SC_NPROCESSORS_CONF: ::c_int = 96; -pub const _SC_NPROCESSORS_ONLN: ::c_int = 97; -pub const _SC_PHYS_PAGES: ::c_int = 98; -pub const _SC_AVPHYS_PAGES: ::c_int = 99; -pub const _SC_MONOTONIC_CLOCK: ::c_int = 100; - -pub const _SC_2_PBS: ::c_int = 101; -pub const _SC_2_PBS_ACCOUNTING: ::c_int = 102; -pub const _SC_2_PBS_CHECKPOINT: ::c_int = 103; -pub const _SC_2_PBS_LOCATE: ::c_int = 104; -pub const _SC_2_PBS_MESSAGE: ::c_int = 105; -pub const _SC_2_PBS_TRACK: ::c_int = 106; -pub const _SC_ADVISORY_INFO: ::c_int = 107; -pub const _SC_BARRIERS: ::c_int = 108; -pub const _SC_CLOCK_SELECTION: ::c_int = 109; -pub const _SC_CPUTIME: ::c_int = 110; -pub const _SC_HOST_NAME_MAX: ::c_int = 111; -pub const _SC_IPV6: ::c_int = 112; -pub const _SC_RAW_SOCKETS: ::c_int = 113; -pub const _SC_READER_WRITER_LOCKS: ::c_int = 114; -pub const _SC_REGEXP: ::c_int = 115; -pub const _SC_SHELL: ::c_int = 116; -pub const _SC_SPAWN: ::c_int = 117; -pub const _SC_SPIN_LOCKS: ::c_int = 118; -pub const _SC_SPORADIC_SERVER: ::c_int = 119; -pub const _SC_SS_REPL_MAX: ::c_int = 120; -pub const _SC_SYMLOOP_MAX: ::c_int = 121; -pub const _SC_THREAD_CPUTIME: ::c_int = 122; -pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 123; -pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 124; -pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 125; -pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 126; -pub const _SC_TIMEOUTS: ::c_int = 127; -pub const _SC_TRACE: ::c_int = 128; -pub const _SC_TRACE_EVENT_FILTER: ::c_int = 129; -pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 130; -pub const _SC_TRACE_INHERIT: ::c_int = 131; -pub const _SC_TRACE_LOG: ::c_int = 132; -pub const _SC_TRACE_NAME_MAX: ::c_int = 133; -pub const _SC_TRACE_SYS_MAX: ::c_int = 134; -pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 135; -pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 136; -pub const _SC_V7_ILP32_OFF32: ::c_int = 137; -pub const _SC_V7_ILP32_OFFBIG: ::c_int = 138; -pub const _SC_V7_LP64_OFF64: ::c_int = 139; -pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 140; -pub const _SC_XOPEN_STREAMS: ::c_int = 141; -pub const _SC_XOPEN_UUCP: ::c_int = 142; +pub const _SC_ARG_MAX: ::c_int = 0x0000; +pub const _SC_BC_BASE_MAX: ::c_int = 0x0001; +pub const _SC_BC_DIM_MAX: ::c_int = 0x0002; +pub const _SC_BC_SCALE_MAX: ::c_int = 0x0003; +pub const _SC_BC_STRING_MAX: ::c_int = 0x0004; +pub const _SC_CHILD_MAX: ::c_int = 0x0005; +pub const _SC_CLK_TCK: ::c_int = 0x0006; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 0x0007; +pub const _SC_EXPR_NEST_MAX: ::c_int = 0x0008; +pub const _SC_LINE_MAX: ::c_int = 0x0009; +pub const _SC_NGROUPS_MAX: ::c_int = 0x000a; +pub const _SC_OPEN_MAX: ::c_int = 0x000b; +pub const _SC_PASS_MAX: ::c_int = 0x000c; +pub const _SC_2_C_BIND: ::c_int = 0x000d; +pub const _SC_2_C_DEV: ::c_int = 0x000e; +pub const _SC_2_C_VERSION: ::c_int = 0x000f; +pub const _SC_2_CHAR_TERM: ::c_int = 0x0010; +pub const _SC_2_FORT_DEV: ::c_int = 0x0011; +pub const _SC_2_FORT_RUN: ::c_int = 0x0012; +pub const _SC_2_LOCALEDEF: ::c_int = 0x0013; +pub const _SC_2_SW_DEV: ::c_int = 0x0014; +pub const _SC_2_UPE: ::c_int = 0x0015; +pub const _SC_2_VERSION: ::c_int = 0x0016; +pub const _SC_JOB_CONTROL: ::c_int = 0x0017; +pub const _SC_SAVED_IDS: ::c_int = 0x0018; +pub const _SC_VERSION: ::c_int = 0x0019; +pub const _SC_RE_DUP_MAX: ::c_int = 0x001a; +pub const _SC_STREAM_MAX: ::c_int = 0x001b; +pub const _SC_TZNAME_MAX: ::c_int = 0x001c; +pub const _SC_XOPEN_CRYPT: ::c_int = 0x001d; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 0x001e; +pub const _SC_XOPEN_SHM: ::c_int = 0x001f; +pub const _SC_XOPEN_VERSION: ::c_int = 0x0020; +pub const _SC_XOPEN_XCU_VERSION: ::c_int = 0x0021; +pub const _SC_XOPEN_REALTIME: ::c_int = 0x0022; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 0x0023; +pub const _SC_XOPEN_LEGACY: ::c_int = 0x0024; +pub const _SC_ATEXIT_MAX: ::c_int = 0x0025; +pub const _SC_IOV_MAX: ::c_int = 0x0026; +pub const _SC_UIO_MAXIOV: ::c_int = _SC_IOV_MAX; +pub const _SC_PAGESIZE: ::c_int = 0x0027; +pub const _SC_PAGE_SIZE: ::c_int = 0x0028; +pub const _SC_XOPEN_UNIX: ::c_int = 0x0029; +pub const _SC_XBS5_ILP32_OFF32: ::c_int = 0x002a; +pub const _SC_XBS5_ILP32_OFFBIG: ::c_int = 0x002b; +pub const _SC_XBS5_LP64_OFF64: ::c_int = 0x002c; +pub const _SC_XBS5_LPBIG_OFFBIG: ::c_int = 0x002d; +pub const _SC_AIO_LISTIO_MAX: ::c_int = 0x002e; +pub const _SC_AIO_MAX: ::c_int = 0x002f; +pub const _SC_AIO_PRIO_DELTA_MAX: ::c_int = 0x0030; +pub const _SC_DELAYTIMER_MAX: ::c_int = 0x0031; +pub const _SC_MQ_OPEN_MAX: ::c_int = 0x0032; +pub const _SC_MQ_PRIO_MAX: ::c_int = 0x0033; +pub const _SC_RTSIG_MAX: ::c_int = 0x0034; +pub const _SC_SEM_NSEMS_MAX: ::c_int = 0x0035; +pub const _SC_SEM_VALUE_MAX: ::c_int = 0x0036; +pub const _SC_SIGQUEUE_MAX: ::c_int = 0x0037; +pub const _SC_TIMER_MAX: ::c_int = 0x0038; +pub const _SC_ASYNCHRONOUS_IO: ::c_int = 0x0039; +pub const _SC_FSYNC: ::c_int = 0x003a; +pub const _SC_MAPPED_FILES: ::c_int = 0x003b; +pub const _SC_MEMLOCK: ::c_int = 0x003c; +pub const _SC_MEMLOCK_RANGE: ::c_int = 0x003d; +pub const _SC_MEMORY_PROTECTION: ::c_int = 0x003e; +pub const _SC_MESSAGE_PASSING: ::c_int = 0x003f; +pub const _SC_PRIORITIZED_IO: ::c_int = 0x0040; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 0x0041; +pub const _SC_REALTIME_SIGNALS: ::c_int = 0x0042; +pub const _SC_SEMAPHORES: ::c_int = 0x0043; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 0x0044; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 0x0045; +pub const _SC_TIMERS: ::c_int = 0x0046; +pub const _SC_GETGR_R_SIZE_MAX: ::c_int = 0x0047; +pub const _SC_GETPW_R_SIZE_MAX: ::c_int = 0x0048; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 0x0049; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 0x004a; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 0x004b; +pub const _SC_THREAD_STACK_MIN: ::c_int = 0x004c; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 0x004d; +pub const _SC_TTY_NAME_MAX: ::c_int = 0x004e; +pub const _SC_THREADS: ::c_int = 0x004f; +pub const _SC_THREAD_ATTR_STACKADDR: ::c_int = 0x0050; +pub const _SC_THREAD_ATTR_STACKSIZE: ::c_int = 0x0051; +pub const _SC_THREAD_PRIORITY_SCHEDULING: ::c_int = 0x0052; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 0x0053; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 0x0054; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 0x0055; +pub const _SC_NPROCESSORS_CONF: ::c_int = 0x0060; +pub const _SC_NPROCESSORS_ONLN: ::c_int = 0x0061; +pub const _SC_PHYS_PAGES: ::c_int = 0x0062; +pub const _SC_AVPHYS_PAGES: ::c_int = 0x0063; +pub const _SC_MONOTONIC_CLOCK: ::c_int = 0x0064; +pub const _SC_2_PBS: ::c_int = 0x0065; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 0x0066; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 0x0067; +pub const _SC_2_PBS_LOCATE: ::c_int = 0x0068; +pub const _SC_2_PBS_MESSAGE: ::c_int = 0x0069; +pub const _SC_2_PBS_TRACK: ::c_int = 0x006a; +pub const _SC_ADVISORY_INFO: ::c_int = 0x006b; +pub const _SC_BARRIERS: ::c_int = 0x006c; +pub const _SC_CLOCK_SELECTION: ::c_int = 0x006d; +pub const _SC_CPUTIME: ::c_int = 0x006e; +pub const _SC_HOST_NAME_MAX: ::c_int = 0x006f; +pub const _SC_IPV6: ::c_int = 0x0070; +pub const _SC_RAW_SOCKETS: ::c_int = 0x0071; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 0x0072; +pub const _SC_REGEXP: ::c_int = 0x0073; +pub const _SC_SHELL: ::c_int = 0x0074; +pub const _SC_SPAWN: ::c_int = 0x0075; +pub const _SC_SPIN_LOCKS: ::c_int = 0x0076; +pub const _SC_SPORADIC_SERVER: ::c_int = 0x0077; +pub const _SC_SS_REPL_MAX: ::c_int = 0x0078; +pub const _SC_SYMLOOP_MAX: ::c_int = 0x0079; +pub const _SC_THREAD_CPUTIME: ::c_int = 0x007a; +pub const _SC_THREAD_PROCESS_SHARED: ::c_int = 0x007b; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 0x007c; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 0x007d; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 0x007e; +pub const _SC_TIMEOUTS: ::c_int = 0x007f; +pub const _SC_TRACE: ::c_int = 0x0080; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 0x0081; +pub const _SC_TRACE_EVENT_NAME_MAX: ::c_int = 0x0082; +pub const _SC_TRACE_INHERIT: ::c_int = 0x0083; +pub const _SC_TRACE_LOG: ::c_int = 0x0084; +pub const _SC_TRACE_NAME_MAX: ::c_int = 0x0085; +pub const _SC_TRACE_SYS_MAX: ::c_int = 0x0086; +pub const _SC_TRACE_USER_EVENT_MAX: ::c_int = 0x0087; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 0x0088; +pub const _SC_V7_ILP32_OFF32: ::c_int = 0x0089; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 0x008a; +pub const _SC_V7_LP64_OFF64: ::c_int = 0x008b; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 0x008c; +pub const _SC_XOPEN_STREAMS: ::c_int = 0x008d; +pub const _SC_XOPEN_UUCP: ::c_int = 0x008e; +pub const _SC_LEVEL1_ICACHE_SIZE: ::c_int = 0x008f; +pub const _SC_LEVEL1_ICACHE_ASSOC: ::c_int = 0x0090; +pub const _SC_LEVEL1_ICACHE_LINESIZE: ::c_int = 0x0091; +pub const _SC_LEVEL1_DCACHE_SIZE: ::c_int = 0x0092; +pub const _SC_LEVEL1_DCACHE_ASSOC: ::c_int = 0x0093; +pub const _SC_LEVEL1_DCACHE_LINESIZE: ::c_int = 0x0094; +pub const _SC_LEVEL2_CACHE_SIZE: ::c_int = 0x0095; +pub const _SC_LEVEL2_CACHE_ASSOC: ::c_int = 0x0096; +pub const _SC_LEVEL2_CACHE_LINESIZE: ::c_int = 0x0097; +pub const _SC_LEVEL3_CACHE_SIZE: ::c_int = 0x0098; +pub const _SC_LEVEL3_CACHE_ASSOC: ::c_int = 0x0099; +pub const _SC_LEVEL3_CACHE_LINESIZE: ::c_int = 0x009a; +pub const _SC_LEVEL4_CACHE_SIZE: ::c_int = 0x009b; +pub const _SC_LEVEL4_CACHE_ASSOC: ::c_int = 0x009c; +pub const _SC_LEVEL4_CACHE_LINESIZE: ::c_int = 0x009d; pub const F_LOCK: ::c_int = 1; pub const F_TEST: ::c_int = 3; From 16b06ea3b67538c27ab6fbaa9fc43a67eac76e31 Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Wed, 3 Apr 2024 10:43:26 +0800 Subject: [PATCH 17/23] feat: more _PC_XXX constants for apple targets --- libc-test/semver/apple.txt | 18 ++++++++++++++++++ src/unix/bsd/apple/mod.rs | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index ce9c6097bbb8..42966b54309c 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -2284,3 +2284,21 @@ wait4 waitid xsw_usage xucred +_PC_NAME_CHARS_MAX +_PC_CASE_SENSITIVE +_PC_CASE_PRESERVING +_PC_EXTENDED_SECURITY_NP +_PC_AUTH_OPAQUE_NP +_PC_2_SYMLINKS +_PC_ALLOC_SIZE_MIN +_PC_ASYNC_IO +_PC_FILESIZEBITS +_PC_PRIO_IO +_PC_REC_INCR_XFER_SIZE +_PC_REC_MAX_XFER_SIZE +_PC_REC_MIN_XFER_SIZE +_PC_REC_XFER_ALIGN +_PC_SYMLINK_MAX +_PC_SYNC_IO +_PC_XATTR_SIZE_BITS +_PC_MIN_HOLE_SIZE diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index d53282402667..74a87eccb165 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3227,6 +3227,24 @@ pub const _PC_PIPE_BUF: ::c_int = 6; pub const _PC_CHOWN_RESTRICTED: ::c_int = 7; pub const _PC_NO_TRUNC: ::c_int = 8; pub const _PC_VDISABLE: ::c_int = 9; +pub const _PC_NAME_CHARS_MAX: ::c_int = 10; +pub const _PC_CASE_SENSITIVE: ::c_int = 11; +pub const _PC_CASE_PRESERVING: ::c_int = 12; +pub const _PC_EXTENDED_SECURITY_NP: ::c_int = 13; +pub const _PC_AUTH_OPAQUE_NP: ::c_int = 14; +pub const _PC_2_SYMLINKS: ::c_int = 15; +pub const _PC_ALLOC_SIZE_MIN: ::c_int = 16; +pub const _PC_ASYNC_IO: ::c_int = 17; +pub const _PC_FILESIZEBITS: ::c_int = 18; +pub const _PC_PRIO_IO: ::c_int = 19; +pub const _PC_REC_INCR_XFER_SIZE: ::c_int = 20; +pub const _PC_REC_MAX_XFER_SIZE: ::c_int = 21; +pub const _PC_REC_MIN_XFER_SIZE: ::c_int = 22; +pub const _PC_REC_XFER_ALIGN: ::c_int = 23; +pub const _PC_SYMLINK_MAX: ::c_int = 24; +pub const _PC_SYNC_IO: ::c_int = 25; +pub const _PC_XATTR_SIZE_BITS: ::c_int = 26; +pub const _PC_MIN_HOLE_SIZE: ::c_int = 27; pub const O_EVTONLY: ::c_int = 0x00008000; pub const O_NOCTTY: ::c_int = 0x00020000; pub const O_DIRECTORY: ::c_int = 0x00100000; From 4b747613a527320504ba2017cb2d8891758c6e0d Mon Sep 17 00:00:00 2001 From: Steve Lau Date: Sun, 28 Apr 2024 08:59:27 +0800 Subject: [PATCH 18/23] feat: O_EXEC/O_SEARCH for apple platforms --- libc-test/semver/apple.txt | 2 ++ src/unix/bsd/apple/mod.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 42966b54309c..e01934bf0ceb 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -1035,11 +1035,13 @@ OXTABS O_ASYNC O_DSYNC O_EVTONLY +O_EXEC O_EXLOCK O_FSYNC O_NDELAY O_NOCTTY O_NOFOLLOW_ANY +O_SEARCH O_SHLOCK O_SYMLINK O_SYNC diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 74a87eccb165..d9e3831ea2e1 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -3252,6 +3252,8 @@ pub const O_SYMLINK: ::c_int = 0x00200000; pub const O_DSYNC: ::c_int = 0x00400000; pub const O_CLOEXEC: ::c_int = 0x01000000; pub const O_NOFOLLOW_ANY: ::c_int = 0x20000000; +pub const O_EXEC: ::c_int = 0x40000000; +pub const O_SEARCH: ::c_int = O_EXEC | O_DIRECTORY; pub const S_IFIFO: mode_t = 4096; pub const S_IFCHR: mode_t = 8192; pub const S_IFBLK: mode_t = 24576; From 1c7f8fcd8a224cdd5f4eb1202f83f76a8023e8d1 Mon Sep 17 00:00:00 2001 From: Niels Sascha Reedijk Date: Sat, 30 Mar 2024 07:47:03 +0000 Subject: [PATCH 19/23] Haiku: synchronize with post R1-beta 4 changes in libc The following changes in Haiku's POSIX library are included, post R1 Beta 4 (hrev56578) [hrev56665] Added missing posixoptions and sysconf constants according POSIX.1-2017 standard [hrev56989] headers/posix: Add TIOCM_RNG as a synonym for TIOCM_RI [hrev56990] termios: New ioctl: TIOCOUTQ [hrev56995] tty: Implement exclusive mode [ 05bd3f0] termios.h: Undefine/remove some unimplemented BeOS extensions [hrev57422] libroot: Add stpncpy [hrev57593] Change `AT_FDCWD` from -1 to -100 --- src/unix/haiku/mod.rs | 86 ++++++++++++++++++++++++++++++++++++++++--- src/unix/mod.rs | 9 +++++ 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/src/unix/haiku/mod.rs b/src/unix/haiku/mod.rs index e7b0f34dd371..0e60a1c6e267 100644 --- a/src/unix/haiku/mod.rs +++ b/src/unix/haiku/mod.rs @@ -706,7 +706,7 @@ pub const F_RDLCK: ::c_int = 0x0040; pub const F_UNLCK: ::c_int = 0x0200; pub const F_WRLCK: ::c_int = 0x0400; -pub const AT_FDCWD: ::c_int = -1; +pub const AT_FDCWD: ::c_int = -100; pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x01; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x02; pub const AT_REMOVEDIR: ::c_int = 0x04; @@ -1192,6 +1192,80 @@ pub const _SC_REGEXP: ::c_int = 62; pub const _SC_SYMLOOP_MAX: ::c_int = 63; pub const _SC_SHELL: ::c_int = 64; pub const _SC_TTY_NAME_MAX: ::c_int = 65; +pub const _SC_ADVISORY_INFO: ::c_int = 66; +pub const _SC_BARRIERS: ::c_int = 67; +pub const _SC_CLOCK_SELECTION: ::c_int = 68; +pub const _SC_FSYNC: ::c_int = 69; +pub const _SC_IPV6: ::c_int = 70; +pub const _SC_MEMLOCK: ::c_int = 71; +pub const _SC_MEMLOCK_RANGE: ::c_int = 72; +pub const _SC_MESSAGE_PASSING: ::c_int = 73; +pub const _SC_PRIORITIZED_IO: ::c_int = 74; +pub const _SC_PRIORITY_SCHEDULING: ::c_int = 75; +pub const _SC_READER_WRITER_LOCKS: ::c_int = 76; +pub const _SC_SHARED_MEMORY_OBJECTS: ::c_int = 77; +pub const _SC_SPAWN: ::c_int = 78; +pub const _SC_SPIN_LOCKS: ::c_int = 79; +pub const _SC_SPORADIC_SERVER: ::c_int = 80; +pub const _SC_SYNCHRONIZED_IO: ::c_int = 81; +pub const _SC_THREAD_PRIO_INHERIT: ::c_int = 82; +pub const _SC_THREAD_PRIO_PROTECT: ::c_int = 83; +pub const _SC_THREAD_ROBUST_PRIO_INHERIT: ::c_int = 84; +pub const _SC_THREAD_ROBUST_PRIO_PROTECT: ::c_int = 85; +pub const _SC_THREAD_SAFE_FUNCTIONS: ::c_int = 86; +pub const _SC_THREAD_SPORADIC_SERVER: ::c_int = 87; +pub const _SC_TIMEOUTS: ::c_int = 88; +pub const _SC_TRACE: ::c_int = 89; +pub const _SC_TRACE_EVENT_FILTER: ::c_int = 90; +pub const _SC_TRACE_INHERIT: ::c_int = 91; +pub const _SC_TRACE_LOG: ::c_int = 92; +pub const _SC_TYPED_MEMORY_OBJECTS: ::c_int = 93; +pub const _SC_V6_ILP32_OFF32: ::c_int = 94; +pub const _SC_V6_ILP32_OFFBIG: ::c_int = 95; +pub const _SC_V6_LP64_OFF64: ::c_int = 96; +pub const _SC_V6_LPBIG_OFFBIG: ::c_int = 97; +pub const _SC_V7_ILP32_OFF32: ::c_int = 98; +pub const _SC_V7_ILP32_OFFBIG: ::c_int = 99; +pub const _SC_V7_LP64_OFF64: ::c_int = 100; +pub const _SC_V7_LPBIG_OFFBIG: ::c_int = 101; +pub const _SC_2_C_BIND: ::c_int = 102; +pub const _SC_2_C_DEV: ::c_int = 103; +pub const _SC_2_CHAR_TERM: ::c_int = 104; +pub const _SC_2_FORT_DEV: ::c_int = 105; +pub const _SC_2_FORT_RUN: ::c_int = 106; +pub const _SC_2_LOCALEDEF: ::c_int = 107; +pub const _SC_2_PBS: ::c_int = 108; +pub const _SC_2_PBS_ACCOUNTING: ::c_int = 109; +pub const _SC_2_PBS_CHECKPOINT: ::c_int = 110; +pub const _SC_2_PBS_LOCATE: ::c_int = 111; +pub const _SC_2_PBS_MESSAGE: ::c_int = 112; +pub const _SC_2_PBS_TRACK: ::c_int = 113; +pub const _SC_2_SW_DEV: ::c_int = 114; +pub const _SC_2_UPE: ::c_int = 115; +pub const _SC_2_VERSION: ::c_int = 116; +pub const _SC_XOPEN_CRYPT: ::c_int = 117; +pub const _SC_XOPEN_ENH_I18N: ::c_int = 118; +pub const _SC_XOPEN_REALTIME: ::c_int = 119; +pub const _SC_XOPEN_REALTIME_THREADS: ::c_int = 120; +pub const _SC_XOPEN_SHM: ::c_int = 121; +pub const _SC_XOPEN_STREAMS: ::c_int = 122; +pub const _SC_XOPEN_UNIX: ::c_int = 123; +pub const _SC_XOPEN_UUCP: ::c_int = 124; +pub const _SC_XOPEN_VERSION: ::c_int = 125; +pub const _SC_BC_BASE_MAX: ::c_int = 129; +pub const _SC_BC_DIM_MAX: ::c_int = 130; +pub const _SC_BC_SCALE_MAX: ::c_int = 131; +pub const _SC_BC_STRING_MAX: ::c_int = 132; +pub const _SC_COLL_WEIGHTS_MAX: ::c_int = 133; +pub const _SC_EXPR_NEST_MAX: ::c_int = 134; +pub const _SC_LINE_MAX: ::c_int = 135; +pub const _SC_LOGIN_NAME_MAX: ::c_int = 136; +pub const _SC_MQ_OPEN_MAX: ::c_int = 137; +pub const _SC_MQ_PRIO_MAX: ::c_int = 138; +pub const _SC_THREAD_DESTRUCTOR_ITERATIONS: ::c_int = 139; +pub const _SC_THREAD_KEYS_MAX: ::c_int = 140; +pub const _SC_THREAD_THREADS_MAX: ::c_int = 141; +pub const _SC_RE_DUP_MAX: ::c_int = 142; pub const PTHREAD_STACK_MIN: ::size_t = 8192; @@ -1386,8 +1460,9 @@ pub const TCGB_RI: ::c_int = 0x04; pub const TCGB_DCD: ::c_int = 0x08; pub const TIOCM_CTS: ::c_int = TCGB_CTS; pub const TIOCM_CD: ::c_int = TCGB_DCD; -pub const TIOCM_CAR: ::c_int = TIOCM_CD; +pub const TIOCM_CAR: ::c_int = TCGB_DCD; pub const TIOCM_RI: ::c_int = TCGB_RI; +pub const TIOCM_RNG: ::c_int = TCGB_RI; pub const TIOCM_DSR: ::c_int = TCGB_DSR; pub const TIOCM_DTR: ::c_int = 0x10; pub const TIOCM_RTS: ::c_int = 0x20; @@ -1430,17 +1505,14 @@ pub const TCGETA: ::c_ulong = 0x8000; pub const TCSETA: ::c_ulong = TCGETA + 1; pub const TCSETAF: ::c_ulong = TCGETA + 2; pub const TCSETAW: ::c_ulong = TCGETA + 3; -pub const TCWAITEVENT: ::c_ulong = TCGETA + 4; pub const TCSBRK: ::c_ulong = TCGETA + 5; pub const TCFLSH: ::c_ulong = TCGETA + 6; pub const TCXONC: ::c_ulong = TCGETA + 7; -pub const TCQUERYCONNECTED: ::c_ulong = TCGETA + 8; pub const TCGETBITS: ::c_ulong = TCGETA + 9; pub const TCSETDTR: ::c_ulong = TCGETA + 10; pub const TCSETRTS: ::c_ulong = TCGETA + 11; pub const TIOCGWINSZ: ::c_ulong = TCGETA + 12; pub const TIOCSWINSZ: ::c_ulong = TCGETA + 13; -pub const TCVTIME: ::c_ulong = TCGETA + 14; pub const TIOCGPGRP: ::c_ulong = TCGETA + 15; pub const TIOCSPGRP: ::c_ulong = TCGETA + 16; pub const TIOCSCTTY: ::c_ulong = TCGETA + 17; @@ -1450,6 +1522,10 @@ pub const TIOCSBRK: ::c_ulong = TCGETA + 20; pub const TIOCCBRK: ::c_ulong = TCGETA + 21; pub const TIOCMBIS: ::c_ulong = TCGETA + 22; pub const TIOCMBIC: ::c_ulong = TCGETA + 23; +pub const TIOCGSID: ::c_ulong = TCGETA + 24; +pub const TIOCOUTQ: ::c_ulong = TCGETA + 25; +pub const TIOCEXCL: ::c_ulong = TCGETA + 26; +pub const TIOCNXCL: ::c_ulong = TCGETA + 27; pub const PRIO_PROCESS: ::c_int = 0; pub const PRIO_PGRP: ::c_int = 1; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 816bcae86ff3..49984d3f00c6 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -1409,6 +1409,15 @@ cfg_if! { target_os = "nto")))] { extern "C" { pub fn adjtime(delta: *const timeval, olddelta: *mut timeval) -> ::c_int; + } + } +} + +cfg_if! { + if #[cfg(not(any(target_os = "emscripten", + target_os = "android", + target_os = "nto")))] { + extern "C" { pub fn stpncpy(dst: *mut c_char, src: *const c_char, n: size_t) -> *mut c_char; } } From c0a693644c22fdb1a13b2e436fd0f5941a746aa4 Mon Sep 17 00:00:00 2001 From: ur4t <46435411+ur4t@users.noreply.github.com> Date: Sat, 30 Mar 2024 13:33:01 +0800 Subject: [PATCH 20/23] Add constant AT_MINSIGSTKSZ introduced by glibc 2.35 --- libc-test/semver/linux.txt | 1 + src/unix/linux_like/linux/mod.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 0ac88784343d..123f8dab404e 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -169,6 +169,7 @@ AT_GID AT_HWCAP AT_HWCAP2 AT_IGNORE +AT_MINSIGSTKSZ AT_NOTELF AT_NO_AUTOMOUNT AT_NULL diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index e8fb33d2c40d..ee2999861f5c 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -1821,6 +1821,7 @@ 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; +pub const AT_MINSIGSTKSZ: ::c_ulong = 51; pub const GLOB_ERR: ::c_int = 1 << 0; pub const GLOB_MARK: ::c_int = 1 << 1; From 82206836f7b61cbf5a4522da02cce54123807e7d Mon Sep 17 00:00:00 2001 From: ur4t <46435411+ur4t@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:08:05 +0800 Subject: [PATCH 21/23] Double quote variables in shell scripts --- ci/install-rust.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/install-rust.sh b/ci/install-rust.sh index d7e2be8070dc..d7a035af2168 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -13,12 +13,12 @@ fi if [ "$OS" = "windows" ]; then : "${TARGET?The TARGET environment variable must be set.}" rustup set profile minimal - rustup update --force $toolchain-"$TARGET" - rustup default $toolchain-"$TARGET" + rustup update --force "$toolchain-$TARGET" + rustup default "$toolchain-$TARGET" else rustup set profile minimal - rustup update --force $toolchain - rustup default $toolchain + rustup update --force "$toolchain" + rustup default "$toolchain" fi if [ -n "$TARGET" ]; then From e79e95f7909c9e04b620b4ec088baaec0377ebb6 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 12 Mar 2024 01:05:50 +0000 Subject: [PATCH 22/23] adding getentropy/getrandom to dragonflybsd. --- libc-test/semver/dragonfly.txt | 5 +++++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 7 ------- src/unix/bsd/freebsdlike/mod.rs | 8 ++++++++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index 8135be3b4948..febed0b3a7aa 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -326,6 +326,9 @@ GLOB_NOESCAPE GLOB_NOMATCH GLOB_NOSORT GLOB_NOSPACE +GRND_INSECURE +GRND_NONBLOCK +GRND_RANDOM HW_BYTEORDER HW_DISKNAMES HW_DISKSTATS @@ -1308,6 +1311,7 @@ fstatfs futimes getdomainname getdtablesize +getentropy getgrent getgrent_r getgrgid @@ -1331,6 +1335,7 @@ getprogname getpwent getpwent_r getpwnam_r +getrandom getresgid getresuid getrlimit diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 78314084cc6e..195c6cb3ead3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3875,11 +3875,6 @@ pub const F_SEAL_WRITE: ::c_int = 8; // for use with fspacectl pub const SPACECTL_DEALLOC: ::c_int = 1; -// For getrandom() -pub const GRND_NONBLOCK: ::c_uint = 0x1; -pub const GRND_RANDOM: ::c_uint = 0x2; -pub const GRND_INSECURE: ::c_uint = 0x4; - // For realhostname* api pub const HOSTNAME_FOUND: ::c_int = 0; pub const HOSTNAME_INCORRECTNAME: ::c_int = 1; @@ -5393,8 +5388,6 @@ extern "C" { pub fn fdatasync(fd: ::c_int) -> ::c_int; - pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; pub fn setproctitle_fast(fmt: *const ::c_char, ...); pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int; diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs index 00a944e42bf2..9b555e42edf2 100644 --- a/src/unix/bsd/freebsdlike/mod.rs +++ b/src/unix/bsd/freebsdlike/mod.rs @@ -1456,6 +1456,11 @@ pub const RB_GDB: ::c_int = 0x8000; pub const RB_MUTE: ::c_int = 0x10000; pub const RB_SELFTEST: ::c_int = 0x20000; +// For getrandom() +pub const GRND_NONBLOCK: ::c_uint = 0x1; +pub const GRND_RANDOM: ::c_uint = 0x2; +pub const GRND_INSECURE: ::c_uint = 0x4; + safe_f! { pub {const} fn WIFCONTINUED(status: ::c_int) -> bool { status == 0x13 @@ -1829,6 +1834,9 @@ extern "C" { abs_timeout: *const ::timespec, ) -> ::c_int; pub fn mq_unlink(name: *const ::c_char) -> ::c_int; + + pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; + pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; } #[link(name = "util")] From 4d6fe50954424fd89a5a229f8e0dbc9862d6809b Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Tue, 27 Feb 2024 15:53:25 -0800 Subject: [PATCH 23/23] Move strftime, strftime_l, strptime to linux_like Bionic, uclibc and emscripten all support these functions. See: https://github.com/aosp-mirror/platform_bionic/blob/2215ad406b253f12e270cdd0876e19e9df2aa6d4/libc/include/time.h https://github.com/wbx-github/uclibc-ng/blame/fc3b6dc46a80e1f4aa468472aa6c7083f3bc6581/include/time.h https://github.com/emscripten-core/emscripten/blob/e25fa53069665c1f6c3be4ba5ed1d6ae82339849/system/lib/libc/musl/include/time.h --- libc-test/semver/linux-gnu.txt | 3 --- libc-test/semver/linux-musl.txt | 3 --- libc-test/semver/linux.txt | 3 +++ src/unix/linux_like/linux/gnu/mod.rs | 15 --------------- src/unix/linux_like/linux/musl/mod.rs | 15 --------------- src/unix/linux_like/mod.rs | 15 +++++++++++++++ 6 files changed, 18 insertions(+), 36 deletions(-) diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 9bbdee0771b6..09625b8280c5 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -691,9 +691,6 @@ euidaccess eaccess asctime_r ctime_r -strftime -strftime_l -strptime dirname posix_basename gnu_basename diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index 2db034f813be..7e5a81194bdf 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -77,8 +77,5 @@ timex euidaccess eaccess asctime_r -strftime -strftime_l -strptime dirname basename diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 0ac88784343d..44e64d726ca4 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -3832,8 +3832,11 @@ statvfs64 strcasecmp strcasestr strchrnul +strftime +strftime_l strncasecmp strndup +strptime strsignal swapoff swapon diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index 9af519e9077d..4b3ee5a15ce3 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -1478,21 +1478,6 @@ extern "C" { pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char; pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char; - pub fn strftime( - s: *mut ::c_char, - max: ::size_t, - format: *const ::c_char, - tm: *const ::tm, - ) -> ::size_t; - pub fn strftime_l( - s: *mut ::c_char, - max: ::size_t, - format: *const ::c_char, - tm: *const ::tm, - locale: ::locale_t, - ) -> ::size_t; - pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; - pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; /// POSIX version of `basename(3)`, defined in `libgen.h`. #[link_name = "__xpg_basename"] diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 080c9ba8278b..36d8c2038143 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -883,21 +883,6 @@ extern "C" { pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char; - pub fn strftime( - s: *mut ::c_char, - max: ::size_t, - format: *const ::c_char, - tm: *const ::tm, - ) -> ::size_t; - pub fn strftime_l( - s: *mut ::c_char, - max: ::size_t, - format: *const ::c_char, - tm: *const ::tm, - locale: ::locale_t, - ) -> ::size_t; - pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; - pub fn dirname(path: *mut ::c_char) -> *mut ::c_char; pub fn basename(path: *mut ::c_char) -> *mut ::c_char; } diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index 8f71782dce05..e4740d76aeef 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1795,6 +1795,21 @@ extern "C" { pub fn uname(buf: *mut ::utsname) -> ::c_int; pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char; + + pub fn strftime( + s: *mut ::c_char, + max: ::size_t, + format: *const ::c_char, + tm: *const ::tm, + ) -> ::size_t; + pub fn strftime_l( + s: *mut ::c_char, + max: ::size_t, + format: *const ::c_char, + tm: *const ::tm, + locale: ::locale_t, + ) -> ::size_t; + pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char; } // LFS64 extensions