diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5609e136663a7..fe37151bccba3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,8 +7,12 @@ on: - libc-0.2 env: + CARGO_TERM_COLOR: always CARGO_TERM_VERBOSE: true LIBC_CI: 1 + RUSTDOCFLAGS: -Dwarnings + RUSTFLAGS: -Dwarnings + RUST_BACKTRACE: full defaults: run: @@ -42,6 +46,12 @@ jobs: TOOLCHAIN: ${{ matrix.toolchain }} steps: - uses: actions/checkout@v4 + # Remove `-Dwarnings` at the MSRV since lints may be different or buffier + - name: Update RUSTFLAGS + run: | + set -eux + [ "${{ matrix.toolchain }}" = "1.63.0" ] && echo 'RUSTFLAGS=' >> "$GITHUB_ENV" || true + - name: Setup Rust toolchain run: ./ci/install-rust.sh diff --git a/ci/docker/loongarch64-unknown-linux-musl/Dockerfile b/ci/docker/loongarch64-unknown-linux-musl/Dockerfile index f4a23a6666c8a..0b3ff4da34ba0 100644 --- a/ci/docker/loongarch64-unknown-linux-musl/Dockerfile +++ b/ci/docker/loongarch64-unknown-linux-musl/Dockerfile @@ -1,14 +1,16 @@ FROM ubuntu:24.10 RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates curl gcc git libc6-dev make qemu-user xz-utils + ca-certificates curl gcc gcc-14-loongarch64-linux-gnu git libc6-dev \ + make qemu-user xz-utils patch rsync -COPY install-musl-cross.sh / -RUN /install-musl-cross.sh loongarch64-unknown-linux-musl +COPY install-musl.sh / +RUN /install-musl.sh loongarch64 -ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc \ +ENV CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc \ CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER="qemu-loongarch64" \ - CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc \ + CC_loongarch64_unknown_linux_musl=musl-gcc \ CFLAGS_loongarch64_unknown_linux_musl="-mabi=lp64d -fPIC" \ - QEMU_LD_PREFIX=/loongarch64-unknown-linux-musl/loongarch64-unknown-linux-musl/sysroot \ - PATH=$PATH:/loongarch64-unknown-linux-musl/bin:/rust/bin + RUSTFLAGS="-Ctarget-feature=+crt-static" \ + QEMU_LD_PREFIX=/musl-loongarch64 \ + PATH=$PATH:/musl-loongarch64/bin:/rust/bin diff --git a/ci/install-musl-cross.sh b/ci/install-musl-cross.sh deleted file mode 100755 index 38381dc9bd6bf..0000000000000 --- a/ci/install-musl-cross.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# Install musl cross toolchain - -set -ex - -MUSL_CROSS_VER=20241103 -MUSL_CROSS_URL=https://github.com/musl-cross/musl-cross/releases/download/$MUSL_CROSS_VER/$1.tar.xz - -curl -L --retry 5 "$MUSL_CROSS_URL" | tar -xJf - -C / diff --git a/ci/install-musl.sh b/ci/install-musl.sh index 1cf1ec6500cde..416874d916f3e 100755 --- a/ci/install-musl.sh +++ b/ci/install-musl.sh @@ -5,7 +5,15 @@ set -eux -musl_version=1.1.24 +case ${1} in + loongarch64) + musl_version=1.2.5 + ;; + *) + musl_version=1.1.24 + ;; +esac + musl="musl-${musl_version}" # Download, configure, build, and install musl: @@ -53,6 +61,13 @@ case ${1} in ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes make install -j4 ;; + loongarch64) + musl_arch=loongarch64 + kernel_arch=loongarch + CC=loongarch64-linux-gnu-gcc-14 \ + ./configure --prefix="/musl-${musl_arch}" --enable-wrapper=yes + make install -j4 + ;; *) echo "Unknown target arch: \"${1}\"" exit 1 diff --git a/libc-test/Cargo.toml b/libc-test/Cargo.toml index 2f32e12bb3755..26b38621fb3c8 100644 --- a/libc-test/Cargo.toml +++ b/libc-test/Cargo.toml @@ -12,10 +12,9 @@ description = """ A test crate for the libc crate. """ -[dependencies.libc] -path = ".." -version = "0.2.171" -default-features = false +[dependencies] +cfg-if = "1.0.0" +libc = { path = "..", version = "0.2.171", default-features = false } [dev-dependencies] syn = { version = "2.0.91", features = ["full", "visit"] } diff --git a/libc-test/build.rs b/libc-test/build.rs index 3fedeb412aa12..3824ac28592c7 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -13,7 +13,7 @@ fn src_hotfix_dir() -> PathBuf { fn do_cc() { let target = env::var("TARGET").unwrap(); - if cfg!(unix) { + if cfg!(unix) || target.contains("cygwin") { let exclude = ["redox", "wasi", "wali"]; if !exclude.iter().any(|x| target.contains(x)) { let mut cmsg = cc::Build::new(); @@ -700,6 +700,7 @@ fn test_cygwin(target: &str) { "dlfcn.h", "errno.h", "fcntl.h", + "fnmatch.h", "grp.h", "iconv.h", "langinfo.h", @@ -710,11 +711,13 @@ fn test_cygwin(target: &str) { "netinet/tcp.h", "poll.h", "pthread.h", + "pty.h", "pwd.h", "resolv.h", "sched.h", "semaphore.h", "signal.h", + "spawn.h", "stddef.h", "stdlib.h", "string.h", @@ -734,6 +737,7 @@ fn test_cygwin(target: &str) { "sys/uio.h", "sys/un.h", "sys/utsname.h", + "sys/vfs.h", "syslog.h", "termios.h", "unistd.h", @@ -853,7 +857,7 @@ fn test_cygwin(target: &str) { } }); - cfg.generate("../src/lib.rs", "main.rs"); + cfg.generate(src_hotfix_dir().join("lib.rs"), "main.rs"); } fn test_windows(target: &str) { @@ -1049,6 +1053,13 @@ fn test_solarish(target: &str) { cfg.define("__EXTENSIONS__", None); cfg.define("_LCONV_C99", None); + // FIXME(solaris): This should be removed once new Nix crate is released. + // See comment in src/unix/solarish/solaris.rs for these. + if is_solaris { + cfg.define("O_DIRECT", Some("0x2000000")); + cfg.define("SIGINFO", Some("41")); + } + headers! { cfg: "aio.h", @@ -1307,6 +1318,10 @@ fn test_solarish(target: &str) { // https://github.com/gnzlbg/ctest/issues/68 "lio_listio" => true, + // Exists on illumos too but, for now, is + // [a recent addition](https://www.illumos.org/issues/17094). + "secure_getenv" if is_illumos => true, + _ => false, } }); @@ -4136,8 +4151,7 @@ fn test_linux(target: &str) { "epoll_params" => true, // FIXME(linux): Requires >= 6.12 kernel headers. - "dmabuf_cmsg" | - "dmabuf_token" => true, + "dmabuf_cmsg" | "dmabuf_token" => true, _ => false, } diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 983d0e6d521a2..34875722a8432 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -1793,8 +1793,11 @@ NLMSG_MIN_TYPE NLMSG_NOOP NLMSG_OVERRUN NLM_F_ACK +NLM_F_ACK_TLVS NLM_F_APPEND NLM_F_ATOMIC +NLM_F_BULK +NLM_F_CAPPED NLM_F_CREATE NLM_F_DUMP NLM_F_DUMP_FILTERED @@ -1803,6 +1806,7 @@ NLM_F_ECHO NLM_F_EXCL NLM_F_MATCH NLM_F_MULTI +NLM_F_NONREC NLM_F_REPLACE NLM_F_REQUEST NLM_F_ROOT @@ -2222,10 +2226,16 @@ SCM_CREDENTIALS SCM_RIGHTS SCM_TIMESTAMP SCM_TIMESTAMPING +SECCOMP_ADDFD_FLAG_SEND +SECCOMP_ADDFD_FLAG_SETFD SECCOMP_FILTER_FLAG_LOG SECCOMP_FILTER_FLAG_NEW_LISTENER SECCOMP_FILTER_FLAG_SPEC_ALLOW SECCOMP_FILTER_FLAG_TSYNC +SECCOMP_FILTER_FLAG_TSYNC_ESRCH +SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV +SECCOMP_GET_ACTION_AVAIL +SECCOMP_GET_NOTIF_SIZES SECCOMP_MODE_DISABLED SECCOMP_MODE_FILTER SECCOMP_MODE_STRICT @@ -2241,6 +2251,9 @@ SECCOMP_RET_LOG SECCOMP_RET_TRACE SECCOMP_RET_TRAP SECCOMP_RET_USER_NOTIF +SECCOMP_SET_MODE_FILTER +SECCOMP_SET_MODE_STRICT +SECCOMP_USER_NOTIF_FLAG_CONTINUE SEEK_CUR SEEK_DATA SEEK_END @@ -3325,6 +3338,7 @@ fwrite_unlocked gai_strerror genlmsghdr getaddrinfo +getauxval getchar getchar_unlocked getcwd diff --git a/libc-test/semver/cygwin.txt b/libc-test/semver/cygwin.txt index 0c953574c0ad6..2b0b827674fdf 100644 --- a/libc-test/semver/cygwin.txt +++ b/libc-test/semver/cygwin.txt @@ -1,5 +1,262 @@ +AF_APPLETALK +AF_CCITT +AF_CHAOS +AF_DATAKIT +AF_DECnet +AF_DLI +AF_ECMA +AF_HYLINK +AF_IMPLINK +AF_ISO +AF_LAT +AF_LOCAL +AF_NETBIOS +AF_NS +AF_OSI +AF_PUP +AF_SNA +AI_ADDRCONFIG +AI_ALL +AI_CANONNAME +AI_NUMERICHOST +AI_NUMERICSERV +AI_PASSIVE +AI_V4MAPPED +ARG_MAX +AT_EACCESS +AT_EMPTY_PATH +AT_FDCWD +AT_REMOVEDIR +AT_SYMLINK_FOLLOW +AT_SYMLINK_NOFOLLOW +B1000000 +B1152000 +B1500000 +B2000000 +B2500000 +B3000000 +B460800 +B500000 +B576000 +B921600 +BIG_ENDIAN +BS0 +BS1 +BSDLY +BUFSIZ +BUS_ADRALN +BUS_ADRERR +BUS_OBJERR +CBAUD +CBAUDEX +CHILD_MAX +CLD_CONTINUED +CLD_DUMPED +CLD_EXITED +CLD_KILLED +CLD_STOPPED +CLD_TRAPPED +CLOCK_BOOTTIME +CLOCK_BOOTTIME_ALARM +CLOCK_MONOTONIC_COARSE +CLOCK_MONOTONIC_RAW +CLOCK_PROCESS_CPUTIME_ID +CLOCK_REALTIME_ALARM +CLOCK_REALTIME_COARSE +CLOCK_THREAD_CPUTIME_ID +CMSPAR +CPU_SETSIZE +CR0 +CR1 +CR2 +CR3 +CRDLY +CRTSCTS +EADV +EAI_AGAIN +EAI_BADFLAGS +EAI_FAIL +EAI_FAMILY +EAI_MEMORY +EAI_NODATA +EAI_NONAME +EAI_OVERFLOW +EAI_SERVICE +EAI_SOCKTYPE +EBADE +EBADFD +EBADR +EBADRQC +EBADSLT +EBFONT +ECHOCTL +ECHOKE +ECHRNG +ECOMM +EDEADLOCK +EDOTDOT +EFTYPE +EL2HLT +EL2NSYNC +EL3HLT +EL3RST +ELIBACC +ELIBBAD +ELIBEXEC +ELIBMAX +ELIBSCN +ELNRNG +EMULTIHOP +ENOANO +ENOCSI +ENODATA +ENOLINK +ENOMEDIUM +ENONET +ENOPKG +ENOSR +ENOSTR +ENOTRECOVERABLE +ENOTSUP +ENOTUNIQ +EOWNERDEAD +EPROCLIM +EREMCHG +EREMOTE +ESOCKTNOSUPPORT +ESRMNT +ESTRPIPE +ETIME +ETOOMANYREFS +EUNATCH +EUSERS +EXFULL +FALLOC_FL_COLLAPSE_RANGE +FALLOC_FL_INSERT_RANGE +FALLOC_FL_KEEP_SIZE +FALLOC_FL_PUNCH_HOLE +FALLOC_FL_UNSHARE_RANGE +FALLOC_FL_ZERO_RANGE +FF0 +FF1 +FFDLY +FIOASYNC +FIONREAD +FLUSHO FORK_NO_RELOAD FORK_RELOAD +F_CNVT +F_GETOWN +F_LOCK +F_RDLCK +F_RGETLK +F_RSETLK +F_RSETLKW +F_SETOWN +F_TEST +F_TLOCK +F_ULOCK +F_UNLCK +F_WRLCK +GRND_NONBLOCK +GRND_RANDOM +IFF_BROADCAST +IFF_DORMANT +IFF_LOOPBACK +IFF_LOWER_UP +IFF_MULTICAST +IFF_NOARP +IFF_NOTRAILERS +IFF_POINTOPOINT +IFF_PROMISC +IFF_RUNNING +IFF_UP +IMAXBEL +IOV_MAX +IPPROTO_AH +IPPROTO_DSTOPTS +IPPROTO_EGP +IPPROTO_ESP +IPPROTO_FRAGMENT +IPPROTO_HOPOPTS +IPPROTO_IDP +IPPROTO_IGMP +IPPROTO_IPIP +IPPROTO_MAX +IPPROTO_NONE +IPPROTO_PUP +IPPROTO_RAW +IPPROTO_ROUTING +IPTOS_LOWDELAY +IPTOS_RELIABILITY +IPTOS_THROUGHPUT +IPV6_ADD_MEMBERSHIP +IPV6_CHECKSUM +IPV6_DONTFRAG +IPV6_DROP_MEMBERSHIP +IPV6_HOPLIMIT +IPV6_HOPOPTS +IPV6_JOIN_GROUP +IPV6_LEAVE_GROUP +IPV6_PKTINFO +IPV6_RECVRTHDR +IPV6_RECVTCLASS +IPV6_RTHDR +IPV6_TCLASS +IPV6_UNICAST_IF +IP_ADD_SOURCE_MEMBERSHIP +IP_BLOCK_SOURCE +IP_DEFAULT_MULTICAST_LOOP +IP_DEFAULT_MULTICAST_TTL +IP_DROP_SOURCE_MEMBERSHIP +IP_HDRINCL +IP_OPTIONS +IP_PKTINFO +IP_TOS +IP_UNBLOCK_SOURCE +IP_UNICAST_IF +ITIMER_PROF +ITIMER_REAL +ITIMER_VIRTUAL +IUCLC +IUTF8 +LC_ALL +LC_ALL_MASK +LC_COLLATE +LC_COLLATE_MASK +LC_CTYPE +LC_CTYPE_MASK +LC_GLOBAL_LOCALE +LC_MESSAGES +LC_MESSAGES_MASK +LC_MONETARY +LC_MONETARY_MASK +LC_NUMERIC +LC_NUMERIC_MASK +LC_TIME +LC_TIME_MASK +LITTLE_ENDIAN +LOCK_EX +LOCK_NB +LOCK_SH +LOCK_UN +MADV_DONTNEED +MADV_NORMAL +MADV_RANDOM +MADV_SEQUENTIAL +MADV_WILLNEED +MAP_FILE +MAP_NORESERVE +MAP_TYPE +MCAST_BLOCK_SOURCE +MCAST_EXCLUDE +MCAST_INCLUDE +MCAST_JOIN_GROUP +MCAST_JOIN_SOURCE_GROUP +MCAST_LEAVE_GROUP +MCAST_LEAVE_SOURCE_GROUP +MCAST_UNBLOCK_SOURCE +MINSIGSTKSZ MOUNT_AUTOMATIC MOUNT_BIND MOUNT_CYGDRIVE @@ -20,8 +277,602 @@ MOUNT_SPARSE MOUNT_SYSTEM MOUNT_TEXT MOUNT_USER_TEMP +MSG_BCAST +MSG_CMSG_CLOEXEC +MSG_DONTWAIT +MSG_MCAST +NGROUPS_MAX +NI_DGRAM +NI_MAXSERV +NI_NAMEREQD +NI_NOFQDN +NI_NUMERICHOST +NI_NUMERICSERV +NL0 +NL1 +NLDLY +OFDEL +OFILL +OLCUC +O_DIRECT +O_DSYNC +O_EXEC +O_NOATIME +O_NOCTTY +O_PATH +O_RSYNC +O_SEARCH +O_SYNC +O_TMPFILE +PF_APPLETALK +PF_CCITT +PF_CHAOS +PF_DATAKIT +PF_DECnet +PF_DLI +PF_HYLINK +PF_IMPLINK +PF_ISO +PF_LAT +PF_LOCAL +PF_NETBIOS +PF_NS +PF_OSI +PF_PUP +PF_SNA +PIPE_BUF +POLLRDBAND +POLLRDNORM +POLLWRBAND +POLLWRNORM +POSIX_FADV_DONTNEED +POSIX_FADV_NOREUSE +POSIX_FADV_NORMAL +POSIX_FADV_RANDOM +POSIX_FADV_SEQUENTIAL +POSIX_FADV_WILLNEED +POSIX_MADV_DONTNEED +POSIX_MADV_NORMAL +POSIX_MADV_RANDOM +POSIX_MADV_SEQUENTIAL +POSIX_MADV_WILLNEED +POSIX_SPAWN_RESETIDS +POSIX_SPAWN_SETPGROUP +POSIX_SPAWN_SETSCHEDPARAM +POSIX_SPAWN_SETSCHEDULER +POSIX_SPAWN_SETSIGDEF +POSIX_SPAWN_SETSIGMASK +PTHREAD_CREATE_DETACHED +PTHREAD_CREATE_JOINABLE +PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP +PTHREAD_MUTEX_DEFAULT +PTHREAD_MUTEX_ERRORCHECK +PTHREAD_PROCESS_PRIVATE +PTHREAD_PROCESS_SHARED +PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +PTHREAD_STACK_MIN +RLIMIT_AS +RLIMIT_CORE +RLIMIT_CPU +RLIMIT_DATA +RLIMIT_FSIZE +RLIMIT_NLIMITS +RLIMIT_NOFILE +RLIMIT_STACK +RLIM_INFINITY +RLIM_NLIMITS +RLIM_SAVED_CUR +RLIM_SAVED_MAX +RTLD_DEEPBIND +RTLD_NODELETE +RTLD_NOLOAD +RUSAGE_CHILDREN +RUSAGE_SELF +SCHED_FIFO +SCHED_OTHER +SCHED_RR +SCM_CREDENTIALS +SCM_RIGHTS +SEM_FAILED +SIGEMT +SIGEV_NONE +SIGEV_SIGNAL +SIGEV_THREAD +SIGPOLL +SIGPWR +SIGSTKSZ +SIOCGIFADDR +SIOCGIFBRDADDR +SIOCGIFCONF +SIOCGIFDSTADDR +SIOCGIFFLAGS +SIOCGIFHWADDR +SIOCGIFINDEX +SIOCGIFMETRIC +SIOCGIFMTU +SIOCGIFNETMASK +SIOGIFINDEX +SOCK_CLOEXEC +SOCK_NONBLOCK +SOCK_RAW +SOCK_RDM +SOL_IP +SOL_IPV6 +SOL_TCP +SOL_UDP +SOMAXCONN +SO_PASSCRED +SO_PEERCRED +SO_USELOOPBACK +SS_DISABLE +SS_ONSTACK +ST_NOSUID +ST_RDONLY +S_BLKSIZE +S_ENFMT +S_IEXEC +S_IREAD +S_IWRITE +TAB0 +TAB1 +TAB2 +TAB3 +TABDLY +TCFLSH +TCGETA +TCP_FASTOPEN +TCP_KEEPCNT +TCP_KEEPIDLE +TCP_KEEPINTVL +TCP_MAXSEG +TCP_QUICKACK +TCP_USER_TIMEOUT +TCSETA +TCSETAF +TCSETAW +TIMER_ABSTIME +TIOCCBRK +TIOCGPGRP +TIOCINQ +TIOCLINUX +TIOCMBIC +TIOCMBIS +TIOCMGET +TIOCMSET +TIOCM_CAR +TIOCM_CD +TIOCM_CTS +TIOCM_DTR +TIOCM_RI +TIOCM_RNG +TIOCM_RTS +TIOCPKT +TIOCPKT_DATA +TIOCPKT_DOSTOP +TIOCPKT_FLUSHREAD +TIOCPKT_FLUSHWRITE +TIOCPKT_NOSTOP +TIOCPKT_START +TIOCPKT_STOP +TIOCSBRK +TIOCSCTTY +TIOCSPGRP +UTIME_NOW +UTIME_OMIT +VDISCARD +VLNEXT +VREPRINT +VSWTC +VT0 +VT1 +VTDLY WINDOWS_HWND WINDOWS_POST WINDOWS_SEND +XTABS +_CS_PATH +_IONBF +_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_TIMESTAMP_RESOLUTION +_POSIX_VDISABLE +_SC_2_CHAR_TERM +_SC_2_C_BIND +_SC_2_C_DEV +_SC_2_FORT_DEV +_SC_2_FORT_RUN +_SC_2_LOCALEDEF +_SC_2_PBS +_SC_2_PBS_ACCOUNTING +_SC_2_PBS_CHECKPOINT +_SC_2_PBS_LOCATE +_SC_2_PBS_MESSAGE +_SC_2_PBS_TRACK +_SC_2_SW_DEV +_SC_2_UPE +_SC_2_VERSION +_SC_ADVISORY_INFO +_SC_AIO_LISTIO_MAX +_SC_AIO_MAX +_SC_AIO_PRIO_DELTA_MAX +_SC_ASYNCHRONOUS_IO +_SC_ATEXIT_MAX +_SC_AVPHYS_PAGES +_SC_BARRIERS +_SC_BC_BASE_MAX +_SC_BC_DIM_MAX +_SC_BC_SCALE_MAX +_SC_BC_STRING_MAX +_SC_CLOCK_SELECTION +_SC_COLL_WEIGHTS_MAX +_SC_CPUTIME +_SC_DELAYTIMER_MAX +_SC_EXPR_NEST_MAX +_SC_FSYNC +_SC_GETGR_R_SIZE_MAX +_SC_GETPW_R_SIZE_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 +_SC_MEMLOCK +_SC_MEMLOCK_RANGE +_SC_MEMORY_PROTECTION +_SC_MESSAGE_PASSING +_SC_MONOTONIC_CLOCK +_SC_MQ_OPEN_MAX +_SC_MQ_PRIO_MAX +_SC_NPROCESSORS_CONF +_SC_NPROCESSORS_ONLN +_SC_PHYS_PAGES +_SC_PRIORITIZED_IO +_SC_PRIORITY_SCHEDULING +_SC_RAW_SOCKETS +_SC_READER_WRITER_LOCKS +_SC_REALTIME_SIGNALS +_SC_REGEXP +_SC_RE_DUP_MAX +_SC_RTSIG_MAX +_SC_SAVED_IDS +_SC_SEMAPHORES +_SC_SEM_NSEMS_MAX +_SC_SEM_VALUE_MAX +_SC_SHARED_MEMORY_OBJECTS +_SC_SHELL +_SC_SIGQUEUE_MAX +_SC_SPAWN +_SC_SPIN_LOCKS +_SC_SPORADIC_SERVER +_SC_SS_REPL_MAX +_SC_SYNCHRONIZED_IO +_SC_THREADS +_SC_THREAD_ATTR_STACKADDR +_SC_THREAD_ATTR_STACKSIZE +_SC_THREAD_CPUTIME +_SC_THREAD_DESTRUCTOR_ITERATIONS +_SC_THREAD_KEYS_MAX +_SC_THREAD_PRIORITY_SCHEDULING +_SC_THREAD_PRIO_CEILING +_SC_THREAD_PRIO_INHERIT +_SC_THREAD_PRIO_PROTECT +_SC_THREAD_PROCESS_SHARED +_SC_THREAD_ROBUST_PRIO_INHERIT +_SC_THREAD_ROBUST_PRIO_PROTECT +_SC_THREAD_SAFE_FUNCTIONS +_SC_THREAD_SPORADIC_SERVER +_SC_THREAD_STACK_MIN +_SC_THREAD_THREADS_MAX +_SC_TIMEOUTS +_SC_TIMERS +_SC_TIMER_MAX +_SC_TRACE +_SC_TRACE_EVENT_FILTER +_SC_TRACE_EVENT_NAME_MAX +_SC_TRACE_INHERIT +_SC_TRACE_LOG +_SC_TRACE_NAME_MAX +_SC_TRACE_SYS_MAX +_SC_TRACE_USER_EVENT_MAX +_SC_TYPED_MEMORY_OBJECTS +_SC_V6_ILP32_OFF32 +_SC_V6_ILP32_OFFBIG +_SC_V6_LP64_OFF64 +_SC_V6_LPBIG_OFFBIG +_SC_V7_ILP32_OFF32 +_SC_V7_ILP32_OFFBIG +_SC_V7_LP64_OFF64 +_SC_V7_LPBIG_OFFBIG +_SC_XBS5_ILP32_OFF32 +_SC_XBS5_ILP32_OFFBIG +_SC_XBS5_LP64_OFF64 +_SC_XBS5_LPBIG_OFFBIG +_SC_XOPEN_CRYPT +_SC_XOPEN_ENH_I18N +_SC_XOPEN_LEGACY +_SC_XOPEN_REALTIME +_SC_XOPEN_REALTIME_THREADS +_SC_XOPEN_SHM +_SC_XOPEN_STREAMS +_SC_XOPEN_UNIX +_SC_XOPEN_UUCP +_SC_XOPEN_VERSION +__errno +_fpstate +_off64_t +_uc_fpxreg +_uc_xmmreg +abs +accept4 +arc4random +arc4random_buf +arc4random_uniform +asctime_r +basename +bintime +caddr_t +clearenv +clock_getres +clock_settime +cmsghdr +cpu_set_t +ctime_r cygwin_umount +daemon +dirfd dlfork +drand48 +dup3 +duplocale +eaccess +endpwent +erand48 +euidaccess +execvpe +explicit_bzero +faccessat +fallocate +fd_mask +fdatasync +fexecve +ffs +ffsl +ffsll +fls +flsl +flsll +forkpty +freelocale +fstatfs +futimes +futimesat +getdomainname +getdtablesize +getentropy +getgrgid_r +getgrnam_r +getgrouplist +gethostid +getitimer +getloadavg +getnameinfo +getpagesize +getpeereid +getpriority +getpt +getpwent +getpwnam_r +getpwuid_r +getrandom +getrlimit +iconv_t +id_t +if_freenameindex +if_nameindex +ifconf +ifreq +in6_pktinfo +in_pktinfo +initgroups +ip_mreq_source +itimerspec +jrand48 +key_t +labs +lcong48 +loff_t +lrand48 +lutimes +madvise +major +makedev +max_align_t +mcontext_t +memalign +memmem +memrchr +minor +mkfifoat +mknodat +mkostemp +mkostemps +mkstemps +mount +mrand48 +msghdr +newlocale +nl_item +nrand48 +openpty +pipe2 +posix_fadvise +posix_fallocate +posix_madvise +posix_spawn +posix_spawn_file_actions_addclose +posix_spawn_file_actions_adddup2 +posix_spawn_file_actions_addopen +posix_spawn_file_actions_destroy +posix_spawn_file_actions_init +posix_spawn_file_actions_t +posix_spawnattr_destroy +posix_spawnattr_getflags +posix_spawnattr_getpgroup +posix_spawnattr_getschedparam +posix_spawnattr_getschedpolicy +posix_spawnattr_getsigdefault +posix_spawnattr_getsigmask +posix_spawnattr_init +posix_spawnattr_setflags +posix_spawnattr_setpgroup +posix_spawnattr_setschedparam +posix_spawnattr_setschedpolicy +posix_spawnattr_setsigdefault +posix_spawnattr_setsigmask +posix_spawnattr_t +posix_spawnp +ppoll +pthread_atfork +pthread_attr_getguardsize +pthread_attr_getschedparam +pthread_attr_getstack +pthread_attr_setschedparam +pthread_barrier_destroy +pthread_barrier_init +pthread_barrier_t +pthread_barrier_wait +pthread_barrierattr_destroy +pthread_barrierattr_getpshared +pthread_barrierattr_init +pthread_barrierattr_t +pthread_cancel +pthread_condattr_getclock +pthread_condattr_getpshared +pthread_condattr_setclock +pthread_condattr_setpshared +pthread_getaffinity_np +pthread_getattr_np +pthread_getcpuclockid +pthread_getname_np +pthread_getschedparam +pthread_kill +pthread_mutex_timedlock +pthread_mutexattr_getprotocol +pthread_mutexattr_getpshared +pthread_mutexattr_setprotocol +pthread_mutexattr_setpshared +pthread_rwlockattr_getpshared +pthread_rwlockattr_setpshared +pthread_setaffinity_np +pthread_setname_np +pthread_setschedparam +pthread_setschedprio +pthread_sigmask +pthread_sigqueue +pthread_spin_destroy +pthread_spin_init +pthread_spin_lock +pthread_spin_trylock +pthread_spin_unlock +pthread_spinlock_t +ptsname_r +qsort_r +rand +reallocarray +reallocf +recvmsg +register_t +sbrk +sched_get_priority_max +sched_get_priority_min +sched_getaffinity +sched_getcpu +sched_getparam +sched_getscheduler +sched_param +sched_rr_get_interval +sched_setaffinity +sched_setparam +sched_setscheduler +seed48 +seekdir +sem +sem_close +sem_destroy +sem_getvalue +sem_init +sem_open +sem_timedwait +sem_unlink +sendmsg +setgroups +sethostname +setitimer +setpriority +setpwent +setrlimit +settimeofday +sigaltstack +sigevent +siginfo_t +sigsuspend +sigtimedwait +sigwait +sigwaitinfo +srand +srand48 +stack_t +statfs +strcasecmp_l +strftime +strncasecmp_l +strptime +strsep +sync +telldir +timer_create +timer_delete +timer_getoverrun +timer_gettime +timer_settime +timer_t +timingsafe_bcmp +timingsafe_memcmp +u_char +u_int +u_long +u_short +ucontext_t +ucred +umount +useconds_t +uselocale +utimensat +vhangup +vm_offset_t +vm_size_t diff --git a/libc-test/semver/hermit.txt b/libc-test/semver/hermit.txt index ba44a7d2246ca..43ca11b6acf74 100644 --- a/libc-test/semver/hermit.txt +++ b/libc-test/semver/hermit.txt @@ -1,5 +1,7 @@ AF_INET AF_INET6 +AF_UNSPEC +AF_VSOCK CLOCK_MONOTONIC CLOCK_REALTIME DT_BLK diff --git a/libc-test/semver/illumos.txt b/libc-test/semver/illumos.txt index b39aba51d1b5f..67d990269d27a 100644 --- a/libc-test/semver/illumos.txt +++ b/libc-test/semver/illumos.txt @@ -15,6 +15,10 @@ POSIX_FADV_RANDOM POSIX_FADV_SEQUENTIAL POSIX_FADV_WILLNEED POSIX_SPAWN_SETSID +TFD_CLOEXEC +TFD_NONBLOCK +TFD_TIMER_ABSTIME +TFD_TIMER_CANCEL_ON_SET posix_fadvise posix_fallocate posix_spawn_file_actions_addfchdir_np @@ -23,3 +27,6 @@ pthread_attr_getstackaddr pthread_attr_setstack ptsname_r syncfs +timerfd_create +timerfd_gettime +timerfd_settime diff --git a/libc-test/semver/linux-aarch64.txt b/libc-test/semver/linux-aarch64.txt index 9dceaeccb819b..c4bce0196f8ae 100644 --- a/libc-test/semver/linux-aarch64.txt +++ b/libc-test/semver/linux-aarch64.txt @@ -2,10 +2,12 @@ B2500000 B3000000 B3500000 B4000000 +BPF_A BPF_ABS BPF_ADD BPF_ALU BPF_B +BPF_CLASS BPF_DIV BPF_H BPF_IMM @@ -25,15 +27,21 @@ BPF_MEM BPF_MISC BPF_MISCOP BPF_MOD +BPF_MODE BPF_MSH BPF_NEG BPF_NET_OFF +BPF_OP BPF_RET BPF_RVAL +BPF_SIZE +BPF_SRC BPF_ST BPF_STMT BPF_STX BPF_SUB +BPF_TAX +BPF_TXA BPF_W BPF_X BPF_XOR diff --git a/libc-test/semver/linux-loongarch64.txt b/libc-test/semver/linux-loongarch64.txt index 1302cb68b2c8a..1b50e7248b7fe 100644 --- a/libc-test/semver/linux-loongarch64.txt +++ b/libc-test/semver/linux-loongarch64.txt @@ -2,10 +2,12 @@ B2500000 B3000000 B3500000 B4000000 +BPF_A BPF_ABS BPF_ADD BPF_ALU BPF_B +BPF_CLASS BPF_DIV BPF_H BPF_IMM @@ -25,15 +27,21 @@ BPF_MEM BPF_MISC BPF_MISCOP BPF_MOD +BPF_MODE BPF_MSH BPF_NEG BPF_NET_OFF +BPF_OP BPF_RET BPF_RVAL +BPF_SIZE +BPF_SRC BPF_ST BPF_STMT BPF_STX BPF_SUB +BPF_TAX +BPF_TXA BPF_W BPF_X BPF_XOR diff --git a/libc-test/semver/linux-x86_64.txt b/libc-test/semver/linux-x86_64.txt index f1ed29b8f299d..9d62f8cd3cd35 100644 --- a/libc-test/semver/linux-x86_64.txt +++ b/libc-test/semver/linux-x86_64.txt @@ -2,10 +2,12 @@ B2500000 B3000000 B3500000 B4000000 +BPF_A BPF_ABS BPF_ADD BPF_ALU BPF_B +BPF_CLASS BPF_DIV BPF_H BPF_IMM @@ -25,15 +27,21 @@ BPF_MEM BPF_MISC BPF_MISCOP BPF_MOD +BPF_MODE BPF_MSH BPF_NEG BPF_NET_OFF +BPF_OP BPF_RET BPF_RVAL +BPF_SIZE +BPF_SRC BPF_ST BPF_STMT BPF_STX BPF_SUB +BPF_TAX +BPF_TXA BPF_W BPF_X BPF_XOR diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 8c4b54f3cfaa4..9bf5ec61c461f 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -1060,8 +1060,15 @@ IF_OPER_TESTING IF_OPER_UNKNOWN IF_OPER_UP IMAXBEL +INPUT_PROP_ACCELEROMETER +INPUT_PROP_BUTTONPAD INPUT_PROP_CNT +INPUT_PROP_DIRECT INPUT_PROP_MAX +INPUT_PROP_POINTER +INPUT_PROP_POINTING_STICK +INPUT_PROP_SEMI_MT +INPUT_PROP_TOPBUTTONPAD IN_ACCESS IN_ALL_EVENTS IN_ATTRIB @@ -1996,8 +2003,11 @@ NLMSG_MIN_TYPE NLMSG_NOOP NLMSG_OVERRUN NLM_F_ACK +NLM_F_ACK_TLVS NLM_F_APPEND NLM_F_ATOMIC +NLM_F_BULK +NLM_F_CAPPED NLM_F_CREATE NLM_F_DUMP NLM_F_DUMP_FILTERED @@ -2006,6 +2016,7 @@ NLM_F_ECHO NLM_F_EXCL NLM_F_MATCH NLM_F_MULTI +NLM_F_NONREC NLM_F_REPLACE NLM_F_REQUEST NLM_F_ROOT @@ -2745,6 +2756,7 @@ SECCOMP_RET_KILL_THREAD SECCOMP_RET_LOG SECCOMP_RET_TRACE SECCOMP_RET_TRAP +SECCOMP_RET_USER_NOTIF SECCOMP_SET_MODE_FILTER SECCOMP_SET_MODE_STRICT SECCOMP_USER_NOTIF_FLAG_CONTINUE @@ -3361,6 +3373,12 @@ TLS_1_2_VERSION_MINOR TLS_1_3_VERSION TLS_1_3_VERSION_MAJOR TLS_1_3_VERSION_MINOR +TLS_CIPHER_AES_CCM_128 +TLS_CIPHER_AES_CCM_128_IV_SIZE +TLS_CIPHER_AES_CCM_128_KEY_SIZE +TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE +TLS_CIPHER_AES_CCM_128_SALT_SIZE +TLS_CIPHER_AES_CCM_128_TAG_SIZE TLS_CIPHER_AES_GCM_128 TLS_CIPHER_AES_GCM_128_IV_SIZE TLS_CIPHER_AES_GCM_128_KEY_SIZE @@ -3373,16 +3391,53 @@ TLS_CIPHER_AES_GCM_256_KEY_SIZE TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE TLS_CIPHER_AES_GCM_256_SALT_SIZE TLS_CIPHER_AES_GCM_256_TAG_SIZE +TLS_CIPHER_ARIA_GCM_128 +TLS_CIPHER_ARIA_GCM_128_IV_SIZE +TLS_CIPHER_ARIA_GCM_128_KEY_SIZE +TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE +TLS_CIPHER_ARIA_GCM_128_SALT_SIZE +TLS_CIPHER_ARIA_GCM_128_TAG_SIZE +TLS_CIPHER_ARIA_GCM_256 +TLS_CIPHER_ARIA_GCM_256_IV_SIZE +TLS_CIPHER_ARIA_GCM_256_KEY_SIZE +TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE +TLS_CIPHER_ARIA_GCM_256_SALT_SIZE +TLS_CIPHER_ARIA_GCM_256_TAG_SIZE TLS_CIPHER_CHACHA20_POLY1305 TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE +TLS_CIPHER_SM4_CCM +TLS_CIPHER_SM4_CCM_IV_SIZE +TLS_CIPHER_SM4_CCM_KEY_SIZE +TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE +TLS_CIPHER_SM4_CCM_SALT_SIZE +TLS_CIPHER_SM4_CCM_TAG_SIZE +TLS_CIPHER_SM4_GCM +TLS_CIPHER_SM4_GCM_IV_SIZE +TLS_CIPHER_SM4_GCM_KEY_SIZE +TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE +TLS_CIPHER_SM4_GCM_SALT_SIZE +TLS_CIPHER_SM4_GCM_TAG_SIZE +TLS_CONF_BASE +TLS_CONF_HW +TLS_CONF_HW_RECORD +TLS_CONF_SW TLS_GET_RECORD_TYPE +TLS_INFO_CIPHER +TLS_INFO_RXCONF +TLS_INFO_RX_NO_PAD +TLS_INFO_TXCONF +TLS_INFO_UNSPEC +TLS_INFO_VERSION +TLS_INFO_ZC_RO_TX TLS_RX +TLS_RX_EXPECT_NO_PAD TLS_SET_RECORD_TYPE TLS_TX +TLS_TX_ZEROCOPY_RO TP_FT_REQ_FILL_RXHASH TP_STATUS_AVAILABLE TP_STATUS_BLK_TMO @@ -3549,9 +3604,13 @@ _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS +_IO _IOFBF _IOLBF _IONBF +_IOR +_IOW +_IOWR _PC_2_SYMLINKS _PC_ALLOC_SIZE_MIN _PC_ASYNC_IO @@ -4023,6 +4082,7 @@ pthread_attr_setguardsize pthread_attr_setinheritsched pthread_attr_setschedparam pthread_attr_setschedpolicy +pthread_attr_setstack pthread_barrier_destroy pthread_barrier_init pthread_barrier_t diff --git a/libc-test/semver/netbsd.txt b/libc-test/semver/netbsd.txt index d9e1b66c233a4..57e1cf5c4bd1b 100644 --- a/libc-test/semver/netbsd.txt +++ b/libc-test/semver/netbsd.txt @@ -1042,6 +1042,10 @@ TCP_KEEPINIT TCP_KEEPINTVL TCP_MAXSEG TCP_MD5SIG +TFD_CLOEXEC +TFD_NONBLOCK +TFD_TIMER_ABSTIME +TFD_TIMER_CANCEL_ON_SET THOUSEP TIMER_ABSTIME TIME_DEL @@ -1613,6 +1617,9 @@ timer_getoverrun timer_gettime timer_settime timer_t +timerfd_create +timerfd_gettime +timerfd_settime timex truncate ttyname_r diff --git a/libc-test/test/makedev.rs b/libc-test/test/makedev.rs index 374294ebe11d6..ea701f6abe94b 100644 --- a/libc-test/test/makedev.rs +++ b/libc-test/test/makedev.rs @@ -1,51 +1,7 @@ //! Compare libc's makedev, major, minor functions against the actual C macros, for various //! inputs. -#[cfg(any(target_os = "solaris", target_os = "illumos"))] -mod ret { - pub type MajorRetType = libc::major_t; - pub type MinorRetType = libc::minor_t; -} - -#[cfg(any( - target_os = "linux", - target_os = "l4re", - target_os = "emscripten", - target_os = "fuchsia", - target_os = "aix", - target_os = "nto", - target_os = "hurd", - target_os = "openbsd", -))] -mod ret { - pub type MajorRetType = libc::c_uint; - pub type MinorRetType = libc::c_uint; -} - -#[cfg(any( - target_os = "android", - target_os = "dragonfly", - target_os = "netbsd", - target_os = "freebsd", -))] -mod ret { - pub type MajorRetType = libc::c_int; - pub type MinorRetType = libc::c_int; -} - -#[cfg(any( - target_os = "macos", - target_os = "ios", - target_os = "tvos", - target_os = "watchos", - target_os = "visionos" -))] -mod ret { - pub type MajorRetType = i32; - pub type MinorRetType = i32; -} - -#[cfg(any( +#![cfg(any( target_os = "android", target_os = "dragonfly", target_os = "emscripten", @@ -56,100 +12,134 @@ mod ret { target_os = "openbsd", target_os = "cygwin", ))] -mod t { - use libc::{self, c_uint, dev_t}; - use super::ret::*; +use libc::{self, c_uint, dev_t}; - extern "C" { - pub fn makedev_ffi(major: c_uint, minor: c_uint) -> dev_t; - pub fn major_ffi(dev: dev_t) -> c_uint; - pub fn minor_ffi(dev: dev_t) -> c_uint; +cfg_if::cfg_if! { + if #[cfg(any(target_os = "solaris", target_os = "illumos"))] { + pub type MajorRetType = libc::major_t; + pub type MinorRetType = libc::minor_t; + } else if #[cfg(any( + target_os = "linux", + target_os = "l4re", + target_os = "emscripten", + target_os = "fuchsia", + target_os = "aix", + target_os = "nto", + target_os = "hurd", + target_os = "openbsd", + target_os = "cygwin", + ))] { + pub type MajorRetType = libc::c_uint; + pub type MinorRetType = libc::c_uint; + } else if #[cfg(any( + target_os = "android", + target_os = "dragonfly", + target_os = "netbsd", + target_os = "freebsd", + ))] { + pub type MajorRetType = libc::c_int; + pub type MinorRetType = libc::c_int; + } else if #[cfg(any( + target_os = "macos", + target_os = "ios", + target_os = "tvos", + target_os = "watchos", + target_os = "visionos" + ))] { + pub type MajorRetType = i32; + pub type MinorRetType = i32; } +} - fn compare(major: c_uint, minor: c_uint) { - let dev = unsafe { makedev_ffi(major, minor) }; - assert_eq!(libc::makedev(major, minor), dev); - let major = unsafe { major_ffi(dev) }; - assert_eq!(libc::major(dev), major as MajorRetType); - let minor = unsafe { minor_ffi(dev) }; - assert_eq!(libc::minor(dev), minor as MinorRetType); - } +extern "C" { + pub fn makedev_ffi(major: c_uint, minor: c_uint) -> dev_t; + pub fn major_ffi(dev: dev_t) -> c_uint; + pub fn minor_ffi(dev: dev_t) -> c_uint; +} - // Every OS should be able to handle 8 bit major and minor numbers - #[test] - fn test_8bits() { - for major in 0..256 { - for minor in 0..256 { - compare(major, minor); - } +fn compare(major: c_uint, minor: c_uint) { + let dev = unsafe { makedev_ffi(major, minor) }; + assert_eq!(libc::makedev(major, minor), dev); + let major = unsafe { major_ffi(dev) }; + assert_eq!(libc::major(dev), major as MajorRetType); + let minor = unsafe { minor_ffi(dev) }; + assert_eq!(libc::minor(dev), minor as MinorRetType); +} + +// Every OS should be able to handle 8 bit major and minor numbers +#[test] +fn test_8bits() { + for major in 0..256 { + for minor in 0..256 { + compare(major, minor); } } +} - // Android allows 12 bits for major and 20 for minor - #[test] - #[cfg(target_os = "android")] - fn test_android_like() { - for major in [0, 1, 255, 256, 4095] { - for minor_exp in [1, 8, 16] { - for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { - compare(major, minor); - } +// Android allows 12 bits for major and 20 for minor +#[test] +#[cfg(target_os = "android")] +fn test_android_like() { + for major in [0, 1, 255, 256, 4095] { + for minor_exp in [1, 8, 16] { + for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { + compare(major, minor); } - compare(major, (1 << 20) - 1); } + compare(major, (1 << 20) - 1); } +} - // These OSes allow 32 bits for minor, but only 8 for major - #[test] - #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd",))] - fn test_fbsd11_like() { - for major in [0, 1, 255] { - for minor_exp in [1, 8, 16, 24, 31] { - for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { - compare(major, minor); - } +// These OSes allow 32 bits for minor, but only 8 for major +#[test] +#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd",))] +fn test_fbsd11_like() { + for major in [0, 1, 255] { + for minor_exp in [1, 8, 16, 24, 31] { + for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { + compare(major, minor); } - compare(major, c_uint::MAX); } + compare(major, c_uint::MAX); } +} - // OpenBSD allows 8 bits for major and 24 for minor - #[test] - #[cfg(target_os = "openbsd")] - fn test_openbsd_like() { - for major in [0, 1, 255] { - for minor_exp in [1, 8, 16] { - for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { - compare(major, minor); - } +// OpenBSD allows 8 bits for major and 24 for minor +#[test] +#[cfg(target_os = "openbsd")] +fn test_openbsd_like() { + for major in [0, 1, 255] { + for minor_exp in [1, 8, 16] { + for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { + compare(major, minor); } - compare(major, (1 << 24) - 1); } + compare(major, (1 << 24) - 1); } +} - // These OSes allow 32 bits for both minor and major - #[cfg(any( - target_os = "emscripten", - target_os = "freebsd", - target_os = "fuchsia", - target_os = "linux", - target_os = "cygwin", - ))] - #[test] - fn test_fbsd12_like() { - if std::mem::size_of::() >= 8 { - for major_exp in [0, 16, 24, 31] { - for major in [(1 << major_exp) - 1, (1 << major_exp)] { - for minor_exp in [1, 8, 16, 24, 31] { - for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { - compare(major, minor); - } +// These OSes allow 32 bits for both minor and major +#[cfg(any( + target_os = "emscripten", + target_os = "freebsd", + target_os = "fuchsia", + target_os = "linux", + target_os = "cygwin", +))] +#[test] +fn test_fbsd12_like() { + if std::mem::size_of::() >= 8 { + for major_exp in [0, 16, 24, 31] { + for major in [(1 << major_exp) - 1, (1 << major_exp)] { + for minor_exp in [1, 8, 16, 24, 31] { + for minor in [(1 << minor_exp) - 1, (1 << minor_exp)] { + compare(major, minor); } - compare(major, c_uint::MAX); } - compare(c_uint::MAX, c_uint::MAX); + compare(major, c_uint::MAX); } + compare(c_uint::MAX, c_uint::MAX); } } } diff --git a/src/hermit.rs b/src/hermit.rs index db51ee94b7881..b96be6b0e2a2f 100644 --- a/src/hermit.rs +++ b/src/hermit.rs @@ -114,8 +114,10 @@ s! { } } -pub const AF_INET: i32 = 0; +pub const AF_UNSPEC: i32 = 0; +pub const AF_INET: i32 = 3; pub const AF_INET6: i32 = 1; +pub const AF_VSOCK: i32 = 2; pub const CLOCK_REALTIME: clockid_t = 1; pub const CLOCK_MONOTONIC: clockid_t = 4; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 8ede2b603d100..9f44907a98b7c 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -2409,6 +2409,12 @@ pub const RTA_TAG: c_int = 0x100; pub const RTAX_TAG: c_int = 8; pub const RTAX_MAX: c_int = 9; +// sys/timerfd.h +pub const TFD_CLOEXEC: i32 = crate::O_CLOEXEC; +pub const TFD_NONBLOCK: i32 = crate::O_NONBLOCK; +pub const TFD_TIMER_ABSTIME: i32 = crate::O_WRONLY; +pub const TFD_TIMER_CANCEL_ON_SET: i32 = crate::O_RDWR; + const_fn! { {const} fn _ALIGN(p: usize) -> usize { (p + _ALIGNBYTES) & !_ALIGNBYTES @@ -2853,6 +2859,16 @@ extern "C" { #[link_name = "__getmntinfo13"] pub fn getmntinfo(mntbufp: *mut *mut crate::statvfs, flags: c_int) -> c_int; pub fn getvfsstat(buf: *mut statvfs, bufsize: size_t, flags: c_int) -> c_int; + + // Added in `NetBSD` 10.0 + pub fn timerfd_create(clockid: crate::clockid_t, flags: c_int) -> c_int; + pub fn timerfd_gettime(fd: c_int, curr_value: *mut itimerspec) -> c_int; + pub fn timerfd_settime( + fd: c_int, + flags: c_int, + new_value: *const itimerspec, + old_value: *mut itimerspec, + ) -> c_int; } #[link(name = "rt")] diff --git a/src/unix/cygwin/mod.rs b/src/unix/cygwin/mod.rs index 4bfdde336ac9b..9fe63985f1180 100644 --- a/src/unix/cygwin/mod.rs +++ b/src/unix/cygwin/mod.rs @@ -435,6 +435,19 @@ s! { pub f_flag: c_ulong, pub f_namemax: c_ulong, } + + pub struct statfs { + pub f_type: c_long, + pub f_bsize: c_long, + pub f_blocks: c_long, + pub f_bfree: c_long, + pub f_bavail: c_long, + pub f_files: c_long, + pub f_ffree: c_long, + pub f_fsid: c_long, + pub f_namelen: c_long, + pub f_spare: [c_long; 6], + } } s_no_extra_traits! { @@ -498,7 +511,7 @@ s_no_extra_traits! { } pub struct utsname { - pub sysname: [c_char; 65], + pub sysname: [c_char; 66], pub nodename: [c_char; 65], pub release: [c_char; 65], pub version: [c_char; 65], @@ -961,6 +974,8 @@ pub const SOL_UDP: c_int = 17; pub const IPTOS_LOWDELAY: u8 = 0x10; pub const IPTOS_THROUGHPUT: u8 = 0x08; pub const IPTOS_RELIABILITY: u8 = 0x04; +pub const IPTOS_LOWCOST: u8 = 0x02; +pub const IPTOS_MINCOST: u8 = IPTOS_LOWCOST; pub const IP_DEFAULT_MULTICAST_TTL: c_int = 1; pub const IP_DEFAULT_MULTICAST_LOOP: c_int = 1; pub const IP_OPTIONS: c_int = 1; @@ -977,8 +992,18 @@ pub const IP_DROP_SOURCE_MEMBERSHIP: c_int = 16; pub const IP_BLOCK_SOURCE: c_int = 17; pub const IP_UNBLOCK_SOURCE: c_int = 18; pub const IP_PKTINFO: c_int = 19; +pub const IP_RECVTTL: c_int = 21; pub const IP_UNICAST_IF: c_int = 31; +pub const IP_RECVTOS: c_int = 40; +pub const IP_MTU_DISCOVER: c_int = 71; +pub const IP_MTU: c_int = 73; +pub const IP_RECVERR: c_int = 75; +pub const IP_PMTUDISC_WANT: c_int = 0; +pub const IP_PMTUDISC_DO: c_int = 1; +pub const IP_PMTUDISC_DONT: c_int = 2; +pub const IP_PMTUDISC_PROBE: c_int = 3; pub const IPV6_HOPOPTS: c_int = 1; +pub const IPV6_HDRINCL: c_int = 2; pub const IPV6_UNICAST_HOPS: c_int = 4; pub const IPV6_MULTICAST_IF: c_int = 9; pub const IPV6_MULTICAST_HOPS: c_int = 10; @@ -997,6 +1022,13 @@ pub const IPV6_RTHDR: c_int = 32; pub const IPV6_RECVRTHDR: c_int = 38; pub const IPV6_TCLASS: c_int = 39; pub const IPV6_RECVTCLASS: c_int = 40; +pub const IPV6_MTU_DISCOVER: c_int = 71; +pub const IPV6_MTU: c_int = 72; +pub const IPV6_RECVERR: c_int = 75; +pub const IPV6_PMTUDISC_WANT: c_int = 0; +pub const IPV6_PMTUDISC_DO: c_int = 1; +pub const IPV6_PMTUDISC_DONT: c_int = 2; +pub const IPV6_PMTUDISC_PROBE: c_int = 3; pub const MCAST_JOIN_GROUP: c_int = 41; pub const MCAST_LEAVE_GROUP: c_int = 42; pub const MCAST_BLOCK_SOURCE: c_int = 43; @@ -1786,6 +1818,20 @@ pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x08; pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x10; pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x20; +pub const POSIX_FADV_NORMAL: c_int = 0; +pub const POSIX_FADV_SEQUENTIAL: c_int = 1; +pub const POSIX_FADV_RANDOM: c_int = 2; +pub const POSIX_FADV_WILLNEED: c_int = 3; +pub const POSIX_FADV_DONTNEED: c_int = 4; +pub const POSIX_FADV_NOREUSE: c_int = 5; + +pub const FALLOC_FL_PUNCH_HOLE: c_int = 0x0001; +pub const FALLOC_FL_ZERO_RANGE: c_int = 0x0002; +pub const FALLOC_FL_UNSHARE_RANGE: c_int = 0x0004; +pub const FALLOC_FL_COLLAPSE_RANGE: c_int = 0x0008; +pub const FALLOC_FL_INSERT_RANGE: c_int = 0x0010; +pub const FALLOC_FL_KEEP_SIZE: c_int = 0x1000; + f! { pub fn FD_CLR(fd: c_int, set: *mut fd_set) -> () { let fd = fd as usize; @@ -1865,14 +1911,6 @@ f! { set1.bits == set2.bits } - pub fn major(dev: dev_t) -> c_uint { - ((dev >> 16) & 0xffff) as c_uint - } - - pub fn minor(dev: dev_t) -> c_uint { - (dev & 0xffff) as c_uint - } - pub fn CMSG_LEN(length: c_uint) -> c_uint { CMSG_ALIGN(::core::mem::size_of::()) as c_uint + length } @@ -1911,6 +1949,14 @@ safe_f! { (ma << 16) | (mi & 0xffff) } + pub {const} fn major(dev: dev_t) -> c_uint { + ((dev >> 16) & 0xffff) as c_uint + } + + pub {const} fn minor(dev: dev_t) -> c_uint { + (dev & 0xffff) as c_uint + } + pub {const} fn WIFEXITED(status: c_int) -> bool { (status & 0xff) == 0 } @@ -2157,8 +2203,6 @@ extern "C" { pub fn timingsafe_bcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int; pub fn timingsafe_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int; - pub fn memccpy(dest: *mut c_void, src: *const c_void, c: c_int, count: size_t) -> *mut c_void; - pub fn memmem( haystack: *const c_void, haystacklen: size_t, @@ -2178,17 +2222,16 @@ extern "C" { pub fn dup3(src: c_int, dst: c_int, flags: c_int) -> c_int; pub fn eaccess(pathname: *const c_char, mode: c_int) -> c_int; pub fn euidaccess(pathname: *const c_char, mode: c_int) -> c_int; - // pub fn execlpe(path: *const c_char, arg0: *const c_char, ...) -> c_int; pub fn execvpe( file: *const c_char, - argv: *const *const c_char, - envp: *const *const c_char, + argv: *const *mut c_char, + envp: *const *mut c_char, ) -> c_int; pub fn faccessat(dirfd: c_int, pathname: *const c_char, mode: c_int, flags: c_int) -> c_int; - pub fn fexecve(fd: c_int, argv: *const *const c_char, envp: *const *const c_char) -> c_int; + pub fn fexecve(fd: c_int, argv: *const *mut c_char, envp: *const *mut c_char) -> c_int; pub fn fdatasync(fd: c_int) -> c_int; pub fn getdomainname(name: *mut c_char, len: size_t) -> c_int; @@ -2349,7 +2392,7 @@ extern "C" { ) -> c_int; pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> c_int; - pub fn pthread_sigqueue(thread: *mut pthread_t, sig: c_int, value: sigval) -> c_int; + pub fn pthread_sigqueue(thread: pthread_t, sig: c_int, value: sigval) -> c_int; pub fn ioctl(fd: c_int, request: c_int, ...) -> c_int; @@ -2472,4 +2515,11 @@ extern "C" { result: *mut *mut crate::group, ) -> c_int; pub fn initgroups(user: *const c_char, group: crate::gid_t) -> c_int; + + pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int; + pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int; + + pub fn posix_fadvise(fd: c_int, offset: off_t, len: off_t, advise: c_int) -> c_int; + pub fn posix_fallocate(fd: c_int, offset: off_t, len: off_t) -> c_int; + pub fn fallocate(fd: c_int, mode: c_int, offset: off_t, len: off_t) -> c_int; } diff --git a/src/unix/linux_like/android/b64/mod.rs b/src/unix/linux_like/android/b64/mod.rs index cc407e113f67a..b507dac7a1227 100644 --- a/src/unix/linux_like/android/b64/mod.rs +++ b/src/unix/linux_like/android/b64/mod.rs @@ -305,7 +305,6 @@ f! { } extern "C" { - pub fn getauxval(type_: c_ulong) -> c_ulong; pub fn __system_property_wait( pi: *const crate::prop_info, __old_serial: u32, diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 330438feb4d76..7d2f4f1327091 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -1985,6 +1985,12 @@ pub const NLM_F_EXCL: c_int = 0x200; pub const NLM_F_CREATE: c_int = 0x400; pub const NLM_F_APPEND: c_int = 0x800; +pub const NLM_F_NONREC: c_int = 0x100; +pub const NLM_F_BULK: c_int = 0x200; + +pub const NLM_F_CAPPED: c_int = 0x100; +pub const NLM_F_ACK_TLVS: c_int = 0x200; + pub const NLMSG_NOOP: c_int = 0x1; pub const NLMSG_ERROR: c_int = 0x2; pub const NLMSG_DONE: c_int = 0x3; @@ -2194,18 +2200,22 @@ pub const GRND_NONBLOCK: c_uint = 0x0001; pub const GRND_RANDOM: c_uint = 0x0002; pub const GRND_INSECURE: c_uint = 0x0004; +// pub const SECCOMP_MODE_DISABLED: c_uint = 0; pub const SECCOMP_MODE_STRICT: c_uint = 1; pub const SECCOMP_MODE_FILTER: c_uint = 2; -pub const SECCOMP_FILTER_FLAG_TSYNC: c_ulong = 1; -pub const SECCOMP_FILTER_FLAG_LOG: c_ulong = 2; -pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: c_ulong = 4; -pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: c_ulong = 8; +pub const SECCOMP_SET_MODE_STRICT: c_uint = 0; +pub const SECCOMP_SET_MODE_FILTER: c_uint = 1; +pub const SECCOMP_GET_ACTION_AVAIL: c_uint = 2; +pub const SECCOMP_GET_NOTIF_SIZES: c_uint = 3; -pub const SECCOMP_RET_ACTION_FULL: c_uint = 0xffff0000; -pub const SECCOMP_RET_ACTION: c_uint = 0x7fff0000; -pub const SECCOMP_RET_DATA: c_uint = 0x0000ffff; +pub const SECCOMP_FILTER_FLAG_TSYNC: c_ulong = 1 << 0; +pub const SECCOMP_FILTER_FLAG_LOG: c_ulong = 1 << 1; +pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: c_ulong = 1 << 2; +pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: c_ulong = 1 << 3; +pub const SECCOMP_FILTER_FLAG_TSYNC_ESRCH: c_ulong = 1 << 4; +pub const SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV: c_ulong = 1 << 5; pub const SECCOMP_RET_KILL_PROCESS: c_uint = 0x80000000; pub const SECCOMP_RET_KILL_THREAD: c_uint = 0x00000000; @@ -2217,6 +2227,15 @@ pub const SECCOMP_RET_TRACE: c_uint = 0x7ff00000; pub const SECCOMP_RET_LOG: c_uint = 0x7ffc0000; pub const SECCOMP_RET_ALLOW: c_uint = 0x7fff0000; +pub const SECCOMP_RET_ACTION_FULL: c_uint = 0xffff0000; +pub const SECCOMP_RET_ACTION: c_uint = 0x7fff0000; +pub const SECCOMP_RET_DATA: c_uint = 0x0000ffff; + +pub const SECCOMP_USER_NOTIF_FLAG_CONTINUE: c_ulong = 1; + +pub const SECCOMP_ADDFD_FLAG_SETFD: c_ulong = 1; +pub const SECCOMP_ADDFD_FLAG_SEND: c_ulong = 2; + pub const NLA_F_NESTED: c_int = 1 << 15; pub const NLA_F_NET_BYTEORDER: c_int = 1 << 14; pub const NLA_TYPE_MASK: c_int = !(NLA_F_NESTED | NLA_F_NET_BYTEORDER); @@ -4066,6 +4085,8 @@ extern "C" { pub fn gettid() -> crate::pid_t; + pub fn getauxval(type_: c_ulong) -> c_ulong; + /// Only available in API Version 28+ 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; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index c2737f8d89096..17d99962eeee9 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -966,6 +966,14 @@ s! { pub rec_seq: [c_uchar; TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE], } + pub struct tls12_crypto_info_aes_ccm_128 { + pub info: tls_crypto_info, + pub iv: [c_uchar; TLS_CIPHER_AES_CCM_128_IV_SIZE], + pub key: [c_uchar; TLS_CIPHER_AES_CCM_128_KEY_SIZE], + pub salt: [c_uchar; TLS_CIPHER_AES_CCM_128_SALT_SIZE], + pub rec_seq: [c_uchar; TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE], + } + pub struct tls12_crypto_info_chacha20_poly1305 { pub info: tls_crypto_info, pub iv: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE], @@ -974,6 +982,38 @@ s! { pub rec_seq: [c_uchar; TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE], } + pub struct tls12_crypto_info_sm4_gcm { + pub info: tls_crypto_info, + pub iv: [c_uchar; TLS_CIPHER_SM4_GCM_IV_SIZE], + pub key: [c_uchar; TLS_CIPHER_SM4_GCM_KEY_SIZE], + pub salt: [c_uchar; TLS_CIPHER_SM4_GCM_SALT_SIZE], + pub rec_seq: [c_uchar; TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_sm4_ccm { + pub info: tls_crypto_info, + pub iv: [c_uchar; TLS_CIPHER_SM4_CCM_IV_SIZE], + pub key: [c_uchar; TLS_CIPHER_SM4_CCM_KEY_SIZE], + pub salt: [c_uchar; TLS_CIPHER_SM4_CCM_SALT_SIZE], + pub rec_seq: [c_uchar; TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_aria_gcm_128 { + pub info: tls_crypto_info, + pub iv: [c_uchar; TLS_CIPHER_ARIA_GCM_128_IV_SIZE], + pub key: [c_uchar; TLS_CIPHER_ARIA_GCM_128_KEY_SIZE], + pub salt: [c_uchar; TLS_CIPHER_ARIA_GCM_128_SALT_SIZE], + pub rec_seq: [c_uchar; TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE], + } + + pub struct tls12_crypto_info_aria_gcm_256 { + pub info: tls_crypto_info, + pub iv: [c_uchar; TLS_CIPHER_ARIA_GCM_256_IV_SIZE], + pub key: [c_uchar; TLS_CIPHER_ARIA_GCM_256_KEY_SIZE], + pub salt: [c_uchar; TLS_CIPHER_ARIA_GCM_256_SALT_SIZE], + pub rec_seq: [c_uchar; TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE], + } + // linux/wireless.h pub struct iw_param { @@ -3285,18 +3325,19 @@ pub const SECCOMP_SET_MODE_FILTER: c_uint = 1; pub const SECCOMP_GET_ACTION_AVAIL: c_uint = 2; pub const SECCOMP_GET_NOTIF_SIZES: c_uint = 3; -pub const SECCOMP_FILTER_FLAG_TSYNC: c_ulong = 1; -pub const SECCOMP_FILTER_FLAG_LOG: c_ulong = 2; -pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: c_ulong = 4; -pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: c_ulong = 8; -pub const SECCOMP_FILTER_FLAG_TSYNC_ESRCH: c_ulong = 16; -pub const SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV: c_ulong = 32; +pub const SECCOMP_FILTER_FLAG_TSYNC: c_ulong = 1 << 0; +pub const SECCOMP_FILTER_FLAG_LOG: c_ulong = 1 << 1; +pub const SECCOMP_FILTER_FLAG_SPEC_ALLOW: c_ulong = 1 << 2; +pub const SECCOMP_FILTER_FLAG_NEW_LISTENER: c_ulong = 1 << 3; +pub const SECCOMP_FILTER_FLAG_TSYNC_ESRCH: c_ulong = 1 << 4; +pub const SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV: c_ulong = 1 << 5; pub const SECCOMP_RET_KILL_PROCESS: c_uint = 0x80000000; pub const SECCOMP_RET_KILL_THREAD: c_uint = 0x00000000; pub const SECCOMP_RET_KILL: c_uint = SECCOMP_RET_KILL_THREAD; pub const SECCOMP_RET_TRAP: c_uint = 0x00030000; pub const SECCOMP_RET_ERRNO: c_uint = 0x00050000; +pub const SECCOMP_RET_USER_NOTIF: c_uint = 0x7fc00000; pub const SECCOMP_RET_TRACE: c_uint = 0x7ff00000; pub const SECCOMP_RET_LOG: c_uint = 0x7ffc0000; pub const SECCOMP_RET_ALLOW: c_uint = 0x7fff0000; @@ -3451,6 +3492,12 @@ pub const BPF_JSET: __u32 = 0x40; pub const BPF_K: __u32 = 0x00; pub const BPF_X: __u32 = 0x08; +// linux/filter.h + +pub const BPF_A: __u32 = 0x10; +pub const BPF_TAX: __u32 = 0x00; +pub const BPF_TXA: __u32 = 0x80; + // linux/openat2.h pub const RESOLVE_NO_XDEV: crate::__u64 = 0x01; pub const RESOLVE_NO_MAGICLINKS: crate::__u64 = 0x02; @@ -4419,6 +4466,12 @@ pub const NLM_F_EXCL: c_int = 0x200; pub const NLM_F_CREATE: c_int = 0x400; pub const NLM_F_APPEND: c_int = 0x800; +pub const NLM_F_NONREC: c_int = 0x100; +pub const NLM_F_BULK: c_int = 0x200; + +pub const NLM_F_CAPPED: c_int = 0x100; +pub const NLM_F_ACK_TLVS: c_int = 0x200; + pub const NETLINK_ADD_MEMBERSHIP: c_int = 1; pub const NETLINK_DROP_MEMBERSHIP: c_int = 2; pub const NETLINK_PKTINFO: c_int = 3; @@ -4714,6 +4767,9 @@ pub const PTP_PF_PHYSYNC: c_uint = 3; pub const TLS_TX: c_int = 1; pub const TLS_RX: c_int = 2; +pub const TLS_TX_ZEROCOPY_RO: c_int = 3; +pub const TLS_RX_EXPECT_NO_PAD: c_int = 4; + pub const TLS_1_2_VERSION_MAJOR: __u8 = 0x3; pub const TLS_1_2_VERSION_MINOR: __u8 = 0x3; pub const TLS_1_2_VERSION: __u16 = @@ -4738,6 +4794,13 @@ pub const TLS_CIPHER_AES_GCM_256_SALT_SIZE: usize = 4; pub const TLS_CIPHER_AES_GCM_256_TAG_SIZE: usize = 16; pub const TLS_CIPHER_AES_GCM_256_REC_SEQ_SIZE: usize = 8; +pub const TLS_CIPHER_AES_CCM_128: __u16 = 53; +pub const TLS_CIPHER_AES_CCM_128_IV_SIZE: usize = 8; +pub const TLS_CIPHER_AES_CCM_128_KEY_SIZE: usize = 16; +pub const TLS_CIPHER_AES_CCM_128_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_AES_CCM_128_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_AES_CCM_128_REC_SEQ_SIZE: usize = 8; + pub const TLS_CIPHER_CHACHA20_POLY1305: __u16 = 54; pub const TLS_CIPHER_CHACHA20_POLY1305_IV_SIZE: usize = 12; pub const TLS_CIPHER_CHACHA20_POLY1305_KEY_SIZE: usize = 32; @@ -4745,11 +4808,53 @@ pub const TLS_CIPHER_CHACHA20_POLY1305_SALT_SIZE: usize = 0; pub const TLS_CIPHER_CHACHA20_POLY1305_TAG_SIZE: usize = 16; pub const TLS_CIPHER_CHACHA20_POLY1305_REC_SEQ_SIZE: usize = 8; +pub const TLS_CIPHER_SM4_GCM: __u16 = 55; +pub const TLS_CIPHER_SM4_GCM_IV_SIZE: usize = 8; +pub const TLS_CIPHER_SM4_GCM_KEY_SIZE: usize = 16; +pub const TLS_CIPHER_SM4_GCM_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_SM4_GCM_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_SM4_GCM_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_SM4_CCM: __u16 = 56; +pub const TLS_CIPHER_SM4_CCM_IV_SIZE: usize = 8; +pub const TLS_CIPHER_SM4_CCM_KEY_SIZE: usize = 16; +pub const TLS_CIPHER_SM4_CCM_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_SM4_CCM_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_SM4_CCM_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_ARIA_GCM_128: __u16 = 57; +pub const TLS_CIPHER_ARIA_GCM_128_IV_SIZE: usize = 8; +pub const TLS_CIPHER_ARIA_GCM_128_KEY_SIZE: usize = 16; +pub const TLS_CIPHER_ARIA_GCM_128_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_ARIA_GCM_128_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_ARIA_GCM_128_REC_SEQ_SIZE: usize = 8; + +pub const TLS_CIPHER_ARIA_GCM_256: __u16 = 58; +pub const TLS_CIPHER_ARIA_GCM_256_IV_SIZE: usize = 8; +pub const TLS_CIPHER_ARIA_GCM_256_KEY_SIZE: usize = 32; +pub const TLS_CIPHER_ARIA_GCM_256_SALT_SIZE: usize = 4; +pub const TLS_CIPHER_ARIA_GCM_256_TAG_SIZE: usize = 16; +pub const TLS_CIPHER_ARIA_GCM_256_REC_SEQ_SIZE: usize = 8; + pub const TLS_SET_RECORD_TYPE: c_int = 1; pub const TLS_GET_RECORD_TYPE: c_int = 2; pub const SOL_TLS: c_int = 282; +// enum +pub const TLS_INFO_UNSPEC: c_int = 0x00; +pub const TLS_INFO_VERSION: c_int = 0x01; +pub const TLS_INFO_CIPHER: c_int = 0x02; +pub const TLS_INFO_TXCONF: c_int = 0x03; +pub const TLS_INFO_RXCONF: c_int = 0x04; +pub const TLS_INFO_ZC_RO_TX: c_int = 0x05; +pub const TLS_INFO_RX_NO_PAD: c_int = 0x06; + +pub const TLS_CONF_BASE: c_int = 1; +pub const TLS_CONF_SW: c_int = 2; +pub const TLS_CONF_HW: c_int = 3; +pub const TLS_CONF_HW_RECORD: c_int = 4; + // linux/if_alg.h pub const ALG_SET_KEY: c_int = 1; pub const ALG_SET_IV: c_int = 2; @@ -5092,6 +5197,13 @@ pub const FF_MAX: __u16 = 0x7f; pub const FF_CNT: usize = FF_MAX as usize + 1; // linux/input-event-codes.h +pub const INPUT_PROP_POINTER: __u16 = 0x00; +pub const INPUT_PROP_DIRECT: __u16 = 0x01; +pub const INPUT_PROP_BUTTONPAD: __u16 = 0x02; +pub const INPUT_PROP_SEMI_MT: __u16 = 0x03; +pub const INPUT_PROP_TOPBUTTONPAD: __u16 = 0x04; +pub const INPUT_PROP_POINTING_STICK: __u16 = 0x05; +pub const INPUT_PROP_ACCELEROMETER: __u16 = 0x06; pub const INPUT_PROP_MAX: __u16 = 0x1f; pub const INPUT_PROP_CNT: usize = INPUT_PROP_MAX as usize + 1; pub const EV_MAX: __u16 = 0x1f; @@ -5933,22 +6045,22 @@ const fn _IOC(dir: u32, ty: u32, nr: u32, size: usize) -> u32 { } /// Build an ioctl number for an argumentless ioctl. -pub(crate) const fn _IO(ty: u32, nr: u32) -> u32 { +pub const fn _IO(ty: u32, nr: u32) -> u32 { _IOC(_IOC_NONE, ty, nr, 0) } /// Build an ioctl number for an read-only ioctl. -pub(crate) const fn _IOR(ty: u32, nr: u32) -> u32 { +pub const fn _IOR(ty: u32, nr: u32) -> u32 { _IOC(_IOC_READ, ty, nr, size_of::()) } /// Build an ioctl number for an write-only ioctl. -pub(crate) const fn _IOW(ty: u32, nr: u32) -> u32 { +pub const fn _IOW(ty: u32, nr: u32) -> u32 { _IOC(_IOC_WRITE, ty, nr, size_of::()) } /// Build an ioctl number for a read-write ioctl. -pub(crate) const fn _IOWR(ty: u32, nr: u32) -> u32 { +pub const fn _IOWR(ty: u32, nr: u32) -> u32 { _IOC(_IOC_READ | _IOC_WRITE, ty, nr, size_of::()) } @@ -6063,6 +6175,26 @@ f! { (x + TPACKET_ALIGNMENT - 1) & !(TPACKET_ALIGNMENT - 1) } + pub fn BPF_CLASS(code: __u32) -> __u32 { + code & 0x07 + } + + pub fn BPF_SIZE(code: __u32) -> __u32 { + code & 0x18 + } + + pub fn BPF_MODE(code: __u32) -> __u32 { + code & 0xe0 + } + + pub fn BPF_OP(code: __u32) -> __u32 { + code & 0xf0 + } + + pub fn BPF_SRC(code: __u32) -> __u32 { + code & 0x08 + } + pub fn BPF_RVAL(code: __u32) -> __u32 { code & 0x18 } diff --git a/src/unix/linux_like/linux/musl/b32/arm/mod.rs b/src/unix/linux_like/linux/musl/b32/arm/mod.rs index ad74ecfcb2bda..292585fc3a77a 100644 --- a/src/unix/linux_like/linux/musl/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/arm/mod.rs @@ -795,7 +795,3 @@ 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_mseal: c_long = 462; - -extern "C" { - pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; -} diff --git a/src/unix/linux_like/linux/musl/b32/powerpc.rs b/src/unix/linux_like/linux/musl/b32/powerpc.rs index 7d7124a7c7e1c..0de40b15094bc 100644 --- a/src/unix/linux_like/linux/musl/b32/powerpc.rs +++ b/src/unix/linux_like/linux/musl/b32/powerpc.rs @@ -745,7 +745,3 @@ 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_mseal: c_long = 462; - -extern "C" { - pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; -} diff --git a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs index 1a4ab1c65502d..9c0525cb167b2 100644 --- a/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs @@ -111,7 +111,6 @@ s_no_extra_traits! { //pub const RLIM_INFINITY: crate::rlim_t = !0; pub const VEOF: usize = 4; -pub const RTLD_DEEPBIND: c_int = 0x8; //pub const RLIMIT_RSS: crate::__rlimit_resource_t = 5; //pub const RLIMIT_AS: crate::__rlimit_resource_t = 9; //pub const RLIMIT_MEMLOCK: crate::__rlimit_resource_t = 8; @@ -125,7 +124,6 @@ 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_FSYNC: c_int = 1052672; pub const MAP_GROWSDOWN: c_int = 256; pub const EDEADLK: c_int = 35; pub const ENAMETOOLONG: c_int = 36; @@ -209,7 +207,7 @@ pub const ERFKILL: c_int = 132; pub const SOCK_STREAM: c_int = 1; pub const SOCK_DGRAM: c_int = 2; -pub const SA_ONSTACK: c_int = 8; +pub const SA_ONSTACK: c_int = 0x08000000; pub const SA_SIGINFO: c_int = 4; pub const SA_NOCLDWAIT: c_int = 2; pub const SIGTTIN: c_int = 21; @@ -346,7 +344,7 @@ pub const EXTPROC: crate::tcflag_t = 65536; pub const SYS_read: c_long = 63; pub const SYS_write: c_long = 64; pub const SYS_close: c_long = 57; -pub const SYS_fstat: c_long = 80; +// RISC-V don't have SYS_fstat, use statx instead. pub const SYS_lseek: c_long = 62; pub const SYS_mmap: c_long = 222; pub const SYS_mprotect: c_long = 226; @@ -369,7 +367,6 @@ pub const SYS_shmget: c_long = 194; pub const SYS_shmat: c_long = 196; pub const SYS_shmctl: c_long = 195; pub const SYS_dup: c_long = 23; -pub const SYS_nanosleep: c_long = 101; pub const SYS_getitimer: c_long = 102; pub const SYS_setitimer: c_long = 103; pub const SYS_getpid: c_long = 172; @@ -392,7 +389,7 @@ pub const SYS_getsockopt: c_long = 209; pub const SYS_clone: c_long = 220; pub const SYS_execve: c_long = 221; pub const SYS_exit: c_long = 93; -pub const SYS_wait4: c_long = 260; +// RISC-V don't have wait4, use waitid instead. pub const SYS_kill: c_long = 129; pub const SYS_uname: c_long = 160; pub const SYS_semget: c_long = 190; @@ -415,8 +412,8 @@ pub const SYS_fchdir: c_long = 50; pub const SYS_fchmod: c_long = 52; pub const SYS_fchown: c_long = 55; pub const SYS_umask: c_long = 166; -pub const SYS_gettimeofday: c_long = 169; -pub const SYS_getrlimit: c_long = 163; +// RISC-V don't have gettimeofday, use clock_gettime64 instead. +// RISC-V don't have getrlimit, use prlimit64 instead. pub const SYS_getrusage: c_long = 165; pub const SYS_sysinfo: c_long = 179; pub const SYS_times: c_long = 153; @@ -446,7 +443,7 @@ pub const SYS_getsid: c_long = 156; pub const SYS_capget: c_long = 90; pub const SYS_capset: c_long = 91; pub const SYS_rt_sigpending: c_long = 136; -pub const SYS_rt_sigtimedwait: c_long = 137; +pub const SYS_rt_sigtimedwait_time64: c_long = 421; pub const SYS_rt_sigqueueinfo: c_long = 138; pub const SYS_rt_sigsuspend: c_long = 133; pub const SYS_sigaltstack: c_long = 132; @@ -461,7 +458,7 @@ pub const SYS_sched_setscheduler: c_long = 119; pub const SYS_sched_getscheduler: c_long = 120; 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_sched_rr_get_interval_time64: c_long = 423; pub const SYS_mlock: c_long = 228; pub const SYS_munlock: c_long = 229; pub const SYS_mlockall: c_long = 230; @@ -469,12 +466,11 @@ pub const SYS_munlockall: c_long = 231; pub const SYS_vhangup: c_long = 58; pub const SYS_pivot_root: c_long = 41; pub const SYS_prctl: c_long = 167; -pub const SYS_adjtimex: c_long = 171; -pub const SYS_setrlimit: c_long = 164; +// RISC-V don't have setrlimit, use prlimit64 instead. pub const SYS_chroot: c_long = 51; pub const SYS_sync: c_long = 81; pub const SYS_acct: c_long = 89; -pub const SYS_settimeofday: c_long = 170; +// RISC-V don't have settimeofday, use clock_settime64 instead. pub const SYS_mount: c_long = 40; pub const SYS_umount2: c_long = 39; pub const SYS_swapon: c_long = 224; @@ -501,12 +497,12 @@ pub const SYS_removexattr: c_long = 14; pub const SYS_lremovexattr: c_long = 15; pub const SYS_fremovexattr: c_long = 16; pub const SYS_tkill: c_long = 130; -pub const SYS_futex: c_long = 98; +pub const SYS_futex_time64: c_long = 422; pub const SYS_sched_setaffinity: c_long = 122; pub const SYS_sched_getaffinity: c_long = 123; pub const SYS_io_setup: c_long = 0; pub const SYS_io_destroy: c_long = 1; -pub const SYS_io_getevents: c_long = 4; +pub const SYS_io_pgetevents_time64: c_long = 416; pub const SYS_io_submit: c_long = 2; pub const SYS_io_cancel: c_long = 3; pub const SYS_lookup_dcookie: c_long = 18; @@ -514,17 +510,17 @@ pub const SYS_remap_file_pages: c_long = 234; pub const SYS_getdents64: c_long = 61; pub const SYS_set_tid_address: c_long = 96; pub const SYS_restart_syscall: c_long = 128; -pub const SYS_semtimedop: c_long = 192; +pub const SYS_semtimedop_time64: c_long = 420; pub const SYS_fadvise64: c_long = 223; pub const SYS_timer_create: c_long = 107; -pub const SYS_timer_settime: c_long = 110; -pub const SYS_timer_gettime: c_long = 108; +pub const SYS_timer_settime64: c_long = 409; +pub const SYS_timer_gettime64: c_long = 408; pub const SYS_timer_getoverrun: c_long = 109; 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_clock_settime64: c_long = 404; +pub const SYS_clock_gettime64: c_long = 403; +pub const SYS_clock_getres_time64: c_long = 406; +pub const SYS_clock_nanosleep_time64: c_long = 407; pub const SYS_exit_group: c_long = 94; pub const SYS_epoll_ctl: c_long = 21; pub const SYS_tgkill: c_long = 131; @@ -533,8 +529,8 @@ pub const SYS_set_mempolicy: c_long = 237; pub const SYS_get_mempolicy: c_long = 236; 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_timedsend_time64: c_long = 418; +pub const SYS_mq_timedreceive_time64: c_long = 419; pub const SYS_mq_notify: c_long = 184; pub const SYS_mq_getsetattr: c_long = 185; pub const SYS_kexec_load: c_long = 104; @@ -551,15 +547,15 @@ pub const SYS_openat: c_long = 56; pub const SYS_mkdirat: c_long = 34; pub const SYS_mknodat: c_long = 33; pub const SYS_fchownat: c_long = 54; -pub const SYS_newfstatat: c_long = 79; +// RISC-V don't have newfstatat, use statx instead. pub const SYS_unlinkat: c_long = 35; pub const SYS_linkat: c_long = 37; pub const SYS_symlinkat: c_long = 36; pub const SYS_readlinkat: c_long = 78; pub const SYS_fchmodat: c_long = 53; pub const SYS_faccessat: c_long = 48; -pub const SYS_pselect6: c_long = 72; -pub const SYS_ppoll: c_long = 73; +pub const SYS_pselect6_time64: c_long = 413; +pub const SYS_ppoll_time64: c_long = 414; pub const SYS_unshare: c_long = 97; pub const SYS_set_robust_list: c_long = 99; pub const SYS_get_robust_list: c_long = 100; @@ -568,12 +564,12 @@ pub const SYS_tee: c_long = 77; pub const SYS_sync_file_range: c_long = 84; pub const SYS_vmsplice: c_long = 75; pub const SYS_move_pages: c_long = 239; -pub const SYS_utimensat: c_long = 88; +pub const SYS_utimensat_time64: c_long = 412; pub const SYS_epoll_pwait: c_long = 22; pub const SYS_timerfd_create: c_long = 85; pub const SYS_fallocate: c_long = 47; -pub const SYS_timerfd_settime: c_long = 86; -pub const SYS_timerfd_gettime: c_long = 87; +pub const SYS_timerfd_settime64: c_long = 411; +pub const SYS_timerfd_gettime64: c_long = 410; pub const SYS_accept4: c_long = 242; pub const SYS_signalfd4: c_long = 74; pub const SYS_eventfd2: c_long = 19; @@ -585,13 +581,13 @@ pub const SYS_preadv: c_long = 69; pub const SYS_pwritev: c_long = 70; pub const SYS_rt_tgsigqueueinfo: c_long = 240; pub const SYS_perf_event_open: c_long = 241; -pub const SYS_recvmmsg: c_long = 243; +pub const SYS_recvmmsg_time64: c_long = 417; pub const SYS_fanotify_init: c_long = 262; pub const SYS_fanotify_mark: c_long = 263; pub const SYS_prlimit64: c_long = 261; 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_clock_adjtime64: c_long = 405; pub const SYS_syncfs: c_long = 267; pub const SYS_sendmmsg: c_long = 269; pub const SYS_setns: c_long = 268; diff --git a/src/unix/linux_like/linux/musl/b32/x86/mod.rs b/src/unix/linux_like/linux/musl/b32/x86/mod.rs index a01dca67c8b89..22befbb0b71a5 100644 --- a/src/unix/linux_like/linux/musl/b32/x86/mod.rs +++ b/src/unix/linux_like/linux/musl/b32/x86/mod.rs @@ -913,7 +913,3 @@ pub const CS: c_int = 13; pub const EFL: c_int = 14; pub const UESP: c_int = 15; pub const SS: c_int = 16; - -extern "C" { - pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; -} diff --git a/src/unix/linux_like/linux/musl/b64/mod.rs b/src/unix/linux_like/linux/musl/b64/mod.rs index 6ae3c39724af8..6b6761ba03ac4 100644 --- a/src/unix/linux_like/linux/musl/b64/mod.rs +++ b/src/unix/linux_like/linux/musl/b64/mod.rs @@ -81,10 +81,6 @@ pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56; pub const __SIZEOF_PTHREAD_MUTEX_T: usize = 40; pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32; -extern "C" { - pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; -} - cfg_if! { if #[cfg(target_arch = "aarch64")] { mod aarch64; diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 57109e920b67d..40ca6d82d1690 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -971,6 +971,9 @@ extern "C" { pub fn dirname(path: *mut c_char) -> *mut c_char; pub fn basename(path: *mut c_char) -> *mut c_char; + // Addded in `musl` 1.1.20 + pub fn getrandom(buf: *mut c_void, buflen: size_t, flags: c_uint) -> ssize_t; + // Added in `musl` 1.1.24 pub fn posix_spawn_file_actions_addchdir_np( actions: *mut crate::posix_spawn_file_actions_t, diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 272f3c4e223b2..b7a34dd3b6716 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -114,6 +114,42 @@ s! { pub struct pthread_condattr_t { size: [u8; crate::__SIZEOF_PTHREAD_CONDATTR_T], } + + pub struct tcp_info { + pub tcpi_state: u8, + pub tcpi_ca_state: u8, + pub tcpi_retransmits: u8, + pub tcpi_probes: u8, + pub tcpi_backoff: u8, + pub tcpi_options: u8, + /// This contains the bitfields `tcpi_snd_wscale` and `tcpi_rcv_wscale`. + /// Each is 4 bits. + pub tcpi_snd_rcv_wscale: u8, + pub tcpi_rto: u32, + pub tcpi_ato: u32, + pub tcpi_snd_mss: u32, + pub tcpi_rcv_mss: u32, + pub tcpi_unacked: u32, + pub tcpi_sacked: u32, + pub tcpi_lost: u32, + pub tcpi_retrans: u32, + pub tcpi_fackets: u32, + pub tcpi_last_data_sent: u32, + pub tcpi_last_ack_sent: u32, + pub tcpi_last_data_recv: u32, + pub tcpi_last_ack_recv: u32, + pub tcpi_pmtu: u32, + pub tcpi_rcv_ssthresh: u32, + pub tcpi_rtt: u32, + pub tcpi_rttvar: u32, + pub tcpi_snd_ssthresh: u32, + pub tcpi_snd_cwnd: u32, + pub tcpi_advmss: u32, + pub tcpi_reordering: u32, + pub tcpi_rcv_rtt: u32, + pub tcpi_rcv_space: u32, + pub tcpi_total_retrans: u32, + } } impl siginfo_t { diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index b3e6281f48d28..875814dcc08e1 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -1784,6 +1784,11 @@ extern "C" { stackaddr: *mut *mut c_void, stacksize: *mut size_t, ) -> c_int; + pub fn pthread_attr_setstack( + attr: *mut crate::pthread_attr_t, + stackaddr: *mut c_void, + stacksize: size_t, + ) -> c_int; pub fn memalign(align: size_t, size: size_t) -> *mut c_void; pub fn setgroups(ngroups: size_t, ptr: *const crate::gid_t) -> c_int; pub fn pipe2(fds: *mut c_int, flags: c_int) -> c_int; diff --git a/src/unix/mod.rs b/src/unix/mod.rs index b2de87ebf8477..32af26a8a4056 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -351,6 +351,7 @@ cfg_if! { target_os = "freebsd", target_os = "android", target_os = "openbsd", + target_os = "cygwin", ))] { pub const FNM_PATHNAME: c_int = 1 << 1; pub const FNM_NOESCAPE: c_int = 1 << 0; diff --git a/src/unix/nuttx/mod.rs b/src/unix/nuttx/mod.rs index 8446eafaf19e6..015a2ba9afbd0 100644 --- a/src/unix/nuttx/mod.rs +++ b/src/unix/nuttx/mod.rs @@ -517,7 +517,39 @@ pub const _SC_THREAD_STACK_MIN: i32 = 0x58; pub const _SC_GETPW_R_SIZE_MAX: i32 = 0x25; // signal.h -pub const SIGPIPE: i32 = 13; +pub const SIGHUP: c_int = 1; +pub const SIGINT: c_int = 2; +pub const SIGQUIT: c_int = 3; +pub const SIGILL: c_int = 4; +pub const SIGTRAP: c_int = 5; +pub const SIGABRT: c_int = 6; +pub const SIGIOT: c_int = 6; +pub const SIGBUS: c_int = 7; +pub const SIGFPE: c_int = 8; +pub const SIGKILL: c_int = 9; +pub const SIGUSR1: c_int = 10; +pub const SIGSEGV: c_int = 11; +pub const SIGUSR2: c_int = 12; +pub const SIGPIPE: c_int = 13; +pub const SIGALRM: c_int = 14; +pub const SIGTERM: c_int = 15; +pub const SIGSTKFLT: c_int = 16; +pub const SIGCHLD: c_int = 17; +pub const SIGCONT: c_int = 18; +pub const SIGSTOP: c_int = 19; +pub const SIGTSTP: c_int = 20; +pub const SIGTTIN: c_int = 21; +pub const SIGTTOU: c_int = 22; +pub const SIGURG: c_int = 23; +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 SIGIO: c_int = 29; +pub const SIGPOLL: c_int = SIGIO; +pub const SIGPWR: c_int = 30; +pub const SIGSYS: c_int = 31; // pthread.h pub const PTHREAD_MUTEX_NORMAL: i32 = 0; diff --git a/src/unix/solarish/compat.rs b/src/unix/solarish/compat.rs index 8fd1c750a62cf..649d6ac9a1536 100644 --- a/src/unix/solarish/compat.rs +++ b/src/unix/solarish/compat.rs @@ -53,6 +53,7 @@ unsafe fn bail(fdm: c_int, fds: c_int) -> c_int { return -1; } +#[cfg(target_os = "illumos")] pub unsafe fn openpty( amain: *mut c_int, asubord: *mut c_int, @@ -123,6 +124,7 @@ pub unsafe fn openpty( 0 } +#[cfg(target_os = "illumos")] pub unsafe fn forkpty( amain: *mut c_int, name: *mut c_char, diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index caa3f27b3cb35..3cb68e4d6fca4 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -286,6 +286,12 @@ pub const B4000000: crate::speed_t = 31; // sys/systeminfo.h pub const SI_ADDRESS_WIDTH: c_int = 520; +// sys/timerfd.h +pub const TFD_CLOEXEC: i32 = 0o2000000; +pub const TFD_NONBLOCK: i32 = 0o4000; +pub const TFD_TIMER_ABSTIME: i32 = 1 << 0; +pub const TFD_TIMER_CANCEL_ON_SET: i32 = 1 << 1; + extern "C" { pub fn eventfd(init: c_uint, flags: c_int) -> c_int; @@ -353,4 +359,13 @@ extern "C" { n: size_t, loc: crate::locale_t, ) -> c_int; + + pub fn timerfd_create(clockid: c_int, flags: c_int) -> c_int; + pub fn timerfd_gettime(fd: c_int, curr_value: *mut crate::itimerspec) -> c_int; + pub fn timerfd_settime( + fd: c_int, + flags: c_int, + new_value: *const crate::itimerspec, + old_value: *mut crate::itimerspec, + ) -> c_int; } diff --git a/src/unix/solarish/mod.rs b/src/unix/solarish/mod.rs index 65aaccec2ba96..3ddde8da0c407 100644 --- a/src/unix/solarish/mod.rs +++ b/src/unix/solarish/mod.rs @@ -3201,6 +3201,8 @@ extern "C" { pub fn arc4random() -> u32; pub fn arc4random_buf(buf: *mut c_void, nbytes: size_t); pub fn arc4random_uniform(upper_bound: u32) -> u32; + + pub fn secure_getenv(name: *const c_char) -> *mut c_char; } #[link(name = "sendfile")] diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index d0304082dac8b..4c6a5bd489604 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -1,7 +1,7 @@ use crate::prelude::*; use crate::{ exit_status, off_t, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, - PRIV_PFEXEC, PRIV_XPOLICY, + PRIV_PFEXEC, PRIV_XPOLICY, termios, }; pub type door_attr_t = c_uint; @@ -161,6 +161,14 @@ cfg_if! { } } +// FIXME(solaris): O_DIRECT and SIGINFO are NOT available on Solaris. +// But in past they were defined here and thus other crates expected them. +// Latest version v0.29.0 of Nix crate still expects this. Since last +// version of Nix crate is almost one year ago let's define these two +// temporarily before new Nix version is released. +pub const O_DIRECT: c_int = 0x2000000; +pub const SIGINFO: c_int = 41; + pub const _UTMP_USER_LEN: usize = 32; pub const _UTMP_LINE_LEN: usize = 32; pub const _UTMP_ID_LEN: usize = 4; @@ -234,4 +242,19 @@ extern "C" { pub fn pthread_getattr_np(thread: crate::pthread_t, attr: *mut crate::pthread_attr_t) -> c_int; pub fn euidaccess(path: *const c_char, amode: c_int) -> c_int; + + pub fn openpty( + amain: *mut c_int, + asubord: *mut c_int, + name: *mut c_char, + termp: *mut termios, + winp: *mut crate::winsize, + ) -> c_int; + + pub fn forkpty( + amain: *mut c_int, + name: *mut c_char, + termp: *mut termios, + winp: *mut crate::winsize, + ) -> crate::pid_t; } diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index 073b5d07ce6fa..3a44adc7ea5b0 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -410,6 +410,7 @@ s_no_extra_traits! { pub struct dirent { pub d_ino: crate::ino_t, pub d_name: [c_char; _PARM_NAME_MAX as usize + 1], + pub d_type: c_uchar, } pub struct sockaddr_un { @@ -458,6 +459,7 @@ cfg_if! { f.debug_struct("dirent") .field("d_ino", &self.d_ino) .field("d_name", &&self.d_name[..]) + .field("d_type", &self.d_type) .finish() } } @@ -620,6 +622,9 @@ pub const ENODEV: c_int = 19; pub const ENOTDIR: c_int = 20; pub const EISDIR: c_int = 21; pub const EINVAL: c_int = 22; +pub const ENFILE: c_int = 23; +pub const EMFILE: c_int = 24; +pub const ENOTTY: c_int = 25; pub const ENAMETOOLONG: c_int = 26; pub const EFBIG: c_int = 27; pub const ENOSPC: c_int = 28; @@ -628,7 +633,12 @@ pub const EROFS: c_int = 30; pub const EMLINK: c_int = 31; pub const EPIPE: c_int = 32; pub const EDEADLK: c_int = 33; +pub const ENOLCK: c_int = 34; +pub const ENOTSUP: c_int = 35; +pub const EMSGSIZE: c_int = 36; +pub const EDOM: c_int = 37; pub const ERANGE: c_int = 38; +pub const EDOOM: c_int = 39; pub const EDESTADDRREQ: c_int = 40; pub const EPROTOTYPE: c_int = 41; pub const ENOPROTOOPT: c_int = 42; @@ -655,12 +665,30 @@ pub const ENETDOWN: c_int = 62; pub const ETXTBSY: c_int = 63; pub const ELOOP: c_int = 64; pub const EHOSTUNREACH: c_int = 65; +pub const ENOTBLK: c_int = 66; +pub const EHOSTDOWN: c_int = 67; pub const EINPROGRESS: c_int = 68; pub const EALREADY: c_int = 69; pub const EWOULDBLOCK: c_int = 70; pub const ENOSYS: c_int = 71; +pub const ECANCELED: c_int = 72; +pub const ENOSR: c_int = 74; +pub const ENOSTR: c_int = 75; +pub const EPROTO: c_int = 76; +pub const EBADMSG: c_int = 77; +pub const ENODATA: c_int = 78; +pub const ETIME: c_int = 79; +pub const ENOMSG: c_int = 80; +pub const EFPOS: c_int = 81; +pub const EILSEQ: c_int = 82; pub const EDQUOT: c_int = 83; +pub const EIDRM: c_int = 84; +pub const EOVERFLOW: c_int = 85; +pub const EMULTIHOP: c_int = 86; +pub const ENOLINK: c_int = 87; pub const ESTALE: c_int = 88; +pub const EOWNERDEAD: c_int = 89; +pub const ENOTRECOVERABLE: c_int = 90; // NFS errnos: Refer to pkgs_v2/storage/fs/nfs/h/nfs/nfsCommon.h const M_nfsStat: c_int = 48 << 16; @@ -941,11 +969,34 @@ pub const SIGCONT: c_int = 19; pub const SIGCHLD: c_int = 20; pub const SIGTTIN: c_int = 21; pub const SIGTTOU: c_int = 22; +pub const SIGUSR1: c_int = 30; +pub const SIGUSR2: c_int = 31; +pub const SIGPOLL: c_int = 32; +pub const SIGPROF: c_int = 33; +pub const SIGSYS: c_int = 34; +pub const SIGURG: c_int = 35; +pub const SIGVTALRM: c_int = 36; +pub const SIGXCPU: c_int = 37; +pub const SIGXFSZ: c_int = 38; +pub const SIGRTMIN: c_int = 48; + +pub const SIGIO: c_int = SIGRTMIN; +pub const SIGWINCH: c_int = SIGRTMIN + 5; +pub const SIGLOST: c_int = SIGRTMIN + 6; pub const SIG_BLOCK: c_int = 1; pub const SIG_UNBLOCK: c_int = 2; pub const SIG_SETMASK: c_int = 3; +pub const SA_NOCLDSTOP: c_int = 0x0001; +pub const SA_SIGINFO: c_int = 0x0002; +pub const SA_ONSTACK: c_int = 0x0004; +pub const SA_INTERRUPT: c_int = 0x0008; +pub const SA_RESETHAND: c_int = 0x0010; +pub const SA_RESTART: c_int = 0x0020; +pub const SA_NODEFER: c_int = 0x0040; +pub const SA_NOCLDWAIT: c_int = 0x0080; + pub const SI_SYNC: c_int = 0; pub const SI_USER: c_int = -1; pub const SI_QUEUE: c_int = -2; @@ -1231,6 +1282,7 @@ extern "C" { pub fn umask(mask: mode_t) -> mode_t; pub fn mlock(addr: *const c_void, len: size_t) -> c_int; pub fn mlockall(flags: c_int) -> c_int; + pub fn munlock(addr: *const c_void, len: size_t) -> c_int; pub fn munlockall() -> c_int; pub fn mmap( @@ -1242,6 +1294,10 @@ extern "C" { offset: off_t, ) -> *mut c_void; pub fn munmap(addr: *mut c_void, len: size_t) -> c_int; + + pub fn mprotect(addr: *mut c_void, len: size_t, prot: c_int) -> c_int; + pub fn msync(addr: *mut c_void, len: size_t, flags: c_int) -> c_int; + pub fn truncate(path: *const c_char, length: off_t) -> c_int; pub fn shm_open(name: *const c_char, oflag: c_int, mode: crate::mode_t) -> c_int; pub fn shm_unlink(name: *const c_char) -> c_int; @@ -1258,6 +1314,8 @@ extern "C" { pub fn utimes(filename: *const c_char, times: *const crate::timeval) -> c_int; + pub fn futimens(fd: c_int, times: *const crate::timespec) -> c_int; + #[link_name = "_rtld_dlopen"] pub fn dlopen(filename: *const c_char, flag: c_int) -> *mut c_void; @@ -1714,7 +1772,7 @@ extern "C" { pub fn getppid() -> pid_t; // wait.h - pub fn waitpid(pid: pid_t, status: *mut c_int, optons: c_int) -> pid_t; + pub fn waitpid(pid: pid_t, status: *mut c_int, options: c_int) -> pid_t; // unistd.h pub fn sysconf(attr: c_int) -> c_long;