diff options
29 files changed, 566 insertions, 57 deletions
diff --git a/.cirrus.yml b/.cirrus.yml index 36690d7fa9..176a44af8f 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,3 +1,7 @@ +env: + # Temporary fix for https://github.com/rust-lang/rustup/issues/2774. + RUSTUP_IO_THREADS: "1" + task: name: stable x86_64-unknown-freebsd-11 freebsd_instance: @@ -31,7 +35,7 @@ task: task: name: nightly x86_64-unknown-freebsd-13 freebsd_instance: - image: freebsd-13-0-alpha3-amd64 + image: freebsd-13-0-release-amd64 setup_script: - pkg install -y curl - curl https://sh.rustup.rs -sSf --output rustup.sh diff --git a/ci/install-rust.sh b/ci/install-rust.sh index b06ba8eddb..377f0d0cf0 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -12,9 +12,9 @@ else fi if [ "$OS" = "windows" ]; then : "${TARGET?The TARGET environment variable must be set.}" + rustup self update rustup set profile minimal - # FIXME: Add `--no-self-update` to avoid CI failure. - rustup update --force $toolchain-"$TARGET" --no-self-update + rustup update --force $toolchain-"$TARGET" rustup default $toolchain-"$TARGET" else rustup set profile minimal diff --git a/libc-test/build.rs b/libc-test/build.rs index 446f1559a5..bd6787cd3d 100755 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -184,10 +184,15 @@ fn test_apple(target: &str) { "iconv.h", "ifaddrs.h", "langinfo.h", + "libproc.h", "limits.h", "locale.h", "mach-o/dyld.h", + "mach/mach_init.h", "mach/mach_time.h", + "mach/mach_types.h", + "mach/thread_act.h", + "mach/thread_policy.h", "malloc/malloc.h", "net/bpf.h", "net/if.h", @@ -579,6 +584,8 @@ fn test_windows(target: &str) { // FIXME: API error: // SIG_ERR type is "void (*)(int)", not "int" "SIG_ERR" => true, + // FIXME: newer windows-gnu environment on CI? + "_O_OBTAIN_DIR" if gnu => true, _ => false, } }); @@ -907,6 +914,7 @@ fn test_netbsd(target: &str) { "grp.h", "ifaddrs.h", "langinfo.h", + "net/bpf.h", "net/if.h", "net/if_arp.h", "net/if_dl.h", @@ -939,6 +947,7 @@ fn test_netbsd(target: &str) { "sys/time.h", "sys/times.h", "sys/timex.h", + "sys/ucontext.h", "sys/uio.h", "sys/un.h", "sys/utsname.h", @@ -1142,6 +1151,7 @@ fn test_dragonflybsd(target: &str) { "sys/ptrace.h", "sys/resource.h", "sys/rtprio.h", + "sys/sched.h", "sys/socket.h", "sys/stat.h", "sys/statvfs.h", @@ -1679,6 +1689,11 @@ fn test_freebsd(target: &str) { _ => cfg.define("_WANT_FREEBSD11_STAT", None), }; + let freebsdlast = match freebsd_ver { + Some(12) | Some(13) => true, + _ => false, + }; + headers! { cfg: "aio.h", "arpa/inet.h", @@ -1724,6 +1739,9 @@ fn test_freebsd(target: &str) { "stdio.h", "stdlib.h", "string.h", + "sys/capsicum.h", + [freebsdlast]:"sys/auxv.h", + "sys/cpuset.h", "sys/event.h", "sys/extattr.h", "sys/file.h", @@ -3203,6 +3221,7 @@ fn test_haiku(target: &str) { "kernel/fs_query.h", "kernel/fs_volume.h", "kernel/image.h", + "kernel/scheduler.h", "storage/StorageDefs.h", "support/Errors.h", "support/SupportDefs.h", diff --git a/libc-test/semver/TODO-linux.txt b/libc-test/semver/TODO-linux.txt index 6396cf4684..aefe205853 100644 --- a/libc-test/semver/TODO-linux.txt +++ b/libc-test/semver/TODO-linux.txt @@ -1,38 +1,6 @@ # The following symbols are not not available in some combinations of # musl/gnu/android and/or architecture. BOTHER -HWCAP_AES -HWCAP_ASIMD -HWCAP_ASIMDDP -HWCAP_ASIMDFHM -HWCAP_ASIMDHP -HWCAP_ASIMDRDM -HWCAP_ATOMICS -HWCAP_CPUID -HWCAP_CRC32 -HWCAP_DCPOP -HWCAP_DIT -HWCAP_EVTSTRM -HWCAP_FCMA -HWCAP_FLAGM -HWCAP_FP -HWCAP_FPHP -HWCAP_ILRCPC -HWCAP_JSCVT -HWCAP_LRCPC -HWCAP_PACA -HWCAP_PACG -HWCAP_PMULL -HWCAP_SB -HWCAP_SHA1 -HWCAP_SHA2 -HWCAP_SHA3 -HWCAP_SHA512 -HWCAP_SM3 -HWCAP_SM4 -HWCAP_SSBS -HWCAP_SVE -HWCAP_USCAT KEYCTL_CAPABILITIES KEYCTL_CAPS0_BIG_KEY KEYCTL_CAPS0_CAPABILITIES diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 7181fb2d09..117d50e361 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1098,6 +1098,7 @@ MS_DIRSYNC MS_INVALIDATE MS_I_VERSION MS_KERNMOUNT +MS_LAZYTIME MS_MANDLOCK MS_MGC_MSK MS_MGC_VAL diff --git a/libc-test/semver/apple.txt b/libc-test/semver/apple.txt index 85753f5fed..a95e0d5285 100644 --- a/libc-test/semver/apple.txt +++ b/libc-test/semver/apple.txt @@ -497,10 +497,12 @@ ITIMER_PROF ITIMER_REAL ITIMER_VIRTUAL IUTF8 +KERN_ABORTED KERN_AFFINITY KERN_AIOMAX KERN_AIOPROCMAX KERN_AIOTHREADS +KERN_ALREADY_WAITING KERN_ARGMAX KERN_BOOTFILE KERN_BOOTTIME @@ -508,16 +510,33 @@ KERN_CHECKOPENEVT KERN_CLASSIC KERN_CLASSICHANDLER KERN_CLOCKRATE +KERN_CODESIGN_ERROR KERN_COREDUMP KERN_COREFILE +KERN_DEFAULT_SET KERN_DOMAINNAME KERN_DUMMY KERN_DUMPDEV +KERN_EXCEPTION_PROTECTED KERN_EXEC +KERN_FAILURE KERN_FILE KERN_HOSTID KERN_HOSTNAME KERN_IPC +KERN_INSUFFICIENT_BUFFER_SIZE +KERN_INVALID_ADDRESS +KERN_INVALID_ARGUMENT +KERN_INVALID_HOST +KERN_INVALID_LEDGER +KERN_INVALID_MEMORY_CONTROL +KERN_INVALID_NAME +KERN_INVALID_POLICY +KERN_INVALID_OBJECT +KERN_INVALID_SECURITY +KERN_INVALID_TASK +KERN_INVALID_RIGHT +KERN_INVALID_VALUE KERN_JOB_CONTROL KERN_KDBUFWAIT KERN_KDCPUMAP @@ -542,6 +561,10 @@ KERN_KDTHRMAP KERN_KDWRITEMAP KERN_KDWRITETR KERN_LOGSIGEXIT +KERN_LOCK_OWNED +KERN_LOCK_OWNED_SELF +KERN_LOCK_SET_DESTROYED +KERN_LOCK_UNSTABLE KERN_LOW_PRI_DELAY KERN_LOW_PRI_WINDOW KERN_MAXFILES @@ -551,17 +574,30 @@ KERN_MAXPARTITIONS KERN_MAXPROC KERN_MAXPROCPERUID KERN_MAXVNODES +KERN_MEMORY_DATA_MOVED +KERN_MEMORY_PRESENT +KERN_MEMORY_RESTART_COPY +KERN_NAME_EXISTS KERN_NETBOOT KERN_NGROUPS KERN_NISDOMAINNAME +KERN_NODE_DOWN +KERN_NOT_DEPRESSED +KERN_NOT_IN_SET +KERN_NOT_RECEIVER +KERN_NOT_SUPPORTED +KERN_NOT_WAITING KERN_NTP_PLL KERN_NX_PROTECTION KERN_OPENEVT_PROC +KERN_OPERATION_TIMED_OUT KERN_OSRELDATE KERN_OSRELEASE KERN_OSREV KERN_OSTYPE KERN_OSVERSION +KERN_POLICY_LIMIT +KERN_POLICY_STATIC KERN_POSIX KERN_POSIX1 KERN_PROC @@ -582,14 +618,21 @@ KERN_PS_STRINGS KERN_RAGEVNODE KERN_RAGE_PROC KERN_RAGE_THREAD +KERN_RIGHT_EXISTS +KERN_RPC_CONTINUE_ORPHAN +KERN_RPC_SERVER_TERMINATED +KERN_RPC_TERMINATE_ORPHAN KERN_SAFEBOOT KERN_SAVED_IDS KERN_SECURELVL +KERN_SEMAPHORE_DESTROYED +KERN_SUCCESS KERN_SHREG_PRIVATIZABLE KERN_SPECULATIVE_READS KERN_SUGID_COREDUMP KERN_SYMFILE KERN_SYSV +KERN_TERMINATED KERN_TFP KERN_TFP_POLICY KERN_TFP_POLICY_DEFAULT @@ -602,6 +645,7 @@ KERN_UNOPENEVT_PROC KERN_UNRAGE_PROC KERN_UNRAGE_THREAD KERN_UPDATEINTERVAL +KERN_UREFS_OVERFLOW KERN_USRSTACK32 KERN_USRSTACK64 KERN_VERSION @@ -1142,6 +1186,24 @@ TCP_MAXSEG TCP_NOOPT TCP_NOPUSH THOUSEP +THREAD_BACKGROUND_POLICY +THREAD_BACKGROUND_POLICY_DARWIN_BG +THREAD_BACKGROUND_POLICY_COUNT +THREAD_AFFINITY_POLICY +THREAD_AFFINITY_POLICY_COUNT +THREAD_AFFINITY_TAG_NULL +THREAD_EXTENDED_POLICY +THREAD_EXTENDED_POLICY_COUNT +THREAD_LATENCY_QOS_POLICY +THREAD_LATENCY_QOS_POLICY_COUNT +THREAD_PRECEDENCE_POLICY +THREAD_PRECEDENCE_POLICY_COUNT +THREAD_STANDARD_POLICY +THREAD_STANDARD_POLICY_COUNT +THREAD_THROUGHPUT_QOS_POLICY +THREAD_THROUGHPUT_QOS_POLICY_COUNT +THREAD_TIME_CONSTRAINT_POLICY +THREAD_TIME_CONSTRAINT_POLICY_COUNT TIME_DEL TIME_ERROR TIME_INS @@ -1597,6 +1659,7 @@ in_pktinfo initgroups integer_t ipc_perm +kern_return_t kevent kevent64 kevent64_s @@ -1614,7 +1677,9 @@ lutimes mach_absolute_time mach_header mach_header_64 +mach_host_self mach_port_t +mach_thread_self mach_timebase_info mach_timebase_info_data_t madvise @@ -1661,6 +1726,10 @@ posix_spawnattr_t posix_spawnp preadv proc_bsdinfo +proc_name +proc_pidinfo +proc_pidfdinfo +proc_pidpath proc_taskallinfo proc_taskinfo proc_threadinfo @@ -1762,6 +1831,8 @@ sysctl sysctlbyname sysctlnametomib telldir +thread_policy_set +thread_policy_get timeval32 timex truncate diff --git a/libc-test/semver/dragonfly.txt b/libc-test/semver/dragonfly.txt index 873acefb1d..5f3e688e22 100644 --- a/libc-test/semver/dragonfly.txt +++ b/libc-test/semver/dragonfly.txt @@ -137,6 +137,10 @@ CMSG_LEN CMSG_NXTHDR CMSG_SPACE CODESET +CPU_CLR +CPU_ISSET +CPU_SET +CPU_ZERO CRNCYSTR CRTSCTS CRTS_IFLOW diff --git a/libc-test/semver/freebsd.txt b/libc-test/semver/freebsd.txt index 6433821b50..b7735db707 100644 --- a/libc-test/semver/freebsd.txt +++ b/libc-test/semver/freebsd.txt @@ -327,6 +327,10 @@ GLOB_NOMATCH GLOB_NOSORT GLOB_NOSPACE H4DISC +HOSTNAME_FOUND +HOSTNAME_INCORRECTNAME +HOSTNAME_INVALIDADDR +HOSTNAME_INVALIDNAME HW_BYTEORDER HW_DISKNAMES HW_DISKSTATS @@ -1551,6 +1555,8 @@ querylocale rand readdir_r readlinkat +realhostname +realhostname_sa recvmmsg recvmsg regcomp diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index c21d15eecc..128e9d9c1c 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1158,6 +1158,7 @@ MS_BIND MS_DIRSYNC MS_I_VERSION MS_KERNMOUNT +MS_LAZYTIME MS_MANDLOCK MS_MGC_MSK MS_MGC_VAL diff --git a/libc-test/semver/macos-aarch64.txt b/libc-test/semver/macos-aarch64.txt new file mode 100644 index 0000000000..1a5fcd2ac3 --- /dev/null +++ b/libc-test/semver/macos-aarch64.txt @@ -0,0 +1,3 @@ +__darwin_arm_exception_state64 +__darwin_arm_neon_state64 +__darwin_arm_thread_state64 diff --git a/libc-test/semver/macos.txt b/libc-test/semver/macos-i686.txt index fb2107cd04..fb2107cd04 100644 --- a/libc-test/semver/macos.txt +++ b/libc-test/semver/macos-i686.txt diff --git a/libc-test/semver/macos-x86_64.txt b/libc-test/semver/macos-x86_64.txt new file mode 100644 index 0000000000..fb2107cd04 --- /dev/null +++ b/libc-test/semver/macos-x86_64.txt @@ -0,0 +1,5 @@ +__darwin_mmst_reg +__darwin_x86_exception_state64 +__darwin_x86_float_state64 +__darwin_x86_thread_state64 +__darwin_xmm_reg diff --git a/libc-test/semver/openbsd.txt b/libc-test/semver/openbsd.txt index 49b7c7d22e..f77196f831 100644 --- a/libc-test/semver/openbsd.txt +++ b/libc-test/semver/openbsd.txt @@ -496,6 +496,11 @@ NFSMNT_WANTRCV NFSMNT_WANTSND NFSMNT_WSIZE NFS_ARGSVERSION +NI_NUMERICHOST +NI_NUMERICSERV +NI_NOFQDN +NI_NAMEREQD +NI_DGRAM NOEXPR NOKERNINFO NOSTR @@ -1071,6 +1076,7 @@ ttyname_r udf_args ufs_args unmount +unveil useconds_t uselocale utimensat diff --git a/libc-test/semver/windows.txt b/libc-test/semver/windows.txt index 6246edce65..eaa7790898 100644 --- a/libc-test/semver/windows.txt +++ b/libc-test/semver/windows.txt @@ -94,16 +94,25 @@ LC_NUMERIC LC_TIME L_tmpnam NSIG +O_RDONLY +O_WRONLY +O_RDWR O_APPEND -O_BINARY O_CREAT +O_TRUNC O_EXCL -O_NOINHERIT -O_RDONLY -O_RDWR O_TEXT -O_TRUNC -O_WRONLY +O_BINARY +_O_WTEXT +_O_U16TEXT +_O_U8TEXT +O_RAW +O_NOINHERIT +O_TEMPORARY +_O_SHORT_LIVED +_O_OBTAIN_DIR +O_SEQUENTIAL +O_RANDOM RAND_MAX SEEK_CUR SEEK_END diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 5efc285dac..7a2f0ed7bb 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -28,6 +28,7 @@ pub type cpu_type_t = integer_t; pub type cpu_subtype_t = integer_t; pub type natural_t = u32; pub type mach_msg_type_number_t = natural_t; +pub type kern_return_t = ::c_int; pub type posix_spawnattr_t = *mut ::c_void; pub type posix_spawn_file_actions_t = *mut ::c_void; @@ -53,6 +54,28 @@ pub type processor_set_load_info_t = *mut processor_set_load_info; pub type processor_info_t = *mut integer_t; pub type processor_info_array_t = *mut integer_t; +pub type thread_t = mach_port_t; +pub type thread_policy_flavor_t = natural_t; +pub type thread_policy_t = *mut integer_t; +pub type thread_latency_qos_t = integer_t; +pub type thread_throughput_qos_t = integer_t; +pub type thread_standard_policy_data_t = thread_standard_policy; +pub type thread_standard_policy_t = *mut thread_standard_policy; +pub type thread_extended_policy_data_t = thread_extended_policy; +pub type thread_extended_policy_t = *mut thread_extended_policy; +pub type thread_time_constraint_policy_data_t = thread_time_constraint_policy; +pub type thread_time_constraint_policy_t = *mut thread_time_constraint_policy; +pub type thread_precedence_policy_data_t = thread_precedence_policy; +pub type thread_precedence_policy_t = *mut thread_precedence_policy; +pub type thread_affinity_policy_data_t = thread_affinity_policy; +pub type thread_affinity_policy_t = *mut thread_affinity_policy; +pub type thread_background_policy_data_t = thread_background_policy; +pub type thread_background_policy_t = *mut thread_background_policy; +pub type thread_latency_qos_policy_data_t = thread_latency_qos_policy; +pub type thread_latency_qos_policy_t = *mut thread_latency_qos_policy; +pub type thread_throughput_qos_policy_data_t = thread_throughput_qos_policy; +pub type thread_throughput_qos_policy_t = *mut thread_throughput_qos_policy; + deprecated_mach! { pub type vm_prot_t = ::c_int; pub type vm_size_t = ::uintptr_t; @@ -570,6 +593,41 @@ s! { pub tai: ::c_long, pub time_state: ::c_int, } + + pub struct thread_standard_policy { + pub no_data: natural_t, + } + + pub struct thread_extended_policy { + pub timeshare: boolean_t, + } + + pub struct thread_time_constraint_policy { + pub period: u32, + pub computation: u32, + pub constraint: u32, + pub preemptible: boolean_t, + } + + pub struct thread_precedence_policy { + pub importance: integer_t, + } + + pub struct thread_affinity_policy { + pub affinity_tag: integer_t, + } + + pub struct thread_background_policy { + pub priority: integer_t, + } + + pub struct thread_latency_qos_policy { + pub thread_latency_qos_tier: thread_latency_qos_t, + } + + pub struct thread_throughput_qos_policy { + pub thread_throughput_qos_tier: thread_throughput_qos_t, + } } s_no_extra_traits! { @@ -2978,6 +3036,59 @@ pub const KERN_PROC_TTY: ::c_int = 4; pub const KERN_PROC_UID: ::c_int = 5; pub const KERN_PROC_RUID: ::c_int = 6; pub const KERN_PROC_LCID: ::c_int = 7; +pub const KERN_SUCCESS: ::c_int = 0; +pub const KERN_INVALID_ADDRESS: ::c_int = 1; +pub const KERN_PROTECTION_FAILURE: ::c_int = 2; +pub const KERN_NO_SPACE: ::c_int = 3; +pub const KERN_INVALID_ARGUMENT: ::c_int = 4; +pub const KERN_FAILURE: ::c_int = 5; +pub const KERN_RESOURCE_SHORTAGE: ::c_int = 6; +pub const KERN_NOT_RECEIVER: ::c_int = 7; +pub const KERN_NO_ACCESS: ::c_int = 8; +pub const KERN_MEMORY_FAILURE: ::c_int = 9; +pub const KERN_MEMORY_ERROR: ::c_int = 10; +pub const KERN_ALREADY_IN_SET: ::c_int = 11; +pub const KERN_NOT_IN_SET: ::c_int = 12; +pub const KERN_NAME_EXISTS: ::c_int = 13; +pub const KERN_ABORTED: ::c_int = 14; +pub const KERN_INVALID_NAME: ::c_int = 15; +pub const KERN_INVALID_TASK: ::c_int = 16; +pub const KERN_INVALID_RIGHT: ::c_int = 17; +pub const KERN_INVALID_VALUE: ::c_int = 18; +pub const KERN_UREFS_OVERFLOW: ::c_int = 19; +pub const KERN_INVALID_CAPABILITY: ::c_int = 20; +pub const KERN_RIGHT_EXISTS: ::c_int = 21; +pub const KERN_INVALID_HOST: ::c_int = 22; +pub const KERN_MEMORY_PRESENT: ::c_int = 23; +pub const KERN_MEMORY_DATA_MOVED: ::c_int = 24; +pub const KERN_MEMORY_RESTART_COPY: ::c_int = 25; +pub const KERN_INVALID_PROCESSOR_SET: ::c_int = 26; +pub const KERN_POLICY_LIMIT: ::c_int = 27; +pub const KERN_INVALID_POLICY: ::c_int = 28; +pub const KERN_INVALID_OBJECT: ::c_int = 29; +pub const KERN_ALREADY_WAITING: ::c_int = 30; +pub const KERN_DEFAULT_SET: ::c_int = 31; +pub const KERN_EXCEPTION_PROTECTED: ::c_int = 32; +pub const KERN_INVALID_LEDGER: ::c_int = 33; +pub const KERN_INVALID_MEMORY_CONTROL: ::c_int = 34; +pub const KERN_INVALID_SECURITY: ::c_int = 35; +pub const KERN_NOT_DEPRESSED: ::c_int = 36; +pub const KERN_TERMINATED: ::c_int = 37; +pub const KERN_LOCK_SET_DESTROYED: ::c_int = 38; +pub const KERN_LOCK_UNSTABLE: ::c_int = 39; +pub const KERN_LOCK_OWNED: ::c_int = 40; +pub const KERN_LOCK_OWNED_SELF: ::c_int = 41; +pub const KERN_SEMAPHORE_DESTROYED: ::c_int = 42; +pub const KERN_RPC_SERVER_TERMINATED: ::c_int = 43; +pub const KERN_RPC_TERMINATE_ORPHAN: ::c_int = 44; +pub const KERN_RPC_CONTINUE_ORPHAN: ::c_int = 45; +pub const KERN_NOT_SUPPORTED: ::c_int = 46; +pub const KERN_NODE_DOWN: ::c_int = 47; +pub const KERN_NOT_WAITING: ::c_int = 48; +pub const KERN_OPERATION_TIMED_OUT: ::c_int = 49; +pub const KERN_CODESIGN_ERROR: ::c_int = 50; +pub const KERN_POLICY_STATIC: ::c_int = 51; +pub const KERN_INSUFFICIENT_BUFFER_SIZE: ::c_int = 52; pub const KIPC_MAXSOCKBUF: ::c_int = 1; pub const KIPC_SOCKBUF_WASTE: ::c_int = 2; pub const KIPC_SOMAXCONN: ::c_int = 3; @@ -3380,6 +3491,19 @@ pub const TIME_ERROR: ::c_int = 5; pub const MNT_WAIT: ::c_int = 1; pub const MNT_NOWAIT: ::c_int = 2; +// <mach/thread_policy.h> +pub const THREAD_STANDARD_POLICY: ::c_int = 1; +pub const THREAD_STANDARD_POLICY_COUNT: ::c_int = 0; +pub const THREAD_EXTENDED_POLICY: ::c_int = 1; +pub const THREAD_TIME_CONSTRAINT_POLICY: ::c_int = 2; +pub const THREAD_PRECEDENCE_POLICY: ::c_int = 3; +pub const THREAD_AFFINITY_POLICY: ::c_int = 4; +pub const THREAD_AFFINITY_TAG_NULL: ::c_int = 0; +pub const THREAD_BACKGROUND_POLICY: ::c_int = 5; +pub const THREAD_BACKGROUND_POLICY_DARWIN_BG: ::c_int = 0x1000; +pub const THREAD_LATENCY_QOS_POLICY: ::c_int = 7; +pub const THREAD_THROUGHPUT_QOS_POLICY: ::c_int = 8; + cfg_if! { if #[cfg(libc_const_extern_fn)] { const fn __DARWIN_ALIGN32(p: usize) -> usize { @@ -3391,11 +3515,39 @@ cfg_if! { const __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1; p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32 } + pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_extended_policy_data_t>() / ::mem::size_of::<integer_t>()) + as mach_msg_type_number_t; + pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_time_constraint_policy_data_t>() / + ::mem::size_of::<integer_t>()) as mach_msg_type_number_t; + pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_precedence_policy_data_t>() / ::mem::size_of::<integer_t>()) + as mach_msg_type_number_t; + pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_affinity_policy_data_t>() / ::mem::size_of::<integer_t>()) + as mach_msg_type_number_t; + pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_background_policy_data_t>() / ::mem::size_of::<integer_t>()) + as mach_msg_type_number_t; + pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_latency_qos_policy_data_t>() / ::mem::size_of::<integer_t>()) + as mach_msg_type_number_t; + pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t = + (::mem::size_of::<thread_throughput_qos_policy_data_t>() / + ::mem::size_of::<integer_t>()) as mach_msg_type_number_t; } else { fn __DARWIN_ALIGN32(p: usize) -> usize { let __DARWIN_ALIGNBYTES32: usize = ::mem::size_of::<u32>() - 1; p + __DARWIN_ALIGNBYTES32 & !__DARWIN_ALIGNBYTES32 } + pub const THREAD_EXTENDED_POLICY_COUNT: mach_msg_type_number_t = 1; + pub const THREAD_TIME_CONSTRAINT_POLICY_COUNT: mach_msg_type_number_t = 4; + pub const THREAD_PRECEDENCE_POLICY_COUNT: mach_msg_type_number_t = 1; + pub const THREAD_AFFINITY_POLICY_COUNT: mach_msg_type_number_t = 1; + pub const THREAD_BACKGROUND_POLICY_COUNT: mach_msg_type_number_t = 1; + pub const THREAD_LATENCY_QOS_POLICY_COUNT: mach_msg_type_number_t = 1; + pub const THREAD_THROUGHPUT_QOS_POLICY_COUNT: mach_msg_type_number_t = 1; } } @@ -3563,6 +3715,8 @@ extern "C" { #[deprecated(since = "0.2.55", note = "Use the mach crate")] #[allow(deprecated)] pub fn mach_timebase_info(info: *mut ::mach_timebase_info) -> ::c_int; + pub fn mach_host_self() -> mach_port_t; + pub fn mach_thread_self() -> mach_port_t; pub fn pthread_setname_np(name: *const ::c_char) -> ::c_int; pub fn pthread_getname_np(thread: ::pthread_t, name: *mut ::c_char, len: ::size_t) -> ::c_int; pub fn pthread_from_mach_thread_np(port: ::mach_port_t) -> ::pthread_t; @@ -3603,6 +3757,19 @@ extern "C" { class: *mut qos_class_t, priority: *mut ::c_int, ) -> ::c_int; + pub fn thread_policy_set( + thread: thread_t, + flavor: thread_policy_flavor_t, + policy_info: thread_policy_t, + count: mach_msg_type_number_t, + ) -> kern_return_t; + pub fn thread_policy_get( + thread: thread_t, + flavor: thread_policy_flavor_t, + policy_info: thread_policy_t, + count: *mut mach_msg_type_number_t, + get_default: *mut boolean_t, + ) -> kern_return_t; pub fn __error() -> *mut ::c_int; pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int; #[cfg_attr( @@ -3882,6 +4049,22 @@ extern "C" { // Added in macOS 10.13 // ISO/IEC 9899:2011 ("ISO C11") K.3.7.4.1 pub fn memset_s(s: *mut ::c_void, smax: ::size_t, c: ::c_int, n: ::size_t) -> ::c_int; + pub fn proc_pidinfo( + pid: ::c_int, + flavor: ::c_int, + arg: u64, + buffer: *mut ::c_void, + buffersize: ::c_int, + ) -> ::c_int; + pub fn proc_pidfdinfo( + pid: ::c_int, + fd: ::c_int, + flavor: ::c_int, + buffer: *mut ::c_void, + buffersize: ::c_int, + ) -> ::c_int; + pub fn proc_pidpath(pid: ::c_int, buffer: *mut ::c_void, buffersize: u32) -> ::c_int; + pub fn proc_name(pid: ::c_int, buffer: *mut ::c_void, buffersize: u32) -> ::c_int; } #[link(name = "iconv")] diff --git a/src/unix/bsd/freebsdlike/dragonfly/mod.rs b/src/unix/bsd/freebsdlike/dragonfly/mod.rs index 60ab2188c4..71529421ea 100644 --- a/src/unix/bsd/freebsdlike/dragonfly/mod.rs +++ b/src/unix/bsd/freebsdlike/dragonfly/mod.rs @@ -22,6 +22,9 @@ pub type idtype_t = ::c_uint; pub type mqd_t = ::c_int; pub type sem_t = *mut sem; +pub type cpuset_t = cpumask_t; +pub type cpu_set_t = cpumask_t; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum sem {} impl ::Copy for sem {} @@ -184,6 +187,10 @@ s! { pub ss_size: ::size_t, pub ss_flags: ::c_int, } + + pub struct cpumask_t { + ary: [u64; 4], + } } s_no_extra_traits! { @@ -1056,6 +1063,29 @@ f! { (_CMSG_ALIGN(::mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)) as ::c_uint } + + pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { + for slot in cpuset.ary.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); + cpuset.ary[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () { + let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); + cpuset.ary[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &mut cpu_set_t) -> bool { + let (idx, offset) = ((cpu >> 6) & 3, cpu & 63); + 0 != cpuset.ary[idx] & (1 << offset) + } } safe_f! { @@ -1098,6 +1128,9 @@ extern "C" { needle: *const ::c_void, needlelen: ::size_t, ) -> *mut ::c_void; + pub fn sched_getaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *mut cpu_set_t) -> ::c_int; + pub fn sched_setaffinity(pid: ::pid_t, cpusetsize: ::size_t, mask: *const cpu_set_t) + -> ::c_int; } #[link(name = "rt")] diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs index 30fc886949..36e0d51441 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs @@ -227,6 +227,7 @@ 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 elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs index 1753583b46..8cb475d9b1 100644 --- a/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs @@ -231,6 +231,8 @@ 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; } cfg_if! { diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index c2cc6d7430..9a64dc39fd 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -14,6 +14,9 @@ pub type key_t = ::c_long; pub type msglen_t = ::c_ulong; pub type msgqnum_t = ::c_ulong; +pub type cpulevel_t = ::c_int; +pub type cpuwhich_t = ::c_int; + pub type mqd_t = *mut ::c_void; pub type posix_spawnattr_t = *mut ::c_void; pub type posix_spawn_file_actions_t = *mut ::c_void; @@ -121,6 +124,17 @@ s! { pub pve_fsid: u32, pub pve_path: *mut ::c_char, } + + pub struct cpuset_t { + #[cfg(target_pointer_width = "64")] + __bits: [::c_long; 4], + #[cfg(target_pointer_width = "32")] + __bits: [::c_long; 8], + } + + pub struct cap_rights_t { + cr_rights: [u64; 2], + } } s_no_extra_traits! { @@ -1214,6 +1228,12 @@ pub const F_READAHEAD: ::c_int = 15; pub const F_RDAHEAD: ::c_int = 16; pub const F_DUP2FD_CLOEXEC: ::c_int = 18; +// For realhostname* api +pub const HOSTNAME_FOUND: ::c_int = 0; +pub const HOSTNAME_INCORRECTNAME: ::c_int = 1; +pub const HOSTNAME_INVALIDADDR: ::c_int = 2; +pub const HOSTNAME_INVALIDNAME: ::c_int = 3; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -1265,6 +1285,38 @@ f! { pub fn uname(buf: *mut ::utsname) -> ::c_int { __xuname(256, buf as *mut ::c_void) } + + pub fn CPU_ZERO(cpuset: &mut cpuset_t) -> () { + for slot in cpuset.__bits.iter_mut() { + *slot = 0; + } + } + + pub fn CPU_FILL(cpuset: &mut cpuset_t) -> () { + for slot in cpuset.__bits.iter_mut() { + *slot = !0; + } + } + + pub fn CPU_SET(cpu: usize, cpuset: &mut cpuset_t) -> () { + let bitset_bits = ::mem::size_of::<::c_long>(); + let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); + cpuset.__bits[idx] |= 1 << offset; + () + } + + pub fn CPU_CLR(cpu: usize, cpuset: &mut cpuset_t) -> () { + let bitset_bits = ::mem::size_of::<::c_long>(); + let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); + cpuset.__bits[idx] &= !(1 << offset); + () + } + + pub fn CPU_ISSET(cpu: usize, cpuset: &mut cpuset_t) -> bool { + let bitset_bits = ::mem::size_of::<::c_long>(); + let (idx, offset) = (cpu / bitset_bits, cpu % bitset_bits); + 0 != cpuset.__bits[idx] & (1 << offset) + } } safe_f! { @@ -1527,6 +1579,33 @@ extern "C" { ) -> *mut ::c_void; pub fn nmount(iov: *mut ::iovec, niov: ::c_uint, flags: ::c_int) -> ::c_int; + pub fn cpuset_getaffinity( + level: cpulevel_t, + which: cpuwhich_t, + id: ::id_t, + setsize: ::size_t, + mask: *mut cpuset_t, + ) -> ::c_int; + pub fn cpuset_setaffinity( + level: cpulevel_t, + which: cpuwhich_t, + id: ::id_t, + setsize: ::size_t, + mask: *const cpuset_t, + ) -> ::c_int; + pub fn cap_enter() -> ::c_int; + pub fn cap_getmode(modep: *mut ::c_uint) -> ::c_int; + pub fn __cap_rights_init(version: ::c_int, rights: *mut cap_rights_t, ...) + -> *mut cap_rights_t; + pub fn __cap_rights_set(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t; + pub fn __cap_rights_clear(rights: *mut cap_rights_t, ...) -> *mut cap_rights_t; + pub fn __cap_rights_is_set(rights: *const cap_rights_t, ...) -> bool; + pub fn cap_rights_is_valid(rights: *const cap_rights_t) -> bool; + pub fn cap_rights_limit(fd: ::c_int, rights: *const cap_rights_t) -> ::c_int; + pub fn cap_rights_merge(dst: *mut cap_rights_t, src: *const cap_rights_t) -> *mut cap_rights_t; + pub fn cap_rights_remove(dst: *mut cap_rights_t, src: *const cap_rights_t) + -> *mut cap_rights_t; + pub fn cap_rights_contains(big: *const cap_rights_t, little: *const cap_rights_t) -> bool; } #[link(name = "util")] @@ -1539,6 +1618,13 @@ extern "C" { string: *const ::c_char, attrnamespace: *mut ::c_int, ) -> ::c_int; + pub fn realhostname(host: *mut ::c_char, hsize: ::size_t, ip: *const ::in_addr) -> ::c_int; + pub fn realhostname_sa( + host: *mut ::c_char, + hsize: ::size_t, + addr: *mut ::sockaddr, + addrlen: ::c_int, + ) -> ::c_int; } cfg_if! { diff --git a/src/unix/bsd/netbsdlike/mod.rs b/src/unix/bsd/netbsdlike/mod.rs index 0eab40c0bc..7e7269fcff 100644 --- a/src/unix/bsd/netbsdlike/mod.rs +++ b/src/unix/bsd/netbsdlike/mod.rs @@ -72,8 +72,14 @@ s! { pub uid: ::uid_t, pub gid: ::gid_t, pub mode: ::mode_t, + #[cfg(target_os = "openbsd")] pub seq: ::c_ushort, + #[cfg(target_os = "netbsd")] + pub _seq: ::c_ushort, + #[cfg(target_os = "openbsd")] pub key: ::key_t, + #[cfg(target_os = "netbsd")] + pub _key: ::key_t, } pub struct ptrace_io_desc { diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index a4f4148d06..f2fc288be3 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -7,7 +7,7 @@ pub type fsfilcnt_t = u64; pub type idtype_t = ::c_int; pub type mqd_t = ::c_int; type __pthread_spin_t = __cpu_simple_lock_nv_t; -pub type vm_size_t = ::uintptr_t; +pub type vm_size_t = ::uintptr_t; // FIXME: deprecated since long time pub type lwpid_t = ::c_uint; pub type shmatt_t = ::c_uint; @@ -403,6 +403,16 @@ s! { pub p_align: Elf64_Xword, } + pub struct Aux32Info { + pub a_type: Elf32_Word, + pub a_v: Elf32_Word, + } + + pub struct Aux64Info { + pub a_type: Elf64_Word, + pub a_v: Elf64_Xword, + } + // link.h pub struct dl_phdr_info { @@ -427,7 +437,7 @@ s_no_extra_traits! { pub ut_session: u16, pub ut_type: u16, pub ut_pid: ::pid_t, - pub ut_exit: __exit_status, + pub ut_exit: __exit_status, // FIXME: when anonymous struct are supported pub ut_ss: sockaddr_storage, pub ut_tv: ::timeval, pub ut_pad: [u8; _UTX_PADSIZE], @@ -2074,6 +2084,10 @@ extern "C" { data: *mut ::c_void, ) -> ::c_int; + // dlfcn.h + + pub fn _dlauxinfo() -> *mut ::c_void; + pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t; pub fn iconv( cd: iconv_t, diff --git a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs index 0860d4f6c7..2f6e445457 100644 --- a/src/unix/bsd/netbsdlike/netbsd/x86_64.rs +++ b/src/unix/bsd/netbsdlike/netbsd/x86_64.rs @@ -3,8 +3,25 @@ use PT_FIRSTMACH; pub type c_long = i64; pub type c_ulong = u64; pub type c_char = i8; +pub type c___greg_t = u64; pub type __cpu_simple_lock_nv_t = ::c_uchar; +s! { + pub struct mcontext_t { + pub __gregs: [c___greg_t; 26], + pub _mc_tlsbase: c___greg_t, + pub __fpregs: [[::c_char;32]; 16], + } + + pub struct ucontext_t { + pub uc_flags: ::c_uint, + pub uc_link: *mut ::ucontext_t, + pub uc_sigmask: ::sigset_t, + pub uc_stack: ::stack_t, + pub uc_mcontext: ::mcontext_t, + } +} + // should be pub(crate), but that requires Rust 1.18.0 cfg_if! { if #[cfg(libc_const_size_of)] { diff --git a/src/unix/bsd/netbsdlike/openbsd/mod.rs b/src/unix/bsd/netbsdlike/openbsd/mod.rs index cd44d85311..803ceac5b8 100644 --- a/src/unix/bsd/netbsdlike/openbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/openbsd/mod.rs @@ -936,6 +936,10 @@ pub const NET_RT_STATS: ::c_int = 4; pub const NET_RT_TABLE: ::c_int = 5; pub const NET_RT_IFNAMES: ::c_int = 6; #[doc(hidden)] +#[deprecated( + since = "0.2.95", + note = "Possibly increasing over the releases and might not be so used in the field" +)] pub const NET_RT_MAXID: ::c_int = 7; pub const IPV6_JOIN_GROUP: ::c_int = 12; @@ -1160,6 +1164,12 @@ pub const NOTE_CHILD: u32 = 0x00000004; pub const TMP_MAX: ::c_uint = 0x7fffffff; +pub const NI_NUMERICHOST: ::c_int = 1; +pub const NI_NUMERICSERV: ::c_int = 2; +pub const NI_NOFQDN: ::c_int = 4; +pub const NI_NAMEREQD: ::c_int = 8; +pub const NI_DGRAM: ::c_int = 16; + pub const NI_MAXHOST: ::size_t = 256; pub const RTLD_LOCAL: ::c_int = 0; @@ -1266,6 +1276,10 @@ pub const KERN_AUDIO: ::c_int = 84; pub const KERN_CPUSTATS: ::c_int = 85; pub const KERN_PFSTATUS: ::c_int = 86; pub const KERN_TIMEOUT_STATS: ::c_int = 87; +#[deprecated( + since = "0.2.95", + note = "Possibly increasing over the releases and might not be so used in the field" +)] pub const KERN_MAXID: ::c_int = 88; pub const KERN_PROC_ALL: ::c_int = 0; @@ -1465,6 +1479,7 @@ extern "C" { envp: *const *const ::c_char, ) -> ::c_int; pub fn pledge(promises: *const ::c_char, execpromises: *const ::c_char) -> ::c_int; + pub fn unveil(path: *const ::c_char, permissions: *const ::c_char) -> ::c_int; pub fn strtonum( nptr: *const ::c_char, minval: ::c_longlong, diff --git a/src/unix/haiku/native.rs b/src/unix/haiku/native.rs index a3c70e883f..5a37c68241 100644 --- a/src/unix/haiku/native.rs +++ b/src/unix/haiku/native.rs @@ -61,6 +61,12 @@ e! { B_ADD_ON_IMAGE, B_SYSTEM_IMAGE } + + // kernel/scheduler.h + pub enum schduler_mode { + SCHEDULER_MODE_LOW_LATENCY, + SCHEDULER_MODE_POWER_SAVING, + } } s! { @@ -744,6 +750,9 @@ extern "C" { pub fn find_thread(name: *const ::c_char) -> thread_id; + pub fn get_scheduler_mode() -> i32; + pub fn set_scheduler_mode(mode: i32) -> status_t; + pub fn send_data( thread: thread_id, code: i32, diff --git a/src/unix/linux_like/android/b32/mod.rs b/src/unix/linux_like/android/b32/mod.rs index 774690704e..fc4b3f150f 100644 --- a/src/unix/linux_like/android/b32/mod.rs +++ b/src/unix/linux_like/android/b32/mod.rs @@ -27,7 +27,7 @@ s! { __pad0: [::c_uchar; 4], __st_ino: ::ino_t, pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, + pub st_nlink: ::nlink_t, pub st_uid: ::uid_t, pub st_gid: ::gid_t, pub st_rdev: ::c_ulonglong, @@ -49,7 +49,7 @@ s! { __pad0: [::c_uchar; 4], __st_ino: ::ino_t, pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, + pub st_nlink: ::nlink_t, pub st_uid: ::uid_t, pub st_gid: ::gid_t, pub st_rdev: ::c_ulonglong, diff --git a/src/unix/linux_like/android/b64/aarch64/mod.rs b/src/unix/linux_like/android/b64/aarch64/mod.rs index 5acb328be9..4912ff5d8e 100644 --- a/src/unix/linux_like/android/b64/aarch64/mod.rs +++ b/src/unix/linux_like/android/b64/aarch64/mod.rs @@ -6,7 +6,7 @@ s! { pub st_dev: ::dev_t, pub st_ino: ::ino_t, pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, + pub st_nlink: ::nlink_t, pub st_uid: ::uid_t, pub st_gid: ::gid_t, pub st_rdev: ::dev_t, @@ -29,7 +29,7 @@ s! { pub st_dev: ::dev_t, pub st_ino: ::ino_t, pub st_mode: ::c_uint, - pub st_nlink: ::c_uint, + pub st_nlink: ::nlink_t, pub st_uid: ::uid_t, pub st_gid: ::gid_t, pub st_rdev: ::dev_t, diff --git a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs index 6e8fee41b1..73162c94ad 100644 --- a/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs @@ -160,6 +160,40 @@ pub const ENOTRECOVERABLE: ::c_int = 131; pub const ERFKILL: ::c_int = 132; pub const EHWPOISON: ::c_int = 133; +// bits/hwcap.h +pub const HWCAP_FP: ::c_ulong = 1 << 0; +pub const HWCAP_ASIMD: ::c_ulong = 1 << 1; +pub const HWCAP_EVTSTRM: ::c_ulong = 1 << 2; +pub const HWCAP_AES: ::c_ulong = 1 << 3; +pub const HWCAP_PMULL: ::c_ulong = 1 << 4; +pub const HWCAP_SHA1: ::c_ulong = 1 << 5; +pub const HWCAP_SHA2: ::c_ulong = 1 << 6; +pub const HWCAP_CRC32: ::c_ulong = 1 << 7; +pub const HWCAP_ATOMICS: ::c_ulong = 1 << 8; +pub const HWCAP_FPHP: ::c_ulong = 1 << 9; +pub const HWCAP_ASIMDHP: ::c_ulong = 1 << 10; +pub const HWCAP_CPUID: ::c_ulong = 1 << 11; +pub const HWCAP_ASIMDRDM: ::c_ulong = 1 << 12; +pub const HWCAP_JSCVT: ::c_ulong = 1 << 13; +pub const HWCAP_FCMA: ::c_ulong = 1 << 14; +pub const HWCAP_LRCPC: ::c_ulong = 1 << 15; +pub const HWCAP_DCPOP: ::c_ulong = 1 << 16; +pub const HWCAP_SHA3: ::c_ulong = 1 << 17; +pub const HWCAP_SM3: ::c_ulong = 1 << 18; +pub const HWCAP_SM4: ::c_ulong = 1 << 19; +pub const HWCAP_ASIMDDP: ::c_ulong = 1 << 20; +pub const HWCAP_SHA512: ::c_ulong = 1 << 21; +pub const HWCAP_SVE: ::c_ulong = 1 << 22; +pub const HWCAP_ASIMDFHM: ::c_ulong = 1 << 23; +pub const HWCAP_DIT: ::c_ulong = 1 << 24; +pub const HWCAP_USCAT: ::c_ulong = 1 << 25; +pub const HWCAP_ILRCPC: ::c_ulong = 1 << 26; +pub const HWCAP_FLAGM: ::c_ulong = 1 << 27; +pub const HWCAP_SSBS: ::c_ulong = 1 << 28; +pub const HWCAP_SB: ::c_ulong = 1 << 29; +pub const HWCAP_PACA: ::c_ulong = 1 << 30; +pub const HWCAP_PACG: ::c_ulong = 1 << 31; + pub const MAP_ANON: ::c_int = 0x0020; pub const MAP_GROWSDOWN: ::c_int = 0x0100; pub const MAP_DENYWRITE: ::c_int = 0x0800; diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index bf66fe72b0..4a6d377a3a 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -602,6 +602,7 @@ pub const MS_RELATIME: ::c_ulong = 0x200000; pub const MS_KERNMOUNT: ::c_ulong = 0x400000; pub const MS_I_VERSION: ::c_ulong = 0x800000; pub const MS_STRICTATIME: ::c_ulong = 0x1000000; +pub const MS_LAZYTIME: ::c_ulong = 0x2000000; pub const MS_ACTIVE: ::c_ulong = 0x40000000; pub const MS_MGC_VAL: ::c_ulong = 0xc0ed0000; pub const MS_MGC_MSK: ::c_ulong = 0xffff0000; diff --git a/src/windows/mod.rs b/src/windows/mod.rs index f64aa2f971..377a6c75f9 100644 --- a/src/windows/mod.rs +++ b/src/windows/mod.rs @@ -117,16 +117,27 @@ pub const BUFSIZ: ::c_uint = 512; pub const FOPEN_MAX: ::c_uint = 20; pub const FILENAME_MAX: ::c_uint = 260; -pub const O_RDONLY: ::c_int = 0; -pub const O_WRONLY: ::c_int = 1; -pub const O_RDWR: ::c_int = 2; -pub const O_APPEND: ::c_int = 8; -pub const O_CREAT: ::c_int = 256; -pub const O_EXCL: ::c_int = 1024; -pub const O_TEXT: ::c_int = 16384; -pub const O_BINARY: ::c_int = 32768; -pub const O_NOINHERIT: ::c_int = 128; -pub const O_TRUNC: ::c_int = 512; +// fcntl.h +pub const O_RDONLY: ::c_int = 0x0000; +pub const O_WRONLY: ::c_int = 0x0001; +pub const O_RDWR: ::c_int = 0x0002; +pub const O_APPEND: ::c_int = 0x0008; +pub const O_CREAT: ::c_int = 0x0100; +pub const O_TRUNC: ::c_int = 0x0200; +pub const O_EXCL: ::c_int = 0x0400; +pub const O_TEXT: ::c_int = 0x4000; +pub const O_BINARY: ::c_int = 0x8000; +pub const _O_WTEXT: ::c_int = 0x10000; +pub const _O_U16TEXT: ::c_int = 0x20000; +pub const _O_U8TEXT: ::c_int = 0x40000; +pub const O_RAW: ::c_int = O_BINARY; +pub const O_NOINHERIT: ::c_int = 0x0080; +pub const O_TEMPORARY: ::c_int = 0x0040; +pub const _O_SHORT_LIVED: ::c_int = 0x1000; +pub const _O_OBTAIN_DIR: ::c_int = 0x2000; +pub const O_SEQUENTIAL: ::c_int = 0x0020; +pub const O_RANDOM: ::c_int = 0x0010; + pub const S_IFCHR: ::c_int = 8192; pub const S_IFDIR: ::c_int = 16384; pub const S_IFREG: ::c_int = 32768; |