diff --git a/libc-test/build.rs b/libc-test/build.rs index 7ea00da688a1..ce3a3fda4e1f 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -5702,6 +5702,18 @@ fn test_aix(target: &str) { // allow type 'double' to be used in signal contexts. "fpreg_t" => true, + // This type is defined for a union used within `struct ld_info`. + // The AIX header does not declare a separate standalone union + // type for it. + "__ld_info_file" => true, + + // This is a simplified version of the AIX union `_simple_lock`. + "_kernel_simple_lock" => true, + + // These structures are guarded by the `_KERNEL` macro in the AIX + // header. + "fileops_t" | "file" => true, + _ => false, } }); @@ -5719,6 +5731,11 @@ fn test_aix(target: &str) { // The _ALL_SOURCE type of 'f_fsid' differs from POSIX's on AIX. ("statvfs", "f_fsid") => true, + // The type of `_file` is `__ld_info_file`, which is defined + // specifically for the union inside `struct ld_info`. The AIX + // header does not define a separate standalone union type for it. + ("ld_info", "_file") => true, + _ => false, } }); diff --git a/libc-test/semver/aix.txt b/libc-test/semver/aix.txt index 1f3324e213f5..73163c854f30 100644 --- a/libc-test/semver/aix.txt +++ b/libc-test/semver/aix.txt @@ -1791,12 +1791,14 @@ _W_STOPPED _W_STRC __context64 __extctx_t +__ld_info_file __pollfd_ext_u __tm_context_t __vmx_context_t __vmxreg_t __vsx_context_t _exit +_kernel_simple_lock abort accept access @@ -1915,7 +1917,9 @@ fgetpos fgetpos64 fgetpwent fgets +file fileno +fileops_t flock flock64 fnmatch @@ -2079,6 +2083,7 @@ kill lchown lcong48 lconv +ld_info lfind linger link @@ -2090,6 +2095,7 @@ locale_t localeconv localtime localtime_r +lock_data_instrumented lpar_get_info lpar_set_resources lrand48 diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index a52cc25077a9..80066883c7db 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1947,17 +1947,171 @@ PROT_GROWSUP PROT_NONE PROT_READ PROT_WRITE +PR_CAPBSET_DROP +PR_CAPBSET_READ +PR_CAP_AMBIENT +PR_CAP_AMBIENT_CLEAR_ALL +PR_CAP_AMBIENT_IS_SET +PR_CAP_AMBIENT_LOWER +PR_CAP_AMBIENT_RAISE +PR_ENDIAN_BIG +PR_ENDIAN_LITTLE +PR_ENDIAN_PPC_LITTLE +PR_FPEMU_NOPRINT +PR_FPEMU_SIGFPE +PR_FP_EXC_ASYNC +PR_FP_EXC_DISABLED +PR_FP_EXC_DIV +PR_FP_EXC_INV +PR_FP_EXC_NONRECOV +PR_FP_EXC_OVF +PR_FP_EXC_PRECISE +PR_FP_EXC_RES +PR_FP_EXC_SW_ENABLE +PR_FP_EXC_UND +PR_FP_MODE_FR +PR_FP_MODE_FRE +PR_GET_AUXV +PR_GET_CHILD_SUBREAPER +PR_GET_DUMPABLE +PR_GET_ENDIAN +PR_GET_FPEMU +PR_GET_FPEXC +PR_GET_FP_MODE +PR_GET_IO_FLUSHER +PR_GET_KEEPCAPS +PR_GET_MDWE +PR_GET_MEMORY_MERGE PR_GET_NAME PR_GET_NO_NEW_PRIVS +PR_GET_PDEATHSIG PR_GET_SECCOMP +PR_GET_SECUREBITS +PR_GET_SPECULATION_CTRL +PR_GET_TAGGED_ADDR_CTRL +PR_GET_THP_DISABLE +PR_GET_TID_ADDRESS +PR_GET_TIMERSLACK PR_GET_TIMING +PR_GET_TSC +PR_GET_UNALIGN +PR_MCE_KILL +PR_MCE_KILL_CLEAR +PR_MCE_KILL_DEFAULT +PR_MCE_KILL_EARLY +PR_MCE_KILL_GET +PR_MCE_KILL_LATE +PR_MCE_KILL_SET +PR_MDWE_NO_INHERIT +PR_MDWE_REFUSE_EXEC_GAIN +PR_MPX_DISABLE_MANAGEMENT +PR_MPX_ENABLE_MANAGEMENT +PR_MTE_TAG_MASK +PR_MTE_TAG_SHIFT +PR_MTE_TCF_ASYNC +PR_MTE_TCF_MASK +PR_MTE_TCF_NONE +PR_MTE_TCF_SHIFT +PR_MTE_TCF_SYNC +PR_PAC_APDAKEY +PR_PAC_APDBKEY +PR_PAC_APGAKEY +PR_PAC_APIAKEY +PR_PAC_APIBKEY +PR_PAC_GET_ENABLED_KEYS +PR_PAC_RESET_KEYS +PR_PAC_SET_ENABLED_KEYS +PR_RISCV_V_GET_CONTROL +PR_RISCV_V_SET_CONTROL +PR_RISCV_V_VSTATE_CTRL_CUR_MASK +PR_RISCV_V_VSTATE_CTRL_DEFAULT +PR_RISCV_V_VSTATE_CTRL_INHERIT +PR_RISCV_V_VSTATE_CTRL_MASK +PR_RISCV_V_VSTATE_CTRL_NEXT_MASK +PR_RISCV_V_VSTATE_CTRL_OFF +PR_RISCV_V_VSTATE_CTRL_ON +PR_SCHED_CORE +PR_SCHED_CORE_CREATE +PR_SCHED_CORE_GET +PR_SCHED_CORE_MAX +PR_SCHED_CORE_SCOPE_PROCESS_GROUP +PR_SCHED_CORE_SCOPE_THREAD +PR_SCHED_CORE_SCOPE_THREAD_GROUP +PR_SCHED_CORE_SHARE_FROM +PR_SCHED_CORE_SHARE_TO +PR_SET_CHILD_SUBREAPER +PR_SET_DUMPABLE +PR_SET_ENDIAN +PR_SET_FPEMU +PR_SET_FPEXC +PR_SET_FP_MODE +PR_SET_IO_FLUSHER +PR_SET_KEEPCAPS +PR_SET_MDWE +PR_SET_MEMORY_MERGE +PR_SET_MM +PR_SET_MM_ARG_END +PR_SET_MM_ARG_START +PR_SET_MM_AUXV +PR_SET_MM_BRK +PR_SET_MM_END_CODE +PR_SET_MM_END_DATA +PR_SET_MM_ENV_END +PR_SET_MM_ENV_START +PR_SET_MM_EXE_FILE +PR_SET_MM_MAP +PR_SET_MM_MAP_SIZE +PR_SET_MM_START_BRK +PR_SET_MM_START_CODE +PR_SET_MM_START_DATA +PR_SET_MM_START_STACK PR_SET_NAME PR_SET_NO_NEW_PRIVS +PR_SET_PDEATHSIG +PR_SET_PTRACER +PR_SET_PTRACER_ANY PR_SET_SECCOMP +PR_SET_SECUREBITS +PR_SET_SPECULATION_CTRL +PR_SET_SYSCALL_USER_DISPATCH +PR_SET_TAGGED_ADDR_CTRL +PR_SET_THP_DISABLE +PR_SET_TIMERSLACK +PR_SET_TIMING +PR_SET_TSC +PR_SET_UNALIGN PR_SET_VMA PR_SET_VMA_ANON_NAME +PR_SME_GET_VL +PR_SME_SET_VL +PR_SME_SET_VL_ONEXEC +PR_SME_VL_INHERIT +PR_SME_VL_LEN_MASK +PR_SPEC_DISABLE +PR_SPEC_DISABLE_NOEXEC +PR_SPEC_ENABLE +PR_SPEC_FORCE_DISABLE +PR_SPEC_INDIRECT_BRANCH +PR_SPEC_L1D_FLUSH +PR_SPEC_NOT_AFFECTED +PR_SPEC_PRCTL +PR_SPEC_STORE_BYPASS +PR_SVE_GET_VL +PR_SVE_SET_VL +PR_SVE_SET_VL_ONEXEC +PR_SVE_VL_INHERIT +PR_SVE_VL_LEN_MASK +PR_SYS_DISPATCH_OFF +PR_SYS_DISPATCH_ON +PR_TAGGED_ADDR_ENABLE +PR_TASK_PERF_EVENTS_DISABLE +PR_TASK_PERF_EVENTS_ENABLE PR_TIMING_STATISTICAL PR_TIMING_TIMESTAMP +PR_TSC_ENABLE +PR_TSC_SIGSEGV +PR_UNALIGN_NOPRINT +PR_UNALIGN_SIGBUS PTHREAD_BARRIER_SERIAL_THREAD PTHREAD_COND_INITIALIZER PTHREAD_CREATE_DETACHED @@ -2516,6 +2670,8 @@ SW_CNT SW_MAX SYN_CNT SYN_MAX +SYSCALL_DISPATCH_FILTER_ALLOW +SYSCALL_DISPATCH_FILTER_BLOCK SYS_accept4 SYS_acct SYS_add_key diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index 57e1cf5c4bd1..677e37ea0a15 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -426,6 +426,17 @@ IFF_SIMPLEX IFF_UP IMAXBEL INIT_PROCESS +IOCBASECMD +IOCGROUP +IOCGROUP_SHIFT +IOCPARM_LEN +IOCPARM_MASK +IOCPARM_SHIFT +IOC_DIRMASK +IOC_IN +IOC_INOUT +IOC_OUT +IOC_VOID IOV_MAX IPC_CREAT IPC_EXCL @@ -1116,9 +1127,14 @@ XATTR_CREATE XATTR_REPLACE YESEXPR YESSTR +_IO +_IOC _IOFBF _IOLBF _IONBF +_IOR +_IOW +_IOWR _PC_2_SYMLINKS _PC_ACL_EXTENDED _PC_FILESIZEBITS diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index a340a83a9271..c63c34772383 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -267,6 +267,15 @@ IFF_SIMPLEX IFF_STATICARP IFF_UP IMAXBEL +IOCBASECMD +IOCGROUP +IOCPARM_LEN +IOCPARM_MASK +IOC_DIRMASK +IOC_IN +IOC_INOUT +IOC_OUT +IOC_VOID IOV_MAX IPC_CREAT IPC_EXCL @@ -912,9 +921,14 @@ WSTOPPED WTRAPPED YESEXPR YESSTR +_IO +_IOC _IOFBF _IOLBF _IONBF +_IOR +_IOW +_IOWR _MAX_PAGE_SHIFT _PC_2_SYMLINKS _PC_ALLOC_SIZE_MIN diff --git a/src/lib.rs b/src/lib.rs index fb901944b22b..5989c64da628 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,12 +4,20 @@ #![allow( renamed_and_removed_lints, // Keep this order. unknown_lints, // Keep this order. - bad_style, + nonstandard_style, overflowing_literals, - improper_ctypes, unused_macros, unused_macro_rules, )] +// Prepare for a future upgrade +#![warn(rust_2024_compatibility)] +// Things missing for 2024 that are blocked on MSRV or breakage +#![allow( + missing_unsafe_on_extern, + edition_2024_expr_fragment_specifier, + // Allowed globally, the warning is enabled in individual modules as we work through them + unsafe_op_in_unsafe_fn +)] #![cfg_attr(libc_deny_warnings, deny(warnings))] // Attributes needed when building as part of the standard library #![cfg_attr(feature = "rustc-dep-of-std", feature(link_cfg, no_core))] diff --git a/src/unix/aix/mod.rs b/src/unix/aix/mod.rs index 1ee8c53b5505..9a4eac63dea6 100644 --- a/src/unix/aix/mod.rs +++ b/src/unix/aix/mod.rs @@ -1159,10 +1159,6 @@ pub const NFSMNT_ACDIRMAX: c_int = 0x0800; // rpcsvc/rstat.h pub const CPUSTATES: c_int = 4; -// search.h -pub const FIND: c_int = 0; -pub const ENTER: c_int = 1; - // semaphore.h pub const SEM_FAILED: *mut sem_t = -1isize as *mut crate::sem_t; diff --git a/src/unix/aix/powerpc64.rs b/src/unix/aix/powerpc64.rs index b2b7ea88f6e4..1a8ebb1cc7f6 100644 --- a/src/unix/aix/powerpc64.rs +++ b/src/unix/aix/powerpc64.rs @@ -1,6 +1,12 @@ use crate::off_t; use crate::prelude::*; +// Define lock_data_instrumented as an empty enum +missing! { + #[cfg_attr(feature = "extra_traits", derive(Debug))] + pub enum lock_data_instrumented {} +} + s! { pub struct sigset_t { pub ss_set: [c_ulong; 4], @@ -256,6 +262,74 @@ s_no_extra_traits! { pub __pad: [c_int; 3], } + pub union _kernel_simple_lock { + pub _slock: c_long, + pub _slockp: *mut lock_data_instrumented, + } + + pub struct fileops_t { + pub fo_rw: Option< + extern "C" fn( + file: *mut file, + rw: crate::uio_rw, + io: *mut c_void, + ext: c_long, + secattr: *mut c_void, + ) -> c_int, + >, + pub fo_ioctl: Option< + extern "C" fn( + file: *mut file, + a: c_long, + b: crate::caddr_t, + c: c_long, + d: c_long, + ) -> c_int, + >, + pub fo_select: Option< + extern "C" fn(file: *mut file, a: c_int, b: *mut c_ushort, c: extern "C" fn()) -> c_int, + >, + pub fo_close: Option c_int>, + pub fo_fstat: Option c_int>, + } + + pub struct file { + pub f_flag: c_long, + pub f_count: c_int, + pub f_options: c_short, + pub f_type: c_short, + // Should be pointer to 'vnode' + pub f_data: *mut c_void, + pub f_offset: c_longlong, + pub f_dir_off: c_long, + // Should be pointer to 'cred' + pub f_cred: *mut c_void, + pub f_lock: _kernel_simple_lock, + pub f_offset_lock: _kernel_simple_lock, + pub f_vinfo: crate::caddr_t, + pub f_ops: *mut fileops_t, + pub f_parentp: crate::caddr_t, + pub f_fnamep: crate::caddr_t, + pub f_fdata: [c_char; 160], + } + + pub union __ld_info_file { + pub _ldinfo_fd: c_int, + pub _ldinfo_fp: *mut file, + pub _core_offset: c_long, + } + + pub struct ld_info { + pub ldinfo_next: c_uint, + pub ldinfo_flags: c_uint, + pub _file: __ld_info_file, + pub ldinfo_textorg: *mut c_void, + pub ldinfo_textsize: c_ulong, + pub ldinfo_dataorg: *mut c_void, + pub ldinfo_datasize: c_ulong, + pub ldinfo_filename: [c_char; 2], + } + pub union __pollfd_ext_u { pub addr: *mut c_void, pub data32: u32, @@ -327,6 +401,7 @@ cfg_if! { self.__si_flags.hash(state); } } + impl PartialEq for __pollfd_ext_u { fn eq(&self, other: &__pollfd_ext_u) -> bool { unsafe { diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 682b8b7e9fe7..b9c35fe7f41f 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -440,6 +440,34 @@ pub const MNT_NODEV: c_int = 0x00000010; pub const MNT_LOCAL: c_int = 0x00001000; pub const MNT_QUOTA: c_int = 0x00002000; +// sys/ioccom.h in NetBSD and OpenBSD +pub const IOCPARM_MASK: u32 = 0x1fff; + +pub const IOC_VOID: c_ulong = 0x20000000; +pub const IOC_OUT: c_ulong = 0x40000000; +pub const IOC_IN: c_ulong = 0x80000000; +pub const IOC_INOUT: c_ulong = IOC_IN | IOC_OUT; +pub const IOC_DIRMASK: c_ulong = 0xe0000000; + +pub const fn _IO(g: c_ulong, n: c_ulong) -> c_ulong { + _IOC(IOC_VOID, g, n, 0) +} + +/// Build an ioctl number for an read-only ioctl. +pub const fn _IOR(g: c_ulong, n: c_ulong) -> c_ulong { + _IOC(IOC_OUT, g, n, mem::size_of::() as c_ulong) +} + +/// Build an ioctl number for an write-only ioctl. +pub const fn _IOW(g: c_ulong, n: c_ulong) -> c_ulong { + _IOC(IOC_IN, g, n, mem::size_of::() as c_ulong) +} + +/// Build an ioctl number for a read-write ioctl. +pub const fn _IOWR(g: c_ulong, n: c_ulong) -> c_ulong { + _IOC(IOC_INOUT, g, n, mem::size_of::() as c_ulong) +} + pub const AF_UNSPEC: c_int = 0; pub const AF_LOCAL: c_int = 1; pub const AF_UNIX: c_int = AF_LOCAL; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 1367276762d6..b6b3639c3791 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -39,6 +39,7 @@ pub type Elf64_Xword = u64; pub type iconv_t = *mut c_void; e! { + #[repr(C)] pub enum fae_action { FAE_OPEN, FAE_DUP2, @@ -1712,6 +1713,29 @@ pub const MNT_WAIT: c_int = 1; pub const MNT_NOWAIT: c_int = 2; pub const MNT_LAZY: c_int = 3; +// sys/ioccom.h +pub const IOCPARM_SHIFT: u32 = 16; +pub const IOCGROUP_SHIFT: u32 = 8; + +pub const fn IOCPARM_LEN(x: u32) -> u32 { + (x >> IOCPARM_SHIFT) & crate::IOCPARM_MASK +} + +pub const fn IOCBASECMD(x: u32) -> u32 { + x & (!(crate::IOCPARM_MASK << IOCPARM_SHIFT)) +} + +pub const fn IOCGROUP(x: u32) -> u32 { + (x >> IOCGROUP_SHIFT) & 0xff +} + +pub const fn _IOC(inout: c_ulong, group: c_ulong, num: c_ulong, len: c_ulong) -> c_ulong { + (inout) + | (((len) & crate::IOCPARM_MASK as c_ulong) << IOCPARM_SHIFT) + | ((group) << IOCGROUP_SHIFT) + | (num) +} + // pub const CLOCK_PROCESS_CPUTIME_ID: crate::clockid_t = 2; pub const CLOCK_THREAD_CPUTIME_ID: crate::clockid_t = 4; diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index 3a7aeadf4656..5ee6bc0ca04f 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -1738,6 +1738,23 @@ pub const PF_R: u32 = 0x4; pub const PF_MASKOS: u32 = 0x0ff00000; pub const PF_MASKPROC: u32 = 0xf0000000; +// sys/ioccom.h +pub const fn IOCPARM_LEN(x: u32) -> u32 { + (x >> 16) & crate::IOCPARM_MASK +} + +pub const fn IOCBASECMD(x: u32) -> u32 { + x & (!(crate::IOCPARM_MASK << 16)) +} + +pub const fn IOCGROUP(x: u32) -> u32 { + (x >> 8) & 0xff +} + +pub const fn _IOC(inout: c_ulong, group: c_ulong, num: c_ulong, len: c_ulong) -> c_ulong { + (inout) | (((len) & crate::IOCPARM_MASK as c_ulong) << 16) | ((group) << 8) | (num) +} + // sys/mount.h pub const MNT_NOPERM: c_int = 0x00000020; pub const MNT_WXALLOWED: c_int = 0x00000800; diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 100008ce5d8e..ac76616b68cf 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -2912,29 +2912,178 @@ pub const PF_VSOCK: c_int = AF_VSOCK; pub const SOMAXCONN: c_int = 128; -// sys/prctl.h -pub const PR_SET_PDEATHSIG: c_int = 1; -pub const PR_GET_PDEATHSIG: c_int = 2; -pub const PR_GET_SECUREBITS: c_int = 27; -pub const PR_SET_SECUREBITS: c_int = 28; - // sys/system_properties.h pub const PROP_VALUE_MAX: c_int = 92; pub const PROP_NAME_MAX: c_int = 32; // sys/prctl.h -pub const PR_SET_VMA: c_int = 0x53564d41; -pub const PR_SET_VMA_ANON_NAME: c_int = 0; -pub const PR_SET_NO_NEW_PRIVS: c_int = 38; -pub const PR_GET_NO_NEW_PRIVS: c_int = 39; -pub const PR_GET_SECCOMP: c_int = 21; -pub const PR_SET_SECCOMP: c_int = 22; +pub const PR_SET_PDEATHSIG: c_int = 1; +pub const PR_GET_PDEATHSIG: c_int = 2; +pub const PR_GET_DUMPABLE: c_int = 3; +pub const PR_SET_DUMPABLE: c_int = 4; +pub const PR_GET_UNALIGN: c_int = 5; +pub const PR_SET_UNALIGN: c_int = 6; +pub const PR_UNALIGN_NOPRINT: c_int = 1; +pub const PR_UNALIGN_SIGBUS: c_int = 2; +pub const PR_GET_KEEPCAPS: c_int = 7; +pub const PR_SET_KEEPCAPS: c_int = 8; +pub const PR_GET_FPEMU: c_int = 9; +pub const PR_SET_FPEMU: c_int = 10; +pub const PR_FPEMU_NOPRINT: c_int = 1; +pub const PR_FPEMU_SIGFPE: c_int = 2; +pub const PR_GET_FPEXC: c_int = 11; +pub const PR_SET_FPEXC: c_int = 12; +pub const PR_FP_EXC_SW_ENABLE: c_int = 0x80; +pub const PR_FP_EXC_DIV: c_int = 0x010000; +pub const PR_FP_EXC_OVF: c_int = 0x020000; +pub const PR_FP_EXC_UND: c_int = 0x040000; +pub const PR_FP_EXC_RES: c_int = 0x080000; +pub const PR_FP_EXC_INV: c_int = 0x100000; +pub const PR_FP_EXC_DISABLED: c_int = 0; +pub const PR_FP_EXC_NONRECOV: c_int = 1; +pub const PR_FP_EXC_ASYNC: c_int = 2; +pub const PR_FP_EXC_PRECISE: c_int = 3; pub const PR_GET_TIMING: c_int = 13; pub const PR_SET_TIMING: c_int = 14; pub const PR_TIMING_STATISTICAL: c_int = 0; pub const PR_TIMING_TIMESTAMP: c_int = 1; pub const PR_SET_NAME: c_int = 15; pub const PR_GET_NAME: c_int = 16; +pub const PR_GET_ENDIAN: c_int = 19; +pub const PR_SET_ENDIAN: c_int = 20; +pub const PR_ENDIAN_BIG: c_int = 0; +pub const PR_ENDIAN_LITTLE: c_int = 1; +pub const PR_ENDIAN_PPC_LITTLE: c_int = 2; +pub const PR_GET_SECCOMP: c_int = 21; +pub const PR_SET_SECCOMP: c_int = 22; +pub const PR_CAPBSET_READ: c_int = 23; +pub const PR_CAPBSET_DROP: c_int = 24; +pub const PR_GET_TSC: c_int = 25; +pub const PR_SET_TSC: c_int = 26; +pub const PR_TSC_ENABLE: c_int = 1; +pub const PR_TSC_SIGSEGV: c_int = 2; +pub const PR_GET_SECUREBITS: c_int = 27; +pub const PR_SET_SECUREBITS: c_int = 28; +pub const PR_SET_TIMERSLACK: c_int = 29; +pub const PR_GET_TIMERSLACK: c_int = 30; +pub const PR_TASK_PERF_EVENTS_DISABLE: c_int = 31; +pub const PR_TASK_PERF_EVENTS_ENABLE: c_int = 32; +pub const PR_MCE_KILL: c_int = 33; +pub const PR_MCE_KILL_CLEAR: c_int = 0; +pub const PR_MCE_KILL_SET: c_int = 1; +pub const PR_MCE_KILL_LATE: c_int = 0; +pub const PR_MCE_KILL_EARLY: c_int = 1; +pub const PR_MCE_KILL_DEFAULT: c_int = 2; +pub const PR_MCE_KILL_GET: c_int = 34; +pub const PR_SET_MM: c_int = 35; +pub const PR_SET_MM_START_CODE: c_int = 1; +pub const PR_SET_MM_END_CODE: c_int = 2; +pub const PR_SET_MM_START_DATA: c_int = 3; +pub const PR_SET_MM_END_DATA: c_int = 4; +pub const PR_SET_MM_START_STACK: c_int = 5; +pub const PR_SET_MM_START_BRK: c_int = 6; +pub const PR_SET_MM_BRK: c_int = 7; +pub const PR_SET_MM_ARG_START: c_int = 8; +pub const PR_SET_MM_ARG_END: c_int = 9; +pub const PR_SET_MM_ENV_START: c_int = 10; +pub const PR_SET_MM_ENV_END: c_int = 11; +pub const PR_SET_MM_AUXV: c_int = 12; +pub const PR_SET_MM_EXE_FILE: c_int = 13; +pub const PR_SET_MM_MAP: c_int = 14; +pub const PR_SET_MM_MAP_SIZE: c_int = 15; +pub const PR_SET_PTRACER: c_int = 0x59616d61; +pub const PR_SET_PTRACER_ANY: c_ulong = 0xffffffffffffffff; +pub const PR_SET_CHILD_SUBREAPER: c_int = 36; +pub const PR_GET_CHILD_SUBREAPER: c_int = 37; +pub const PR_SET_NO_NEW_PRIVS: c_int = 38; +pub const PR_GET_NO_NEW_PRIVS: c_int = 39; +pub const PR_GET_TID_ADDRESS: c_int = 40; +pub const PR_SET_THP_DISABLE: c_int = 41; +pub const PR_GET_THP_DISABLE: c_int = 42; +pub const PR_MPX_ENABLE_MANAGEMENT: c_int = 43; +pub const PR_MPX_DISABLE_MANAGEMENT: c_int = 44; +pub const PR_SET_FP_MODE: c_int = 45; +pub const PR_GET_FP_MODE: c_int = 46; +pub const PR_FP_MODE_FR: c_int = 1 << 0; +pub const PR_FP_MODE_FRE: c_int = 1 << 1; +pub const PR_CAP_AMBIENT: c_int = 47; +pub const PR_CAP_AMBIENT_IS_SET: c_int = 1; +pub const PR_CAP_AMBIENT_RAISE: c_int = 2; +pub const PR_CAP_AMBIENT_LOWER: c_int = 3; +pub const PR_CAP_AMBIENT_CLEAR_ALL: c_int = 4; +pub const PR_SVE_SET_VL: c_int = 50; +pub const PR_SVE_SET_VL_ONEXEC: c_int = 1 << 18; +pub const PR_SVE_GET_VL: c_int = 51; +pub const PR_SVE_VL_LEN_MASK: c_int = 0xffff; +pub const PR_SVE_VL_INHERIT: c_int = 1 << 17; +pub const PR_GET_SPECULATION_CTRL: c_int = 52; +pub const PR_SET_SPECULATION_CTRL: c_int = 53; +pub const PR_SPEC_STORE_BYPASS: c_int = 0; +pub const PR_SPEC_INDIRECT_BRANCH: c_int = 1; +pub const PR_SPEC_L1D_FLUSH: c_int = 2; +pub const PR_SPEC_NOT_AFFECTED: c_int = 0; +pub const PR_SPEC_PRCTL: c_ulong = 1 << 0; +pub const PR_SPEC_ENABLE: c_ulong = 1 << 1; +pub const PR_SPEC_DISABLE: c_ulong = 1 << 2; +pub const PR_SPEC_FORCE_DISABLE: c_ulong = 1 << 3; +pub const PR_SPEC_DISABLE_NOEXEC: c_ulong = 1 << 4; +pub const PR_PAC_RESET_KEYS: c_int = 54; +pub const PR_PAC_APIAKEY: c_ulong = 1 << 0; +pub const PR_PAC_APIBKEY: c_ulong = 1 << 1; +pub const PR_PAC_APDAKEY: c_ulong = 1 << 2; +pub const PR_PAC_APDBKEY: c_ulong = 1 << 3; +pub const PR_PAC_APGAKEY: c_ulong = 1 << 4; +pub const PR_SET_TAGGED_ADDR_CTRL: c_int = 55; +pub const PR_GET_TAGGED_ADDR_CTRL: c_int = 56; +pub const PR_TAGGED_ADDR_ENABLE: c_ulong = 1 << 0; +pub const PR_MTE_TCF_NONE: c_ulong = 0; +pub const PR_MTE_TCF_SYNC: c_ulong = 1 << 1; +pub const PR_MTE_TCF_ASYNC: c_ulong = 1 << 2; +pub const PR_MTE_TCF_MASK: c_ulong = PR_MTE_TCF_SYNC | PR_MTE_TCF_ASYNC; +pub const PR_MTE_TAG_SHIFT: c_ulong = 3; +pub const PR_MTE_TAG_MASK: c_ulong = 0xffff << PR_MTE_TAG_SHIFT; +pub const PR_MTE_TCF_SHIFT: c_ulong = 1; +pub const PR_SET_IO_FLUSHER: c_int = 57; +pub const PR_GET_IO_FLUSHER: c_int = 58; +pub const PR_SET_SYSCALL_USER_DISPATCH: c_int = 59; +pub const PR_SYS_DISPATCH_OFF: c_int = 0; +pub const PR_SYS_DISPATCH_ON: c_int = 1; +pub const SYSCALL_DISPATCH_FILTER_ALLOW: c_int = 0; +pub const SYSCALL_DISPATCH_FILTER_BLOCK: c_int = 1; +pub const PR_PAC_SET_ENABLED_KEYS: c_int = 60; +pub const PR_PAC_GET_ENABLED_KEYS: c_int = 61; +pub const PR_SCHED_CORE: c_int = 62; +pub const PR_SCHED_CORE_GET: c_int = 0; +pub const PR_SCHED_CORE_CREATE: c_int = 1; +pub const PR_SCHED_CORE_SHARE_TO: c_int = 2; +pub const PR_SCHED_CORE_SHARE_FROM: c_int = 3; +pub const PR_SCHED_CORE_MAX: c_int = 4; +pub const PR_SCHED_CORE_SCOPE_THREAD: c_int = 0; +pub const PR_SCHED_CORE_SCOPE_THREAD_GROUP: c_int = 1; +pub const PR_SCHED_CORE_SCOPE_PROCESS_GROUP: c_int = 2; +pub const PR_SME_SET_VL: c_int = 63; +pub const PR_SME_SET_VL_ONEXEC: c_int = 1 << 18; +pub const PR_SME_GET_VL: c_int = 64; +pub const PR_SME_VL_LEN_MASK: c_int = 0xffff; +pub const PR_SME_VL_INHERIT: c_int = 1 << 17; +pub const PR_SET_MDWE: c_int = 65; +pub const PR_MDWE_REFUSE_EXEC_GAIN: c_ulong = 1 << 0; +pub const PR_MDWE_NO_INHERIT: c_ulong = 1 << 1; +pub const PR_GET_MDWE: c_int = 66; +pub const PR_SET_VMA: c_int = 0x53564d41; +pub const PR_SET_VMA_ANON_NAME: c_int = 0; +pub const PR_GET_AUXV: c_int = 0x41555856; +pub const PR_SET_MEMORY_MERGE: c_int = 67; +pub const PR_GET_MEMORY_MERGE: c_int = 68; +pub const PR_RISCV_V_SET_CONTROL: c_int = 69; +pub const PR_RISCV_V_GET_CONTROL: c_int = 70; +pub const PR_RISCV_V_VSTATE_CTRL_DEFAULT: c_int = 0; +pub const PR_RISCV_V_VSTATE_CTRL_OFF: c_int = 1; +pub const PR_RISCV_V_VSTATE_CTRL_ON: c_int = 2; +pub const PR_RISCV_V_VSTATE_CTRL_INHERIT: c_int = 1 << 4; +pub const PR_RISCV_V_VSTATE_CTRL_CUR_MASK: c_int = 0x3; +pub const PR_RISCV_V_VSTATE_CTRL_NEXT_MASK: c_int = 0xc; +pub const PR_RISCV_V_VSTATE_CTRL_MASK: c_int = 0x1f; // linux/if_addr.h pub const IFA_UNSPEC: c_ushort = 0; diff --git a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs index 380077711d79..536c716ca486 100644 --- a/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs +++ b/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs @@ -26,22 +26,21 @@ s! { /// Bitmap of CPUs. map: l4_umword_t, } -} -#[cfg_attr(feature = "extra_traits", derive(Debug))] -pub struct pthread_attr_t { - pub __detachstate: c_int, - pub __schedpolicy: c_int, - pub __schedparam: super::__sched_param, - pub __inheritsched: c_int, - pub __scope: c_int, - pub __guardsize: size_t, - pub __stackaddr_set: c_int, - pub __stackaddr: *mut c_void, // better don't use it - pub __stacksize: size_t, - // L4Re specifics - pub affinity: l4_sched_cpu_set_t, - pub create_flags: c_uint, + pub struct pthread_attr_t { + pub __detachstate: c_int, + pub __schedpolicy: c_int, + pub __schedparam: super::__sched_param, + pub __inheritsched: c_int, + pub __scope: c_int, + pub __guardsize: size_t, + pub __stackaddr_set: c_int, + pub __stackaddr: *mut c_void, // better don't use it + pub __stacksize: size_t, + // L4Re specifics + pub affinity: l4_sched_cpu_set_t, + pub create_flags: c_uint, + } } // L4Re requires a min stack size of 64k; that isn't defined in uClibc, but