diff --git a/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile b/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile new file mode 100644 index 0000000000000..f868f65573ae6 --- /dev/null +++ b/ci/docker/armv7-unknown-linux-uclibceabihf/Dockerfile @@ -0,0 +1,17 @@ +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc libc6-dev qemu-user ca-certificates qemu-system-arm curl \ + xz-utils patch + +RUN mkdir /toolchain + +RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/armv7-eabihf/tarballs/armv7-eabihf--uclibc--bleeding-edge-2020.08-1.tar.bz2 | \ + tar xjf - -C /toolchain --strip-components=1 +RUN /toolchain/relocate-sdk.sh + +ENV PATH=$PATH:/rust/bin:/toolchain/bin \ + STAGING_DIR=/toolchain/armv7-buildroot-linux-uclibceabihf/sysroot \ + CC_armv7_unknown_linux_uclibc=armv7-buildroot-linux-uclibc-gcc \ + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_LINKER=armv7-buildroot-linux-uclibc-gcc \ + CARGO_TARGET_ARMV7_UNKNOWN_LINUX_UCLIBCEABIHF_RUNNER="qemu-arm -L /toolchain/arm-buildroot-linux-uclibcgnueabihf/sysroot/" diff --git a/ci/docker/mipsel-unknown-linux-uclibc/Dockerfile b/ci/docker/mipsel-unknown-linux-uclibc/Dockerfile new file mode 100644 index 0000000000000..5abb49dbe6681 --- /dev/null +++ b/ci/docker/mipsel-unknown-linux-uclibc/Dockerfile @@ -0,0 +1,22 @@ +FROM ubuntu:20.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc libc6-dev qemu-user ca-certificates qemu-system-mipsel curl \ + xz-utils patch + +RUN mkdir /toolchain + +# binutils 2.33.1 +# gcc 9.3.0 +# gdb 8.3.1 +# linux-headers 4.9.234 +# uclibc 1.0.34 +RUN curl --retry 5 -L https://toolchains.bootlin.com/downloads/releases/toolchains/mips32el/tarballs/mips32el--uclibc--stable-2020.08-1.tar.bz2 | \ + tar xjf - -C /toolchain --strip-components=1 +RUN /toolchain/relocate-sdk.sh + +ENV PATH=$PATH:/rust/bin:/toolchain/bin \ + STAGING_DIR=/toolchain/mipsel-buildroot-linux-uclibc/sysroot \ + CC_mipsel_unknown_linux_uclibc=mipsel-buildroot-linux-uclibc-gcc \ + CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_UCLIBC_LINKER=mipsel-buildroot-linux-uclibc-gcc \ + CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_UCLIBC_RUNNER="qemu-mipsel -L /toolchain/mipsel-buildroot-linux-uclibc/sysroot/" diff --git a/libc-test/build.rs b/libc-test/build.rs index afef1af570bb8..513200988919f 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -2852,6 +2852,34 @@ fn test_linux(target: &str) { | "SW_CNT" if mips || ppc64 || riscv64 || sparc64 => true, + // kernel constants not available in uclibc 1.0.34 + | "ADDR_COMPAT_LAYOUT" + | "ADDR_LIMIT_3GB" + | "ADDR_NO_RANDOMIZE" + | "CLONE_NEWCGROUP" + | "EXTPROC" + | "FAN_MARK_FILESYSTEM" + | "FAN_MARK_INODE" + | "IPPROTO_BEETPH" + | "IPPROTO_MPLS" + | "IPV6_HDRINCL" + | "IPV6_MULTICAST_ALL" + | "IPV6_PMTUDISC_INTERFACE" + | "IPV6_PMTUDISC_OMIT" + | "IPV6_ROUTER_ALERT_ISOLATE" + | "O_TMPFILE" + | "PACKET_MR_UNICAST" + | "PTRACE_EVENT_STOP" + | "PTRACE_O_EXITKILL" + | "PTRACE_O_SUSPEND_SECCOMP" + | "PTRACE_PEEKSIGINFO" + | "READ_IMPLIES_EXEC" + | "RUSAGE_THREAD" + | "SHM_EXEC" + | "UDP_GRO" + | "UDP_SEGMENT" + if uclibc => true, + _ => false, } }); @@ -2929,6 +2957,9 @@ fn test_linux(target: &str) { "reallocarray" if musl => true, + // Not defined in uclibc as of 1.0.34 + "gettid" if uclibc => true, + _ => false, } }); diff --git a/libc-test/semver/linux-gnu.txt b/libc-test/semver/linux-gnu.txt index 83a82521d770d..9eac72d3c5415 100644 --- a/libc-test/semver/linux-gnu.txt +++ b/libc-test/semver/linux-gnu.txt @@ -15,6 +15,11 @@ ADJ_TICK ADJ_TIMECONST AFFS_SUPER_MAGIC AFS_SUPER_MAGIC +AF_MPLS +AF_XDP +AIO_ALLDONE +AIO_CANCELED +AIO_NOTCANCELED AT_STATX_DONT_SYNC AT_STATX_FORCE_SYNC AT_STATX_SYNC_AS_STAT @@ -54,6 +59,8 @@ EMPTY EXT2_SUPER_MAGIC EXT3_SUPER_MAGIC EXT4_SUPER_MAGIC +Elf32_Chdr +Elf64_Chdr F2FS_SUPER_MAGIC FDPIC_FUNCPTRS FUTEXFS_SUPER_MAGIC @@ -111,6 +118,11 @@ LC_PAPER LC_PAPER_MASK LC_TELEPHONE LC_TELEPHONE_MASK +LIO_NOP +LIO_NOWAIT +LIO_READ +LIO_WAIT +LIO_WRITE LM_ID_BASE LM_ID_NEWLM LOGIN_PROCESS @@ -316,6 +328,9 @@ OLD_TIME OPENPROM_SUPER_MAGIC OVERLAYFS_SUPER_MAGIC O_FSYNC +PF_IB +PF_MPLS +PF_XDP PROC_SUPER_MAGIC PTHREAD_MUTEX_ADAPTIVE_NP QNX4_SUPER_MAGIC @@ -524,6 +539,14 @@ __priority_which_t __rlimit_resource_t __timeval adjtimex +aio_cancel +aio_error +aio_fsync +aio_read +aio_return +aio_suspend +aio_write +aiocb backtrace clock_adjtime copy_file_range @@ -532,7 +555,10 @@ dlmopen endutxent explicit_bzero fgetspent_r +futimes +getauxval getgrent_r +getloadavg getpt getpwent_r getpwnam_r @@ -541,11 +567,12 @@ getutxent getutxid getutxline glob +glob_t glob64 glob64_t -glob_t globfree globfree64 +lio_listio mallinfo mallinfo2 malloc_info @@ -557,7 +584,13 @@ nl_pktinfo ntp_adjtime ntp_gettime ntptimeval +open_wmemstream preadv2 +preadv64 +prlimit +prlimit64 +process_vm_readv +process_vm_writev pthread_attr_getaffinity_np pthread_attr_setaffinity_np pthread_getname_np @@ -567,6 +600,7 @@ pthread_rwlockattr_setkind_np pthread_setname_np pututxline pwritev2 +pwritev64 qsort_r reallocarray semid_ds diff --git a/libc-test/semver/linux-musl.txt b/libc-test/semver/linux-musl.txt index bb69070b1ff2e..737eb1f11d4e6 100644 --- a/libc-test/semver/linux-musl.txt +++ b/libc-test/semver/linux-musl.txt @@ -1,8 +1,42 @@ # TODO: musl. +AF_IB +AF_MPLS +AF_XDP +AIO_ALLDONE +AIO_CANCELED +AIO_NOTCANCELED +Elf32_Chdr +Elf64_Chdr +LIO_NOP +LIO_NOWAIT +LIO_READ +LIO_WAIT +LIO_WRITE +PF_IB +PF_MPLS +PF_XDP adjtimex +aio_cancel +aio_error +aio_fsync +aio_read +aio_return +aio_suspend +aio_write +aiocb clock_adjtime explicit_bzero +futimes +getauxval +getloadavg +lio_listio ntptimeval +open_wmemstream +preadv64 +prlimit +prlimit64 +process_vm_readv +process_vm_writev +pwritev64 reallocarray timex - diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 5698a6f451a87..780181a5098dd 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -35,7 +35,6 @@ AF_CAIF AF_CAN AF_DECnet AF_ECONET -AF_IB AF_IEEE802154 AF_IPX AF_IRDA @@ -44,7 +43,6 @@ AF_IUCV AF_KEY AF_LLC AF_LOCAL -AF_MPLS AF_NETBEUI AF_NETLINK AF_NETROM @@ -62,10 +60,6 @@ AF_TIPC AF_VSOCK AF_WANPIPE AF_X25 -AF_XDP -AIO_ALLDONE -AIO_CANCELED -AIO_NOTCANCELED AI_ADDRCONFIG AI_ALL AI_CANONNAME @@ -513,7 +507,6 @@ EXTA EXTB EXTPROC Elf32_Addr -Elf32_Chdr Elf32_Ehdr Elf32_Half Elf32_Off @@ -523,7 +516,6 @@ Elf32_Shdr Elf32_Sym Elf32_Word Elf64_Addr -Elf64_Chdr Elf64_Ehdr Elf64_Half Elf64_Off @@ -1050,11 +1042,6 @@ LINUX_REBOOT_MAGIC2 LINUX_REBOOT_MAGIC2A LINUX_REBOOT_MAGIC2B LINUX_REBOOT_MAGIC2C -LIO_NOP -LIO_NOWAIT -LIO_READ -LIO_WAIT -LIO_WRITE LOG_AUTHPRIV LOG_CRON LOG_FTP @@ -1483,7 +1470,6 @@ PF_CAIF PF_CAN PF_DECnet PF_ECONET -PF_IB PF_IEEE802154 PF_IPX PF_IRDA @@ -1492,7 +1478,6 @@ PF_IUCV PF_KEY PF_LLC PF_LOCAL -PF_MPLS PF_NETBEUI PF_NETLINK PF_NETROM @@ -1510,7 +1495,6 @@ PF_TIPC PF_VSOCK PF_WANPIPE PF_X25 -PF_XDP PIPE_BUF PM_STR POLLRDBAND @@ -2643,14 +2627,6 @@ accept4 acct addmntent af_alg_iv -aio_cancel -aio_error -aio_fsync -aio_read -aio_return -aio_suspend -aio_write -aiocb arpd_request arphdr arpreq @@ -2741,9 +2717,7 @@ fstatvfs64 ftello64 ftok ftruncate64 -futimes genlmsghdr -getauxval getdomainname getdtablesize getgrent @@ -2755,7 +2729,6 @@ getgrouplist gethostid getifaddrs getline -getloadavg getmntent getnameinfo getpriority @@ -2805,7 +2778,6 @@ key_t killpg labs lgetxattr -lio_listio listxattr llistxattr lockf @@ -2866,7 +2838,6 @@ nlmsghdr off64_t open64 open_memstream -open_wmemstream openat openat64 openpty @@ -2907,11 +2878,6 @@ ppoll prctl pread64 preadv -preadv64 -prlimit -prlimit64 -process_vm_readv -process_vm_writev pthread_attr_getguardsize pthread_attr_getstack pthread_cancel @@ -2941,7 +2907,6 @@ ptrace ptsname_r pwrite64 pwritev -pwritev64 qsort quotactl rand diff --git a/src/unix/linux_like/linux/gnu/mod.rs b/src/unix/linux_like/linux/gnu/mod.rs index d55973a77e80f..bb2a777d776c2 100644 --- a/src/unix/linux_like/linux/gnu/mod.rs +++ b/src/unix/linux_like/linux/gnu/mod.rs @@ -141,19 +141,6 @@ s! { pub keepcost: ::size_t, } - pub struct nlmsghdr { - pub nlmsg_len: u32, - pub nlmsg_type: u16, - pub nlmsg_flags: u16, - pub nlmsg_seq: u32, - pub nlmsg_pid: u32, - } - - pub struct nlmsgerr { - pub error: ::c_int, - pub msg: nlmsghdr, - } - pub struct nl_pktinfo { pub group: u32, } @@ -174,11 +161,6 @@ s! { pub nm_gid: u32, } - pub struct nlattr { - pub nla_len: u16, - pub nla_type: u16, - } - pub struct rtentry { pub rt_pad1: ::c_ulong, pub rt_dst: ::sockaddr, @@ -1210,13 +1192,6 @@ extern "C" { statxbuf: *mut statx, ) -> ::c_int; pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t; - - pub fn memmem( - haystack: *const ::c_void, - haystacklen: ::size_t, - needle: *const ::c_void, - needlelen: ::size_t, - ) -> *mut ::c_void; pub fn getauxval(type_: ::c_ulong) -> ::c_ulong; pub fn adjtimex(buf: *mut timex) -> ::c_int; @@ -1305,16 +1280,6 @@ extern "C" { ) -> ::c_int; pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn pthread_getaffinity_np( - thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t, - ) -> ::c_int; - pub fn pthread_setaffinity_np( - thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t, - ) -> ::c_int; pub fn pthread_rwlockattr_getkind_np( attr: *const ::pthread_rwlockattr_t, val: *mut ::c_int, @@ -1323,7 +1288,6 @@ extern "C" { attr: *mut ::pthread_rwlockattr_t, val: ::c_int, ) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; pub fn mallinfo() -> ::mallinfo; pub fn mallinfo2() -> ::mallinfo2; pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int; diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 20cb9ae6e2387..e10a310a2e09e 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -563,6 +563,24 @@ s! { pub instruction_pointer: ::__u64, pub args: [::__u64; 6], } + + pub struct nlmsghdr { + pub nlmsg_len: u32, + pub nlmsg_type: u16, + pub nlmsg_flags: u16, + pub nlmsg_seq: u32, + pub nlmsg_pid: u32, + } + + pub struct nlmsgerr { + pub error: ::c_int, + pub msg: nlmsghdr, + } + + pub struct nlattr { + pub nla_len: u16, + pub nla_type: u16, + } } s_no_extra_traits! { @@ -3438,6 +3456,16 @@ extern "C" { len: *mut ::socklen_t, flg: ::c_int, ) -> ::c_int; + pub fn pthread_getaffinity_np( + thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *mut ::cpu_set_t, + ) -> ::c_int; + pub fn pthread_setaffinity_np( + thread: ::pthread_t, + cpusetsize: ::size_t, + cpuset: *const ::cpu_set_t, + ) -> ::c_int; pub fn pthread_setschedprio(native: ::pthread_t, priority: ::c_int) -> ::c_int; pub fn reboot(how_to: ::c_int) -> ::c_int; pub fn setfsgid(gid: ::gid_t) -> ::c_int; @@ -3850,6 +3878,13 @@ extern "C" { pub fn gethostid() -> ::c_long; pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int; + pub fn memmem( + haystack: *const ::c_void, + haystacklen: ::size_t, + needle: *const ::c_void, + needlelen: ::size_t, + ) -> *mut ::c_void; + pub fn sched_getcpu() -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/linux/musl/mod.rs b/src/unix/linux_like/linux/musl/mod.rs index 6b2dd898fee74..df596e9683e24 100644 --- a/src/unix/linux_like/linux/musl/mod.rs +++ b/src/unix/linux_like/linux/musl/mod.rs @@ -133,24 +133,6 @@ s! { __dummy4: [::c_char; 16], } - pub struct nlmsghdr { - pub nlmsg_len: u32, - pub nlmsg_type: u16, - pub nlmsg_flags: u16, - pub nlmsg_seq: u32, - pub nlmsg_pid: u32, - } - - pub struct nlmsgerr { - pub error: ::c_int, - pub msg: nlmsghdr, - } - - pub struct nlattr { - pub nla_len: u16, - pub nla_type: u16, - } - pub struct sigaction { pub sa_sigaction: ::sighandler_t, pub sa_mask: ::sigset_t, @@ -757,23 +739,6 @@ extern "C" { pub fn ptrace(request: ::c_int, ...) -> ::c_long; pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; - pub fn pthread_getaffinity_np( - thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *mut ::cpu_set_t, - ) -> ::c_int; - pub fn pthread_setaffinity_np( - thread: ::pthread_t, - cpusetsize: ::size_t, - cpuset: *const ::cpu_set_t, - ) -> ::c_int; - pub fn sched_getcpu() -> ::c_int; - pub fn memmem( - haystack: *const ::c_void, - haystacklen: ::size_t, - needle: *const ::c_void, - needlelen: ::size_t, - ) -> *mut ::c_void; // Musl targets need the `mask` argument of `fanotify_mark` be specified // `::c_ulonglong` instead of `u64` or there will be a type mismatch between // `long long unsigned int` and the expected `uint64_t`. diff --git a/src/unix/linux_like/linux/uclibc/arm/mod.rs b/src/unix/linux_like/linux/uclibc/arm/mod.rs index dc6518c0daf8f..ccc005d48b97e 100644 --- a/src/unix/linux_like/linux/uclibc/arm/mod.rs +++ b/src/unix/linux_like/linux/uclibc/arm/mod.rs @@ -61,8 +61,8 @@ s! { pub st_mtime_nsec: ::c_long, pub st_ctime: ::time_t, pub st_ctime_nsec: ::c_long, - pub __uclibc_unused4: ::c_ulong, - pub __uclibc_unused5: ::c_ulong, + pub __unused4: ::c_ulong, + pub __unused5: ::c_ulong, } pub struct stat64 @@ -205,41 +205,41 @@ s! { pub __pad1: ::c_ushort, pub __seq: ::c_ushort, pub __pad2: ::c_ushort, - pub __uclibc_unused1: ::c_ulong, - pub __uclibc_unused2: ::c_ulong, + pub __unused1: ::c_ulong, + pub __unused2: ::c_ulong, } pub struct msqid_ds { pub msg_perm: ::ipc_perm, pub msg_stime: ::time_t, - pub __uclibc_unused1: ::c_ulong, + pub __unused1: ::c_ulong, pub msg_rtime: ::time_t, - pub __uclibc_unused2: ::c_ulong, + pub __unused2: ::c_ulong, pub msg_ctime: ::time_t, - pub __uclibc_unused3: ::c_ulong, + pub __unused3: ::c_ulong, pub __msg_cbytes: ::c_ulong, pub msg_qnum: ::msgqnum_t, pub msg_qbytes: ::msglen_t, pub msg_lspid: ::pid_t, pub msg_lrpid: ::pid_t, - pub __uclibc_unused4: ::c_ulong, - pub __uclibc_unused5: ::c_ulong, + pub __unused4: ::c_ulong, + pub __unused5: ::c_ulong, } pub struct shmid_ds { pub shm_perm: ::ipc_perm, pub shm_segsz: ::size_t, pub shm_atime: ::time_t, - pub __uclibc_unused1: ::c_ulong, + pub __unused1: ::c_ulong, pub shm_dtime: ::time_t, - pub __uclibc_unused2: ::c_ulong, + pub __unused2: ::c_ulong, pub shm_ctime: ::time_t, - pub __uclibc_unused3: ::c_ulong, + pub __unused3: ::c_ulong, pub shm_cpid: ::pid_t, pub shm_lpid: ::pid_t, pub shm_nattch: ::shmatt_t, - pub __uclibc_unused4: ::c_ulong, - pub __uclibc_unused5: ::c_ulong, + pub __unused4: ::c_ulong, + pub __unused5: ::c_ulong, } } @@ -469,6 +469,7 @@ pub const PENDIN: ::tcflag_t = 0x4000; pub const POLLWRBAND: ::c_short = 0x200; pub const POLLWRNORM: ::c_short = 0x100; pub const PTHREAD_STACK_MIN: ::size_t = 16384; +pub const RTLD_GLOBAL: ::c_int = 0x00100; // These are typed unsigned to match sigaction pub const SA_NOCLDSTOP: ::c_ulong = 0x1; @@ -516,6 +517,8 @@ pub const TABDLY: ::c_int = 0x1800; pub const TCSADRAIN: ::c_int = 0x1; pub const TCSAFLUSH: ::c_int = 0x2; pub const TCSANOW: ::c_int = 0; +pub const TIOCGWINSZ: ::c_int = 0x5413; +pub const TIOCSWINSZ: ::c_int = 0x5414; pub const TOSTOP: ::tcflag_t = 0x100; pub const VDISCARD: usize = 0xd; pub const VEOF: usize = 0x4; @@ -886,6 +889,9 @@ pub const SYS_pwritev2: ::c_long = 393; pub const SYS_pkey_mprotect: ::c_long = 394; pub const SYS_pkey_alloc: ::c_long = 395; pub const SYS_pkey_free: ::c_long = 396; +pub const SYS_statx: ::c_int = 397; +pub const SYS_pidfd_open: ::c_long = 434; +pub const SYS_clone3: ::c_long = 435; extern "C" { pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int; diff --git a/src/unix/linux_like/linux/uclibc/mips/mod.rs b/src/unix/linux_like/linux/uclibc/mips/mod.rs index 28fa9a22a3666..4ae024eb64b81 100644 --- a/src/unix/linux_like/linux/uclibc/mips/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mips/mod.rs @@ -41,7 +41,6 @@ pub const O_ACCMODE: ::c_int = 3; pub const O_DIRECT: ::c_int = 0x8000; pub const O_DIRECTORY: ::c_int = 0x10000; pub const O_NOFOLLOW: ::c_int = 0x20000; -pub const NI_MAXHOST: ::socklen_t = 1025; pub const RLIMIT_NOFILE: ::c_int = 5; pub const RLIMIT_AS: ::c_int = 6; diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs index 396e33d5608f3..113303a49f741 100644 --- a/src/unix/linux_like/linux/uclibc/mod.rs +++ b/src/unix/linux_like/linux/uclibc/mod.rs @@ -2,6 +2,8 @@ pub type shmatt_t = ::c_ulong; pub type msgqnum_t = ::c_ulong; pub type msglen_t = ::c_ulong; pub type regoff_t = ::c_int; +pub type __rlimit_resource_t = ::c_uint; +pub type __priority_which_t = ::c_uint; s! { pub struct statvfs { // Different than GNU! @@ -34,6 +36,32 @@ s! { __re_nsub: ::size_t, __bitfield: u8, } + + pub struct rtentry { + pub rt_pad1: ::c_ulong, + pub rt_dst: ::sockaddr, + pub rt_gateway: ::sockaddr, + pub rt_genmask: ::sockaddr, + pub rt_flags: ::c_ushort, + pub rt_pad2: ::c_short, + pub rt_pad3: ::c_ulong, + pub rt_tos: ::c_uchar, + pub rt_class: ::c_uchar, + #[cfg(target_pointer_width = "64")] + pub rt_pad4: [::c_short; 3usize], + #[cfg(not(target_pointer_width = "64"))] + pub rt_pad4: ::c_short, + pub rt_metric: ::c_short, + pub rt_dev: *mut ::c_char, + pub rt_mtu: ::c_ulong, + pub rt_window: ::c_ulong, + pub rt_irtt: ::c_ushort, + } + + pub struct __exit_status { + pub e_termination: ::c_short, + pub e_exit: ::c_short, + } } pub const MCL_CURRENT: ::c_int = 0x0001; @@ -223,6 +251,108 @@ pub const PRIO_USER: ::c_int = 2; pub const ST_RELATIME: ::c_ulong = 4096; +pub const AF_NFC: ::c_int = PF_NFC; +pub const BUFSIZ: ::c_int = 4096; +pub const EDEADLOCK: ::c_int = EDEADLK; +pub const EXTA: ::c_uint = B19200; +pub const EXTB: ::c_uint = B38400; +pub const EXTPROC: ::c_int = 0200000; +pub const FAN_MARK_FILESYSTEM: ::c_int = 0x00000100; +pub const FAN_MARK_INODE: ::c_int = 0x00000000; +pub const FAN_MARK_MOUNT: ::c_int = 0x10; +pub const FIONREAD: ::c_int = 0x541B; +pub const FOPEN_MAX: ::c_int = 16; +pub const F_GETOWN: ::c_int = 9; +pub const F_OFD_GETLK: ::c_int = 36; +pub const F_OFD_SETLK: ::c_int = 37; +pub const F_OFD_SETLKW: ::c_int = 38; +pub const F_RDLCK: ::c_int = 0; +pub const F_SETOWN: ::c_int = 8; +pub const F_UNLCK: ::c_int = 2; +pub const F_WRLCK: ::c_int = 1; +pub const IPV6_MULTICAST_ALL: ::c_int = 29; +pub const IPV6_ROUTER_ALERT_ISOLATE: ::c_int = 30; +pub const MAP_HUGE_SHIFT: ::c_int = 26; +pub const MAP_HUGE_MASK: ::c_int = 0x3f; +pub const MAP_HUGE_64KB: ::c_int = 16 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_512KB: ::c_int = 19 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_1MB: ::c_int = 20 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_2MB: ::c_int = 21 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_8MB: ::c_int = 23 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_16MB: ::c_int = 24 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_32MB: ::c_int = 25 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_256MB: ::c_int = 28 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_512MB: ::c_int = 29 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_1GB: ::c_int = 30 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_2GB: ::c_int = 31 << MAP_HUGE_SHIFT; +pub const MAP_HUGE_16GB: ::c_int = 34 << MAP_HUGE_SHIFT; +pub const MINSIGSTKSZ: ::c_int = 2048; +pub const MSG_COPY: ::c_int = 040000; +pub const NI_MAXHOST: ::socklen_t = 1025; +pub const O_TMPFILE: ::c_int = 020000000 | O_DIRECTORY; +pub const PACKET_MR_UNICAST: ::c_int = 3; +pub const PF_NFC: ::c_int = 39; +pub const PF_VSOCK: ::c_int = 40; +pub const POSIX_MADV_DONTNEED: ::c_int = 4; +pub const PTRACE_EVENT_STOP: ::c_int = 128; +pub const PTRACE_PEEKSIGINFO: ::c_int = 0x4209; +pub const RLIMIT_AS: ::c_int = 9; +pub const RLIMIT_MEMLOCK: ::c_int = 8; +pub const RLIMIT_NLIMITS: ::c_int = 15; +pub const RLIMIT_NOFILE: ::c_int = 7; +pub const RLIMIT_NPROC: ::c_int = 6; +pub const RLIMIT_RSS: ::c_int = 5; +pub const RLIMIT_RTTIME: ::c_int = 15; +pub const RTLD_NOLOAD: ::c_int = 0x00004; +pub const RUSAGE_THREAD: ::c_int = 1; +pub const SHM_EXEC: ::c_int = 0100000; +pub const SIGPOLL: ::c_int = SIGIO; +pub const SOCK_DCCP: ::c_int = 6; +pub const SOCK_PACKET: ::c_int = 10; +pub const TCFLSH: ::c_int = 0x540B; +pub const TCGETA: ::c_int = 0x5405; +pub const TCGETS: ::c_int = 0x5401; +pub const TCP_COOKIE_TRANSACTIONS: ::c_int = 15; +pub const TCSBRK: ::c_int = 0x5409; +pub const TCSETA: ::c_int = 0x5406; +pub const TCSETAF: ::c_int = 0x5408; +pub const TCSETAW: ::c_int = 0x5407; +pub const TCSETS: ::c_int = 0x5402; +pub const TCSETSF: ::c_int = 0x5404; +pub const TCSETSW: ::c_int = 0x5403; +pub const TCXONC: ::c_int = 0x540A; +pub const TIOCCONS: ::c_int = 0x541D; +pub const TIOCEXCL: ::c_int = 0x540C; +pub const TIOCGPGRP: ::c_int = 0x540F; +pub const TIOCGSERIAL: ::c_int = 0x541E; +pub const TIOCGSOFTCAR: ::c_int = 0x5419; +pub const TIOCINQ: ::c_int = FIONREAD; +pub const TIOCLINUX: ::c_int = 0x541C; +pub const TIOCMBIC: ::c_int = 0x5417; +pub const TIOCMGET: ::c_int = 0x5415; +pub const TIOCMBIS: ::c_int = 0x5416; +pub const TIOCMSET: ::c_int = 0x5418; +pub const TIOCM_CAR: ::c_int = 0x040; +pub const TIOCM_CD: ::c_int = TIOCM_CAR; +pub const TIOCM_CTS: ::c_int = 0x020; +pub const TIOCM_DSR: ::c_int = 0x100; +pub const TIOCM_DTR: ::c_int = 0x002; +pub const TIOCM_LE: ::c_int = 0x001; +pub const TIOCM_RI: ::c_int = TIOCM_RNG; +pub const TIOCM_RNG: ::c_int = 0x080; +pub const TIOCM_RTS: ::c_int = 0x004; +pub const TIOCM_SR: ::c_int = 0x010; +pub const TIOCM_ST: ::c_int = 0x008; +pub const TIOCNXCL: ::c_int = 0x540D; +pub const TIOCOUTQ: ::c_int = 0x5411; +pub const TIOCSCTTY: ::c_int = 0x540E; +pub const TIOCSPGRP: ::c_int = 0x5410; +pub const TIOCSSOFTCAR: ::c_int = 0x541A; +pub const TIOCSTI: ::c_int = 0x5412; +pub const UDP_GRO: ::c_int = 104; +pub const UDP_SEGMENT: ::c_int = 103; +pub const YESEXPR: ::c_int = ((5) << 8) | (0); + extern "C" { pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int; @@ -289,6 +419,19 @@ extern "C" { ) -> ::ssize_t; pub fn sethostid(hostid: ::c_long) -> ::c_int; + pub fn fanotify_mark( + fd: ::c_int, + flags: ::c_uint, + mask: u64, + dirfd: ::c_int, + path: *const ::c_char, + ) -> ::c_int; + pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int; + pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int; + pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int; + pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int; + pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int; + pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int; } cfg_if! { diff --git a/src/unix/linux_like/mod.rs b/src/unix/linux_like/mod.rs index a8b0332065429..59404247212d2 100644 --- a/src/unix/linux_like/mod.rs +++ b/src/unix/linux_like/mod.rs @@ -877,6 +877,8 @@ pub const IPPROTO_MH: ::c_int = 135; pub const IPPROTO_UDPLITE: ::c_int = 136; /// raw IP packet pub const IPPROTO_RAW: ::c_int = 255; +pub const IPPROTO_BEETPH: ::c_int = 94; +pub const IPPROTO_MPLS: ::c_int = 137; pub const MCAST_EXCLUDE: ::c_int = 0; pub const MCAST_INCLUDE: ::c_int = 1; @@ -913,6 +915,7 @@ pub const IPV6_JOIN_ANYCAST: ::c_int = 27; pub const IPV6_LEAVE_ANYCAST: ::c_int = 28; pub const IPV6_IPSEC_POLICY: ::c_int = 34; pub const IPV6_XFRM_POLICY: ::c_int = 35; +pub const IPV6_HDRINCL: ::c_int = 36; pub const IPV6_RECVPKTINFO: ::c_int = 49; pub const IPV6_PKTINFO: ::c_int = 50; pub const IPV6_RECVHOPLIMIT: ::c_int = 51; @@ -948,6 +951,8 @@ pub const IPV6_PMTUDISC_DONT: ::c_int = 0; pub const IPV6_PMTUDISC_WANT: ::c_int = 1; pub const IPV6_PMTUDISC_DO: ::c_int = 2; pub const IPV6_PMTUDISC_PROBE: ::c_int = 3; +pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4; +pub const IPV6_PMTUDISC_OMIT: ::c_int = 5; pub const TCP_NODELAY: ::c_int = 1; pub const TCP_MAXSEG: ::c_int = 2; @@ -1117,6 +1122,7 @@ pub const CLONE_CHILD_CLEARTID: ::c_int = 0x200000; pub const CLONE_DETACHED: ::c_int = 0x400000; pub const CLONE_UNTRACED: ::c_int = 0x800000; pub const CLONE_CHILD_SETTID: ::c_int = 0x01000000; +pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; pub const CLONE_NEWUTS: ::c_int = 0x04000000; pub const CLONE_NEWIPC: ::c_int = 0x08000000; pub const CLONE_NEWUSER: ::c_int = 0x10000000; @@ -1132,11 +1138,15 @@ pub const WCONTINUED: ::c_int = 0x00000008; pub const WNOWAIT: ::c_int = 0x01000000; // Options for personality(2). +pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000; pub const MMAP_PAGE_ZERO: ::c_int = 0x0100000; +pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000; +pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000; pub const ADDR_LIMIT_32BIT: ::c_int = 0x0800000; pub const SHORT_INODE: ::c_int = 0x1000000; pub const WHOLE_SECONDS: ::c_int = 0x2000000; pub const STICKY_TIMEOUTS: ::c_int = 0x4000000; +pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000; // Options set using PTRACE_SETOPTIONS. pub const PTRACE_O_TRACESYSGOOD: ::c_int = 0x00000001; @@ -1147,6 +1157,8 @@ pub const PTRACE_O_TRACEEXEC: ::c_int = 0x00000010; pub const PTRACE_O_TRACEVFORKDONE: ::c_int = 0x00000020; pub const PTRACE_O_TRACEEXIT: ::c_int = 0x00000040; pub const PTRACE_O_TRACESECCOMP: ::c_int = 0x00000080; +pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; +pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; // Wait extended result codes for the above trace options. pub const PTRACE_EVENT_FORK: ::c_int = 1; @@ -1346,18 +1358,6 @@ pub const ARPHRD_NONE: u16 = 0xFFFE; cfg_if! { if #[cfg(not(target_env = "uclibc"))] { - pub const IPPROTO_BEETPH: ::c_int = 94; - pub const IPPROTO_MPLS: ::c_int = 137; - pub const IPV6_HDRINCL: ::c_int = 36; - pub const IPV6_PMTUDISC_INTERFACE: ::c_int = 4; - pub const IPV6_PMTUDISC_OMIT: ::c_int = 5; - pub const CLONE_NEWCGROUP: ::c_int = 0x02000000; - pub const ADDR_NO_RANDOMIZE: ::c_int = 0x0040000; - pub const ADDR_COMPAT_LAYOUT: ::c_int = 0x0200000; - pub const READ_IMPLIES_EXEC: ::c_int = 0x0400000; - pub const ADDR_LIMIT_3GB: ::c_int = 0x8000000; - pub const PTRACE_O_EXITKILL: ::c_int = 0x00100000; - pub const PTRACE_O_SUSPEND_SECCOMP: ::c_int = 0x00200000; pub const PTRACE_O_MASK: ::c_int = 0x003000ff; } }