summaryrefslogtreecommitdiffstats
path: root/vendor/rustix
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/rustix')
-rw-r--r--vendor/rustix/.cargo-checksum.json2
-rw-r--r--vendor/rustix/Cargo.lock1281
-rw-r--r--vendor/rustix/Cargo.toml59
-rw-r--r--vendor/rustix/README.md10
-rw-r--r--vendor/rustix/build.rs15
-rw-r--r--vendor/rustix/ci/getsockopt-timeouts.patch80
-rw-r--r--vendor/rustix/ci/s390x-stat-have-nsec.patch27
-rw-r--r--vendor/rustix/ci/translate-errno.patch28
-rw-r--r--vendor/rustix/examples/dup2_to_replace_stdio.rs55
-rw-r--r--vendor/rustix/examples/hello.rs43
-rw-r--r--vendor/rustix/examples/process.rs105
-rw-r--r--vendor/rustix/examples/stdio.rs465
-rw-r--r--vendor/rustix/examples/time.rs20
-rw-r--r--vendor/rustix/src/backend/libc/conv.rs (renamed from vendor/rustix/src/imp/libc/conv.rs)6
-rw-r--r--vendor/rustix/src/backend/libc/fs/dir.rs (renamed from vendor/rustix/src/imp/libc/fs/dir.rs)121
-rw-r--r--vendor/rustix/src/backend/libc/fs/makedev.rs (renamed from vendor/rustix/src/imp/libc/fs/makedev.rs)6
-rw-r--r--vendor/rustix/src/backend/libc/fs/mod.rs (renamed from vendor/rustix/src/imp/libc/fs/mod.rs)3
-rw-r--r--vendor/rustix/src/backend/libc/fs/syscalls.rs (renamed from vendor/rustix/src/imp/libc/fs/syscalls.rs)164
-rw-r--r--vendor/rustix/src/backend/libc/fs/types.rs (renamed from vendor/rustix/src/imp/libc/fs/types.rs)118
-rw-r--r--vendor/rustix/src/backend/libc/io/epoll.rs (renamed from vendor/rustix/src/imp/libc/io/epoll.rs)39
-rw-r--r--vendor/rustix/src/backend/libc/io/errno.rs (renamed from vendor/rustix/src/imp/libc/io/errno.rs)125
-rw-r--r--vendor/rustix/src/backend/libc/io/io_slice.rs (renamed from vendor/rustix/src/imp/libc/io/io_slice.rs)2
-rw-r--r--vendor/rustix/src/backend/libc/io/mod.rs (renamed from vendor/rustix/src/imp/libc/io/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/io/poll_fd.rs (renamed from vendor/rustix/src/imp/libc/io/poll_fd.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/io/syscalls.rs (renamed from vendor/rustix/src/imp/libc/io/syscalls.rs)105
-rw-r--r--vendor/rustix/src/backend/libc/io/types.rs (renamed from vendor/rustix/src/imp/libc/io/types.rs)81
-rw-r--r--vendor/rustix/src/backend/libc/io/windows_syscalls.rs (renamed from vendor/rustix/src/imp/libc/io/windows_syscalls.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/io_lifetimes.rs (renamed from vendor/rustix/src/imp/libc/io_lifetimes.rs)34
-rw-r--r--vendor/rustix/src/backend/libc/io_uring/mod.rs (renamed from vendor/rustix/src/imp/libc/io_uring/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/io_uring/syscalls.rs (renamed from vendor/rustix/src/imp/libc/io_uring/syscalls.rs)4
-rw-r--r--vendor/rustix/src/backend/libc/mm/mod.rs (renamed from vendor/rustix/src/imp/libc/mm/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/mm/syscalls.rs (renamed from vendor/rustix/src/imp/libc/mm/syscalls.rs)4
-rw-r--r--vendor/rustix/src/backend/libc/mm/types.rs (renamed from vendor/rustix/src/imp/libc/mm/types.rs)51
-rw-r--r--vendor/rustix/src/backend/libc/mod.rs (renamed from vendor/rustix/src/imp/libc/mod.rs)6
-rw-r--r--vendor/rustix/src/backend/libc/net/addr.rs (renamed from vendor/rustix/src/imp/libc/net/addr.rs)10
-rw-r--r--vendor/rustix/src/backend/libc/net/ext.rs (renamed from vendor/rustix/src/imp/libc/net/ext.rs)19
-rw-r--r--vendor/rustix/src/backend/libc/net/mod.rs (renamed from vendor/rustix/src/imp/libc/net/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/net/read_sockaddr.rs (renamed from vendor/rustix/src/imp/libc/net/read_sockaddr.rs)6
-rw-r--r--vendor/rustix/src/backend/libc/net/send_recv.rs (renamed from vendor/rustix/src/imp/libc/net/send_recv.rs)8
-rw-r--r--vendor/rustix/src/backend/libc/net/syscalls.rs (renamed from vendor/rustix/src/imp/libc/net/syscalls.rs)28
-rw-r--r--vendor/rustix/src/backend/libc/net/types.rs (renamed from vendor/rustix/src/imp/libc/net/types.rs)108
-rw-r--r--vendor/rustix/src/backend/libc/net/write_sockaddr.rs (renamed from vendor/rustix/src/imp/libc/net/write_sockaddr.rs)6
-rw-r--r--vendor/rustix/src/backend/libc/offset.rs (renamed from vendor/rustix/src/imp/libc/offset.rs)63
-rw-r--r--vendor/rustix/src/backend/libc/param/auxv.rs (renamed from vendor/rustix/src/imp/libc/param/auxv.rs)12
-rw-r--r--vendor/rustix/src/backend/libc/param/mod.rs (renamed from vendor/rustix/src/imp/libc/param/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/process/cpu_set.rs (renamed from vendor/rustix/src/imp/libc/process/cpu_set.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/process/mod.rs (renamed from vendor/rustix/src/imp/libc/process/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/process/syscalls.rs (renamed from vendor/rustix/src/imp/libc/process/syscalls.rs)50
-rw-r--r--vendor/rustix/src/backend/libc/process/types.rs (renamed from vendor/rustix/src/imp/libc/process/types.rs)75
-rw-r--r--vendor/rustix/src/backend/libc/process/wait.rs (renamed from vendor/rustix/src/imp/libc/process/wait.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/rand/mod.rs (renamed from vendor/rustix/src/imp/libc/rand/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/rand/syscalls.rs (renamed from vendor/rustix/src/imp/libc/rand/syscalls.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/rand/types.rs (renamed from vendor/rustix/src/imp/libc/rand/types.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/termios/mod.rs (renamed from vendor/rustix/src/imp/libc/termios/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs (renamed from vendor/rustix/src/imp/libc/termios/syscalls.rs)7
-rw-r--r--vendor/rustix/src/backend/libc/termios/types.rs (renamed from vendor/rustix/src/imp/libc/termios/types.rs)103
-rw-r--r--vendor/rustix/src/backend/libc/thread/mod.rs (renamed from vendor/rustix/src/imp/libc/thread/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/thread/syscalls.rs (renamed from vendor/rustix/src/imp/libc/thread/syscalls.rs)17
-rw-r--r--vendor/rustix/src/backend/libc/time/mod.rs (renamed from vendor/rustix/src/imp/libc/time/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/libc/time/syscalls.rs (renamed from vendor/rustix/src/imp/libc/time/syscalls.rs)18
-rw-r--r--vendor/rustix/src/backend/libc/time/types.rs (renamed from vendor/rustix/src/imp/libc/time/types.rs)2
-rw-r--r--vendor/rustix/src/backend/libc/weak.rs (renamed from vendor/rustix/src/imp/libc/weak.rs)4
-rw-r--r--vendor/rustix/src/backend/libc/winsock_c.rs (renamed from vendor/rustix/src/imp/libc/winsock_c.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/aarch64.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/arm.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/mips.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/mips64.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/mod.rs)5
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/powerpc64.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/riscv64.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs322
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/x86.rs)50
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/inline/x86_64.rs)32
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/mod.rs)76
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/aarch64.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/aarch64.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/arm.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/arm.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mips.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/mips.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/mips64.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/mod.rs)4
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/nr_last.rs)26
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/powerpc64.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/riscv64.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/riscv64.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/x86.rs)38
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/x86.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/x86.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/outline/x86_64.s (renamed from vendor/rustix/src/imp/linux_raw/arch/outline/x86_64.s)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/c.rs (renamed from vendor/rustix/src/imp/linux_raw/c.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/conv.rs (renamed from vendor/rustix/src/imp/linux_raw/conv.rs)76
-rw-r--r--vendor/rustix/src/backend/linux_raw/elf.rs (renamed from vendor/rustix/src/imp/linux_raw/elf.rs)4
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/dir.rs (renamed from vendor/rustix/src/imp/linux_raw/fs/dir.rs)26
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/makedev.rs (renamed from vendor/rustix/src/imp/linux_raw/fs/makedev.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/fs/mod.rs)1
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/fs/syscalls.rs)197
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/types.rs (renamed from vendor/rustix/src/imp/linux_raw/fs/types.rs)69
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/epoll.rs (renamed from vendor/rustix/src/imp/linux_raw/io/epoll.rs)40
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/errno.rs (renamed from vendor/rustix/src/imp/linux_raw/io/errno.rs)28
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/io_slice.rs (renamed from vendor/rustix/src/imp/linux_raw/io/io_slice.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/io/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/poll_fd.rs (renamed from vendor/rustix/src/imp/linux_raw/io/poll_fd.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/io/syscalls.rs)146
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/types.rs (renamed from vendor/rustix/src/imp/linux_raw/io/types.rs)61
-rw-r--r--vendor/rustix/src/backend/linux_raw/io_uring/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/io_uring/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/io_uring/syscalls.rs)5
-rw-r--r--vendor/rustix/src/backend/linux_raw/mm/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/mm/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/mm/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/mm/syscalls.rs)8
-rw-r--r--vendor/rustix/src/backend/linux_raw/mm/types.rs (renamed from vendor/rustix/src/imp/linux_raw/mm/types.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/mod.rs)18
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/addr.rs (renamed from vendor/rustix/src/imp/linux_raw/net/addr.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/net/mod.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/read_sockaddr.rs (renamed from vendor/rustix/src/imp/linux_raw/net/read_sockaddr.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/send_recv.rs (renamed from vendor/rustix/src/imp/linux_raw/net/send_recv.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/net/syscalls.rs)40
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/types.rs (renamed from vendor/rustix/src/imp/linux_raw/net/types.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs (renamed from vendor/rustix/src/imp/linux_raw/net/write_sockaddr.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/auxv.rs370
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs74
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/mod.rs12
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs159
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/cpu_set.rs (renamed from vendor/rustix/src/imp/linux_raw/process/cpu_set.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/process/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/process/syscalls.rs)61
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/types.rs (renamed from vendor/rustix/src/imp/linux_raw/process/types.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/wait.rs (renamed from vendor/rustix/src/imp/linux_raw/process/wait.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/rand/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/rand/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/rand/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/rand/syscalls.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/rand/types.rs (renamed from vendor/rustix/src/imp/linux_raw/rand/types.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/reg.rs (renamed from vendor/rustix/src/imp/linux_raw/reg.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/runtime/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/runtime/syscalls.rs)5
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/tls.rs (renamed from vendor/rustix/src/imp/linux_raw/runtime/tls.rs)11
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/termios/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/termios/syscalls.rs)33
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/types.rs (renamed from vendor/rustix/src/imp/linux_raw/termios/types.rs)4
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/futex.rs (renamed from vendor/rustix/src/imp/linux_raw/thread/futex.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/thread/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/thread/syscalls.rs)14
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/mod.rs (renamed from vendor/rustix/src/imp/linux_raw/time/mod.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/syscalls.rs (renamed from vendor/rustix/src/imp/linux_raw/time/syscalls.rs)38
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/types.rs (renamed from vendor/rustix/src/imp/linux_raw/time/types.rs)0
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso.rs310
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs (renamed from vendor/rustix/src/imp/linux_raw/vdso_wrappers.rs)26
-rw-r--r--vendor/rustix/src/const_assert.rs1
-rw-r--r--vendor/rustix/src/fs/abs.rs42
-rw-r--r--vendor/rustix/src/fs/at.rs55
-rw-r--r--vendor/rustix/src/fs/constants.rs15
-rw-r--r--vendor/rustix/src/fs/copy_file_range.rs6
-rw-r--r--vendor/rustix/src/fs/cwd.rs6
-rw-r--r--vendor/rustix/src/fs/dir.rs4
-rw-r--r--vendor/rustix/src/fs/fadvise.rs8
-rw-r--r--vendor/rustix/src/fs/fcntl.rs72
-rw-r--r--vendor/rustix/src/fs/fcntl_darwin.rs8
-rw-r--r--vendor/rustix/src/fs/fcopyfile.rs16
-rw-r--r--vendor/rustix/src/fs/fd.rs97
-rw-r--r--vendor/rustix/src/fs/file_type.rs4
-rw-r--r--vendor/rustix/src/fs/getpath.rs6
-rw-r--r--vendor/rustix/src/fs/makedev.rs8
-rw-r--r--vendor/rustix/src/fs/memfd_create.rs8
-rw-r--r--vendor/rustix/src/fs/mod.rs51
-rw-r--r--vendor/rustix/src/fs/openat2.rs10
-rw-r--r--vendor/rustix/src/fs/sendfile.rs6
-rw-r--r--vendor/rustix/src/fs/statx.rs10
-rw-r--r--vendor/rustix/src/imp/linux_raw/net/ext.rs64
-rw-r--r--vendor/rustix/src/imp/linux_raw/param/auxv.rs203
-rw-r--r--vendor/rustix/src/imp/linux_raw/param/mod.rs1
-rw-r--r--vendor/rustix/src/imp/linux_raw/vdso.rs435
-rw-r--r--vendor/rustix/src/io/close.rs6
-rw-r--r--vendor/rustix/src/io/dup.rs20
-rw-r--r--vendor/rustix/src/io/errno.rs4
-rw-r--r--vendor/rustix/src/io/eventfd.rs8
-rw-r--r--vendor/rustix/src/io/fcntl.rs86
-rw-r--r--vendor/rustix/src/io/fd/owned.rs4
-rw-r--r--vendor/rustix/src/io/fd/raw.rs2
-rw-r--r--vendor/rustix/src/io/ioctl.rs22
-rw-r--r--vendor/rustix/src/io/is_read_write.rs10
-rw-r--r--vendor/rustix/src/io/mod.rs45
-rw-r--r--vendor/rustix/src/io/owned_fd.rs272
-rw-r--r--vendor/rustix/src/io/pipe.rs91
-rw-r--r--vendor/rustix/src/io/poll.rs6
-rw-r--r--vendor/rustix/src/io/procfs.rs106
-rw-r--r--vendor/rustix/src/io/read_write.rs32
-rw-r--r--vendor/rustix/src/io/stdio.rs96
-rw-r--r--vendor/rustix/src/io_uring.rs19
-rw-r--r--vendor/rustix/src/lib.rs30
-rw-r--r--vendor/rustix/src/mm/madvise.rs6
-rw-r--r--vendor/rustix/src/mm/mmap.rs28
-rw-r--r--vendor/rustix/src/mm/msync.rs6
-rw-r--r--vendor/rustix/src/mm/userfaultfd.rs8
-rw-r--r--vendor/rustix/src/net/addr.rs204
-rw-r--r--vendor/rustix/src/net/ip.rs423
-rw-r--r--vendor/rustix/src/net/send_recv.rs28
-rw-r--r--vendor/rustix/src/net/socket.rs62
-rw-r--r--vendor/rustix/src/net/socket_addr_any.rs20
-rw-r--r--vendor/rustix/src/net/socketpair.rs6
-rw-r--r--vendor/rustix/src/net/sockopt.rs102
-rw-r--r--vendor/rustix/src/net/wsa.rs4
-rw-r--r--vendor/rustix/src/param/auxv.rs10
-rw-r--r--vendor/rustix/src/param/init.rs4
-rw-r--r--vendor/rustix/src/param/mod.rs10
-rw-r--r--vendor/rustix/src/path/arg.rs28
-rw-r--r--vendor/rustix/src/path/dec_int.rs2
-rw-r--r--vendor/rustix/src/process/chdir.rs10
-rw-r--r--vendor/rustix/src/process/exit.rs8
-rw-r--r--vendor/rustix/src/process/id.rs53
-rw-r--r--vendor/rustix/src/process/kill.rs10
-rw-r--r--vendor/rustix/src/process/membarrier.rs10
-rw-r--r--vendor/rustix/src/process/mod.rs13
-rw-r--r--vendor/rustix/src/process/prctl.rs1120
-rw-r--r--vendor/rustix/src/process/priority.rs16
-rw-r--r--vendor/rustix/src/process/procctl.rs180
-rw-r--r--vendor/rustix/src/process/rlimit.rs10
-rw-r--r--vendor/rustix/src/process/sched.rs22
-rw-r--r--vendor/rustix/src/process/sched_yield.rs4
-rw-r--r--vendor/rustix/src/process/uname.rs6
-rw-r--r--vendor/rustix/src/process/wait.rs26
-rw-r--r--vendor/rustix/src/rand/getrandom.rs6
-rw-r--r--vendor/rustix/src/runtime.rs38
-rw-r--r--vendor/rustix/src/termios/cf.rs14
-rw-r--r--vendor/rustix/src/termios/constants.rs401
-rw-r--r--vendor/rustix/src/termios/mod.rs105
-rw-r--r--vendor/rustix/src/termios/tc.rs26
-rw-r--r--vendor/rustix/src/termios/tty.rs11
-rw-r--r--vendor/rustix/src/thread/clock.rs14
-rw-r--r--vendor/rustix/src/thread/futex.rs6
-rw-r--r--vendor/rustix/src/thread/id.rs4
-rw-r--r--vendor/rustix/src/thread/mod.rs9
-rw-r--r--vendor/rustix/src/thread/prctl.rs989
-rw-r--r--vendor/rustix/src/thread/setns.rs89
-rw-r--r--vendor/rustix/src/time/clock.rs12
-rw-r--r--vendor/rustix/src/time/timerfd.rs13
-rw-r--r--vendor/rustix/src/utils.rs16
-rw-r--r--vendor/rustix/tests/backends.rs109
-rw-r--r--vendor/rustix/tests/fs/cwd.rs3
-rw-r--r--vendor/rustix/tests/fs/dir.rs37
-rw-r--r--vendor/rustix/tests/fs/fcntl.rs17
-rw-r--r--vendor/rustix/tests/fs/file.rs83
-rw-r--r--vendor/rustix/tests/fs/flock.rs34
-rw-r--r--vendor/rustix/tests/fs/futimens.rs42
-rw-r--r--vendor/rustix/tests/fs/invalid_offset.rs182
-rw-r--r--vendor/rustix/tests/fs/long_paths.rs28
-rw-r--r--vendor/rustix/tests/fs/main.rs47
-rw-r--r--vendor/rustix/tests/fs/makedev.rs10
-rw-r--r--vendor/rustix/tests/fs/mkdirat.rs33
-rw-r--r--vendor/rustix/tests/fs/mknodat.rs27
-rw-r--r--vendor/rustix/tests/fs/openat.rs33
-rw-r--r--vendor/rustix/tests/fs/openat2.rs184
-rw-r--r--vendor/rustix/tests/fs/readdir.rs68
-rw-r--r--vendor/rustix/tests/fs/renameat.rs104
-rw-r--r--vendor/rustix/tests/fs/statfs.rs49
-rw-r--r--vendor/rustix/tests/fs/utimensat.rs127
-rw-r--r--vendor/rustix/tests/fs/y2038.rs146
-rw-r--r--vendor/rustix/tests/io/dup2_to_replace_stdio.rs18
-rw-r--r--vendor/rustix/tests/io/epoll.rs103
-rw-r--r--vendor/rustix/tests/io/error.rs14
-rw-r--r--vendor/rustix/tests/io/eventfd.rs24
-rw-r--r--vendor/rustix/tests/io/from_into.rs28
-rw-r--r--vendor/rustix/tests/io/ioctl.rs14
-rw-r--r--vendor/rustix/tests/io/main.rs31
-rw-r--r--vendor/rustix/tests/io/poll.rs63
-rw-r--r--vendor/rustix/tests/io/procfs.rs8
-rw-r--r--vendor/rustix/tests/io/read_write.rs118
-rw-r--r--vendor/rustix/tests/io/seals.rs41
-rw-r--r--vendor/rustix/tests/mm/main.rs13
-rw-r--r--vendor/rustix/tests/mm/mlock.rs79
-rw-r--r--vendor/rustix/tests/mm/mmap.rs163
-rw-r--r--vendor/rustix/tests/mm/prot.rs4
-rw-r--r--vendor/rustix/tests/net/addr.rs92
-rw-r--r--vendor/rustix/tests/net/connect_bind_send.rs487
-rw-r--r--vendor/rustix/tests/net/main.rs32
-rw-r--r--vendor/rustix/tests/net/poll.rs119
-rw-r--r--vendor/rustix/tests/net/sockopt.rs158
-rw-r--r--vendor/rustix/tests/net/unix.rs147
-rw-r--r--vendor/rustix/tests/net/v4.rs86
-rw-r--r--vendor/rustix/tests/net/v6.rs95
-rw-r--r--vendor/rustix/tests/param/auxv.rs41
-rw-r--r--vendor/rustix/tests/param/main.rs14
-rw-r--r--vendor/rustix/tests/param/weak.rs201
-rw-r--r--vendor/rustix/tests/path/arg.rs167
-rw-r--r--vendor/rustix/tests/path/dec_int.rs20
-rw-r--r--vendor/rustix/tests/path/main.rs13
-rw-r--r--vendor/rustix/tests/process/cpu_set.rs14
-rw-r--r--vendor/rustix/tests/process/id.rs65
-rw-r--r--vendor/rustix/tests/process/main.rs28
-rw-r--r--vendor/rustix/tests/process/membarrier.rs40
-rw-r--r--vendor/rustix/tests/process/priority.rs83
-rw-r--r--vendor/rustix/tests/process/proc.rs5
-rw-r--r--vendor/rustix/tests/process/rlimit.rs51
-rw-r--r--vendor/rustix/tests/process/sched_yield.rs7
-rw-r--r--vendor/rustix/tests/process/uname.rs13
-rw-r--r--vendor/rustix/tests/process/wait.rs25
-rw-r--r--vendor/rustix/tests/process/weak.rs201
-rw-r--r--vendor/rustix/tests/process/working_directory.rs43
-rw-r--r--vendor/rustix/tests/rand/getrandom.rs7
-rw-r--r--vendor/rustix/tests/rand/main.rs9
-rw-r--r--vendor/rustix/tests/termios/isatty.rs69
-rw-r--r--vendor/rustix/tests/termios/main.rs10
-rw-r--r--vendor/rustix/tests/termios/ttyname.rs24
-rw-r--r--vendor/rustix/tests/thread/clocks.rs212
-rw-r--r--vendor/rustix/tests/thread/id.rs7
-rw-r--r--vendor/rustix/tests/thread/main.rs9
-rw-r--r--vendor/rustix/tests/time/dynamic_clocks.rs22
-rw-r--r--vendor/rustix/tests/time/main.rs14
-rw-r--r--vendor/rustix/tests/time/monotonic.rs45
-rw-r--r--vendor/rustix/tests/time/timerfd.rs75
-rw-r--r--vendor/rustix/tests/time/timespec.rs26
-rw-r--r--vendor/rustix/tests/time/y2038.rs77
304 files changed, 7344 insertions, 9962 deletions
diff --git a/vendor/rustix/.cargo-checksum.json b/vendor/rustix/.cargo-checksum.json
index 400d20075..03b6e41ab 100644
--- a/vendor/rustix/.cargo-checksum.json
+++ b/vendor/rustix/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"CODE_OF_CONDUCT.md":"f210602311e3f74b32f46237fd55f4ce36d798e85e3db1432ec667f63a7ffc44","CONTRIBUTING.md":"fb570c76cf924cd75b77bed52b0dbe1e87ce224dc3428c48d98301710dcc331e","COPYRIGHT":"377c2e7c53250cc5905c0b0532d35973392af16ffb9596a41d99d202cf3617c9","Cargo.lock":"e37f04aa97ce0f46b8e576c184cf2721da3b5bb2f3d5c70e8b7d499ba28dbdff","Cargo.toml":"4c6237c9b334bdcc8b7abd9155666ec8721df934bd76e69a85ab81bb0d92f0c0","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"a39bb3863c4d4cde6c9d8b9d99fad5b030ca14f85a6dbb8cc7c0f9403703cf08","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"89a1349fc84e32d3f144daa4b6b41a97b3fd8dfaa71e7e4c0c7b4963f5afb019","build.rs":"69283e1aef247eb8d51ee41ca9e32efd57fd031da6f8ae20268b342eb1c9d19f","ci/getsockopt-timeouts.patch":"f2941f99cbcb4f3382b89f094d7ae74d7f4814ac9b27f594f4e83e26f45b8f07","ci/s390x-stat-have-nsec.patch":"d8f446000f25451eda8b65f350c7feb482aedcd71f8bde724321f70749edc363","ci/translate-errno.patch":"0bf9576a791eba44566ab1507b54d309c73cfc5504bff6e8ca07940b2c3e7b61","examples/dup2_to_replace_stdio.rs":"20816ccca0f0498ffa4a97dc3d9dc8d2fbdd88fd15dae55f2bf60529865dc9c7","examples/hello.rs":"06594427a12147298ef47dbece0f3cb10f8ebd1badc894e7545fbad2892e269f","examples/process.rs":"f2f4a58d8dfecbf8f71b825da805a143948ec8e1c907c8ef329bf0cacf54719d","examples/stdio.rs":"d1e7f68624814b925ceced2de457cbd0902b457ff1a441f0c6e28ed020d8dcb4","examples/time.rs":"965499c22e4dd9493b30a8ab3d72c3e0d79a1451d022dd4365a2a17a4caad6b0","src/const_assert.rs":"05a0b46b4b3333efe4148f29c523046754c3f08454e7d3cd1f17a3beb38f040b","src/cstr.rs":"e5db2aae8fcbad410218696e3e3b3a0da3cc17fc7f64360fc1127bc4e4deff76","src/ffi/mod.rs":"1990dae8190991142bef24220f02b99c96c5bfa7dda2a7974d9dcac265d58945","src/fs/abs.rs":"89714d984afe1d872a2d3b2a44dee2051a09956631518e0fe7b0ea7d1612f4a5","src/fs/at.rs":"f462bf9a2476c5047c76e2c9e167e3e7f3a080133041d8497e039cb5e84c33f2","src/fs/constants.rs":"301ab8e8e99d1d673ebf0e6a6a4f28671130759c934aea1659340edbf4ded90d","src/fs/copy_file_range.rs":"b880f1686c1a48f49e7549bfb1bcfc448db432b80ba4c8550f4eebcbc30755b3","src/fs/cwd.rs":"10f8bc2354151a383ec2d225b72990e4d3c81d711817614acfe4620295b8b5c5","src/fs/dir.rs":"c1567c8420bffffc92628da80c2334e9b647cbb7d286ef5daa9f14a3540d6bc5","src/fs/fadvise.rs":"7231349ba3b750db4527d3b3af5588c447a76fcc8374aeaf6c808bb04e3ebcc6","src/fs/fcntl.rs":"c6beed70a0a6a66acc82d9e6d6b14908a3bf6d352940f5d5cf008e6f19f322d9","src/fs/fcntl_darwin.rs":"a8e5b53914138fea9db62d486aad6a96159bdb75f4670c2ac519ae7f6dcb1552","src/fs/fcopyfile.rs":"4c41bb477fc262f108a79b724fce69a938d87293573327c8bcae8d7bc6931f88","src/fs/fd.rs":"eb8064a06b5b3e2fba4a18bd2a51ab5455c64a30123ed4b442e087de40ae0acd","src/fs/file_type.rs":"42dc46831af066ff4df1009626a962e4e014c6e0782e358224bf485b4dd52708","src/fs/getpath.rs":"85712f58fabef750ccaf8c256a0ad8dd3579e5a40c8eabba8bfc0ec6f59995c6","src/fs/makedev.rs":"1ee9e56ceb3f081764cbffb2a50df4fe70b15c874ad0264679b6c096f0962282","src/fs/memfd_create.rs":"564732f58d3eb529fa9b67b8b311c1a1762ce2f13e6ee58b7fd344e647ac13a7","src/fs/mod.rs":"3e3bc020f3d2c93fb86ee8cafdd2c6b6ca5fb1ec6b3d9c67615023477151bb9c","src/fs/openat2.rs":"ece04e9229ab634837a6ccc2d4fd14e9967f39ae4fe29c3616ea6eaa1713b153","src/fs/sendfile.rs":"11e1c067f442962a3a7b9dc39362b57c45c912c612851fd56aea4cfae3092269","src/fs/statx.rs":"1c74d7d1cc0744f4c1f1ab2e9de189b49861740b309143861b0b25daaedd7f6e","src/imp/libc/conv.rs":"a62a08ab930833d605ab81384b454e7fc01c5060bb3fff5717554949a10917b0","src/imp/libc/fs/dir.rs":"83a4a60b9e5ce68e39c9f8a5e0974944b7589a13d9718fcdd0cad607c26bbb0d","src/imp/libc/fs/makedev.rs":"2213273074906d2c71a3bd2033fad1828fcbb71a5ec4fd416b7f6345fa9912d2","src/imp/libc/fs/mod.rs":"00ba2c415cfb1f23128307edd108d7638d8e03317ce7d59f485451b814ddbbc5","src/imp/libc/fs/syscalls.rs":"f53ba484f9ac89ae4e2d93acc99771677eebf4f711edc8ab2e762e0ffa910ac2","src/imp/libc/fs/types.rs":"1ffc14e0ca66908491b5b7652db4cb6d8d8c16769f1dcfa506c73117b948fa3f","src/imp/libc/io/epoll.rs":"e498add7e93a7f1ce8793b24dafecbdab7e0968760c32bf2cccb811d542fda4a","src/imp/libc/io/errno.rs":"9e4aad81b3fd6d7b4afbd6a64638a8b07da715c67f21405c7e53a3003ab96e6b","src/imp/libc/io/io_slice.rs":"22b034b07e6db028bd4f7cb423fb0bf4c2d4e852a44c68f5b4b4c9a327a533ef","src/imp/libc/io/mod.rs":"a76e0071a887a6bdb1a3edc4887f91889d4beab1426e73417958257467f3c602","src/imp/libc/io/poll_fd.rs":"71c83405affcac8a4a7d4339cf71add4f3ccc2f3ef72cda835eec96f5a115cd6","src/imp/libc/io/syscalls.rs":"82e6ce8ca531c290d8da7901b1622e8c6e56866731ab78bb2b465d6184197a7d","src/imp/libc/io/types.rs":"7cdd0354ca7443d2eb1fa9aa335d6981b3bab7ef2d6e34c312529befb9dfbf6d","src/imp/libc/io/windows_syscalls.rs":"741f524b384d59e703b278739563ab04273dbb48c062349353dd9b7cf9ed2332","src/imp/libc/io_lifetimes.rs":"2bc5f59216136c74a72e208ac486c662451f23e6d72689532a7721c397f8a024","src/imp/libc/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/imp/libc/io_uring/syscalls.rs":"cd5fb63023f8a615ef9aec699fd15f3d993a7c91467f00f5fdb3e93aab201661","src/imp/libc/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/imp/libc/mm/syscalls.rs":"563d2fe119968b85c64b5765caf10aa252765027c8f2d7dc393503233fa3eecf","src/imp/libc/mm/types.rs":"1fcfda95f1e26c766da6c2778829e2dc21d9071ab6666c68d7975723c281ea5b","src/imp/libc/mod.rs":"2ec1e54673eda7ada51e4039ca5312786db9cfe401b5bcab3a70a79cea32ab0d","src/imp/libc/net/addr.rs":"b158799745f833d28397d5ce1253419d4f78b8e4ba61c7b6710fa5f7d51ef7ce","src/imp/libc/net/ext.rs":"d4be1c18d597dbaee64fd5771358ff7a7fdc2a6a2d11972692a19a19a91a80c5","src/imp/libc/net/mod.rs":"772c788c60141e41044b59c4812c4208f52838da1effe1d476ab1d99304d9f9d","src/imp/libc/net/read_sockaddr.rs":"b97728bbb759910a8af699d4456df5c92ad3c58df18180d0c93bebc4349ed981","src/imp/libc/net/send_recv.rs":"1d9376d8f481d3c6b5bfb048e7471368fc15f5c861d95c89e1368fe36928fdab","src/imp/libc/net/syscalls.rs":"e138bec0fb988c850e3ae3f0ce4f39a51943dd502276246b30bf0815baabf46e","src/imp/libc/net/types.rs":"87c0de2e72008df7039ac429f479fb5fd58db9a686c5e3fc1a12f04dad48bf2b","src/imp/libc/net/write_sockaddr.rs":"77b43e57d13a4bba1c9aaed5c19685a85bf8624190cd582672c36b0692602016","src/imp/libc/offset.rs":"fd50f582675b61dd1966a831e3bf1063469012d3aacc839633bc27ec57b06bb0","src/imp/libc/param/auxv.rs":"90c71482be3c378c1de08af28117ee0b1e86fca738d81101612672d7607fdf75","src/imp/libc/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/imp/libc/process/cpu_set.rs":"9c0734ac8f07431e0ad704ca5bd749c9fba25d295c8ee59dd92437c0d6fa05b2","src/imp/libc/process/mod.rs":"45a9979d6bc7c669ffe212c55ffbf6ea8f4bdb9a711c894b9e93b52a05e611d7","src/imp/libc/process/syscalls.rs":"eac779d8ae7529c8e7c3e66d1eb3e127cbc7497850d756c9968a5bf1116c2c42","src/imp/libc/process/types.rs":"516ba32a547b46a8e80ad20d4a17bf24a00bff0b69b74f56df119f770f3dfff6","src/imp/libc/process/wait.rs":"47862cd801bb2e0b4f98a48d6755fb263014675896fd888eb500866ba35b2ba4","src/imp/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/imp/libc/rand/syscalls.rs":"dd675f045e4f18ae57db9a67f95c67a3f0d14d3b8df22907c4e80ca4b611dd43","src/imp/libc/rand/types.rs":"8a840167af1454d1399c1defb254e9a626ab46d00981e9c7360828be6ac45b08","src/imp/libc/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/imp/libc/termios/syscalls.rs":"19ec1fcad6a8262ff00bf2da1e504bd4020477aa37a3cbfdd6eaa9d39a539b91","src/imp/libc/termios/types.rs":"646552053670ea8b77b024b6eaa2024fb5f70ad1677e11a3e54df5f191f39aac","src/imp/libc/thread/mod.rs":"0de5f67a684b9fd7628d3009d2ea5fd51b8770e8b387eed14f59152157844287","src/imp/libc/thread/syscalls.rs":"53b2ffe0d16a01c98e1b65a40754cf994733b06a04df584959b952e558ecab06","src/imp/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/imp/libc/time/syscalls.rs":"abfbc3dedc61bb3037a7df7d867a63f63711553f358e52a3d9592f9a757097a3","src/imp/libc/time/types.rs":"09a6332f36a1a65dc0dbb0cf55dd3e74d8d610b5a8993a723afa54dce2c8ba05","src/imp/libc/weak.rs":"eba805bb69e9017a9969354269ace291fccfebc35278faf6c7b39578e0bcd1b1","src/imp/libc/winsock_c.rs":"34b26b3fe14720e4c66069c2c1c3daeb632ac2b1750bb1798243bb4efc26573b","src/imp/linux_raw/arch/inline/aarch64.rs":"6b525ba80c295111e47b1dbe5fa77d8505348b61ea2afc9a7f17b315b56919ae","src/imp/linux_raw/arch/inline/arm.rs":"371525cf45f74928b84f2f38bad78967c461c123842106fe3942927485b3e2d0","src/imp/linux_raw/arch/inline/mips.rs":"34197d3900d31e976810b730ae1561044804acec484db7dfc507c64ffbfe9916","src/imp/linux_raw/arch/inline/mips64.rs":"582f4fbc7124dc3521473d9f4a0864ffafb7a9b4616df9b619cb4c9723cacc1d","src/imp/linux_raw/arch/inline/mod.rs":"4d0eace2ef2821e97f694326757ec06970c2b9f02afe95a989db27e7f8162cc9","src/imp/linux_raw/arch/inline/powerpc64.rs":"b5991ed219451392000421fbf3fdcb2680a2375011941522455f1279a5edf71b","src/imp/linux_raw/arch/inline/riscv64.rs":"f2018fc2624ea814fe58d8ad8ec5f47431fc651f5441a429b3d57eda1b4de2e2","src/imp/linux_raw/arch/inline/x86.rs":"3052fb3e24e310bd6e39b9a01fb6c8f5562dcee52c46cca65f91d5d4f4eec111","src/imp/linux_raw/arch/inline/x86_64.rs":"fca7d3b64cef714a9a79db2d725381457347262262414798ad5863082739b812","src/imp/linux_raw/arch/mod.rs":"3ed41804d3db006be712e97fa40927bdbea934cf77760553ffc9e9dd376d0531","src/imp/linux_raw/arch/outline/aarch64.s":"84f066b6fe3cf25ed61c7aa420408c6d5a0b33a7c91b748ed81e47737567975f","src/imp/linux_raw/arch/outline/arm.s":"fa266bf9f4533da1e96c27c4ae5418c86f44074ac0c6afcff0404738e11365da","src/imp/linux_raw/arch/outline/debug/librustix_outline_aarch64.a":"2be1d64488c0a02c9777e0defc3e9bd47839da3982b5e790b02160d423366431","src/imp/linux_raw/arch/outline/debug/librustix_outline_arm.a":"a3aefaa54bb7384dcacb04e47c4c726bcafb331f993fbe7051e73ce4ea6b6301","src/imp/linux_raw/arch/outline/debug/librustix_outline_mips.a":"95e8393bf38ee28e9fe911eb142deeb1af1d48744692a59dba166da695a2217c","src/imp/linux_raw/arch/outline/debug/librustix_outline_mips64.a":"825207c9ce2d7bca5ab424d1017df7412d3ef583478ca6f6e7a5274feffeb524","src/imp/linux_raw/arch/outline/debug/librustix_outline_powerpc64.a":"0889c12a2345e476ac6185d27a592cc79da75dc2937bbe83267a0068c549b4e8","src/imp/linux_raw/arch/outline/debug/librustix_outline_riscv64.a":"1e1ffad421ad95a79222a293c2e2b791dc36b4a3ceef69d245d02b805f6f7520","src/imp/linux_raw/arch/outline/debug/librustix_outline_x86.a":"c9dd9bcf5dd3513dacdde072152489f4a29824bfaa198ac026ec04a70f3fb73c","src/imp/linux_raw/arch/outline/debug/librustix_outline_x86_64.a":"f638a09b8aef86c11a5a6bd8ff3934f07890155ce6fbff381273ae48c1f4ab89","src/imp/linux_raw/arch/outline/mips.s":"e265e8fa0b9785a9f2779d6ba70ce982b954b802862b0026dc70fd79b12968bb","src/imp/linux_raw/arch/outline/mips64.s":"c79de202f0eb00e2d9cf1fce2b9a2cabfe4ff2f5cc1476bcfd6c3d139570d447","src/imp/linux_raw/arch/outline/mod.rs":"d1429a7d6a5b27a2ccdcf79bd8a27814eecd6b3e149105950fe88d976ba147ad","src/imp/linux_raw/arch/outline/nr_last.rs":"1639aa5267da1ad668f98f502710e6896f945baf4f780f05810c2a194e924443","src/imp/linux_raw/arch/outline/powerpc64.s":"0847fa3f160846ee02771550667913734ba9773e2221f2279c4f296d6f5b7bd4","src/imp/linux_raw/arch/outline/release/librustix_outline_aarch64.a":"fa8d31702cafb24d9799c162d3319c522892e91c58fbbff2b09950a0fa81b46f","src/imp/linux_raw/arch/outline/release/librustix_outline_arm.a":"0f7c8c5c02d5329d884f800da70aaf6b5b67c14000b12afb708f3e4758aa1f7a","src/imp/linux_raw/arch/outline/release/librustix_outline_mips.a":"c9254760fa993e88662c5e1e8911d994f29e203b37a0fc9b550be193125f5031","src/imp/linux_raw/arch/outline/release/librustix_outline_mips64.a":"224f9ac5196833491bee67fd287a53b7e88111731e2eaaa3ebefba31faea373b","src/imp/linux_raw/arch/outline/release/librustix_outline_powerpc64.a":"1f04e44c3d863bac066520c787444c314f2aa2f8d8d3cae38990ecc008b9b6e1","src/imp/linux_raw/arch/outline/release/librustix_outline_riscv64.a":"465b6631b33632f4a6aca32b04134cd07993cd1bb55405a080157829d7396373","src/imp/linux_raw/arch/outline/release/librustix_outline_x86.a":"380aa7c802be2795471407d438e3da768df9bdc7340cc448d3a91b2d123dbf19","src/imp/linux_raw/arch/outline/release/librustix_outline_x86_64.a":"36f837703d7f0e246b7f596441010fdc1be27e42417af925b6040504c5aa32a4","src/imp/linux_raw/arch/outline/riscv64.s":"ca5303c0c8af6de1f246d658003e270d4e29d6c68dd90c6eee372d045bdf7305","src/imp/linux_raw/arch/outline/x86.rs":"f87a50c1eea6956a4d6b454b0b3322aa59f688918188cc5c15cfd07595e48efc","src/imp/linux_raw/arch/outline/x86.s":"4604e3b41161802343e2e4c890fd2042098a901d95893ebe4c436f97fd47cad3","src/imp/linux_raw/arch/outline/x86_64.s":"a530084cd42ad8d4b2d36526f4e04f45a6e29ea49882e2c561ac2eeac16272bf","src/imp/linux_raw/c.rs":"f112bda3f89c5859f9130ef1a9de1000054af7992073c20ac230230610a29a6e","src/imp/linux_raw/conv.rs":"cbe92c6a8f181bcd4b3678cd24b3ee65c4625545dda290c5d35604aaa7120aca","src/imp/linux_raw/elf.rs":"5be25de1b9be04601573c704fd9deef62f86b42be5e70d241a9a87ca72a56a07","src/imp/linux_raw/fs/dir.rs":"aa2e68489d0efca8cf7028c140aaa7dc19f8228beab78700aa057df7c62cf08d","src/imp/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/imp/linux_raw/fs/mod.rs":"2a7db3cf1b3f9afd0044a4329797f0f255d2eb4c5161fe99c1bd70f10bb72dde","src/imp/linux_raw/fs/syscalls.rs":"a853513369b9bc7cd5f94b514bef8df96f010e1efda972fb23bef5d8c2ed5433","src/imp/linux_raw/fs/types.rs":"e99daf778002b98644428b8a6fd129bfa8c6499ff1d3c2f4b15c40a347446592","src/imp/linux_raw/io/epoll.rs":"894134fdff9c6e3b3e3b5fbd1b51a978ad9b0dd05dc975b46237e446cc585cc6","src/imp/linux_raw/io/errno.rs":"c972e22a4ae9cc0ad8c8d3407a243c132b1b448eda38f9c2ef3e6e256c99d511","src/imp/linux_raw/io/io_slice.rs":"5ba992f3fe701184841006588b35f2452156b73e3bef9e07460e4b1f61ac889f","src/imp/linux_raw/io/mod.rs":"6ea805b91d571217c9649364121d0824bbdf4635b36c9150e5968fbeb75c0892","src/imp/linux_raw/io/poll_fd.rs":"9f5a15c80094cc3334acd171c0621d033b44d5d9a987a57acbdcd62cb17d871b","src/imp/linux_raw/io/syscalls.rs":"7c6504d3990d0012cec0ab85cde361719fa4b0c65a8707a9e6c26a240b042e44","src/imp/linux_raw/io/types.rs":"230462d5bec3e0f9373d231899aebac6f7a796d59634700b12a57f0b5f964a33","src/imp/linux_raw/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/imp/linux_raw/io_uring/syscalls.rs":"e0a02f6d90bdc82952046d805a8e9ed2d842ac276d0b6d02bd3c2a1f55db6e60","src/imp/linux_raw/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/imp/linux_raw/mm/syscalls.rs":"6ef85f7dc389b8886840c2acdcb0e58fc8f81f6fa58929ae0ec03c8236f5a79c","src/imp/linux_raw/mm/types.rs":"a5d0ea04a85df5e196d68a8524c4325963c7b2ded3d7d48713c8e855273b60d4","src/imp/linux_raw/mod.rs":"9fd16496692a41767bba186a655e70d10d3c1c67a15acff9adb49f0898f3d12b","src/imp/linux_raw/net/addr.rs":"b439d61da1356708987bf7de3dcb44ba45d58dbf8b2db1234b0fdcd88365078c","src/imp/linux_raw/net/ext.rs":"25440556ff6f67842b286df557dcfb1259836ae523bb02c05960144a8b364a80","src/imp/linux_raw/net/mod.rs":"a03a3756141e47185ff5f55f7ed6e044776129d6c8aa3f0bd1d3a87582a98763","src/imp/linux_raw/net/read_sockaddr.rs":"0357ae643c384b08578aa0b148ac9b236953da9b36b2e387a40d5b87ae9eccef","src/imp/linux_raw/net/send_recv.rs":"42834cf8148abd02021115a61d57b23bb323dd8ad0d1b9a91d17fb8f7defab01","src/imp/linux_raw/net/syscalls.rs":"160eaeaef2d8f530494da261e01f55adcef6bd5bb9b73de5d7f79f20b4d342f9","src/imp/linux_raw/net/types.rs":"c61b689d7f4b9b68d065935d70926d47b5ac7246b2fbe4f20d144a0c2f417fc2","src/imp/linux_raw/net/write_sockaddr.rs":"ec0bf20a354cb86e2b5646bfc79297a378f11fcdf5641c16e4dd13e305011dc6","src/imp/linux_raw/param/auxv.rs":"6834154a21a134aa446a2f1c6ede0631daec2cb9d89254e8734ad4dc35c4e08c","src/imp/linux_raw/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/imp/linux_raw/process/cpu_set.rs":"2c996e58b556d7528885bc5a8477846a60d0086f812364643db0d2ee6e99d9e4","src/imp/linux_raw/process/mod.rs":"fb393c70a9c63ef9a6bf1fb5a2dc94f07d6b0b6987cc5231c15c607015dafd68","src/imp/linux_raw/process/syscalls.rs":"177430a8c0388e8843a4d9ba360aff7f6dc4c27dbe393fa4c6a844595ef505a1","src/imp/linux_raw/process/types.rs":"fba10dc8ca9eaf4d481cb82bd1540cf5c05620533c44f917c09a22ea55ef408c","src/imp/linux_raw/process/wait.rs":"81e20506feb1e6f90a1fe0cc01768d380e11e7f8afe5212e353030835dba2408","src/imp/linux_raw/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/imp/linux_raw/rand/syscalls.rs":"cddee8ba4026d140d4b76fee4d83f4e4613f7c8ecaa20a33fa1329ce6cc9f88a","src/imp/linux_raw/rand/types.rs":"271416d5241d70932b8a17f3b67eefd1b9c360f217f807de3d73192e9b620552","src/imp/linux_raw/reg.rs":"f9ab26b045150894b98c741f9e80ac2734bf7598f5cf166ab080938febe7af20","src/imp/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/imp/linux_raw/runtime/syscalls.rs":"97fac3c6f4687975548b36d0d612d8d77d6769419d46c69e50f4eed48ad3877a","src/imp/linux_raw/runtime/tls.rs":"f307c3a8f0f63907d67842d22c3c0a4ccea039dbaf28caa96518f2546a2d5e17","src/imp/linux_raw/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/imp/linux_raw/termios/syscalls.rs":"462a740ff5b11c0790667dad85121338d5298beaa6c1f714dc6376498b64b66f","src/imp/linux_raw/termios/types.rs":"e2f3f256aa25e807ed05ed566b8b6fcbd2fd6d273dcc199c0eafca2fee78e0f0","src/imp/linux_raw/thread/futex.rs":"e4ca5be060c52538b97df3781d84e2eb4d8241a7f647b2874412bc0fe6061efa","src/imp/linux_raw/thread/mod.rs":"f7132a68c9db1b4a796781b9e8d0ac268a1ddb713e510bfd43425564ec9b39c4","src/imp/linux_raw/thread/syscalls.rs":"9cfd86d7f0ac0525276780f60d257bb9c7247b1c796c83bbee6c42ecb22ff1cf","src/imp/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/imp/linux_raw/time/syscalls.rs":"4d7a88e651c10253fd36218eef123b19d985f383ffb70b890ad4f5999c69be9b","src/imp/linux_raw/time/types.rs":"865d968a6d2903344982f94c69868031cd1fea582318659ca4c69a11d8a53e33","src/imp/linux_raw/vdso.rs":"3e57ba3f17f1a04166230b39b1aac7a5c5387aa2a5168703a4395179a560edb8","src/imp/linux_raw/vdso_wrappers.rs":"a9972929081844ef18da1ffac334b6f866472be132d7e7c95c0002d2db1b43b1","src/io/close.rs":"3b3d1a691b25fc1f1c72a7c695b839780b6c2064e7d94c517073900fc838694f","src/io/dup.rs":"2ee79ce8b234ff6cc06dd8330d8ea2b5f4ffa95c34187bc55a41942cf4a54ec6","src/io/errno.rs":"a2d75f39bdfc559dd90ba13d74e7891e2d7d15dc64c56761a730c8d13e0e83bb","src/io/eventfd.rs":"64cec379d3e5cf87af3fc1366a424d5ed2145f4cf4436fee924ec158ab060ba3","src/io/fd/mod.rs":"a1eab9ce9a2c4454053afdfd3f3705e4cb971e94cc453e4f13690f2f0d83dc2c","src/io/fd/owned.rs":"d733407758c6e8a6b663515c7827a723ac63bc4d40401b103d4b4a7df04f5426","src/io/fd/raw.rs":"1b33986fc135f247a0891bdd48482ee09b9d05b04d2ac9993bf24443c85b4ceb","src/io/ioctl.rs":"ec6940e91ec39eeb7346c49cf2fa72624531ccc7910c757cc5291643277e2db1","src/io/is_read_write.rs":"559d7c8fcf279578d9efe8c67d3db5d23761544a885409117f53558a5ec9c29e","src/io/mod.rs":"ebd5cf558103710dab169fcdd77842818e573ec47fe12e5626fd0f4ef51c1830","src/io/owned_fd.rs":"69cccac3c1cc3a52c20a714bb56c14b2ddf5766652eb09b2da1ceb82ad73665c","src/io/pipe.rs":"840390696389df7e57aba6172b932aede6ea5cdec456407dd0ba954f0677d472","src/io/poll.rs":"1f10bafe78c9fec3b040541e29b84047c2fe1a98ca16fe4fc258f2d63e9f2a0a","src/io/procfs.rs":"2c974415ce34fecfccddf88f92e5040877630c10871d9cf2f031db6634b8bd80","src/io/read_write.rs":"cde17bc43767621a264b757597d13f05df35d717902e3e344bd59e76a8b8fe00","src/io/seek_from.rs":"16072918edbb97e7ac92a0b38bcf0781ff9e968f77661df7778fa0154d2a105e","src/io/stdio.rs":"4aa1d46780edca3aec48875237a57e852f53943b209a62105b7377ad34618e2b","src/io_uring.rs":"7671bec00805cce7b6e5bf3901049d7509e5cc6bedecba06237e89ac7d95a878","src/lib.rs":"f3a80816a1cf382262da37903d223bf244280386a114241f726a8e4707810374","src/mm/madvise.rs":"b29247b66d2a976c49e336279882249285f9b27f6f30ee525d12d525799bd0c1","src/mm/mmap.rs":"0a4eae3d6e884eb963dccc9015849e1ba731e0a5a0acbdd90372136a70569f9f","src/mm/mod.rs":"92d2cb7e8e27b8e6bf2e18e29137aa249935f9ae97ee48aa30fcbb1acd0f4b6e","src/mm/msync.rs":"ca17288060951768990cbf565e4e653e75460934915e4f853978efd1f46864f4","src/mm/userfaultfd.rs":"e41f459094b6dcdad1d78e65f10089cfd5d8a835a95355cde1416e0fdeacabb1","src/net/addr.rs":"0cd121bea50d8937006a8d469e3cd323a9c8d4f17bfb1945877af5be5410b3ec","src/net/ip.rs":"ebe5c42ed6175188bb1d8237d9a0790a32ee200ee6eaceafe470c46be4f882a5","src/net/mod.rs":"cc99751c260f63d1d98bfd26c08ed71cb7fb1f9535c98af75965be25c81a1cf5","src/net/send_recv.rs":"96aef488ef4bd8a4ec9935b19fb2e52803829fab81739080f9198fd5e4bda2bb","src/net/socket.rs":"55356915bfa5d7287cd85decbbd25103b48ca37eb575e79e93259111ae470791","src/net/socket_addr_any.rs":"9a3b764acce0c100ad3e1c9b261b4e02572d7371e81cc0fbaab7b92de3ec5236","src/net/socketpair.rs":"d182f30242bfedd7126456c9dafe857edc9631067cef3bbdbd3aa82e7e7bc56b","src/net/sockopt.rs":"4872f25587b92e2c63b70d2a9e35d81d1bf2d96e541c5af2573e8b94f142e1c0","src/net/wsa.rs":"9bec9297f9982fdf8f9519c339da79b5b339ed50514b59d13ad7d7c139e129a8","src/param/auxv.rs":"f0d6fb69afe647d2358cc6380ceda80b34b7eacecdcc222be84bb15a3ba0fe3f","src/param/init.rs":"448349cd928655068757a8dd4509664d4707d53934e0957ca9dfabae737fefc1","src/param/mod.rs":"ec67d1a4a781764ea2afd9650222c72fbe6499fcb85b473aa9442a5a7214a8e5","src/path/arg.rs":"12385b9129ccd567bb4e158326a1b163cd4efd8d30518965594ae81afdb52466","src/path/dec_int.rs":"753efc79daaaef39a3e9d0c8c0fe6558764dda13ffd3821b93c156b658eedb15","src/path/mod.rs":"513fea21b1ba0226c3c5da769ded06a7cd7abe9f49cec9d165bc62a15da126a8","src/process/chdir.rs":"a9f83bc78714215e0e2fc1ded2b24f2c11c785a68789522e320aa54cf9e72fc3","src/process/exit.rs":"3ab0711958947df06351fbb6ca2bc06bd6f4e782e2e58e175ebdd41e38b6118b","src/process/id.rs":"615ad352b2c41568885df08548b287b6d18022ac7011349eb1aabc4827d89409","src/process/kill.rs":"81ffb9dc56ff3aef9786d1146ef3f16d634dde333e6218018d73b59390171b82","src/process/membarrier.rs":"c05567bf62114725cbecee92fc33cef4792ed874085599c4db8d1aac599972be","src/process/mod.rs":"ddb175818000530be4240ca59c8565bc90a4a22b9eabe677977fce444f82c2be","src/process/priority.rs":"406b98d679364193840245cf1895ffabc1f043b1cdfff6da28f9a340fc7232b7","src/process/rlimit.rs":"dc7914cc7ff084e056f162c51e808b544fe5a614f550daa452bda84abdc672d2","src/process/sched.rs":"10d75f67ba5cfbd62bdd39dda9ea289b5e86c834ffb129b7b0ac810797201b8b","src/process/sched_yield.rs":"4d16a9238e90a88fdac43b47e165bfe872c83f9ff6454ac1451e72d910b19d0e","src/process/uname.rs":"5dfa68eaca2538c342330d1332d36a822f1f11913d7d3e1235732cd2ba432778","src/process/wait.rs":"37089a8d28441099822a60ffc8b04ac98d0c60049b3fa82791f913504d78b00c","src/rand/getrandom.rs":"b7a5054ccc6f3dab01c9ab1eb2eaf4a7b3826afb8ce4e6e7352af8cf730afc01","src/rand/mod.rs":"9bde22996f417e84b54720a584b440b895f19ea4717a7638af98ff4c1485ca98","src/runtime.rs":"b577f2f12fffb4e75bde8e1b5a45e556b2e8ffc285edfdcc8deafd84463f158e","src/termios/cf.rs":"0788c3faf08beb7e907ba585d894b5b7006710eb7463581ecb35eeab1e7344bf","src/termios/constants.rs":"bd76e99f82ee8bfaa6e5f84b0f63127d4e5c4393c5f8669509d1c752130a127c","src/termios/mod.rs":"8f895da97fb833257931c5e77507096b946b1b72f6fea983b66afd5a61282feb","src/termios/tc.rs":"102ffbcee98ad72c02f6e4be77f761594a44b625c56df4c0667e08cb8fd3eba9","src/termios/tty.rs":"d07168a6f7e04e8ee5b070c03f840b83e6a047aba478995780c10ba4ee127126","src/thread/clock.rs":"de463cfa2b5420db29e3cd3b6658a3c36bea2fcc000cba8e2e71013cc0f5e2dd","src/thread/futex.rs":"902ca7274c2b2fe2f5743639697d80869339a03457d549c92e0e40fc1518faa4","src/thread/id.rs":"becf72b98879e853f19b01d69a9e301a4041efafa3587c6786cba35513ed3f2d","src/thread/mod.rs":"b2d79a861c2459b262e7ac7f6cf51f86bfea65961298bc9210c5915e60165f52","src/time/clock.rs":"e8a66ab064565e5682da378212f2a57036e8a94a48f2f4e197fb75f54d43845b","src/time/mod.rs":"9fc60d342eb166729729531cf88a3ec3e8baa71b6788f40aeef1351ee8b6c94d","src/time/timerfd.rs":"9ccf7c47f4f453c6f2405252ba9b6a534c7b5306a5cd237f0819d4f0255ee45b","src/utils.rs":"0341598c878ce8e4e11fd2dbda8aeb04b11a31f9255578c0a781b2a89d2811a1","tests/backends.rs":"05840d02e96c11bbeeb00c8c5afc647872f5650839bebeb973ba34eb5bc23036","tests/fs/cwd.rs":"6227a70d733e17844e43bcba3dff1dcf939f93ca60286298ea1ce392ef0b028a","tests/fs/dir.rs":"fe13dd693695d0737b565e765e60eb86d76d42c15e135481e6c8e79d206c213c","tests/fs/fcntl.rs":"855b3e69f65994268c541eda40fa366e7be46fdd2ce2ac075bdd6795a0a4f3d6","tests/fs/file.rs":"1985d226a4376e3aec86620d1d1aacbf950683ed939db851e6342227f5d7227a","tests/fs/flock.rs":"82ec6477a71b8a9d6942686829dd7ede12514d70cb90b71e2fc48a1286db7476","tests/fs/futimens.rs":"bd9388b8cdd53d6b9b0da7b531d79a37257488218efd68b342b37051497c2b4d","tests/fs/invalid_offset.rs":"bebe8fa9f0555731fc97bd3ecb40489cc41c02a1ac3c48c9c1ea25b201440bdd","tests/fs/long_paths.rs":"449a1a69014f86b4b960db0d52bd104274df16fbff96aaed6d8a37bee627ed09","tests/fs/main.rs":"855ab2ca2a9088a96b29e12f0c8e29982a5c7f30689a0b8cfc04110aad3fedb3","tests/fs/makedev.rs":"41787d477f23bf1c6705d10f834b4c8e973506e3e1146d3e29c95ce7e667df54","tests/fs/mkdirat.rs":"0ec3b9f0e8ed193701e23e95c3f7bcf1e771788361906885ca83af65de71694c","tests/fs/mknodat.rs":"d32ce6ff5b2efcc3166cb0766af9577945493cc9342bb73b5bd70475ab8365e3","tests/fs/openat.rs":"e5471aa6597a9fc591d2e4b11470d5cc68192d1025c71a709662c762aa8298eb","tests/fs/openat2.rs":"7730c44886ce8766d2c035067caf6de13ce1fa4b11ac871375dfa06a99688f76","tests/fs/readdir.rs":"2e2a34da27b5b3cbd1296a3c428a45dce0c3a1ac9414e5002008b21611a3799f","tests/fs/renameat.rs":"021ebfc3375cbf3f8f3823364647a21a60ea1ec784acb1d9fbb6e309484acf85","tests/fs/statfs.rs":"1dab0140a8c8a296b3389868064643eda84c49363b2189c6c1f86392631f7f4a","tests/fs/utimensat.rs":"0aa41d9c40f0c33983590d69d9f4779d17b4ce7bc952bb1b6ae7b506fb1a9de0","tests/fs/y2038.rs":"992377ea3fc22550f33bda36e1debc356728810ca2b679234c86316504ce5982","tests/io/dup2_to_replace_stdio.rs":"0325983ece27c323ab1a04542d56eac26e517425f98eeef607e100f680f50469","tests/io/epoll.rs":"71689f28351b61946bf05a3c89a80c4a85f8e6ddb17bd6370b4ca5cc22cce51c","tests/io/error.rs":"cb9ba3bd5383cfc0f7caef321e70f12ee3ba1072cb8b213b295d0e22bfd7bc81","tests/io/eventfd.rs":"084f9bc64b12bc2fee9b83fd29bfa42dd64d9b710f5b63bd75a37cb6a2f0b760","tests/io/from_into.rs":"8f3e70a9ed0433f24d30d3444596138fdc91f363dedbe9908e0d8b6b8cac6b14","tests/io/ioctl.rs":"908182673e65ae67d02997608efb3c6597379c17fe1fc285183b9cbb94046519","tests/io/main.rs":"d9215378d1d9a91263c2831803e6b691cc5ee5fd3f3dfe03633269741413a9b8","tests/io/poll.rs":"6bf9ad8584c2bbffd0fd35a5f30d564f5399e38cd7d229a41bf2c822a07bf0d9","tests/io/procfs.rs":"313d308dbcb818804185b4f4a1090e87f126a76a3561d4032f4f94a2734790d6","tests/io/read_write.rs":"741ac241604706eb7b5e65d0b70b2750fc7a97b5e193e2f83b9badec60c155ec","tests/io/seals.rs":"63a8d6918604989b261207e5ce5ca9894bd4bfd51a4efc8ae4e1b0df9a12dd4b","tests/mm/main.rs":"189d731e45d8f78c7866e065e62b0ee7cd4d00f707be2cf1e2d2ac03cd64f57b","tests/mm/mlock.rs":"a7a9461ece82e006b52f0edd352d66c1a0c7ed448a985185050186c3c09104f4","tests/mm/mmap.rs":"342e9b03058c01b81c5f94caf0bb8d9804e3aab88ba125cf41335c89e3140db1","tests/mm/prot.rs":"b384ab62497ab431d54c22a1ebadab0d8d82218bd90c301d47b8ffe77646bf7b","tests/net/addr.rs":"735fbc06c637a8ff2a600ba01bb38acea597576f6e1038849906cb6c374885d9","tests/net/connect_bind_send.rs":"5f07265b705e0ea8503e3783183aef9efcca8c22b44d07543601f68c8bd6a90a","tests/net/main.rs":"4e5b3933201581d0f728a2fddf8c606b909c46ecf783df7bff70bf02e759def6","tests/net/poll.rs":"c09bab98177d9d53a011fae59a04c16d4cd3891f5503cac34515a849159e7af9","tests/net/sockopt.rs":"45cd771f8eeec1e4a1b10f15742e5774d801459abd8eed9f169f83415d06e524","tests/net/unix.rs":"8dc0ab6801d3384a9449147830357b272eb109cc444f64afcbbc30265eb07309","tests/net/v4.rs":"f3027b3e1aff90470a175aa8aed7705f5961d6cb5c22f95a222d22dfa73e9a6b","tests/net/v6.rs":"7169e5468627f024a00788589e881f578081c1989cfe545077f5eb424f5013f1","tests/param/auxv.rs":"e59ef1ff4207ef21546046a38215a49be0531f58f440e775643f8b413f9a5e62","tests/param/main.rs":"376e2c6a79931e9b2005686b845bf9d7a76531079c10e0863fcff4cd95a9a2b7","tests/param/weak.rs":"3a7f0a468a6153dabf49fc5bcd735c559d9dfcf8e770194fde71ee266281f68f","tests/path/arg.rs":"2ef95bfa674db279a04927dc986b4ea6da64559d2764c1a3a38b7ef73d6bb656","tests/path/dec_int.rs":"e1f9c55aa5e1a3bb974e80cad0ddc04161b558c7e9b01b0e8d391ce8c78c1aea","tests/path/main.rs":"d9efb138a9f1bad0de19ca0270234eda4209e12c822d88f25dbb8367ad27f05d","tests/process/cpu_set.rs":"f34f4eacf69ce49793506e598f488d640b38a29239101eddc9a06616759883c0","tests/process/id.rs":"c605520595555fa25071dd32a98f7a63c1c3435d04a96048240d9547c2eb2705","tests/process/main.rs":"25dd3e10bb46857eca97ebca1aa080e0cf0a0c73a50c5629da53abfc59109e6c","tests/process/membarrier.rs":"65d74ff51b6f64bbca0b0f5e4e36f7008fcb378e200d8c647f91da572ca15f83","tests/process/priority.rs":"bc67dfeca05ca3b5fb4589dfcde9d7110520006249d523cb12b3e860c42095e1","tests/process/proc.rs":"d47b7c35c24cb98d2219e4c453b96be9648c635bfa996e86d4050da2de157962","tests/process/rlimit.rs":"c23813bc6f3940a67f58264bf3a45d7f5688ed1f5bd020ea0cb00c97f85734f1","tests/process/sched_yield.rs":"1c7b83fdbd91bce384fec844acc0775548ed7ae7b6e3dde255b2f47fdaedb5ea","tests/process/uname.rs":"0c0347a81df9029c04290149256e333dcb45078f0b5a107a192193d7749d886f","tests/process/wait.rs":"e671016a65ab4f0e5711af33bcdeb639ee92f4894a964dd6fde23b33ffb80f92","tests/process/weak.rs":"9f62b62c7b11427e994dd46cd59522a4d879c5dfef39406eb7d78aceb665989e","tests/process/working_directory.rs":"c914188666a966857084bdeedd897c2ab741b0a6819536c9c303dd414d7dedd8","tests/rand/getrandom.rs":"6d2ec8dfbe92ad996bb1fb98dc6760ffee131c6d494f6ed01fa4442df3b4c23d","tests/rand/main.rs":"4bfa0968870ca7712bd5cf07f67c1e380934d414c925070ef381f0edbdd6ddfc","tests/termios/isatty.rs":"b6b9895345c97562c9d3d1a6297652bb7610b06394676a58cd5d334bf7c42697","tests/termios/main.rs":"83e824f25798cc9e2ba975f58f7446517748d5e82ef3e2e95b6c5166665cd1ec","tests/termios/ttyname.rs":"89cbdfeb87ccf060b8b2217f955fd18ec49b6125a51497e404185afcae93881e","tests/thread/clocks.rs":"e22fd56af0ac63a38ddfc7bce29c0820f074e27e4fe20b8270db54ffe4697835","tests/thread/id.rs":"29e24d640045a5eb1e73b72aead0df5b75f7e812503aa86d46fdada66f2967a8","tests/thread/main.rs":"716d0008c297865517a169f28c3789c217b1f735df927b486931c40577603894","tests/time/dynamic_clocks.rs":"74f83e581bce16e45e0fbe512ee939647fe7ff9ae0462b77763077d5cf0dc1e5","tests/time/main.rs":"1641dc6ce6aed219c9c62f917e35c2935494ae2e5098583f72450415ef684f94","tests/time/monotonic.rs":"2ca0292e6d7e6d5bdc8263f053ee1eeaf09f95674e432770ad3e0cf46d0ebf54","tests/time/timerfd.rs":"fab1509bfccda9d867ed436621d028b516d553a4ef75d95221e9e359252d47fc","tests/time/timespec.rs":"a8192c52071b22fed45f5cf80d0a525b29d28e5f69a020d5d6e2dd3ebba3609a","tests/time/y2038.rs":"969a01bf34f3aee83a98d9139a8c739f8dd72bf574a41561a630c1a1e004f08c"},"package":"ef258c11e17f5c01979a10543a30a4e12faef6aab217a74266e747eefa3aed88"} \ No newline at end of file
+{"files":{"CODE_OF_CONDUCT.md":"f210602311e3f74b32f46237fd55f4ce36d798e85e3db1432ec667f63a7ffc44","CONTRIBUTING.md":"fb570c76cf924cd75b77bed52b0dbe1e87ce224dc3428c48d98301710dcc331e","COPYRIGHT":"377c2e7c53250cc5905c0b0532d35973392af16ffb9596a41d99d202cf3617c9","Cargo.toml":"2b7e8820633cb8422365f8ac45e1724cfd2202d212a570b1882ecd12600a52c6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"7f4a59fcebb44a860dfe5c32e85ada9a83e8dcd6214ba46258e13b566b59b8ed","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"89a1349fc84e32d3f144daa4b6b41a97b3fd8dfaa71e7e4c0c7b4963f5afb019","build.rs":"1fe75202f65ca5724a5e4a2615efb166304e014e29bc7e11261177be522e7d73","src/backend/libc/conv.rs":"a94f5937ad41d7c13e4554481ea1d8ac10c2954b22e55ca0ccd93dedaeb6f1d6","src/backend/libc/fs/dir.rs":"e4110428c2bca8b35733cce9fde8b53f541bef52cb78380f103264d1ef6cffe3","src/backend/libc/fs/makedev.rs":"b8c7f845c3286b9efd7c6d32e58026b36999c583769e52716544191f765873c8","src/backend/libc/fs/mod.rs":"e749e9ebae31c41a7b22a046fdb6c4462ed9e341e0b441f0b755774e17c01428","src/backend/libc/fs/syscalls.rs":"85545b4786ba417b11ae7c9a4ed5711495d40f22c701d983ceb01c91e83ae041","src/backend/libc/fs/types.rs":"f4bfcf89faf517eae82637202a87b04f75d1b1be21a32e27d65ce143d02d4342","src/backend/libc/io/epoll.rs":"25e89e9dd758b7f33f84c3a8062efe63fdb7c9f9b4ab345d7140dbae590d8a26","src/backend/libc/io/errno.rs":"cef81f24b14891b9e7e0165c1d5f69ca15e0d591ce44c369fe2528d31b5e7d52","src/backend/libc/io/io_slice.rs":"34da1bcc17993318fa93b7e71ff36116044ac12a031963710af84c3ed1bc443a","src/backend/libc/io/mod.rs":"a76e0071a887a6bdb1a3edc4887f91889d4beab1426e73417958257467f3c602","src/backend/libc/io/poll_fd.rs":"71c83405affcac8a4a7d4339cf71add4f3ccc2f3ef72cda835eec96f5a115cd6","src/backend/libc/io/syscalls.rs":"4ad98f71e052b3213bffb9769cf8d79e9de02df596c253d575b08f593f1d297c","src/backend/libc/io/types.rs":"62bbef9f8b1223214b88d1ae54401e550d2e96e853602cde0bfcf553809e9e0e","src/backend/libc/io/windows_syscalls.rs":"741f524b384d59e703b278739563ab04273dbb48c062349353dd9b7cf9ed2332","src/backend/libc/io_lifetimes.rs":"8d5c5a789321d0874a53b5bb6cbc0df866634c7c1ad2a20a7b073e0ad2c85169","src/backend/libc/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/io_uring/syscalls.rs":"01f8a4cda26bf4e0e6ba92d9d6aa27b70387e1f3fa5566130edba03bce9bc842","src/backend/libc/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mm/syscalls.rs":"2f6600bc0d13b8a425e3c082df04c296091ea3c435c7a47a235f302a53034bef","src/backend/libc/mm/types.rs":"af20d737e5994ce40831658cc3a5e20d707a92f76d1597e950ab62a1cc97b95d","src/backend/libc/mod.rs":"524dd7181a289aa4d3bef121f6f3160b215b5bde754812299cd1cd498a9db4eb","src/backend/libc/net/addr.rs":"ce6468d789cfd944cc72d3cd27c29f23c257d8b95a534ea5bf40a26ef1f72ca5","src/backend/libc/net/ext.rs":"201977ad8a8eff409c7e7f5b3d060ffc37a8396b196bbf397a650fdefaff636f","src/backend/libc/net/mod.rs":"772c788c60141e41044b59c4812c4208f52838da1effe1d476ab1d99304d9f9d","src/backend/libc/net/read_sockaddr.rs":"ac28ddcccd8dba65d979709fabac34bb5f459e95fea1877cad2e6b14073414cf","src/backend/libc/net/send_recv.rs":"b22a1f64a8628769e94fa4082ed100b1845f9a01a158c5777836947e7e71d7f9","src/backend/libc/net/syscalls.rs":"64450f0a90bcf5e80f9ac814fb197f3063570f16c6daf215bad3fb292f57a656","src/backend/libc/net/types.rs":"7851d7c258b580ab8c64463dba951668afcb928ed687be6480af455ee5603c63","src/backend/libc/net/write_sockaddr.rs":"140ea379b63e93ae27ca6764a6103204ba31431796484eb91d1829c754e8166b","src/backend/libc/offset.rs":"5a31da74aace8ca17af40c60004f4ffa4caab7df06d833edfb9268fcfc7231fd","src/backend/libc/param/auxv.rs":"7d71f224f7d9c547b6b5e1425cad03466328b7b8ad2a62f49d9e29e075061e43","src/backend/libc/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/backend/libc/process/cpu_set.rs":"9c0734ac8f07431e0ad704ca5bd749c9fba25d295c8ee59dd92437c0d6fa05b2","src/backend/libc/process/mod.rs":"45a9979d6bc7c669ffe212c55ffbf6ea8f4bdb9a711c894b9e93b52a05e611d7","src/backend/libc/process/syscalls.rs":"496875ec58336293966db86d8af01e9a2f070598c39895012e75cf3826c3be5e","src/backend/libc/process/types.rs":"48d6a96ef735f7e4842edec75ea37650919e97f62bcd1cefabc0bdf58a93fb40","src/backend/libc/process/wait.rs":"47862cd801bb2e0b4f98a48d6755fb263014675896fd888eb500866ba35b2ba4","src/backend/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/rand/syscalls.rs":"dd675f045e4f18ae57db9a67f95c67a3f0d14d3b8df22907c4e80ca4b611dd43","src/backend/libc/rand/types.rs":"8a840167af1454d1399c1defb254e9a626ab46d00981e9c7360828be6ac45b08","src/backend/libc/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/termios/syscalls.rs":"42fb689f202c22bbd6ad7e286f9dde657f5ac7717743efb2ac7fe6a0e551e9fb","src/backend/libc/termios/types.rs":"314fbb3dbd5a6e05e4ac700ad30c4f4a129fad73493dcf372c9295fd7b5740b6","src/backend/libc/thread/mod.rs":"0de5f67a684b9fd7628d3009d2ea5fd51b8770e8b387eed14f59152157844287","src/backend/libc/thread/syscalls.rs":"0d59679e92b28e51bb2680fd3d0aad0ef768fbdba37435bec3e249031bc61715","src/backend/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/time/syscalls.rs":"6d78a726329e8dc45c4cf965aa38989398ea119729587f4729aa363d8dc7d72e","src/backend/libc/time/types.rs":"f48f6baa4b5dc5cfd5b937911d234ed7d94d3c19f6305334d21d72dfcf246c68","src/backend/libc/weak.rs":"89b985e993ecc4e932631814e1b67933ae0127e278042f67926ad2fcfa55f90a","src/backend/libc/winsock_c.rs":"1739787b6a6e878c5d0213ec7a2151c3495589962829711c04e3e8a7782fd846","src/backend/linux_raw/arch/inline/aarch64.rs":"67011427b3cecd29ee716113d952e70d63574c96d1d3ea3c75d46250bde9ca44","src/backend/linux_raw/arch/inline/arm.rs":"7760d51aef17a69a797eb96fd61f7fade0d55bc87ec9a3e77fa6bb6aebaecdbb","src/backend/linux_raw/arch/inline/mips.rs":"d00c84cfdb4e37bdee9a2daa0a7b3298afbb4ebe288702203cb43d9c2617012d","src/backend/linux_raw/arch/inline/mips64.rs":"ab5455c9b2511ba6b67a66873cd8b53bf77471249fd2779d6437ebb4934087b5","src/backend/linux_raw/arch/inline/mod.rs":"48e60ed847f1fe7bcf561d3dd04217589698b576649d17094da98bbfcb826e8a","src/backend/linux_raw/arch/inline/powerpc64.rs":"dcd12314184441f5f7705bea6b829103c7abc9062db366ae5584023a38252a36","src/backend/linux_raw/arch/inline/riscv64.rs":"58a58203e9cac2ed21e4a7b26692c5d56d3c2bcddb3f60a648efd18a02129f3c","src/backend/linux_raw/arch/inline/thumb.rs":"82b88c9a3b6837f28a738cc760fc2403e7014abdb2c35d2bdbc8073235ae2863","src/backend/linux_raw/arch/inline/x86.rs":"459cca47f3300418de9945858ba42009e66e4be3c8da268481f30ae4e815b3db","src/backend/linux_raw/arch/inline/x86_64.rs":"7c893ca306b3b8a5980c525dc5fa23187a0526bc9f7ac637204d88a1d596df5d","src/backend/linux_raw/arch/mod.rs":"2f2e26f5742c302bb44f367ad265de573d89494eae0789fa44b5a39248e354e3","src/backend/linux_raw/arch/outline/aarch64.s":"84f066b6fe3cf25ed61c7aa420408c6d5a0b33a7c91b748ed81e47737567975f","src/backend/linux_raw/arch/outline/arm.s":"fa266bf9f4533da1e96c27c4ae5418c86f44074ac0c6afcff0404738e11365da","src/backend/linux_raw/arch/outline/debug/librustix_outline_aarch64.a":"168fda5b82263fee87661cb146d8de281aa18f6748b372d4e24cfd73a5f3d9c1","src/backend/linux_raw/arch/outline/debug/librustix_outline_arm.a":"2f07acdd80130f32835b64a6e1afa37f62510674c45d5c4c53c39185e1091cb6","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips.a":"82b042b867680439a9a8123439cc81fd597bc2a579d63448c860260bc3061cf7","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips64.a":"1fd5e6e5e6c92dc8990dc3526f4c9340c246b6000c70097b058e5463a16f7c2c","src/backend/linux_raw/arch/outline/debug/librustix_outline_powerpc64.a":"08a7322545cd3ee790f7ee51e459dd289f7dc44ba4f71a94c951c6e7b655e685","src/backend/linux_raw/arch/outline/debug/librustix_outline_riscv64.a":"74ea44d51255593cd95d3298020df872536ec7b967f0d779018482a49966ecdd","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86.a":"aeb926e156f39fb87dc438dcd441cce9f04dec3a083a96344a373ea8900d55f5","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86_64.a":"c77044773834308d327927ac87a1a36a8fc4be333a876c2e356743deb455a24c","src/backend/linux_raw/arch/outline/mips.s":"e265e8fa0b9785a9f2779d6ba70ce982b954b802862b0026dc70fd79b12968bb","src/backend/linux_raw/arch/outline/mips64.s":"c79de202f0eb00e2d9cf1fce2b9a2cabfe4ff2f5cc1476bcfd6c3d139570d447","src/backend/linux_raw/arch/outline/mod.rs":"d97b3657e828a40553677469887b1efab0544812ca592ef359a2d4230a0dd621","src/backend/linux_raw/arch/outline/nr_last.rs":"82d92b9ca8307c19d74ced1ae2c0b31f2a7c5db70fa31fdedb55d38a90601455","src/backend/linux_raw/arch/outline/powerpc64.s":"0847fa3f160846ee02771550667913734ba9773e2221f2279c4f296d6f5b7bd4","src/backend/linux_raw/arch/outline/release/librustix_outline_aarch64.a":"fa8d31702cafb24d9799c162d3319c522892e91c58fbbff2b09950a0fa81b46f","src/backend/linux_raw/arch/outline/release/librustix_outline_arm.a":"0f7c8c5c02d5329d884f800da70aaf6b5b67c14000b12afb708f3e4758aa1f7a","src/backend/linux_raw/arch/outline/release/librustix_outline_mips.a":"c9254760fa993e88662c5e1e8911d994f29e203b37a0fc9b550be193125f5031","src/backend/linux_raw/arch/outline/release/librustix_outline_mips64.a":"224f9ac5196833491bee67fd287a53b7e88111731e2eaaa3ebefba31faea373b","src/backend/linux_raw/arch/outline/release/librustix_outline_powerpc64.a":"1f04e44c3d863bac066520c787444c314f2aa2f8d8d3cae38990ecc008b9b6e1","src/backend/linux_raw/arch/outline/release/librustix_outline_riscv64.a":"465b6631b33632f4a6aca32b04134cd07993cd1bb55405a080157829d7396373","src/backend/linux_raw/arch/outline/release/librustix_outline_x86.a":"380aa7c802be2795471407d438e3da768df9bdc7340cc448d3a91b2d123dbf19","src/backend/linux_raw/arch/outline/release/librustix_outline_x86_64.a":"36f837703d7f0e246b7f596441010fdc1be27e42417af925b6040504c5aa32a4","src/backend/linux_raw/arch/outline/riscv64.s":"ca5303c0c8af6de1f246d658003e270d4e29d6c68dd90c6eee372d045bdf7305","src/backend/linux_raw/arch/outline/x86.rs":"f7e12a0f3fe8e97acb1ade2c9e61d82542f00ad4d8fe684a8dcd9f30fd9ab5d4","src/backend/linux_raw/arch/outline/x86.s":"4604e3b41161802343e2e4c890fd2042098a901d95893ebe4c436f97fd47cad3","src/backend/linux_raw/arch/outline/x86_64.s":"a530084cd42ad8d4b2d36526f4e04f45a6e29ea49882e2c561ac2eeac16272bf","src/backend/linux_raw/c.rs":"f112bda3f89c5859f9130ef1a9de1000054af7992073c20ac230230610a29a6e","src/backend/linux_raw/conv.rs":"ad343251bb09c263ef4c7a280fadceb2f515830873426cadb6f3cd908f0ca8be","src/backend/linux_raw/elf.rs":"a257fbc3f22e4970605cf72a3b301dc2eaee2f5f1b3b0ea434fa192db3c3164e","src/backend/linux_raw/fs/dir.rs":"d54842a373968da54bdae73e10ccab7a8bc19c1bc75b6dca2bb70818c5b275ea","src/backend/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/backend/linux_raw/fs/mod.rs":"021f88307e54b391367066ac38c8316064cf1c526350ed1ee1da89475a2c1566","src/backend/linux_raw/fs/syscalls.rs":"e2c9a41b4a63ed3afb022803bff4d991a375d3d9f75ccce311a8ea48c54f52b9","src/backend/linux_raw/fs/types.rs":"de709c7da97a8b15fff7e99f086398056885e3eb397c0de658dd7e68bc78a7b6","src/backend/linux_raw/io/epoll.rs":"71026126ddf47c07ef568a1ee5057c57da41026e80c4787b1b168a54b01a51a6","src/backend/linux_raw/io/errno.rs":"db192a59aa27f3ae34f7c9b246c158c4db173e6ffb03860ce1c5541c0dac31bb","src/backend/linux_raw/io/io_slice.rs":"5ba992f3fe701184841006588b35f2452156b73e3bef9e07460e4b1f61ac889f","src/backend/linux_raw/io/mod.rs":"6ea805b91d571217c9649364121d0824bbdf4635b36c9150e5968fbeb75c0892","src/backend/linux_raw/io/poll_fd.rs":"9f5a15c80094cc3334acd171c0621d033b44d5d9a987a57acbdcd62cb17d871b","src/backend/linux_raw/io/syscalls.rs":"0a161b4f05c05c812fa1e511f3c4a8239c58941519a8d17f2f45a875166f2461","src/backend/linux_raw/io/types.rs":"babdfe55f4f2704559dc38e56bac55569d69c0911a906381c19cde3e1a2b420d","src/backend/linux_raw/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/io_uring/syscalls.rs":"c5bb6b93718a8b6db743209701b7f5713dae6514e822875d34609b881f3058af","src/backend/linux_raw/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mm/syscalls.rs":"647c1846793c386f6babae898686604a4808344ec3e2d1e71071bbfd04079357","src/backend/linux_raw/mm/types.rs":"a5d0ea04a85df5e196d68a8524c4325963c7b2ded3d7d48713c8e855273b60d4","src/backend/linux_raw/mod.rs":"62db302236f6d07f2315956d7515a3347a0d3a08991b8ff308166a6f6d6d0707","src/backend/linux_raw/net/addr.rs":"b439d61da1356708987bf7de3dcb44ba45d58dbf8b2db1234b0fdcd88365078c","src/backend/linux_raw/net/mod.rs":"4ffd3f6f9cad722e4c29b9bad4912a69f521d737b9e637599a1c60436651d4ae","src/backend/linux_raw/net/read_sockaddr.rs":"0357ae643c384b08578aa0b148ac9b236953da9b36b2e387a40d5b87ae9eccef","src/backend/linux_raw/net/send_recv.rs":"42834cf8148abd02021115a61d57b23bb323dd8ad0d1b9a91d17fb8f7defab01","src/backend/linux_raw/net/syscalls.rs":"b989424fa6e181998c1c0c738069d7b98841acee4691454c2bb24588c2921994","src/backend/linux_raw/net/types.rs":"c61b689d7f4b9b68d065935d70926d47b5ac7246b2fbe4f20d144a0c2f417fc2","src/backend/linux_raw/net/write_sockaddr.rs":"ec0bf20a354cb86e2b5646bfc79297a378f11fcdf5641c16e4dd13e305011dc6","src/backend/linux_raw/param/auxv.rs":"da21efc4eb515dbf076e5011b88fb29e694cf17afd44e0f22ee6f182c89ade41","src/backend/linux_raw/param/libc_auxv.rs":"00a44c8593e55326386980c78e38029f43891dc47c7930243853ca6ceab1d46b","src/backend/linux_raw/param/mod.rs":"db21fc1b0ea5568b8649890fa38a878bfcdcf7398f6cf1640176b37bcc6ce990","src/backend/linux_raw/param/mustang_auxv.rs":"9ca4753766736ed6e9b2ec4464c4e9cb64e5f85a4f75fa928725814d1be02a79","src/backend/linux_raw/process/cpu_set.rs":"2c996e58b556d7528885bc5a8477846a60d0086f812364643db0d2ee6e99d9e4","src/backend/linux_raw/process/mod.rs":"fb393c70a9c63ef9a6bf1fb5a2dc94f07d6b0b6987cc5231c15c607015dafd68","src/backend/linux_raw/process/syscalls.rs":"542cea257842929ac2a668a44c045ed1d9893eaa2c4722a5a5a10659a8e40cae","src/backend/linux_raw/process/types.rs":"fba10dc8ca9eaf4d481cb82bd1540cf5c05620533c44f917c09a22ea55ef408c","src/backend/linux_raw/process/wait.rs":"81e20506feb1e6f90a1fe0cc01768d380e11e7f8afe5212e353030835dba2408","src/backend/linux_raw/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/rand/syscalls.rs":"b1d8b2fea0c792bd1e7c24ee59429d178dc0ad442ac817b12c7abcb38d71497b","src/backend/linux_raw/rand/types.rs":"271416d5241d70932b8a17f3b67eefd1b9c360f217f807de3d73192e9b620552","src/backend/linux_raw/reg.rs":"f9ab26b045150894b98c741f9e80ac2734bf7598f5cf166ab080938febe7af20","src/backend/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/backend/linux_raw/runtime/syscalls.rs":"6488160051a991e6d385abbf8a08ccd6498acf525906d512b3f89bf3a33fca6a","src/backend/linux_raw/runtime/tls.rs":"c8e6c9a4277a4f50539ab8a666a59b78760ba3426c8cdd3046d8d5ac41a3d1cf","src/backend/linux_raw/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/termios/syscalls.rs":"e8a1855b5c171dcef67e98afc3d88092f723a1503d68b8ae9934359c9e2da264","src/backend/linux_raw/termios/types.rs":"f95e3c697156265612b02489cf5bf0e651bc6054ab97c5ba7b59b03b3c664470","src/backend/linux_raw/thread/futex.rs":"e4ca5be060c52538b97df3781d84e2eb4d8241a7f647b2874412bc0fe6061efa","src/backend/linux_raw/thread/mod.rs":"f7132a68c9db1b4a796781b9e8d0ac268a1ddb713e510bfd43425564ec9b39c4","src/backend/linux_raw/thread/syscalls.rs":"ba5c9659dbca75796c9161eb98f9548a7d5e0ba758ee8138f70e582123bdced6","src/backend/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/backend/linux_raw/time/syscalls.rs":"184c1208a744e9859e98a7f3e1425db12b00594d2aed42f64a5964e184ef0f31","src/backend/linux_raw/time/types.rs":"865d968a6d2903344982f94c69868031cd1fea582318659ca4c69a11d8a53e33","src/backend/linux_raw/vdso.rs":"400af287fc77ab464489ce4db21c842a52a72977bbec285675f3eca98c4ab6d9","src/backend/linux_raw/vdso_wrappers.rs":"e49159aeef47f1bb1128f7a3c0aba1cc22f6ad7a9bd712ca1278ac2e18c83a9d","src/const_assert.rs":"ff08ab91f11f2ad29883096f4468bd9a65060d5a9e6681e9282bb081f8bdac27","src/cstr.rs":"e5db2aae8fcbad410218696e3e3b3a0da3cc17fc7f64360fc1127bc4e4deff76","src/ffi/mod.rs":"1990dae8190991142bef24220f02b99c96c5bfa7dda2a7974d9dcac265d58945","src/fs/abs.rs":"f30ccd2cea4a850250db931e416762f1d9727ab2839969f3f55825c13eabfea0","src/fs/at.rs":"0f3a7bd25c7dcda26f6327e2cb68307349e963b67ddb80633ee1861c39d91864","src/fs/constants.rs":"4692df5cdcaab06158be44c017b0baf4ec8a98d3636574468cd3bf086ff2ab5e","src/fs/copy_file_range.rs":"a48f5688a4697e0bcd3079f7dc75908e8d044bf479fecd97055c2efb56014671","src/fs/cwd.rs":"c7b98a4f1a49102c22ff587fd5aa9cd9b9bd3ba107d0337c58fa996b5521671e","src/fs/dir.rs":"c88832b426a731b26b8d307fb5bbcb41fa64346e31d700503af8539e492278be","src/fs/fadvise.rs":"beef66ebe1310fb92628240b2cde68f744c78e50f6ff61bb1404bd4868d9cae8","src/fs/fcntl.rs":"30ca419db650dcb266110f421bd89d9ce4a81365a7fc153aa00b2fa003a1d052","src/fs/fcntl_darwin.rs":"07f07b2ac75dc28bc9e08200f72eb95550a87ff3d69c1204f49ecb63a0c4fd20","src/fs/fcopyfile.rs":"ec95929cbbe02cf49233a785e5238931bb107b7903cc5bc95e4231de960995f2","src/fs/fd.rs":"a5f75172d7a304595aa85a8a04ce996272c15d232d60cce991bd4b23a2b491d9","src/fs/file_type.rs":"fefd865f91011f66126213b0994773d99e373b468c31e866002228c98c64ad85","src/fs/getpath.rs":"28f6970fc1bbc37bb35c84724b59eac436ea7407a4522e18c2bdacb1fdd2edd9","src/fs/makedev.rs":"85520b484cb7c15ab71ea1c368578ea3b7e484d82f8510db92b6ce9f7ca341ae","src/fs/memfd_create.rs":"3f1d809e81fe479a82a454a04ea1219a11969d75d0c8b9ddacb09c630a9af896","src/fs/mod.rs":"31527cb94628ae9695409d45efb2eacfd68c2d64baef4f54e0d1b8c90301ebba","src/fs/openat2.rs":"4a95c15dab533a41201b5fa25c8a212956b7571d58cad696bdaf45af8aef96db","src/fs/sendfile.rs":"ac053f03608656bb675228ba61079b774498c0233d17e5816ac72538bb12b70e","src/fs/statx.rs":"88d4c497a185201921884502c78ca5dcec51b0f4768f930dd3681f1d03de46e8","src/io/close.rs":"c59bf90183625da1b1e87975739469440dcddc7b5b2b6ff3a6fd12b2d399a783","src/io/dup.rs":"5dc927cc11bc74bc9d03944261379422ce684945209c16332bd6a9ea64e6c381","src/io/errno.rs":"733f8e9246a319db137740e8dca29d7b3c7474a715e066568b1dc82f0944f692","src/io/eventfd.rs":"163aebe29b5a0e21dd9d121d39c71e82bc6569a4bb658026cfef8ee61809066b","src/io/fcntl.rs":"4174010a26ecba74312cdf900e27594153cc7ea44e03664b21b6e304ec5382b9","src/io/fd/mod.rs":"a1eab9ce9a2c4454053afdfd3f3705e4cb971e94cc453e4f13690f2f0d83dc2c","src/io/fd/owned.rs":"b339000df323764414c71cbe60a7ce0d5e4222cb4c125c7ce40269defaec18af","src/io/fd/raw.rs":"9bcd00be7df3d9f4e6c49ca2d18ef25aee3d6f0ed5ee6b73df5a9beacefb6031","src/io/ioctl.rs":"705add2c90270980523ab31fd224dac4f0fa210d7475b1b3a2f31e1c0e2a818e","src/io/is_read_write.rs":"072b5ea6ddb2339fc6c7e90dfc5a0a5354d926d0f2ac4df06cadafe823425c47","src/io/mod.rs":"6b3d50275cbd5f67f87f17d3130dd1391366762cd27d2bd3f060d5040c366ff4","src/io/pipe.rs":"fabf1cfd5bb3bba5866f530503da9b10afbaa5f0ba33900e1b8cf05e57c3a361","src/io/poll.rs":"41dab55365df215739dcf71815bfc4c2344828d8056ab200564f75210dbc56bd","src/io/procfs.rs":"d7b21900416ca54b9bbe683257dd4da1857f56edc25dd78a954dbafed4914ab9","src/io/read_write.rs":"313aef278466ae546a0989ceaebc41a673f04ba59a21171175bc7ed415c2ffc2","src/io/seek_from.rs":"16072918edbb97e7ac92a0b38bcf0781ff9e968f77661df7778fa0154d2a105e","src/io/stdio.rs":"e9c970290d5a83666966b123755b92454670d4cc6eb03036344ce8ca2844aadb","src/io_uring.rs":"0c6e1531a03e5739de2423b6d49b5bece77b2bc179adf668193abf10f78fd004","src/lib.rs":"2cc7563fad063c99d12e32188adad782eea78976c4ced13b794f8dae780b85c1","src/mm/madvise.rs":"cdc61b39d8abeea184575ca21e14483c335ce373a86007439fad6e72f58e4e24","src/mm/mmap.rs":"988dc5e7ab116218e14c2c387f8eb90ab3031c2d65560a6fd0ff021666919db7","src/mm/mod.rs":"92d2cb7e8e27b8e6bf2e18e29137aa249935f9ae97ee48aa30fcbb1acd0f4b6e","src/mm/msync.rs":"a7f61abe4cb5e96f95ae8229c62b9ecc08382080ed99d76278be7001cfcf82f2","src/mm/userfaultfd.rs":"8073443bd181ff0b3ba4d0b1ae67370b4864035a0c8b4898cd709dc47c518ae7","src/net/addr.rs":"1d84310a4bb7e45f94a10b2cd2000f208db9e28e21bf051ad493261d4e46ae35","src/net/ip.rs":"92fa33205b9d955bf956b152ad283757f3526ec3d7cb9cd958ae460b3949619d","src/net/mod.rs":"cc99751c260f63d1d98bfd26c08ed71cb7fb1f9535c98af75965be25c81a1cf5","src/net/send_recv.rs":"f1fb0b9be750b1949b54054b3195904123cfb96f2ee0ebcedef86fc7175c63e9","src/net/socket.rs":"15840dcdabc1c5fe553f67aa29670f75fae3339b33d019613f2e1d9d573e7b8d","src/net/socket_addr_any.rs":"076d682aa000b2f4421c41f88824533dcee56c2fed874740b3c3cd7b2140564b","src/net/socketpair.rs":"b005b019f8ae0f022fd0e730dafb258606f1f537e4448078175fc192d002dc81","src/net/sockopt.rs":"5276668a1357b704681d33e999a65a91ed684e55024e54b33d55d64843f7b0ed","src/net/wsa.rs":"6e546b42f50a851fc833c57cda76cfb347203ed4b0dea574a3d325bf5a2ebf80","src/param/auxv.rs":"988872f9bec2e12f35765ae8963cbb9535d4acaedd4c9a4d07ced6feb70e0aaa","src/param/init.rs":"671d8974f0d9b82e79076d1f4deabe0273a874a329f74b8aad26e07b86791ba3","src/param/mod.rs":"57ba7d1c16cfc419409cfe73acc253723df79dd0caaf46864939f9aa0a7cfa50","src/path/arg.rs":"e137550750e3bef341579ceb2448c0e50a666ab614a49ad00bb9fdb1e3ead9dd","src/path/dec_int.rs":"6442d2b8fbb648cd4c50eca40daefac9422c306bebeb34de053a8c57989f1dab","src/path/mod.rs":"513fea21b1ba0226c3c5da769ded06a7cd7abe9f49cec9d165bc62a15da126a8","src/process/chdir.rs":"4c63c351e207b1bbefdd7c001e85fed383d5ac2147894d5a09fbd8b302d7c728","src/process/exit.rs":"79f6c0dd45dca0a2bea919ac920c4a56cea23608a345961e4d027aee6624783c","src/process/id.rs":"aab5ef5818e2b16cc4950a92a9c71e72be51a92cbc5778384399ea8ee2a872fa","src/process/kill.rs":"e4b4dcc7e5b2a1e3e68ce03ce9a5dde43108dae4ddbc443488c464194738d06f","src/process/membarrier.rs":"f35aeeb9ab4e1918f9606bf11e8c84db3d20362f01513103ce988d86b5481a7b","src/process/mod.rs":"727cf13a29f1af83949bff00df47d2ae0a92f922d147d5671aa8d0136d3dbb55","src/process/prctl.rs":"884d29ecc07513f02d6aa06a3a011319289829f2977f156ae262dd6ed68f8c6e","src/process/priority.rs":"653a1f525c18ef1de685a3c3307d5214b0d20e61dfd1d4f5065d9c08ebcb4185","src/process/procctl.rs":"5da78c978ae5e9c723efd338b4388ada25b4308ad16c78fdfa34c1ffd86f2132","src/process/rlimit.rs":"b030f3cf585f2eae210703eb01983b937797bdcb9b25a84d42c26711ce7e2221","src/process/sched.rs":"ea8b20942ef09dbcd7a54d8218435129dfece427e4960055bcdf81c997e80f5f","src/process/sched_yield.rs":"6565faa3928b66ddc74a65e893e15edfa4b9be4f7e5f5f68527501a7f6bc3350","src/process/uname.rs":"850f16288261ea8fa92714402a72e89ba2b7880ffea5a9ab9b4c1613b1642ad3","src/process/wait.rs":"6019bd90fd1f58f328099d484e54be49c4327b73bf21e35d071a0e3d1c22dd0c","src/rand/getrandom.rs":"7ad1be6a5b0dc25030bb2434bdc00f3a0c410b7ebc24c136b9839410bf6c5a97","src/rand/mod.rs":"9bde22996f417e84b54720a584b440b895f19ea4717a7638af98ff4c1485ca98","src/runtime.rs":"c6412d171458922f50a85a84900dd3ab7d8ba603b4c058eb9f9d70de52cac628","src/termios/cf.rs":"cb13ee88cba541cbd683c7a5da034a126fd9e09dc6b5f25c9f32382f8318ffc0","src/termios/constants.rs":"16747dc753fa85206953f297067d2eae3184b4e3681a9818f3fee67d206f7e89","src/termios/mod.rs":"284de815b9821350a86fa809e26fb888d2a46bcd56ebc25bfe53c04ddd8601a9","src/termios/tc.rs":"b1d4615a75dbf4d8bd34e705b86ef61a6c1078a099e0f70efaf7fcd86f96b1b2","src/termios/tty.rs":"6cf99ae9753e9faa18a899f17e5bc79d0de9ac1e68bed0e3658e3683062e317b","src/thread/clock.rs":"36b99ea79cfd39b3ec98ddef4625e7d0ba95df9db6d1475a53bc05b40791e00a","src/thread/futex.rs":"4e78c84589b535ca9ca633633696ef212393a98f2890b181acaa8f908fbc5ae2","src/thread/id.rs":"3a50734df74925222632e4b1217944ed3d7dd3075f997f4728b8309e64f49dfc","src/thread/mod.rs":"e7f67653b99329903a0e14d6fcd209acf492a8539071b2174204d401d679d590","src/thread/prctl.rs":"4c44e84060895213d8a2c7889fe3ad6dc214fa904c5e4ec203a78c0ab1e539a5","src/thread/setns.rs":"a2a80df6877f1a665b18a2a338052b1a97f6e13f913b55a690b3834f6afaa038","src/time/clock.rs":"56ab98ae8a637dc94fa70704aed1b9364a6bbdc0f6c16cd6d5f5c424a1fe5311","src/time/mod.rs":"9fc60d342eb166729729531cf88a3ec3e8baa71b6788f40aeef1351ee8b6c94d","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/utils.rs":"6ed86e62ac05d6279b664a97fd62878a4c1811ab66a1a2920b169eb74c0c1fcd"},"package":"0b1fbb4dfc4eb1d390c02df47760bb19a84bb80b301ecc947ab5406394d8223e"} \ No newline at end of file
diff --git a/vendor/rustix/Cargo.lock b/vendor/rustix/Cargo.lock
deleted file mode 100644
index 0f6929768..000000000
--- a/vendor/rustix/Cargo.lock
+++ /dev/null
@@ -1,1281 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "async-channel"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2114d64672151c0c5eaa5e131ec84a74f06e1e559830dabba01ca30605d66319"
-dependencies = [
- "concurrent-queue",
- "event-listener",
- "futures-core",
-]
-
-[[package]]
-name = "async-executor"
-version = "1.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "871f9bb5e0a22eeb7e8cf16641feb87c9dc67032ccf8ff49e772eb9941d3a965"
-dependencies = [
- "async-task",
- "concurrent-queue",
- "fastrand",
- "futures-lite",
- "once_cell",
- "slab",
-]
-
-[[package]]
-name = "async-global-executor"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd8b508d585e01084059b60f06ade4cb7415cd2e4084b71dd1cb44e7d3fb9880"
-dependencies = [
- "async-channel",
- "async-executor",
- "async-io",
- "async-lock",
- "blocking",
- "futures-lite",
- "once_cell",
-]
-
-[[package]]
-name = "async-io"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5e18f61464ae81cde0a23e713ae8fd299580c54d697a35820cfd0625b8b0e07"
-dependencies = [
- "concurrent-queue",
- "futures-lite",
- "libc",
- "log",
- "once_cell",
- "parking",
- "polling",
- "slab",
- "socket2",
- "waker-fn",
- "winapi",
-]
-
-[[package]]
-name = "async-lock"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6"
-dependencies = [
- "event-listener",
-]
-
-[[package]]
-name = "async-process"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cf2c06e30a24e8c78a3987d07f0930edf76ef35e027e7bdb063fccafdad1f60c"
-dependencies = [
- "async-io",
- "blocking",
- "cfg-if",
- "event-listener",
- "futures-lite",
- "libc",
- "once_cell",
- "signal-hook",
- "winapi",
-]
-
-[[package]]
-name = "async-std"
-version = "1.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52580991739c5cdb36cde8b2a516371c0a3b70dda36d916cc08b82372916808c"
-dependencies = [
- "async-channel",
- "async-global-executor",
- "async-io",
- "async-lock",
- "async-process",
- "crossbeam-utils",
- "futures-channel",
- "futures-core",
- "futures-io",
- "futures-lite",
- "gloo-timers",
- "kv-log-macro",
- "log",
- "memchr",
- "num_cpus",
- "once_cell",
- "pin-project-lite",
- "pin-utils",
- "slab",
- "wasm-bindgen-futures",
-]
-
-[[package]]
-name = "async-task"
-version = "4.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9"
-
-[[package]]
-name = "atomic-waker"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
-
-[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "autocfg"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
-
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-dependencies = [
- "compiler_builtins",
- "rustc-std-workspace-core",
-]
-
-[[package]]
-name = "blocking"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6ccb65d468978a086b69884437ded69a90faab3bbe6e67f242173ea728acccc"
-dependencies = [
- "async-channel",
- "async-task",
- "atomic-waker",
- "fastrand",
- "futures-lite",
- "once_cell",
-]
-
-[[package]]
-name = "bstr"
-version = "0.2.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
-dependencies = [
- "lazy_static",
- "memchr",
- "regex-automata",
- "serde",
-]
-
-[[package]]
-name = "bumpalo"
-version = "3.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3"
-
-[[package]]
-name = "bytes"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8"
-
-[[package]]
-name = "cache-padded"
-version = "1.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c"
-
-[[package]]
-name = "cast"
-version = "0.2.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a"
-dependencies = [
- "rustc_version",
-]
-
-[[package]]
-name = "cc"
-version = "1.0.73"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "clap"
-version = "2.34.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
-dependencies = [
- "bitflags",
- "textwrap",
- "unicode-width",
-]
-
-[[package]]
-name = "compiler_builtins"
-version = "0.1.75"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c6e3183e88f659a862835db8f4b67dbeed3d93e44dd4927eef78edb1c149d784"
-
-[[package]]
-name = "concurrent-queue"
-version = "1.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3"
-dependencies = [
- "cache-padded",
-]
-
-[[package]]
-name = "criterion"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10"
-dependencies = [
- "atty",
- "cast",
- "clap",
- "criterion-plot",
- "csv",
- "itertools",
- "lazy_static",
- "num-traits",
- "oorandom",
- "plotters",
- "rayon",
- "regex",
- "serde",
- "serde_cbor",
- "serde_derive",
- "serde_json",
- "tinytemplate",
- "walkdir",
-]
-
-[[package]]
-name = "criterion-plot"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57"
-dependencies = [
- "cast",
- "itertools",
-]
-
-[[package]]
-name = "crossbeam-channel"
-version = "0.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aaa7bd5fb665c6864b5f963dd9097905c54125909c7aa94c9e18507cdbe6c53"
-dependencies = [
- "cfg-if",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-deque"
-version = "0.8.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
-dependencies = [
- "cfg-if",
- "crossbeam-epoch",
- "crossbeam-utils",
-]
-
-[[package]]
-name = "crossbeam-epoch"
-version = "0.9.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1145cf131a2c6ba0615079ab6a638f7e1973ac9c2634fcbeaaad6114246efe8c"
-dependencies = [
- "autocfg",
- "cfg-if",
- "crossbeam-utils",
- "lazy_static",
- "memoffset",
- "scopeguard",
-]
-
-[[package]]
-name = "crossbeam-utils"
-version = "0.8.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38"
-dependencies = [
- "cfg-if",
- "lazy_static",
-]
-
-[[package]]
-name = "csv"
-version = "1.1.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
-dependencies = [
- "bstr",
- "csv-core",
- "itoa 0.4.8",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "csv-core"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "ctor"
-version = "0.1.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c"
-dependencies = [
- "quote",
- "syn",
-]
-
-[[package]]
-name = "either"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
-
-[[package]]
-name = "errno"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
-dependencies = [
- "errno-dragonfly",
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "errno-dragonfly"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
-dependencies = [
- "cc",
- "libc",
-]
-
-[[package]]
-name = "event-listener"
-version = "2.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71"
-
-[[package]]
-name = "fastrand"
-version = "1.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
-dependencies = [
- "instant",
-]
-
-[[package]]
-name = "fs-err"
-version = "2.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bd79fa345a495d3ae89fb7165fec01c0e72f41821d642dda363a1e97975652e"
-
-[[package]]
-name = "futures-channel"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010"
-dependencies = [
- "futures-core",
-]
-
-[[package]]
-name = "futures-core"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
-
-[[package]]
-name = "futures-io"
-version = "0.3.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
-
-[[package]]
-name = "futures-lite"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48"
-dependencies = [
- "fastrand",
- "futures-core",
- "futures-io",
- "memchr",
- "parking",
- "pin-project-lite",
- "waker-fn",
-]
-
-[[package]]
-name = "gloo-timers"
-version = "0.2.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9"
-dependencies = [
- "futures-channel",
- "futures-core",
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "half"
-version = "1.8.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
-
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "instant"
-version = "0.1.12"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "io-lifetimes"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f62e69445763372c8b1bc117771b5a4a67fdcbb2ebc8e4508b92e63ed0ca6550"
-dependencies = [
- "async-std",
- "fs-err",
- "mio",
- "os_pipe",
- "socket2",
- "tokio",
-]
-
-[[package]]
-name = "itertools"
-version = "0.10.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3"
-dependencies = [
- "either",
-]
-
-[[package]]
-name = "itoa"
-version = "0.4.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
-
-[[package]]
-name = "itoa"
-version = "1.0.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
-
-[[package]]
-name = "js-sys"
-version = "0.3.58"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27"
-dependencies = [
- "wasm-bindgen",
-]
-
-[[package]]
-name = "kv-log-macro"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
-dependencies = [
- "log",
-]
-
-[[package]]
-name = "lazy_static"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-
-[[package]]
-name = "libc"
-version = "0.2.126"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
-
-[[package]]
-name = "linux-raw-sys"
-version = "0.0.46"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d"
-dependencies = [
- "compiler_builtins",
- "rustc-std-workspace-core",
-]
-
-[[package]]
-name = "lock_api"
-version = "0.4.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53"
-dependencies = [
- "autocfg",
- "scopeguard",
-]
-
-[[package]]
-name = "log"
-version = "0.4.17"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
-dependencies = [
- "cfg-if",
- "value-bag",
-]
-
-[[package]]
-name = "memchr"
-version = "2.5.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
-
-[[package]]
-name = "memoffset"
-version = "0.6.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "mio"
-version = "0.8.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "713d550d9b44d89174e066b7a6217ae06234c10cb47819a88290d2b353c31799"
-dependencies = [
- "libc",
- "log",
- "wasi",
- "windows-sys",
-]
-
-[[package]]
-name = "num-traits"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
-dependencies = [
- "autocfg",
-]
-
-[[package]]
-name = "num_cpus"
-version = "1.13.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
-dependencies = [
- "hermit-abi",
- "libc",
-]
-
-[[package]]
-name = "once_cell"
-version = "1.12.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225"
-
-[[package]]
-name = "oorandom"
-version = "11.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
-
-[[package]]
-name = "os_pipe"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c92f2b54f081d635c77e7120862d48db8e91f7f21cef23ab1b4fe9971c59f55"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "parking"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
-
-[[package]]
-name = "parking_lot"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
-dependencies = [
- "instant",
- "lock_api",
- "parking_lot_core",
-]
-
-[[package]]
-name = "parking_lot_core"
-version = "0.8.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
-dependencies = [
- "cfg-if",
- "instant",
- "libc",
- "redox_syscall",
- "smallvec",
- "winapi",
-]
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
-
-[[package]]
-name = "plotters"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a"
-dependencies = [
- "num-traits",
- "plotters-backend",
- "plotters-svg",
- "wasm-bindgen",
- "web-sys",
-]
-
-[[package]]
-name = "plotters-backend"
-version = "0.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c"
-
-[[package]]
-name = "plotters-svg"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9"
-dependencies = [
- "plotters-backend",
-]
-
-[[package]]
-name = "polling"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "685404d509889fade3e86fe3a5803bca2ec09b0c0778d5ada6ec8bf7a8de5259"
-dependencies = [
- "cfg-if",
- "libc",
- "log",
- "wepoll-ffi",
- "winapi",
-]
-
-[[package]]
-name = "proc-macro-error"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-dependencies = [
- "proc-macro-error-attr",
- "proc-macro2",
- "quote",
- "syn",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro-error-attr"
-version = "1.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-dependencies = [
- "proc-macro2",
- "quote",
- "version_check",
-]
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.39"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c54b25569025b7fc9651de43004ae593a75ad88543b17178aa5e1b9c4f15f56f"
-dependencies = [
- "unicode-ident",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "rayon"
-version = "1.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bd99e5772ead8baa5215278c9b15bf92087709e9c1b2d1f97cdb5a183c933a7d"
-dependencies = [
- "autocfg",
- "crossbeam-deque",
- "either",
- "rayon-core",
-]
-
-[[package]]
-name = "rayon-core"
-version = "1.9.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "258bcdb5ac6dad48491bb2992db6b7cf74878b0384908af124823d118c99683f"
-dependencies = [
- "crossbeam-channel",
- "crossbeam-deque",
- "crossbeam-utils",
- "num_cpus",
-]
-
-[[package]]
-name = "redox_syscall"
-version = "0.2.13"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42"
-dependencies = [
- "bitflags",
-]
-
-[[package]]
-name = "regex"
-version = "1.5.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1"
-dependencies = [
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-automata"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64"
-
-[[package]]
-name = "remove_dir_all"
-version = "0.5.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "rustc-std-workspace-alloc"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ff66d57013a5686e1917ed6a025d54dd591fcda71a41fe07edf4d16726aefa86"
-
-[[package]]
-name = "rustc-std-workspace-core"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1956f5517128a2b6f23ab2dadf1a976f4f5b27962e7724c2bf3d45e539ec098c"
-
-[[package]]
-name = "rustc_version"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
-dependencies = [
- "semver",
-]
-
-[[package]]
-name = "rustix"
-version = "0.35.6"
-dependencies = [
- "bitflags",
- "cc",
- "compiler_builtins",
- "criterion",
- "ctor",
- "errno",
- "io-lifetimes",
- "itoa 1.0.2",
- "libc",
- "linux-raw-sys",
- "memoffset",
- "once_cell",
- "rustc-std-workspace-alloc",
- "rustc-std-workspace-core",
- "serial_test",
- "tempfile",
- "windows-sys",
-]
-
-[[package]]
-name = "rustversion"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
-
-[[package]]
-name = "ryu"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3f6f92acf49d1b98f7a81226834412ada05458b7364277387724a237f062695"
-
-[[package]]
-name = "same-file"
-version = "1.0.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "scopeguard"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
-
-[[package]]
-name = "semver"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c"
-
-[[package]]
-name = "serde"
-version = "1.0.137"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1"
-
-[[package]]
-name = "serde_cbor"
-version = "0.11.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
-dependencies = [
- "half",
- "serde",
-]
-
-[[package]]
-name = "serde_derive"
-version = "1.0.137"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "serde_json"
-version = "1.0.81"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c"
-dependencies = [
- "itoa 1.0.2",
- "ryu",
- "serde",
-]
-
-[[package]]
-name = "serial_test"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5bcc41d18f7a1d50525d080fd3e953be87c4f9f1a974f3c21798ca00d54ec15"
-dependencies = [
- "lazy_static",
- "parking_lot",
- "serial_test_derive",
-]
-
-[[package]]
-name = "serial_test_derive"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2881bccd7d60fb32dfa3d7b3136385312f8ad75e2674aab2852867a09790cae8"
-dependencies = [
- "proc-macro-error",
- "proc-macro2",
- "quote",
- "rustversion",
- "syn",
-]
-
-[[package]]
-name = "signal-hook"
-version = "0.3.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d"
-dependencies = [
- "libc",
- "signal-hook-registry",
-]
-
-[[package]]
-name = "signal-hook-registry"
-version = "1.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "slab"
-version = "0.4.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32"
-
-[[package]]
-name = "smallvec"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
-
-[[package]]
-name = "socket2"
-version = "0.4.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "syn"
-version = "1.0.96"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0748dd251e24453cb8717f0354206b91557e4ec8703673a4b30208f2abaf1ebf"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-ident",
-]
-
-[[package]]
-name = "tempfile"
-version = "3.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
-dependencies = [
- "cfg-if",
- "fastrand",
- "libc",
- "redox_syscall",
- "remove_dir_all",
- "winapi",
-]
-
-[[package]]
-name = "textwrap"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
-dependencies = [
- "unicode-width",
-]
-
-[[package]]
-name = "tinytemplate"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
-dependencies = [
- "serde",
- "serde_json",
-]
-
-[[package]]
-name = "tokio"
-version = "1.19.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c51a52ed6686dd62c320f9b89299e9dfb46f730c7a48e635c19f21d116cb1439"
-dependencies = [
- "bytes",
- "libc",
- "mio",
- "once_cell",
- "pin-project-lite",
- "signal-hook-registry",
- "socket2",
- "winapi",
-]
-
-[[package]]
-name = "unicode-ident"
-version = "1.0.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
-
-[[package]]
-name = "unicode-width"
-version = "0.1.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
-
-[[package]]
-name = "value-bag"
-version = "1.0.0-alpha.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"
-dependencies = [
- "ctor",
- "version_check",
-]
-
-[[package]]
-name = "version_check"
-version = "0.9.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
-
-[[package]]
-name = "waker-fn"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca"
-
-[[package]]
-name = "walkdir"
-version = "2.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
-dependencies = [
- "same-file",
- "winapi",
- "winapi-util",
-]
-
-[[package]]
-name = "wasi"
-version = "0.11.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
-
-[[package]]
-name = "wasm-bindgen"
-version = "0.2.81"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994"
-dependencies = [
- "cfg-if",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.81"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a"
-dependencies = [
- "bumpalo",
- "lazy_static",
- "log",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-futures"
-version = "0.4.31"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f"
-dependencies = [
- "cfg-if",
- "js-sys",
- "wasm-bindgen",
- "web-sys",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.81"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.81"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.81"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be"
-
-[[package]]
-name = "web-sys"
-version = "0.3.58"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
-name = "wepoll-ffi"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
-dependencies = [
- "cc",
-]
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "windows-sys"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
-dependencies = [
- "windows_aarch64_msvc",
- "windows_i686_gnu",
- "windows_i686_msvc",
- "windows_x86_64_gnu",
- "windows_x86_64_msvc",
-]
-
-[[package]]
-name = "windows_aarch64_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
-
-[[package]]
-name = "windows_i686_gnu"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
-
-[[package]]
-name = "windows_i686_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
-
-[[package]]
-name = "windows_x86_64_gnu"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
-
-[[package]]
-name = "windows_x86_64_msvc"
-version = "0.36.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
diff --git a/vendor/rustix/Cargo.toml b/vendor/rustix/Cargo.toml
index 95221b2dd..25acf14fd 100644
--- a/vendor/rustix/Cargo.toml
+++ b/vendor/rustix/Cargo.toml
@@ -12,17 +12,23 @@
[package]
edition = "2018"
name = "rustix"
-version = "0.35.6"
+version = "0.36.3"
authors = [
"Dan Gohman <dev@sunfishcode.online>",
"Jakub Konka <kubkon@jakubkonka.com>",
]
-exclude = [
- "/.*",
- "test-crates",
+include = [
+ "src",
+ "build.rs",
+ "Cargo.toml",
+ "COPYRIGHT",
+ "LICENSE*",
+ "/*.md",
+ "benches",
]
description = "Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls"
documentation = "https://docs.rs/rustix"
+readme = "README.md"
keywords = [
"api",
"file",
@@ -74,7 +80,8 @@ optional = true
package = "rustc-std-workspace-core"
[dependencies.io-lifetimes]
-version = "0.7.0"
+version = "1.0.0"
+features = ["close"]
optional = true
default-features = false
@@ -83,19 +90,24 @@ version = "1.0.1"
optional = true
default-features = false
+[dev-dependencies.flate2]
+version = "1.0"
+
[dev-dependencies.io-lifetimes]
-version = "0.7.0"
+version = "1.0.0"
+features = ["close"]
default-features = false
[dev-dependencies.libc]
-version = "0.2.126"
+version = "0.2.133"
[dev-dependencies.libc_errno]
version = "0.2.8"
+default-features = false
package = "errno"
[dev-dependencies.memoffset]
-version = "0.6.5"
+version = "0.7.1"
[dev-dependencies.serial_test]
version = "0.6"
@@ -123,24 +135,20 @@ all-apis = [
"time",
]
all-impls = [
- "async-std",
- "tokio",
"os_pipe",
- "socket2",
- "mio",
"fs-err",
]
-async-std = ["io-lifetimes/async-std"]
-default = ["std"]
+default = [
+ "std",
+ "use-libc-auxv",
+]
fs = []
fs-err = ["io-lifetimes/fs-err"]
io_uring = [
- "linux-raw-sys",
"fs",
"net",
]
-mio = ["io-lifetimes/mio"]
-mm = ["linux-raw-sys"]
+mm = []
net = []
os_pipe = ["io-lifetimes/os_pipe"]
param = []
@@ -148,6 +156,7 @@ process = []
procfs = [
"once_cell",
"itoa",
+ "fs",
]
rand = []
runtime = []
@@ -158,28 +167,26 @@ rustc-dep-of-std = [
"linux-raw-sys/rustc-dep-of-std",
"bitflags/rustc-dep-of-std",
]
-socket2 = ["io-lifetimes/socket2"]
std = ["io-lifetimes"]
termios = []
thread = []
time = []
-tokio = ["io-lifetimes/tokio"]
use-libc = [
"libc_errno",
"libc",
]
+use-libc-auxv = ["libc"]
[target."cfg(all(any(target_os = \"android\", target_os = \"linux\"), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\"))))))))".dependencies.linux-raw-sys]
-version = "0.0.46"
+version = "0.1.2"
features = [
"general",
"no_std",
]
-optional = true
default-features = false
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))".dependencies.libc]
-version = "0.2.126"
+version = "0.2.133"
features = ["extra_traits"]
optional = true
@@ -190,7 +197,7 @@ default-features = false
package = "errno"
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))".dependencies.linux-raw-sys]
-version = "0.0.46"
+version = "0.1.2"
features = [
"general",
"errno",
@@ -200,7 +207,7 @@ features = [
default-features = false
[target."cfg(any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))))".dependencies.libc]
-version = "0.2.126"
+version = "0.2.133"
features = ["extra_traits"]
[target."cfg(any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))))".dependencies.libc_errno]
@@ -213,10 +220,10 @@ version = "1.5.2"
optional = true
[target."cfg(not(target_os = \"emscripten\"))".dev-dependencies.criterion]
-version = "0.3"
+version = "0.4"
[target."cfg(windows)".dependencies.windows-sys]
-version = "0.36.0"
+version = "0.42.0"
features = [
"Win32_Foundation",
"Win32_Networking_WinSock",
diff --git a/vendor/rustix/README.md b/vendor/rustix/README.md
index 4c49d1159..8ef865387 100644
--- a/vendor/rustix/README.md
+++ b/vendor/rustix/README.md
@@ -103,11 +103,11 @@ supported on Redox, such as `*at` functions like `openat`, which are important
features for `rustix`.
`rustix` has its own code for making direct syscalls, similar to the [`sc`] and
-[`scall`] crates, though `rustix` can use either the unstable Rust `asm!` macro
-or out-of-line `.s` files so it supports both Stable and Nightly Rust. `rustix`
-can also use Linux's vDSO mechanism to optimize Linux `clock_gettime` on all
-architectures, and all Linux system calls on x86. And `rustix`'s syscalls
-report errors using an optimized `Errno` type.
+[`scall`] crates, though `rustix` can use either the Rust `asm!` macro or
+out-of-line `.s` files so it supports Rust versions from 1.48 though Nightly.
+`rustix` can also use Linux's vDSO mechanism to optimize Linux `clock_gettime`
+on all architectures, and all Linux system calls on x86. And `rustix`'s
+syscalls report errors using an optimized `Errno` type.
`rustix`'s `*at` functions are similar to the [`openat`] crate, but `rustix`
provides them as free functions rather than associated functions of a `Dir`
diff --git a/vendor/rustix/build.rs b/vendor/rustix/build.rs
index f6fa64579..56c6b1557 100644
--- a/vendor/rustix/build.rs
+++ b/vendor/rustix/build.rs
@@ -4,7 +4,7 @@ use std::env::var;
use std::io::Write;
/// The directory for out-of-line ("outline") libraries.
-const OUTLINE_PATH: &str = "src/imp/linux_raw/arch/outline";
+const OUTLINE_PATH: &str = "src/backend/linux_raw/arch/outline";
fn main() {
// Don't rerun this on changes other than build.rs, as we only depend on
@@ -101,6 +101,11 @@ fn main() {
}
}
+ // Detect whether the compiler requires us to use thumb mode on ARM.
+ if arch == "arm" && use_thumb_mode() {
+ use_feature("thumb_mode");
+ }
+
println!("cargo:rerun-if-env-changed=CARGO_CFG_RUSTIX_USE_EXPERIMENTAL_ASM");
}
@@ -151,6 +156,11 @@ fn link_in_librustix_outline(arch: &str, asm_name: &str) {
}
}
+fn use_thumb_mode() -> bool {
+ // In thumb mode, r7 is reserved.
+ !can_compile("pub unsafe fn f() { core::arch::asm!(\"udf #16\", in(\"r7\") 0); }")
+}
+
fn use_feature_or_nothing(feature: &str) {
if has_feature(feature) {
use_feature(feature);
@@ -174,10 +184,13 @@ fn can_compile(code: &str) -> bool {
use std::process::Stdio;
let out_dir = var("OUT_DIR").unwrap();
let rustc = var("RUSTC").unwrap();
+ let target = var("TARGET").unwrap();
let mut child = std::process::Command::new(rustc)
.arg("--crate-type=rlib") // Don't require `main`.
.arg("--emit=metadata") // Do as little as possible but still parse.
+ .arg("--target")
+ .arg(target)
.arg("--out-dir")
.arg(out_dir) // Put the output somewhere inconsequential.
.arg("-") // Read from stdin.
diff --git a/vendor/rustix/ci/getsockopt-timeouts.patch b/vendor/rustix/ci/getsockopt-timeouts.patch
deleted file mode 100644
index a9a989325..000000000
--- a/vendor/rustix/ci/getsockopt-timeouts.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From: Dan Gohman <dev@sunfishcode.online>
-Subject: [PATCH] Avoid storing unexpected values for `SO_RCVTIMEO_NEW` etc.
-
-This issue is reported upstream [here].
-
-[here]: https://gitlab.com/qemu-project/qemu/-/issues/885
-
----
- linux-user/generic/sockbits.h | 2 ++
- linux-user/mips/sockbits.h | 2 ++
- linux-user/sparc/sockbits.h | 2 ++
- linux-user/syscall.c | 6 ++++++
- 4 files changed, 12 insertions(+)
-
-diff --git a/linux-user/generic/sockbits.h b/linux-user/generic/sockbits.h
-index b3b4a8e44c..f95747e3cc 100644
---- a/linux-user/generic/sockbits.h
-+++ b/linux-user/generic/sockbits.h
-@@ -36,6 +36,8 @@
- #define TARGET_SO_SNDLOWAT 19
- #define TARGET_SO_RCVTIMEO 20
- #define TARGET_SO_SNDTIMEO 21
-+#define TARGET_SO_RCVTIMEO_NEW 66
-+#define TARGET_SO_SNDTIMEO_NEW 67
-
- /* Security levels - as per NRL IPv6 - don't actually do anything */
- #define TARGET_SO_SECURITY_AUTHENTICATION 22
-diff --git a/linux-user/mips/sockbits.h b/linux-user/mips/sockbits.h
-index 562cad88e2..4d411f7b61 100644
---- a/linux-user/mips/sockbits.h
-+++ b/linux-user/mips/sockbits.h
-@@ -39,6 +39,8 @@
- #define TARGET_SO_RCVLOWAT 0x1004 /* receive low-water mark */
- #define TARGET_SO_SNDTIMEO 0x1005 /* send timeout */
- #define TARGET_SO_RCVTIMEO 0x1006 /* receive timeout */
-+#define TARGET_SO_RCVTIMEO_NEW 66
-+#define TARGET_SO_SNDTIMEO_NEW 67
- #define TARGET_SO_ACCEPTCONN 0x1009
- #define TARGET_SO_PROTOCOL 0x1028 /* protocol type */
- #define TARGET_SO_DOMAIN 0x1029 /* domain/socket family */
-diff --git a/linux-user/sparc/sockbits.h b/linux-user/sparc/sockbits.h
-index 0a822e3e1f..8420ef9953 100644
---- a/linux-user/sparc/sockbits.h
-+++ b/linux-user/sparc/sockbits.h
-@@ -26,6 +26,8 @@
- #define TARGET_SO_SNDLOWAT 0x1000
- #define TARGET_SO_RCVTIMEO 0x2000
- #define TARGET_SO_SNDTIMEO 0x4000
-+#define TARGET_SO_RCVTIMEO_NEW 68
-+#define TARGET_SO_SNDTIMEO_NEW 69
- #define TARGET_SO_ACCEPTCONN 0x8000
-
- #define TARGET_SO_SNDBUF 0x1001
-diff --git a/linux-user/syscall.c b/linux-user/syscall.c
-index a8eae3c4ac..8326e03a19 100644
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -2348,6 +2348,9 @@ set_timeout:
- case TARGET_SO_SNDTIMEO:
- optname = SO_SNDTIMEO;
- goto set_timeout;
-+ case TARGET_SO_RCVTIMEO_NEW:
-+ case TARGET_SO_SNDTIMEO_NEW:
-+ return -TARGET_ENOPROTOOPT;
- case TARGET_SO_ATTACH_FILTER:
- {
- struct target_sock_fprog *tfprog;
-@@ -2595,6 +2598,9 @@ get_timeout:
- case TARGET_SO_SNDTIMEO:
- optname = SO_SNDTIMEO;
- goto get_timeout;
-+ case TARGET_SO_RCVTIMEO_NEW:
-+ case TARGET_SO_SNDTIMEO_NEW:
-+ return -TARGET_ENOPROTOOPT;
- case TARGET_SO_PEERCRED: {
- struct ucred cr;
- socklen_t crlen;
---
-2.32.0
-
diff --git a/vendor/rustix/ci/s390x-stat-have-nsec.patch b/vendor/rustix/ci/s390x-stat-have-nsec.patch
deleted file mode 100644
index 1a4562298..000000000
--- a/vendor/rustix/ci/s390x-stat-have-nsec.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From: Dan Gohman <dev@sunfishcode.online>
-Subject: [PATCH] Define `TARGET_STAT_HAVE_NSEC` for s390x
-
-Without this, The `fstat` syscall sets `st_mtime_nsec` and the other `_nsec`
-fields to 0. Libc `fstat` will sometimes use the `fstatat` or `fstat64`
-syscalls instead, which aren't affected, but the libc `fstat` on ubuntu-20.04
-on Github Actions appears to be affected.
-
-This can be seen in the `st_mtime_nsec` assert in tests/fs/futimens.rs.
-
-It's not yet known why upstream qemu doesn't define this.
-
----
- linux-user/generic/sockbits.h | 1 +
- 1 files changed, 1 insertions(+)
-
-diff -ur a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
---- a/linux-user/syscall_defs.h 2021-08-24 10:35:41.000000000 -0700
-+++ b/linux-user/syscall_defs.h 2022-04-12 13:23:25.291064887 -0700
-@@ -2040,6 +2040,7 @@
- abi_long __unused[3];
- };
- #elif defined(TARGET_S390X)
-+#define TARGET_STAT_HAVE_NSEC
- struct target_stat {
- abi_ulong st_dev;
- abi_ulong st_ino;
diff --git a/vendor/rustix/ci/translate-errno.patch b/vendor/rustix/ci/translate-errno.patch
deleted file mode 100644
index 6a4152038..000000000
--- a/vendor/rustix/ci/translate-errno.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From: Dan Gohman <dev@sunfishcode.online>
-Subject: [PATCH] Translate errno codes from host to target for `SO_ERROR`.
-
-This issue is reported upstream [here].
-
-[here]: https://gitlab.com/qemu-project/qemu/-/issues/872
-
----
- linux-user/syscall.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/linux-user/syscall.c b/linux-user/syscall.c
-index b9b18a7eaf..a8eae3c4ac 100644
---- a/linux-user/syscall.c
-+++ b/linux-user/syscall.c
-@@ -2767,6 +2767,9 @@ get_timeout:
- if (optname == SO_TYPE) {
- val = host_to_target_sock_type(val);
- }
-+ if (level == SOL_SOCKET && optname == SO_ERROR) {
-+ val = host_to_target_errno(val);
-+ }
- if (len > lv)
- len = lv;
- if (len == 4) {
---
-2.32.0
-
diff --git a/vendor/rustix/examples/dup2_to_replace_stdio.rs b/vendor/rustix/examples/dup2_to_replace_stdio.rs
deleted file mode 100644
index cc8565915..000000000
--- a/vendor/rustix/examples/dup2_to_replace_stdio.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-//! This is an example of how to use `dup2` to replace the stdin and stdout
-//! file descriptors.
-
-#[cfg(not(windows))]
-fn main() {
- use rustix::io::{dup2, pipe};
- use std::io::{BufRead, BufReader};
- use std::mem::forget;
-
- // Create some new file descriptors that we'll use to replace stdio's file
- // descriptors with.
- let (reader, writer) = pipe().unwrap();
-
- // Acquire `OwnedFd` instances for stdin and stdout. These APIs are `unsafe`
- // because in general, with low-level APIs like this, libraries can't assume
- // that stdin and stdout will be open or safe to use. It's ok here, because
- // we're directly inside `main`, so we know that stdin and stdout haven't
- // been closed and aren't being used for other purposes.
- let (mut stdin, mut stdout) = unsafe { (rustix::io::take_stdin(), rustix::io::take_stdout()) };
-
- // Use `dup2` to copy our new file descriptors over the stdio file descriptors.
- //
- // These take their second argument as an `&mut OwnedFd` rather than the
- // usual `impl AsFd` because they conceptually do a `close` on the original
- // file descriptor, which one shouldn't be able to do with just a
- // `BorrowedFd`.
- dup2(&reader, &mut stdin).unwrap();
- dup2(&writer, &mut stdout).unwrap();
-
- // Then, forget the stdio `OwnedFd`s, because actually dropping them would
- // close them. Here, we want stdin and stdout to remain open for the rest
- // of the program.
- forget(stdin);
- forget(stdout);
-
- // We can also drop the original file descriptors now, since `dup2` creates
- // new file descriptors with independent lifetimes.
- drop(reader);
- drop(writer);
-
- // Now we can print to "stdout" in the usual way, and it'll go to our pipe.
- println!("hello, world!");
-
- // And we can read from stdin, and it'll read from our pipe. It's a little
- // silly that we connected our stdout to our own stdin, but it's just an
- // example :-).
- let mut s = String::new();
- BufReader::new(std::io::stdin()).read_line(&mut s).unwrap();
- assert_eq!(s, "hello, world!\n");
-}
-
-#[cfg(windows)]
-fn main() {
- unimplemented!()
-}
diff --git a/vendor/rustix/examples/hello.rs b/vendor/rustix/examples/hello.rs
deleted file mode 100644
index 16ce69bd6..000000000
--- a/vendor/rustix/examples/hello.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-//! Hello world, via plain syscalls.
-
-#[cfg(all(feature = "std", not(windows)))]
-fn main() -> std::io::Result<()> {
- // The message to print. It includes an explicit newline because we're
- // not using `println!`, so we have to include the newline manually.
- let message = "Hello, world!\n";
-
- // The bytes to print. The `write` syscall operates on byte buffers and
- // returns a byte offset if it writes fewer bytes than requested, so we
- // need the ability to compute substrings at arbitrary byte offsets.
- let mut bytes = message.as_bytes();
-
- // Safety: See [here] for the safety conditions for calling `stdout`. In
- // this example, the code is inside `main` itself so we know how `stdout`
- // is being used and we know that it's not dropped.
- //
- // [here]: https://docs.rs/rustix/*/rustix/io/fn.stdout.html#safety
- let stdout = unsafe { rustix::io::stdout() };
-
- while !bytes.is_empty() {
- match rustix::io::write(&stdout, bytes) {
- // `write` can write fewer bytes than requested. In that case,
- // continue writing with the remainder of the bytes.
- Ok(n) => bytes = &bytes[n..],
-
- // `write` can be interrupted before doing any work; if that
- // happens, retry it.
- Err(rustix::io::Errno::INTR) => (),
-
- // `write` can also fail for external reasons, such as running out
- // of storage space.
- Err(e) => return Err(e.into()),
- }
- }
-
- Ok(())
-}
-
-#[cfg(any(not(feature = "std"), windows))]
-fn main() {
- unimplemented!()
-}
diff --git a/vendor/rustix/examples/process.rs b/vendor/rustix/examples/process.rs
deleted file mode 100644
index 49c6b8d9e..000000000
--- a/vendor/rustix/examples/process.rs
+++ /dev/null
@@ -1,105 +0,0 @@
-//! A command which prints out information about the process it runs in.
-
-use rustix::io;
-
-#[cfg(all(feature = "process", feature = "param"))]
-#[cfg(not(windows))]
-fn main() -> io::Result<()> {
- use rustix::param::*;
- use rustix::process::*;
-
- println!("Pid: {}", getpid().as_raw_nonzero());
- println!("Parent Pid: {}", Pid::as_raw(getppid()));
- println!("Uid: {}", getuid().as_raw());
- println!("Gid: {}", getgid().as_raw());
- #[cfg(any(
- all(target_os = "android", target_pointer_width = "64"),
- target_os = "linux",
- ))]
- {
- let (a, b) = linux_hwcap();
- println!("Linux hwcap: {:#x}, {:#x}", a, b);
- }
- println!("Page size: {}", page_size());
- println!("Clock ticks/sec: {}", clock_ticks_per_second());
- println!("Uname: {:?}", uname());
- println!("Process group priority: {}", getpriority_pgrp(None)?);
- println!("Process priority: {}", getpriority_process(None)?);
- println!("User priority: {}", getpriority_user(Uid::ROOT)?);
- println!(
- "Current working directory: {}",
- getcwd(Vec::new())?.to_string_lossy()
- );
- println!("Cpu Limit: {:?}", getrlimit(Resource::Cpu));
- println!("Fsize Limit: {:?}", getrlimit(Resource::Fsize));
- println!("Data Limit: {:?}", getrlimit(Resource::Data));
- println!("Stack Limit: {:?}", getrlimit(Resource::Stack));
- println!("Core Limit: {:?}", getrlimit(Resource::Core));
- println!("Rss Limit: {:?}", getrlimit(Resource::Rss));
- println!("Nproc Limit: {:?}", getrlimit(Resource::Nproc));
- println!("Nofile Limit: {:?}", getrlimit(Resource::Nofile));
- println!("Memlock Limit: {:?}", getrlimit(Resource::Memlock));
- #[cfg(not(target_os = "openbsd"))]
- println!("As Limit: {:?}", getrlimit(Resource::As));
- #[cfg(not(any(
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- println!("Locks Limit: {:?}", getrlimit(Resource::Locks));
- #[cfg(not(any(
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- println!("Sigpending Limit: {:?}", getrlimit(Resource::Sigpending));
- #[cfg(not(any(
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- println!("Msgqueue Limit: {:?}", getrlimit(Resource::Msgqueue));
- #[cfg(not(any(
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- println!("Nice Limit: {:?}", getrlimit(Resource::Nice));
- #[cfg(not(any(
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- println!("Rtprio Limit: {:?}", getrlimit(Resource::Rtprio));
- #[cfg(not(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- println!("Rttime Limit: {:?}", getrlimit(Resource::Rttime));
- #[cfg(any(
- all(target_os = "android", target_pointer_width = "64"),
- target_os = "linux"
- ))]
- println!("Execfn: {:?}", linux_execfn());
- Ok(())
-}
-
-#[cfg(any(windows, not(all(feature = "process", feature = "param"))))]
-fn main() -> io::Result<()> {
- unimplemented!()
-}
diff --git a/vendor/rustix/examples/stdio.rs b/vendor/rustix/examples/stdio.rs
deleted file mode 100644
index 9e79d5356..000000000
--- a/vendor/rustix/examples/stdio.rs
+++ /dev/null
@@ -1,465 +0,0 @@
-//! A command which prints out information about the standard input,
-//! output, and error streams provided to it.
-
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(not(windows))]
-use rustix::fd::AsFd;
-#[cfg(not(windows))]
-use rustix::io::{self, stderr, stdin, stdout};
-#[cfg(feature = "termios")]
-#[cfg(not(windows))]
-use rustix::termios::isatty;
-#[cfg(all(not(windows), feature = "termios", feature = "procfs"))]
-use rustix::termios::ttyname;
-
-#[cfg(not(windows))]
-fn main() -> io::Result<()> {
- let (stdin, stdout, stderr) = unsafe { (stdin(), stdout(), stderr()) };
-
- println!("Stdin:");
- show(&stdin)?;
-
- println!("Stdout:");
- show(&stdout)?;
-
- println!("Stderr:");
- show(&stderr)?;
-
- Ok(())
-}
-
-#[cfg(not(windows))]
-fn show<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- let fd = fd.as_fd();
- println!(" - ready: {:?}", rustix::io::ioctl_fionread(fd)?);
-
- #[cfg(feature = "termios")]
- if isatty(fd) {
- #[cfg(feature = "procfs")]
- println!(" - ttyname: {}", ttyname(fd, Vec::new())?.to_string_lossy());
- println!(" - process group: {:?}", rustix::termios::tcgetpgrp(fd)?);
- println!(" - winsize: {:?}", rustix::termios::tcgetwinsize(fd)?);
-
- {
- use rustix::termios::*;
- let term = tcgetattr(fd)?;
-
- if let Some(speed) = speed_value(cfgetispeed(&term)) {
- println!(" - ispeed: {}", speed);
- }
- if let Some(speed) = speed_value(cfgetospeed(&term)) {
- println!(" - ospeed: {}", speed);
- }
-
- print!(" - in flags:");
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IGNBRK) != 0 {
- print!(" IGNBRK");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & BRKINT) != 0 {
- print!(" BRKINT");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IGNPAR) != 0 {
- print!(" IGNPAR");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & PARMRK) != 0 {
- print!(" PARMRK");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & INPCK) != 0 {
- print!(" INPCK");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & ISTRIP) != 0 {
- print!(" ISTRIP");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & INLCR) != 0 {
- print!(" INLCR");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IGNCR) != 0 {
- print!(" IGNCR");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & ICRNL) != 0 {
- print!(" ICRNL");
- }
- #[cfg(any(
- linux_raw,
- all(
- libc,
- any(target_os = "haiku", target_os = "illumos", target_os = "solaris"),
- )
- ))]
- if (term.c_iflag & IUCLC) != 0 {
- print!(" IUCLC");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IXON) != 0 {
- print!(" IXON");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IXANY) != 0 {
- print!(" IXANY");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IXOFF) != 0 {
- print!(" IXOFF");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_iflag & IMAXBEL) != 0 {
- print!(" IMAXBEL");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_iflag & IUTF8) != 0 {
- print!(" IUTF8");
- }
- println!();
-
- print!(" - out flags:");
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_oflag & OPOST) != 0 {
- print!(" OPOST");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "redox",
- )))]
- if (term.c_oflag & OLCUC) != 0 {
- print!(" OLCUC");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_oflag & ONLCR) != 0 {
- print!(" ONLCR");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_oflag & OCRNL) != 0 {
- print!(" OCRNL");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_oflag & ONOCR) != 0 {
- print!(" ONOCR");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_oflag & ONLRET) != 0 {
- print!(" ONLRET");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- if (term.c_oflag & OFILL) != 0 {
- print!(" OFILL");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- if (term.c_oflag & OFDEL) != 0 {
- print!(" OFDEL");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_oflag & NLDLY) != 0 {
- print!(" NLDLY");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_oflag & CRDLY) != 0 {
- print!(" CRDLY");
- }
- #[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "illumos",
- target_os = "redox",
- )))]
- if (term.c_oflag & TABDLY) != 0 {
- print!(" TABDLY");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_oflag & BSDLY) != 0 {
- print!(" BSDLY");
- }
- #[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_oflag & VTDLY) != 0 {
- print!(" VTDLY");
- }
- #[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_oflag & FFDLY) != 0 {
- print!(" FFDLY");
- }
- println!();
-
- print!(" - control flags:");
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_cflag & CBAUD) != 0 {
- print!(" CBAUD");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_cflag & CBAUDEX) != 0 {
- print!(" CBAUDEX");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & CSIZE) != 0 {
- print!(" CSIZE");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & CSTOPB) != 0 {
- print!(" CSTOPB");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & CREAD) != 0 {
- print!(" CREAD");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & PARENB) != 0 {
- print!(" PARENB");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & PARODD) != 0 {
- print!(" PARODD");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & HUPCL) != 0 {
- print!(" HUPCL");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & CLOCAL) != 0 {
- print!(" CLOCAL");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_cflag & CIBAUD) != 0 {
- print!(" CIBAUD");
- }
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- if (term.c_cflag & CMSPAR) != 0 {
- print!(" CMSPAR");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_cflag & CRTSCTS) != 0 {
- print!(" CRTSCTS");
- }
- println!();
-
- print!(" - local flags:");
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ISIG) != 0 {
- print!(" ISIG");
- }
- if (term.c_lflag & ICANON) != 0 {
- print!(" ICANON");
- }
- #[cfg(any(linux_raw, all(libc, any(target_arch = "s390x", target_os = "haiku"))))]
- if (term.c_lflag & XCASE) != 0 {
- print!(" XCASE");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHO) != 0 {
- print!(" ECHO");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHOE) != 0 {
- print!(" ECHOE");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHOK) != 0 {
- print!(" ECHOK");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHONL) != 0 {
- print!(" ECHONL");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHOCTL) != 0 {
- print!(" ECHOCTL");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHOPRT) != 0 {
- print!(" ECHOPRT");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & ECHOKE) != 0 {
- print!(" ECHOKE");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & FLUSHO) != 0 {
- print!(" FLUSHO");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & NOFLSH) != 0 {
- print!(" NOFLSH");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & TOSTOP) != 0 {
- print!(" TOSTOP");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & PENDIN) != 0 {
- print!(" PENDIN");
- }
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- if (term.c_lflag & IEXTEN) != 0 {
- print!(" IEXTEN");
- }
- println!();
-
- println!(
- " - keys: INTR={} QUIT={} ERASE={} KILL={} EOF={} TIME={} MIN={} ",
- key(term.c_cc[VINTR]),
- key(term.c_cc[VQUIT]),
- key(term.c_cc[VERASE]),
- key(term.c_cc[VKILL]),
- key(term.c_cc[VEOF]),
- term.c_cc[VTIME],
- term.c_cc[VMIN]
- );
- println!(
- " START={} STOP={} SUSP={} EOL={} REPRINT={} DISCARD={}",
- key(term.c_cc[VSTART]),
- key(term.c_cc[VSTOP]),
- key(term.c_cc[VSUSP]),
- key(term.c_cc[VEOL]),
- key(term.c_cc[VREPRINT]),
- key(term.c_cc[VDISCARD])
- );
- println!(
- " WERASE={} LNEXT={} EOL2={}",
- key(term.c_cc[VWERASE]),
- key(term.c_cc[VLNEXT]),
- key(term.c_cc[VEOL2])
- );
- }
- } else {
- println!(" - is not a tty");
- }
-
- println!();
- Ok(())
-}
-
-#[cfg(feature = "termios")]
-#[cfg(not(windows))]
-fn key(b: u8) -> String {
- if b == 0 {
- format!("<undef>")
- } else if b < 0x20 {
- format!("^{}", (b + 0x40) as char)
- } else if b == 0x7f {
- format!("^?")
- } else {
- format!("{}", b as char)
- }
-}
-
-#[cfg(windows)]
-fn main() {
- unimplemented!()
-}
diff --git a/vendor/rustix/examples/time.rs b/vendor/rustix/examples/time.rs
deleted file mode 100644
index 3648336a7..000000000
--- a/vendor/rustix/examples/time.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-//! A command which prints the current values of the realtime and monotonic
-//! clocks it's given.
-
-#[cfg(not(windows))]
-#[cfg(feature = "time")]
-fn main() {
- println!(
- "Real time: {:?}",
- rustix::time::clock_gettime(rustix::time::ClockId::Realtime)
- );
- println!(
- "Monotonic time: {:?}",
- rustix::time::clock_gettime(rustix::time::ClockId::Monotonic)
- );
-}
-
-#[cfg(any(windows, not(feature = "time")))]
-fn main() {
- unimplemented!()
-}
diff --git a/vendor/rustix/src/imp/libc/conv.rs b/vendor/rustix/src/backend/libc/conv.rs
index fed15fbd1..1e74ea9ba 100644
--- a/vendor/rustix/src/imp/libc/conv.rs
+++ b/vendor/rustix/src/backend/libc/conv.rs
@@ -5,12 +5,13 @@
#![allow(dead_code)]
use super::c;
-use super::fd::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, LibcFd, RawFd};
+use super::fd::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, LibcFd, OwnedFd, RawFd};
#[cfg(not(windows))]
+#[cfg(feature = "fs")]
use super::offset::libc_off_t;
#[cfg(not(windows))]
use crate::ffi::CStr;
-use crate::io::{self, OwnedFd};
+use crate::io;
#[cfg(windows)]
use core::convert::TryInto;
@@ -120,6 +121,7 @@ pub(super) fn syscall_ret_u32(raw: c::c_long) -> io::Result<u32> {
}
#[cfg(not(windows))]
+#[cfg(feature = "fs")]
#[inline]
pub(super) fn ret_off_t(raw: libc_off_t) -> io::Result<libc_off_t> {
if raw == -1 {
diff --git a/vendor/rustix/src/imp/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs
index 1e6b6066f..8e5477401 100644
--- a/vendor/rustix/src/imp/libc/fs/dir.rs
+++ b/vendor/rustix/src/backend/libc/fs/dir.rs
@@ -1,6 +1,6 @@
use super::super::c;
use super::super::conv::owned_fd;
-#[cfg(not(target_os = "illumos"))]
+#[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
use super::types::FileType;
use crate::fd::{AsFd, BorrowedFd};
use crate::ffi::CStr;
@@ -8,12 +8,22 @@ use crate::ffi::CStr;
use crate::ffi::CString;
use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat};
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
-)))] // not implemented in libc for netbsd yet
+)))]
use crate::fs::{fstatfs, StatFs};
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+use crate::fs::{fstatvfs, StatVfs};
use crate::io;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use crate::process::fchdir;
@@ -65,8 +75,8 @@ impl Dir {
// file description state, which would cause Undefined Behavior after
// our call to `fdopendir`. To prevent this, we obtain an independent
// `OwnedFd`.
- let flags = fcntl_getfl(&fd)?;
- let fd_for_dir = openat(&fd, cstr!("."), flags | OFlags::CLOEXEC, Mode::empty())?;
+ let flags = fcntl_getfl(fd)?;
+ let fd_for_dir = openat(fd, cstr!("."), flags | OFlags::CLOEXEC, Mode::empty())?;
let raw = owned_fd(fd_for_dir);
unsafe {
@@ -75,9 +85,9 @@ impl Dir {
if let Some(libc_dir) = NonNull::new(libc_dir) {
Ok(Self(libc_dir))
} else {
- let e = io::Errno::last_os_error();
+ let err = io::Errno::last_os_error();
let _ = c::close(raw);
- Err(e)
+ Err(err)
}
}
}
@@ -129,16 +139,31 @@ impl Dir {
/// `fstatfs(self)`
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
- )))] // not implemented in libc for netbsd yet
+ )))]
#[inline]
pub fn statfs(&self) -> io::Result<StatFs> {
fstatfs(unsafe { BorrowedFd::borrow_raw(c::dirfd(self.0.as_ptr())) })
}
+ /// `fstatvfs(self)`
+ #[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+ )))]
+ #[inline]
+ pub fn statvfs(&self) -> io::Result<StatVfs> {
+ fstatvfs(unsafe { BorrowedFd::borrow_raw(c::dirfd(self.0.as_ptr())) })
+ }
+
/// `fchdir(self)`
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
#[inline]
@@ -151,12 +176,19 @@ impl Dir {
// struct, as the name is NUL-terminated and memory may not be allocated for
// the full extent of the struct. Copy the fields one at a time.
unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "solaris"
+ )))]
let d_type = input.d_type;
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -164,6 +196,9 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
)))]
let d_off = input.d_off;
+ #[cfg(target_os = "aix")]
+ let d_offset = input.d_offset;
+
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -172,13 +207,19 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
)))]
let d_ino = input.d_ino;
- #[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
+ #[cfg(any(
+ target_os = "dragonfly",
+ target_os = "freebsd",
+ target_os = "netbsd",
+ target_os = "openbsd"
+ ))]
let d_fileno = input.d_fileno;
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "wasi")))]
let d_reclen = input.d_reclen;
#[cfg(any(
+ target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
@@ -190,34 +231,46 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
#[cfg(any(target_os = "ios", target_os = "macos"))]
let d_seekoff = input.d_seekoff;
+ #[cfg(target_os = "haiku")]
+ let d_dev = input.d_dev;
+ #[cfg(target_os = "haiku")]
+ let d_pdev = input.d_pdev;
+ #[cfg(target_os = "haiku")]
+ let d_pino = input.d_pino;
+
// Construct the input. Rust will give us an error if any OS has a input
// with a field that we missed here. And we can avoid blindly copying the
// whole `d_name` field, which may not be entirely allocated.
#[cfg_attr(target_os = "wasi", allow(unused_mut))]
+ #[cfg(not(target_os = "dragonfly"))]
let mut dirent = libc_dirent {
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "solaris"
+ )))]
d_type,
#[cfg(not(any(
- target_os = "dragonfly",
+ target_os = "aix",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "wasi",
)))]
d_off,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(target_os = "aix")]
+ d_offset,
+ #[cfg(not(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
d_ino,
#[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
d_fileno,
#[cfg(not(target_os = "wasi"))]
d_reclen,
#[cfg(any(
+ target_os = "aix",
target_os = "freebsd",
target_os = "ios",
target_os = "macos",
@@ -239,6 +292,29 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
d_name: zeroed(),
#[cfg(target_os = "openbsd")]
__d_padding: zeroed(),
+ #[cfg(target_os = "haiku")]
+ d_dev,
+ #[cfg(target_os = "haiku")]
+ d_pdev,
+ #[cfg(target_os = "haiku")]
+ d_pino,
+ };
+ /*
+ pub d_ino: ino_t,
+ pub d_pino: i64,
+ pub d_reclen: ::c_ushort,
+ pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
+ // */
+
+ // On dragonfly, `dirent` has some non-public padding fields so we can't
+ // directly initialize it.
+ #[cfg(target_os = "dragonfly")]
+ let mut dirent = unsafe {
+ let mut dirent: libc_dirent = zeroed();
+ dirent.d_fileno = d_fileno;
+ dirent.d_namlen = d_namlen;
+ dirent.d_type = d_type;
+ dirent
};
// Copy from d_name, reading up to and including the first NUL.
@@ -306,7 +382,12 @@ impl DirEntry {
}
/// Returns the type of this directory entry.
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "solaris"
+ )))]
#[inline]
pub fn file_type(&self) -> FileType {
FileType::from_dirent_d_type(self.dirent.d_type)
@@ -321,7 +402,7 @@ impl DirEntry {
)))]
#[inline]
pub fn ino(&self) -> u64 {
- self.dirent.d_ino
+ self.dirent.d_ino as u64
}
/// Return the inode number of this directory entry.
diff --git a/vendor/rustix/src/imp/libc/fs/makedev.rs b/vendor/rustix/src/backend/libc/fs/makedev.rs
index d9089e7f4..08ecd872e 100644
--- a/vendor/rustix/src/imp/libc/fs/makedev.rs
+++ b/vendor/rustix/src/backend/libc/fs/makedev.rs
@@ -5,14 +5,14 @@ use crate::fs::Dev;
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
- unsafe { c::makedev(maj, min) }
+ c::makedev(maj, min)
}
#[cfg(all(target_os = "android", not(target_pointer_width = "32")))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
// Android's `makedev` oddly has signed argument types.
- unsafe { c::makedev(maj as i32, min as i32) }
+ c::makedev(maj, min)
}
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
@@ -30,7 +30,7 @@ pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
// Emscripten's `makedev` has a 32-bit return value.
- Dev::from(unsafe { c::makedev(maj, min) })
+ Dev::from(c::makedev(maj, min))
}
#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
diff --git a/vendor/rustix/src/imp/libc/fs/mod.rs b/vendor/rustix/src/backend/libc/fs/mod.rs
index 02b7b2d6a..d0fc08765 100644
--- a/vendor/rustix/src/imp/libc/fs/mod.rs
+++ b/vendor/rustix/src/backend/libc/fs/mod.rs
@@ -1,8 +1,8 @@
#[cfg(not(target_os = "redox"))]
-#[cfg(any(feature = "fs", feature = "procfs"))]
pub(crate) mod dir;
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "freebsd",
target_os = "illumos",
target_os = "ios",
@@ -10,6 +10,7 @@ pub(crate) mod dir;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub(crate) mod makedev;
diff --git a/vendor/rustix/src/imp/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs
index 0317367ab..1d1891f0f 100644
--- a/vendor/rustix/src/imp/libc/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs
@@ -10,15 +10,18 @@ use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_ssize_t}
use super::super::offset::libc_fallocate;
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
use super::super::offset::libc_posix_fadvise;
#[cfg(not(any(
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "fuchsia",
@@ -29,48 +32,61 @@ use super::super::offset::libc_posix_fadvise;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
use super::super::offset::libc_posix_fallocate;
use super::super::offset::{libc_fstat, libc_fstatat, libc_ftruncate, libc_lseek, libc_off_t};
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
use super::super::offset::{libc_fstatfs, libc_statfs};
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+use super::super::offset::{libc_fstatvfs, libc_statvfs};
#[cfg(all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
target_env = "gnu",
))]
use super::super::time::types::LibcTimespec;
-use crate::fd::BorrowedFd;
-#[cfg(not(target_os = "wasi"))]
-use crate::fd::RawFd;
+use crate::fd::{BorrowedFd, OwnedFd};
use crate::ffi::CStr;
#[cfg(any(target_os = "ios", target_os = "macos"))]
use crate::ffi::CString;
-#[cfg(not(target_os = "illumos"))]
+#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
use crate::fs::Access;
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
use crate::fs::Advice;
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
use crate::fs::FallocateFlags;
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
use crate::fs::FlockOperation;
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
use crate::fs::MemfdFlags;
@@ -82,12 +98,13 @@ use crate::fs::MemfdFlags;
))]
use crate::fs::SealFlags;
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
-// not implemented in libc for netbsd yet
use crate::fs::StatFs;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fs::{cwd, RenameFlags, ResolveFlags, Statx, StatxFlags};
@@ -98,8 +115,16 @@ use crate::fs::{cwd, RenameFlags, ResolveFlags, Statx, StatxFlags};
target_os = "wasi",
)))]
use crate::fs::{Dev, FileType};
-use crate::fs::{FdFlags, Mode, OFlags, Stat, Timestamps};
-use crate::io::{self, OwnedFd, SeekFrom};
+use crate::fs::{Mode, OFlags, Stat, Timestamps};
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+use crate::fs::{StatVfs, StatVfsMountFlags};
+use crate::io::{self, SeekFrom};
#[cfg(not(target_os = "wasi"))]
use crate::process::{Gid, Uid};
#[cfg(not(all(
@@ -179,7 +204,7 @@ pub(crate) fn openat(
// Work around <https://sourceware.org/bugzilla/show_bug.cgi?id=17523>.
// Basically old glibc versions don't handle O_TMPFILE correctly.
#[cfg(all(unix, target_env = "gnu"))]
- if oflags.contains(OFlags::TMPFILE) && crate::imp::if_glibc_is_less_than_2_25() {
+ if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() {
return openat_via_syscall(dirfd, path, oflags, mode);
}
unsafe {
@@ -196,9 +221,11 @@ pub(crate) fn openat(
}
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
#[inline]
@@ -210,6 +237,22 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
}
}
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+#[inline]
+pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
+ unsafe {
+ let mut result = MaybeUninit::<libc_statvfs>::uninit();
+ ret(libc_statvfs(c_str(filename), result.as_mut_ptr()))?;
+ Ok(libc_statvfs_to_statvfs(result.assume_init()))
+ }
+}
+
#[cfg(not(target_os = "redox"))]
#[inline]
pub(crate) fn readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
@@ -349,9 +392,9 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::
))]
{
match statx(dirfd, path, flags, StatxFlags::BASIC_STATS) {
- Ok(x) => return statx_to_stat(x),
+ Ok(x) => statx_to_stat(x),
Err(io::Errno::NOSYS) => statat_old(dirfd, path, flags),
- Err(e) => return Err(e),
+ Err(err) => Err(err),
}
}
@@ -390,7 +433,12 @@ fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<
}
}
-#[cfg(not(any(target_os = "emscripten", target_os = "illumos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+)))]
pub(crate) fn accessat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -757,12 +805,14 @@ pub(crate) fn copy_file_range(
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub(crate) fn fadvise(fd: BorrowedFd<'_>, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
let offset = offset as i64;
@@ -794,14 +844,6 @@ pub(crate) fn fadvise(fd: BorrowedFd<'_>, offset: u64, len: u64, advice: Advice)
}
}
-pub(crate) fn fcntl_getfd(fd: BorrowedFd<'_>) -> io::Result<FdFlags> {
- unsafe { ret_c_int(c::fcntl(borrowed_fd(fd), c::F_GETFD)).map(FdFlags::from_bits_truncate) }
-}
-
-pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()> {
- unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_SETFD, flags.bits())) }
-}
-
pub(crate) fn fcntl_getfl(fd: BorrowedFd<'_>) -> io::Result<OFlags> {
unsafe { ret_c_int(c::fcntl(borrowed_fd(fd), c::F_GETFL)).map(OFlags::from_bits_truncate) }
}
@@ -833,11 +875,6 @@ pub(crate) fn fcntl_add_seals(fd: BorrowedFd<'_>, seals: SealFlags) -> io::Resul
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_ADD_SEALS, seals.bits())) }
}
-#[cfg(not(target_os = "wasi"))]
-pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
- unsafe { ret_owned_fd(c::fcntl(borrowed_fd(fd), c::F_DUPFD_CLOEXEC, min)) }
-}
-
pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
let (whence, offset): (c::c_int, libc_off_t) = match pos {
SeekFrom::Start(pos) => {
@@ -897,7 +934,7 @@ pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option<Uid>, group: Option<Gid>)
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> {
unsafe { ret(c::flock(borrowed_fd(fd), operation as c::c_int)) }
}
@@ -911,9 +948,9 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
))]
{
match statx(fd, cstr!(""), AtFlags::EMPTY_PATH, StatxFlags::BASIC_STATS) {
- Ok(x) => return statx_to_stat(x),
+ Ok(x) => statx_to_stat(x),
Err(io::Errno::NOSYS) => fstat_old(fd),
- Err(e) => return Err(e),
+ Err(err) => Err(err),
}
}
@@ -943,11 +980,13 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result<Stat> {
}
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
-)))] // not implemented in libc for netbsd yet
+)))]
pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
let mut statfs = MaybeUninit::<StatFs>::uninit();
unsafe {
@@ -956,6 +995,44 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
}
}
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
+ let mut statvfs = MaybeUninit::<libc_statvfs>::uninit();
+ unsafe {
+ ret(libc_fstatvfs(borrowed_fd(fd), statvfs.as_mut_ptr()))?;
+ Ok(libc_statvfs_to_statvfs(statvfs.assume_init()))
+ }
+}
+
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi"
+)))]
+fn libc_statvfs_to_statvfs(from: libc_statvfs) -> StatVfs {
+ StatVfs {
+ f_bsize: from.f_bsize as u64,
+ f_frsize: from.f_frsize as u64,
+ f_blocks: from.f_blocks as u64,
+ f_bfree: from.f_bfree as u64,
+ f_bavail: from.f_bavail as u64,
+ f_files: from.f_files as u64,
+ f_ffree: from.f_ffree as u64,
+ f_favail: from.f_ffree as u64,
+ f_fsid: from.f_fsid as u64,
+ f_flag: unsafe { StatVfsMountFlags::from_bits_unchecked(from.f_flag as u64) },
+ f_namemax: from.f_namemax as u64,
+ }
+}
+
pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> {
// 32-bit gnu version: libc has `futimens` but it is not y2038 safe by default.
#[cfg(all(
@@ -1058,6 +1135,7 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
}
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "ios",
@@ -1065,6 +1143,7 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub(crate) fn fallocate(
fd: BorrowedFd<'_>,
@@ -1107,7 +1186,7 @@ pub(crate) fn fallocate(
assert!(mode.is_empty());
- let new_len = offset.checked_add(len).ok_or_else(|| io::Errno::FBIG)?;
+ let new_len = offset.checked_add(len).ok_or(io::Errno::FBIG)?;
let mut store = c::fstore_t {
fst_flags: c::F_ALLOCATECONTIG,
fst_posmode: c::F_PEOFPOSMODE,
@@ -1130,6 +1209,7 @@ pub(crate) fn fsync(fd: BorrowedFd<'_>) -> io::Result<()> {
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
@@ -1417,6 +1497,28 @@ pub(crate) fn statx(
flags: AtFlags,
mask: StatxFlags,
) -> io::Result<Statx> {
+ // If a future Linux kernel adds more fields to `struct statx` and users
+ // passing flags unknown to rustix in `StatxFlags`, we could end up
+ // writing outside of the buffer. To prevent this possibility, we mask off
+ // any flags that we don't know about.
+ //
+ // This includes `STATX__RESERVED`, which has a value that we know, but
+ // which could take on arbitrary new meaning in the future. Linux currently
+ // rejects this flag with `EINVAL`, so we do the same.
+ //
+ // This doesn't rely on `STATX_ALL` because [it's deprecated] and already
+ // doesn't represent all the known flags.
+ //
+ // [it's deprecated]: https://patchwork.kernel.org/project/linux-fsdevel/patch/20200505095915.11275-7-mszeredi@redhat.com/
+ #[cfg(not(any(target_os = "android", target_env = "musl")))]
+ const STATX__RESERVED: u32 = libc::STATX__RESERVED as u32;
+ #[cfg(any(target_os = "android", target_env = "musl"))]
+ const STATX__RESERVED: u32 = linux_raw_sys::general::STATX__RESERVED;
+ if (mask.bits() & STATX__RESERVED) == STATX__RESERVED {
+ return Err(io::Errno::INVAL);
+ }
+ let mask = mask & StatxFlags::all();
+
let mut statx_buf = MaybeUninit::<Statx>::uninit();
unsafe {
ret(sys::statx(
@@ -1520,7 +1622,7 @@ pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> {
// `F_GETPATH` in terms of `MAXPATHLEN`, and there are no
// alternatives. If a better method is invented, it should be used
// instead.
- let mut buf = vec![0; c::PATH_MAX as usize];
+ let mut buf = alloc::vec![0; c::PATH_MAX as usize];
// From the [macOS `fcntl` man page]:
// `F_GETPATH` - Get the path of the file descriptor `Fildes`. The argument
diff --git a/vendor/rustix/src/imp/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs
index 9d892daf0..8d8ec08bf 100644
--- a/vendor/rustix/src/imp/libc/fs/types.rs
+++ b/vendor/rustix/src/backend/libc/fs/types.rs
@@ -2,17 +2,6 @@ use super::super::c;
use bitflags::bitflags;
bitflags! {
- /// `FD_*` constants for use with [`fcntl_getfd`] and [`fcntl_setfd`].
- ///
- /// [`fcntl_getfd`]: crate::fs::fcntl_getfd
- /// [`fcntl_setfd`]: crate::fs::fcntl_setfd
- pub struct FdFlags: c::c_int {
- /// `FD_CLOEXEC`
- const CLOEXEC = c::FD_CLOEXEC;
- }
-}
-
-bitflags! {
/// `*_OK` constants for use with [`accessat`].
///
/// [`accessat`]: fn.accessat.html
@@ -438,7 +427,12 @@ impl FileType {
}
/// Construct a `FileType` from the `d_type` field of a `c::dirent`.
- #[cfg(not(any(target_os = "illumos", target_os = "redox")))]
+ #[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris"
+ )))]
pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self {
match d_type {
c::DT_REG => Self::RegularFile,
@@ -461,12 +455,14 @@ impl FileType {
/// [`fadvise`]: crate::fs::fadvise
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(u32)]
@@ -681,10 +677,12 @@ bitflags! {
}
#[cfg(not(any(
+ target_os = "aix",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
bitflags! {
/// `FALLOC_FL_*` constants for use with [`fallocate`].
@@ -693,8 +691,10 @@ bitflags! {
pub struct FallocateFlags: i32 {
/// `FALLOC_FL_KEEP_SIZE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -704,8 +704,10 @@ bitflags! {
const KEEP_SIZE = c::FALLOC_FL_KEEP_SIZE;
/// `FALLOC_FL_PUNCH_HOLE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -715,8 +717,10 @@ bitflags! {
const PUNCH_HOLE = c::FALLOC_FL_PUNCH_HOLE;
/// `FALLOC_FL_NO_HIDE_STALE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos",
@@ -729,8 +733,10 @@ bitflags! {
const NO_HIDE_STALE = c::FALLOC_FL_NO_HIDE_STALE;
/// `FALLOC_FL_COLLAPSE_RANGE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -741,8 +747,10 @@ bitflags! {
const COLLAPSE_RANGE = c::FALLOC_FL_COLLAPSE_RANGE;
/// `FALLOC_FL_ZERO_RANGE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -753,8 +761,10 @@ bitflags! {
const ZERO_RANGE = c::FALLOC_FL_ZERO_RANGE;
/// `FALLOC_FL_INSERT_RANGE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -765,8 +775,10 @@ bitflags! {
const INSERT_RANGE = c::FALLOC_FL_INSERT_RANGE;
/// `FALLOC_FL_UNSHARE_RANGE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -778,10 +790,56 @@ bitflags! {
}
}
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+bitflags! {
+ /// `ST_*` constants for use with [`StatVfs`].
+ pub struct StatVfsMountFlags: u64 {
+ /// `ST_MANDLOCK`
+ #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
+ const MANDLOCK = libc::ST_MANDLOCK as u64;
+
+ /// `ST_NOATIME`
+ #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
+ const NOATIME = libc::ST_NOATIME as u64;
+
+ /// `ST_NODEV`
+ #[cfg(any(target_os = "aix", target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
+ const NODEV = libc::ST_NODEV as u64;
+
+ /// `ST_NODIRATIME`
+ #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
+ const NODIRATIME = libc::ST_NODIRATIME as u64;
+
+ /// `ST_NOEXEC`
+ #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
+ const NOEXEC = libc::ST_NOEXEC as u64;
+
+ /// `ST_NOSUID`
+ const NOSUID = libc::ST_NOSUID as u64;
+
+ /// `ST_RDONLY`
+ const RDONLY = libc::ST_RDONLY as u64;
+
+ /// `ST_RELATIME`
+ #[cfg(any(target_os = "android", all(target_os = "linux", target_env = "gnu")))]
+ const RELATIME = libc::ST_RELATIME as u64;
+
+ /// `ST_SYNCHRONOUS`
+ #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))]
+ const SYNCHRONOUS = libc::ST_SYNCHRONOUS as u64;
+ }
+}
+
/// `LOCK_*` constants for use with [`flock`]
///
/// [`flock`]: crate::fs::flock
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(i32)]
pub enum FlockOperation {
@@ -858,24 +916,28 @@ pub struct Stat {
pub st_ino: u64,
}
-/// `struct statfs` for use with [`fstatfs`].
+/// `struct statfs` for use with [`statfs`] and [`fstatfs`].
///
+/// [`statfs`]: crate::fs::statfs
/// [`fstatfs`]: crate::fs::fstatfs
#[cfg(not(any(
target_os = "android",
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "linux",
target_os = "l4re",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
#[allow(clippy::module_name_repetitions)]
pub type StatFs = c::statfs;
-/// `struct statfs` for use with [`fstatfs`].
+/// `struct statfs` for use with [`statfs`] and [`fstatfs`].
///
+/// [`statfs`]: crate::fs::statfs
/// [`fstatfs`]: crate::fs::fstatfs
#[cfg(any(
target_os = "android",
@@ -885,6 +947,32 @@ pub type StatFs = c::statfs;
))]
pub type StatFs = c::statfs64;
+/// `struct statvfs` for use with [`statvfs`] and [`fstatvfs`].
+///
+/// [`statvfs`]: crate::fs::statvfs
+/// [`fstatvfs`]: crate::fs::fstatvfs
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+#[allow(missing_docs)]
+pub struct StatVfs {
+ pub f_bsize: u64,
+ pub f_frsize: u64,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: u64,
+ pub f_flag: StatVfsMountFlags,
+ pub f_namemax: u64,
+}
+
/// `struct statx` for use with [`statx`].
///
/// [`statx`]: crate::fs::statx
diff --git a/vendor/rustix/src/imp/libc/io/epoll.rs b/vendor/rustix/src/backend/libc/io/epoll.rs
index a95e6b5cd..3205a613f 100644
--- a/vendor/rustix/src/imp/libc/io/epoll.rs
+++ b/vendor/rustix/src/backend/libc/io/epoll.rs
@@ -59,10 +59,10 @@
use super::super::c;
use super::super::conv::{ret, ret_owned_fd, ret_u32};
-use crate::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};
+use crate::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd};
#[cfg(not(feature = "rustc-dep-of-std"))]
-use crate::fd::{FromFd, FromRawFd, IntoFd, IntoRawFd};
-use crate::io::{self, OwnedFd};
+use crate::fd::{FromRawFd, IntoRawFd};
+use crate::io;
use alloc::vec::Vec;
use bitflags::bitflags;
use core::convert::TryInto;
@@ -207,17 +207,17 @@ impl<'a> Context for Borrowing<'a> {
}
/// A type implementing [`Context`] where the `Data` type is `T`, a type
-/// implementing `IntoFd` and `FromFd`.
+/// implementing `From<OwnedFd>` and `From<T> for OwnedFd`.
///
/// This may be used with [`OwnedFd`], or higher-level types like
/// [`std::fs::File`] or [`std::net::TcpStream`].
#[cfg(not(feature = "rustc-dep-of-std"))]
-pub struct Owning<'context, T: IntoFd + FromFd> {
+pub struct Owning<'context, T: Into<OwnedFd> + From<OwnedFd>> {
_phantom: PhantomData<&'context T>,
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: IntoFd + FromFd> Owning<'context, T> {
+impl<'context, T: Into<OwnedFd> + From<OwnedFd>> Owning<'context, T> {
/// Creates a new empty `Owning`.
#[allow(clippy::new_without_default)] // This is a specialized type that doesn't need to be generically constructible.
#[inline]
@@ -229,16 +229,17 @@ impl<'context, T: IntoFd + FromFd> Owning<'context, T> {
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> Context for Owning<'context, T> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> Context for Owning<'context, T> {
type Data = T;
type Target = BorrowedFd<'context>;
#[inline]
fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target> {
- let raw_fd = data.into_fd().into_raw_fd();
+ let fd: OwnedFd = data.into();
+ let raw_fd = fd.into_raw_fd();
// Safety: `epoll` will assign ownership of the file descriptor to the
- // kernel epoll object. We use `IntoFd`+`IntoRawFd` to consume the
- // `Data` and extract the raw file descriptor and then "borrow" it
+ // kernel epoll object. We use `Into<OwnedFd>`+`IntoRawFd` to consume
+ // the `Data` and extract the raw file descriptor and then "borrow" it
// with `borrow_raw` knowing that the borrow won't outlive the
// kernel epoll object.
unsafe { Ref::new(BorrowedFd::<'context>::borrow_raw(raw_fd)) }
@@ -260,7 +261,7 @@ impl<'context, T: AsFd + IntoFd + FromFd> Context for Owning<'context, T> {
// being released, so we can create a new `OwnedFd` that assumes
// ownership.
let raw_fd = target.consume().as_raw_fd();
- unsafe { T::from_fd(io_lifetimes::OwnedFd::from_raw_fd(raw_fd)) }
+ unsafe { T::from(OwnedFd::from_raw_fd(raw_fd).into()) }
}
}
@@ -396,21 +397,21 @@ impl<Context: self::Context> Epoll<Context> {
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> AsRawFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsRawFd for Epoll<Owning<'context, T>> {
fn as_raw_fd(&self) -> RawFd {
self.epoll_fd.as_raw_fd()
}
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> IntoRawFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> IntoRawFd for Epoll<Owning<'context, T>> {
fn into_raw_fd(self) -> RawFd {
self.epoll_fd.into_raw_fd()
}
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> FromRawFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> FromRawFd for Epoll<Owning<'context, T>> {
unsafe fn from_raw_fd(fd: RawFd) -> Self {
Self {
epoll_fd: OwnedFd::from_raw_fd(fd),
@@ -420,21 +421,25 @@ impl<'context, T: AsFd + IntoFd + FromFd> FromRawFd for Epoll<Owning<'context, T
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> AsFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsFd for Epoll<Owning<'context, T>> {
fn as_fd(&self) -> BorrowedFd<'_> {
self.epoll_fd.as_fd()
}
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> From<Epoll<Owning<'context, T>>> for OwnedFd {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<Epoll<Owning<'context, T>>>
+ for OwnedFd
+{
fn from(epoll: Epoll<Owning<'context, T>>) -> Self {
epoll.epoll_fd
}
}
#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + IntoFd + FromFd> From<OwnedFd> for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<OwnedFd>
+ for Epoll<Owning<'context, T>>
+{
fn from(fd: OwnedFd) -> Self {
Self {
epoll_fd: fd,
diff --git a/vendor/rustix/src/imp/libc/io/errno.rs b/vendor/rustix/src/backend/libc/io/errno.rs
index 470cf205c..131709e0c 100644
--- a/vendor/rustix/src/imp/libc/io/errno.rs
+++ b/vendor/rustix/src/backend/libc/io/errno.rs
@@ -26,8 +26,10 @@ impl Errno {
/// `EADV`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -54,8 +56,10 @@ impl Errno {
/// `EBADE`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -68,8 +72,10 @@ impl Errno {
/// `EBADFD`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -83,8 +89,10 @@ impl Errno {
/// `EBADR`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -105,8 +113,10 @@ impl Errno {
/// `EBADRQC`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -117,8 +127,10 @@ impl Errno {
/// `EBADSLT`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -129,8 +141,10 @@ impl Errno {
/// `EBFONT`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -154,6 +168,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -164,8 +179,10 @@ impl Errno {
/// `ECOMM`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -185,9 +202,11 @@ impl Errno {
/// `EDEADLOCK`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -209,13 +228,16 @@ impl Errno {
/// `EDOTDOT`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const DOTDOT: Self = Self(c::EDOTDOT);
@@ -248,15 +270,18 @@ impl Errno {
/// `EHWPOISON`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const HWPOISON: Self = Self(c::EHWPOISON);
@@ -294,52 +319,64 @@ impl Errno {
/// `EISNAM`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const ISNAM: Self = Self(c::EISNAM);
/// `EKEYEXPIRED`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const KEYEXPIRED: Self = Self(c::EKEYEXPIRED);
/// `EKEYREJECTED`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const KEYREJECTED: Self = Self(c::EKEYREJECTED);
/// `EKEYREVOKED`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const KEYREVOKED: Self = Self(c::EKEYREVOKED);
@@ -348,6 +385,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -360,6 +398,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -372,6 +411,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -384,6 +424,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -394,8 +435,10 @@ impl Errno {
/// `ELIBACC`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -406,8 +449,10 @@ impl Errno {
/// `ELIBBAD`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -418,8 +463,10 @@ impl Errno {
/// `ELIBEXEC`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -430,8 +477,10 @@ impl Errno {
/// `ELIBMAX`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -442,8 +491,10 @@ impl Errno {
/// `ELIBSCN`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -456,6 +507,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -468,13 +520,16 @@ impl Errno {
/// `EMEDIUMTYPE`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const MEDIUMTYPE: Self = Self(c::EMEDIUMTYPE);
@@ -493,13 +548,16 @@ impl Errno {
/// `ENAVAIL`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const NAVAIL: Self = Self(c::ENAVAIL);
@@ -525,8 +583,10 @@ impl Errno {
/// `ENOANO`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -538,6 +598,7 @@ impl Errno {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -551,6 +612,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -563,6 +625,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "openbsd",
target_os = "wasi",
)))]
@@ -579,13 +642,16 @@ impl Errno {
/// `ENOKEY`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const NOKEY: Self = Self(c::ENOKEY);
@@ -598,13 +664,16 @@ impl Errno {
/// `ENOMEDIUM`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const NOMEDIUM: Self = Self(c::ENOMEDIUM);
@@ -620,8 +689,10 @@ impl Errno {
/// `ENONET`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -632,8 +703,10 @@ impl Errno {
/// `ENOPKG`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -651,6 +724,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "openbsd",
target_os = "wasi",
)))]
@@ -660,6 +734,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "openbsd",
target_os = "wasi",
)))]
@@ -668,7 +743,7 @@ impl Errno {
#[cfg(not(windows))]
pub const NOSYS: Self = Self(c::ENOSYS);
/// `ENOTBLK`
- #[cfg(not(any(windows, target_os = "wasi")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "wasi")))]
pub const NOTBLK: Self = Self(c::ENOTBLK);
/// `ENOTCAPABLE`
#[cfg(any(target_os = "freebsd", target_os = "wasi"))]
@@ -683,23 +758,31 @@ impl Errno {
/// `ENOTNAM`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const NOTNAM: Self = Self(c::ENOTNAM);
/// `ENOTRECOVERABLE`
- #[cfg(not(any(windows, target_os = "dragonfly", target_os = "netbsd")))]
+ #[cfg(not(any(
+ windows,
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "netbsd"
+ )))]
pub const NOTRECOVERABLE: Self = Self(c::ENOTRECOVERABLE);
/// `ENOTSOCK`
pub const NOTSOCK: Self = Self(c::ENOTSOCK);
/// `ENOTSUP`
- #[cfg(not(any(windows, target_os = "redox")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "redox")))]
pub const NOTSUP: Self = Self(c::ENOTSUP);
/// `ENOTTY`
#[cfg(not(windows))]
@@ -707,8 +790,10 @@ impl Errno {
/// `ENOTUNIQ`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -725,7 +810,12 @@ impl Errno {
#[cfg(not(windows))]
pub const OVERFLOW: Self = Self(c::EOVERFLOW);
/// `EOWNERDEAD`
- #[cfg(not(any(windows, target_os = "dragonfly", target_os = "netbsd")))]
+ #[cfg(not(any(
+ windows,
+ target_os = "haiku",
+ target_os = "dragonfly",
+ target_os = "netbsd"
+ )))]
pub const OWNERDEAD: Self = Self(c::EOWNERDEAD);
/// `EPERM`
#[cfg(not(windows))]
@@ -795,8 +885,10 @@ impl Errno {
/// `EREMCHG`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -805,18 +897,21 @@ impl Errno {
)))]
pub const REMCHG: Self = Self(c::EREMCHG);
/// `EREMOTE`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
pub const REMOTE: Self = Self(c::EREMOTE);
/// `EREMOTEIO`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const REMOTEIO: Self = Self(c::EREMOTEIO);
@@ -825,6 +920,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -835,15 +931,18 @@ impl Errno {
/// `ERFKILL`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const RFKILL: Self = Self(c::ERFKILL);
@@ -864,7 +963,7 @@ impl Errno {
#[cfg(not(target_os = "wasi"))]
pub const SHUTDOWN: Self = Self(c::ESHUTDOWN);
/// `ESOCKTNOSUPPORT`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
pub const SOCKTNOSUPPORT: Self = Self(c::ESOCKTNOSUPPORT);
/// `ESPIPE`
#[cfg(not(windows))]
@@ -875,8 +974,10 @@ impl Errno {
/// `ESRMNT`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -889,8 +990,10 @@ impl Errno {
/// `ESTRPIPE`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -914,7 +1017,7 @@ impl Errno {
#[doc(alias = "2BIG")]
pub const TOOBIG: Self = Self(c::E2BIG);
/// `ETOOMANYREFS`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
pub const TOOMANYREFS: Self = Self(c::ETOOMANYREFS);
/// `ETXTBSY`
#[cfg(not(windows))]
@@ -922,13 +1025,16 @@ impl Errno {
/// `EUCLEAN`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub const UCLEAN: Self = Self(c::EUCLEAN);
@@ -937,6 +1043,7 @@ impl Errno {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -945,7 +1052,7 @@ impl Errno {
)))]
pub const UNATCH: Self = Self(c::EUNATCH);
/// `EUSERS`
- #[cfg(not(target_os = "wasi"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
pub const USERS: Self = Self(c::EUSERS);
/// `EWOULDBLOCK`
pub const WOULDBLOCK: Self = Self(c::EWOULDBLOCK);
@@ -955,8 +1062,10 @@ impl Errno {
/// `EXFULL`
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
diff --git a/vendor/rustix/src/imp/libc/io/io_slice.rs b/vendor/rustix/src/backend/libc/io/io_slice.rs
index 81c504d25..de1ef434c 100644
--- a/vendor/rustix/src/imp/libc/io/io_slice.rs
+++ b/vendor/rustix/src/backend/libc/io/io_slice.rs
@@ -2,6 +2,8 @@
//! library/std/src/sys/unix/io.rs
//! dca3f1b786efd27be3b325ed1e01e247aa589c3b.
+#![allow(missing_docs)]
+
use super::super::c;
use core::marker::PhantomData;
use core::slice;
diff --git a/vendor/rustix/src/imp/libc/io/mod.rs b/vendor/rustix/src/backend/libc/io/mod.rs
index 1378adf3d..1378adf3d 100644
--- a/vendor/rustix/src/imp/libc/io/mod.rs
+++ b/vendor/rustix/src/backend/libc/io/mod.rs
diff --git a/vendor/rustix/src/imp/libc/io/poll_fd.rs b/vendor/rustix/src/backend/libc/io/poll_fd.rs
index c516a9309..c516a9309 100644
--- a/vendor/rustix/src/imp/libc/io/poll_fd.rs
+++ b/vendor/rustix/src/backend/libc/io/poll_fd.rs
diff --git a/vendor/rustix/src/imp/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs
index 4fafbfd66..3774e700a 100644
--- a/vendor/rustix/src/imp/libc/io/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/syscalls.rs
@@ -7,22 +7,30 @@ use super::super::conv::{
borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_ssize_t,
};
use super::super::offset::{libc_pread, libc_pwrite};
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
use super::super::offset::{libc_preadv, libc_pwritev};
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use super::super::offset::{libc_preadv2, libc_pwritev2};
-use crate::fd::{AsFd, BorrowedFd, RawFd};
-#[cfg(not(target_os = "wasi"))]
+use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
+#[cfg(not(any(target_os = "aix", target_os = "wasi")))]
use crate::io::DupFlags;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "wasi"
+)))]
use crate::io::PipeFlags;
-use crate::io::{self, IoSlice, IoSliceMut, OwnedFd, PollFd};
+use crate::io::{self, FdFlags, IoSlice, IoSliceMut, PollFd};
#[cfg(any(target_os = "android", target_os = "linux"))]
-use crate::io::{EventfdFlags, ReadWriteFlags};
+use crate::io::{EventfdFlags, IoSliceRaw, ReadWriteFlags, SpliceFlags};
use core::cmp::min;
use core::convert::TryInto;
use core::mem::MaybeUninit;
-#[cfg(feature = "net")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use core::ptr;
+#[cfg(all(feature = "fs", feature = "net"))]
use libc_errno::errno;
pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
@@ -103,7 +111,7 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize>
Ok(nwritten as usize)
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
pub(crate) fn preadv(
fd: BorrowedFd<'_>,
bufs: &mut [IoSliceMut],
@@ -122,7 +130,7 @@ pub(crate) fn preadv(
Ok(nread as usize)
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
let offset = offset as i64;
@@ -314,7 +322,7 @@ pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
}
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[cfg(feature = "net")]
+#[cfg(all(feature = "fs", feature = "net"))]
pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
let (mut read, mut write) = crate::fs::fd::_is_file_read_write(fd)?;
let mut not_socket = false;
@@ -361,11 +369,24 @@ pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
}
#[cfg(target_os = "wasi")]
-#[cfg(feature = "net")]
+#[cfg(all(feature = "fs", feature = "net"))]
pub(crate) fn is_read_write(_fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
todo!("Implement is_read_write for WASI in terms of fd_fdstat_get");
}
+pub(crate) fn fcntl_getfd(fd: BorrowedFd<'_>) -> io::Result<FdFlags> {
+ unsafe { ret_c_int(c::fcntl(borrowed_fd(fd), c::F_GETFD)).map(FdFlags::from_bits_truncate) }
+}
+
+pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()> {
+ unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_SETFD, flags.bits())) }
+}
+
+#[cfg(not(target_os = "wasi"))]
+pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(c::fcntl(borrowed_fd(fd), c::F_DUPFD_CLOEXEC, min)) }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn dup(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::dup(borrowed_fd(fd))) }
@@ -377,8 +398,10 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> {
}
#[cfg(not(any(
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
@@ -397,6 +420,7 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, flags: DupFlags) -> io
#[cfg(any(
target_os = "android",
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
@@ -414,12 +438,12 @@ pub(crate) fn ioctl_fioclex(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::FIOCLEX)) }
}
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub(crate) fn ioctl_tiocexcl(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCEXCL as _)) }
}
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCNXCL as _)) }
}
@@ -434,7 +458,13 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
}
}
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "wasi"
+)))]
pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
unsafe {
let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit();
@@ -454,3 +484,50 @@ pub(crate) fn poll(fds: &mut [PollFd<'_>], timeout: c::c_int) -> io::Result<usiz
ret_c_int(unsafe { c::poll(fds.as_mut_ptr().cast(), nfds, timeout) })
.map(|nready| nready as usize)
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub fn splice(
+ fd_in: BorrowedFd,
+ off_in: Option<&mut u64>,
+ fd_out: BorrowedFd,
+ off_out: Option<&mut u64>,
+ len: usize,
+ flags: SpliceFlags,
+) -> io::Result<usize> {
+ let off_in = off_in
+ .map(|off| (off as *mut u64).cast())
+ .unwrap_or(ptr::null_mut());
+
+ let off_out = off_out
+ .map(|off| (off as *mut u64).cast())
+ .unwrap_or(ptr::null_mut());
+
+ ret_ssize_t(unsafe {
+ c::splice(
+ borrowed_fd(fd_in),
+ off_in,
+ borrowed_fd(fd_out),
+ off_out,
+ len,
+ flags.bits(),
+ )
+ })
+ .map(|spliced| spliced as usize)
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub unsafe fn vmsplice(
+ fd: BorrowedFd,
+ bufs: &[IoSliceRaw],
+ flags: SpliceFlags,
+) -> io::Result<usize> {
+ ret_ssize_t(c::vmsplice(
+ borrowed_fd(fd),
+ bufs.as_ptr().cast::<c::iovec>(),
+ min(bufs.len(), max_iov()),
+ flags.bits(),
+ ))
+ .map(|spliced| spliced as usize)
+}
diff --git a/vendor/rustix/src/imp/libc/io/types.rs b/vendor/rustix/src/backend/libc/io/types.rs
index 483f3a6af..46d5f6332 100644
--- a/vendor/rustix/src/imp/libc/io/types.rs
+++ b/vendor/rustix/src/backend/libc/io/types.rs
@@ -1,6 +1,18 @@
use super::super::c;
-#[cfg(not(target_os = "wasi"))]
use bitflags::bitflags;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use core::marker::PhantomData;
+
+bitflags! {
+ /// `FD_*` constants for use with [`fcntl_getfd`] and [`fcntl_setfd`].
+ ///
+ /// [`fcntl_getfd`]: crate::io::fcntl_getfd
+ /// [`fcntl_setfd`]: crate::io::fcntl_setfd
+ pub struct FdFlags: c::c_int {
+ /// `FD_CLOEXEC`
+ const CLOEXEC = c::FD_CLOEXEC;
+ }
+}
#[cfg(any(target_os = "android", target_os = "linux"))]
bitflags! {
@@ -27,6 +39,21 @@ bitflags! {
}
}
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `SPLICE_F_*` constants for use with [`splice`] and [`vmsplice`].
+ pub struct SpliceFlags: c::c_uint {
+ /// `SPLICE_F_MOVE`
+ const MOVE = c::SPLICE_F_MOVE;
+ /// `SPLICE_F_NONBLOCK`
+ const NONBLOCK = c::SPLICE_F_NONBLOCK;
+ /// `SPLICE_F_MORE`
+ const MORE = c::SPLICE_F_MORE;
+ /// `SPLICE_F_GIFT`
+ const GIFT = c::SPLICE_F_GIFT;
+ }
+}
+
#[cfg(not(target_os = "wasi"))]
bitflags! {
/// `O_*` constants for use with [`dup2`].
@@ -53,7 +80,13 @@ bitflags! {
/// `O_CLOEXEC`
const CLOEXEC = c::O_CLOEXEC;
/// `O_DIRECT`
- #[cfg(not(any(target_os = "illumos", target_os = "openbsd", target_os = "redox")))]
+ #[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "openbsd",
+ target_os = "redox",
+ target_os = "solaris",
+ )))]
const DIRECT = c::O_DIRECT;
/// `O_NONBLOCK`
const NONBLOCK = c::O_NONBLOCK;
@@ -76,7 +109,13 @@ bitflags! {
}
/// `PIPE_BUF`—The maximum size of a write to a pipe guaranteed to be atomic.
-#[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
pub const PIPE_BUF: usize = c::PIPE_BUF;
#[cfg(not(any(windows, target_os = "redox")))]
@@ -87,3 +126,39 @@ pub(crate) const STDIN_FILENO: c::c_int = c::STDIN_FILENO;
pub(crate) const STDOUT_FILENO: c::c_int = c::STDOUT_FILENO;
#[cfg(not(windows))]
pub(crate) const STDERR_FILENO: c::c_int = c::STDERR_FILENO;
+
+/// A buffer type used with `vmsplice`.
+/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms and WSABUF on Windows.
+/// Unlike `IoSlice` and `IoSliceMut` it is semantically like a raw pointer,
+/// and therefore can be shared or mutated as needed.
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[repr(transparent)]
+pub struct IoSliceRaw<'a> {
+ _buf: c::iovec,
+ _lifetime: PhantomData<&'a ()>,
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+impl<'a> IoSliceRaw<'a> {
+ /// Creates a new IoSlice wrapping a byte slice.
+ pub fn from_slice(buf: &'a [u8]) -> Self {
+ IoSliceRaw {
+ _buf: c::iovec {
+ iov_base: buf.as_ptr() as *mut u8 as *mut c::c_void,
+ iov_len: buf.len() as _,
+ },
+ _lifetime: PhantomData,
+ }
+ }
+
+ /// Creates a new IoSlice wrapping a mutable byte slice.
+ pub fn from_slice_mut(buf: &'a mut [u8]) -> Self {
+ IoSliceRaw {
+ _buf: c::iovec {
+ iov_base: buf.as_mut_ptr() as *mut c::c_void,
+ iov_len: buf.len() as _,
+ },
+ _lifetime: PhantomData,
+ }
+ }
+}
diff --git a/vendor/rustix/src/imp/libc/io/windows_syscalls.rs b/vendor/rustix/src/backend/libc/io/windows_syscalls.rs
index 4c6e86f94..4c6e86f94 100644
--- a/vendor/rustix/src/imp/libc/io/windows_syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/windows_syscalls.rs
diff --git a/vendor/rustix/src/imp/libc/io_lifetimes.rs b/vendor/rustix/src/backend/libc/io_lifetimes.rs
index b0b14b7c8..2dcd772e8 100644
--- a/vendor/rustix/src/imp/libc/io_lifetimes.rs
+++ b/vendor/rustix/src/backend/libc/io_lifetimes.rs
@@ -9,7 +9,7 @@ pub use std::os::windows::io::RawSocket as RawFd;
pub(crate) use windows_sys::Win32::Networking::WinSock::SOCKET as LibcFd;
// Re-export the `Socket` traits so that users can implement them.
-pub use io_lifetimes::{AsSocket, FromSocket, IntoSocket};
+pub use io_lifetimes::AsSocket;
/// A version of [`AsRawFd`] for use with Winsock2 API.
///
@@ -75,35 +75,3 @@ impl<T: AsSocket> AsFd for T {
self.as_socket()
}
}
-
-/// A version of [`IntoFd`] for use with Winsock2 API.
-///
-/// [`IntoFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.IntoFd.html
-pub trait IntoFd {
- /// A version of [`into_fd`] for use with Winsock2 API.
- ///
- /// [`into_fd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.IntoFd.html#tymethod.into_fd
- fn into_fd(self) -> OwnedFd;
-}
-impl<T: IntoSocket> IntoFd for T {
- #[inline]
- fn into_fd(self) -> OwnedFd {
- self.into_socket()
- }
-}
-
-/// A version of [`FromFd`] for use with Winsock2 API.
-///
-/// [`FromFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.FromFd.html
-pub trait FromFd {
- /// A version of [`from_fd`] for use with Winsock2 API.
- ///
- /// [`from_fd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.FromFd.html#tymethod.from_fd
- fn from_fd(fd: OwnedFd) -> Self;
-}
-impl<T: FromSocket> FromFd for T {
- #[inline]
- fn from_fd(fd: OwnedFd) -> Self {
- Self::from_socket(fd)
- }
-}
diff --git a/vendor/rustix/src/imp/libc/io_uring/mod.rs b/vendor/rustix/src/backend/libc/io_uring/mod.rs
index ef944f04d..ef944f04d 100644
--- a/vendor/rustix/src/imp/libc/io_uring/mod.rs
+++ b/vendor/rustix/src/backend/libc/io_uring/mod.rs
diff --git a/vendor/rustix/src/imp/libc/io_uring/syscalls.rs b/vendor/rustix/src/backend/libc/io_uring/syscalls.rs
index d1e68363c..31fcec3db 100644
--- a/vendor/rustix/src/imp/libc/io_uring/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io_uring/syscalls.rs
@@ -2,8 +2,8 @@
use super::super::c;
use super::super::conv::{borrowed_fd, syscall_ret, syscall_ret_owned_fd, syscall_ret_u32};
-use crate::fd::BorrowedFd;
-use crate::io::{self, OwnedFd};
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::io;
use crate::io_uring::{io_uring_params, IoringEnterFlags, IoringRegisterOp};
use linux_raw_sys::general::{__NR_io_uring_enter, __NR_io_uring_register, __NR_io_uring_setup};
diff --git a/vendor/rustix/src/imp/libc/mm/mod.rs b/vendor/rustix/src/backend/libc/mm/mod.rs
index 1e0181a99..1e0181a99 100644
--- a/vendor/rustix/src/imp/libc/mm/mod.rs
+++ b/vendor/rustix/src/backend/libc/mm/mod.rs
diff --git a/vendor/rustix/src/imp/libc/mm/syscalls.rs b/vendor/rustix/src/backend/libc/mm/syscalls.rs
index ee670b5bf..a1d2df1af 100644
--- a/vendor/rustix/src/imp/libc/mm/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/mm/syscalls.rs
@@ -13,9 +13,9 @@ use super::types::{MapFlags, MprotectFlags, MsyncFlags, ProtFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
use super::types::{MlockFlags, UserfaultfdFlags};
use crate::fd::BorrowedFd;
-use crate::io;
#[cfg(any(target_os = "android", target_os = "linux"))]
-use crate::io::OwnedFd;
+use crate::fd::OwnedFd;
+use crate::io;
#[cfg(not(target_os = "redox"))]
pub(crate) fn madvise(addr: *mut c::c_void, len: usize, advice: Advice) -> io::Result<()> {
diff --git a/vendor/rustix/src/imp/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs
index 385b6c0e6..11ab708cf 100644
--- a/vendor/rustix/src/imp/libc/mm/types.rs
+++ b/vendor/rustix/src/backend/libc/mm/types.rs
@@ -56,12 +56,14 @@ bitflags! {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const SHARED_VALIDATE = c::MAP_SHARED_VALIDATE;
/// `MAP_PRIVATE`
@@ -70,12 +72,14 @@ bitflags! {
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const DENYWRITE = c::MAP_DENYWRITE;
/// `MAP_FIXED`
@@ -87,36 +91,42 @@ bitflags! {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const FIXED_NOREPLACE = c::MAP_FIXED_NOREPLACE;
/// `MAP_GROWSDOWN`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const GROWSDOWN = c::MAP_GROWSDOWN;
/// `MAP_HUGETLB`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const HUGETLB = c::MAP_HUGETLB;
/// `MAP_HUGE_2MB`
@@ -126,12 +136,14 @@ bitflags! {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const HUGE_2MB = c::MAP_HUGE_2MB;
/// `MAP_HUGE_1GB`
@@ -141,51 +153,68 @@ bitflags! {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const HUGE_1GB = c::MAP_HUGE_1GB;
/// `MAP_LOCKED`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const LOCKED = c::MAP_LOCKED;
+ /// `MAP_NOCORE`
+ #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
+ const NOCORE = c::MAP_NOCORE;
/// `MAP_NORESERVE`
#[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "redox")))]
const NORESERVE = c::MAP_NORESERVE;
+ /// `MAP_NOSYNC`
+ #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
+ const NOSYNC = c::MAP_NOSYNC;
/// `MAP_POPULATE`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const POPULATE = c::MAP_POPULATE;
/// `MAP_STACK`
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
const STACK = c::MAP_STACK;
+ /// `MAP_PREFAULT_READ`
+ #[cfg(target_os = "freebsd")]
+ const PREFAULT_READ = c::MAP_PREFAULT_READ;
/// `MAP_SYNC`
#[cfg(not(any(
target_os = "android",
@@ -193,12 +222,14 @@ bitflags! {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
any(target_arch = "mips", target_arch = "mips64"),
@@ -262,43 +293,43 @@ bitflags! {
#[non_exhaustive]
pub enum Advice {
/// `POSIX_MADV_NORMAL`
- #[cfg(not(target_os = "android"))]
+ #[cfg(not(any(target_os = "android", target_os = "haiku")))]
Normal = c::POSIX_MADV_NORMAL,
/// `POSIX_MADV_NORMAL`
- #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "android", target_os = "haiku"))]
Normal = c::MADV_NORMAL,
/// `POSIX_MADV_SEQUENTIAL`
- #[cfg(not(target_os = "android"))]
+ #[cfg(not(any(target_os = "android", target_os = "haiku")))]
Sequential = c::POSIX_MADV_SEQUENTIAL,
/// `POSIX_MADV_SEQUENTIAL`
- #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "android", target_os = "haiku"))]
Sequential = c::MADV_SEQUENTIAL,
/// `POSIX_MADV_RANDOM`
- #[cfg(not(target_os = "android"))]
+ #[cfg(not(any(target_os = "android", target_os = "haiku")))]
Random = c::POSIX_MADV_RANDOM,
/// `POSIX_MADV_RANDOM`
- #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "android", target_os = "haiku"))]
Random = c::MADV_RANDOM,
/// `POSIX_MADV_WILLNEED`
- #[cfg(not(target_os = "android"))]
+ #[cfg(not(any(target_os = "android", target_os = "haiku")))]
WillNeed = c::POSIX_MADV_WILLNEED,
/// `POSIX_MADV_WILLNEED`
- #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "android", target_os = "haiku"))]
WillNeed = c::MADV_WILLNEED,
/// `POSIX_MADV_DONTNEED`
- #[cfg(not(any(target_os = "android", target_os = "emscripten")))]
+ #[cfg(not(any(target_os = "android", target_os = "emscripten", target_os = "haiku")))]
DontNeed = c::POSIX_MADV_DONTNEED,
/// `POSIX_MADV_DONTNEED`
- #[cfg(target_os = "android")]
+ #[cfg(any(target_os = "android", target_os = "haiku"))]
DontNeed = i32::MAX - 1,
/// `MADV_DONTNEED`
diff --git a/vendor/rustix/src/imp/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs
index e99a323ce..16d21b657 100644
--- a/vendor/rustix/src/imp/libc/mod.rs
+++ b/vendor/rustix/src/backend/libc/mod.rs
@@ -56,7 +56,7 @@ pub(crate) mod c;
pub(crate) use libc as c;
#[cfg(not(windows))]
-// #[cfg(feature = "fs")] // TODO: Enable this once `OwnedFd` moves out of the tree.
+#[cfg(feature = "fs")]
pub(crate) mod fs;
pub(crate) mod io;
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -64,7 +64,7 @@ pub(crate) mod io;
#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
pub(crate) mod io_uring;
#[cfg(not(any(windows, target_os = "wasi")))]
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
+#[cfg(feature = "mm")]
pub(crate) mod mm;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[cfg(feature = "net")]
@@ -101,7 +101,7 @@ pub(crate) mod time;
#[cfg(all(unix, target_env = "gnu"))]
pub(crate) fn if_glibc_is_less_than_2_25() -> bool {
// This is also defined inside `weak_or_syscall!` in
- // imp/libc/rand/syscalls.rs, but it's not convenient to re-export the weak
+ // backend/libc/rand/syscalls.rs, but it's not convenient to re-export the weak
// symbol from that macro, so we duplicate it at a small cost here.
weak! { fn getrandom(*mut c::c_void, c::size_t, c::c_uint) -> c::ssize_t }
diff --git a/vendor/rustix/src/imp/libc/net/addr.rs b/vendor/rustix/src/backend/libc/net/addr.rs
index 1aeda5e5d..ba64ed279 100644
--- a/vendor/rustix/src/imp/libc/net/addr.rs
+++ b/vendor/rustix/src/backend/libc/net/addr.rs
@@ -109,6 +109,7 @@ impl SocketAddrUnix {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -128,12 +129,15 @@ impl SocketAddrUnix {
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
)))]
sun_path: [0; 108],
+ #[cfg(target_os = "haiku")]
+ sun_path: [0; 126],
}
}
@@ -273,6 +277,7 @@ pub(crate) fn offsetof_sun_path() -> usize {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -282,6 +287,7 @@ pub(crate) fn offsetof_sun_path() -> usize {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -291,6 +297,7 @@ pub(crate) fn offsetof_sun_path() -> usize {
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -309,12 +316,15 @@ pub(crate) fn offsetof_sun_path() -> usize {
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
)))]
sun_path: [0; 108],
+ #[cfg(target_os = "haiku")]
+ sun_path: [0; 126],
};
(crate::utils::as_ptr(&z.sun_path) as usize) - (crate::utils::as_ptr(&z) as usize)
}
diff --git a/vendor/rustix/src/imp/libc/net/ext.rs b/vendor/rustix/src/backend/libc/net/ext.rs
index 7b5313c51..1c8f9f65c 100644
--- a/vendor/rustix/src/imp/libc/net/ext.rs
+++ b/vendor/rustix/src/backend/libc/net/ext.rs
@@ -127,27 +127,13 @@ pub(crate) fn sockaddr_in6_sin6_scope_id(addr: c::sockaddr_in6) -> u32 {
addr.sin6_scope_id
}
-#[cfg(not(feature = "std"))]
-#[cfg(not(windows))]
-#[inline]
-pub(crate) fn sockaddr_in6_sin6_scope_id_mut(addr: &mut c::sockaddr_in6) -> &mut u32 {
- &mut addr.sin6_scope_id
-}
-
-#[cfg(not(feature = "std"))]
-#[cfg(windows)]
-#[inline]
-pub(crate) fn sockaddr_in6_sin6_scope_id_mut(addr: &mut c::sockaddr_in6) -> &mut u32 {
- let addr: &mut sockaddr_in6 = unsafe { core::mem::transmute(addr) };
- &mut addr.sin6_scope_id
-}
-
#[cfg(not(windows))]
#[inline]
pub(crate) const fn sockaddr_in6_new(
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -164,6 +150,7 @@ pub(crate) const fn sockaddr_in6_new(
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -175,7 +162,7 @@ pub(crate) const fn sockaddr_in6_new(
sin6_flowinfo,
sin6_addr,
sin6_scope_id,
- #[cfg(target_os = "illumos")]
+ #[cfg(any(target_os = "illumos", target_os = "solaris"))]
__sin6_src_id: 0,
}
}
diff --git a/vendor/rustix/src/imp/libc/net/mod.rs b/vendor/rustix/src/backend/libc/net/mod.rs
index f7196ae4f..f7196ae4f 100644
--- a/vendor/rustix/src/imp/libc/net/mod.rs
+++ b/vendor/rustix/src/backend/libc/net/mod.rs
diff --git a/vendor/rustix/src/imp/libc/net/read_sockaddr.rs b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
index cb76b296c..5a946fbeb 100644
--- a/vendor/rustix/src/imp/libc/net/read_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
@@ -49,6 +49,7 @@ unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -58,6 +59,7 @@ unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -67,13 +69,17 @@ unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 {
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
)))]
sa_family: 0_u16,
+ #[cfg(not(target_os = "haiku"))]
sa_data: [0; 14],
+ #[cfg(target_os = "haiku")]
+ sa_data: [0; 30],
};
(*storage.cast::<sockaddr_header>()).ss_family.into()
diff --git a/vendor/rustix/src/imp/libc/net/send_recv.rs b/vendor/rustix/src/backend/libc/net/send_recv.rs
index 9ab908d62..8d1cc8ab7 100644
--- a/vendor/rustix/src/imp/libc/net/send_recv.rs
+++ b/vendor/rustix/src/backend/libc/net/send_recv.rs
@@ -9,11 +9,13 @@ bitflags! {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
const CONFIRM = c::MSG_CONFIRM;
/// `MSG_DONTROUTE`
@@ -29,11 +31,13 @@ bitflags! {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
const MORE = c::MSG_MORE;
#[cfg(not(any(windows, target_os = "ios", target_os = "macos")))]
@@ -47,7 +51,7 @@ bitflags! {
bitflags! {
/// `MSG_*`
pub struct RecvFlags: i32 {
- #[cfg(not(any(windows, target_os = "illumos", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "solaris")))]
/// `MSG_CMSG_CLOEXEC`
const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC;
/// `MSG_DONTWAIT`
@@ -58,11 +62,13 @@ bitflags! {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
const ERRQUEUE = c::MSG_ERRQUEUE;
/// `MSG_OOB`
diff --git a/vendor/rustix/src/imp/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs
index b0bab2e31..3d8a849c7 100644
--- a/vendor/rustix/src/imp/libc/net/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/net/syscalls.rs
@@ -15,8 +15,8 @@ use super::send_recv::{RecvFlags, SendFlags};
use super::types::{AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
use super::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6};
-use crate::fd::BorrowedFd;
-use crate::io::{self, OwnedFd};
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::io;
use crate::net::{SocketAddrAny, SocketAddrV4, SocketAddrV6};
use crate::utils::as_ptr;
use core::convert::TryInto;
@@ -252,6 +252,7 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
#[cfg(not(any(
windows,
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
@@ -288,6 +289,7 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<
#[cfg(not(any(
windows,
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
@@ -315,14 +317,14 @@ pub(crate) fn acceptfrom_with(
/// Darwin lacks `accept4`, but does have `accept`. We define
/// `AcceptFlags` to have no flags, so we can discard it here.
-#[cfg(any(windows, target_os = "ios", target_os = "macos"))]
+#[cfg(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos"))]
pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: AcceptFlags) -> io::Result<OwnedFd> {
accept(sockfd)
}
/// Darwin lacks `accept4`, but does have `accept`. We define
/// `AcceptFlags` to have no flags, so we can discard it here.
-#[cfg(any(windows, target_os = "ios", target_os = "macos"))]
+#[cfg(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos"))]
pub(crate) fn acceptfrom_with(
sockfd: BorrowedFd<'_>,
_flags: AcceptFlags,
@@ -700,6 +702,24 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn set_ipv6_multicast_hops(
+ fd: BorrowedFd<'_>,
+ multicast_hops: u32,
+ ) -> io::Result<()> {
+ setsockopt(
+ fd,
+ c::IPPROTO_IP as _,
+ c::IPV6_MULTICAST_LOOP,
+ multicast_hops,
+ )
+ }
+
+ #[inline]
+ pub(crate) fn get_ipv6_multicast_hops(fd: BorrowedFd<'_>) -> io::Result<u32> {
+ getsockopt(fd, c::IPPROTO_IP as _, c::IPV6_MULTICAST_LOOP)
+ }
+
+ #[inline]
pub(crate) fn set_ip_add_membership(
fd: BorrowedFd<'_>,
multiaddr: &Ipv4Addr,
diff --git a/vendor/rustix/src/imp/libc/net/types.rs b/vendor/rustix/src/backend/libc/net/types.rs
index 63e3a317e..19d97e7c7 100644
--- a/vendor/rustix/src/imp/libc/net/types.rs
+++ b/vendor/rustix/src/backend/libc/net/types.rs
@@ -27,6 +27,7 @@ impl SocketType {
pub const RAW: Self = Self(c::SOCK_RAW as u32);
/// `SOCK_RDM`
+ #[cfg(not(target_os = "haiku"))]
pub const RDM: Self = Self(c::SOCK_RDM as u32);
/// Constructs a `SocketType` from a raw integer.
@@ -64,11 +65,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const NETLINK: Self = Self(c::AF_NETLINK as _);
/// `AF_UNIX`, aka `AF_LOCAL`
@@ -79,11 +82,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const AX25: Self = Self(c::AF_AX25 as _);
/// `AF_IPX`
@@ -95,11 +100,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const NETROM: Self = Self(c::AF_NETROM as _);
/// `AF_BRIDGE`
@@ -107,11 +114,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const BRIDGE: Self = Self(c::AF_BRIDGE as _);
/// `AF_ATMPVC`
@@ -119,11 +128,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const ATMPVC: Self = Self(c::AF_ATMPVC as _);
/// `AF_X25`
@@ -131,6 +142,7 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -142,26 +154,31 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const ROSE: Self = Self(c::AF_ROSE as _);
/// `AF_DECnet`
#[allow(non_upper_case_globals)]
+ #[cfg(not(target_os = "haiku"))]
pub const DECnet: Self = Self(c::AF_DECnet as _);
/// `AF_NETBEUI`
#[cfg(not(any(
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const NETBEUI: Self = Self(c::AF_NETBEUI as _);
/// `AF_SECURITY`
@@ -169,11 +186,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const SECURITY: Self = Self(c::AF_SECURITY as _);
/// `AF_KEY`
@@ -181,6 +200,7 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -192,6 +212,7 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -203,11 +224,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const ASH: Self = Self(c::AF_ASH as _);
/// `AF_ECONET`
@@ -215,11 +238,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const ECONET: Self = Self(c::AF_ECONET as _);
/// `AF_ATMSVC`
@@ -227,11 +252,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const ATMSVC: Self = Self(c::AF_ATMSVC as _);
/// `AF_RDS`
@@ -239,24 +266,29 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const RDS: Self = Self(c::AF_RDS as _);
/// `AF_SNA`
+ #[cfg(not(target_os = "haiku"))]
pub const SNA: Self = Self(c::AF_SNA as _);
/// `AF_IRDA`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const IRDA: Self = Self(c::AF_IRDA as _);
/// `AF_PPPOX`
@@ -264,11 +296,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const PPPOX: Self = Self(c::AF_PPPOX as _);
/// `AF_WANPIPE`
@@ -276,11 +310,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const WANPIPE: Self = Self(c::AF_WANPIPE as _);
/// `AF_LLC`
@@ -288,11 +324,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const LLC: Self = Self(c::AF_LLC as _);
/// `AF_CAN`
@@ -300,11 +338,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const CAN: Self = Self(c::AF_CAN as _);
/// `AF_TIPC`
@@ -312,26 +352,30 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const TIPC: Self = Self(c::AF_TIPC as _);
/// `AF_BLUETOOTH`
- #[cfg(not(any(windows, target_os = "illumos", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(windows, target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "solaris")))]
pub const BLUETOOTH: Self = Self(c::AF_BLUETOOTH as _);
/// `AF_IUCV`
#[cfg(not(any(
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const IUCV: Self = Self(c::AF_IUCV as _);
/// `AF_RXRPC`
@@ -339,26 +383,30 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const RXRPC: Self = Self(c::AF_RXRPC as _);
/// `AF_ISDN`
- #[cfg(not(any(windows, target_os = "illumos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const ISDN: Self = Self(c::AF_ISDN as _);
/// `AF_PHONET`
#[cfg(not(any(
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const PHONET: Self = Self(c::AF_PHONET as _);
/// `AF_IEEE802154`
@@ -366,11 +414,13 @@ impl AddressFamily {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const IEEE802154: Self = Self(c::AF_IEEE802154 as _);
@@ -403,57 +453,61 @@ impl Protocol {
/// `IPPROTO_ICMP`
pub const ICMP: Self = Self(c::IPPROTO_ICMP as _);
/// `IPPROTO_IGMP`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const IGMP: Self = Self(c::IPPROTO_IGMP as _);
/// `IPPROTO_IPIP`
- #[cfg(not(any(windows, target_os = "illumos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const IPIP: Self = Self(c::IPPROTO_IPIP as _);
/// `IPPROTO_TCP`
pub const TCP: Self = Self(c::IPPROTO_TCP as _);
/// `IPPROTO_EGP`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const EGP: Self = Self(c::IPPROTO_EGP as _);
/// `IPPROTO_PUP`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const PUP: Self = Self(c::IPPROTO_PUP as _);
/// `IPPROTO_UDP`
pub const UDP: Self = Self(c::IPPROTO_UDP as _);
/// `IPPROTO_IDP`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const IDP: Self = Self(c::IPPROTO_IDP as _);
/// `IPPROTO_TP`
- #[cfg(not(any(windows, target_os = "illumos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const TP: Self = Self(c::IPPROTO_TP as _);
/// `IPPROTO_DCCP`
#[cfg(not(any(
windows,
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const DCCP: Self = Self(c::IPPROTO_DCCP as _);
/// `IPPROTO_IPV6`
pub const IPV6: Self = Self(c::IPPROTO_IPV6 as _);
/// `IPPROTO_RSVP`
- #[cfg(not(any(windows, target_os = "illumos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const RSVP: Self = Self(c::IPPROTO_RSVP as _);
/// `IPPROTO_GRE`
- #[cfg(not(any(windows, target_os = "illumos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const GRE: Self = Self(c::IPPROTO_GRE as _);
/// `IPPROTO_ESP`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const ESP: Self = Self(c::IPPROTO_ESP as _);
/// `IPPROTO_AH`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const AH: Self = Self(c::IPPROTO_AH as _);
/// `IPPROTO_MTP`
#[cfg(not(any(
windows,
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const MTP: Self = Self(c::IPPROTO_MTP as _);
/// `IPPROTO_BEETPH`
@@ -461,53 +515,61 @@ impl Protocol {
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const BEETPH: Self = Self(c::IPPROTO_BEETPH as _);
/// `IPPROTO_ENCAP`
- #[cfg(not(any(windows, target_os = "illumos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const ENCAP: Self = Self(c::IPPROTO_ENCAP as _);
/// `IPPROTO_PIM`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const PIM: Self = Self(c::IPPROTO_PIM as _);
/// `IPPROTO_COMP`
#[cfg(not(any(
windows,
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const COMP: Self = Self(c::IPPROTO_COMP as _);
/// `IPPROTO_SCTP`
- #[cfg(not(any(target_os = "dragonfly", target_os = "illumos", target_os = "openbsd")))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "haiku", target_os = "illumos", target_os = "openbsd", target_os = "solaris")))]
pub const SCTP: Self = Self(c::IPPROTO_SCTP as _);
/// `IPPROTO_UDPLITE`
#[cfg(not(any(
windows,
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const UDPLITE: Self = Self(c::IPPROTO_UDPLITE as _);
/// `IPPROTO_MPLS`
#[cfg(not(any(
windows,
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
+ target_os = "solaris",
)))]
pub const MPLS: Self = Self(c::IPPROTO_MPLS as _);
/// `IPPROTO_RAW`
@@ -520,15 +582,17 @@ impl Protocol {
target_os = "emscripten",
target_os = "freebsd",
target_os = "fuchsia",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const MPTCP: Self = Self(c::IPPROTO_MPTCP as _);
/// `IPPROTO_FRAGMENT`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const FRAGMENT: Self = Self(c::IPPROTO_FRAGMENT as _);
/// `IPPROTO_ICMPV6`
pub const ICMPV6: Self = Self(c::IPPROTO_ICMPV6 as _);
@@ -536,15 +600,17 @@ impl Protocol {
#[cfg(not(any(
windows,
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const MH: Self = Self(c::IPPROTO_MH as _);
/// `IPPROTO_ROUTING`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
pub const ROUTING: Self = Self(c::IPPROTO_ROUTING as _);
/// Constructs a `Protocol` from a raw integer.
@@ -581,11 +647,11 @@ bitflags! {
/// [`acceptfrom_with`]: crate::net::acceptfrom_with
pub struct AcceptFlags: c::c_int {
/// `SOCK_NONBLOCK`
- #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
const NONBLOCK = c::SOCK_NONBLOCK;
/// `SOCK_CLOEXEC`
- #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
const CLOEXEC = c::SOCK_CLOEXEC;
}
}
@@ -596,11 +662,11 @@ bitflags! {
/// [`socket`]: crate::net::socket
pub struct SocketFlags: c::c_int {
/// `SOCK_NONBLOCK`
- #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
const NONBLOCK = c::SOCK_NONBLOCK;
/// `SOCK_CLOEXEC`
- #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
const CLOEXEC = c::SOCK_CLOEXEC;
}
}
diff --git a/vendor/rustix/src/imp/libc/net/write_sockaddr.rs b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
index adbf7255d..f44284a0b 100644
--- a/vendor/rustix/src/imp/libc/net/write_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
@@ -26,6 +26,7 @@ pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -35,7 +36,10 @@ pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
sin_family: c::AF_INET as _,
sin_port: u16::to_be(v4.port()),
sin_addr: in_addr_new(u32::from_ne_bytes(v4.ip().octets())),
+ #[cfg(not(target_os = "haiku"))]
sin_zero: [0; 8_usize],
+ #[cfg(target_os = "haiku")]
+ sin_zero: [0; 24_usize],
}
}
@@ -49,6 +53,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
#[cfg(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -67,6 +72,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
diff --git a/vendor/rustix/src/imp/libc/offset.rs b/vendor/rustix/src/backend/libc/offset.rs
index 3002e8bdd..48729be0c 100644
--- a/vendor/rustix/src/imp/libc/offset.rs
+++ b/vendor/rustix/src/backend/libc/offset.rs
@@ -6,10 +6,11 @@ use super::c;
#[cfg(not(any(
windows,
target_os = "android",
- target_os = "linux",
target_os = "emscripten",
target_os = "l4re",
+ target_os = "linux",
)))]
+#[cfg(feature = "fs")]
pub(super) use c::{
fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, lseek as libc_lseek,
off_t as libc_off_t,
@@ -17,33 +18,42 @@ pub(super) use c::{
#[cfg(any(
target_os = "android",
- target_os = "linux",
target_os = "emscripten",
target_os = "l4re",
+ target_os = "linux",
))]
+#[cfg(feature = "fs")]
pub(super) use c::{
fstat64 as libc_fstat, fstatat64 as libc_fstatat, ftruncate64 as libc_ftruncate,
- lseek64 as libc_lseek, off64_t as libc_off_t, rlimit64 as libc_rlimit,
+ lseek64 as libc_lseek, off64_t as libc_off_t,
};
+#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
+ target_os = "l4re",
+ target_os = "linux",
+))]
+pub(super) use c::rlimit64 as libc_rlimit;
+
#[cfg(not(any(
windows,
target_os = "android",
- target_os = "linux",
target_os = "emscripten",
target_os = "l4re",
+ target_os = "linux",
target_os = "wasi",
)))]
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
+#[cfg(feature = "mm")]
pub(super) use c::mmap as libc_mmap;
#[cfg(not(any(
windows,
target_os = "android",
- target_os = "linux",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "l4re",
+ target_os = "linux",
target_os = "redox",
target_os = "wasi",
)))]
@@ -83,7 +93,7 @@ pub(super) use c::{getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit}
target_os = "emscripten",
target_os = "l4re",
))]
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
+#[cfg(feature = "mm")]
pub(super) use c::mmap64 as libc_mmap;
// `prlimit64` wasn't supported in glibc until 2.13.
@@ -150,6 +160,7 @@ pub(super) unsafe fn libc_prlimit(
target_os = "l4re",
target_os = "redox",
)))]
+#[cfg(feature = "fs")]
pub(super) use c::openat as libc_openat;
#[cfg(any(
target_os = "android",
@@ -157,17 +168,21 @@ pub(super) use c::openat as libc_openat;
target_os = "emscripten",
target_os = "l4re",
))]
+#[cfg(feature = "fs")]
pub(super) use c::openat64 as libc_openat;
#[cfg(target_os = "fuchsia")]
+#[cfg(feature = "fs")]
pub(super) use c::fallocate as libc_fallocate;
#[cfg(any(target_os = "android", target_os = "linux"))]
+#[cfg(feature = "fs")]
pub(super) use c::fallocate64 as libc_fallocate;
#[cfg(not(any(
windows,
target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "linux",
@@ -176,7 +191,9 @@ pub(super) use c::fallocate64 as libc_fallocate;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
+#[cfg(feature = "fs")]
pub(super) use c::posix_fadvise as libc_posix_fadvise;
#[cfg(any(
target_os = "android",
@@ -184,6 +201,7 @@ pub(super) use c::posix_fadvise as libc_posix_fadvise;
target_os = "linux",
target_os = "l4re",
))]
+#[cfg(feature = "fs")]
pub(super) use c::posix_fadvise64 as libc_posix_fadvise;
#[cfg(all(not(any(
@@ -202,7 +220,7 @@ mod readwrite_pv64 {
use super::c;
// 64-bit offsets on 32-bit platforms are passed in endianness-specific
- // lo/hi pairs. See src/imp/linux_raw/conv.rs for details.
+ // lo/hi pairs. See src/backend/linux_raw/conv.rs for details.
#[cfg(all(target_endian = "little", target_pointer_width = "32"))]
fn lo(x: u64) -> usize {
(x >> 32) as usize
@@ -288,10 +306,12 @@ mod readwrite_pv64 {
windows,
target_os = "android",
target_os = "emscripten",
+ target_os = "haiku",
target_os = "ios",
target_os = "linux",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub(super) use c::{preadv as libc_preadv, pwritev as libc_pwritev};
#[cfg(target_os = "android")]
@@ -324,6 +344,7 @@ pub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev};
#[cfg(not(any(
windows,
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "fuchsia",
@@ -335,22 +356,42 @@ pub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev};
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
+#[cfg(feature = "fs")]
pub(super) use c::posix_fallocate as libc_posix_fallocate;
#[cfg(any(target_os = "l4re"))]
+#[cfg(feature = "fs")]
pub(super) use c::posix_fallocate64 as libc_posix_fallocate;
#[cfg(not(any(
windows,
target_os = "android",
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "linux",
target_os = "l4re",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
+#[cfg(feature = "fs")]
pub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs};
+#[cfg(not(any(
+ windows,
+ target_os = "android",
+ target_os = "emscripten",
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "linux",
+ target_os = "l4re",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+#[cfg(feature = "fs")]
+pub(super) use {c::fstatvfs as libc_fstatvfs, c::statvfs as libc_statvfs};
#[cfg(any(
target_os = "android",
@@ -358,4 +399,8 @@ pub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs};
target_os = "emscripten",
target_os = "l4re",
))]
-pub(super) use {c::fstatfs64 as libc_fstatfs, c::statfs64 as libc_statfs};
+#[cfg(feature = "fs")]
+pub(super) use {
+ c::fstatfs64 as libc_fstatfs, c::fstatvfs64 as libc_fstatvfs, c::statfs64 as libc_statfs,
+ c::statvfs64 as libc_statvfs,
+};
diff --git a/vendor/rustix/src/imp/libc/param/auxv.rs b/vendor/rustix/src/backend/libc/param/auxv.rs
index 584329da9..a770c60d8 100644
--- a/vendor/rustix/src/imp/libc/param/auxv.rs
+++ b/vendor/rustix/src/backend/libc/param/auxv.rs
@@ -52,15 +52,3 @@ pub(crate) fn linux_execfn() -> &'static CStr {
cstr!("")
}
}
-
-/// Initialize process-wide state.
-#[cfg(any(
- target_vendor = "mustang",
- not(any(target_env = "gnu", target_env = "musl")),
-))]
-#[inline]
-#[doc(hidden)]
-pub(crate) unsafe fn init(_envp: *mut *mut u8) {
- // Nothing to do. This is the libc backend, and libc does the
- // initialization for us.
-}
diff --git a/vendor/rustix/src/imp/libc/param/mod.rs b/vendor/rustix/src/backend/libc/param/mod.rs
index 2cb2fe78a..2cb2fe78a 100644
--- a/vendor/rustix/src/imp/libc/param/mod.rs
+++ b/vendor/rustix/src/backend/libc/param/mod.rs
diff --git a/vendor/rustix/src/imp/libc/process/cpu_set.rs b/vendor/rustix/src/backend/libc/process/cpu_set.rs
index 14ad8d208..14ad8d208 100644
--- a/vendor/rustix/src/imp/libc/process/cpu_set.rs
+++ b/vendor/rustix/src/backend/libc/process/cpu_set.rs
diff --git a/vendor/rustix/src/imp/libc/process/mod.rs b/vendor/rustix/src/backend/libc/process/mod.rs
index 8675c1af9..8675c1af9 100644
--- a/vendor/rustix/src/imp/libc/process/mod.rs
+++ b/vendor/rustix/src/backend/libc/process/mod.rs
diff --git a/vendor/rustix/src/imp/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs
index 9874f617f..6f4e85916 100644
--- a/vendor/rustix/src/imp/libc/process/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/process/syscalls.rs
@@ -3,6 +3,8 @@
use super::super::c;
#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
use super::super::conv::borrowed_fd;
+#[cfg(not(target_os = "wasi"))]
+use super::super::conv::ret_pid_t;
use super::super::conv::{c_str, ret, ret_c_int, ret_discarded_char_ptr};
#[cfg(any(target_os = "android", target_os = "linux"))]
use super::super::conv::{syscall_ret, syscall_ret_u32};
@@ -145,6 +147,27 @@ pub(crate) fn getppid() -> Option<Pid> {
}
}
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+pub(crate) fn getpgid(pid: Option<Pid>) -> io::Result<Pid> {
+ unsafe {
+ let pgid = ret_pid_t(c::getpgid(Pid::as_raw(pid) as _))?;
+ debug_assert_ne!(pgid, 0);
+ Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pgid)))
+ }
+}
+
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+#[must_use]
+pub(crate) fn getpgrp() -> Pid {
+ unsafe {
+ let pgid = c::getpgrp();
+ debug_assert_ne!(pgid, 0);
+ Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pgid))
+ }
+}
+
#[cfg(any(
target_os = "android",
target_os = "dragonfly",
@@ -302,8 +325,8 @@ pub(crate) fn prlimit(pid: Option<Pid>, limit: Resource, new: Rlimit) -> io::Res
limit as _,
&lim,
result.as_mut_ptr(),
- ))
- .map(|()| rlimit_from_libc(result.assume_init()))
+ ))?;
+ Ok(rlimit_from_libc(result.assume_init()))
}
}
@@ -417,3 +440,26 @@ pub(crate) fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> {
unsafe { ret(c::kill(0, sig as i32)) }
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) unsafe fn prctl(
+ option: c::c_int,
+ arg2: *mut c::c_void,
+ arg3: *mut c::c_void,
+ arg4: *mut c::c_void,
+ arg5: *mut c::c_void,
+) -> io::Result<c::c_int> {
+ ret_c_int(c::prctl(option, arg2, arg3, arg4, arg5))
+}
+
+#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+#[inline]
+pub(crate) unsafe fn procctl(
+ idtype: c::idtype_t,
+ id: c::id_t,
+ option: c::c_int,
+ data: *mut c::c_void,
+) -> io::Result<()> {
+ ret(c::procctl(idtype, id, option, data))
+}
diff --git a/vendor/rustix/src/imp/libc/process/types.rs b/vendor/rustix/src/backend/libc/process/types.rs
index 60d629d81..f8e3b8bf4 100644
--- a/vendor/rustix/src/imp/libc/process/types.rs
+++ b/vendor/rustix/src/backend/libc/process/types.rs
@@ -54,87 +54,117 @@ pub enum Resource {
/// `RLIMIT_STACK`
Stack = c::RLIMIT_STACK as c::c_int,
/// `RLIMIT_CORE`
+ #[cfg(not(target_os = "haiku"))]
Core = c::RLIMIT_CORE as c::c_int,
/// `RLIMIT_RSS`
- #[cfg(not(any(target_os = "illumos", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "solaris",
+ )))]
Rss = c::RLIMIT_RSS as c::c_int,
/// `RLIMIT_NPROC`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
Nproc = c::RLIMIT_NPROC as c::c_int,
/// `RLIMIT_NOFILE`
Nofile = c::RLIMIT_NOFILE as c::c_int,
/// `RLIMIT_MEMLOCK`
- #[cfg(not(target_os = "illumos"))]
+ #[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "solaris"
+ )))]
Memlock = c::RLIMIT_MEMLOCK as c::c_int,
/// `RLIMIT_AS`
#[cfg(not(target_os = "openbsd"))]
As = c::RLIMIT_AS as c::c_int,
/// `RLIMIT_LOCKS`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
Locks = c::RLIMIT_LOCKS as c::c_int,
/// `RLIMIT_SIGPENDING`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
Sigpending = c::RLIMIT_SIGPENDING as c::c_int,
/// `RLIMIT_MSGQUEUE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
Msgqueue = c::RLIMIT_MSGQUEUE as c::c_int,
/// `RLIMIT_NICE`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
Nice = c::RLIMIT_NICE as c::c_int,
/// `RLIMIT_RTPRIO`
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
Rtprio = c::RLIMIT_RTPRIO as c::c_int,
/// `RLIMIT_RTTIME`
#[cfg(not(any(
+ target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
Rttime = c::RLIMIT_RTTIME as c::c_int,
}
@@ -191,15 +221,24 @@ pub enum Signal {
Term = c::SIGTERM,
/// `SIGSTKFLT`
#[cfg(not(any(
+ target_os = "aix",
+ target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
- any(target_arch = "mips", target_arch = "mips64"),
+ any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "sparc",
+ target_arch = "sparc64"
+ ),
)
)))]
Stkflt = c::SIGSTKFLT,
@@ -231,10 +270,13 @@ pub enum Signal {
Winch = c::SIGWINCH,
/// `SIGIO`, aka `SIGPOLL`
#[doc(alias = "Poll")]
+ #[cfg(not(target_os = "haiku"))]
Io = c::SIGIO,
/// `SIGPWR`
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -268,15 +310,24 @@ impl Signal {
c::SIGALRM => Some(Self::Alarm),
c::SIGTERM => Some(Self::Term),
#[cfg(not(any(
+ target_os = "aix",
+ target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
- any(target_arch = "mips", target_arch = "mips64"),
+ any(
+ target_arch = "mips",
+ target_arch = "mips64",
+ target_arch = "sparc",
+ target_arch = "sparc64"
+ ),
)
)))]
c::SIGSTKFLT => Some(Self::Stkflt),
@@ -292,9 +343,12 @@ impl Signal {
c::SIGVTALRM => Some(Self::Vtalarm),
c::SIGPROF => Some(Self::Prof),
c::SIGWINCH => Some(Self::Winch),
+ #[cfg(not(target_os = "haiku"))]
c::SIGIO => Some(Self::Io),
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -327,6 +381,8 @@ pub type RawUid = c::uid_t;
/// A CPU identifier as a raw integer.
#[cfg(any(target_os = "android", target_os = "linux"))]
pub type RawCpuid = u32;
+#[cfg(target_os = "freebsd")]
+pub type RawId = c::id_t;
#[cfg(not(target_os = "wasi"))]
pub(crate) type RawUname = c::utsname;
@@ -352,10 +408,7 @@ pub(crate) fn raw_cpu_set_new() -> RawCpuSet {
set
}
-#[cfg(any(
- target_os = "android",
- target_os = "dragonfly",
- target_os = "fuchsia",
- target_os = "linux",
-))]
+#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
pub(crate) const CPU_SETSIZE: usize = c::CPU_SETSIZE as usize;
+#[cfg(target_os = "dragonfly")]
+pub(crate) const CPU_SETSIZE: usize = 256;
diff --git a/vendor/rustix/src/imp/libc/process/wait.rs b/vendor/rustix/src/backend/libc/process/wait.rs
index 6de79955d..6de79955d 100644
--- a/vendor/rustix/src/imp/libc/process/wait.rs
+++ b/vendor/rustix/src/backend/libc/process/wait.rs
diff --git a/vendor/rustix/src/imp/libc/rand/mod.rs b/vendor/rustix/src/backend/libc/rand/mod.rs
index 1e0181a99..1e0181a99 100644
--- a/vendor/rustix/src/imp/libc/rand/mod.rs
+++ b/vendor/rustix/src/backend/libc/rand/mod.rs
diff --git a/vendor/rustix/src/imp/libc/rand/syscalls.rs b/vendor/rustix/src/backend/libc/rand/syscalls.rs
index 1c4286235..1c4286235 100644
--- a/vendor/rustix/src/imp/libc/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/rand/syscalls.rs
diff --git a/vendor/rustix/src/imp/libc/rand/types.rs b/vendor/rustix/src/backend/libc/rand/types.rs
index 2ba3f1119..2ba3f1119 100644
--- a/vendor/rustix/src/imp/libc/rand/types.rs
+++ b/vendor/rustix/src/backend/libc/rand/types.rs
diff --git a/vendor/rustix/src/imp/libc/termios/mod.rs b/vendor/rustix/src/backend/libc/termios/mod.rs
index 1e0181a99..1e0181a99 100644
--- a/vendor/rustix/src/imp/libc/termios/mod.rs
+++ b/vendor/rustix/src/backend/libc/termios/mod.rs
diff --git a/vendor/rustix/src/imp/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index 91b01b4a1..e0ab7a016 100644
--- a/vendor/rustix/src/imp/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -2,9 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp::syscalls` module documentation for details.
-
-#![allow(unsafe_code)]
+//! See the `rustix::backend::syscalls` module documentation for details.
use super::super::c;
use super::super::conv::{borrowed_fd, ret, ret_pid_t};
@@ -21,7 +19,8 @@ use libc_errno::errno;
pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
let mut result = MaybeUninit::<Termios>::uninit();
unsafe {
- ret(c::tcgetattr(borrowed_fd(fd), result.as_mut_ptr())).map(|()| result.assume_init())
+ ret(c::tcgetattr(borrowed_fd(fd), result.as_mut_ptr()))?;
+ Ok(result.assume_init())
}
}
diff --git a/vendor/rustix/src/imp/libc/termios/types.rs b/vendor/rustix/src/backend/libc/termios/types.rs
index 7e6728755..6dda70064 100644
--- a/vendor/rustix/src/imp/libc/termios/types.rs
+++ b/vendor/rustix/src/backend/libc/termios/types.rs
@@ -95,11 +95,13 @@ pub const VMIN: usize = c::VMIN as usize;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const VSWTC: usize = c::VSWTC as usize;
@@ -116,15 +118,19 @@ pub const VSUSP: usize = c::VSUSP as usize;
pub const VEOL: usize = c::VEOL as usize;
/// `VREPRINT`
+#[cfg(not(target_os = "haiku"))]
pub const VREPRINT: usize = c::VREPRINT as usize;
/// `VDISCARD`
+#[cfg(not(target_os = "haiku"))]
pub const VDISCARD: usize = c::VDISCARD as usize;
/// `VWERASE`
+#[cfg(not(target_os = "haiku"))]
pub const VWERASE: usize = c::VWERASE as usize;
/// `VLNEXT`
+#[cfg(not(target_os = "haiku"))]
pub const VLNEXT: usize = c::VLNEXT as usize;
/// `VEOL2`
@@ -183,7 +189,12 @@ pub const IXANY: c::c_uint = c::IXANY;
pub const IXOFF: c::c_uint = c::IXOFF;
/// `IMAXBEL`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox"
+)))]
pub const IMAXBEL: c::c_uint = c::IMAXBEL;
/// `IUTF8`
@@ -191,12 +202,14 @@ pub const IMAXBEL: c::c_uint = c::IMAXBEL;
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const IUTF8: c::c_uint = c::IUTF8;
@@ -263,6 +276,7 @@ pub const OFDEL: c::c_uint = c::OFDEL;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const NLDLY: c::c_uint = c::NLDLY;
@@ -277,6 +291,7 @@ pub const NLDLY: c::c_uint = c::NLDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const NL0: c::c_uint = c::NL0;
@@ -291,6 +306,7 @@ pub const NL0: c::c_uint = c::NL0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const NL1: c::c_uint = c::NL1;
@@ -304,6 +320,7 @@ pub const NL1: c::c_uint = c::NL1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CRDLY: c::c_uint = c::CRDLY;
@@ -318,6 +335,7 @@ pub const CRDLY: c::c_uint = c::CRDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CR0: c::c_uint = c::CR0;
@@ -334,6 +352,7 @@ pub const CR0: c::c_uint = c::CR0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CR1: c::c_uint = c::CR1;
@@ -350,6 +369,7 @@ pub const CR1: c::c_uint = c::CR1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CR2: c::c_uint = c::CR2;
@@ -366,22 +386,26 @@ pub const CR2: c::c_uint = c::CR2;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CR3: c::c_uint = c::CR3;
/// `TABDLY`
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const TABDLY: c::c_uint = c::TABDLY;
/// `TAB0`
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
@@ -389,6 +413,7 @@ pub const TABDLY: c::c_uint = c::TABDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const TAB0: c::c_uint = c::TAB0;
@@ -405,6 +430,7 @@ pub const TAB0: c::c_uint = c::TAB0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const TAB1: c::c_uint = c::TAB1;
@@ -421,12 +447,14 @@ pub const TAB1: c::c_uint = c::TAB1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const TAB2: c::c_uint = c::TAB2;
/// `TAB3`
#[cfg(not(any(
target_env = "musl",
+ target_os = "dragonfly",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "illumos",
@@ -435,6 +463,7 @@ pub const TAB2: c::c_uint = c::TAB2;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const TAB3: c::c_uint = c::TAB3;
@@ -448,6 +477,7 @@ pub const TAB3: c::c_uint = c::TAB3;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const BSDLY: c::c_uint = c::BSDLY;
@@ -462,6 +492,7 @@ pub const BSDLY: c::c_uint = c::BSDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const BS0: c::c_uint = c::BS0;
@@ -478,6 +509,7 @@ pub const BS0: c::c_uint = c::BS0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const BS1: c::c_uint = c::BS1;
@@ -492,6 +524,7 @@ pub const BS1: c::c_uint = c::BS1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const FFDLY: c::c_uint = c::FFDLY;
@@ -506,6 +539,7 @@ pub const FFDLY: c::c_uint = c::FFDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const FF0: c::c_uint = c::FF0;
@@ -522,6 +556,7 @@ pub const FF0: c::c_uint = c::FF0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const FF1: c::c_uint = c::FF1;
@@ -536,6 +571,7 @@ pub const FF1: c::c_uint = c::FF1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const VTDLY: c::c_uint = c::VTDLY;
@@ -550,6 +586,7 @@ pub const VTDLY: c::c_uint = c::VTDLY;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const VT0: c::c_uint = c::VT0;
@@ -566,6 +603,7 @@ pub const VT0: c::c_uint = c::VT0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const VT1: c::c_uint = c::VT1;
@@ -627,18 +665,26 @@ pub const B115200: Speed = c::B115200;
pub const B230400: Speed = c::B230400;
/// `B460800`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+)))]
pub const B460800: Speed = c::B460800;
/// `B500000`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B500000: Speed = c::B500000;
@@ -646,26 +692,36 @@ pub const B500000: Speed = c::B500000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B576000: Speed = c::B576000;
/// `B921600`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+)))]
pub const B921600: Speed = c::B921600;
/// `B1000000`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B1000000: Speed = c::B1000000;
@@ -673,10 +729,12 @@ pub const B1000000: Speed = c::B1000000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B1152000: Speed = c::B1152000;
@@ -684,10 +742,12 @@ pub const B1152000: Speed = c::B1152000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B1500000: Speed = c::B1500000;
@@ -695,54 +755,72 @@ pub const B1500000: Speed = c::B1500000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B2000000: Speed = c::B2000000;
/// `B2500000`
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B2500000: Speed = c::B2500000;
/// `B3000000`
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B3000000: Speed = c::B3000000;
/// `B3500000`
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B3500000: Speed = c::B3500000;
/// `B4000000`
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub const B4000000: Speed = c::B4000000;
@@ -829,20 +907,24 @@ pub const IEXTEN: c::c_uint = c::IEXTEN;
/// `EXTA`
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const EXTA: c::c_uint = c::EXTA;
/// `EXTB`
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const EXTB: c::c_uint = c::EXTB;
@@ -850,6 +932,7 @@ pub const EXTB: c::c_uint = c::EXTB;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -862,12 +945,14 @@ pub const CBAUD: c::c_uint = c::CBAUD;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CBAUDEX: c::c_uint = c::CBAUDEX;
@@ -876,6 +961,7 @@ pub const CBAUDEX: c::c_uint = c::CBAUDEX;
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -896,12 +982,14 @@ pub const CIBAUD: c::tcflag_t = 0o77600000;
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const CMSPAR: c::c_uint = c::CMSPAR;
@@ -934,18 +1022,25 @@ pub const FLUSHO: c::c_uint = c::FLUSHO;
pub const PENDIN: c::c_uint = c::PENDIN;
/// `EXTPROC`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox"
+)))]
pub const EXTPROC: c::c_uint = c::EXTPROC;
/// `XTABS`
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub const XTABS: c::c_uint = c::XTABS;
diff --git a/vendor/rustix/src/imp/libc/thread/mod.rs b/vendor/rustix/src/backend/libc/thread/mod.rs
index 40e0d1135..40e0d1135 100644
--- a/vendor/rustix/src/imp/libc/thread/mod.rs
+++ b/vendor/rustix/src/backend/libc/thread/mod.rs
diff --git a/vendor/rustix/src/imp/libc/thread/syscalls.rs b/vendor/rustix/src/backend/libc/thread/syscalls.rs
index c885372dc..0709fbb19 100644
--- a/vendor/rustix/src/imp/libc/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/thread/syscalls.rs
@@ -2,7 +2,11 @@
use super::super::c;
use super::super::conv::ret;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use super::super::conv::{borrowed_fd, ret_c_int};
use super::super::time::types::LibcTimespec;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use crate::fd::BorrowedFd;
use crate::io;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::process::{Pid, RawNonZeroPid};
@@ -11,8 +15,9 @@ use crate::thread::{NanosleepRelativeResult, Timespec};
use core::mem::MaybeUninit;
#[cfg(not(any(
target_os = "dragonfly",
- target_os = "freebsd",
target_os = "emscripten",
+ target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
@@ -36,6 +41,7 @@ weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int);
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
@@ -127,8 +133,9 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos
#[cfg(not(any(
target_os = "dragonfly",
- target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "emscripten",
+ target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
@@ -280,3 +287,9 @@ pub(crate) fn gettid() -> Pid {
Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(tid))
}
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
+ unsafe { ret_c_int(c::setns(borrowed_fd(fd), nstype)) }
+}
diff --git a/vendor/rustix/src/imp/libc/time/mod.rs b/vendor/rustix/src/backend/libc/time/mod.rs
index bff7fd564..bff7fd564 100644
--- a/vendor/rustix/src/imp/libc/time/mod.rs
+++ b/vendor/rustix/src/backend/libc/time/mod.rs
diff --git a/vendor/rustix/src/imp/libc/time/syscalls.rs b/vendor/rustix/src/backend/libc/time/syscalls.rs
index 2bbaf8ff1..c9e075e53 100644
--- a/vendor/rustix/src/imp/libc/time/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/time/syscalls.rs
@@ -15,8 +15,7 @@ use core::mem::MaybeUninit;
#[cfg(feature = "time")]
use {
super::super::conv::{borrowed_fd, ret_owned_fd},
- crate::fd::BorrowedFd,
- crate::io::OwnedFd,
+ crate::fd::{BorrowedFd, OwnedFd},
crate::time::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags},
};
@@ -259,8 +258,8 @@ pub(crate) fn timerfd_settime(
flags.bits(),
&new_value.clone().into(),
result.as_mut_ptr(),
- ))
- .map(|()| result.assume_init().into())
+ ))?;
+ Ok(result.assume_init().into())
} else {
timerfd_settime_old(fd, flags, new_value)
}
@@ -276,8 +275,8 @@ pub(crate) fn timerfd_settime(
flags.bits(),
new_value,
result.as_mut_ptr(),
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
}
@@ -363,8 +362,8 @@ pub(crate) fn timerfd_gettime(fd: BorrowedFd<'_>) -> io::Result<Itimerspec> {
))]
unsafe {
if let Some(libc_timerfd_gettime) = __timerfd_gettime64.get() {
- ret(libc_timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))
- .map(|()| result.assume_init().into())
+ ret(libc_timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?;
+ Ok(result.assume_init().into())
} else {
timerfd_gettime_old(fd)
}
@@ -375,7 +374,8 @@ pub(crate) fn timerfd_gettime(fd: BorrowedFd<'_>) -> io::Result<Itimerspec> {
target_env = "gnu",
)))]
unsafe {
- ret(c::timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr())).map(|()| result.assume_init())
+ ret(c::timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?;
+ Ok(result.assume_init())
}
}
diff --git a/vendor/rustix/src/imp/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs
index 4aa2b22e5..080f64431 100644
--- a/vendor/rustix/src/imp/libc/time/types.rs
+++ b/vendor/rustix/src/backend/libc/time/types.rs
@@ -132,6 +132,7 @@ pub enum ClockId {
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
ProcessCPUTime = c::CLOCK_PROCESS_CPUTIME_ID,
@@ -141,6 +142,7 @@ pub enum ClockId {
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
ThreadCPUTime = c::CLOCK_THREAD_CPUTIME_ID,
diff --git a/vendor/rustix/src/imp/libc/weak.rs b/vendor/rustix/src/backend/libc/weak.rs
index 893403b1c..d578038cd 100644
--- a/vendor/rustix/src/imp/libc/weak.rs
+++ b/vendor/rustix/src/backend/libc/weak.rs
@@ -38,8 +38,8 @@ const INVALID: *mut c_void = 1 as *mut c_void;
macro_rules! weak {
($vis:vis fn $name:ident($($t:ty),*) -> $ret:ty) => (
#[allow(non_upper_case_globals)]
- $vis static $name: $crate::imp::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
- $crate::imp::weak::Weak::new(concat!(stringify!($name), '\0'));
+ $vis static $name: $crate::backend::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
+ $crate::backend::weak::Weak::new(concat!(stringify!($name), '\0'));
)
}
diff --git a/vendor/rustix/src/imp/libc/winsock_c.rs b/vendor/rustix/src/backend/libc/winsock_c.rs
index 1fbce416f..7d78aef65 100644
--- a/vendor/rustix/src/imp/libc/winsock_c.rs
+++ b/vendor/rustix/src/backend/libc/winsock_c.rs
@@ -59,7 +59,7 @@ pub(crate) const SHUT_WR: i32 = WinSock::SD_SEND as _;
pub(crate) use WinSock::{
closesocket as close, ioctlsocket as ioctl, WSAPoll as poll, ADDRESS_FAMILY as sa_family_t,
ADDRINFOA as addrinfo, IN6_ADDR as in6_addr, IN_ADDR as in_addr, IPV6_MREQ as ipv6_mreq,
- IP_MREQ as ip_mreq, SOCKADDR as sockaddr, SOCKADDR_IN as sockaddr_in,
+ IP_MREQ as ip_mreq, LINGER as linger, SOCKADDR as sockaddr, SOCKADDR_IN as sockaddr_in,
SOCKADDR_IN6 as sockaddr_in6, SOCKADDR_STORAGE as sockaddr_storage, WSAEACCES as EACCES,
WSAEADDRINUSE as EADDRINUSE, WSAEADDRNOTAVAIL as EADDRNOTAVAIL,
WSAEAFNOSUPPORT as EAFNOSUPPORT, WSAEALREADY as EALREADY, WSAEBADF as EBADF,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/aarch64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs
index 7d33a4a52..0f4465d51 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/aarch64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs
@@ -1,13 +1,15 @@
//! aarch64 Linux system calls.
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
use core::arch::asm;
#[cfg(target_pointer_width = "32")]
compile_error!("arm64-ilp32 is not supported yet");
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
let r0;
asm!(
"svc 0",
@@ -19,7 +21,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let r0;
asm!(
"svc 0",
@@ -31,7 +33,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -46,7 +48,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"svc 0",
in("x8") nr.to_asm(),
@@ -56,7 +58,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -73,7 +75,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -90,7 +92,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -109,7 +111,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -128,7 +130,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -149,7 +151,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -170,7 +172,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -193,7 +195,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -216,7 +218,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -241,7 +243,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/arm.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs
index 9acccd6dc..9695c6028 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/arm.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs
@@ -1,10 +1,12 @@
//! arm Linux system calls.
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
use core::arch::asm;
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
let r0;
asm!(
"svc 0",
@@ -16,7 +18,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let r0;
asm!(
"svc 0",
@@ -28,7 +30,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -43,7 +45,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"svc 0",
in("r7") nr.to_asm(),
@@ -53,7 +55,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -70,7 +72,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -87,7 +89,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -106,7 +108,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -125,7 +127,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -146,7 +148,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -167,7 +169,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -190,7 +192,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -213,7 +215,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -238,7 +240,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/mips.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs
index 0f2b9d9d2..b39a16847 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/mips.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs
@@ -6,13 +6,13 @@
//! Mips-family platforms have a special calling convention for `__NR_pipe`,
//! however we use `__NR_pipe2` instead to avoid having to implement it.
-use crate::imp::reg::{
+use crate::backend::reg::{
ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, A6, R0,
};
use core::arch::asm;
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
let x0;
let err: usize;
asm!(
@@ -39,7 +39,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0>
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let x0;
let err: usize;
asm!(
@@ -67,7 +67,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -98,7 +98,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"syscall",
in("$2" /*$v0*/) nr.to_asm(),
@@ -108,7 +108,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -141,7 +141,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -174,7 +174,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -209,7 +209,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -244,7 +244,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -280,7 +280,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -316,7 +316,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -359,7 +359,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -402,7 +402,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -448,7 +448,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -494,7 +494,7 @@ pub(in crate::imp) unsafe fn syscall6_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall7_readonly(
+pub(in crate::backend) unsafe fn syscall7_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/mips64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs
index 36dd79316..d3c7d341f 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/mips64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs
@@ -6,11 +6,13 @@
//! Mips-family platforms have a special calling convention for `__NR_pipe`,
//! however we use `__NR_pipe2` instead to avoid having to implement it.
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
use core::arch::asm;
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
let x0;
let err: usize;
asm!(
@@ -37,7 +39,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0>
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let x0;
let err: usize;
asm!(
@@ -65,7 +67,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -96,7 +98,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"syscall",
in("$2" /*$v0*/) nr.to_asm(),
@@ -106,7 +108,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -139,7 +141,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -172,7 +174,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -207,7 +209,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -242,7 +244,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -278,7 +280,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -314,7 +316,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -351,7 +353,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -388,7 +390,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -426,7 +428,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs
index 3e25e2149..524c449d9 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs
@@ -5,7 +5,8 @@
//! conventions are otherwise the compiler's job. But for now, use inline asm.
#[cfg_attr(target_arch = "aarch64", path = "aarch64.rs")]
-#[cfg_attr(target_arch = "arm", path = "arm.rs")]
+#[cfg_attr(all(target_arch = "arm", not(thumb_mode)), path = "arm.rs")]
+#[cfg_attr(all(target_arch = "arm", thumb_mode), path = "thumb.rs")]
#[cfg_attr(target_arch = "mips", path = "mips.rs")]
#[cfg_attr(target_arch = "mips64", path = "mips64.rs")]
#[cfg_attr(target_arch = "powerpc64", path = "powerpc64.rs")]
@@ -14,4 +15,4 @@
#[cfg_attr(target_arch = "x86_64", path = "x86_64.rs")]
mod target_arch;
-pub(in crate::imp) use self::target_arch::*;
+pub(in crate::backend) use self::target_arch::*;
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/powerpc64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs
index 520bd4d79..8cca7dca7 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/powerpc64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs
@@ -9,11 +9,13 @@
//! check the flag and negate the error value to make PowerPC64 look like other
//! architectures.
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
use core::arch::asm;
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
let r0;
asm!(
"sc",
@@ -38,7 +40,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0>
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let r0;
asm!(
"sc",
@@ -63,7 +65,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -91,7 +93,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"sc",
in("r0") nr.to_asm(),
@@ -101,7 +103,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -130,7 +132,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -159,7 +161,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -189,7 +191,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -219,7 +221,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -250,7 +252,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -281,7 +283,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -313,7 +315,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -345,7 +347,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -378,7 +380,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/riscv64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs
index 3ed36a16c..b1e306266 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/riscv64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs
@@ -1,10 +1,12 @@
//! riscv64 Linux system calls.
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
use core::arch::asm;
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
let r0;
asm!(
"ecall",
@@ -16,7 +18,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let r0;
asm!(
"ecall",
@@ -28,7 +30,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -43,7 +45,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"ecall",
in("a7") nr.to_asm(),
@@ -53,7 +55,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -70,7 +72,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -87,7 +89,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -106,7 +108,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -125,7 +127,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -146,7 +148,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -167,7 +169,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -190,7 +192,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -213,7 +215,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -238,7 +240,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs
new file mode 100644
index 000000000..398a73dfe
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs
@@ -0,0 +1,322 @@
+//! arm Linux system calls, using thumb-mode.
+//!
+//! In thumb-mode, r7 is the frame pointer and is not permitted to be used in
+//! an inline asm operand, so we have to use a different register and copy it
+//! into r7 inside the inline asm.
+
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
+use core::arch::asm;
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ lateout("r0") r0,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+ asm!(
+ "mov r7, {nr}",
+ "svc 0",
+ nr = in(reg) nr.to_asm(),
+ in("r0") a0.to_asm(),
+ options(noreturn)
+ )
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall2(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall2_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall3(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall3_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall4(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ in("r3") a3.to_asm(),
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall4_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ in("r3") a3.to_asm(),
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall5(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ in("r3") a3.to_asm(),
+ in("r4") a4.to_asm(),
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall5_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ in("r3") a3.to_asm(),
+ in("r4") a4.to_asm(),
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall6(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ in("r3") a3.to_asm(),
+ in("r4") a4.to_asm(),
+ in("r5") a5.to_asm(),
+ options(nostack, preserves_flags)
+ );
+ FromAsm::from_asm(r0)
+}
+
+#[inline]
+pub(in crate::backend) unsafe fn syscall6_readonly(
+ nr: SyscallNumber<'_>,
+ a0: ArgReg<'_, A0>,
+ a1: ArgReg<'_, A1>,
+ a2: ArgReg<'_, A2>,
+ a3: ArgReg<'_, A3>,
+ a4: ArgReg<'_, A4>,
+ a5: ArgReg<'_, A5>,
+) -> RetReg<R0> {
+ let r0;
+ asm!(
+ "mov {tmp}, r7",
+ "mov r7, {nr}",
+ "svc 0",
+ "mov r7, {tmp}",
+ nr = in(reg) nr.to_asm(),
+ tmp = out(reg) _,
+ inlateout("r0") a0.to_asm() => r0,
+ in("r1") a1.to_asm(),
+ in("r2") a2.to_asm(),
+ in("r3") a3.to_asm(),
+ in("r4") a4.to_asm(),
+ in("r5") a5.to_asm(),
+ options(nostack, preserves_flags, readonly)
+ );
+ FromAsm::from_asm(r0)
+}
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs
index 8d1b4ed0a..8e115148d 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/x86.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs
@@ -9,12 +9,14 @@
#![allow(dead_code)]
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
-use crate::imp::vdso_wrappers::SyscallType;
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
+use crate::backend::vdso_wrappers::SyscallType;
use core::arch::asm;
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall0(
+pub(in crate::backend) unsafe fn indirect_syscall0(
callee: SyscallType,
nr: SyscallNumber<'_>,
) -> RetReg<R0> {
@@ -29,7 +31,7 @@ pub(in crate::imp) unsafe fn indirect_syscall0(
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall1(
+pub(in crate::backend) unsafe fn indirect_syscall1(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -46,7 +48,7 @@ pub(in crate::imp) unsafe fn indirect_syscall1(
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall1_noreturn(
+pub(in crate::backend) unsafe fn indirect_syscall1_noreturn(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -61,7 +63,7 @@ pub(in crate::imp) unsafe fn indirect_syscall1_noreturn(
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall2(
+pub(in crate::backend) unsafe fn indirect_syscall2(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -80,7 +82,7 @@ pub(in crate::imp) unsafe fn indirect_syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall3(
+pub(in crate::backend) unsafe fn indirect_syscall3(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -101,7 +103,7 @@ pub(in crate::imp) unsafe fn indirect_syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall4(
+pub(in crate::backend) unsafe fn indirect_syscall4(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -132,7 +134,7 @@ pub(in crate::imp) unsafe fn indirect_syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall5(
+pub(in crate::backend) unsafe fn indirect_syscall5(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -166,7 +168,7 @@ pub(in crate::imp) unsafe fn indirect_syscall5(
#[allow(clippy::too_many_arguments)]
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall6(
+pub(in crate::backend) unsafe fn indirect_syscall6(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -207,7 +209,7 @@ pub(in crate::imp) unsafe fn indirect_syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
let r0;
asm!(
"int $$0x80",
@@ -218,7 +220,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let r0;
asm!(
"int $$0x80",
@@ -230,7 +232,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -245,7 +247,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"int $$0x80",
in("eax") nr.to_asm(),
@@ -255,7 +257,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -272,7 +274,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -289,7 +291,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -308,7 +310,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -327,7 +329,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -352,7 +354,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -375,7 +377,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -404,7 +406,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -430,7 +432,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -461,7 +463,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/inline/x86_64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs
index 75d6124f7..084f5fee4 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/inline/x86_64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs
@@ -1,13 +1,15 @@
//! x86-64 Linux system calls.
-use crate::imp::reg::{ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::{
+ ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0,
+};
use core::arch::asm;
#[cfg(target_pointer_width = "32")]
compile_error!("x32 is not yet supported");
#[inline]
-pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
let r0;
asm!(
"syscall",
@@ -20,7 +22,7 @@ pub(in crate::imp) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
let r0;
asm!(
"syscall",
@@ -34,7 +36,7 @@ pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_readonly(
+pub(in crate::backend) unsafe fn syscall1_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
) -> RetReg<R0> {
@@ -51,7 +53,7 @@ pub(in crate::imp) unsafe fn syscall1_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
asm!(
"syscall",
in("rax") nr.to_asm(),
@@ -61,7 +63,7 @@ pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -80,7 +82,7 @@ pub(in crate::imp) unsafe fn syscall2(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2_readonly(
+pub(in crate::backend) unsafe fn syscall2_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -99,7 +101,7 @@ pub(in crate::imp) unsafe fn syscall2_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -120,7 +122,7 @@ pub(in crate::imp) unsafe fn syscall3(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3_readonly(
+pub(in crate::backend) unsafe fn syscall3_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -141,7 +143,7 @@ pub(in crate::imp) unsafe fn syscall3_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -164,7 +166,7 @@ pub(in crate::imp) unsafe fn syscall4(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4_readonly(
+pub(in crate::backend) unsafe fn syscall4_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -187,7 +189,7 @@ pub(in crate::imp) unsafe fn syscall4_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -212,7 +214,7 @@ pub(in crate::imp) unsafe fn syscall5(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5_readonly(
+pub(in crate::backend) unsafe fn syscall5_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -237,7 +239,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -264,7 +266,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6_readonly(
+pub(in crate::backend) unsafe fn syscall6_readonly(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/mod.rs
index 81f3a255e..e13f675fd 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mod.rs
@@ -15,13 +15,15 @@
#![allow(unsafe_code)]
#![cfg_attr(not(feature = "all-apis"), allow(unused_imports))]
+// We'll use as many arguments as syscalls need.
+#![allow(clippy::too_many_arguments)]
// When inline asm is available, use it. Otherwise, use out-of-line asm. These
// functions always use the machine's syscall instruction, even when it isn't
// the fastest option available.
#[cfg_attr(asm, path = "inline/mod.rs")]
#[cfg_attr(not(asm), path = "outline/mod.rs")]
-pub(in crate::imp) mod asm;
+pub(in crate::backend) mod asm;
// On most architectures, the architecture syscall instruction is fast, so use
// it directly.
@@ -34,17 +36,17 @@ pub(in crate::imp) mod asm;
target_arch = "riscv64",
target_arch = "x86_64",
))]
-pub(in crate::imp) use self::asm as choose;
+pub(in crate::backend) use self::asm as choose;
// On 32-bit x86, use vDSO wrappers for all syscalls. We could use the
// architecture syscall instruction (`int 0x80`), but the vDSO kernel_vsyscall
// mechanism is much faster.
#[cfg(target_arch = "x86")]
-pub(in crate::imp) use super::vdso_wrappers::x86_via_vdso as choose;
+pub(in crate::backend) use super::vdso_wrappers::x86_via_vdso as choose;
// This would be the code for always using `int 0x80` on 32-bit x86.
//#[cfg(target_arch = "x86")]
-//pub(in crate::imp) use self::asm as choose;
+//pub(in crate::backend) use self::asm as choose;
// Macros for invoking system calls.
//
@@ -55,27 +57,29 @@ pub(in crate::imp) use super::vdso_wrappers::x86_via_vdso as choose;
// - Counting the number of arguments.
macro_rules! syscall {
($nr:ident) => {
- $crate::imp::arch::choose::syscall0($crate::imp::reg::nr(linux_raw_sys::general::$nr))
+ $crate::backend::arch::choose::syscall0($crate::backend::reg::nr(
+ linux_raw_sys::general::$nr,
+ ))
};
($nr:ident, $a0:expr) => {
- $crate::imp::arch::choose::syscall1(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall1(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
)
};
($nr:ident, $a0:expr, $a1:expr) => {
- $crate::imp::arch::choose::syscall2(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall2(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
)
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr) => {
- $crate::imp::arch::choose::syscall3(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall3(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -83,8 +87,8 @@ macro_rules! syscall {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr) => {
- $crate::imp::arch::choose::syscall4(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall4(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -93,8 +97,8 @@ macro_rules! syscall {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => {
- $crate::imp::arch::choose::syscall5(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall5(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -104,8 +108,8 @@ macro_rules! syscall {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr) => {
- $crate::imp::arch::choose::syscall6(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall6(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -116,8 +120,8 @@ macro_rules! syscall {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr) => {
- $crate::imp::arch::choose::syscall7(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall7(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -131,29 +135,29 @@ macro_rules! syscall {
macro_rules! syscall_readonly {
($nr:ident) => {
- $crate::imp::arch::choose::syscall0_readonly($crate::imp::reg::nr(
+ $crate::backend::arch::choose::syscall0_readonly($crate::backend::reg::nr(
linux_raw_sys::general::$nr,
))
};
($nr:ident, $a0:expr) => {
- $crate::imp::arch::choose::syscall1_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall1_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
)
};
($nr:ident, $a0:expr, $a1:expr) => {
- $crate::imp::arch::choose::syscall2_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall2_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
)
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr) => {
- $crate::imp::arch::choose::syscall3_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall3_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -161,8 +165,8 @@ macro_rules! syscall_readonly {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr) => {
- $crate::imp::arch::choose::syscall4_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall4_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -171,8 +175,8 @@ macro_rules! syscall_readonly {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr) => {
- $crate::imp::arch::choose::syscall5_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall5_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -182,8 +186,8 @@ macro_rules! syscall_readonly {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr) => {
- $crate::imp::arch::choose::syscall6_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall6_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -194,8 +198,8 @@ macro_rules! syscall_readonly {
};
($nr:ident, $a0:expr, $a1:expr, $a2:expr, $a3:expr, $a4:expr, $a5:expr, $a6:expr) => {
- $crate::imp::arch::choose::syscall7_readonly(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall7_readonly(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
$a1.into(),
$a2.into(),
@@ -210,8 +214,8 @@ macro_rules! syscall_readonly {
#[cfg(feature = "runtime")]
macro_rules! syscall_noreturn {
($nr:ident, $a0:expr) => {
- $crate::imp::arch::choose::syscall1_noreturn(
- $crate::imp::reg::nr(linux_raw_sys::general::$nr),
+ $crate::backend::arch::choose::syscall1_noreturn(
+ $crate::backend::reg::nr(linux_raw_sys::general::$nr),
$a0.into(),
)
};
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/aarch64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/aarch64.s
index 1fad2fa6d..1fad2fa6d 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/aarch64.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/aarch64.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/arm.s b/vendor/rustix/src/backend/linux_raw/arch/outline/arm.s
index 7001686f1..7001686f1 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/arm.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/arm.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/mips.s b/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s
index ab1bbfa2d..ab1bbfa2d 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/mips.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/mips64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s
index 3c5e76e36..3c5e76e36 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/mips64.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
index ce1352751..a6a5f270d 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs
@@ -28,6 +28,6 @@ mod nr_last;
target_arch = "riscv64",
target_arch = "x86_64",
))]
-pub(in crate::imp) use nr_last::*;
+pub(in crate::backend) use nr_last::*;
#[cfg(target_arch = "x86")]
-pub(in crate::imp) use x86::*;
+pub(in crate::backend) use x86::*;
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/nr_last.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs
index fdcd11021..4af64d6c4 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/nr_last.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs
@@ -13,8 +13,8 @@
//! other arguments mostly as they are.
#[cfg(target_arch = "mips")]
-use crate::imp::reg::A6;
-use crate::imp::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::reg::A6;
+use crate::backend::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
// First we declare the actual assembly routines with `*_nr_last` names and
// reordered arguments. If the signatures or calling conventions are ever
@@ -78,19 +78,19 @@ extern "C" {
// Then we define inline wrapper functions that do the reordering.
#[inline]
-pub(in crate::imp) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
rustix_syscall0_nr_last(nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
rustix_syscall1_nr_last(a0, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
rustix_syscall1_noreturn_nr_last(a0, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -98,7 +98,7 @@ pub(in crate::imp) unsafe fn syscall2(
rustix_syscall2_nr_last(a0, a1, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -107,7 +107,7 @@ pub(in crate::imp) unsafe fn syscall3(
rustix_syscall3_nr_last(a0, a1, a2, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -117,7 +117,7 @@ pub(in crate::imp) unsafe fn syscall4(
rustix_syscall4_nr_last(a0, a1, a2, a3, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -128,7 +128,7 @@ pub(in crate::imp) unsafe fn syscall5(
rustix_syscall5_nr_last(a0, a1, a2, a3, a4, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -141,7 +141,7 @@ pub(in crate::imp) unsafe fn syscall6(
}
#[cfg(target_arch = "mips")]
#[inline]
-pub(in crate::imp) unsafe fn syscall7(
+pub(in crate::backend) unsafe fn syscall7(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -158,8 +158,8 @@ pub(in crate::imp) unsafe fn syscall7(
// separate `_readonly` implementations, so these can just be aliases to
// their non-`_readonly` counterparts.
#[cfg(target_arch = "mips")]
-pub(in crate::imp) use syscall7 as syscall7_readonly;
-pub(in crate::imp) use {
+pub(in crate::backend) use syscall7 as syscall7_readonly;
+pub(in crate::backend) use {
syscall0 as syscall0_readonly, syscall1 as syscall1_readonly, syscall2 as syscall2_readonly,
syscall3 as syscall3_readonly, syscall4 as syscall4_readonly, syscall5 as syscall5_readonly,
syscall6 as syscall6_readonly,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/powerpc64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s
index 29d4c0a95..29d4c0a95 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/powerpc64.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/riscv64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/riscv64.s
index 28d692f7c..28d692f7c 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/riscv64.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/riscv64.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs
index 938a4a09d..e74b8d2aa 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/x86.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs
@@ -14,8 +14,8 @@
#![allow(dead_code, unused_imports)]
-use crate::imp::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
-use crate::imp::vdso_wrappers::SyscallType;
+use crate::backend::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
+use crate::backend::vdso_wrappers::SyscallType;
// First we declare the actual assembly routines with `*_nr_last_fastcall`
// names and reordered arguments. If the signatures or calling conventions are
@@ -68,19 +68,19 @@ extern "fastcall" {
// Then we define inline wrapper functions that do the reordering.
#[inline]
-pub(in crate::imp) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
rustix_syscall0_nr_last_fastcall(nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg<R0> {
rustix_syscall1_nr_last_fastcall(a0, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
+pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! {
rustix_syscall1_noreturn_nr_last_fastcall(a0, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall2(
+pub(in crate::backend) unsafe fn syscall2(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -88,7 +88,7 @@ pub(in crate::imp) unsafe fn syscall2(
rustix_syscall2_nr_last_fastcall(a1, a0, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall3(
+pub(in crate::backend) unsafe fn syscall3(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -97,7 +97,7 @@ pub(in crate::imp) unsafe fn syscall3(
rustix_syscall3_nr_last_fastcall(a1, a2, a0, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall4(
+pub(in crate::backend) unsafe fn syscall4(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -107,7 +107,7 @@ pub(in crate::imp) unsafe fn syscall4(
rustix_syscall4_nr_last_fastcall(a1, a2, a0, a3, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall5(
+pub(in crate::backend) unsafe fn syscall5(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -118,7 +118,7 @@ pub(in crate::imp) unsafe fn syscall5(
rustix_syscall5_nr_last_fastcall(a1, a2, a0, a3, a4, nr)
}
#[inline]
-pub(in crate::imp) unsafe fn syscall6(
+pub(in crate::backend) unsafe fn syscall6(
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
a1: ArgReg<'_, A1>,
@@ -133,7 +133,7 @@ pub(in crate::imp) unsafe fn syscall6(
// Then we define the `_readonly` versions of the wrappers. We don't have
// separate `_readonly` implementations, so these can just be aliases to
// their non-`_readonly` counterparts.
-pub(in crate::imp) use {
+pub(in crate::backend) use {
syscall0 as syscall0_readonly, syscall1 as syscall1_readonly, syscall2 as syscall2_readonly,
syscall3 as syscall3_readonly, syscall4 as syscall4_readonly, syscall5 as syscall5_readonly,
syscall6 as syscall6_readonly,
@@ -206,14 +206,14 @@ extern "fastcall" {
// Then we define inline wrapper functions that do the reordering.
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall0(
+pub(in crate::backend) unsafe fn indirect_syscall0(
callee: SyscallType,
nr: SyscallNumber<'_>,
) -> RetReg<R0> {
rustix_indirect_syscall0_nr_last_fastcall(nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall1(
+pub(in crate::backend) unsafe fn indirect_syscall1(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -221,7 +221,7 @@ pub(in crate::imp) unsafe fn indirect_syscall1(
rustix_indirect_syscall1_nr_last_fastcall(a0, nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall1_noreturn(
+pub(in crate::backend) unsafe fn indirect_syscall1_noreturn(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -229,7 +229,7 @@ pub(in crate::imp) unsafe fn indirect_syscall1_noreturn(
rustix_indirect_syscall1_noreturn_nr_last_fastcall(a0, nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall2(
+pub(in crate::backend) unsafe fn indirect_syscall2(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -238,7 +238,7 @@ pub(in crate::imp) unsafe fn indirect_syscall2(
rustix_indirect_syscall2_nr_last_fastcall(a1, a0, nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall3(
+pub(in crate::backend) unsafe fn indirect_syscall3(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -248,7 +248,7 @@ pub(in crate::imp) unsafe fn indirect_syscall3(
rustix_indirect_syscall3_nr_last_fastcall(a1, a2, a0, nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall4(
+pub(in crate::backend) unsafe fn indirect_syscall4(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -259,7 +259,7 @@ pub(in crate::imp) unsafe fn indirect_syscall4(
rustix_indirect_syscall4_nr_last_fastcall(a1, a2, a0, a3, nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall5(
+pub(in crate::backend) unsafe fn indirect_syscall5(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
@@ -271,7 +271,7 @@ pub(in crate::imp) unsafe fn indirect_syscall5(
rustix_indirect_syscall5_nr_last_fastcall(a1, a2, a0, a3, a4, nr, callee)
}
#[inline]
-pub(in crate::imp) unsafe fn indirect_syscall6(
+pub(in crate::backend) unsafe fn indirect_syscall6(
callee: SyscallType,
nr: SyscallNumber<'_>,
a0: ArgReg<'_, A0>,
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/x86.s b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s
index bda234e1a..bda234e1a 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/x86.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s
diff --git a/vendor/rustix/src/imp/linux_raw/arch/outline/x86_64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/x86_64.s
index 2beda323b..2beda323b 100644
--- a/vendor/rustix/src/imp/linux_raw/arch/outline/x86_64.s
+++ b/vendor/rustix/src/backend/linux_raw/arch/outline/x86_64.s
diff --git a/vendor/rustix/src/imp/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs
index a6f0b8ff6..a6f0b8ff6 100644
--- a/vendor/rustix/src/imp/linux_raw/c.rs
+++ b/vendor/rustix/src/backend/linux_raw/c.rs
diff --git a/vendor/rustix/src/imp/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs
index c80ad58cc..7e09cdf80 100644
--- a/vendor/rustix/src/imp/linux_raw/conv.rs
+++ b/vendor/rustix/src/backend/linux_raw/conv.rs
@@ -30,9 +30,11 @@ use super::reg::{raw_arg, ArgNumber, ArgReg, RetReg, R0};
use super::time::types::ClockId;
#[cfg(feature = "time")]
use super::time::types::TimerfdClockId;
+use crate::fd::OwnedFd;
use crate::ffi::CStr;
+#[cfg(feature = "fs")]
use crate::fs::{FileType, Mode, OFlags};
-use crate::io::{self, OwnedFd};
+use crate::io;
use crate::process::{Pid, Resource, Signal};
use crate::utils::{as_mut_ptr, as_ptr};
use core::mem::MaybeUninit;
@@ -44,6 +46,7 @@ use linux_raw_sys::general::__kernel_loff_t;
#[cfg(feature = "net")]
use linux_raw_sys::general::socklen_t;
#[cfg(target_pointer_width = "32")]
+#[cfg(feature = "fs")]
use linux_raw_sys::general::O_LARGEFILE;
/// Convert `SYS_*` constants for socketcall.
@@ -156,6 +159,7 @@ impl<'a, Num: ArgNumber> From<BorrowedFd<'a>> for ArgReg<'a, Num> {
#[inline]
pub(super) unsafe fn raw_fd<'a, Num: ArgNumber>(fd: RawFd) -> ArgReg<'a, Num> {
// Use `no_fd` when passing `-1` is intended.
+ #[cfg(feature = "fs")]
debug_assert!(fd == crate::fs::cwd().as_raw_fd() || fd >= 0);
// Don't pass the `io_uring_register_files_skip` sentry value this way.
@@ -226,7 +230,7 @@ pub(super) fn opt_mut<T: Sized, Num: ArgNumber>(t: Option<&mut T>) -> ArgReg<Num
/// syscall.
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
#[inline]
-pub(super) fn opt_ref<'a, T: Sized, Num: ArgNumber>(t: Option<&'a T>) -> ArgReg<'a, Num> {
+pub(super) fn opt_ref<T: Sized, Num: ArgNumber>(t: Option<&T>) -> ArgReg<Num> {
// This optimizes into the equivalent of `transmute(t)`, and has the
// advantage of not requiring `unsafe`.
match t {
@@ -285,6 +289,7 @@ pub(super) fn socklen_t<'a, Num: ArgNumber>(i: socklen_t) -> ArgReg<'a, Num> {
pass_usize(i as usize)
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<Mode> for ArgReg<'a, Num> {
#[inline]
fn from(mode: Mode) -> Self {
@@ -292,6 +297,7 @@ impl<'a, Num: ArgNumber> From<Mode> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<(Mode, FileType)> for ArgReg<'a, Num> {
#[inline]
fn from(pair: (Mode, FileType)) -> Self {
@@ -299,6 +305,7 @@ impl<'a, Num: ArgNumber> From<(Mode, FileType)> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::AtFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::AtFlags) -> Self {
@@ -306,6 +313,7 @@ impl<'a, Num: ArgNumber> From<crate::fs::AtFlags> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::MemfdFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::MemfdFlags) -> Self {
@@ -313,6 +321,7 @@ impl<'a, Num: ArgNumber> From<crate::fs::MemfdFlags> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::RenameFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::RenameFlags) -> Self {
@@ -320,6 +329,7 @@ impl<'a, Num: ArgNumber> From<crate::fs::RenameFlags> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::StatxFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::StatxFlags) -> Self {
@@ -327,9 +337,9 @@ impl<'a, Num: ArgNumber> From<crate::fs::StatxFlags> for ArgReg<'a, Num> {
}
}
-impl<'a, Num: ArgNumber> From<crate::fs::FdFlags> for ArgReg<'a, Num> {
+impl<'a, Num: ArgNumber> From<crate::io::FdFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::fs::FdFlags) -> Self {
+ fn from(flags: crate::io::FdFlags) -> Self {
c_uint(flags.bits())
}
}
@@ -369,65 +379,67 @@ impl<'a, Num: ArgNumber> From<crate::io::epoll::CreateFlags> for ArgReg<'a, Num>
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::ProtFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::ProtFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::ProtFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::ProtFlags) -> Self {
c_uint(flags.bits())
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::MsyncFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MsyncFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::MsyncFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::MsyncFlags) -> Self {
c_uint(flags.bits())
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::MremapFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MremapFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::MremapFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::MremapFlags) -> Self {
c_uint(flags.bits())
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::MlockFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MlockFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::MlockFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::MlockFlags) -> Self {
c_uint(flags.bits())
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::MapFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MapFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::MapFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::MapFlags) -> Self {
c_uint(flags.bits())
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::MprotectFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::MprotectFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::MprotectFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::MprotectFlags) -> Self {
c_uint(flags.bits())
}
}
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
-impl<'a, Num: ArgNumber> From<crate::imp::mm::types::UserfaultfdFlags> for ArgReg<'a, Num> {
+#[cfg(feature = "mm")]
+impl<'a, Num: ArgNumber> From<crate::backend::mm::types::UserfaultfdFlags> for ArgReg<'a, Num> {
#[inline]
- fn from(flags: crate::imp::mm::types::UserfaultfdFlags) -> Self {
+ fn from(flags: crate::backend::mm::types::UserfaultfdFlags) -> Self {
c_uint(flags.bits())
}
}
-impl<'a, Num: ArgNumber> From<crate::imp::process::types::MembarrierCommand> for ArgReg<'a, Num> {
+impl<'a, Num: ArgNumber> From<crate::backend::process::types::MembarrierCommand>
+ for ArgReg<'a, Num>
+{
#[inline]
- fn from(cmd: crate::imp::process::types::MembarrierCommand) -> Self {
+ fn from(cmd: crate::backend::process::types::MembarrierCommand) -> Self {
c_uint(cmd as u32)
}
}
@@ -453,6 +465,7 @@ pub(super) fn dev_t<'a, Num: ArgNumber>(dev: u64) -> io::Result<ArgReg<'a, Num>>
}
#[cfg(target_pointer_width = "32")]
+#[cfg(feature = "fs")]
#[inline]
fn oflags_bits(oflags: OFlags) -> c::c_uint {
let mut bits = oflags.bits();
@@ -465,11 +478,13 @@ fn oflags_bits(oflags: OFlags) -> c::c_uint {
}
#[cfg(target_pointer_width = "64")]
+#[cfg(feature = "fs")]
#[inline]
const fn oflags_bits(oflags: OFlags) -> c::c_uint {
oflags.bits()
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<OFlags> for ArgReg<'a, Num> {
#[inline]
fn from(oflags: OFlags) -> Self {
@@ -478,11 +493,13 @@ impl<'a, Num: ArgNumber> From<OFlags> for ArgReg<'a, Num> {
}
/// Convert an `OFlags` into a `u64` for use in the `open_how` struct.
+#[cfg(feature = "fs")]
#[inline]
pub(super) fn oflags_for_open_how(oflags: OFlags) -> u64 {
u64::from(oflags_bits(oflags))
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::FallocateFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::FallocateFlags) -> Self {
@@ -517,6 +534,7 @@ impl<'a, Num: ArgNumber> From<Signal> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::Advice> for ArgReg<'a, Num> {
#[inline]
fn from(advice: crate::fs::Advice) -> Self {
@@ -524,6 +542,7 @@ impl<'a, Num: ArgNumber> From<crate::fs::Advice> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::SealFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::SealFlags) -> Self {
@@ -615,6 +634,7 @@ impl<'a, Num: ArgNumber> From<(crate::thread::FutexOperation, crate::thread::Fut
}
}
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::Access> for ArgReg<'a, Num> {
#[inline]
fn from(access: crate::fs::Access) -> Self {
@@ -744,7 +764,7 @@ pub(super) unsafe fn ret_usize_infallible(raw: RetReg<R0>) -> usize {
#[inline]
pub(super) unsafe fn ret_owned_fd(raw: RetReg<R0>) -> io::Result<OwnedFd> {
let raw_fd = try_decode_raw_fd(raw)?;
- Ok(OwnedFd::from(crate::imp::fd::OwnedFd::from_raw_fd(raw_fd)))
+ Ok(crate::backend::fd::OwnedFd::from_raw_fd(raw_fd))
}
/// Convert the return value of `dup2` and `dup3`.
diff --git a/vendor/rustix/src/imp/linux_raw/elf.rs b/vendor/rustix/src/backend/linux_raw/elf.rs
index 7b9bb3245..87fb5fa0f 100644
--- a/vendor/rustix/src/imp/linux_raw/elf.rs
+++ b/vendor/rustix/src/backend/linux_raw/elf.rs
@@ -1,6 +1,10 @@
//! The ELF ABI.
#![allow(non_snake_case)]
+#![cfg_attr(
+ all(not(target_vendor = "mustang"), feature = "use-libc-auxv"),
+ allow(dead_code)
+)]
pub(super) const SELFMAG: usize = 4;
pub(super) const ELFMAG: [u8; SELFMAG] = [0x7f, b'E', b'L', b'F'];
diff --git a/vendor/rustix/src/imp/linux_raw/fs/dir.rs b/vendor/rustix/src/backend/linux_raw/fs/dir.rs
index 64f5aa652..cfa347d03 100644
--- a/vendor/rustix/src/imp/linux_raw/fs/dir.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/dir.rs
@@ -1,7 +1,9 @@
-use crate::fd::{AsFd, BorrowedFd};
+use crate::fd::{AsFd, BorrowedFd, OwnedFd};
use crate::ffi::{CStr, CString};
-use crate::fs::{fcntl_getfl, fstat, fstatfs, openat, FileType, Mode, OFlags, Stat, StatFs};
-use crate::io::{self, OwnedFd};
+use crate::fs::{
+ fcntl_getfl, fstat, fstatfs, fstatvfs, openat, FileType, Mode, OFlags, Stat, StatFs, StatVfs,
+};
+use crate::io;
use crate::process::fchdir;
use crate::utils::as_ptr;
use alloc::borrow::ToOwned;
@@ -51,7 +53,7 @@ impl Dir {
/// `readdir(self)`, where `None` means the end of the directory.
pub fn read(&mut self) -> Option<io::Result<DirEntry>> {
if let Some(next) = self.next.take() {
- match crate::imp::fs::syscalls::_seek(self.fd.as_fd(), next as i64, SEEK_SET) {
+ match crate::backend::fs::syscalls::_seek(self.fd.as_fd(), next as i64, SEEK_SET) {
Ok(_) => (),
Err(err) => return Some(Err(err)),
}
@@ -134,15 +136,19 @@ impl Dir {
}
fn read_more(&mut self) -> Option<io::Result<()>> {
+ let og_len = self.buf.len();
// Capacity increment currently chosen by wild guess.
self.buf
.resize(self.buf.capacity() + 32 * size_of::<linux_dirent64>(), 0);
- self.pos = 0;
- let nread = match crate::imp::fs::syscalls::getdents(self.fd.as_fd(), &mut self.buf) {
+ let nread = match crate::backend::fs::syscalls::getdents(self.fd.as_fd(), &mut self.buf) {
Ok(nread) => nread,
- Err(err) => return Some(Err(err)),
+ Err(err) => {
+ self.buf.resize(og_len, 0);
+ return Some(Err(err));
+ }
};
self.buf.resize(nread, 0);
+ self.pos = 0;
if nread == 0 {
None
} else {
@@ -162,6 +168,12 @@ impl Dir {
fstatfs(&self.fd)
}
+ /// `fstatvfs(self)`
+ #[inline]
+ pub fn statvfs(&self) -> io::Result<StatVfs> {
+ fstatvfs(&self.fd)
+ }
+
/// `fchdir(self)`
#[inline]
pub fn chdir(&self) -> io::Result<()> {
diff --git a/vendor/rustix/src/imp/linux_raw/fs/makedev.rs b/vendor/rustix/src/backend/linux_raw/fs/makedev.rs
index 284ba2f10..284ba2f10 100644
--- a/vendor/rustix/src/imp/linux_raw/fs/makedev.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/makedev.rs
diff --git a/vendor/rustix/src/imp/linux_raw/fs/mod.rs b/vendor/rustix/src/backend/linux_raw/fs/mod.rs
index 641e65744..015c6baec 100644
--- a/vendor/rustix/src/imp/linux_raw/fs/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/mod.rs
@@ -1,4 +1,3 @@
-#[cfg(any(feature = "fs", feature = "procfs"))]
pub(crate) mod dir;
pub(crate) mod makedev;
pub(crate) mod syscalls;
diff --git a/vendor/rustix/src/imp/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
index db1ecaaf6..ff58f0a7b 100644
--- a/vendor/rustix/src/imp/linux_raw/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(dead_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -21,22 +21,23 @@ use super::super::conv::{loff_t, loff_t_from_u64, ret_u64};
target_pointer_width = "32",
))]
use crate::fd::AsFd;
-use crate::fd::{BorrowedFd, RawFd};
+use crate::fd::{BorrowedFd, OwnedFd};
use crate::ffi::CStr;
use crate::fs::{
- Access, Advice, AtFlags, FallocateFlags, FdFlags, FileType, FlockOperation, MemfdFlags, Mode,
- OFlags, RenameFlags, ResolveFlags, SealFlags, Stat, StatFs, StatxFlags, Timestamps,
+ Access, Advice, AtFlags, FallocateFlags, FileType, FlockOperation, MemfdFlags, Mode, OFlags,
+ RenameFlags, ResolveFlags, SealFlags, Stat, StatFs, StatVfs, StatVfsMountFlags, StatxFlags,
+ Timestamps,
};
-use crate::io::{self, OwnedFd, SeekFrom};
+use crate::io::{self, SeekFrom};
use crate::process::{Gid, Uid};
use core::convert::TryInto;
use core::mem::MaybeUninit;
#[cfg(target_arch = "mips64")]
use linux_raw_sys::general::stat as linux_stat64;
use linux_raw_sys::general::{
- __kernel_timespec, open_how, statx, AT_EACCESS, AT_FDCWD, AT_REMOVEDIR, AT_SYMLINK_NOFOLLOW,
- F_ADD_SEALS, F_DUPFD, F_DUPFD_CLOEXEC, F_GETFD, F_GETFL, F_GETLEASE, F_GETOWN, F_GETPIPE_SZ,
- F_GETSIG, F_GET_SEALS, F_SETFD, F_SETFL, F_SETPIPE_SZ, SEEK_CUR, SEEK_END, SEEK_SET,
+ __kernel_fsid_t, __kernel_timespec, open_how, statx, AT_EACCESS, AT_FDCWD, AT_REMOVEDIR,
+ AT_SYMLINK_NOFOLLOW, F_ADD_SEALS, F_GETFL, F_GETLEASE, F_GETOWN, F_GETPIPE_SZ, F_GETSIG,
+ F_GET_SEALS, F_SETFL, F_SETPIPE_SZ, SEEK_CUR, SEEK_END, SEEK_SET, STATX__RESERVED,
};
#[cfg(target_pointer_width = "32")]
use {
@@ -231,8 +232,8 @@ pub(crate) fn _seek(fd: BorrowedFd<'_>, offset: i64, whence: c::c_uint) -> io::R
pass_usize(offset as usize),
&mut result,
c_uint(whence)
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
#[cfg(target_pointer_width = "64")]
unsafe {
@@ -413,14 +414,15 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
match statx(fd, cstr!(""), AtFlags::EMPTY_PATH, StatxFlags::BASIC_STATS) {
Ok(x) => statx_to_stat(x),
Err(io::Errno::NOSYS) => fstat_old(fd),
- Err(e) => Err(e),
+ Err(err) => Err(err),
}
}
#[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))]
unsafe {
let mut result = MaybeUninit::<Stat>::uninit();
- ret(syscall!(__NR_fstat, fd, &mut result)).map(|()| result.assume_init())
+ ret(syscall!(__NR_fstat, fd, &mut result))?;
+ Ok(result.assume_init())
}
}
@@ -451,9 +453,9 @@ pub(crate) fn stat(filename: &CStr) -> io::Result<Stat> {
AtFlags::empty(),
StatxFlags::BASIC_STATS,
) {
- Ok(x) => return statx_to_stat(x),
+ Ok(x) => statx_to_stat(x),
Err(io::Errno::NOSYS) => stat_old(filename),
- Err(e) => return Err(e),
+ Err(err) => Err(err),
}
}
@@ -466,8 +468,8 @@ pub(crate) fn stat(filename: &CStr) -> io::Result<Stat> {
filename,
&mut result,
c_uint(0)
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
}
@@ -505,9 +507,9 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, filename: &CStr, flags: AtFlags) ->
#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
{
match statx(dirfd, filename, flags, StatxFlags::BASIC_STATS) {
- Ok(x) => return statx_to_stat(x),
+ Ok(x) => statx_to_stat(x),
Err(io::Errno::NOSYS) => statat_old(dirfd, filename, flags),
- Err(e) => return Err(e),
+ Err(err) => Err(err),
}
}
@@ -520,8 +522,8 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, filename: &CStr, flags: AtFlags) ->
filename,
&mut result,
flags
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
}
@@ -564,9 +566,9 @@ pub(crate) fn lstat(filename: &CStr) -> io::Result<Stat> {
AtFlags::SYMLINK_NOFOLLOW,
StatxFlags::BASIC_STATS,
) {
- Ok(x) => return statx_to_stat(x),
+ Ok(x) => statx_to_stat(x),
Err(io::Errno::NOSYS) => lstat_old(filename),
- Err(e) => return Err(e),
+ Err(err) => Err(err),
}
}
@@ -579,8 +581,8 @@ pub(crate) fn lstat(filename: &CStr) -> io::Result<Stat> {
filename,
&mut result,
c_uint(AT_SYMLINK_NOFOLLOW)
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
}
@@ -719,6 +721,24 @@ pub(crate) fn statx(
flags: AtFlags,
mask: StatxFlags,
) -> io::Result<statx> {
+ // If a future Linux kernel adds more fields to `struct statx` and users
+ // passing flags unknown to rustix in `StatxFlags`, we could end up
+ // writing outside of the buffer. To prevent this possibility, we mask off
+ // any flags that we don't know about.
+ //
+ // This includes `STATX__RESERVED`, which has a value that we know, but
+ // which could take on arbitrary new meaning in the future. Linux currently
+ // rejects this flag with `EINVAL`, so we do the same.
+ //
+ // This doesn't rely on `STATX_ALL` because [it's deprecated] and already
+ // doesn't represent all the known flags.
+ //
+ // [it's deprecated]: https://patchwork.kernel.org/project/linux-fsdevel/patch/20200505095915.11275-7-mszeredi@redhat.com/
+ if (mask.bits() & STATX__RESERVED) == STATX__RESERVED {
+ return Err(io::Errno::INVAL);
+ }
+ let mask = mask & StatxFlags::all();
+
unsafe {
let mut statx_buf = MaybeUninit::<statx>::uninit();
ret(syscall!(
@@ -728,8 +748,8 @@ pub(crate) fn statx(
flags,
mask,
&mut statx_buf
- ))
- .map(|()| statx_buf.assume_init())
+ ))?;
+ Ok(statx_buf.assume_init())
}
}
@@ -762,18 +782,28 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
fd,
size_of::<StatFs, _>(),
&mut result
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
#[cfg(target_pointer_width = "64")]
unsafe {
let mut result = MaybeUninit::<StatFs>::uninit();
- ret(syscall!(__NR_fstatfs, fd, &mut result)).map(|()| result.assume_init())
+ ret(syscall!(__NR_fstatfs, fd, &mut result))?;
+ Ok(result.assume_init())
}
}
#[inline]
+pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
+ // Linux doesn't have an `fstatvfs` syscall; we have to do `fstatfs` and
+ // translate the fields as best we can.
+ let statfs = fstatfs(fd)?;
+
+ Ok(statfs_to_statvfs(statfs))
+}
+
+#[inline]
pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
#[cfg(target_pointer_width = "32")]
unsafe {
@@ -783,13 +813,46 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
filename,
size_of::<StatFs, _>(),
&mut result
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
#[cfg(target_pointer_width = "64")]
unsafe {
let mut result = MaybeUninit::<StatFs>::uninit();
- ret(syscall!(__NR_statfs, filename, &mut result)).map(|()| result.assume_init())
+ ret(syscall!(__NR_statfs, filename, &mut result))?;
+ Ok(result.assume_init())
+ }
+}
+
+#[inline]
+pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
+ // Linux doesn't have a `statvfs` syscall; we have to do `statfs` and
+ // translate the fields as best we can.
+ let statfs = statfs(filename)?;
+
+ Ok(statfs_to_statvfs(statfs))
+}
+
+fn statfs_to_statvfs(statfs: StatFs) -> StatVfs {
+ let __kernel_fsid_t { val } = statfs.f_fsid;
+ let [f_fsid_val0, f_fsid_val1]: [i32; 2] = val;
+
+ StatVfs {
+ f_bsize: statfs.f_bsize as u64,
+ f_frsize: if statfs.f_frsize != 0 {
+ statfs.f_frsize
+ } else {
+ statfs.f_bsize
+ } as u64,
+ f_blocks: statfs.f_blocks as u64,
+ f_bfree: statfs.f_bfree as u64,
+ f_bavail: statfs.f_bavail as u64,
+ f_files: statfs.f_files as u64,
+ f_ffree: statfs.f_ffree as u64,
+ f_favail: statfs.f_ffree as u64,
+ f_fsid: f_fsid_val0 as u32 as u64 | ((f_fsid_val1 as u32 as u64) << 32),
+ f_flag: unsafe { StatVfsMountFlags::from_bits_unchecked(statfs.f_flags as u64) },
+ f_namemax: statfs.f_namelen as u64,
}
}
@@ -822,76 +885,6 @@ pub(crate) fn readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, buf: &mut [u8]) ->
}
#[inline]
-pub(crate) fn fcntl_dupfd(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
- #[cfg(target_pointer_width = "32")]
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_fcntl64,
- fd,
- c_uint(F_DUPFD),
- raw_fd(min)
- ))
- }
- #[cfg(target_pointer_width = "64")]
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_fcntl,
- fd,
- c_uint(F_DUPFD),
- raw_fd(min)
- ))
- }
-}
-
-#[inline]
-pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
- #[cfg(target_pointer_width = "32")]
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_fcntl64,
- fd,
- c_uint(F_DUPFD_CLOEXEC),
- raw_fd(min)
- ))
- }
- #[cfg(target_pointer_width = "64")]
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_fcntl,
- fd,
- c_uint(F_DUPFD_CLOEXEC),
- raw_fd(min)
- ))
- }
-}
-
-#[inline]
-pub(crate) fn fcntl_getfd(fd: BorrowedFd<'_>) -> io::Result<FdFlags> {
- #[cfg(target_pointer_width = "32")]
- unsafe {
- ret_c_uint(syscall_readonly!(__NR_fcntl64, fd, c_uint(F_GETFD)))
- .map(FdFlags::from_bits_truncate)
- }
- #[cfg(target_pointer_width = "64")]
- unsafe {
- ret_c_uint(syscall_readonly!(__NR_fcntl, fd, c_uint(F_GETFD)))
- .map(FdFlags::from_bits_truncate)
- }
-}
-
-#[inline]
-pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()> {
- #[cfg(target_pointer_width = "32")]
- unsafe {
- ret(syscall_readonly!(__NR_fcntl64, fd, c_uint(F_SETFD), flags))
- }
- #[cfg(target_pointer_width = "64")]
- unsafe {
- ret(syscall_readonly!(__NR_fcntl, fd, c_uint(F_SETFD), flags))
- }
-}
-
-#[inline]
pub(crate) fn fcntl_getfl(fd: BorrowedFd<'_>) -> io::Result<OFlags> {
#[cfg(target_pointer_width = "32")]
unsafe {
diff --git a/vendor/rustix/src/imp/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs
index 959a5ee27..a8d225ede 100644
--- a/vendor/rustix/src/imp/linux_raw/fs/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs
@@ -2,17 +2,6 @@ use super::super::c;
use bitflags::bitflags;
bitflags! {
- /// `FD_*` constants for use with [`fcntl_getfd`] and [`fcntl_setfd`].
- ///
- /// [`fcntl_getfd`]: crate::fs::fcntl_getfd
- /// [`fcntl_setfd`]: crate::fs::fcntl_setfd
- pub struct FdFlags: c::c_uint {
- /// `FD_CLOEXEC`
- const CLOEXEC = linux_raw_sys::general::FD_CLOEXEC;
- }
-}
-
-bitflags! {
/// `*_OK` constants for use with [`accessat`].
///
/// [`accessat`]: fn.accessat.html
@@ -494,6 +483,38 @@ bitflags! {
}
}
+bitflags! {
+ /// `ST_*` constants for use with [`StatVfs`].
+ pub struct StatVfsMountFlags: u64 {
+ /// `ST_MANDLOCK`
+ const MANDLOCK = linux_raw_sys::general::MS_MANDLOCK as u64;
+
+ /// `ST_NOATIME`
+ const NOATIME = linux_raw_sys::general::MS_NOATIME as u64;
+
+ /// `ST_NODEV`
+ const NODEV = linux_raw_sys::general::MS_NODEV as u64;
+
+ /// `ST_NODIRATIME`
+ const NODIRATIME = linux_raw_sys::general::MS_NODIRATIME as u64;
+
+ /// `ST_NOEXEC`
+ const NOEXEC = linux_raw_sys::general::MS_NOEXEC as u64;
+
+ /// `ST_NOSUID`
+ const NOSUID = linux_raw_sys::general::MS_NOSUID as u64;
+
+ /// `ST_RDONLY`
+ const RDONLY = linux_raw_sys::general::MS_RDONLY as u64;
+
+ /// `ST_RELATIME`
+ const RELATIME = linux_raw_sys::general::MS_RELATIME as u64;
+
+ /// `ST_SYNCHRONOUS`
+ const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS as u64;
+ }
+}
+
/// `LOCK_*` constants for use with [`flock`]
///
/// [`flock`]: crate::fs::flock
@@ -551,19 +572,31 @@ pub struct Stat {
#[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))]
pub type Stat = linux_raw_sys::general::stat;
-/// `struct statfs` for use with [`fstatfs`].
+/// `struct statfs` for use with [`statfs`] and [`fstatfs`].
///
+/// [`statfs`]: crate::fs::statfs
/// [`fstatfs`]: crate::fs::fstatfs
-#[cfg(target_pointer_width = "32")]
#[allow(clippy::module_name_repetitions)]
pub type StatFs = linux_raw_sys::general::statfs64;
-/// `struct statfs` for use with [`fstatfs`].
+/// `struct statvfs` for use with [`statvfs`] and [`fstatvfs`].
///
-/// [`fstatfs`]: crate::fs::fstatfs
-#[cfg(target_pointer_width = "64")]
-#[allow(clippy::module_name_repetitions)]
-pub type StatFs = linux_raw_sys::general::statfs64;
+/// [`statvfs`]: crate::fs::statvfs
+/// [`fstatvfs`]: crate::fs::fstatvfs
+#[allow(missing_docs)]
+pub struct StatVfs {
+ pub f_bsize: u64,
+ pub f_frsize: u64,
+ pub f_blocks: u64,
+ pub f_bfree: u64,
+ pub f_bavail: u64,
+ pub f_files: u64,
+ pub f_ffree: u64,
+ pub f_favail: u64,
+ pub f_fsid: u64,
+ pub f_flag: StatVfsMountFlags,
+ pub f_namemax: u64,
+}
/// `struct statx` for use with [`statx`].
///
diff --git a/vendor/rustix/src/imp/linux_raw/io/epoll.rs b/vendor/rustix/src/backend/linux_raw/io/epoll.rs
index 4362e40fb..d55ad75b1 100644
--- a/vendor/rustix/src/imp/linux_raw/io/epoll.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/epoll.rs
@@ -60,11 +60,11 @@
#![allow(unsafe_code)]
use super::super::c;
-use crate::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};
+use crate::backend::io::syscalls::{epoll_add, epoll_create, epoll_del, epoll_mod, epoll_wait};
+use crate::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd};
#[cfg(feature = "std")]
-use crate::fd::{FromFd, FromRawFd, IntoFd, IntoRawFd};
-use crate::imp::io::syscalls::{epoll_add, epoll_create, epoll_del, epoll_mod, epoll_wait};
-use crate::io::{self, OwnedFd};
+use crate::fd::{FromRawFd, IntoRawFd};
+use crate::io;
use alloc::vec::Vec;
use bitflags::bitflags;
use core::fmt;
@@ -207,17 +207,17 @@ impl<'a> Context for Borrowing<'a> {
}
/// A type implementing [`Context`] where the `Data` type is `T`, a type
-/// implementing `IntoFd` and `FromFd`.
+/// implementing `From<OwnedFd>` and `From<T> of OwnedFd`.
///
/// This may be used with [`OwnedFd`], or higher-level types like
/// [`std::fs::File`] or [`std::net::TcpStream`].
#[cfg(feature = "std")]
-pub struct Owning<'context, T: IntoFd + FromFd> {
+pub struct Owning<'context, T: Into<OwnedFd> + From<OwnedFd>> {
_phantom: PhantomData<&'context T>,
}
#[cfg(feature = "std")]
-impl<'context, T: IntoFd + FromFd> Owning<'context, T> {
+impl<'context, T: Into<OwnedFd> + From<OwnedFd>> Owning<'context, T> {
/// Creates a new empty `Owning`.
#[allow(clippy::new_without_default)] // This is a specialized type that doesn't need to be generically constructible.
#[inline]
@@ -229,16 +229,16 @@ impl<'context, T: IntoFd + FromFd> Owning<'context, T> {
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> Context for Owning<'context, T> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> Context for Owning<'context, T> {
type Data = T;
type Target = BorrowedFd<'context>;
#[inline]
fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target> {
- let raw_fd = data.into_fd().into_raw_fd();
+ let raw_fd = data.into().into_raw_fd();
// Safety: `epoll` will assign ownership of the file descriptor to the
- // kernel epoll object. We use `IntoFd`+`IntoRawFd` to consume the
- // `Data` and extract the raw file descriptor and then "borrow" it
+ // kernel epoll object. We use `Into<OwnedFd>`+`IntoRawFd` to consume
+ // the `Data` and extract the raw file descriptor and then "borrow" it
// with `borrow_raw` knowing that the borrow won't outlive the
// kernel epoll object.
unsafe { Ref::new(BorrowedFd::<'context>::borrow_raw(raw_fd)) }
@@ -261,7 +261,7 @@ impl<'context, T: AsFd + IntoFd + FromFd> Context for Owning<'context, T> {
// Safety: The file descriptor was held by the kernel epoll object and
// is now being released, so we can create a new `OwnedFd` that assumes
// ownership.
- unsafe { T::from_fd(io_lifetimes::OwnedFd::from_raw_fd(raw_fd)) }
+ unsafe { T::from(io_lifetimes::OwnedFd::from_raw_fd(raw_fd)) }
}
}
@@ -388,21 +388,21 @@ impl<Context: self::Context> Epoll<Context> {
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> AsRawFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsRawFd for Epoll<Owning<'context, T>> {
fn as_raw_fd(&self) -> RawFd {
self.epoll_fd.as_raw_fd()
}
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> IntoRawFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> IntoRawFd for Epoll<Owning<'context, T>> {
fn into_raw_fd(self) -> RawFd {
self.epoll_fd.into_raw_fd()
}
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> FromRawFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> FromRawFd for Epoll<Owning<'context, T>> {
unsafe fn from_raw_fd(fd: RawFd) -> Self {
Self {
epoll_fd: OwnedFd::from_raw_fd(fd),
@@ -412,21 +412,25 @@ impl<'context, T: AsFd + IntoFd + FromFd> FromRawFd for Epoll<Owning<'context, T
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> AsFd for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsFd for Epoll<Owning<'context, T>> {
fn as_fd(&self) -> BorrowedFd<'_> {
self.epoll_fd.as_fd()
}
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> From<Epoll<Owning<'context, T>>> for OwnedFd {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<Epoll<Owning<'context, T>>>
+ for OwnedFd
+{
fn from(epoll: Epoll<Owning<'context, T>>) -> Self {
epoll.epoll_fd
}
}
#[cfg(feature = "std")]
-impl<'context, T: AsFd + IntoFd + FromFd> From<OwnedFd> for Epoll<Owning<'context, T>> {
+impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<OwnedFd>
+ for Epoll<Owning<'context, T>>
+{
fn from(fd: OwnedFd) -> Self {
Self {
epoll_fd: fd,
diff --git a/vendor/rustix/src/imp/linux_raw/io/errno.rs b/vendor/rustix/src/backend/linux_raw/io/errno.rs
index 2637ae02e..5c7b2fcd5 100644
--- a/vendor/rustix/src/imp/linux_raw/io/errno.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/errno.rs
@@ -11,8 +11,8 @@
#![cfg_attr(not(rustc_attrs), allow(unused_unsafe))]
use super::super::c;
-use crate::imp::fd::RawFd;
-use crate::imp::reg::{RetNumber, RetReg};
+use crate::backend::fd::RawFd;
+use crate::backend::reg::{RetNumber, RetReg};
use crate::io;
use linux_raw_sys::errno;
@@ -78,7 +78,9 @@ impl Errno {
/// Check for an error from the result of a syscall which encodes a
/// `c::c_int` on success.
#[inline]
-pub(in crate::imp) fn try_decode_c_int<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<c::c_int> {
+pub(in crate::backend) fn try_decode_c_int<Num: RetNumber>(
+ raw: RetReg<Num>,
+) -> io::Result<c::c_int> {
if raw.is_in_range(-4095..0) {
// Safety: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
@@ -91,7 +93,9 @@ pub(in crate::imp) fn try_decode_c_int<Num: RetNumber>(raw: RetReg<Num>) -> io::
/// Check for an error from the result of a syscall which encodes a
/// `c::c_uint` on success.
#[inline]
-pub(in crate::imp) fn try_decode_c_uint<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<c::c_uint> {
+pub(in crate::backend) fn try_decode_c_uint<Num: RetNumber>(
+ raw: RetReg<Num>,
+) -> io::Result<c::c_uint> {
if raw.is_in_range(-4095..0) {
// Safety: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
@@ -104,7 +108,7 @@ pub(in crate::imp) fn try_decode_c_uint<Num: RetNumber>(raw: RetReg<Num>) -> io:
/// Check for an error from the result of a syscall which encodes a `usize` on
/// success.
#[inline]
-pub(in crate::imp) fn try_decode_usize<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<usize> {
+pub(in crate::backend) fn try_decode_usize<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<usize> {
if raw.is_in_range(-4095..0) {
// Safety: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
@@ -117,7 +121,7 @@ pub(in crate::imp) fn try_decode_usize<Num: RetNumber>(raw: RetReg<Num>) -> io::
/// Check for an error from the result of a syscall which encodes a
/// `*mut c_void` on success.
#[inline]
-pub(in crate::imp) fn try_decode_void_star<Num: RetNumber>(
+pub(in crate::backend) fn try_decode_void_star<Num: RetNumber>(
raw: RetReg<Num>,
) -> io::Result<*mut c::c_void> {
if raw.is_in_range(-4095..0) {
@@ -133,7 +137,7 @@ pub(in crate::imp) fn try_decode_void_star<Num: RetNumber>(
/// `u64` on success.
#[cfg(target_pointer_width = "64")]
#[inline]
-pub(in crate::imp) fn try_decode_u64<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<u64> {
+pub(in crate::backend) fn try_decode_u64<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<u64> {
if raw.is_in_range(-4095..0) {
// Safety: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
@@ -151,7 +155,7 @@ pub(in crate::imp) fn try_decode_u64<Num: RetNumber>(raw: RetReg<Num>) -> io::Re
/// This must only be used with syscalls which return file descriptors on
/// success.
#[inline]
-pub(in crate::imp) unsafe fn try_decode_raw_fd<Num: RetNumber>(
+pub(in crate::backend) unsafe fn try_decode_raw_fd<Num: RetNumber>(
raw: RetReg<Num>,
) -> io::Result<RawFd> {
// Instead of using `check_result` here, we just check for negative, since
@@ -180,7 +184,9 @@ pub(in crate::imp) unsafe fn try_decode_raw_fd<Num: RetNumber>(
///
/// This must only be used with syscalls which return no value on success.
#[inline]
-pub(in crate::imp) unsafe fn try_decode_void<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<()> {
+pub(in crate::backend) unsafe fn try_decode_void<Num: RetNumber>(
+ raw: RetReg<Num>,
+) -> io::Result<()> {
// Instead of using `check_result` here, we just check for zero, since this
// function is only used for system calls which have no other return value,
// and this produces smaller code.
@@ -210,7 +216,7 @@ pub(in crate::imp) unsafe fn try_decode_void<Num: RetNumber>(raw: RetReg<Num>) -
/// This must only be used with syscalls which do not return on success.
#[cfg(feature = "runtime")]
#[inline]
-pub(in crate::imp) unsafe fn try_decode_error<Num: RetNumber>(raw: RetReg<Num>) -> io::Errno {
+pub(in crate::backend) unsafe fn try_decode_error<Num: RetNumber>(raw: RetReg<Num>) -> io::Errno {
debug_assert!(raw.is_in_range(-4095..0));
// Tell the optimizer that we know the value is in the error range.
@@ -226,7 +232,7 @@ pub(in crate::imp) unsafe fn try_decode_error<Num: RetNumber>(raw: RetReg<Num>)
/// Return the contained `usize` value.
#[cfg(not(debug_assertions))]
#[inline]
-pub(in crate::imp) fn decode_usize_infallible<Num: RetNumber>(raw: RetReg<Num>) -> usize {
+pub(in crate::backend) fn decode_usize_infallible<Num: RetNumber>(raw: RetReg<Num>) -> usize {
raw.decode_usize()
}
diff --git a/vendor/rustix/src/imp/linux_raw/io/io_slice.rs b/vendor/rustix/src/backend/linux_raw/io/io_slice.rs
index fc8e64698..fc8e64698 100644
--- a/vendor/rustix/src/imp/linux_raw/io/io_slice.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/io_slice.rs
diff --git a/vendor/rustix/src/imp/linux_raw/io/mod.rs b/vendor/rustix/src/backend/linux_raw/io/mod.rs
index f5c2bf3c0..f5c2bf3c0 100644
--- a/vendor/rustix/src/imp/linux_raw/io/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/io/poll_fd.rs b/vendor/rustix/src/backend/linux_raw/io/poll_fd.rs
index 252358331..252358331 100644
--- a/vendor/rustix/src/imp/linux_raw/io/poll_fd.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/poll_fd.rs
diff --git a/vendor/rustix/src/imp/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
index 7857859de..2cc7898af 100644
--- a/vendor/rustix/src/imp/linux_raw/io/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -10,22 +10,27 @@ use super::super::c;
#[cfg(target_pointer_width = "64")]
use super::super::conv::loff_t_from_u64;
use super::super::conv::{
- by_ref, c_int, c_uint, pass_usize, raw_fd, ret, ret_discarded_fd, ret_owned_fd, ret_usize,
- slice, slice_mut, zero,
+ by_ref, c_int, c_uint, opt_mut, pass_usize, raw_fd, ret, ret_c_uint, ret_discarded_fd,
+ ret_owned_fd, ret_usize, slice, slice_mut, zero,
};
#[cfg(target_pointer_width = "32")]
use super::super::conv::{hi, lo};
-use crate::fd::{AsFd, BorrowedFd, RawFd};
+use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use crate::io::SpliceFlags;
use crate::io::{
- self, epoll, DupFlags, EventfdFlags, IoSlice, IoSliceMut, OwnedFd, PipeFlags, PollFd,
- ReadWriteFlags,
+ self, epoll, DupFlags, EventfdFlags, FdFlags, IoSlice, IoSliceMut, IoSliceRaw, PipeFlags,
+ PollFd, ReadWriteFlags,
};
-#[cfg(feature = "net")]
+#[cfg(all(feature = "fs", feature = "net"))]
use crate::net::{RecvFlags, SendFlags};
use core::cmp;
use core::mem::MaybeUninit;
+#[cfg(target_os = "espidf")]
+use linux_raw_sys::general::F_DUPFD;
use linux_raw_sys::general::{
- epoll_event, EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD, UIO_MAXIOV,
+ epoll_event, EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD,
+ UIO_MAXIOV,
};
use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FIONBIO, FIONREAD, TIOCEXCL, TIOCNXCL};
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
@@ -301,8 +306,8 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd>
pub(crate) fn ioctl_fionread(fd: BorrowedFd<'_>) -> io::Result<u64> {
unsafe {
let mut result = MaybeUninit::<c::c_int>::uninit();
- ret(syscall!(__NR_ioctl, fd, c_uint(FIONREAD), &mut result))
- .map(|()| result.assume_init() as u64)
+ ret(syscall!(__NR_ioctl, fd, c_uint(FIONREAD), &mut result))?;
+ Ok(result.assume_init() as u64)
}
}
@@ -333,8 +338,8 @@ pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd<'_>) -> io::Result<()> {
pub(crate) fn ioctl_blksszget(fd: BorrowedFd) -> io::Result<u32> {
let mut result = MaybeUninit::<c::c_uint>::uninit();
unsafe {
- ret(syscall!(__NR_ioctl, fd, c_uint(BLKSSZGET), &mut result))
- .map(|()| result.assume_init() as u32)
+ ret(syscall!(__NR_ioctl, fd, c_uint(BLKSSZGET), &mut result))?;
+ Ok(result.assume_init() as u32)
}
}
@@ -342,12 +347,12 @@ pub(crate) fn ioctl_blksszget(fd: BorrowedFd) -> io::Result<u32> {
pub(crate) fn ioctl_blkpbszget(fd: BorrowedFd) -> io::Result<u32> {
let mut result = MaybeUninit::<c::c_uint>::uninit();
unsafe {
- ret(syscall!(__NR_ioctl, fd, c_uint(BLKPBSZGET), &mut result))
- .map(|()| result.assume_init() as u32)
+ ret(syscall!(__NR_ioctl, fd, c_uint(BLKPBSZGET), &mut result))?;
+ Ok(result.assume_init() as u32)
}
}
-#[cfg(feature = "net")]
+#[cfg(all(feature = "fs", feature = "net"))]
pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
let (mut read, mut write) = crate::fs::fd::_is_file_read_write(fd)?;
let mut not_socket = false;
@@ -417,6 +422,77 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, flags: DupFlags) -> io
}
#[inline]
+pub(crate) fn fcntl_getfd(fd: BorrowedFd<'_>) -> io::Result<FdFlags> {
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ ret_c_uint(syscall_readonly!(__NR_fcntl64, fd, c_uint(F_GETFD)))
+ .map(FdFlags::from_bits_truncate)
+ }
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ ret_c_uint(syscall_readonly!(__NR_fcntl, fd, c_uint(F_GETFD)))
+ .map(FdFlags::from_bits_truncate)
+ }
+}
+
+#[inline]
+pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()> {
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ ret(syscall_readonly!(__NR_fcntl64, fd, c_uint(F_SETFD), flags))
+ }
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ ret(syscall_readonly!(__NR_fcntl, fd, c_uint(F_SETFD), flags))
+ }
+}
+
+#[cfg(target_os = "espidf")]
+#[inline]
+pub(crate) fn fcntl_dupfd(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ ret_owned_fd(syscall_readonly!(
+ __NR_fcntl64,
+ fd,
+ c_uint(F_DUPFD),
+ raw_fd(min)
+ ))
+ }
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ ret_owned_fd(syscall_readonly!(
+ __NR_fcntl,
+ fd,
+ c_uint(F_DUPFD),
+ raw_fd(min)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result<OwnedFd> {
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ ret_owned_fd(syscall_readonly!(
+ __NR_fcntl64,
+ fd,
+ c_uint(F_DUPFD_CLOEXEC),
+ raw_fd(min)
+ ))
+ }
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ ret_owned_fd(syscall_readonly!(
+ __NR_fcntl,
+ fd,
+ c_uint(F_DUPFD_CLOEXEC),
+ raw_fd(min)
+ ))
+ }
+}
+
+#[inline]
pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
unsafe {
let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit();
@@ -558,3 +634,43 @@ pub(crate) fn epoll_wait(
))
}
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub fn splice(
+ fd_in: BorrowedFd,
+ off_in: Option<&mut u64>,
+ fd_out: BorrowedFd,
+ off_out: Option<&mut u64>,
+ len: usize,
+ flags: SpliceFlags,
+) -> io::Result<usize> {
+ unsafe {
+ ret_usize(syscall!(
+ __NR_splice,
+ fd_in,
+ opt_mut(off_in),
+ fd_out,
+ opt_mut(off_out),
+ pass_usize(len),
+ c_uint(flags.bits())
+ ))
+ }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub unsafe fn vmsplice(
+ fd: BorrowedFd,
+ bufs: &[IoSliceRaw],
+ flags: SpliceFlags,
+) -> io::Result<usize> {
+ let (bufs_addr, bufs_len) = slice(&bufs[..cmp::min(bufs.len(), max_iov())]);
+ ret_usize(syscall!(
+ __NR_vmsplice,
+ fd,
+ bufs_addr,
+ bufs_len,
+ c_uint(flags.bits())
+ ))
+}
diff --git a/vendor/rustix/src/imp/linux_raw/io/types.rs b/vendor/rustix/src/backend/linux_raw/io/types.rs
index 282a23aa1..51ab61d94 100644
--- a/vendor/rustix/src/imp/linux_raw/io/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/types.rs
@@ -1,5 +1,17 @@
use super::super::c;
use bitflags::bitflags;
+use core::marker::PhantomData;
+
+bitflags! {
+ /// `FD_*` constants for use with [`fcntl_getfd`] and [`fcntl_setfd`].
+ ///
+ /// [`fcntl_getfd`]: crate::io::fcntl_getfd
+ /// [`fcntl_setfd`]: crate::io::fcntl_setfd
+ pub struct FdFlags: c::c_uint {
+ /// `FD_CLOEXEC`
+ const CLOEXEC = linux_raw_sys::general::FD_CLOEXEC;
+ }
+}
bitflags! {
/// `RWF_*` constants for use with [`preadv2`] and [`pwritev2`].
@@ -20,6 +32,21 @@ bitflags! {
}
}
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `SPLICE_F_*` constants for use with [`splice`] and [`vmsplice`].
+ pub struct SpliceFlags: c::c_uint {
+ /// `SPLICE_F_MOVE`
+ const MOVE = linux_raw_sys::general::SPLICE_F_MOVE;
+ /// `SPLICE_F_NONBLOCK`
+ const NONBLOCK = linux_raw_sys::general::SPLICE_F_NONBLOCK;
+ /// `SPLICE_F_MORE`
+ const MORE = linux_raw_sys::general::SPLICE_F_MORE;
+ /// `SPLICE_F_GIFT`
+ const GIFT = linux_raw_sys::general::SPLICE_F_GIFT;
+ }
+}
+
bitflags! {
/// `O_*` constants for use with [`dup2`].
///
@@ -65,3 +92,37 @@ pub(crate) const AT_FDCWD: c::c_int = linux_raw_sys::general::AT_FDCWD;
pub(crate) const STDIN_FILENO: c::c_uint = linux_raw_sys::general::STDIN_FILENO;
pub(crate) const STDOUT_FILENO: c::c_uint = linux_raw_sys::general::STDOUT_FILENO;
pub(crate) const STDERR_FILENO: c::c_uint = linux_raw_sys::general::STDERR_FILENO;
+
+/// A buffer type used with `vmsplice`.
+/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms and WSABUF on Windows.
+/// Unlike `IoSlice` and `IoSliceMut` it is semantically like a raw pointer,
+/// and therefore can be shared or mutated as needed.
+#[repr(transparent)]
+pub struct IoSliceRaw<'a> {
+ _buf: c::iovec,
+ _lifetime: PhantomData<&'a ()>,
+}
+
+impl<'a> IoSliceRaw<'a> {
+ /// Creates a new IoSlice wrapping a byte slice.
+ pub fn from_slice(buf: &'a [u8]) -> Self {
+ IoSliceRaw {
+ _buf: c::iovec {
+ iov_base: buf.as_ptr() as *mut u8 as *mut c::c_void,
+ iov_len: buf.len() as _,
+ },
+ _lifetime: PhantomData,
+ }
+ }
+
+ /// Creates a new IoSlice wrapping a mutable byte slice.
+ pub fn from_slice_mut(buf: &'a mut [u8]) -> Self {
+ IoSliceRaw {
+ _buf: c::iovec {
+ iov_base: buf.as_mut_ptr() as *mut c::c_void,
+ iov_len: buf.len() as _,
+ },
+ _lifetime: PhantomData,
+ }
+ }
+}
diff --git a/vendor/rustix/src/imp/linux_raw/io_uring/mod.rs b/vendor/rustix/src/backend/linux_raw/io_uring/mod.rs
index ef944f04d..ef944f04d 100644
--- a/vendor/rustix/src/imp/linux_raw/io_uring/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/io_uring/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/io_uring/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
index 812568efc..196676985 100644
--- a/vendor/rustix/src/imp/linux_raw/io_uring/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
@@ -2,14 +2,13 @@
//!
//! # Safety
//!
-//! See the `rustix::imp::syscalls` module documentation for details.
+//! See the `rustix::backend::syscalls` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
use super::super::conv::{by_mut, c_uint, pass_usize, ret, ret_c_uint, ret_owned_fd};
-use crate::fd::BorrowedFd;
+use crate::fd::{BorrowedFd, OwnedFd};
use crate::io;
-use crate::io::OwnedFd;
use crate::io_uring::{io_uring_params, IoringEnterFlags, IoringRegisterOp};
use core::ffi::c_void;
diff --git a/vendor/rustix/src/imp/linux_raw/mm/mod.rs b/vendor/rustix/src/backend/linux_raw/mm/mod.rs
index 1e0181a99..1e0181a99 100644
--- a/vendor/rustix/src/imp/linux_raw/mm/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mm/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/mm/syscalls.rs b/vendor/rustix/src/backend/linux_raw/mm/syscalls.rs
index 8b230be3d..8fa6a3ec3 100644
--- a/vendor/rustix/src/imp/linux_raw/mm/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/mm/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -14,8 +14,8 @@ use super::types::{
Advice, MapFlags, MlockFlags, MprotectFlags, MremapFlags, MsyncFlags, ProtFlags,
UserfaultfdFlags,
};
-use crate::fd::BorrowedFd;
-use crate::io::{self, OwnedFd};
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::io;
#[cfg(target_pointer_width = "32")]
use core::convert::TryInto;
use linux_raw_sys::general::MAP_ANONYMOUS;
@@ -61,7 +61,7 @@ pub(crate) unsafe fn mmap(
fd,
(offset / 4096)
.try_into()
- .map(|scaled_offset| pass_usize(scaled_offset))
+ .map(pass_usize)
.map_err(|_| io::Errno::INVAL)?
))
}
diff --git a/vendor/rustix/src/imp/linux_raw/mm/types.rs b/vendor/rustix/src/backend/linux_raw/mm/types.rs
index a58dd76be..a58dd76be 100644
--- a/vendor/rustix/src/imp/linux_raw/mm/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/mm/types.rs
diff --git a/vendor/rustix/src/imp/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs
index ed46eaad1..231dc37b6 100644
--- a/vendor/rustix/src/imp/linux_raw/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mod.rs
@@ -24,23 +24,23 @@ mod vdso;
#[cfg(any(feature = "time", target_arch = "x86"))]
mod vdso_wrappers;
-#[cfg(any(
- feature = "param",
- feature = "runtime",
- feature = "time",
- target_arch = "x86",
-))]
-pub(crate) mod param;
-// #[cfg(feature = "fs")] // TODO: Enable once `OwnedFd` moves out of the tree.
+#[cfg(feature = "fs")]
pub(crate) mod fs;
pub(crate) mod io;
#[cfg(feature = "io_uring")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
pub(crate) mod io_uring;
-#[cfg(any(feature = "mm", feature = "time", target_arch = "x86"))] // vdso.rs uses `madvise`
+#[cfg(feature = "mm")]
pub(crate) mod mm;
#[cfg(feature = "net")]
pub(crate) mod net;
+#[cfg(any(
+ feature = "param",
+ feature = "runtime",
+ feature = "time",
+ target_arch = "x86",
+))]
+pub(crate) mod param;
pub(crate) mod process;
#[cfg(feature = "rand")]
pub(crate) mod rand;
diff --git a/vendor/rustix/src/imp/linux_raw/net/addr.rs b/vendor/rustix/src/backend/linux_raw/net/addr.rs
index d5683f34e..d5683f34e 100644
--- a/vendor/rustix/src/imp/linux_raw/net/addr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/addr.rs
diff --git a/vendor/rustix/src/imp/linux_raw/net/mod.rs b/vendor/rustix/src/backend/linux_raw/net/mod.rs
index 5e67dfd21..f2273db1b 100644
--- a/vendor/rustix/src/imp/linux_raw/net/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/mod.rs
@@ -1,6 +1,4 @@
pub(crate) mod addr;
-#[cfg(not(feature = "std"))]
-pub(crate) mod ext;
pub(crate) mod read_sockaddr;
pub(crate) mod send_recv;
pub(crate) mod syscalls;
diff --git a/vendor/rustix/src/imp/linux_raw/net/read_sockaddr.rs b/vendor/rustix/src/backend/linux_raw/net/read_sockaddr.rs
index b9bc09b96..b9bc09b96 100644
--- a/vendor/rustix/src/imp/linux_raw/net/read_sockaddr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/read_sockaddr.rs
diff --git a/vendor/rustix/src/imp/linux_raw/net/send_recv.rs b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
index 888e81e2b..888e81e2b 100644
--- a/vendor/rustix/src/imp/linux_raw/net/send_recv.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
diff --git a/vendor/rustix/src/imp/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
index 18a0f130d..7b9947a03 100644
--- a/vendor/rustix/src/imp/linux_raw/net/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -15,8 +15,8 @@ use super::read_sockaddr::{initialize_family_to_unspec, maybe_read_sockaddr_os,
use super::send_recv::{RecvFlags, SendFlags};
use super::types::{AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType};
use super::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6};
-use crate::fd::BorrowedFd;
-use crate::io::{self, OwnedFd};
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::io;
use crate::net::{SocketAddrAny, SocketAddrUnix, SocketAddrV4, SocketAddrV6};
use c::{sockaddr, sockaddr_in, sockaddr_in6, socklen_t};
use core::convert::TryInto;
@@ -102,11 +102,9 @@ pub(crate) fn socketpair(
(type_, flags),
protocol,
&mut result
- ))
- .map(|()| {
- let [fd0, fd1] = result.assume_init();
- (fd0, fd1)
- })
+ ))?;
+ let [fd0, fd1] = result.assume_init();
+ Ok((fd0, fd1))
}
#[cfg(target_arch = "x86")]
unsafe {
@@ -120,11 +118,9 @@ pub(crate) fn socketpair(
protocol.into(),
(&mut result).into(),
])
- ))
- .map(|()| {
- let [fd0, fd1] = result.assume_init();
- (fd0, fd1)
- })
+ ))?;
+ let [fd0, fd1] = result.assume_init();
+ Ok((fd0, fd1))
}
}
@@ -1136,6 +1132,24 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn set_ipv6_multicast_hops(
+ fd: BorrowedFd<'_>,
+ multicast_hops: u32,
+ ) -> io::Result<()> {
+ setsockopt(
+ fd,
+ c::IPPROTO_IP as _,
+ c::IPV6_MULTICAST_LOOP,
+ multicast_hops,
+ )
+ }
+
+ #[inline]
+ pub(crate) fn get_ipv6_multicast_hops(fd: BorrowedFd<'_>) -> io::Result<u32> {
+ getsockopt(fd, c::IPPROTO_IP as _, c::IPV6_MULTICAST_LOOP)
+ }
+
+ #[inline]
pub(crate) fn set_ip_add_membership(
fd: BorrowedFd<'_>,
multiaddr: &Ipv4Addr,
diff --git a/vendor/rustix/src/imp/linux_raw/net/types.rs b/vendor/rustix/src/backend/linux_raw/net/types.rs
index b8f786b3f..b8f786b3f 100644
--- a/vendor/rustix/src/imp/linux_raw/net/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/types.rs
diff --git a/vendor/rustix/src/imp/linux_raw/net/write_sockaddr.rs b/vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs
index 17abd96a0..17abd96a0 100644
--- a/vendor/rustix/src/imp/linux_raw/net/write_sockaddr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs
diff --git a/vendor/rustix/src/backend/linux_raw/param/auxv.rs b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
new file mode 100644
index 000000000..20a3d5da6
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
@@ -0,0 +1,370 @@
+//! Linux auxv support.
+//!
+//! # Safety
+//!
+//! This uses raw pointers to locate and read the kernel-provided auxv array.
+#![allow(unsafe_code)]
+
+use super::super::c;
+use super::super::elf::*;
+use crate::fd::OwnedFd;
+#[cfg(feature = "param")]
+use crate::ffi::CStr;
+use crate::fs::{Mode, OFlags};
+use crate::utils::{as_ptr, check_raw_pointer};
+use alloc::vec::Vec;
+use core::ffi::c_void;
+use core::mem::size_of;
+use core::ptr::{null_mut, read_unaligned, NonNull};
+#[cfg(feature = "runtime")]
+use core::slice;
+use core::sync::atomic::Ordering::Relaxed;
+use core::sync::atomic::{AtomicPtr, AtomicUsize};
+use linux_raw_sys::general::{
+ AT_BASE, AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_NULL, AT_PAGESZ, AT_PHDR, AT_PHENT,
+ AT_PHNUM, AT_SYSINFO_EHDR,
+};
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn page_size() -> usize {
+ let mut page_size = PAGE_SIZE.load(Relaxed);
+
+ if page_size == 0 {
+ init_from_proc_self_auxv();
+ page_size = PAGE_SIZE.load(Relaxed);
+ }
+
+ page_size
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn clock_ticks_per_second() -> u64 {
+ let mut ticks = CLOCK_TICKS_PER_SECOND.load(Relaxed);
+
+ if ticks == 0 {
+ init_from_proc_self_auxv();
+ ticks = CLOCK_TICKS_PER_SECOND.load(Relaxed);
+ }
+
+ ticks as u64
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_hwcap() -> (usize, usize) {
+ let mut hwcap = HWCAP.load(Relaxed);
+ let mut hwcap2 = HWCAP2.load(Relaxed);
+
+ if hwcap == 0 || hwcap2 == 0 {
+ init_from_proc_self_auxv();
+ hwcap = HWCAP.load(Relaxed);
+ hwcap2 = HWCAP2.load(Relaxed);
+ }
+
+ (hwcap, hwcap2)
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_execfn() -> &'static CStr {
+ let mut execfn = EXECFN.load(Relaxed);
+
+ if execfn.is_null() {
+ init_from_proc_self_auxv();
+ execfn = EXECFN.load(Relaxed);
+ }
+
+ // Safety: We assume the `AT_EXECFN` value provided by the kernel is a
+ // valid pointer to a valid NUL-terminated array of bytes.
+ unsafe { CStr::from_ptr(execfn.cast()) }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
+ let mut phdr = PHDR.load(Relaxed);
+ let mut phnum = PHNUM.load(Relaxed);
+
+ if phdr.is_null() || phnum == 0 {
+ init_from_proc_self_auxv();
+ phdr = PHDR.load(Relaxed);
+ phnum = PHNUM.load(Relaxed);
+ }
+
+ (phdr.cast(), phnum)
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
+ let (phdr, phnum) = exe_phdrs();
+
+ // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
+ // kernel form a valid slice.
+ unsafe { slice::from_raw_parts(phdr.cast(), phnum) }
+}
+
+/// `AT_SYSINFO_EHDR` isn't present on all platforms in all configurations,
+/// so if we don't see it, this function returns a null pointer.
+#[inline]
+pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
+ let mut ehdr = SYSINFO_EHDR.load(Relaxed);
+
+ if ehdr.is_null() {
+ init_from_proc_self_auxv();
+ ehdr = SYSINFO_EHDR.load(Relaxed);
+ }
+
+ ehdr
+}
+
+static PAGE_SIZE: AtomicUsize = AtomicUsize::new(0);
+static CLOCK_TICKS_PER_SECOND: AtomicUsize = AtomicUsize::new(0);
+static HWCAP: AtomicUsize = AtomicUsize::new(0);
+static HWCAP2: AtomicUsize = AtomicUsize::new(0);
+static SYSINFO_EHDR: AtomicPtr<Elf_Ehdr> = AtomicPtr::new(null_mut());
+static PHDR: AtomicPtr<Elf_Phdr> = AtomicPtr::new(null_mut());
+static PHNUM: AtomicUsize = AtomicUsize::new(0);
+static EXECFN: AtomicPtr<c::c_char> = AtomicPtr::new(null_mut());
+
+/// On non-Mustang platforms, we read the aux vector from /proc/self/auxv.
+fn init_from_proc_self_auxv() {
+ // Open "/proc/self/auxv", either because we trust "/proc", or because
+ // we're running inside QEMU and `proc_self_auxv`'s extra checking foils
+ // QEMU's emulation so we need to do a plain open to get the right
+ // auxv records.
+ let file = crate::fs::openat(
+ crate::fs::cwd(),
+ "/proc/self/auxv",
+ OFlags::empty(),
+ Mode::empty(),
+ )
+ .unwrap();
+
+ let _ = init_from_auxv_file(file);
+}
+
+/// Process auxv entries from the open file `auxv`.
+fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
+ let mut buffer = Vec::<u8>::with_capacity(512);
+ loop {
+ let cur = buffer.len();
+
+ // Request one extra byte; `Vec` will often allocate more.
+ buffer.reserve(1);
+
+ // Use all the space it allocated.
+ buffer.resize(buffer.capacity(), 0);
+
+ // Read up to that many bytes.
+ let n = match crate::io::read(&auxv, &mut buffer[cur..]) {
+ Err(crate::io::Errno::INTR) => 0,
+ Err(_err) => panic!(),
+ Ok(0) => break,
+ Ok(n) => n,
+ };
+
+ // Account for the number of bytes actually read.
+ buffer.resize(cur + n, 0_u8);
+ }
+
+ // Safety: We loaded from an auxv file into the buffer.
+ unsafe { init_from_auxp(buffer.as_ptr().cast()) }
+}
+
+/// Process auxv entries from the auxv array pointed to by `auxp`.
+///
+/// # Safety
+///
+/// This must be passed a pointer to an auxv array.
+///
+/// The buffer contains `Elf_aux_t` elements, though it need not be aligned;
+/// function uses `read_unaligned` to read from it.
+unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) -> Option<()> {
+ let mut pagesz = 0;
+ let mut clktck = 0;
+ let mut hwcap = 0;
+ let mut hwcap2 = 0;
+ let mut phdr = null_mut();
+ let mut phnum = 0;
+ let mut execfn = null_mut();
+ let mut sysinfo_ehdr = null_mut();
+ let mut phent = 0;
+
+ loop {
+ let Elf_auxv_t { a_type, a_val } = read_unaligned(auxp);
+
+ match a_type as _ {
+ AT_PAGESZ => pagesz = a_val as usize,
+ AT_CLKTCK => clktck = a_val as usize,
+ AT_HWCAP => hwcap = a_val as usize,
+ AT_HWCAP2 => hwcap2 = a_val as usize,
+ AT_PHDR => phdr = check_raw_pointer::<Elf_Phdr>(a_val as *mut _)?.as_ptr(),
+ AT_PHNUM => phnum = a_val as usize,
+ AT_PHENT => phent = a_val as usize,
+ AT_EXECFN => execfn = check_raw_pointer::<c::c_char>(a_val as *mut _)?.as_ptr(),
+ AT_BASE => check_interpreter_base(a_val.cast())?,
+ AT_SYSINFO_EHDR => sysinfo_ehdr = check_vdso_base(a_val as *mut _)?.as_ptr(),
+ AT_NULL => break,
+ _ => (),
+ }
+ auxp = auxp.add(1);
+ }
+
+ assert_eq!(phent, size_of::<Elf_Phdr>());
+
+ // The base and sysinfo_ehdr (if present) matches our platform. Accept
+ // the aux values.
+ PAGE_SIZE.store(pagesz, Relaxed);
+ CLOCK_TICKS_PER_SECOND.store(clktck, Relaxed);
+ HWCAP.store(hwcap, Relaxed);
+ HWCAP2.store(hwcap2, Relaxed);
+ PHDR.store(phdr, Relaxed);
+ PHNUM.store(phnum, Relaxed);
+ EXECFN.store(execfn, Relaxed);
+ SYSINFO_EHDR.store(sysinfo_ehdr, Relaxed);
+
+ Some(())
+}
+
+/// Check that `base` is a valid pointer to the program interpreter.
+///
+/// `base` is some value we got from a `AT_BASE` aux record somewhere,
+/// which hopefully holds the value of the program interpreter in memory. Do a
+/// series of checks to be as sure as we can that it's safe to use.
+unsafe fn check_interpreter_base(base: *const Elf_Ehdr) -> Option<()> {
+ check_elf_base(base)?;
+ Some(())
+}
+
+/// Check that `base` is a valid pointer to the kernel-provided vDSO.
+///
+/// `base` is some value we got from a `AT_SYSINFO_EHDR` aux record somewhere,
+/// which hopefully holds the value of the kernel-provided vDSO in memory. Do a
+/// series of checks to be as sure as we can that it's safe to use.
+unsafe fn check_vdso_base(base: *const Elf_Ehdr) -> Option<NonNull<Elf_Ehdr>> {
+ // In theory, we could check that we're not attempting to parse our own ELF
+ // image, as an additional check. However, older Linux toolchains don't
+ // support this, and Rust's `#[linkage = "extern_weak"]` isn't stable yet,
+ // so just disable this for now.
+ /*
+ {
+ extern "C" {
+ static __ehdr_start: c::c_void;
+ }
+
+ let ehdr_start: *const c::c_void = &__ehdr_start;
+ if base == ehdr_start {
+ return None;
+ }
+ }
+ */
+
+ let hdr = check_elf_base(base)?;
+
+ // Check that the ELF is not writable, since that would indicate that this
+ // isn't the ELF we think it is. Here we're just using `clock_getres` just
+ // as an arbitrary system call which writes to a buffer and fails with
+ // `EFAULT` if the buffer is not writable.
+ {
+ use super::super::conv::{c_uint, ret};
+ if ret(syscall!(
+ __NR_clock_getres,
+ c_uint(linux_raw_sys::general::CLOCK_MONOTONIC),
+ base
+ )) != Err(crate::io::Errno::FAULT)
+ {
+ // We can't gracefully fail here because we would seem to have just
+ // mutated some unknown memory.
+ #[cfg(feature = "std")]
+ {
+ std::process::abort();
+ }
+ #[cfg(all(not(feature = "std"), feature = "rustc-dep-of-std"))]
+ {
+ core::intrinsics::abort();
+ }
+ }
+ }
+
+ Some(hdr)
+}
+
+/// Check that `base` is a valid pointer to an ELF image.
+unsafe fn check_elf_base(base: *const Elf_Ehdr) -> Option<NonNull<Elf_Ehdr>> {
+ // If we're reading a 64-bit auxv on a 32-bit platform, we'll see
+ // a zero `a_val` because `AT_*` values are never greater than
+ // `u32::MAX`. Zero is used by libc's `getauxval` to indicate
+ // errors, so it should never be a valid value.
+ if base.is_null() {
+ return None;
+ }
+
+ let hdr = match check_raw_pointer::<Elf_Ehdr>(base as *mut _) {
+ Some(hdr) => hdr,
+ None => return None,
+ };
+
+ let hdr = hdr.as_ref();
+ if hdr.e_ident[..SELFMAG] != ELFMAG {
+ return None; // Wrong ELF magic
+ }
+ if !matches!(hdr.e_ident[EI_OSABI], ELFOSABI_SYSV | ELFOSABI_LINUX) {
+ return None; // Unrecognized ELF OS ABI
+ }
+ if hdr.e_ident[EI_ABIVERSION] != ELFABIVERSION {
+ return None; // Unrecognized ELF ABI version
+ }
+ if hdr.e_type != ET_DYN {
+ return None; // Wrong ELF type
+ }
+
+ // If ELF is extended, we'll need to adjust.
+ if hdr.e_ident[EI_VERSION] != EV_CURRENT
+ || hdr.e_ehsize as usize != size_of::<Elf_Ehdr>()
+ || hdr.e_phentsize as usize != size_of::<Elf_Phdr>()
+ {
+ return None;
+ }
+ // We don't currently support extra-large numbers of segments.
+ if hdr.e_phnum == PN_XNUM {
+ return None;
+ }
+
+ // If `e_phoff` is zero, it's more likely that we're looking at memory that
+ // has been zeroed than that the kernel has somehow aliased the `Ehdr` and
+ // the `Phdr`.
+ if hdr.e_phoff < size_of::<Elf_Ehdr>() {
+ return None;
+ }
+
+ // Verify that the `EI_CLASS`/`EI_DATA`/`e_machine` fields match the
+ // architecture we're running as. This helps catch cases where we're
+ // running under QEMU.
+ if hdr.e_ident[EI_CLASS] != ELFCLASS {
+ return None; // Wrong ELF class
+ }
+ if hdr.e_ident[EI_DATA] != ELFDATA {
+ return None; // Wrong ELF data
+ }
+ if hdr.e_machine != EM_CURRENT {
+ return None; // Wrong machine type
+ }
+
+ Some(NonNull::new_unchecked(as_ptr(hdr) as *mut _))
+}
+
+// ELF ABI
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct Elf_auxv_t {
+ a_type: usize,
+
+ // Some of the values in the auxv array are pointers, so we make `a_val` a
+ // pointer, in order to preserve their provenance. For the values which are
+ // integers, we cast this to `usize`.
+ a_val: *const c_void,
+}
diff --git a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
new file mode 100644
index 000000000..1597fd727
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
@@ -0,0 +1,74 @@
+//! Linux auxv support, using libc.
+//!
+//! # Safety
+//!
+//! This uses raw pointers to locate and read the kernel-provided auxv array.
+#![allow(unsafe_code)]
+
+#[cfg(any(feature = "param", feature = "runtime"))]
+use super::super::c;
+use super::super::elf::*;
+#[cfg(feature = "param")]
+use crate::ffi::CStr;
+#[cfg(feature = "runtime")]
+use core::slice;
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn page_size() -> usize {
+ unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn clock_ticks_per_second() -> u64 {
+ unsafe { libc::getauxval(libc::AT_CLKTCK) as u64 }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_hwcap() -> (usize, usize) {
+ unsafe {
+ (
+ libc::getauxval(libc::AT_HWCAP) as usize,
+ libc::getauxval(libc::AT_HWCAP2) as usize,
+ )
+ }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_execfn() -> &'static CStr {
+ unsafe {
+ let execfn = libc::getauxval(libc::AT_EXECFN) as *const c::c_char;
+ CStr::from_ptr(execfn.cast())
+ }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
+ unsafe {
+ (
+ libc::getauxval(libc::AT_PHDR) as *const c::c_void,
+ libc::getauxval(libc::AT_PHNUM) as usize,
+ )
+ }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
+ let (phdr, phnum) = exe_phdrs();
+
+ // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
+ // kernel form a valid slice.
+ unsafe { slice::from_raw_parts(phdr.cast(), phnum) }
+}
+
+/// `AT_SYSINFO_EHDR` isn't present on all platforms in all configurations,
+/// so if we don't see it, this function returns a null pointer.
+#[inline]
+pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
+ unsafe { libc::getauxval(linux_raw_sys::general::AT_SYSINFO_EHDR.into()) as *const Elf_Ehdr }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/param/mod.rs b/vendor/rustix/src/backend/linux_raw/param/mod.rs
new file mode 100644
index 000000000..956282074
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/param/mod.rs
@@ -0,0 +1,12 @@
+// On Mustang, origin is in control of program startup and can access the
+// incoming aux values on the stack.
+//
+// With "use-libc-auxv" enabled, use libc's `getauxval`.
+//
+// Otherwise, we read aux values from /proc/self/auxv.
+#[cfg_attr(target_vendor = "mustang", path = "mustang_auxv.rs")]
+#[cfg_attr(
+ all(not(target_vendor = "mustang"), feature = "use-libc-auxv"),
+ path = "libc_auxv.rs"
+)]
+pub(crate) mod auxv;
diff --git a/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs b/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs
new file mode 100644
index 000000000..e9b89b500
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs
@@ -0,0 +1,159 @@
+//! Linux auxv support, for Mustang.
+//!
+//! # Safety
+//!
+//! This uses raw pointers to locate and read the kernel-provided auxv array.
+#![allow(unsafe_code)]
+
+use super::super::c;
+use super::super::elf::*;
+#[cfg(feature = "param")]
+use crate::ffi::CStr;
+use core::ffi::c_void;
+use core::mem::size_of;
+use core::ptr::{null, read};
+#[cfg(feature = "runtime")]
+use core::slice;
+use linux_raw_sys::general::{
+ AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_NULL, AT_PAGESZ, AT_PHDR, AT_PHENT, AT_PHNUM,
+ AT_SYSINFO_EHDR,
+};
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn page_size() -> usize {
+ // Safety: This is initialized during program startup.
+ unsafe { PAGE_SIZE }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn clock_ticks_per_second() -> u64 {
+ // Safety: This is initialized during program startup.
+ unsafe { CLOCK_TICKS_PER_SECOND as u64 }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_hwcap() -> (usize, usize) {
+ // Safety: This is initialized during program startup.
+ unsafe { (HWCAP, HWCAP2) }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_execfn() -> &'static CStr {
+ // Safety: This is initialized during program startup. And we
+ // assume it's a valid pointer to a NUL-terminated string.
+ unsafe { CStr::from_ptr(EXECFN.0.cast()) }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn exe_phdrs() -> (*const c_void, usize) {
+ // Safety: This is initialized during program startup.
+ unsafe { (PHDR.0.cast(), PHNUM) }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
+ let (phdr, phnum) = exe_phdrs();
+
+ // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
+ // kernel form a valid slice.
+ unsafe { slice::from_raw_parts(phdr.cast(), phnum) }
+}
+
+/// `AT_SYSINFO_EHDR` isn't present on all platforms in all configurations,
+/// so if we don't see it, this function returns a null pointer.
+#[inline]
+pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
+ // Safety: This is initialized during program startup.
+ unsafe { SYSINFO_EHDR.0 }
+}
+
+/// A const pointer to `T` that implements [`Sync`].
+#[repr(transparent)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct SyncConstPtr<T>(*const T);
+unsafe impl<T> Sync for SyncConstPtr<T> {}
+
+impl<T> SyncConstPtr<T> {
+ /// Creates a `SyncConstPointer` from a raw pointer.
+ ///
+ /// Behavior is undefined if `ptr` is actually not
+ /// safe to share across threads.
+ pub const unsafe fn new(ptr: *const T) -> Self {
+ Self(ptr)
+ }
+}
+
+static mut PAGE_SIZE: usize = 0;
+static mut CLOCK_TICKS_PER_SECOND: usize = 0;
+static mut HWCAP: usize = 0;
+static mut HWCAP2: usize = 0;
+static mut SYSINFO_EHDR: SyncConstPtr<Elf_Ehdr> = unsafe { SyncConstPtr::new(null()) };
+static mut PHDR: SyncConstPtr<Elf_Phdr> = unsafe { SyncConstPtr::new(null()) };
+static mut PHNUM: usize = 0;
+static mut EXECFN: SyncConstPtr<c::c_char> = unsafe { SyncConstPtr::new(null()) };
+
+/// On mustang, we export a function to be called during initialization, and
+/// passed a pointer to the original environment variable block set up by the
+/// OS.
+pub(crate) unsafe fn init(envp: *mut *mut u8) {
+ init_from_envp(envp);
+}
+
+/// # Safety
+///
+/// This must be passed a pointer to the environment variable buffer
+/// provided by the kernel, which is followed in memory by the auxv array.
+unsafe fn init_from_envp(mut envp: *mut *mut u8) {
+ while !(*envp).is_null() {
+ envp = envp.add(1);
+ }
+ init_from_auxp(envp.add(1).cast())
+}
+
+/// Process auxv entries from the auxv array pointed to by `auxp`.
+///
+/// # Safety
+///
+/// This must be passed a pointer to an auxv array.
+///
+/// The buffer contains `Elf_aux_t` elements, though it need not be aligned;
+/// function uses `read_unaligned` to read from it.
+unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) {
+ loop {
+ let Elf_auxv_t { a_type, a_val } = read(auxp);
+
+ match a_type as _ {
+ AT_PAGESZ => PAGE_SIZE = a_val as usize,
+ AT_CLKTCK => CLOCK_TICKS_PER_SECOND = a_val as usize,
+ AT_HWCAP => HWCAP = a_val as usize,
+ AT_HWCAP2 => HWCAP2 = a_val as usize,
+ AT_PHDR => PHDR = SyncConstPtr::new(a_val.cast::<Elf_Phdr>()),
+ AT_PHNUM => PHNUM = a_val as usize,
+ AT_PHENT => assert_eq!(a_val as usize, size_of::<Elf_Phdr>()),
+ AT_EXECFN => EXECFN = SyncConstPtr::new(a_val.cast::<c::c_char>()),
+ AT_SYSINFO_EHDR => SYSINFO_EHDR = SyncConstPtr::new(a_val.cast::<Elf_Ehdr>()),
+ AT_NULL => break,
+ _ => (),
+ }
+ auxp = auxp.add(1);
+ }
+}
+
+// ELF ABI
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct Elf_auxv_t {
+ a_type: usize,
+
+ // Some of the values in the auxv array are pointers, so we make `a_val` a
+ // pointer, in order to preserve their provenance. For the values which are
+ // integers, we cast this to `usize`.
+ a_val: *const c_void,
+}
diff --git a/vendor/rustix/src/imp/linux_raw/process/cpu_set.rs b/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs
index 10c5f478e..10c5f478e 100644
--- a/vendor/rustix/src/imp/linux_raw/process/cpu_set.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs
diff --git a/vendor/rustix/src/imp/linux_raw/process/mod.rs b/vendor/rustix/src/backend/linux_raw/process/mod.rs
index 9b2c25f91..9b2c25f91 100644
--- a/vendor/rustix/src/imp/linux_raw/process/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
index 3c833ede7..ac62e6944 100644
--- a/vendor/rustix/src/imp/linux_raw/process/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -21,6 +21,7 @@ use crate::process::{
};
use core::convert::TryInto;
use core::mem::MaybeUninit;
+use core::num::NonZeroU32;
use core::ptr::{null, null_mut};
use linux_raw_sys::general::{
__kernel_gid_t, __kernel_pid_t, __kernel_uid_t, membarrier_cmd, membarrier_cmd_flag, rlimit,
@@ -100,6 +101,37 @@ pub(crate) fn getppid() -> Option<Pid> {
}
#[inline]
+pub(crate) fn getpgid(pid: Option<Pid>) -> io::Result<Pid> {
+ unsafe {
+ let pgid: i32 =
+ ret_usize(syscall_readonly!(__NR_getpgid, c_uint(Pid::as_raw(pid))))? as __kernel_pid_t;
+ Ok(Pid::from_raw_nonzero(NonZeroU32::new_unchecked(
+ pgid as u32,
+ )))
+ }
+}
+
+#[inline]
+pub(crate) fn getpgrp() -> Pid {
+ // Use the `getpgrp` syscall if available.
+ #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
+ unsafe {
+ let pgid: i32 = ret_usize_infallible(syscall_readonly!(__NR_getpgrp)) as __kernel_pid_t;
+ debug_assert!(pgid > 0);
+ Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pgid as u32))
+ }
+
+ // Otherwise use `getpgrp` and pass it zero.
+ #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
+ unsafe {
+ let pgid: i32 =
+ ret_usize_infallible(syscall_readonly!(__NR_getpgid, c_uint(0))) as __kernel_pid_t;
+ debug_assert!(pgid > 0);
+ Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pgid as u32))
+ }
+}
+
+#[inline]
pub(crate) fn getgid() -> Gid {
#[cfg(any(target_arch = "x86", target_arch = "sparc", target_arch = "arm"))]
unsafe {
@@ -307,8 +339,8 @@ pub(crate) fn getrlimit(limit: Resource) -> Rlimit {
&mut result
)) {
Ok(()) => rlimit_from_linux(result.assume_init()),
- Err(e) => {
- debug_assert_eq!(e, io::Errno::NOSYS);
+ Err(err) => {
+ debug_assert_eq!(err, io::Errno::NOSYS);
getrlimit_old(limit)
}
}
@@ -348,7 +380,7 @@ unsafe fn getrlimit_old(limit: Resource) -> Rlimit {
#[inline]
pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> {
unsafe {
- let lim = rlimit_to_linux(new.clone())?;
+ let lim = rlimit_to_linux(new.clone());
match ret(syscall_readonly!(
__NR_prlimit64,
c_uint(0),
@@ -358,7 +390,7 @@ pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> {
)) {
Ok(()) => Ok(()),
Err(io::Errno::NOSYS) => setrlimit_old(limit, new),
- Err(e) => Err(e),
+ Err(err) => Err(err),
}
}
}
@@ -372,7 +404,7 @@ unsafe fn setrlimit_old(limit: Resource, new: Rlimit) -> io::Result<()> {
#[inline]
pub(crate) fn prlimit(pid: Option<Pid>, limit: Resource, new: Rlimit) -> io::Result<Rlimit> {
- let lim = rlimit_to_linux(new)?;
+ let lim = rlimit_to_linux(new);
let mut result = MaybeUninit::<rlimit64>::uninit();
unsafe {
match ret(syscall!(
@@ -383,7 +415,7 @@ pub(crate) fn prlimit(pid: Option<Pid>, limit: Resource, new: Rlimit) -> io::Res
&mut result
)) {
Ok(()) => Ok(rlimit_from_linux(result.assume_init())),
- Err(e) => Err(e),
+ Err(err) => Err(err),
}
}
}
@@ -406,7 +438,7 @@ fn rlimit_from_linux(lim: rlimit64) -> Rlimit {
/// Convert a C `rlimit64` to a Rust `Rlimit`.
#[inline]
-fn rlimit_to_linux(lim: Rlimit) -> io::Result<rlimit64> {
+fn rlimit_to_linux(lim: Rlimit) -> rlimit64 {
let rlim_cur = match lim.current {
Some(r) => r,
None => RLIM64_INFINITY as _,
@@ -415,7 +447,7 @@ fn rlimit_to_linux(lim: Rlimit) -> io::Result<rlimit64> {
Some(r) => r,
None => RLIM64_INFINITY as _,
};
- Ok(rlimit64 { rlim_cur, rlim_max })
+ rlimit64 { rlim_cur, rlim_max }
}
/// Like `rlimit_from_linux` but uses Linux's old 32-bit `rlimit`.
@@ -515,3 +547,14 @@ pub(crate) fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_kill, pass_usize(0), sig)) }
}
+
+#[inline]
+pub(crate) unsafe fn prctl(
+ option: c::c_int,
+ arg2: *mut c::c_void,
+ arg3: *mut c::c_void,
+ arg4: *mut c::c_void,
+ arg5: *mut c::c_void,
+) -> io::Result<c::c_int> {
+ ret_c_int(syscall!(__NR_prctl, c_int(option), arg2, arg3, arg4, arg5))
+}
diff --git a/vendor/rustix/src/imp/linux_raw/process/types.rs b/vendor/rustix/src/backend/linux_raw/process/types.rs
index 53e2c7db1..53e2c7db1 100644
--- a/vendor/rustix/src/imp/linux_raw/process/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/types.rs
diff --git a/vendor/rustix/src/imp/linux_raw/process/wait.rs b/vendor/rustix/src/backend/linux_raw/process/wait.rs
index 701b4ac0c..701b4ac0c 100644
--- a/vendor/rustix/src/imp/linux_raw/process/wait.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/wait.rs
diff --git a/vendor/rustix/src/imp/linux_raw/rand/mod.rs b/vendor/rustix/src/backend/linux_raw/rand/mod.rs
index 1e0181a99..1e0181a99 100644
--- a/vendor/rustix/src/imp/linux_raw/rand/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/rand/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/rand/syscalls.rs b/vendor/rustix/src/backend/linux_raw/rand/syscalls.rs
index 2b5ca28e5..5533f75e0 100644
--- a/vendor/rustix/src/imp/linux_raw/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/rand/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
diff --git a/vendor/rustix/src/imp/linux_raw/rand/types.rs b/vendor/rustix/src/backend/linux_raw/rand/types.rs
index 75f17443e..75f17443e 100644
--- a/vendor/rustix/src/imp/linux_raw/rand/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/rand/types.rs
diff --git a/vendor/rustix/src/imp/linux_raw/reg.rs b/vendor/rustix/src/backend/linux_raw/reg.rs
index afe99c5f4..afe99c5f4 100644
--- a/vendor/rustix/src/imp/linux_raw/reg.rs
+++ b/vendor/rustix/src/backend/linux_raw/reg.rs
diff --git a/vendor/rustix/src/imp/linux_raw/runtime/mod.rs b/vendor/rustix/src/backend/linux_raw/runtime/mod.rs
index 0b48649ce..0b48649ce 100644
--- a/vendor/rustix/src/imp/linux_raw/runtime/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/runtime/syscalls.rs b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
index 49a29b2a2..a331786f9 100644
--- a/vendor/rustix/src/imp/linux_raw/runtime/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -10,8 +10,10 @@ use super::super::c;
#[cfg(target_arch = "x86")]
use super::super::conv::by_mut;
use super::super::conv::{c_int, c_uint, ret, ret_c_uint, ret_error, ret_usize_infallible, zero};
+#[cfg(feature = "fs")]
use crate::fd::BorrowedFd;
use crate::ffi::CStr;
+#[cfg(feature = "fs")]
use crate::fs::AtFlags;
use crate::io;
use crate::process::{Pid, RawNonZeroPid};
@@ -32,6 +34,7 @@ pub(crate) unsafe fn fork() -> io::Result<Option<Pid>> {
Ok(Pid::from_raw(pid))
}
+#[cfg(feature = "fs")]
pub(crate) unsafe fn execveat(
dirfd: BorrowedFd<'_>,
path: &CStr,
diff --git a/vendor/rustix/src/imp/linux_raw/runtime/tls.rs b/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
index 63eed9bbd..43ed25d7d 100644
--- a/vendor/rustix/src/imp/linux_raw/runtime/tls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
@@ -22,15 +22,10 @@ pub(crate) fn startup_tls_info() -> StartupTlsInfo {
// to the process describe a valid phdr array.
unsafe {
for phdr in phdrs {
- match (*phdr).p_type {
- PT_PHDR => {
- base = phdrs
- .as_ptr()
- .cast::<u8>()
- .offset(-((*phdr).p_vaddr as isize))
- }
+ match phdr.p_type {
+ PT_PHDR => base = phdrs.as_ptr().cast::<u8>().offset(-(phdr.p_vaddr as isize)),
PT_TLS => tls_phdr = phdr,
- PT_GNU_STACK => stack_size = (*phdr).p_memsz,
+ PT_GNU_STACK => stack_size = phdr.p_memsz,
_ => {}
}
}
diff --git a/vendor/rustix/src/imp/linux_raw/termios/mod.rs b/vendor/rustix/src/backend/linux_raw/termios/mod.rs
index 1e0181a99..1e0181a99 100644
--- a/vendor/rustix/src/imp/linux_raw/termios/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
index b62a033e0..a8dda5f81 100644
--- a/vendor/rustix/src/imp/linux_raw/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -27,8 +27,8 @@ use linux_raw_sys::ioctl::{
pub(crate) fn tcgetwinsize(fd: BorrowedFd<'_>) -> io::Result<Winsize> {
unsafe {
let mut result = MaybeUninit::<Winsize>::uninit();
- ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGWINSZ), &mut result))
- .map(|()| result.assume_init())
+ ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGWINSZ), &mut result))?;
+ Ok(result.assume_init())
}
}
@@ -36,7 +36,8 @@ pub(crate) fn tcgetwinsize(fd: BorrowedFd<'_>) -> io::Result<Winsize> {
pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
unsafe {
let mut result = MaybeUninit::<Termios>::uninit();
- ret(syscall!(__NR_ioctl, fd, c_uint(TCGETS), &mut result)).map(|()| result.assume_init())
+ ret(syscall!(__NR_ioctl, fd, c_uint(TCGETS), &mut result))?;
+ Ok(result.assume_init())
}
}
@@ -44,11 +45,12 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
let mut result = MaybeUninit::<__kernel_pid_t>::uninit();
- ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGPGRP), &mut result)).map(|()| {
- let pid = result.assume_init();
- debug_assert!(pid > 0);
- Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pid as u32))
- })
+ ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGPGRP), &mut result))?;
+ let pid = result.assume_init();
+ debug_assert!(pid > 0);
+ Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(
+ pid as u32,
+ )))
}
}
@@ -113,11 +115,12 @@ pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
unsafe {
let mut result = MaybeUninit::<__kernel_pid_t>::uninit();
- ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGSID), &mut result)).map(|()| {
- let pid = result.assume_init();
- debug_assert!(pid > 0);
- Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pid as u32))
- })
+ ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGSID), &mut result))?;
+ let pid = result.assume_init();
+ debug_assert!(pid > 0);
+ Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(
+ pid as u32,
+ )))
}
}
@@ -227,7 +230,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
// Gather the ttyname by reading the 'fd' file inside 'proc_self_fd'.
let r =
- super::super::fs::syscalls::readlinkat(proc_self_fd, DecInt::from_fd(&fd).as_c_str(), buf)?;
+ super::super::fs::syscalls::readlinkat(proc_self_fd, DecInt::from_fd(fd).as_c_str(), buf)?;
// If the number of bytes is equal to the buffer length, truncation may
// have occurred. This check also ensures that we have enough space for
diff --git a/vendor/rustix/src/imp/linux_raw/termios/types.rs b/vendor/rustix/src/backend/linux_raw/termios/types.rs
index ce8832455..88db4e1c9 100644
--- a/vendor/rustix/src/imp/linux_raw/termios/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/types.rs
@@ -338,15 +338,19 @@ pub const B1500000: Speed = linux_raw_sys::general::B1500000;
pub const B2000000: Speed = linux_raw_sys::general::B2000000;
/// `B2500000`
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B2500000: Speed = linux_raw_sys::general::B2500000;
/// `B3000000`
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B3000000: Speed = linux_raw_sys::general::B3000000;
/// `B3500000`
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B3500000: Speed = linux_raw_sys::general::B3500000;
/// `B4000000`
+#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64",)))]
pub const B4000000: Speed = linux_raw_sys::general::B4000000;
/// `CSIZE`
diff --git a/vendor/rustix/src/imp/linux_raw/thread/futex.rs b/vendor/rustix/src/backend/linux_raw/thread/futex.rs
index 9e087f9f1..9e087f9f1 100644
--- a/vendor/rustix/src/imp/linux_raw/thread/futex.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/futex.rs
diff --git a/vendor/rustix/src/imp/linux_raw/thread/mod.rs b/vendor/rustix/src/backend/linux_raw/thread/mod.rs
index 8bb80c33a..8bb80c33a 100644
--- a/vendor/rustix/src/imp/linux_raw/thread/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/thread/syscalls.rs b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
index 600b4649d..99c632e7e 100644
--- a/vendor/rustix/src/imp/linux_raw/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
@@ -2,11 +2,15 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
-use super::super::conv::{by_ref, c_int, c_uint, ret, ret_usize, ret_usize_infallible, zero};
+use super::super::c;
+use super::super::conv::{
+ by_ref, c_int, c_uint, ret, ret_c_int, ret_usize, ret_usize_infallible, zero,
+};
+use crate::fd::BorrowedFd;
use crate::io;
use crate::process::{Pid, RawNonZeroPid};
use crate::thread::{ClockId, FutexFlags, FutexOperation, NanosleepRelativeResult, Timespec};
@@ -278,3 +282,9 @@ unsafe fn futex_old(
c_uint(val3)
))
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
+ unsafe { ret_c_int(syscall_readonly!(__NR_setns, fd, c_int(nstype))) }
+}
diff --git a/vendor/rustix/src/imp/linux_raw/time/mod.rs b/vendor/rustix/src/backend/linux_raw/time/mod.rs
index c42592c4f..c42592c4f 100644
--- a/vendor/rustix/src/imp/linux_raw/time/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/mod.rs
diff --git a/vendor/rustix/src/imp/linux_raw/time/syscalls.rs b/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
index 93651e499..6e73a921b 100644
--- a/vendor/rustix/src/imp/linux_raw/time/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
@@ -2,7 +2,7 @@
//!
//! # Safety
//!
-//! See the `rustix::imp` module documentation for details.
+//! See the `rustix::backend` module documentation for details.
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
@@ -12,9 +12,9 @@ use super::super::conv::{ret, ret_infallible};
use super::types::ClockId;
#[cfg(feature = "time")]
use crate::fd::BorrowedFd;
-use crate::io;
#[cfg(feature = "time")]
-use crate::io::OwnedFd;
+use crate::fd::OwnedFd;
+use crate::io;
#[cfg(feature = "time")]
use crate::time::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags};
use core::mem::MaybeUninit;
@@ -88,8 +88,8 @@ pub(crate) fn timerfd_settime(
flags,
by_ref(new_value),
&mut result
- ))
- .map(|()| result.assume_init())
+ ))?;
+ Ok(result.assume_init())
}
#[cfg(target_pointer_width = "32")]
@@ -109,8 +109,8 @@ pub(crate) fn timerfd_settime(
} else {
Err(err)
}
- })
- .map(|()| result.assume_init())
+ })?;
+ Ok(result.assume_init())
}
}
@@ -183,22 +183,22 @@ pub(crate) fn timerfd_gettime(fd: BorrowedFd<'_>) -> io::Result<Itimerspec> {
#[cfg(target_pointer_width = "64")]
unsafe {
- ret(syscall!(__NR_timerfd_gettime, fd, &mut result)).map(|()| result.assume_init())
+ ret(syscall!(__NR_timerfd_gettime, fd, &mut result))?;
+ Ok(result.assume_init())
}
#[cfg(target_pointer_width = "32")]
unsafe {
- ret(syscall!(__NR_timerfd_gettime64, fd, &mut result))
- .or_else(|err| {
- // See the comments in `rustix_clock_gettime_via_syscall` about
- // emulation.
- if err == io::Errno::NOSYS {
- timerfd_gettime_old(fd, &mut result)
- } else {
- Err(err)
- }
- })
- .map(|()| result.assume_init())
+ ret(syscall!(__NR_timerfd_gettime64, fd, &mut result)).or_else(|err| {
+ // See the comments in `rustix_clock_gettime_via_syscall` about
+ // emulation.
+ if err == io::Errno::NOSYS {
+ timerfd_gettime_old(fd, &mut result)
+ } else {
+ Err(err)
+ }
+ })?;
+ Ok(result.assume_init())
}
}
diff --git a/vendor/rustix/src/imp/linux_raw/time/types.rs b/vendor/rustix/src/backend/linux_raw/time/types.rs
index 5a0fcc6f5..5a0fcc6f5 100644
--- a/vendor/rustix/src/imp/linux_raw/time/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/types.rs
diff --git a/vendor/rustix/src/backend/linux_raw/vdso.rs b/vendor/rustix/src/backend/linux_raw/vdso.rs
new file mode 100644
index 000000000..da7910b88
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/vdso.rs
@@ -0,0 +1,310 @@
+//! Parse the Linux vDSO.
+//!
+//! The following code is transliterated from
+//! tools/testing/selftests/vDSO/parse_vdso.c in Linux 5.11, which is licensed
+//! with Creative Commons Zero License, version 1.0,
+//! available at <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
+//!
+//! # Safety
+//!
+//! Parsing the vDSO involves a lot of raw pointer manipulation. This
+//! implementation follows Linux's reference implementation, and adds several
+//! additional safety checks.
+#![allow(unsafe_code)]
+
+use super::c;
+use super::elf::*;
+use crate::ffi::CStr;
+use crate::utils::check_raw_pointer;
+use core::ffi::c_void;
+use core::mem::size_of;
+use core::ptr::{null, null_mut};
+
+pub(super) struct Vdso {
+ // Load information
+ load_addr: *const Elf_Ehdr,
+ load_end: *const c_void, // the end of the `PT_LOAD` segment
+ pv_offset: usize, // recorded paddr - recorded vaddr
+
+ // Symbol table
+ symtab: *const Elf_Sym,
+ symstrings: *const u8,
+ bucket: *const u32,
+ chain: *const u32,
+ nbucket: u32,
+ //nchain: u32,
+
+ // Version table
+ versym: *const u16,
+ verdef: *const Elf_Verdef,
+}
+
+// Straight from the ELF specification.
+fn elf_hash(name: &CStr) -> u32 {
+ let mut h: u32 = 0;
+ for b in name.to_bytes() {
+ h = (h << 4).wrapping_add(u32::from(*b));
+ let g = h & 0xf000_0000;
+ if g != 0 {
+ h ^= g >> 24;
+ }
+ h &= !g;
+ }
+ h
+}
+
+/// Create a `Vdso` value by parsing the vDSO at the `sysinfo_ehdr` address.
+fn init_from_sysinfo_ehdr() -> Option<Vdso> {
+ // Safety: the auxv initialization code does extensive checks to ensure
+ // that the value we get really is an `AT_SYSINFO_EHDR` value from the
+ // kernel.
+ unsafe {
+ let hdr = super::param::auxv::sysinfo_ehdr();
+
+ // If the platform doesn't provide a `AT_SYSINFO_EHDR`, we can't locate
+ // the vDSO.
+ if hdr.is_null() {
+ return None;
+ }
+
+ let mut vdso = Vdso {
+ load_addr: hdr,
+ load_end: hdr.cast(),
+ pv_offset: 0,
+ symtab: null(),
+ symstrings: null(),
+ bucket: null(),
+ chain: null(),
+ nbucket: 0,
+ //nchain: 0,
+ versym: null(),
+ verdef: null(),
+ };
+
+ let hdr = &*hdr;
+ let pt = check_raw_pointer::<Elf_Phdr>(vdso.base_plus(hdr.e_phoff)? as *mut _)?.as_ptr();
+ let mut dyn_: *const Elf_Dyn = null();
+ let mut num_dyn = 0;
+
+ // We need two things from the segment table: the load offset
+ // and the dynamic table.
+ let mut found_vaddr = false;
+ for i in 0..hdr.e_phnum {
+ let phdr = &*pt.add(i as usize);
+ if phdr.p_flags & PF_W != 0 {
+ // Don't trust any vDSO that claims to be loading writable
+ // segments into memory.
+ return None;
+ }
+ if phdr.p_type == PT_LOAD && !found_vaddr {
+ // The segment should be readable and executable, because it
+ // contains the symbol table and the function bodies.
+ if phdr.p_flags & (PF_R | PF_X) != (PF_R | PF_X) {
+ return None;
+ }
+ found_vaddr = true;
+ vdso.load_end = vdso.base_plus(phdr.p_offset.checked_add(phdr.p_memsz)?)?;
+ vdso.pv_offset = phdr.p_offset.wrapping_sub(phdr.p_vaddr);
+ } else if phdr.p_type == PT_DYNAMIC {
+ // If `p_offset` is zero, it's more likely that we're looking at memory
+ // that has been zeroed than that the kernel has somehow aliased the
+ // `Ehdr` and the `Elf_Dyn` array.
+ if phdr.p_offset < size_of::<Elf_Ehdr>() {
+ return None;
+ }
+
+ dyn_ = check_raw_pointer::<Elf_Dyn>(vdso.base_plus(phdr.p_offset)? as *mut _)?
+ .as_ptr();
+ num_dyn = phdr.p_memsz / size_of::<Elf_Dyn>();
+ } else if phdr.p_type == PT_INTERP || phdr.p_type == PT_GNU_RELRO {
+ // Don't trust any ELF image that has an "interpreter" or that uses
+ // RELRO, which is likely to be a user ELF image rather and not the
+ // kernel vDSO.
+ return None;
+ }
+ }
+
+ if !found_vaddr || dyn_.is_null() {
+ return None; // Failed
+ }
+
+ // Fish out the useful bits of the dynamic table.
+ let mut hash: *const u32 = null();
+ vdso.symstrings = null();
+ vdso.symtab = null();
+ vdso.versym = null();
+ vdso.verdef = null();
+ let mut i = 0;
+ loop {
+ if i == num_dyn {
+ return None;
+ }
+ let d = &*dyn_.add(i);
+ match d.d_tag {
+ DT_STRTAB => {
+ vdso.symstrings =
+ check_raw_pointer::<u8>(vdso.addr_from_elf(d.d_val)? as *mut _)?.as_ptr();
+ }
+ DT_SYMTAB => {
+ vdso.symtab =
+ check_raw_pointer::<Elf_Sym>(vdso.addr_from_elf(d.d_val)? as *mut _)?
+ .as_ptr();
+ }
+ DT_HASH => {
+ hash =
+ check_raw_pointer::<u32>(vdso.addr_from_elf(d.d_val)? as *mut _)?.as_ptr();
+ }
+ DT_VERSYM => {
+ vdso.versym =
+ check_raw_pointer::<u16>(vdso.addr_from_elf(d.d_val)? as *mut _)?.as_ptr();
+ }
+ DT_VERDEF => {
+ vdso.verdef =
+ check_raw_pointer::<Elf_Verdef>(vdso.addr_from_elf(d.d_val)? as *mut _)?
+ .as_ptr();
+ }
+ DT_SYMENT => {
+ if d.d_val != size_of::<Elf_Sym>() {
+ return None; // Failed
+ }
+ }
+ DT_NULL => break,
+ _ => {}
+ }
+ i = i.checked_add(1)?;
+ }
+ // The upstream code checks `symstrings`, `symtab`, and `hash` for null;
+ // here, `check_raw_pointer` has already done that.
+
+ if vdso.verdef.is_null() {
+ vdso.versym = null();
+ }
+
+ // Parse the hash table header.
+ vdso.nbucket = *hash.add(0);
+ //vdso.nchain = *hash.add(1);
+ vdso.bucket = hash.add(2);
+ vdso.chain = hash.add(vdso.nbucket as usize + 2);
+
+ // That's all we need.
+ Some(vdso)
+ }
+}
+
+impl Vdso {
+ /// Parse the vDSO.
+ ///
+ /// Returns `None` if the vDSO can't be located or if it doesn't conform
+ /// to our expectations.
+ #[inline]
+ pub(super) fn new() -> Option<Self> {
+ init_from_sysinfo_ehdr()
+ }
+
+ /// Check the version for a symbol.
+ ///
+ /// # Safety
+ ///
+ /// The raw pointers inside `self` must be valid.
+ unsafe fn match_version(&self, mut ver: u16, name: &CStr, hash: u32) -> bool {
+ // This is a helper function to check if the version indexed by
+ // ver matches name (which hashes to hash).
+ //
+ // The version definition table is a mess, and I don't know how
+ // to do this in better than linear time without allocating memory
+ // to build an index. I also don't know why the table has
+ // variable size entries in the first place.
+ //
+ // For added fun, I can't find a comprehensible specification of how
+ // to parse all the weird flags in the table.
+ //
+ // So I just parse the whole table every time.
+
+ // First step: find the version definition
+ ver &= 0x7fff; // Apparently bit 15 means "hidden"
+ let mut def = self.verdef;
+ loop {
+ if (*def).vd_version != VER_DEF_CURRENT {
+ return false; // Failed
+ }
+
+ if ((*def).vd_flags & VER_FLG_BASE) == 0 && ((*def).vd_ndx & 0x7fff) == ver {
+ break;
+ }
+
+ if (*def).vd_next == 0 {
+ return false; // No definition.
+ }
+
+ def = def
+ .cast::<u8>()
+ .add((*def).vd_next as usize)
+ .cast::<Elf_Verdef>();
+ }
+
+ // Now figure out whether it matches.
+ let aux = &*(def.cast::<u8>())
+ .add((*def).vd_aux as usize)
+ .cast::<Elf_Verdaux>();
+ (*def).vd_hash == hash
+ && (name == CStr::from_ptr(self.symstrings.add(aux.vda_name as usize).cast()))
+ }
+
+ /// Look up a symbol in the vDSO.
+ pub(super) fn sym(&self, version: &CStr, name: &CStr) -> *mut c::c_void {
+ let ver_hash = elf_hash(version);
+ let name_hash = elf_hash(name);
+
+ // Safety: The pointers in `self` must be valid.
+ unsafe {
+ let mut chain = *self.bucket.add((name_hash % self.nbucket) as usize);
+
+ while chain != STN_UNDEF {
+ let sym = &*self.symtab.add(chain as usize);
+
+ // Check for a defined global or weak function w/ right name.
+ //
+ // The reference parser in Linux's parse_vdso.c requires
+ // symbols to have type `STT_FUNC`, but on powerpc64, the vDSO
+ // uses `STT_NOTYPE`, so allow that too.
+ if (ELF_ST_TYPE(sym.st_info) != STT_FUNC &&
+ ELF_ST_TYPE(sym.st_info) != STT_NOTYPE)
+ || (ELF_ST_BIND(sym.st_info) != STB_GLOBAL
+ && ELF_ST_BIND(sym.st_info) != STB_WEAK)
+ || sym.st_shndx == SHN_UNDEF
+ || sym.st_shndx == SHN_ABS
+ || ELF_ST_VISIBILITY(sym.st_other) != STV_DEFAULT
+ || (name != CStr::from_ptr(self.symstrings.add(sym.st_name as usize).cast()))
+ // Check symbol version.
+ || (!self.versym.is_null()
+ && !self.match_version(*self.versym.add(chain as usize), version, ver_hash))
+ {
+ chain = *self.chain.add(chain as usize);
+ continue;
+ }
+
+ let sum = self.addr_from_elf(sym.st_value).unwrap();
+ assert!(
+ sum as usize >= self.load_addr as usize
+ && sum as usize <= self.load_end as usize
+ );
+ return sum as *mut c::c_void;
+ }
+ }
+
+ null_mut()
+ }
+
+ /// Add the given address to the vDSO base address.
+ unsafe fn base_plus(&self, offset: usize) -> Option<*const c_void> {
+ // Check for overflow.
+ let _ = (self.load_addr as usize).checked_add(offset)?;
+ // Add the offset to the base.
+ Some(self.load_addr.cast::<u8>().add(offset).cast())
+ }
+
+ /// Translate an ELF-address-space address into a usable virtual address.
+ unsafe fn addr_from_elf(&self, elf_addr: usize) -> Option<*const c_void> {
+ self.base_plus(elf_addr.wrapping_add(self.pv_offset))
+ }
+}
diff --git a/vendor/rustix/src/imp/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
index 80c8dbefd..487835314 100644
--- a/vendor/rustix/src/imp/linux_raw/vdso_wrappers.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
@@ -49,7 +49,7 @@ pub(crate) fn clock_gettime_dynamic(which_clock: DynamicClockId<'_>) -> io::Resu
DynamicClockId::Dynamic(fd) => {
// See `FD_TO_CLOCKID` in Linux's `clock_gettime` documentation.
- use crate::imp::fd::AsRawFd;
+ use crate::backend::fd::AsRawFd;
const CLOCKFD: i32 = 3;
((!fd.as_raw_fd() << 3) | CLOCKFD) as __kernel_clockid_t
}
@@ -86,10 +86,10 @@ pub(crate) fn clock_gettime_dynamic(which_clock: DynamicClockId<'_>) -> io::Resu
#[cfg(target_arch = "x86")]
pub(super) mod x86_via_vdso {
use super::{transmute, ArgReg, Relaxed, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0};
- use crate::imp::arch::asm;
+ use crate::backend::arch::asm;
#[inline]
- pub(in crate::imp) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
+ pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg<R0> {
let callee = match transmute(super::SYSCALL.load(Relaxed)) {
Some(callee) => callee,
None => super::init_syscall(),
@@ -98,7 +98,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall1<'a>(
+ pub(in crate::backend) unsafe fn syscall1<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
) -> RetReg<R0> {
@@ -110,7 +110,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall1_noreturn<'a>(
+ pub(in crate::backend) unsafe fn syscall1_noreturn<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
) -> ! {
@@ -122,7 +122,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall2<'a>(
+ pub(in crate::backend) unsafe fn syscall2<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
a1: ArgReg<'a, A1>,
@@ -135,7 +135,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall3<'a>(
+ pub(in crate::backend) unsafe fn syscall3<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
a1: ArgReg<'a, A1>,
@@ -149,7 +149,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall4<'a>(
+ pub(in crate::backend) unsafe fn syscall4<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
a1: ArgReg<'a, A1>,
@@ -164,7 +164,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall5<'a>(
+ pub(in crate::backend) unsafe fn syscall5<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
a1: ArgReg<'a, A1>,
@@ -180,7 +180,7 @@ pub(super) mod x86_via_vdso {
}
#[inline]
- pub(in crate::imp) unsafe fn syscall6<'a>(
+ pub(in crate::backend) unsafe fn syscall6<'a>(
nr: SyscallNumber<'a>,
a0: ArgReg<'a, A0>,
a1: ArgReg<'a, A1>,
@@ -198,7 +198,7 @@ pub(super) mod x86_via_vdso {
// With the indirect call, it isn't meaningful to do a separate
// `_readonly` optimization.
- pub(in crate::imp) use {
+ pub(in crate::backend) use {
syscall0 as syscall0_readonly, syscall1 as syscall1_readonly,
syscall2 as syscall2_readonly, syscall3 as syscall3_readonly,
syscall4 as syscall4_readonly, syscall5 as syscall5_readonly,
@@ -214,6 +214,7 @@ type ClockGettimeType = unsafe extern "C" fn(c::c_int, *mut Timespec) -> c::c_in
#[cfg(target_arch = "x86")]
pub(super) type SyscallType = unsafe extern "C" fn();
+/// Initialize `CLOCK_GETTIME` and return its value.
fn init_clock_gettime() -> ClockGettimeType {
init();
// Safety: Load the function address from static storage that we
@@ -221,6 +222,7 @@ fn init_clock_gettime() -> ClockGettimeType {
unsafe { transmute(CLOCK_GETTIME.load(Relaxed)) }
}
+/// Initialize `SYSCALL` and return its value.
#[cfg(target_arch = "x86")]
fn init_syscall() -> SyscallType {
init();
@@ -242,7 +244,7 @@ unsafe extern "C" fn rustix_clock_gettime_via_syscall(
) -> c::c_int {
match _rustix_clock_gettime_via_syscall(clockid, res) {
Ok(()) => 0,
- Err(e) => e.raw_os_error().wrapping_neg(),
+ Err(err) => err.raw_os_error().wrapping_neg(),
}
}
diff --git a/vendor/rustix/src/const_assert.rs b/vendor/rustix/src/const_assert.rs
index 8761a4a21..c1dd5498c 100644
--- a/vendor/rustix/src/const_assert.rs
+++ b/vendor/rustix/src/const_assert.rs
@@ -12,6 +12,7 @@ macro_rules! const_assert {
}
#[test]
+#[allow(clippy::missing_const_for_fn)]
fn test_const_assert() {
const_assert!(true);
}
diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs
index 25556304b..a0d6cdecb 100644
--- a/vendor/rustix/src/fs/abs.rs
+++ b/vendor/rustix/src/fs/abs.rs
@@ -1,33 +1,69 @@
//! POSIX-style filesystem functions which operate on bare paths.
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
use crate::fs::StatFs;
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
- target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
-use crate::{imp, io, path};
+use {
+ crate::fs::StatVfs,
+ crate::{backend, io, path},
+};
/// `statfs`—Queries filesystem metadata.
///
+/// Compared to [`statvfs`], this function often provides more information,
+/// though it's less portable.
+///
/// # References
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/statfs.2.html
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
#[inline]
pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> {
- path.into_with_c_str(imp::fs::syscalls::statfs)
+ path.into_with_c_str(backend::fs::syscalls::statfs)
+}
+
+/// `statvfs`—Queries filesystem metadata, POSIX version.
+///
+/// Compared to [`statfs`], this function often provides less information,
+/// but it is more portable. But even so, filesystems are very diverse and not
+/// all the fields are meaningful for every filesystem. And `f_fsid` doesn't
+/// seem to have a clear meaning anywhere.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+#[inline]
+pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> {
+ path.into_with_c_str(backend::fs::syscalls::statvfs)
}
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs
index 2ecd90324..463c247c0 100644
--- a/vendor/rustix/src/fs/at.rs
+++ b/vendor/rustix/src/fs/at.rs
@@ -5,8 +5,9 @@
//!
//! [`cwd`]: crate::fs::cwd
+use crate::fd::OwnedFd;
use crate::ffi::{CStr, CString};
-#[cfg(not(target_os = "illumos"))]
+#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
use crate::fs::Access;
#[cfg(any(target_os = "ios", target_os = "macos"))]
use crate::fs::CloneFlags;
@@ -15,28 +16,27 @@ use crate::fs::FileType;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fs::RenameFlags;
use crate::fs::{AtFlags, Mode, OFlags, Stat, Timestamps};
-use crate::io::{self, OwnedFd};
use crate::path::SMALL_PATH_BUFFER_SIZE;
#[cfg(not(target_os = "wasi"))]
use crate::process::{Gid, Uid};
-use crate::{imp, path};
+use crate::{backend, io, path};
use alloc::vec::Vec;
-use imp::fd::{AsFd, BorrowedFd};
-use imp::time::types::Nsecs;
+use backend::fd::{AsFd, BorrowedFd};
+use backend::time::types::Nsecs;
-pub use imp::fs::types::{Dev, RawMode};
+pub use backend::fs::types::{Dev, RawMode};
/// `UTIME_NOW` for use with [`utimensat`].
///
/// [`utimensat`]: crate::fs::utimensat
#[cfg(not(target_os = "redox"))]
-pub const UTIME_NOW: Nsecs = imp::fs::types::UTIME_NOW as Nsecs;
+pub const UTIME_NOW: Nsecs = backend::fs::types::UTIME_NOW as Nsecs;
/// `UTIME_OMIT` for use with [`utimensat`].
///
/// [`utimensat`]: crate::fs::utimensat
#[cfg(not(target_os = "redox"))]
-pub const UTIME_OMIT: Nsecs = imp::fs::types::UTIME_OMIT as Nsecs;
+pub const UTIME_OMIT: Nsecs = backend::fs::types::UTIME_OMIT as Nsecs;
/// `openat(dirfd, path, oflags, mode)`—Opens a file.
///
@@ -59,7 +59,9 @@ pub fn openat<P: path::Arg, Fd: AsFd>(
oflags: OFlags,
create_mode: Mode,
) -> io::Result<OwnedFd> {
- path.into_with_c_str(|path| imp::fs::syscalls::openat(dirfd.as_fd(), path, oflags, create_mode))
+ path.into_with_c_str(|path| {
+ backend::fs::syscalls::openat(dirfd.as_fd(), path, oflags, create_mode)
+ })
}
/// `readlinkat(fd, path)`—Reads the contents of a symlink.
@@ -89,7 +91,7 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R
buffer.resize(buffer.capacity(), 0_u8);
loop {
- let nread = imp::fs::syscalls::readlinkat(dirfd.as_fd(), path, &mut buffer)?;
+ let nread = backend::fs::syscalls::readlinkat(dirfd.as_fd(), path, &mut buffer)?;
let nread = nread as usize;
assert!(nread <= buffer.len());
@@ -112,7 +114,7 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R
/// [Linux]: https://man7.org/linux/man-pages/man2/mkdirat.2.html
#[inline]
pub fn mkdirat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> {
- path.into_with_c_str(|path| imp::fs::syscalls::mkdirat(dirfd.as_fd(), path, mode))
+ path.into_with_c_str(|path| backend::fs::syscalls::mkdirat(dirfd.as_fd(), path, mode))
}
/// `linkat(old_dirfd, old_path, new_dirfd, new_path, flags)`—Creates a hard
@@ -134,7 +136,7 @@ pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
) -> io::Result<()> {
old_path.into_with_c_str(|old_path| {
new_path.into_with_c_str(|new_path| {
- imp::fs::syscalls::linkat(
+ backend::fs::syscalls::linkat(
old_dirfd.as_fd(),
old_path,
new_dirfd.as_fd(),
@@ -159,7 +161,7 @@ pub fn linkat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/unlinkat.2.html
#[inline]
pub fn unlinkat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<()> {
- path.into_with_c_str(|path| imp::fs::syscalls::unlinkat(dirfd.as_fd(), path, flags))
+ path.into_with_c_str(|path| backend::fs::syscalls::unlinkat(dirfd.as_fd(), path, flags))
}
/// `renameat(old_dirfd, old_path, new_dirfd, new_path)`—Renames a file or
@@ -180,7 +182,12 @@ pub fn renameat<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
) -> io::Result<()> {
old_path.into_with_c_str(|old_path| {
new_path.into_with_c_str(|new_path| {
- imp::fs::syscalls::renameat(old_dirfd.as_fd(), old_path, new_dirfd.as_fd(), new_path)
+ backend::fs::syscalls::renameat(
+ old_dirfd.as_fd(),
+ old_path,
+ new_dirfd.as_fd(),
+ new_path,
+ )
})
})
}
@@ -204,7 +211,7 @@ pub fn renameat_with<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
) -> io::Result<()> {
old_path.into_with_c_str(|old_path| {
new_path.into_with_c_str(|new_path| {
- imp::fs::syscalls::renameat2(
+ backend::fs::syscalls::renameat2(
old_dirfd.as_fd(),
old_path,
new_dirfd.as_fd(),
@@ -231,7 +238,7 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>(
) -> io::Result<()> {
old_path.into_with_c_str(|old_path| {
new_path.into_with_c_str(|new_path| {
- imp::fs::syscalls::symlinkat(old_path, new_dirfd.as_fd(), new_path)
+ backend::fs::syscalls::symlinkat(old_path, new_dirfd.as_fd(), new_path)
})
})
}
@@ -252,7 +259,7 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>(
#[inline]
#[doc(alias = "fstatat")]
pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<Stat> {
- path.into_with_c_str(|path| imp::fs::syscalls::statat(dirfd.as_fd(), path, flags))
+ path.into_with_c_str(|path| backend::fs::syscalls::statat(dirfd.as_fd(), path, flags))
}
/// `faccessat(dirfd, path, access, flags)`—Tests permissions for a file or
@@ -264,7 +271,7 @@ pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io:
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/faccessat.2.html
-#[cfg(not(target_os = "illumos"))]
+#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
#[inline]
#[doc(alias = "faccessat")]
pub fn accessat<P: path::Arg, Fd: AsFd>(
@@ -273,7 +280,7 @@ pub fn accessat<P: path::Arg, Fd: AsFd>(
access: Access,
flags: AtFlags,
) -> io::Result<()> {
- path.into_with_c_str(|path| imp::fs::syscalls::accessat(dirfd.as_fd(), path, access, flags))
+ path.into_with_c_str(|path| backend::fs::syscalls::accessat(dirfd.as_fd(), path, access, flags))
}
/// `utimensat(dirfd, path, times, flags)`—Sets file or directory timestamps.
@@ -291,7 +298,7 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>(
times: &Timestamps,
flags: AtFlags,
) -> io::Result<()> {
- path.into_with_c_str(|path| imp::fs::syscalls::utimensat(dirfd.as_fd(), path, times, flags))
+ path.into_with_c_str(|path| backend::fs::syscalls::utimensat(dirfd.as_fd(), path, times, flags))
}
/// `fchmodat(dirfd, path, mode, 0)`—Sets file or directory permissions.
@@ -312,7 +319,7 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>(
#[inline]
#[doc(alias = "fchmodat")]
pub fn chmodat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> {
- path.into_with_c_str(|path| imp::fs::syscalls::chmodat(dirfd.as_fd(), path, mode))
+ path.into_with_c_str(|path| backend::fs::syscalls::chmodat(dirfd.as_fd(), path, mode))
}
/// `fclonefileat(src, dst_dir, dst, flags)`—Efficiently copies between files.
@@ -330,7 +337,7 @@ pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>(
flags: CloneFlags,
) -> io::Result<()> {
dst.into_with_c_str(|dst| {
- imp::fs::syscalls::fclonefileat(src.as_fd(), dst_dir.as_fd(), &dst, flags)
+ backend::fs::syscalls::fclonefileat(src.as_fd(), dst_dir.as_fd(), dst, flags)
})
}
@@ -352,7 +359,7 @@ pub fn mknodat<P: path::Arg, Fd: AsFd>(
dev: Dev,
) -> io::Result<()> {
path.into_with_c_str(|path| {
- imp::fs::syscalls::mknodat(dirfd.as_fd(), path, file_type, mode, dev)
+ backend::fs::syscalls::mknodat(dirfd.as_fd(), path, file_type, mode, dev)
})
}
@@ -375,6 +382,6 @@ pub fn chownat<P: path::Arg, Fd: AsFd>(
flags: AtFlags,
) -> io::Result<()> {
path.into_with_c_str(|path| {
- imp::fs::syscalls::chownat(dirfd.as_fd(), path, owner, group, flags)
+ backend::fs::syscalls::chownat(dirfd.as_fd(), path, owner, group, flags)
})
}
diff --git a/vendor/rustix/src/fs/constants.rs b/vendor/rustix/src/fs/constants.rs
index b6893a92e..11b53fd2a 100644
--- a/vendor/rustix/src/fs/constants.rs
+++ b/vendor/rustix/src/fs/constants.rs
@@ -1,19 +1,20 @@
//! Filesystem API constants, translated into `bitflags` constants.
-use crate::imp;
+use crate::backend;
-pub use imp::fs::types::{Access, FdFlags, Mode, OFlags};
+pub use crate::io::FdFlags;
+pub use backend::fs::types::{Access, Mode, OFlags};
#[cfg(not(target_os = "redox"))]
-pub use imp::fs::types::AtFlags;
+pub use backend::fs::types::AtFlags;
#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use imp::fs::types::{CloneFlags, CopyfileFlags};
+pub use backend::fs::types::{CloneFlags, CopyfileFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use imp::fs::types::{RenameFlags, ResolveFlags};
+pub use backend::fs::types::{RenameFlags, ResolveFlags};
#[cfg(not(target_os = "redox"))]
-pub use imp::fs::types::Dev;
+pub use backend::fs::types::Dev;
-pub use imp::time::types::{Nsecs, Secs, Timespec};
+pub use backend::time::types::{Nsecs, Secs, Timespec};
diff --git a/vendor/rustix/src/fs/copy_file_range.rs b/vendor/rustix/src/fs/copy_file_range.rs
index b12190472..4b118b30e 100644
--- a/vendor/rustix/src/fs/copy_file_range.rs
+++ b/vendor/rustix/src/fs/copy_file_range.rs
@@ -1,5 +1,5 @@
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
/// `copy_file_range(fd_in, off_in, fd_out, off_out, len, 0)`—Copies data
/// from one file to another.
@@ -16,5 +16,5 @@ pub fn copy_file_range<InFd: AsFd, OutFd: AsFd>(
off_out: Option<&mut u64>,
len: u64,
) -> io::Result<u64> {
- imp::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len)
+ backend::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len)
}
diff --git a/vendor/rustix/src/fs/cwd.rs b/vendor/rustix/src/fs/cwd.rs
index 95f97f85d..d0455cd6c 100644
--- a/vendor/rustix/src/fs/cwd.rs
+++ b/vendor/rustix/src/fs/cwd.rs
@@ -7,8 +7,8 @@
#![allow(unsafe_code)]
-use crate::imp;
-use imp::fd::{BorrowedFd, RawFd};
+use crate::backend;
+use backend::fd::{BorrowedFd, RawFd};
/// `AT_FDCWD`—Returns a handle representing the current working directory.
///
@@ -24,7 +24,7 @@ use imp::fd::{BorrowedFd, RawFd};
#[inline]
#[doc(alias = "AT_FDCWD")]
pub const fn cwd() -> BorrowedFd<'static> {
- let at_fdcwd = imp::io::types::AT_FDCWD as RawFd;
+ let at_fdcwd = backend::io::types::AT_FDCWD as RawFd;
// Safety: `AT_FDCWD` is a reserved value that is never dynamically
// allocated, so it'll remain valid for the duration of `'static`.
diff --git a/vendor/rustix/src/fs/dir.rs b/vendor/rustix/src/fs/dir.rs
index f9d7ff871..94bc0a3ee 100644
--- a/vendor/rustix/src/fs/dir.rs
+++ b/vendor/rustix/src/fs/dir.rs
@@ -1,5 +1,5 @@
//! `Dir` and `Entry`.
-use crate::imp;
+use crate::backend;
-pub use imp::fs::dir::{Dir, DirEntry};
+pub use backend::fs::dir::{Dir, DirEntry};
diff --git a/vendor/rustix/src/fs/fadvise.rs b/vendor/rustix/src/fs/fadvise.rs
index ead3ad9a3..5bc3a588a 100644
--- a/vendor/rustix/src/fs/fadvise.rs
+++ b/vendor/rustix/src/fs/fadvise.rs
@@ -1,7 +1,7 @@
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
-pub use imp::fs::types::Advice;
+pub use backend::fs::types::Advice;
/// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access
/// pattern for a file.
@@ -15,5 +15,5 @@ pub use imp::fs::types::Advice;
#[inline]
#[doc(alias = "posix_fadvise")]
pub fn fadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
- imp::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice)
+ backend::fs::syscalls::fadvise(fd.as_fd(), offset, len, advice)
}
diff --git a/vendor/rustix/src/fs/fcntl.rs b/vendor/rustix/src/fs/fcntl.rs
index 7f89873b5..80ac858c0 100644
--- a/vendor/rustix/src/fs/fcntl.rs
+++ b/vendor/rustix/src/fs/fcntl.rs
@@ -3,38 +3,16 @@
//! a type-safe API, rustix makes them all separate functions so that they
//! can have dedicated static type signatures.
-use crate::imp;
-use crate::io::{self, OwnedFd};
-use imp::fd::{AsFd, RawFd};
-use imp::fs::types::{FdFlags, OFlags};
+use crate::{backend, io};
+use backend::fd::AsFd;
+use backend::fs::types::OFlags;
-/// `fcntl(fd, F_GETFD)`—Returns a file descriptor's flags.
-///
-/// # References
-/// - [POSIX]
-/// - [Linux]
-///
-/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
-/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
-#[inline]
-#[doc(alias = "F_GETFD")]
-pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> {
- imp::fs::syscalls::fcntl_getfd(fd.as_fd())
-}
-
-/// `fcntl(fd, F_SETFD, flags)`—Sets a file descriptor's flags.
-///
-/// # References
-/// - [POSIX]
-/// - [Linux]
-///
-/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
-/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
-#[inline]
-#[doc(alias = "F_SETFD")]
-pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> {
- imp::fs::syscalls::fcntl_setfd(fd.as_fd(), flags)
-}
+// These `fcntl` functions like in the `io` module because they're not specific
+// to files, directories, or memfd objects. We re-export them here in the `fs`
+// module because the other the `fcntl` functions are here.
+#[cfg(not(target_os = "wasi"))]
+pub use crate::io::fcntl_dupfd_cloexec;
+pub use crate::io::{fcntl_getfd, fcntl_setfd};
/// `fcntl(fd, F_GETFL)`—Returns a file descriptor's access mode and status.
///
@@ -47,7 +25,7 @@ pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> {
#[inline]
#[doc(alias = "F_GETFL")]
pub fn fcntl_getfl<Fd: AsFd>(fd: Fd) -> io::Result<OFlags> {
- imp::fs::syscalls::fcntl_getfl(fd.as_fd())
+ backend::fs::syscalls::fcntl_getfl(fd.as_fd())
}
/// `fcntl(fd, F_SETFL, flags)`—Sets a file descriptor's status.
@@ -61,7 +39,7 @@ pub fn fcntl_getfl<Fd: AsFd>(fd: Fd) -> io::Result<OFlags> {
#[inline]
#[doc(alias = "F_SETFL")]
pub fn fcntl_setfl<Fd: AsFd>(fd: Fd, flags: OFlags) -> io::Result<()> {
- imp::fs::syscalls::fcntl_setfl(fd.as_fd(), flags)
+ backend::fs::syscalls::fcntl_setfl(fd.as_fd(), flags)
}
/// `fcntl(fd, F_GET_SEALS)`
@@ -79,7 +57,7 @@ pub fn fcntl_setfl<Fd: AsFd>(fd: Fd, flags: OFlags) -> io::Result<()> {
#[inline]
#[doc(alias = "F_GET_SEALS")]
pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> {
- imp::fs::syscalls::fcntl_get_seals(fd.as_fd())
+ backend::fs::syscalls::fcntl_get_seals(fd.as_fd())
}
#[cfg(any(
@@ -88,7 +66,7 @@ pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> {
target_os = "fuchsia",
target_os = "linux",
))]
-pub use imp::fs::types::SealFlags;
+pub use backend::fs::types::SealFlags;
/// `fcntl(fd, F_ADD_SEALS)`
///
@@ -105,27 +83,5 @@ pub use imp::fs::types::SealFlags;
#[inline]
#[doc(alias = "F_ADD_SEALS")]
pub fn fcntl_add_seals<Fd: AsFd>(fd: Fd, seals: SealFlags) -> io::Result<()> {
- imp::fs::syscalls::fcntl_add_seals(fd.as_fd(), seals)
-}
-
-/// `fcntl(fd, F_DUPFD_CLOEXEC)`—Creates a new `OwnedFd` instance, with value
-/// at least `min`, that has `O_CLOEXEC` set and that shares the same
-/// underlying [file description] as `fd`.
-///
-/// POSIX guarantees that `F_DUPFD_CLOEXEC` will use the lowest unused file
-/// descriptor which is at least `min`, however it is not safe in general to
-/// rely on this, as file descriptors may be unexpectedly allocated on other
-/// threads or in libraries.
-///
-/// # References
-/// - [POSIX]
-/// - [Linux]
-///
-/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
-/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
-#[cfg(not(target_os = "wasi"))]
-#[inline]
-#[doc(alias = "F_DUPFD_CLOEXEC")]
-pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> {
- imp::fs::syscalls::fcntl_dupfd_cloexec(fd.as_fd(), min)
+ backend::fs::syscalls::fcntl_add_seals(fd.as_fd(), seals)
}
diff --git a/vendor/rustix/src/fs/fcntl_darwin.rs b/vendor/rustix/src/fs/fcntl_darwin.rs
index 17d8f844f..6d624ee47 100644
--- a/vendor/rustix/src/fs/fcntl_darwin.rs
+++ b/vendor/rustix/src/fs/fcntl_darwin.rs
@@ -1,5 +1,5 @@
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
/// `fcntl(fd, F_RDADVISE, radvisory { offset, len })`
///
@@ -9,7 +9,7 @@ use imp::fd::AsFd;
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
#[inline]
pub fn fcntl_rdadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64) -> io::Result<()> {
- imp::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len)
+ backend::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len)
}
/// `fcntl(fd, F_FULLFSYNC)`
@@ -20,5 +20,5 @@ pub fn fcntl_rdadvise<Fd: AsFd>(fd: Fd, offset: u64, len: u64) -> io::Result<()>
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
#[inline]
pub fn fcntl_fullfsync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::fs::syscalls::fcntl_fullfsync(fd.as_fd())
+ backend::fs::syscalls::fcntl_fullfsync(fd.as_fd())
}
diff --git a/vendor/rustix/src/fs/fcopyfile.rs b/vendor/rustix/src/fs/fcopyfile.rs
index c5b00ce10..d8931733f 100644
--- a/vendor/rustix/src/fs/fcopyfile.rs
+++ b/vendor/rustix/src/fs/fcopyfile.rs
@@ -1,9 +1,9 @@
use crate::fs::CopyfileFlags;
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
/// `copyfile_state_t`
-pub use imp::fs::types::copyfile_state_t;
+pub use backend::fs::types::copyfile_state_t;
/// `fcopyfile(from, to, state, flags)`
///
@@ -23,7 +23,7 @@ pub unsafe fn fcopyfile<FromFd: AsFd, ToFd: AsFd>(
state: copyfile_state_t,
flags: CopyfileFlags,
) -> io::Result<()> {
- imp::fs::syscalls::fcopyfile(from.as_fd(), to.as_fd(), state, flags)
+ backend::fs::syscalls::fcopyfile(from.as_fd(), to.as_fd(), state, flags)
}
/// `copyfile_state_alloc()`
@@ -34,7 +34,7 @@ pub unsafe fn fcopyfile<FromFd: AsFd, ToFd: AsFd>(
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/fcopyfile.3.html
#[inline]
pub fn copyfile_state_alloc() -> io::Result<copyfile_state_t> {
- imp::fs::syscalls::copyfile_state_alloc()
+ backend::fs::syscalls::copyfile_state_alloc()
}
/// `copyfile_state_free(state)`
@@ -50,7 +50,7 @@ pub fn copyfile_state_alloc() -> io::Result<copyfile_state_t> {
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/fcopyfile.3.html
#[inline]
pub unsafe fn copyfile_state_free(state: copyfile_state_t) -> io::Result<()> {
- imp::fs::syscalls::copyfile_state_free(state)
+ backend::fs::syscalls::copyfile_state_free(state)
}
/// `copyfile_state_get(state, COPYFILE_STATE_COPIED)`
@@ -66,7 +66,7 @@ pub unsafe fn copyfile_state_free(state: copyfile_state_t) -> io::Result<()> {
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/fcopyfile.3.html
#[inline]
pub unsafe fn copyfile_state_get_copied(state: copyfile_state_t) -> io::Result<u64> {
- imp::fs::syscalls::copyfile_state_get_copied(state)
+ backend::fs::syscalls::copyfile_state_get_copied(state)
}
/// `copyfile_state_get(state, flags, dst)`
@@ -86,5 +86,5 @@ pub unsafe fn copyfile_state_get(
flag: u32,
dst: *mut core::ffi::c_void,
) -> io::Result<()> {
- imp::fs::syscalls::copyfile_state_get(state, flag, dst)
+ backend::fs::syscalls::copyfile_state_get(state, flag, dst)
}
diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs
index b41579fb8..6bea89547 100644
--- a/vendor/rustix/src/fs/fd.rs
+++ b/vendor/rustix/src/fs/fd.rs
@@ -5,33 +5,46 @@ use crate::fs::Mode;
use crate::io::SeekFrom;
#[cfg(not(target_os = "wasi"))]
use crate::process::{Gid, Uid};
-use crate::{imp, io};
-use imp::fd::{AsFd, BorrowedFd};
+use crate::{backend, io};
+use backend::fd::{AsFd, BorrowedFd};
-#[cfg(not(target_os = "wasi"))]
-pub use imp::fs::types::FlockOperation;
+#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
+pub use backend::fs::types::FlockOperation;
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::fs::types::FallocateFlags;
+pub use backend::fs::types::FallocateFlags;
-pub use imp::fs::types::Stat;
+pub use backend::fs::types::Stat;
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+pub use backend::fs::types::StatFs;
+
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
-pub use imp::fs::types::StatFs;
+pub use backend::fs::types::{StatVfs, StatVfsMountFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use imp::fs::types::FsWord;
+pub use backend::fs::types::FsWord;
/// Timestamps used by [`utimensat`] and [`futimens`].
///
@@ -55,7 +68,7 @@ pub struct Timestamps {
///
/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub const PROC_SUPER_MAGIC: FsWord = imp::fs::types::PROC_SUPER_MAGIC;
+pub const PROC_SUPER_MAGIC: FsWord = backend::fs::types::PROC_SUPER_MAGIC;
/// The filesystem magic number for NFS.
///
@@ -63,7 +76,7 @@ pub const PROC_SUPER_MAGIC: FsWord = imp::fs::types::PROC_SUPER_MAGIC;
///
/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub const NFS_SUPER_MAGIC: FsWord = imp::fs::types::NFS_SUPER_MAGIC;
+pub const NFS_SUPER_MAGIC: FsWord = backend::fs::types::NFS_SUPER_MAGIC;
/// `lseek(fd, offset, whence)`—Repositions a file descriptor within a file.
///
@@ -75,7 +88,7 @@ pub const NFS_SUPER_MAGIC: FsWord = imp::fs::types::NFS_SUPER_MAGIC;
/// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html
#[inline]
pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> {
- imp::fs::syscalls::seek(fd.as_fd(), pos)
+ backend::fs::syscalls::seek(fd.as_fd(), pos)
}
/// `lseek(fd, 0, SEEK_CUR)`—Returns the current position within a file.
@@ -92,7 +105,7 @@ pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> {
/// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html
#[inline]
pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
- imp::fs::syscalls::tell(fd.as_fd())
+ backend::fs::syscalls::tell(fd.as_fd())
}
/// `fchmod(fd)`—Sets open file or directory permissions.
@@ -109,7 +122,7 @@ pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> {
- imp::fs::syscalls::fchmod(fd.as_fd(), mode)
+ backend::fs::syscalls::fchmod(fd.as_fd(), mode)
}
/// `fchown(fd)`—Sets open file or directory ownership.
@@ -123,7 +136,7 @@ pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> {
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn fchown<Fd: AsFd>(fd: Fd, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
- imp::fs::syscalls::fchown(fd.as_fd(), owner, group)
+ backend::fs::syscalls::fchown(fd.as_fd(), owner, group)
}
/// `fstat(fd)`—Queries metadata for an open file or directory.
@@ -141,24 +154,55 @@ pub fn fchown<Fd: AsFd>(fd: Fd, owner: Option<Uid>, group: Option<Gid>) -> io::R
/// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode
#[inline]
pub fn fstat<Fd: AsFd>(fd: Fd) -> io::Result<Stat> {
- imp::fs::syscalls::fstat(fd.as_fd())
+ backend::fs::syscalls::fstat(fd.as_fd())
}
/// `fstatfs(fd)`—Queries filesystem statistics for an open file or directory.
///
+/// Compared to [`fstatvfs`], this function often provides more information,
+/// though it's less portable.
+///
/// # References
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatfs.2.html
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
-)))] // not implemented in libc for netbsd yet
+)))]
#[inline]
pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> {
- imp::fs::syscalls::fstatfs(fd.as_fd())
+ backend::fs::syscalls::fstatfs(fd.as_fd())
+}
+
+/// `fstatvfs(fd)`—Queries filesystem statistics for an open file or
+/// directory, POSIX version.
+///
+/// Compared to [`fstatfs`], this function often provides less information,
+/// but it is more portable. But even so, filesystems are very diverse and not
+/// all the fields are meaningful for every filesystem. And `f_fsid` doesn't
+/// seem to have a clear meaning anywhere.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+#[inline]
+pub fn fstatvfs<Fd: AsFd>(fd: Fd) -> io::Result<StatVfs> {
+ backend::fs::syscalls::fstatvfs(fd.as_fd())
}
/// `futimens(fd, times)`—Sets timestamps for an open file or directory.
@@ -171,7 +215,7 @@ pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> {
/// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html
#[inline]
pub fn futimens<Fd: AsFd>(fd: Fd, times: &Timestamps) -> io::Result<()> {
- imp::fs::syscalls::futimens(fd.as_fd(), times)
+ backend::fs::syscalls::futimens(fd.as_fd(), times)
}
/// `fallocate(fd, mode, offset, len)`—Adjusts file allocation.
@@ -190,16 +234,18 @@ pub fn futimens<Fd: AsFd>(fd: Fd, times: &Timestamps) -> io::Result<()> {
/// [Linux `fallocate`]: https://man7.org/linux/man-pages/man2/fallocate.2.html
/// [Linux `posix_fallocate`]: https://man7.org/linux/man-pages/man3/posix_fallocate.3.html
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))] // not implemented in libc for netbsd yet
#[inline]
#[doc(alias = "posix_fallocate")]
pub fn fallocate<Fd: AsFd>(fd: Fd, mode: FallocateFlags, offset: u64, len: u64) -> io::Result<()> {
- imp::fs::syscalls::fallocate(fd.as_fd(), mode, offset, len)
+ backend::fs::syscalls::fallocate(fd.as_fd(), mode, offset, len)
}
/// `fcntl(fd, F_GETFL) & O_ACCMODE`
@@ -214,7 +260,7 @@ pub fn is_file_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> {
}
pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
- let mode = imp::fs::syscalls::fcntl_getfl(fd)?;
+ let mode = backend::fs::syscalls::fcntl_getfl(fd)?;
// Check for `O_PATH`.
#[cfg(any(
@@ -252,7 +298,7 @@ pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)
/// [`fcntl_fullfsync`]: https://docs.rs/rustix/*/x86_64-apple-darwin/rustix/fs/fn.fcntl_fullfsync.html
#[inline]
pub fn fsync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::fs::syscalls::fsync(fd.as_fd())
+ backend::fs::syscalls::fsync(fd.as_fd())
}
/// `fdatasync(fd)`—Ensures that file data is written to the underlying
@@ -266,13 +312,14 @@ pub fn fsync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
/// [Linux]: https://man7.org/linux/man-pages/man2/fdatasync.2.html
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
)))]
#[inline]
pub fn fdatasync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::fs::syscalls::fdatasync(fd.as_fd())
+ backend::fs::syscalls::fdatasync(fd.as_fd())
}
/// `ftruncate(fd, length)`—Sets the length of a file.
@@ -285,7 +332,7 @@ pub fn fdatasync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
/// [Linux]: https://man7.org/linux/man-pages/man2/ftruncate.2.html
#[inline]
pub fn ftruncate<Fd: AsFd>(fd: Fd, length: u64) -> io::Result<()> {
- imp::fs::syscalls::ftruncate(fd.as_fd(), length)
+ backend::fs::syscalls::ftruncate(fd.as_fd(), length)
}
/// `flock(fd, operation)`—Acquire or release an advisory lock on an open file.
@@ -294,8 +341,8 @@ pub fn ftruncate<Fd: AsFd>(fd: Fd, length: u64) -> io::Result<()> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/flock.2.html
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
#[inline]
pub fn flock<Fd: AsFd>(fd: Fd, operation: FlockOperation) -> io::Result<()> {
- imp::fs::syscalls::flock(fd.as_fd(), operation)
+ backend::fs::syscalls::flock(fd.as_fd(), operation)
}
diff --git a/vendor/rustix/src/fs/file_type.rs b/vendor/rustix/src/fs/file_type.rs
index 75935c794..cf8fc1d38 100644
--- a/vendor/rustix/src/fs/file_type.rs
+++ b/vendor/rustix/src/fs/file_type.rs
@@ -1,4 +1,4 @@
-use crate::imp;
+use crate::backend;
/// `S_IF*` constants.
-pub use imp::fs::types::FileType;
+pub use backend::fs::types::FileType;
diff --git a/vendor/rustix/src/fs/getpath.rs b/vendor/rustix/src/fs/getpath.rs
index bc40890d1..8e14ff2f2 100644
--- a/vendor/rustix/src/fs/getpath.rs
+++ b/vendor/rustix/src/fs/getpath.rs
@@ -1,6 +1,6 @@
use crate::ffi::CString;
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
/// `fcntl(fd, F_GETPATH)`
///
@@ -10,5 +10,5 @@ use imp::fd::AsFd;
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html
#[inline]
pub fn getpath<Fd: AsFd>(fd: Fd) -> io::Result<CString> {
- imp::fs::syscalls::getpath(fd.as_fd())
+ backend::fs::syscalls::getpath(fd.as_fd())
}
diff --git a/vendor/rustix/src/fs/makedev.rs b/vendor/rustix/src/fs/makedev.rs
index 75cc42540..5793058ff 100644
--- a/vendor/rustix/src/fs/makedev.rs
+++ b/vendor/rustix/src/fs/makedev.rs
@@ -1,5 +1,5 @@
+use crate::backend;
use crate::fs::Dev;
-use crate::imp;
/// `makedev(maj, min)`
///
@@ -9,7 +9,7 @@ use crate::imp;
/// [Linux]: https://man7.org/linux/man-pages/man3/makedev.3.html
#[inline]
pub fn makedev(maj: u32, min: u32) -> Dev {
- imp::fs::makedev::makedev(maj, min)
+ backend::fs::makedev::makedev(maj, min)
}
/// `minor(dev)`
@@ -20,7 +20,7 @@ pub fn makedev(maj: u32, min: u32) -> Dev {
/// [Linux]: https://man7.org/linux/man-pages/man3/minor.3.html
#[inline]
pub fn minor(dev: Dev) -> u32 {
- imp::fs::makedev::minor(dev)
+ backend::fs::makedev::minor(dev)
}
/// `major(dev)`
@@ -31,5 +31,5 @@ pub fn minor(dev: Dev) -> u32 {
/// [Linux]: https://man7.org/linux/man-pages/man3/major.3.html
#[inline]
pub fn major(dev: Dev) -> u32 {
- imp::fs::makedev::major(dev)
+ backend::fs::makedev::major(dev)
}
diff --git a/vendor/rustix/src/fs/memfd_create.rs b/vendor/rustix/src/fs/memfd_create.rs
index 74b432739..dad964777 100644
--- a/vendor/rustix/src/fs/memfd_create.rs
+++ b/vendor/rustix/src/fs/memfd_create.rs
@@ -1,7 +1,7 @@
-use crate::io::{self, OwnedFd};
-use crate::{imp, path};
+use crate::fd::OwnedFd;
+use crate::{backend, io, path};
-pub use imp::fs::types::MemfdFlags;
+pub use backend::fs::types::MemfdFlags;
/// `memfd_create(path, flags)`
///
@@ -11,5 +11,5 @@ pub use imp::fs::types::MemfdFlags;
/// [Linux]: https://man7.org/linux/man-pages/man2/memfd_create.2.html
#[inline]
pub fn memfd_create<P: path::Arg>(path: P, flags: MemfdFlags) -> io::Result<OwnedFd> {
- path.into_with_c_str(|path| imp::fs::syscalls::memfd_create(path, flags))
+ path.into_with_c_str(|path| backend::fs::syscalls::memfd_create(path, flags))
}
diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs
index 49b9c3b51..fa7f93aec 100644
--- a/vendor/rustix/src/fs/mod.rs
+++ b/vendor/rustix/src/fs/mod.rs
@@ -1,9 +1,7 @@
//! Filesystem operations.
-#[cfg(feature = "fs")]
mod abs;
#[cfg(not(target_os = "redox"))]
-#[cfg(any(feature = "fs", feature = "procfs"))]
mod at;
mod constants;
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -11,16 +9,17 @@ mod copy_file_range;
#[cfg(not(target_os = "redox"))]
mod cwd;
#[cfg(not(target_os = "redox"))]
-#[cfg(any(feature = "fs", feature = "procfs"))]
mod dir;
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
mod fadvise;
pub(crate) mod fcntl;
@@ -35,19 +34,20 @@ mod getpath;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
mod makedev;
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
mod memfd_create;
#[cfg(any(target_os = "android", target_os = "linux"))]
-#[cfg(feature = "fs")]
mod openat2;
#[cfg(target_os = "linux")]
mod sendfile;
@@ -55,18 +55,25 @@ mod sendfile;
mod statx;
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
-#[cfg(feature = "fs")]
pub use abs::statfs;
-#[cfg(not(any(target_os = "illumos", target_os = "redox")))]
-#[cfg(feature = "fs")]
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+pub use abs::statvfs;
+#[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "solaris")))]
pub use at::accessat;
#[cfg(any(target_os = "ios", target_os = "macos"))]
-#[cfg(feature = "fs")]
pub use at::fclonefileat;
#[cfg(not(any(
target_os = "ios",
@@ -74,16 +81,12 @@ pub use at::fclonefileat;
target_os = "redox",
target_os = "wasi",
)))]
-#[cfg(feature = "fs")]
pub use at::mknodat;
#[cfg(any(target_os = "android", target_os = "linux"))]
-#[cfg(feature = "fs")]
pub use at::renameat_with;
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[cfg(feature = "fs")]
pub use at::{chmodat, chownat};
#[cfg(not(target_os = "redox"))]
-#[cfg(any(feature = "fs", feature = "procfs"))]
pub use at::{
linkat, mkdirat, openat, readlinkat, renameat, statat, symlinkat, unlinkat, utimensat, RawMode,
UTIME_NOW, UTIME_OMIT,
@@ -105,16 +108,17 @@ pub use copy_file_range::copy_file_range;
#[cfg(not(target_os = "redox"))]
pub use cwd::cwd;
#[cfg(not(target_os = "redox"))]
-#[cfg(any(feature = "fs", feature = "procfs"))]
pub use dir::{Dir, DirEntry};
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use fadvise::{fadvise, Advice};
#[cfg(not(target_os = "wasi"))]
@@ -136,30 +140,44 @@ pub use fcopyfile::{
};
#[cfg(not(any(
target_os = "dragonfly",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "redox",
)))]
pub use fd::fdatasync;
#[cfg(not(any(
+ target_os = "aix",
target_os = "dragonfly",
target_os = "illumos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use fd::{fallocate, FallocateFlags};
#[cfg(not(target_os = "wasi"))]
-pub use fd::{fchmod, fchown, flock, FlockOperation};
+pub use fd::{fchmod, fchown};
+#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
+pub use fd::{flock, FlockOperation};
pub use fd::{fstat, fsync, ftruncate, futimens, is_file_read_write, seek, tell, Stat, Timestamps};
#[cfg(not(any(
+ target_os = "haiku",
target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
-// not implemented in libc for netbsd yet
pub use fd::{fstatfs, StatFs};
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "illumos",
+ target_os = "redox",
+ target_os = "solaris",
+ target_os = "wasi",
+)))]
+pub use fd::{fstatvfs, StatVfs, StatVfsMountFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use fd::{FsWord, NFS_SUPER_MAGIC, PROC_SUPER_MAGIC};
pub use file_type::FileType;
@@ -168,19 +186,20 @@ pub use getpath::getpath;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub use makedev::{major, makedev, minor};
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
pub use memfd_create::{memfd_create, MemfdFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
-#[cfg(feature = "fs")]
pub use openat2::openat2;
#[cfg(target_os = "linux")]
pub use sendfile::sendfile;
diff --git a/vendor/rustix/src/fs/openat2.rs b/vendor/rustix/src/fs/openat2.rs
index d6f77357b..4918e0034 100644
--- a/vendor/rustix/src/fs/openat2.rs
+++ b/vendor/rustix/src/fs/openat2.rs
@@ -1,7 +1,7 @@
-use crate::io::{self, OwnedFd};
-use crate::{imp, path};
-use imp::fd::AsFd;
-use imp::fs::types::{Mode, OFlags, ResolveFlags};
+use crate::fd::OwnedFd;
+use crate::{backend, io, path};
+use backend::fd::AsFd;
+use backend::fs::types::{Mode, OFlags, ResolveFlags};
/// `openat2(dirfd, path, OpenHow { oflags, mode, resolve }, sizeof(OpenHow))`
///
@@ -18,6 +18,6 @@ pub fn openat2<Fd: AsFd, P: path::Arg>(
resolve: ResolveFlags,
) -> io::Result<OwnedFd> {
path.into_with_c_str(|path| {
- imp::fs::syscalls::openat2(dirfd.as_fd(), path, oflags, mode, resolve)
+ backend::fs::syscalls::openat2(dirfd.as_fd(), path, oflags, mode, resolve)
})
}
diff --git a/vendor/rustix/src/fs/sendfile.rs b/vendor/rustix/src/fs/sendfile.rs
index a4d8c24d4..472ad37b2 100644
--- a/vendor/rustix/src/fs/sendfile.rs
+++ b/vendor/rustix/src/fs/sendfile.rs
@@ -1,5 +1,5 @@
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
/// `sendfile(out_fd, in_fd, offset, count)`
///
@@ -15,5 +15,5 @@ pub fn sendfile<OutFd: AsFd, InFd: AsFd>(
offset: Option<&mut u64>,
count: usize,
) -> io::Result<usize> {
- imp::fs::syscalls::sendfile(out_fd.as_fd(), in_fd.as_fd(), offset, count)
+ backend::fs::syscalls::sendfile(out_fd.as_fd(), in_fd.as_fd(), offset, count)
}
diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs
index fa1d36779..383f109ce 100644
--- a/vendor/rustix/src/fs/statx.rs
+++ b/vendor/rustix/src/fs/statx.rs
@@ -3,10 +3,10 @@
use crate::fd::{AsFd, BorrowedFd};
use crate::ffi::CStr;
use crate::fs::AtFlags;
-use crate::{imp, io, path};
+use crate::{backend, io, path};
use core::sync::atomic::{AtomicU8, Ordering};
-pub use imp::fs::types::{Statx, StatxFlags, StatxTimestamp};
+pub use backend::fs::types::{Statx, StatxFlags, StatxTimestamp};
/// `statx(dirfd, path, flags, mask, statxbuf)`
///
@@ -47,7 +47,7 @@ fn _statx(
match STATX_STATE.load(Ordering::Relaxed) {
0 => statx_init(dirfd, path, flags, mask),
1 => Err(io::Errno::NOSYS),
- _ => imp::fs::syscalls::statx(dirfd, path, flags, mask),
+ _ => backend::fs::syscalls::statx(dirfd, path, flags, mask),
}
}
@@ -58,7 +58,7 @@ fn statx_init(
flags: AtFlags,
mask: StatxFlags,
) -> io::Result<Statx> {
- match imp::fs::syscalls::statx(dirfd, path, flags, mask) {
+ match backend::fs::syscalls::statx(dirfd, path, flags, mask) {
Err(io::Errno::NOSYS) => statx_error_nosys(),
Err(io::Errno::PERM) => statx_error_perm(),
result => {
@@ -82,7 +82,7 @@ fn statx_error_perm() -> io::Result<Statx> {
// Some old versions of Docker have `statx` fail with `PERM` when it isn't
// recognized. Check whether `statx` really is available, and if so, fail
// with `PERM`, and if not, treat it like `NOSYS`.
- if imp::fs::syscalls::is_statx_available() {
+ if backend::fs::syscalls::is_statx_available() {
STATX_STATE.store(2, Ordering::Relaxed);
Err(io::Errno::PERM)
} else {
diff --git a/vendor/rustix/src/imp/linux_raw/net/ext.rs b/vendor/rustix/src/imp/linux_raw/net/ext.rs
deleted file mode 100644
index 8556c9d90..000000000
--- a/vendor/rustix/src/imp/linux_raw/net/ext.rs
+++ /dev/null
@@ -1,64 +0,0 @@
-#![allow(unsafe_code)]
-
-use super::super::c;
-
-#[inline]
-pub(crate) const fn in_addr_s_addr(addr: c::in_addr) -> u32 {
- addr.s_addr
-}
-
-#[inline]
-pub(crate) const fn in_addr_new(s_addr: u32) -> c::in_addr {
- c::in_addr { s_addr }
-}
-
-#[cfg(not(feature = "std"))]
-#[inline]
-pub(crate) const fn in6_addr_s6_addr(addr: c::in6_addr) -> [u8; 16] {
- // Safety: `in6_addr` is `repr(C)` and contains plain integer data.
- unsafe { addr.in6_u.u6_addr8 }
-}
-
-// TODO: With Rust 1.55, we can use the above `in6_addr_s6_addr` definition
-// that uses a const-fn union access instead of doing a transmute.
-#[cfg(not(not(feature = "std")))]
-#[inline]
-pub(crate) fn in6_addr_s6_addr(addr: c::in6_addr) -> [u8; 16] {
- // Safety: `in6_addr` is `repr(C)` and contains plain integer data.
- unsafe { core::mem::transmute(addr) }
-}
-
-#[inline]
-pub(crate) const fn in6_addr_new(s6_addr: [u8; 16]) -> c::in6_addr {
- c::in6_addr {
- in6_u: linux_raw_sys::general::in6_addr__bindgen_ty_1 { u6_addr8: s6_addr },
- }
-}
-
-#[inline]
-pub(crate) const fn sockaddr_in6_sin6_scope_id(addr: c::sockaddr_in6) -> u32 {
- addr.sin6_scope_id
-}
-
-#[cfg(not(feature = "std"))]
-#[inline]
-pub(crate) fn sockaddr_in6_sin6_scope_id_mut(addr: &mut c::sockaddr_in6) -> &mut u32 {
- &mut addr.sin6_scope_id
-}
-
-#[inline]
-pub(crate) const fn sockaddr_in6_new(
- sin6_family: c::sa_family_t,
- sin6_port: u16,
- sin6_flowinfo: u32,
- sin6_addr: c::in6_addr,
- sin6_scope_id: u32,
-) -> c::sockaddr_in6 {
- c::sockaddr_in6 {
- sin6_family,
- sin6_port,
- sin6_flowinfo,
- sin6_addr,
- sin6_scope_id,
- }
-}
diff --git a/vendor/rustix/src/imp/linux_raw/param/auxv.rs b/vendor/rustix/src/imp/linux_raw/param/auxv.rs
deleted file mode 100644
index beed8613c..000000000
--- a/vendor/rustix/src/imp/linux_raw/param/auxv.rs
+++ /dev/null
@@ -1,203 +0,0 @@
-//! Linux auxv support.
-//!
-//! # Safety
-//!
-//! This uses raw pointers to locate and read the kernel-provided auxv array.
-#![allow(unsafe_code)]
-
-use super::super::c;
-use super::super::elf::{Elf_Ehdr, Elf_Phdr};
-#[cfg(feature = "param")]
-use crate::ffi::CStr;
-use core::mem::size_of;
-use core::ptr::null;
-#[cfg(feature = "runtime")]
-use core::slice;
-use linux_raw_sys::general::{
- AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_NULL, AT_PAGESZ, AT_PHDR, AT_PHENT, AT_PHNUM,
- AT_SYSINFO_EHDR,
-};
-
-#[cfg(feature = "param")]
-#[inline]
-pub(crate) fn page_size() -> usize {
- auxv().page_size
-}
-
-#[cfg(feature = "param")]
-#[inline]
-pub(crate) fn clock_ticks_per_second() -> u64 {
- auxv().clock_ticks_per_second as u64
-}
-
-#[cfg(feature = "param")]
-#[inline]
-pub(crate) fn linux_hwcap() -> (usize, usize) {
- let auxv = auxv();
- (auxv.hwcap, auxv.hwcap2)
-}
-
-#[cfg(feature = "param")]
-#[inline]
-pub(crate) fn linux_execfn() -> &'static CStr {
- let execfn = auxv().execfn;
-
- // Safety: We assume the `AT_EXECFN` value provided by the kernel is a
- // valid pointer to a valid NUL-terminated array of bytes.
- unsafe { CStr::from_ptr(execfn.cast()) }
-}
-
-#[cfg(feature = "runtime")]
-#[inline]
-pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
- let auxv = auxv();
- (auxv.phdr.cast(), auxv.phnum)
-}
-
-#[cfg(feature = "runtime")]
-#[inline]
-pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
- let auxv = auxv();
-
- // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
- // kernel form a valid slice.
- unsafe { slice::from_raw_parts(auxv.phdr, auxv.phnum) }
-}
-
-#[inline]
-pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
- auxv().sysinfo_ehdr
-}
-
-#[inline]
-fn auxv() -> &'static Auxv {
- // Safety: `AUXV` is initialized from the `.init_array`, and we never
- // mutate it thereafter, so it's effectively initialized read-only in all
- // other code.
- unsafe {
- // Assert that the initialization has happened. On glibc and musl, this
- // is handled automatically by `.init_array` functions. Otherwise,
- // `rustix::process::init` must be called explicitly.
- debug_assert_ne!(AUXV.page_size, 0);
-
- &AUXV
- }
-}
-
-/// A struct for holding fields obtained from the kernel-provided auxv array.
-struct Auxv {
- page_size: usize,
- clock_ticks_per_second: usize,
- hwcap: usize,
- hwcap2: usize,
- sysinfo_ehdr: *const Elf_Ehdr,
- phdr: *const Elf_Phdr,
- phnum: usize,
- execfn: *const c::c_char,
-}
-
-/// Data obtained from the kernel-provided auxv array. This is initialized at
-/// program startup below.
-static mut AUXV: Auxv = Auxv {
- page_size: 0,
- clock_ticks_per_second: 0,
- hwcap: 0,
- hwcap2: 0,
- sysinfo_ehdr: null(),
- phdr: null(),
- phnum: 0,
- execfn: null(),
-};
-
-/// GLIBC passes argc, argv, and envp to functions in .init_array, as a
-/// non-standard extension. Use priority 99 so that we run before any
-/// normal user-defined constructor functions.
-#[cfg(all(target_env = "gnu", not(target_vendor = "mustang")))]
-#[used]
-#[link_section = ".init_array.00099"]
-static INIT_ARRAY: unsafe extern "C" fn(c::c_int, *mut *mut u8, *mut *mut u8) = {
- unsafe extern "C" fn function(_argc: c::c_int, _argv: *mut *mut u8, envp: *mut *mut u8) {
- init_from_envp(envp);
- }
- function
-};
-
-/// For musl, assume that `__environ` is available and points to the original
-/// environment from the kernel, so we can find the auxv array in memory after
-/// it. Use priority 99 so that we run before any normal user-defined
-/// constructor functions.
-///
-/// <https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib---environ.html>
-#[cfg(all(target_env = "musl", not(target_vendor = "mustang")))]
-#[used]
-#[link_section = ".init_array.00099"]
-static INIT_ARRAY: unsafe extern "C" fn() = {
- unsafe extern "C" fn function() {
- extern "C" {
- static __environ: *mut *mut u8;
- }
-
- init_from_envp(__environ)
- }
- function
-};
-
-/// On mustang or any non-musl non-glibic platform where we don't know that we
-/// have `.init_array`, we export a function to be called during
-/// initialization, and passed a pointer to the original environment variable
-/// block set up by the OS.
-#[cfg(any(
- target_vendor = "mustang",
- not(any(target_env = "gnu", target_env = "musl")),
-))]
-#[inline]
-pub(crate) unsafe fn init(envp: *mut *mut u8) {
- init_from_envp(envp);
-}
-
-/// # Safety
-///
-/// This must be passed a pointer to the environment variable buffer
-/// provided by the kernel, which is followed in memory by the auxv array.
-unsafe fn init_from_envp(mut envp: *mut *mut u8) {
- while !(*envp).is_null() {
- envp = envp.add(1);
- }
- init_from_auxp(envp.add(1).cast())
-}
-
-/// # Safety
-///
-/// This must be passed a pointer to the auxv array provided by the kernel.
-unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) {
- loop {
- let Elf_auxv_t { a_type, a_val } = *auxp;
- match a_type as _ {
- AT_PAGESZ => AUXV.page_size = a_val as usize,
- AT_CLKTCK => AUXV.clock_ticks_per_second = a_val as usize,
- AT_HWCAP => AUXV.hwcap = a_val as usize,
- AT_HWCAP2 => AUXV.hwcap2 = a_val as usize,
- AT_SYSINFO_EHDR => AUXV.sysinfo_ehdr = a_val.cast(),
- AT_PHDR => AUXV.phdr = a_val.cast(),
- AT_PHNUM => AUXV.phnum = a_val as usize,
- AT_PHENT => assert_eq!(a_val as usize, size_of::<Elf_Phdr>()),
- AT_EXECFN => AUXV.execfn = a_val.cast(),
- AT_NULL => break,
- _ => (),
- }
- auxp = auxp.add(1);
- }
-}
-
-// ELF ABI
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct Elf_auxv_t {
- a_type: usize,
-
- // Some of the values in the auxv array are pointers, so we make `a_val` a
- // pointer, in order to preserve their provenance. For the values which are
- // integers, we cast this to `usize`.
- a_val: *const (),
-}
diff --git a/vendor/rustix/src/imp/linux_raw/param/mod.rs b/vendor/rustix/src/imp/linux_raw/param/mod.rs
deleted file mode 100644
index 2cb2fe78a..000000000
--- a/vendor/rustix/src/imp/linux_raw/param/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-pub(crate) mod auxv;
diff --git a/vendor/rustix/src/imp/linux_raw/vdso.rs b/vendor/rustix/src/imp/linux_raw/vdso.rs
deleted file mode 100644
index bda0a4773..000000000
--- a/vendor/rustix/src/imp/linux_raw/vdso.rs
+++ /dev/null
@@ -1,435 +0,0 @@
-//! Parse the Linux vDSO.
-//!
-//! The following code is transliterated from
-//! tools/testing/selftests/vDSO/parse_vdso.c in Linux 5.11, which is licensed
-//! with Creative Commons Zero License, version 1.0,
-//! available at <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
-//!
-//! # Safety
-//!
-//! Parsing the vDSO involves a lot of raw pointer manipulation. This
-//! implementation follows Linux's reference implementation, and adds several
-//! additional safety checks.
-#![allow(unsafe_code)]
-
-use super::c;
-use super::elf::*;
-use super::mm::syscalls::madvise;
-use super::mm::types::Advice;
-use crate::ffi::CStr;
-use crate::io;
-use core::ffi::c_void;
-use core::mem::{align_of, size_of};
-use core::ptr::{null, null_mut};
-
-pub(super) struct Vdso {
- // Load information
- load_addr: *const Elf_Ehdr,
- load_end: *const c_void, // the end of the `PT_LOAD` segment
- pv_offset: usize, // recorded paddr - recorded vaddr
-
- // Symbol table
- symtab: *const Elf_Sym,
- symstrings: *const u8,
- bucket: *const u32,
- chain: *const u32,
- nbucket: u32,
- //nchain: u32,
-
- // Version table
- versym: *const u16,
- verdef: *const Elf_Verdef,
-}
-
-// Straight from the ELF specification.
-fn elf_hash(name: &CStr) -> u32 {
- let mut h: u32 = 0;
- for b in name.to_bytes() {
- h = (h << 4).wrapping_add(u32::from(*b));
- let g = h & 0xf000_0000;
- if g != 0 {
- h ^= g >> 24;
- }
- h &= !g;
- }
- h
-}
-
-/// Cast `value` to a pointer type, doing some checks for validity.
-fn make_pointer<T>(value: *const c_void) -> Option<*const T> {
- if value.is_null()
- || (value as usize).checked_add(size_of::<T>()).is_none()
- || (value as usize) % align_of::<T>() != 0
- {
- return None;
- }
-
- Some(value.cast())
-}
-
-/// Create a `Vdso` value by parsing the vDSO at the given address.
-///
-/// # Safety
-///
-/// `base` must be a valid pointer to an ELF image in memory.
-unsafe fn init_from_sysinfo_ehdr(base: *const Elf_Ehdr) -> Option<Vdso> {
- // Check that `base` is a valid pointer to the kernel-provided vDSO.
- let hdr = check_vdso_base(base)?;
-
- let mut vdso = Vdso {
- load_addr: base,
- load_end: base.cast(),
- pv_offset: 0,
- symtab: null(),
- symstrings: null(),
- bucket: null(),
- chain: null(),
- nbucket: 0,
- //nchain: 0,
- versym: null(),
- verdef: null(),
- };
-
- let pt = make_pointer::<Elf_Phdr>(vdso.base_plus(hdr.e_phoff)?)?;
- let mut dyn_: *const Elf_Dyn = null();
- let mut num_dyn = 0;
-
- // We need two things from the segment table: the load offset
- // and the dynamic table.
- let mut found_vaddr = false;
- for i in 0..hdr.e_phnum {
- let phdr = &*pt.add(i as usize);
- if phdr.p_flags & PF_W != 0 {
- // Don't trust any vDSO that claims to be loading writable
- // segments into memory.
- return None;
- }
- if phdr.p_type == PT_LOAD && !found_vaddr {
- // The segment should be readable and executable, because it
- // contains the symbol table and the function bodies.
- if phdr.p_flags & (PF_R | PF_X) != (PF_R | PF_X) {
- return None;
- }
- found_vaddr = true;
- vdso.load_end = vdso.base_plus(phdr.p_offset.checked_add(phdr.p_memsz)?)?;
- vdso.pv_offset = phdr.p_offset.wrapping_sub(phdr.p_vaddr);
- } else if phdr.p_type == PT_DYNAMIC {
- // If `p_offset` is zero, it's more likely that we're looking at memory
- // that has been zeroed than that the kernel has somehow aliased the
- // `Ehdr` and the `Elf_Dyn` array.
- if phdr.p_offset < size_of::<Elf_Ehdr>() {
- return None;
- }
-
- dyn_ = make_pointer::<Elf_Dyn>(vdso.base_plus(phdr.p_offset)?)?;
- num_dyn = phdr.p_memsz / size_of::<Elf_Dyn>();
- } else if phdr.p_type == PT_INTERP || phdr.p_type == PT_GNU_RELRO {
- // Don't trust any ELF image that has an "interpreter" or that uses
- // RELRO, which is likely to be a user ELF image rather and not the
- // kernel vDSO.
- return None;
- }
- }
-
- if !found_vaddr || dyn_.is_null() {
- return None; // Failed
- }
-
- // Fish out the useful bits of the dynamic table.
- let mut hash: *const u32 = null();
- vdso.symstrings = null();
- vdso.symtab = null();
- vdso.versym = null();
- vdso.verdef = null();
- let mut i = 0;
- loop {
- if i == num_dyn {
- return None;
- }
- let d = &*dyn_.add(i);
- match d.d_tag {
- DT_STRTAB => {
- vdso.symstrings = make_pointer::<u8>(vdso.addr_from_elf(d.d_val)?)?;
- }
- DT_SYMTAB => {
- vdso.symtab = make_pointer::<Elf_Sym>(vdso.addr_from_elf(d.d_val)?)?;
- }
- DT_HASH => {
- hash = make_pointer::<u32>(vdso.addr_from_elf(d.d_val)?)?;
- }
- DT_VERSYM => {
- vdso.versym = make_pointer::<u16>(vdso.addr_from_elf(d.d_val)?)?;
- }
- DT_VERDEF => {
- vdso.verdef = make_pointer::<Elf_Verdef>(vdso.addr_from_elf(d.d_val)?)?;
- }
- DT_SYMENT => {
- if d.d_val != size_of::<Elf_Sym>() {
- return None; // Failed
- }
- }
- DT_NULL => break,
- _ => {}
- }
- i = i.checked_add(1)?;
- }
- if vdso.symstrings.is_null() || vdso.symtab.is_null() || hash.is_null() {
- return None; // Failed
- }
-
- if vdso.verdef.is_null() {
- vdso.versym = null();
- }
-
- // Parse the hash table header.
- vdso.nbucket = *hash.add(0);
- //vdso.nchain = *hash.add(1);
- vdso.bucket = hash.add(2);
- vdso.chain = hash.add(vdso.nbucket as usize + 2);
-
- // That's all we need.
- Some(vdso)
-}
-
-/// Check that `base` is a valid pointer to the kernel-provided vDSO.
-///
-/// `base` is some value we got from a `AT_SYSINFO_EHDR` aux record somewhere,
-/// which hopefully holds the value of the kernel-provided vDSO in memory. Do a
-/// series of checks to be as sure as we can that it's safe to use.
-unsafe fn check_vdso_base<'vdso>(base: *const Elf_Ehdr) -> Option<&'vdso Elf_Ehdr> {
- // In theory, we could check that we're not attempting to parse our own ELF
- // image, as an additional check. However, older Linux toolchains don't
- // support this, and Rust's `#[linkage = "extern_weak"]` isn't stable yet,
- // so just disable this for now.
- /*
- {
- extern "C" {
- static __ehdr_start: c::c_void;
- }
-
- let ehdr_start: *const c::c_void = &__ehdr_start;
- if base == ehdr_start {
- return None;
- }
- }
- */
-
- let hdr = &*make_pointer::<Elf_Ehdr>(base.cast())?;
-
- // Check that the vDSO is page-aligned and appropriately mapped. We call
- // this after `make_pointer` so that we don't do a syscall if there's no
- // chance the pointer is valid.
- madvise(base as *mut c_void, size_of::<Elf_Ehdr>(), Advice::Normal).ok()?;
-
- if hdr.e_ident[..SELFMAG] != ELFMAG {
- return None; // Wrong ELF magic
- }
- if hdr.e_ident[EI_CLASS] != ELFCLASS {
- return None; // Wrong ELF class
- }
- if hdr.e_ident[EI_DATA] != ELFDATA {
- return None; // Wrong ELF data
- }
- if !matches!(hdr.e_ident[EI_OSABI], ELFOSABI_SYSV | ELFOSABI_LINUX) {
- return None; // Unrecognized ELF OS ABI
- }
- if hdr.e_ident[EI_ABIVERSION] != ELFABIVERSION {
- return None; // Unrecognized ELF ABI version
- }
- if hdr.e_type != ET_DYN {
- return None; // Wrong ELF type
- }
- // Verify that the `e_machine` matches the architecture we're running as.
- // This helps catch cases where we're running under qemu.
- if hdr.e_machine != EM_CURRENT {
- return None; // Wrong machine type
- }
-
- // If ELF is extended, we'll need to adjust.
- if hdr.e_ident[EI_VERSION] != EV_CURRENT
- || hdr.e_ehsize as usize != size_of::<Elf_Ehdr>()
- || hdr.e_phentsize as usize != size_of::<Elf_Phdr>()
- {
- return None;
- }
- // We don't currently support extra-large numbers of segments.
- if hdr.e_phnum == PN_XNUM {
- return None;
- }
-
- // If `e_phoff` is zero, it's more likely that we're looking at memory that
- // has been zeroed than that the kernel has somehow aliased the `Ehdr` and
- // the `Phdr`.
- if hdr.e_phoff < size_of::<Elf_Ehdr>() {
- return None;
- }
-
- // Check that the vDSO is not writable, since that would indicate that this
- // isn't the kernel vDSO. Here we're just using `clock_getres` just as an
- // arbitrary system call which writes to a buffer and fails with `EFAULT`
- // if the buffer is not writable.
- {
- use super::conv::ret;
- use super::time::types::ClockId;
- if ret(syscall!(__NR_clock_getres, ClockId::Monotonic, base)) != Err(io::Errno::FAULT) {
- // We can't gracefully fail here because we would seem to have just
- // mutated some unknown memory.
- #[cfg(feature = "std")]
- {
- std::process::abort();
- }
- #[cfg(all(not(feature = "std"), feature = "rustc-dep-of-std"))]
- {
- core::intrinsics::abort();
- }
- }
- }
-
- Some(hdr)
-}
-
-impl Vdso {
- /// Parse the vDSO.
- ///
- /// Returns None if the vDSO can't be located or if it doesn't conform
- /// to our expectations.
- #[inline]
- pub(super) fn new() -> Option<Self> {
- init_from_auxv()
- }
-
- /// Check the version for a symbol.
- ///
- /// # Safety
- ///
- /// The raw pointers inside `self` must be valid.
- unsafe fn match_version(&self, mut ver: u16, name: &CStr, hash: u32) -> bool {
- // This is a helper function to check if the version indexed by
- // ver matches name (which hashes to hash).
- //
- // The version definition table is a mess, and I don't know how
- // to do this in better than linear time without allocating memory
- // to build an index. I also don't know why the table has
- // variable size entries in the first place.
- //
- // For added fun, I can't find a comprehensible specification of how
- // to parse all the weird flags in the table.
- //
- // So I just parse the whole table every time.
-
- // First step: find the version definition
- ver &= 0x7fff; // Apparently bit 15 means "hidden"
- let mut def = self.verdef;
- loop {
- if (*def).vd_version != VER_DEF_CURRENT {
- return false; // Failed
- }
-
- if ((*def).vd_flags & VER_FLG_BASE) == 0 && ((*def).vd_ndx & 0x7fff) == ver {
- break;
- }
-
- if (*def).vd_next == 0 {
- return false; // No definition.
- }
-
- def = def
- .cast::<u8>()
- .add((*def).vd_next as usize)
- .cast::<Elf_Verdef>();
- }
-
- // Now figure out whether it matches.
- let aux = &*(def.cast::<u8>())
- .add((*def).vd_aux as usize)
- .cast::<Elf_Verdaux>();
- (*def).vd_hash == hash
- && (name == CStr::from_ptr(self.symstrings.add(aux.vda_name as usize).cast()))
- }
-
- /// Look up a symbol in the vDSO.
- pub(super) fn sym(&self, version: &CStr, name: &CStr) -> *mut c::c_void {
- let ver_hash = elf_hash(version);
- let name_hash = elf_hash(name);
-
- // Safety: The pointers in `self` must be valid.
- unsafe {
- let mut chain = *self.bucket.add((name_hash % self.nbucket) as usize);
-
- while chain != STN_UNDEF {
- let sym = &*self.symtab.add(chain as usize);
-
- // Check for a defined global or weak function w/ right name.
- //
- // The reference parser in Linux's parse_vdso.c requires
- // symbols to have type `STT_FUNC`, but on powerpc64, the vDSO
- // uses `STT_NOTYPE`, so allow that too.
- if (ELF_ST_TYPE(sym.st_info) != STT_FUNC &&
- ELF_ST_TYPE(sym.st_info) != STT_NOTYPE)
- || (ELF_ST_BIND(sym.st_info) != STB_GLOBAL
- && ELF_ST_BIND(sym.st_info) != STB_WEAK)
- || sym.st_shndx == SHN_UNDEF
- || sym.st_shndx == SHN_ABS
- || ELF_ST_VISIBILITY(sym.st_other) != STV_DEFAULT
- || (name != CStr::from_ptr(self.symstrings.add(sym.st_name as usize).cast()))
- // Check symbol version.
- || (!self.versym.is_null()
- && !self.match_version(*self.versym.add(chain as usize), version, ver_hash))
- {
- chain = *self.chain.add(chain as usize);
- continue;
- }
-
- let sum = self.addr_from_elf(sym.st_value).unwrap();
- assert!(
- sum as usize >= self.load_addr as usize
- && sum as usize <= self.load_end as usize
- );
- return sum as *mut c::c_void;
- }
- }
-
- null_mut()
- }
-
- /// Add the given address to the vDSO base address.
- unsafe fn base_plus(&self, offset: usize) -> Option<*const c_void> {
- // Check for overflow.
- let _ = (self.load_addr as usize).checked_add(offset)?;
- // Add the offset to the base.
- Some(self.load_addr.cast::<u8>().add(offset).cast())
- }
-
- /// Translate an ELF-address-space address into a usable virtual address.
- unsafe fn addr_from_elf(&self, elf_addr: usize) -> Option<*const c_void> {
- self.base_plus(elf_addr.wrapping_add(self.pv_offset))
- }
-}
-
-// Find the `AT_SYSINFO_EHDR` in auxv records in memory. We have our own code
-// for reading the auxv records in memory, so we don't currently use this.
-//
-// # Safety
-//
-// `elf_auxv` must point to a valid array of AUXV records terminated by an
-// `AT_NULL` record.
-/*
-unsafe fn init_from_auxv(elf_auxv: *const Elf_auxv_t) -> Option<Vdso> {
- let mut i = 0;
- while (*elf_auxv.add(i)).a_type != AT_NULL {
- if (*elf_auxv.add(i)).a_type == AT_SYSINFO_EHDR {
- return init_from_sysinfo_ehdr((*elf_auxv.add(i)).a_val);
- }
- i += 1;
- }
-
- None
-}
-*/
-
-/// Find the vDSO image by following the `AT_SYSINFO_EHDR` auxv record pointer.
-fn init_from_auxv() -> Option<Vdso> {
- // Safety: `sysinfo_ehdr` does extensive checks to ensure that the value
- // we get really is an `AT_SYSINFO_EHDR` value from the kernel.
- unsafe { init_from_sysinfo_ehdr(super::param::auxv::sysinfo_ehdr()) }
-}
diff --git a/vendor/rustix/src/io/close.rs b/vendor/rustix/src/io/close.rs
index 2116f53bd..b286d2368 100644
--- a/vendor/rustix/src/io/close.rs
+++ b/vendor/rustix/src/io/close.rs
@@ -5,8 +5,8 @@
//! Operating on raw file descriptors is unsafe.
#![allow(unsafe_code)]
-use crate::imp;
-use imp::fd::RawFd;
+use crate::backend;
+use backend::fd::RawFd;
/// `close(raw_fd)`—Closes a `RawFd` directly.
///
@@ -37,5 +37,5 @@ use imp::fd::RawFd;
/// not valid after the call.
#[inline]
pub unsafe fn close(raw_fd: RawFd) {
- imp::io::syscalls::close(raw_fd)
+ backend::io::syscalls::close(raw_fd)
}
diff --git a/vendor/rustix/src/io/dup.rs b/vendor/rustix/src/io/dup.rs
index ffa0401f2..8da6aa091 100644
--- a/vendor/rustix/src/io/dup.rs
+++ b/vendor/rustix/src/io/dup.rs
@@ -1,11 +1,11 @@
//! Functions which duplicate file descriptors.
-use crate::imp;
-use crate::io::{self, OwnedFd};
-use imp::fd::AsFd;
+use crate::fd::OwnedFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
#[cfg(not(target_os = "wasi"))]
-pub use imp::io::types::DupFlags;
+pub use backend::io::types::DupFlags;
/// `dup(fd)`—Creates a new `OwnedFd` instance that shares the same
/// underlying [file description] as `fd`.
@@ -23,14 +23,14 @@ pub use imp::io::types::DupFlags;
/// - [Apple]
///
/// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258
-/// [`fcntl_dupfd_cloexec`]: crate::fs::fcntl_dupfd_cloexec
+/// [`fcntl_dupfd_cloexec`]: crate::io::fcntl_dupfd_cloexec
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html
/// [Linux]: https://man7.org/linux/man-pages/man2/dup.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/dup.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> {
- imp::io::syscalls::dup(fd.as_fd())
+ backend::io::syscalls::dup(fd.as_fd())
}
/// `dup2(fd, new)`—Changes the [file description] of a file descriptor.
@@ -50,14 +50,14 @@ pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> {
/// - [Apple]
///
/// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258
-/// [`fcntl_dupfd_cloexec`]: crate::fs::fcntl_dupfd_cloexec
+/// [`fcntl_dupfd_cloexec`]: crate::io::fcntl_dupfd_cloexec
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html
/// [Linux]: https://man7.org/linux/man-pages/man2/dup2.2.html
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/dup2.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> {
- imp::io::syscalls::dup2(fd.as_fd(), new)
+ backend::io::syscalls::dup2(fd.as_fd(), new)
}
/// `dup3(fd, new, flags)`—Changes the [file description] of a file
@@ -73,8 +73,8 @@ pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> {
///
/// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258
/// [Linux]: https://man7.org/linux/man-pages/man2/dup3.2.html
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "aix", target_os = "wasi")))]
#[inline]
pub fn dup3<Fd: AsFd>(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> {
- imp::io::syscalls::dup3(fd.as_fd(), new, flags)
+ backend::io::syscalls::dup3(fd.as_fd(), new, flags)
}
diff --git a/vendor/rustix/src/io/errno.rs b/vendor/rustix/src/io/errno.rs
index 84ced6a37..f39573797 100644
--- a/vendor/rustix/src/io/errno.rs
+++ b/vendor/rustix/src/io/errno.rs
@@ -4,7 +4,7 @@
//! enum because we may not know about all of the host's error values
//! and we don't want unrecognized values to create UB.
-use crate::imp;
+use crate::backend;
use core::{fmt, result};
#[cfg(feature = "std")]
use std::error;
@@ -25,7 +25,7 @@ pub type Result<T> = result::Result<T, Errno>;
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html
/// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html
-pub use imp::io::errno::Errno;
+pub use backend::io::errno::Errno;
impl Errno {
/// Shorthand for `std::io::Error::from(self).kind()`.
diff --git a/vendor/rustix/src/io/eventfd.rs b/vendor/rustix/src/io/eventfd.rs
index 53e9d11f0..22ffc627c 100644
--- a/vendor/rustix/src/io/eventfd.rs
+++ b/vendor/rustix/src/io/eventfd.rs
@@ -1,7 +1,7 @@
-use crate::imp;
-use crate::io::{self, OwnedFd};
+use crate::fd::OwnedFd;
+use crate::{backend, io};
-pub use imp::io::types::EventfdFlags;
+pub use backend::io::types::EventfdFlags;
/// `eventfd(initval, flags)`—Creates a file descriptor for event
/// notification.
@@ -12,5 +12,5 @@ pub use imp::io::types::EventfdFlags;
/// [Linux]: https://man7.org/linux/man-pages/man2/eventfd.2.html
#[inline]
pub fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> {
- imp::io::syscalls::eventfd(initval, flags)
+ backend::io::syscalls::eventfd(initval, flags)
}
diff --git a/vendor/rustix/src/io/fcntl.rs b/vendor/rustix/src/io/fcntl.rs
new file mode 100644
index 000000000..109e4540b
--- /dev/null
+++ b/vendor/rustix/src/io/fcntl.rs
@@ -0,0 +1,86 @@
+//! The Unix `fcntl` function is effectively lots of different functions
+//! hidden behind a single dynamic dispatch interface. In order to provide
+//! a type-safe API, rustix makes them all separate functions so that they
+//! can have dedicated static type signatures.
+//!
+//! `fcntl` functions which are not specific to files or directories live
+//! in the [`io`] module instead.
+//!
+//! [`io`]: crate::io
+
+use crate::backend;
+use crate::io;
+use backend::fd::{AsFd, OwnedFd, RawFd};
+
+pub use backend::io::types::FdFlags;
+
+/// `fcntl(fd, F_GETFD)`—Returns a file descriptor's flags.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+#[inline]
+#[doc(alias = "F_GETFD")]
+pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> {
+ backend::io::syscalls::fcntl_getfd(fd.as_fd())
+}
+
+/// `fcntl(fd, F_SETFD, flags)`—Sets a file descriptor's flags.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+#[inline]
+#[doc(alias = "F_SETFD")]
+pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> {
+ backend::io::syscalls::fcntl_setfd(fd.as_fd(), flags)
+}
+
+/// `fcntl(fd, F_DUPFD_CLOEXEC)`—Creates a new `OwnedFd` instance, with value
+/// at least `min`, that has `O_CLOEXEC` set and that shares the same
+/// underlying [file description] as `fd`.
+///
+/// POSIX guarantees that `F_DUPFD_CLOEXEC` will use the lowest unused file
+/// descriptor which is at least `min`, however it is not safe in general to
+/// rely on this, as file descriptors may be unexpectedly allocated on other
+/// threads or in libraries.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+#[cfg(not(any(target_os = "wasi", target_os = "espidf")))]
+#[inline]
+#[doc(alias = "F_DUPFD_CLOEXEC")]
+pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> {
+ backend::io::syscalls::fcntl_dupfd_cloexec(fd.as_fd(), min)
+}
+
+/// `fcntl(fd, F_DUPFD)`—Creates a new `OwnedFd` instance, with value at least
+/// `min`, that shares the same underlying [file description] as `fd`.
+///
+/// POSIX guarantees that `F_DUPFD` will use the lowest unused file descriptor
+/// which is at least `min`, however it is not safe in general to rely on this,
+/// as file descriptors may be unexpectedly allocated on other threads or in
+/// libraries.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+#[cfg(target_os = "espidf")]
+#[inline]
+#[doc(alias = "F_DUPFD")]
+pub fn fcntl_dupfd<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> {
+ backend::io::syscalls::fcntl_dupfd(fd.as_fd(), min)
+}
diff --git a/vendor/rustix/src/io/fd/owned.rs b/vendor/rustix/src/io/fd/owned.rs
index d99b6a0f9..c2972b073 100644
--- a/vendor/rustix/src/io/fd/owned.rs
+++ b/vendor/rustix/src/io/fd/owned.rs
@@ -92,14 +92,14 @@ impl OwnedFd {
// CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This
// is a POSIX flag that was added to Linux in 2.6.24.
#[cfg(not(target_os = "espidf"))]
- let fd = crate::fs::fcntl_dupfd_cloexec(self, 0)?;
+ let fd = crate::io::fcntl_dupfd_cloexec(self, 0)?;
// For ESP-IDF, F_DUPFD is used instead, because the CLOEXEC semantics
// will never be supported, as this is a bare metal framework with
// no capabilities for multi-process execution. While F_DUPFD is also
// not supported yet, it might be (currently it returns ENOSYS).
#[cfg(target_os = "espidf")]
- let fd = crate::fs::fcntl_dupfd(self)?;
+ let fd = crate::io::fcntl_dupfd(self)?;
Ok(fd.into())
}
diff --git a/vendor/rustix/src/io/fd/raw.rs b/vendor/rustix/src/io/fd/raw.rs
index 44322d9fe..a522c9794 100644
--- a/vendor/rustix/src/io/fd/raw.rs
+++ b/vendor/rustix/src/io/fd/raw.rs
@@ -7,7 +7,7 @@
#![cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#![allow(unsafe_code)]
-use crate::imp::c;
+use crate::backend::c;
/// Raw file descriptors.
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs
index be47e7958..01ded2e12 100644
--- a/vendor/rustix/src/io/ioctl.rs
+++ b/vendor/rustix/src/io/ioctl.rs
@@ -3,8 +3,8 @@
//! a type-safe API, rustix makes them all separate functions so that they
//! can have dedicated static type signatures.
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
/// `ioctl(fd, TIOCEXCL)`—Enables exclusive mode on a terminal.
///
@@ -12,11 +12,11 @@ use imp::fd::AsFd;
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
#[doc(alias = "TIOCEXCL")]
pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::io::syscalls::ioctl_tiocexcl(fd.as_fd())
+ backend::io::syscalls::ioctl_tiocexcl(fd.as_fd())
}
/// `ioctl(fd, TIOCNXCL)`—Disables exclusive mode on a terminal.
@@ -25,11 +25,11 @@ pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
#[doc(alias = "TIOCNXCL")]
pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::io::syscalls::ioctl_tiocnxcl(fd.as_fd())
+ backend::io::syscalls::ioctl_tiocnxcl(fd.as_fd())
}
/// `ioctl(fd, FIOCLEX)`—Set the close-on-exec flag.
@@ -47,7 +47,7 @@ pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
#[doc(alias = "FIOCLEX")]
#[doc(alias = "FD_CLOEXEC")]
pub fn ioctl_fioclex<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::io::syscalls::ioctl_fioclex(fd.as_fd())
+ backend::io::syscalls::ioctl_fioclex(fd.as_fd())
}
/// `ioctl(fd, FIONBIO, &value)`—Enables or disables non-blocking mode.
@@ -61,7 +61,7 @@ pub fn ioctl_fioclex<Fd: AsFd>(fd: Fd) -> io::Result<()> {
#[inline]
#[doc(alias = "FIONBIO")]
pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
- imp::io::syscalls::ioctl_fionbio(fd.as_fd(), value)
+ backend::io::syscalls::ioctl_fionbio(fd.as_fd(), value)
}
/// `ioctl(fd, FIONREAD)`—Returns the number of bytes ready to be read.
@@ -79,7 +79,7 @@ pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
#[inline]
#[doc(alias = "FIONREAD")]
pub fn ioctl_fionread<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
- imp::io::syscalls::ioctl_fionread(fd.as_fd())
+ backend::io::syscalls::ioctl_fionread(fd.as_fd())
}
/// `ioctl(fd, BLKSSZGET)`—Returns the logical block size of a block device.
@@ -87,7 +87,7 @@ pub fn ioctl_fionread<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
#[inline]
#[doc(alias = "BLKSSZGET")]
pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- imp::io::syscalls::ioctl_blksszget(fd.as_fd())
+ backend::io::syscalls::ioctl_blksszget(fd.as_fd())
}
/// `ioctl(fd, BLKPBSZGET)`—Returns the physical block size of a block device.
@@ -95,5 +95,5 @@ pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
#[inline]
#[doc(alias = "BLKPBSZGET")]
pub fn ioctl_blkpbszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- imp::io::syscalls::ioctl_blkpbszget(fd.as_fd())
+ backend::io::syscalls::ioctl_blkpbszget(fd.as_fd())
}
diff --git a/vendor/rustix/src/io/is_read_write.rs b/vendor/rustix/src/io/is_read_write.rs
index c6f189090..74007e7f9 100644
--- a/vendor/rustix/src/io/is_read_write.rs
+++ b/vendor/rustix/src/io/is_read_write.rs
@@ -1,7 +1,9 @@
//! The [`is_read_write`] function.
-use crate::{imp, io};
-use imp::fd::AsFd;
+#[cfg(all(feature = "fs", feature = "net"))]
+use crate::{backend, io};
+#[cfg(all(feature = "fs", feature = "net"))]
+use backend::fd::AsFd;
/// Returns a pair of booleans indicating whether the file descriptor is
/// readable and/or writable, respectively.
@@ -11,6 +13,8 @@ use imp::fd::AsFd;
///
/// [`is_file_read_write`]: crate::fs::is_file_read_write
#[inline]
+#[cfg(all(feature = "fs", feature = "net"))]
+#[cfg_attr(doc_cfg, doc(cfg(all(feature = "fs", feature = "net"))))]
pub fn is_read_write<Fd: AsFd>(fd: Fd) -> io::Result<(bool, bool)> {
- imp::io::syscalls::is_read_write(fd.as_fd())
+ backend::io::syscalls::is_read_write(fd.as_fd())
}
diff --git a/vendor/rustix/src/io/mod.rs b/vendor/rustix/src/io/mod.rs
index 5cd5e2ec9..03f06c4ac 100644
--- a/vendor/rustix/src/io/mod.rs
+++ b/vendor/rustix/src/io/mod.rs
@@ -6,13 +6,13 @@ mod dup;
mod errno;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod eventfd;
+#[cfg(not(windows))]
+mod fcntl;
#[cfg(not(feature = "std"))]
pub(crate) mod fd;
mod ioctl;
#[cfg(not(any(windows, target_os = "redox")))]
-#[cfg(feature = "net")]
mod is_read_write;
-mod owned_fd;
#[cfg(not(any(windows, target_os = "wasi")))]
mod pipe;
mod poll;
@@ -26,13 +26,17 @@ mod seek_from;
mod stdio;
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use crate::imp::io::epoll;
+pub use crate::backend::io::epoll;
pub use close::close;
-#[cfg(not(any(windows, target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "aix", target_os = "wasi")))]
pub use dup::{dup, dup2, dup3, DupFlags};
pub use errno::{retry_on_intr, Errno, Result};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use eventfd::{eventfd, EventfdFlags};
+#[cfg(not(any(windows, target_os = "wasi")))]
+pub use fcntl::fcntl_dupfd_cloexec;
+#[cfg(not(windows))]
+pub use fcntl::{fcntl_getfd, fcntl_setfd, FdFlags};
#[cfg(any(target_os = "ios", target_os = "macos"))]
pub use ioctl::ioctl_fioclex;
pub use ioctl::ioctl_fionbio;
@@ -40,29 +44,46 @@ pub use ioctl::ioctl_fionbio;
pub use ioctl::ioctl_fionread;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use ioctl::{ioctl_blkpbszget, ioctl_blksszget};
-#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))]
+#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub use ioctl::{ioctl_tiocexcl, ioctl_tiocnxcl};
#[cfg(not(any(windows, target_os = "redox")))]
-#[cfg(feature = "net")]
+#[cfg(all(feature = "fs", feature = "net"))]
pub use is_read_write::is_read_write;
-pub use owned_fd::OwnedFd;
#[cfg(not(any(windows, target_os = "wasi")))]
pub use pipe::pipe;
#[cfg(not(any(
windows,
+ target_os = "haiku",
target_os = "illumos",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
pub use pipe::PIPE_BUF;
-#[cfg(not(any(windows, target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(
+ windows,
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "wasi"
+)))]
pub use pipe::{pipe_with, PipeFlags};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use pipe::{splice, vmsplice, IoSliceRaw, SpliceFlags};
pub use poll::{poll, PollFd, PollFlags};
#[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))]
-pub use procfs::{proc_self_fd, proc_self_fdinfo_fd, proc_self_maps, proc_self_pagemap};
+pub use procfs::{
+ proc_self_fd, proc_self_fdinfo_fd, proc_self_maps, proc_self_pagemap, proc_self_status,
+};
#[cfg(not(windows))]
pub use read_write::{pread, pwrite, read, readv, write, writev, IoSlice, IoSliceMut};
-#[cfg(not(any(windows, target_os = "redox")))]
+#[cfg(not(any(
+ windows,
+ target_os = "haiku",
+ target_os = "redox",
+ target_os = "solaris"
+)))]
pub use read_write::{preadv, pwritev};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use read_write::{preadv2, pwritev2, ReadWriteFlags};
@@ -71,4 +92,6 @@ pub use seek_from::SeekFrom;
#[cfg(feature = "std")]
pub use std::io::SeekFrom;
#[cfg(not(windows))]
-pub use stdio::{stderr, stdin, stdout, take_stderr, take_stdin, take_stdout};
+pub use stdio::{
+ raw_stderr, raw_stdin, raw_stdout, stderr, stdin, stdout, take_stderr, take_stdin, take_stdout,
+};
diff --git a/vendor/rustix/src/io/owned_fd.rs b/vendor/rustix/src/io/owned_fd.rs
deleted file mode 100644
index 63c6145b0..000000000
--- a/vendor/rustix/src/io/owned_fd.rs
+++ /dev/null
@@ -1,272 +0,0 @@
-//! A wrapper around [`io_lifetimes::OwnedFd`].
-//!
-//! rustix needs to wrap io-lifetimes' `OwnedFd` type so that it can call its
-//! own [`close`] function when the `OwnedFd` is dropped.
-//!
-//! [`close`]: crate::io::close
-//!
-//! # Safety
-//!
-//! We wrap an `OwnedFd` in a `ManuallyDrop` so that we can extract the
-//! file descriptor and close it ourselves.
-#![allow(unsafe_code)]
-
-use crate::imp::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};
-#[cfg(all(not(io_lifetimes_use_std), feature = "std"))]
-use crate::imp::fd::{FromFd, IntoFd};
-use crate::io::close;
-use core::fmt;
-use core::mem::{forget, ManuallyDrop};
-
-/// A wrapper around [`io_lifetimes::OwnedFd`] which closes the file descriptor
-/// using rustix's own [`close`] rather than libc's `close`.
-///
-/// [`close`]: crate::io::close
-#[repr(transparent)]
-pub struct OwnedFd {
- inner: ManuallyDrop<crate::imp::fd::OwnedFd>,
-}
-
-impl OwnedFd {
- /// Creates a new `OwnedFd` instance that shares the same underlying file
- /// handle as the existing `OwnedFd` instance.
- #[cfg(all(unix, not(target_os = "wasi")))]
- pub fn try_clone(&self) -> crate::io::Result<Self> {
- // We want to atomically duplicate this file descriptor and set the
- // CLOEXEC flag, and currently that's done via F_DUPFD_CLOEXEC. This
- // is a POSIX flag that was added to Linux in 2.6.24.
- #[cfg(not(target_os = "espidf"))]
- let fd = crate::fs::fcntl_dupfd_cloexec(self, 0)?;
-
- // For ESP-IDF, F_DUPFD is used instead, because the CLOEXEC semantics
- // will never be supported, as this is a bare metal framework with
- // no capabilities for multi-process execution. While F_DUPFD is also
- // not supported yet, it might be (currently it returns ENOSYS).
- #[cfg(target_os = "espidf")]
- let fd = crate::fs::fcntl_dupfd(self)?;
-
- Ok(fd)
- }
-
- /// Creates a new `OwnedFd` instance that shares the same underlying file
- /// handle as the existing `OwnedFd` instance.
- #[cfg(target_os = "wasi")]
- pub fn try_clone(&self) -> std::io::Result<Self> {
- Err(std::io::Error::new(
- std::io::ErrorKind::Unsupported,
- "operation not supported on WASI yet",
- ))
- }
-
- /// Creates a new `OwnedFd` instance that shares the same underlying file
- /// handle as the existing `OwnedFd` instance.
- #[cfg(target_os = "windows")]
- pub fn try_clone(&self) -> std::io::Result<Self> {
- use windows_sys::Win32::Networking::WinSock::{
- WSADuplicateSocketW, WSAGetLastError, WSASocketW, INVALID_SOCKET, SOCKET_ERROR,
- WSAEINVAL, WSAEPROTOTYPE, WSAPROTOCOL_INFOW, WSA_FLAG_NO_HANDLE_INHERIT,
- WSA_FLAG_OVERLAPPED,
- };
- use windows_sys::Win32::System::Threading::GetCurrentProcessId;
-
- let mut info = unsafe { std::mem::zeroed::<WSAPROTOCOL_INFOW>() };
- let result =
- unsafe { WSADuplicateSocketW(self.as_raw_fd() as _, GetCurrentProcessId(), &mut info) };
- match result {
- SOCKET_ERROR => return Err(std::io::Error::last_os_error()),
- 0 => (),
- _ => panic!(),
- }
- let socket = unsafe {
- WSASocketW(
- info.iAddressFamily,
- info.iSocketType,
- info.iProtocol,
- &mut info,
- 0,
- WSA_FLAG_OVERLAPPED | WSA_FLAG_NO_HANDLE_INHERIT,
- )
- };
-
- if socket != INVALID_SOCKET {
- unsafe { Ok(Self::from_raw_fd(socket as _)) }
- } else {
- let error = unsafe { WSAGetLastError() };
-
- if error != WSAEPROTOTYPE && error != WSAEINVAL {
- return Err(std::io::Error::from_raw_os_error(error));
- }
-
- let socket = unsafe {
- WSASocketW(
- info.iAddressFamily,
- info.iSocketType,
- info.iProtocol,
- &mut info,
- 0,
- WSA_FLAG_OVERLAPPED,
- )
- };
-
- if socket == INVALID_SOCKET {
- return Err(std::io::Error::last_os_error());
- }
-
- unsafe {
- let socket = Self::from_raw_fd(socket as _);
- socket.set_no_inherit()?;
- Ok(socket)
- }
- }
- }
-
- #[cfg(windows)]
- #[cfg(not(target_vendor = "uwp"))]
- fn set_no_inherit(&self) -> std::io::Result<()> {
- use windows_sys::Win32::Foundation::{SetHandleInformation, HANDLE, HANDLE_FLAG_INHERIT};
- match unsafe { SetHandleInformation(self.as_raw_fd() as HANDLE, HANDLE_FLAG_INHERIT, 0) } {
- 0 => return Err(std::io::Error::last_os_error()),
- _ => Ok(()),
- }
- }
-
- #[cfg(windows)]
- #[cfg(target_vendor = "uwp")]
- fn set_no_inherit(&self) -> std::io::Result<()> {
- Err(std::io::Error::new(
- std::io::ErrorKind::Unsupported,
- "Unavailable on UWP",
- ))
- }
-}
-
-#[cfg(not(windows))]
-impl AsFd for OwnedFd {
- #[inline]
- fn as_fd(&self) -> BorrowedFd<'_> {
- self.inner.as_fd()
- }
-}
-
-#[cfg(windows)]
-impl io_lifetimes::AsSocket for OwnedFd {
- #[inline]
- fn as_socket(&self) -> BorrowedFd<'_> {
- self.inner.as_socket()
- }
-}
-
-#[cfg(any(io_lifetimes_use_std, not(feature = "std")))]
-impl From<OwnedFd> for crate::imp::fd::OwnedFd {
- #[inline]
- fn from(owned_fd: OwnedFd) -> Self {
- let raw_fd = owned_fd.inner.as_fd().as_raw_fd();
- forget(owned_fd);
-
- // Safety: We use `as_fd().as_raw_fd()` to extract the raw file
- // descriptor from `self.inner`, and then `forget` `self` so
- // that they remain valid until the new `OwnedFd` acquires them.
- unsafe { crate::imp::fd::OwnedFd::from_raw_fd(raw_fd) }
- }
-}
-
-#[cfg(not(any(io_lifetimes_use_std, not(feature = "std"))))]
-impl IntoFd for OwnedFd {
- #[inline]
- fn into_fd(self) -> crate::imp::fd::OwnedFd {
- let raw_fd = self.inner.as_fd().as_raw_fd();
- forget(self);
-
- // Safety: We use `as_fd().as_raw_fd()` to extract the raw file
- // descriptor from `self.inner`, and then `forget` `self` so
- // that they remain valid until the new `OwnedFd` acquires them.
- unsafe { crate::imp::fd::OwnedFd::from_raw_fd(raw_fd) }
- }
-}
-
-#[cfg(any(io_lifetimes_use_std, not(feature = "std")))]
-impl From<crate::imp::fd::OwnedFd> for OwnedFd {
- #[inline]
- fn from(owned_fd: crate::imp::fd::OwnedFd) -> Self {
- Self {
- inner: ManuallyDrop::new(owned_fd),
- }
- }
-}
-
-#[cfg(all(not(io_lifetimes_use_std), feature = "std"))]
-impl FromFd for OwnedFd {
- #[inline]
- fn from_fd(owned_fd: crate::imp::fd::OwnedFd) -> Self {
- Self {
- inner: ManuallyDrop::new(owned_fd),
- }
- }
-}
-
-#[cfg(not(any(io_lifetimes_use_std, not(feature = "std"))))]
-impl From<crate::imp::fd::OwnedFd> for OwnedFd {
- #[inline]
- fn from(fd: crate::imp::fd::OwnedFd) -> Self {
- Self {
- inner: ManuallyDrop::new(fd),
- }
- }
-}
-
-#[cfg(not(any(io_lifetimes_use_std, not(feature = "std"))))]
-impl From<OwnedFd> for crate::imp::fd::OwnedFd {
- #[inline]
- fn from(fd: OwnedFd) -> Self {
- let raw_fd = fd.inner.as_fd().as_raw_fd();
- forget(fd);
-
- // Safety: We use `as_fd().as_raw_fd()` to extract the raw file
- // descriptor from `self.inner`, and then `forget` `self` so
- // that they remain valid until the new `OwnedFd` acquires them.
- unsafe { Self::from_raw_fd(raw_fd) }
- }
-}
-
-impl AsRawFd for OwnedFd {
- #[inline]
- fn as_raw_fd(&self) -> RawFd {
- self.inner.as_raw_fd()
- }
-}
-
-impl IntoRawFd for OwnedFd {
- #[inline]
- fn into_raw_fd(self) -> RawFd {
- let raw_fd = self.inner.as_fd().as_raw_fd();
- forget(self);
- raw_fd
- }
-}
-
-impl FromRawFd for OwnedFd {
- #[inline]
- unsafe fn from_raw_fd(raw_fd: RawFd) -> Self {
- Self {
- inner: ManuallyDrop::new(crate::imp::fd::OwnedFd::from_raw_fd(raw_fd)),
- }
- }
-}
-
-impl Drop for OwnedFd {
- #[inline]
- fn drop(&mut self) {
- // Safety: We use `as_fd().as_raw_fd()` to extract the raw file
- // descriptor from `self.inner`. `self.inner` is wrapped with
- // `ManuallyDrop` so dropping it doesn't invalid them.
- unsafe {
- close(self.as_fd().as_raw_fd());
- }
- }
-}
-
-impl fmt::Debug for OwnedFd {
- fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.inner.fmt(f)
- }
-}
diff --git a/vendor/rustix/src/io/pipe.rs b/vendor/rustix/src/io/pipe.rs
index 2878d10b1..2b8af6a84 100644
--- a/vendor/rustix/src/io/pipe.rs
+++ b/vendor/rustix/src/io/pipe.rs
@@ -1,8 +1,15 @@
-use crate::imp;
-use crate::io::{self, OwnedFd};
+#![allow(unsafe_code)]
+
+use crate::fd::OwnedFd;
+use crate::{backend, io};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use backend::fd::AsFd;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::io::types::PipeFlags;
+pub use backend::io::types::PipeFlags;
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use backend::io::types::{IoSliceRaw, SpliceFlags};
/// `PIPE_BUF`—The maximum length at which writes to a pipe are atomic.
///
@@ -14,11 +21,13 @@ pub use imp::io::types::PipeFlags;
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
#[cfg(not(any(
windows,
+ target_os = "haiku",
target_os = "illumos",
target_os = "redox",
+ target_os = "solaris",
target_os = "wasi",
)))]
-pub const PIPE_BUF: usize = imp::io::types::PIPE_BUF;
+pub const PIPE_BUF: usize = backend::io::types::PIPE_BUF;
/// `pipe()`—Creates a pipe.
///
@@ -33,7 +42,7 @@ pub const PIPE_BUF: usize = imp::io::types::PIPE_BUF;
/// [Linux]: https://man7.org/linux/man-pages/man2/pipe.2.html
#[inline]
pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
- imp::io::syscalls::pipe()
+ backend::io::syscalls::pipe()
}
/// `pipe2(flags)`—Creates a pipe, with flags.
@@ -45,9 +54,77 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pipe2.2.html
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(any(
+ target_os = "aix",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos"
+)))]
#[inline]
#[doc(alias = "pipe2")]
pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
- imp::io::syscalls::pipe_with(flags)
+ backend::io::syscalls::pipe_with(flags)
+}
+
+/// `splice(fd_in, off_in, fd_out, off_out, len, flags)`—Transfer data between a file and a pipe.
+///
+/// This function transfers up to `len` bytes of data from the file descriptor `fd_in`
+/// to the file descriptor `fd_out`, where one of the file descriptors
+/// must refer to a pipe.
+///
+/// `off_*` must be `None` if the corresponding fd refers to a pipe.
+/// Otherwise its value points to the starting offset to the file,
+/// from which the data is read/written.
+/// on success the number of bytes read/written is added to the offset.
+///
+/// passing `None` causes the read/write to start from the file offset,
+/// and the file offset is adjusted appropriately.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/splice.2.html
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub fn splice<FdIn: AsFd, FdOut: AsFd>(
+ fd_in: FdIn,
+ off_in: Option<&mut u64>,
+ fd_out: FdOut,
+ off_out: Option<&mut u64>,
+ len: usize,
+ flags: SpliceFlags,
+) -> io::Result<usize> {
+ backend::io::syscalls::splice(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len, flags)
+}
+
+/// `vmsplice(fd, bufs, flags)`—Transfer data between memory and a pipe.
+///
+/// If `fd` is the write end of the pipe,
+/// the function maps the memory pointer at by `bufs` to the pipe.
+///
+/// If `fd` is the read end of the pipe,
+/// the function writes data from the pipe to said memory.
+///
+/// # Safety
+///
+/// If the memory must not be mutated (such as when `bufs` were originally immutable slices),
+/// it is up to the caller to ensure that the write end of the pipe is placed in `fd`.
+///
+/// Additionally if `SpliceFlags::GIFT` is set, the caller must also ensure
+/// that the contents of `bufs` in never modified following the call,
+/// and that all of the pointers in `bufs` are page aligned,
+/// and the lengths are multiples of a page size in bytes.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/vmsplice.2.html
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub unsafe fn vmsplice<PipeFd: AsFd>(
+ fd: PipeFd,
+ bufs: &[io::IoSliceRaw],
+ flags: SpliceFlags,
+) -> io::Result<usize> {
+ backend::io::syscalls::vmsplice(fd.as_fd(), bufs, flags)
}
diff --git a/vendor/rustix/src/io/poll.rs b/vendor/rustix/src/io/poll.rs
index efa25045c..01f625af2 100644
--- a/vendor/rustix/src/io/poll.rs
+++ b/vendor/rustix/src/io/poll.rs
@@ -1,6 +1,6 @@
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::io::poll_fd::{PollFd, PollFlags};
+pub use backend::io::poll_fd::{PollFd, PollFlags};
/// `poll(self.fds, timeout)`
///
@@ -16,5 +16,5 @@ pub use imp::io::poll_fd::{PollFd, PollFlags};
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll
#[inline]
pub fn poll(fds: &mut [PollFd<'_>], timeout: i32) -> io::Result<usize> {
- imp::io::syscalls::poll(fds, timeout)
+ backend::io::syscalls::poll(fds, timeout)
}
diff --git a/vendor/rustix/src/io/procfs.rs b/vendor/rustix/src/io/procfs.rs
index a947a4e06..c6eeb08e0 100644
--- a/vendor/rustix/src/io/procfs.rs
+++ b/vendor/rustix/src/io/procfs.rs
@@ -16,15 +16,15 @@
//! namespace. So with the checking here, they may fail, but they won't be able
//! to succeed with bogus results.
-use crate::fd::{AsFd, BorrowedFd};
+use crate::fd::{AsFd, BorrowedFd, OwnedFd};
use crate::ffi::CStr;
use crate::fs::{
cwd, fstat, fstatfs, major, openat, renameat, Dir, FileType, Mode, OFlags, Stat,
PROC_SUPER_MAGIC,
};
-use crate::io::{self, OwnedFd};
+use crate::io;
use crate::path::DecInt;
-use crate::process::{getgid, getpid, getuid, Gid, RawGid, RawUid, Uid};
+use crate::process::getpid;
#[cfg(feature = "rustc-dep-of-std")]
use core::lazy::OnceCell;
#[cfg(not(feature = "rustc-dep-of-std"))]
@@ -47,11 +47,9 @@ fn check_proc_entry(
kind: Kind,
entry: BorrowedFd<'_>,
proc_stat: Option<&Stat>,
- uid: RawUid,
- gid: RawGid,
) -> io::Result<Stat> {
let entry_stat = fstat(entry)?;
- check_proc_entry_with_stat(kind, entry, entry_stat, proc_stat, uid, gid)
+ check_proc_entry_with_stat(kind, entry, entry_stat, proc_stat)
}
/// Check a subdirectory of "/proc" for anomalies, using the provided `Stat`.
@@ -60,8 +58,6 @@ fn check_proc_entry_with_stat(
entry: BorrowedFd<'_>,
entry_stat: Stat,
proc_stat: Option<&Stat>,
- uid: RawUid,
- gid: RawGid,
) -> io::Result<Stat> {
// Check the filesystem magic.
check_procfs(entry)?;
@@ -72,13 +68,6 @@ fn check_proc_entry_with_stat(
Kind::File => check_proc_file(&entry_stat, proc_stat)?,
}
- // Check the ownership of the directory. We can't do that for the toplevel
- // "/proc" though, because in e.g. a user namespace scenario, root outside
- // the container may be mapped to another uid like `nobody`.
- if !matches!(kind, Kind::Proc) && (entry_stat.st_uid, entry_stat.st_gid) != (uid, gid) {
- return Err(io::Errno::NOTSUP);
- }
-
// "/proc" directories are typically mounted r-xr-xr-x.
// "/proc/self/fd" is r-x------. Allow them to have fewer permissions, but
// not more.
@@ -207,6 +196,7 @@ fn is_mountpoint(file: BorrowedFd<'_>) -> bool {
/// Open a directory in `/proc`, mapping all errors to `io::Errno::NOTSUP`.
fn proc_opendirat<P: crate::path::Arg, Fd: AsFd>(dirfd: Fd, path: P) -> io::Result<OwnedFd> {
// We could add `PATH`|`NOATIME` here but Linux 2.6.32 doesn't support it.
+ // Also for `NOATIME` see the comment in `open_and_check_file`.
let oflags = OFlags::NOFOLLOW | OFlags::DIRECTORY | OFlags::CLOEXEC | OFlags::NOCTTY;
openat(dirfd, path, oflags, Mode::empty()).map_err(|_err| io::Errno::NOTSUP)
}
@@ -229,14 +219,8 @@ fn proc() -> io::Result<(BorrowedFd<'static>, &'static Stat)> {
PROC.get_or_try_init(|| {
// Open "/proc".
let proc = proc_opendirat(cwd(), cstr!("/proc"))?;
- let proc_stat = check_proc_entry(
- Kind::Proc,
- proc.as_fd(),
- None,
- Uid::ROOT.as_raw(),
- Gid::ROOT.as_raw(),
- )
- .map_err(|_err| io::Errno::NOTSUP)?;
+ let proc_stat =
+ check_proc_entry(Kind::Proc, proc.as_fd(), None).map_err(|_err| io::Errno::NOTSUP)?;
Ok(new_static_fd(proc, proc_stat))
})
@@ -260,19 +244,13 @@ fn proc_self() -> io::Result<(BorrowedFd<'static>, &'static Stat)> {
.get_or_try_init(|| {
let (proc, proc_stat) = proc()?;
- let (uid, gid, pid) = (getuid(), getgid(), getpid());
+ let pid = getpid();
// Open "/proc/self". Use our pid to compute the name rather than literally
// using "self", as "self" is a symlink.
let proc_self = proc_opendirat(proc, DecInt::new(pid.as_raw_nonzero().get()))?;
- let proc_self_stat = check_proc_entry(
- Kind::Pid,
- proc_self.as_fd(),
- Some(proc_stat),
- uid.as_raw(),
- gid.as_raw(),
- )
- .map_err(|_err| io::Errno::NOTSUP)?;
+ let proc_self_stat = check_proc_entry(Kind::Pid, proc_self.as_fd(), Some(proc_stat))
+ .map_err(|_err| io::Errno::NOTSUP)?;
Ok(new_static_fd(proc_self, proc_self_stat))
})
@@ -297,18 +275,13 @@ pub fn proc_self_fd() -> io::Result<BorrowedFd<'static>> {
.get_or_try_init(|| {
let (_, proc_stat) = proc()?;
- let (proc_self, proc_self_stat) = proc_self()?;
+ let (proc_self, _proc_self_stat) = proc_self()?;
// Open "/proc/self/fd".
let proc_self_fd = proc_opendirat(proc_self, cstr!("fd"))?;
- let proc_self_fd_stat = check_proc_entry(
- Kind::Fd,
- proc_self_fd.as_fd(),
- Some(proc_stat),
- proc_self_stat.st_uid,
- proc_self_stat.st_gid,
- )
- .map_err(|_err| io::Errno::NOTSUP)?;
+ let proc_self_fd_stat =
+ check_proc_entry(Kind::Fd, proc_self_fd.as_fd(), Some(proc_stat))
+ .map_err(|_err| io::Errno::NOTSUP)?;
Ok(new_static_fd(proc_self_fd, proc_self_fd_stat))
})
@@ -333,24 +306,19 @@ fn new_static_fd(fd: OwnedFd, stat: Stat) -> (OwnedFd, Stat) {
///
/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
fn proc_self_fdinfo() -> io::Result<(BorrowedFd<'static>, &'static Stat)> {
- static PROC_SELF_FDINFO: OnceCell<(OwnedFd, Stat)> = OnceCell::new();
+ static PROC_SELF_FDINFO: StaticFd = StaticFd::new();
PROC_SELF_FDINFO
.get_or_try_init(|| {
let (_, proc_stat) = proc()?;
- let (proc_self, proc_self_stat) = proc_self()?;
+ let (proc_self, _proc_self_stat) = proc_self()?;
// Open "/proc/self/fdinfo".
let proc_self_fdinfo = proc_opendirat(proc_self, cstr!("fdinfo"))?;
- let proc_self_fdinfo_stat = check_proc_entry(
- Kind::Fd,
- proc_self_fdinfo.as_fd(),
- Some(proc_stat),
- proc_self_stat.st_uid,
- proc_self_stat.st_gid,
- )
- .map_err(|_err| io::Errno::NOTSUP)?;
+ let proc_self_fdinfo_stat =
+ check_proc_entry(Kind::Fd, proc_self_fdinfo.as_fd(), Some(proc_stat))
+ .map_err(|_err| io::Errno::NOTSUP)?;
Ok((proc_self_fdinfo, proc_self_fdinfo_stat))
})
@@ -410,6 +378,21 @@ pub fn proc_self_maps() -> io::Result<OwnedFd> {
proc_self_file(cstr!("maps"))
}
+/// Returns a handle to a Linux `/proc/self/status` file.
+///
+/// This ensures that `/proc/self/status` is `procfs`, that nothing is
+/// mounted on top of it, and that it looks normal.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
+#[inline]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
+pub fn proc_self_status() -> io::Result<OwnedFd> {
+ proc_self_file(cstr!("status"))
+}
+
/// Open a file under `/proc/self`.
fn proc_self_file(name: &CStr) -> io::Result<OwnedFd> {
let (proc_self, proc_self_stat) = proc_self()?;
@@ -420,9 +403,14 @@ fn proc_self_file(name: &CStr) -> io::Result<OwnedFd> {
fn open_and_check_file(dir: BorrowedFd, dir_stat: &Stat, name: &CStr) -> io::Result<OwnedFd> {
let (_, proc_stat) = proc()?;
- let oflags =
- OFlags::RDONLY | OFlags::CLOEXEC | OFlags::NOFOLLOW | OFlags::NOCTTY | OFlags::NOATIME;
- let file = openat(&dir, name, oflags, Mode::empty()).map_err(|_err| io::Errno::NOTSUP)?;
+ // Don't use `NOATIME`, because it [requires us to own the file], and when
+ // a process sets itself non-dumpable Linux changes the user:group of its
+ // `/proc/<pid>` files [to root:root].
+ //
+ // [requires us to own the file]: https://man7.org/linux/man-pages/man2/openat.2.html
+ // [to root:root]: https://man7.org/linux/man-pages/man5/proc.5.html
+ let oflags = OFlags::RDONLY | OFlags::CLOEXEC | OFlags::NOFOLLOW | OFlags::NOCTTY;
+ let file = openat(dir, name, oflags, Mode::empty()).map_err(|_err| io::Errno::NOTSUP)?;
let file_stat = fstat(&file)?;
// `is_mountpoint` only works on directory mount points, not file mount
@@ -455,14 +443,8 @@ fn open_and_check_file(dir: BorrowedFd, dir_stat: &Stat, name: &CStr) -> io::Res
&& entry.file_name() == name
{
// We found the file. Proceed to check the file handle.
- let _ = check_proc_entry_with_stat(
- Kind::File,
- file.as_fd(),
- file_stat,
- Some(proc_stat),
- dir_stat.st_uid,
- dir_stat.st_gid,
- )?;
+ let _ =
+ check_proc_entry_with_stat(Kind::File, file.as_fd(), file_stat, Some(proc_stat))?;
found_file = true;
} else if entry.ino() == dir_stat.st_ino
diff --git a/vendor/rustix/src/io/read_write.rs b/vendor/rustix/src/io/read_write.rs
index abb96e9c1..1a4d37b65 100644
--- a/vendor/rustix/src/io/read_write.rs
+++ b/vendor/rustix/src/io/read_write.rs
@@ -1,19 +1,19 @@
//! `read` and `write`, optionally positioned, optionally vectored
-use crate::{imp, io};
-use imp::fd::AsFd;
+use crate::{backend, io};
+use backend::fd::AsFd;
// Declare `IoSlice` and `IoSliceMut`.
#[cfg(not(windows))]
#[cfg(not(feature = "std"))]
-pub use imp::io::io_slice::{IoSlice, IoSliceMut};
+pub use backend::io::io_slice::{IoSlice, IoSliceMut};
#[cfg(not(windows))]
#[cfg(feature = "std")]
pub use std::io::{IoSlice, IoSliceMut};
/// `RWF_*` constants for use with [`preadv2`] and [`pwritev2`].
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use imp::io::types::ReadWriteFlags;
+pub use backend::io::types::ReadWriteFlags;
/// `read(fd, buf)`—Reads from a stream.
///
@@ -27,7 +27,7 @@ pub use imp::io::types::ReadWriteFlags;
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/read.2.html
#[inline]
pub fn read<Fd: AsFd>(fd: Fd, buf: &mut [u8]) -> io::Result<usize> {
- imp::io::syscalls::read(fd.as_fd(), buf)
+ backend::io::syscalls::read(fd.as_fd(), buf)
}
/// `write(fd, buf)`—Writes to a stream.
@@ -42,7 +42,7 @@ pub fn read<Fd: AsFd>(fd: Fd, buf: &mut [u8]) -> io::Result<usize> {
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/write.2.html
#[inline]
pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> {
- imp::io::syscalls::write(fd.as_fd(), buf)
+ backend::io::syscalls::write(fd.as_fd(), buf)
}
/// `pread(fd, buf, offset)`—Reads from a file at a given position.
@@ -57,7 +57,7 @@ pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> {
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pread.2.html
#[inline]
pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize> {
- imp::io::syscalls::pread(fd.as_fd(), buf, offset)
+ backend::io::syscalls::pread(fd.as_fd(), buf, offset)
}
/// `pwrite(fd, bufs)`—Writes to a file at a given position.
@@ -72,7 +72,7 @@ pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize>
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pwrite.2.html
#[inline]
pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: u64) -> io::Result<usize> {
- imp::io::syscalls::pwrite(fd.as_fd(), buf, offset)
+ backend::io::syscalls::pwrite(fd.as_fd(), buf, offset)
}
/// `readv(fd, bufs)`—Reads from a stream into multiple buffers.
@@ -87,7 +87,7 @@ pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: u64) -> io::Result<usize> {
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/readv.2.html
#[inline]
pub fn readv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
- imp::io::syscalls::readv(fd.as_fd(), bufs)
+ backend::io::syscalls::readv(fd.as_fd(), bufs)
}
/// `writev(fd, bufs)`—Writes to a stream from multiple buffers.
@@ -102,7 +102,7 @@ pub fn readv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize>
/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/writev.2.html
#[inline]
pub fn writev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
- imp::io::syscalls::writev(fd.as_fd(), bufs)
+ backend::io::syscalls::writev(fd.as_fd(), bufs)
}
/// `preadv(fd, bufs, offset)`—Reads from a file at a given position into
@@ -112,10 +112,10 @@ pub fn writev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/preadv.2.html
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
#[inline]
pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> {
- imp::io::syscalls::preadv(fd.as_fd(), bufs, offset)
+ backend::io::syscalls::preadv(fd.as_fd(), bufs, offset)
}
/// `pwritev(fd, bufs, offset)`—Writes to a file at a given position from
@@ -125,10 +125,10 @@ pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io:
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pwritev.2.html
-#[cfg(not(target_os = "redox"))]
+#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))]
#[inline]
pub fn pwritev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> {
- imp::io::syscalls::pwritev(fd.as_fd(), bufs, offset)
+ backend::io::syscalls::pwritev(fd.as_fd(), bufs, offset)
}
/// `preadv2(fd, bufs, offset, flags)`—Reads data, with several options.
@@ -147,7 +147,7 @@ pub fn preadv2<Fd: AsFd>(
offset: u64,
flags: ReadWriteFlags,
) -> io::Result<usize> {
- imp::io::syscalls::preadv2(fd.as_fd(), bufs, offset, flags)
+ backend::io::syscalls::preadv2(fd.as_fd(), bufs, offset, flags)
}
/// `pwritev2(fd, bufs, offset, flags)`—Writes data, with several options.
@@ -166,5 +166,5 @@ pub fn pwritev2<Fd: AsFd>(
offset: u64,
flags: ReadWriteFlags,
) -> io::Result<usize> {
- imp::io::syscalls::pwritev2(fd.as_fd(), bufs, offset, flags)
+ backend::io::syscalls::pwritev2(fd.as_fd(), bufs, offset, flags)
}
diff --git a/vendor/rustix/src/io/stdio.rs b/vendor/rustix/src/io/stdio.rs
index f9d03a701..caa8183c2 100644
--- a/vendor/rustix/src/io/stdio.rs
+++ b/vendor/rustix/src/io/stdio.rs
@@ -8,9 +8,9 @@
//! stdio streams.
#![allow(unsafe_code)]
-use crate::imp;
-use crate::io::OwnedFd;
-use imp::fd::{BorrowedFd, FromRawFd, RawFd};
+use crate::backend;
+use crate::fd::OwnedFd;
+use backend::fd::{BorrowedFd, FromRawFd, RawFd};
/// `STDIN_FILENO`—Standard input, borrowed.
///
@@ -36,9 +36,10 @@ use imp::fd::{BorrowedFd, FromRawFd, RawFd};
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+#[doc(alias = "STDIN_FILENO")]
#[inline]
-pub unsafe fn stdin() -> BorrowedFd<'static> {
- BorrowedFd::borrow_raw(imp::io::types::STDIN_FILENO as RawFd)
+pub const unsafe fn stdin() -> BorrowedFd<'static> {
+ BorrowedFd::borrow_raw(backend::io::types::STDIN_FILENO as RawFd)
}
/// `STDIN_FILENO`—Standard input, owned.
@@ -65,11 +66,10 @@ pub unsafe fn stdin() -> BorrowedFd<'static> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+#[doc(alias = "STDIN_FILENO")]
#[inline]
pub unsafe fn take_stdin() -> OwnedFd {
- OwnedFd::from(imp::fd::OwnedFd::from_raw_fd(
- imp::io::types::STDIN_FILENO as RawFd,
- ))
+ backend::fd::OwnedFd::from_raw_fd(backend::io::types::STDIN_FILENO as RawFd)
}
/// `STDOUT_FILENO`—Standard output, borrowed.
@@ -97,9 +97,10 @@ pub unsafe fn take_stdin() -> OwnedFd {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+#[doc(alias = "STDOUT_FILENO")]
#[inline]
-pub unsafe fn stdout() -> BorrowedFd<'static> {
- BorrowedFd::borrow_raw(imp::io::types::STDOUT_FILENO as RawFd)
+pub const unsafe fn stdout() -> BorrowedFd<'static> {
+ BorrowedFd::borrow_raw(backend::io::types::STDOUT_FILENO as RawFd)
}
/// `STDOUT_FILENO`—Standard output, owned.
@@ -126,11 +127,10 @@ pub unsafe fn stdout() -> BorrowedFd<'static> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+#[doc(alias = "STDOUT_FILENO")]
#[inline]
pub unsafe fn take_stdout() -> OwnedFd {
- OwnedFd::from(imp::fd::OwnedFd::from_raw_fd(
- imp::io::types::STDOUT_FILENO as RawFd,
- ))
+ backend::fd::OwnedFd::from_raw_fd(backend::io::types::STDOUT_FILENO as RawFd)
}
/// `STDERR_FILENO`—Standard error, borrowed.
@@ -157,9 +157,10 @@ pub unsafe fn take_stdout() -> OwnedFd {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+#[doc(alias = "STDERR_FILENO")]
#[inline]
-pub unsafe fn stderr() -> BorrowedFd<'static> {
- BorrowedFd::borrow_raw(imp::io::types::STDERR_FILENO as RawFd)
+pub const unsafe fn stderr() -> BorrowedFd<'static> {
+ BorrowedFd::borrow_raw(backend::io::types::STDERR_FILENO as RawFd)
}
/// `STDERR_FILENO`—Standard error, owned.
@@ -186,9 +187,68 @@ pub unsafe fn stderr() -> BorrowedFd<'static> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+#[doc(alias = "STDERR_FILENO")]
#[inline]
pub unsafe fn take_stderr() -> OwnedFd {
- OwnedFd::from(imp::fd::OwnedFd::from_raw_fd(
- imp::io::types::STDERR_FILENO as RawFd,
- ))
+ backend::fd::OwnedFd::from_raw_fd(backend::io::types::STDERR_FILENO as RawFd)
+}
+
+/// `STDIN_FILENO`—Standard input, raw.
+///
+/// This is similar to [`stdin`], however it returns a `RawFd`.
+///
+/// # Other hazards
+///
+/// This has the same hazards as [`stdin`].
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+#[doc(alias = "STDIN_FILENO")]
+#[inline]
+pub const fn raw_stdin() -> RawFd {
+ backend::io::types::STDIN_FILENO as RawFd
+}
+
+/// `STDOUT_FILENO`—Standard output, raw.
+///
+/// This is similar to [`stdout`], however it returns a `RawFd`.
+///
+/// # Other hazards
+///
+/// This has the same hazards as [`stdout`].
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+#[doc(alias = "STDOUT_FILENO")]
+#[inline]
+pub const fn raw_stdout() -> RawFd {
+ backend::io::types::STDOUT_FILENO as RawFd
+}
+
+/// `STDERR_FILENO`—Standard error, raw.
+///
+/// This is similar to [`stderr`], however it returns a `RawFd`.
+///
+/// # Other hazards
+///
+/// This has the same hazards as [`stderr`].
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+#[doc(alias = "STDERR_FILENO")]
+#[inline]
+pub const fn raw_stderr() -> RawFd {
+ backend::io::types::STDERR_FILENO as RawFd
}
diff --git a/vendor/rustix/src/io_uring.rs b/vendor/rustix/src/io_uring.rs
index 13f3bbd10..2f67107ba 100644
--- a/vendor/rustix/src/io_uring.rs
+++ b/vendor/rustix/src/io_uring.rs
@@ -19,9 +19,8 @@
//! [io_uring]: https://en.wikipedia.org/wiki/Io_uring
#![allow(unsafe_code)]
-use crate::fd::{AsFd, BorrowedFd, RawFd};
-use crate::imp;
-use crate::io::{self, OwnedFd};
+use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
+use crate::{backend, io};
use core::ffi::c_void;
use core::ptr::null_mut;
use linux_raw_sys::general as sys;
@@ -35,7 +34,7 @@ use linux_raw_sys::general as sys;
/// [Linux]: https://man.archlinux.org/man/io_uring_setup.2.en
#[inline]
pub fn io_uring_setup(entries: u32, params: &mut io_uring_params) -> io::Result<OwnedFd> {
- imp::io_uring::syscalls::io_uring_setup(entries, params)
+ backend::io_uring::syscalls::io_uring_setup(entries, params)
}
/// `io_uring_register(fd, opcode, arg, nr_args)`—Register files or user
@@ -58,7 +57,7 @@ pub unsafe fn io_uring_register<Fd: AsFd>(
arg: *const c_void,
nr_args: u32,
) -> io::Result<()> {
- imp::io_uring::syscalls::io_uring_register(fd.as_fd(), opcode, arg, nr_args)
+ backend::io_uring::syscalls::io_uring_register(fd.as_fd(), opcode, arg, nr_args)
}
/// `io_uring_enter(fd, to_submit, min_complete, flags, arg, size)`—Initiate
@@ -83,7 +82,14 @@ pub unsafe fn io_uring_enter<Fd: AsFd>(
arg: *const c_void,
size: usize,
) -> io::Result<u32> {
- imp::io_uring::syscalls::io_uring_enter(fd.as_fd(), to_submit, min_complete, flags, arg, size)
+ backend::io_uring::syscalls::io_uring_enter(
+ fd.as_fd(),
+ to_submit,
+ min_complete,
+ flags,
+ arg,
+ size,
+ )
}
bitflags::bitflags! {
@@ -545,7 +551,6 @@ pub const IORING_OFF_SQES: u64 = sys::IORING_OFF_SQES as _;
/// `IORING_REGISTER_FILES_SKIP`
#[inline]
#[doc(alias = "IORING_REGISTER_FILES_SKIP")]
-#[allow(unsafe_code)]
pub const fn io_uring_register_files_skip() -> BorrowedFd<'static> {
let files_skip = sys::IORING_REGISTER_FILES_SKIP as RawFd;
diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs
index ca7c6cd4e..f8bf0729f 100644
--- a/vendor/rustix/src/lib.rs
+++ b/vendor/rustix/src/lib.rs
@@ -117,6 +117,12 @@
)]
#![cfg_attr(asm_experimental_arch, feature(asm_experimental_arch))]
#![cfg_attr(not(feature = "all-apis"), allow(dead_code))]
+// Clamp depends on Rust 1.50 which is newer than our MSRV.
+#![allow(clippy::manual_clamp)]
+// It is common in linux and libc APIs for types to vary between platforms.
+#![allow(clippy::unnecessary_cast)]
+// It is common in linux and libc APIs for types to vary between platforms.
+#![allow(clippy::useless_conversion)]
#[cfg(not(feature = "rustc-dep-of-std"))]
extern crate alloc;
@@ -130,27 +136,20 @@ pub(crate) mod const_assert;
pub(crate) mod utils;
// Pick the backend implementation to use.
-#[cfg_attr(libc, path = "imp/libc/mod.rs")]
-#[cfg_attr(linux_raw, path = "imp/linux_raw/mod.rs")]
-#[cfg_attr(wasi, path = "imp/wasi/mod.rs")]
-mod imp;
+#[cfg_attr(libc, path = "backend/libc/mod.rs")]
+#[cfg_attr(linux_raw, path = "backend/linux_raw/mod.rs")]
+#[cfg_attr(wasi, path = "backend/wasi/mod.rs")]
+mod backend;
/// Export the `*Fd` types and traits that are used in rustix's public API.
///
/// Users can use this to avoid needing to import anything else to use the same
/// versions of these types and traits.
-///
-/// Rustix APIs that use `OwnedFd` use [`rustix::io::OwnedFd`] instead, which
-/// allows rustix to implement `close` for them.
-///
-/// [`rustix::io::OwnedFd`]: crate::io::OwnedFd
pub mod fd {
- use super::imp;
- pub use imp::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
+ use super::backend;
#[cfg(windows)]
- pub use imp::fd::{AsSocket, FromSocket, IntoSocket};
- #[cfg(feature = "std")]
- pub use imp::fd::{FromFd, IntoFd};
+ pub use backend::fd::AsSocket;
+ pub use backend::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
}
// The public API modules.
@@ -214,9 +213,6 @@ pub mod runtime;
// that they're not public, but still available for internal use.
#[cfg(not(windows))]
-#[cfg(not(feature = "fs"))]
-pub(crate) mod fs;
-#[cfg(not(windows))]
#[cfg(all(
not(feature = "param"),
any(feature = "runtime", feature = "time", target_arch = "x86"),
diff --git a/vendor/rustix/src/mm/madvise.rs b/vendor/rustix/src/mm/madvise.rs
index 317c3b515..cf13f951b 100644
--- a/vendor/rustix/src/mm/madvise.rs
+++ b/vendor/rustix/src/mm/madvise.rs
@@ -6,10 +6,10 @@
//! mutate the memory or have other side effects.
#![allow(unsafe_code)]
-use crate::{imp, io};
+use crate::{backend, io};
use core::ffi::c_void;
-pub use imp::mm::types::Advice;
+pub use backend::mm::types::Advice;
/// `posix_madvise(addr, len, advice)`—Declares an expected access pattern
/// for a memory-mapped file.
@@ -31,5 +31,5 @@ pub use imp::mm::types::Advice;
#[inline]
#[doc(alias = "posix_madvise")]
pub unsafe fn madvise(addr: *mut c_void, len: usize, advice: Advice) -> io::Result<()> {
- imp::mm::syscalls::madvise(addr, len, advice)
+ backend::mm::syscalls::madvise(addr, len, advice)
}
diff --git a/vendor/rustix/src/mm/mmap.rs b/vendor/rustix/src/mm/mmap.rs
index 7be02464e..31d3a77b3 100644
--- a/vendor/rustix/src/mm/mmap.rs
+++ b/vendor/rustix/src/mm/mmap.rs
@@ -6,15 +6,15 @@
//! semantics and are wildly unsafe.
#![allow(unsafe_code)]
-use crate::{imp, io};
+use crate::{backend, io};
+use backend::fd::AsFd;
use core::ffi::c_void;
-use imp::fd::AsFd;
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use imp::mm::types::MlockFlags;
+pub use backend::mm::types::MlockFlags;
#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
-pub use imp::mm::types::MremapFlags;
-pub use imp::mm::types::{MapFlags, MprotectFlags, ProtFlags};
+pub use backend::mm::types::MremapFlags;
+pub use backend::mm::types::{MapFlags, MprotectFlags, ProtFlags};
/// `mmap(ptr, len, prot, flags, fd, offset)`—Create a file-backed memory
/// mapping.
@@ -41,7 +41,7 @@ pub unsafe fn mmap<Fd: AsFd>(
fd: Fd,
offset: u64,
) -> io::Result<*mut c_void> {
- imp::mm::syscalls::mmap(ptr, len, prot, flags, fd.as_fd(), offset)
+ backend::mm::syscalls::mmap(ptr, len, prot, flags, fd.as_fd(), offset)
}
/// `mmap(ptr, len, prot, MAP_ANONYMOUS | flags, -1, 0)`—Create an anonymous
@@ -67,7 +67,7 @@ pub unsafe fn mmap_anonymous(
prot: ProtFlags,
flags: MapFlags,
) -> io::Result<*mut c_void> {
- imp::mm::syscalls::mmap_anonymous(ptr, len, prot, flags)
+ backend::mm::syscalls::mmap_anonymous(ptr, len, prot, flags)
}
/// `munmap(ptr, len)`
@@ -84,7 +84,7 @@ pub unsafe fn mmap_anonymous(
/// [Linux]: https://man7.org/linux/man-pages/man2/munmap.2.html
#[inline]
pub unsafe fn munmap(ptr: *mut c_void, len: usize) -> io::Result<()> {
- imp::mm::syscalls::munmap(ptr, len)
+ backend::mm::syscalls::munmap(ptr, len)
}
/// `mremap(old_address, old_size, new_size, flags)`—Resize, modify,
@@ -109,7 +109,7 @@ pub unsafe fn mremap(
new_size: usize,
flags: MremapFlags,
) -> io::Result<*mut c_void> {
- imp::mm::syscalls::mremap(old_address, old_size, new_size, flags)
+ backend::mm::syscalls::mremap(old_address, old_size, new_size, flags)
}
/// `mremap(old_address, old_size, new_size, MREMAP_FIXED | flags)`—Resize,
@@ -136,7 +136,7 @@ pub unsafe fn mremap_fixed(
flags: MremapFlags,
new_address: *mut c_void,
) -> io::Result<*mut c_void> {
- imp::mm::syscalls::mremap_fixed(old_address, old_size, new_size, flags, new_address)
+ backend::mm::syscalls::mremap_fixed(old_address, old_size, new_size, flags, new_address)
}
/// `mprotect(ptr, len, flags)`
@@ -153,7 +153,7 @@ pub unsafe fn mremap_fixed(
/// [Linux]: https://man7.org/linux/man-pages/man2/mprotect.2.html
#[inline]
pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io::Result<()> {
- imp::mm::syscalls::mprotect(ptr, len, flags)
+ backend::mm::syscalls::mprotect(ptr, len, flags)
}
/// `mlock(ptr, len)`—Lock memory into RAM.
@@ -177,7 +177,7 @@ pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io
/// [Linux]: https://man7.org/linux/man-pages/man2/mlock.2.html
#[inline]
pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> io::Result<()> {
- imp::mm::syscalls::mlock(ptr, len)
+ backend::mm::syscalls::mlock(ptr, len)
}
/// `mlock2(ptr, len, flags)`—Lock memory into RAM, with
@@ -204,7 +204,7 @@ pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> io::Result<()> {
#[inline]
#[doc(alias = "mlock2")]
pub unsafe fn mlock_with(ptr: *mut c_void, len: usize, flags: MlockFlags) -> io::Result<()> {
- imp::mm::syscalls::mlock_with(ptr, len, flags)
+ backend::mm::syscalls::mlock_with(ptr, len, flags)
}
/// `munlock(ptr, len)`—Unlock memory.
@@ -227,5 +227,5 @@ pub unsafe fn mlock_with(ptr: *mut c_void, len: usize, flags: MlockFlags) -> io:
/// [Linux]: https://man7.org/linux/man-pages/man2/munlock.2.html
#[inline]
pub unsafe fn munlock(ptr: *mut c_void, len: usize) -> io::Result<()> {
- imp::mm::syscalls::munlock(ptr, len)
+ backend::mm::syscalls::munlock(ptr, len)
}
diff --git a/vendor/rustix/src/mm/msync.rs b/vendor/rustix/src/mm/msync.rs
index 7117a5067..3ca418fc4 100644
--- a/vendor/rustix/src/mm/msync.rs
+++ b/vendor/rustix/src/mm/msync.rs
@@ -6,10 +6,10 @@
//! memory or have other side effects.
#![allow(unsafe_code)]
-use crate::{imp, io};
+use crate::{backend, io};
use core::ffi::c_void;
-pub use imp::mm::types::MsyncFlags;
+pub use backend::mm::types::MsyncFlags;
/// `msync(addr, len, flags)`—Synchronizes a memory-mapping with its backing
/// storage.
@@ -28,5 +28,5 @@ pub use imp::mm::types::MsyncFlags;
/// [Linux `msync`]: https://man7.org/linux/man-pages/man2/msync.2.html
#[inline]
pub unsafe fn msync(addr: *mut c_void, len: usize, flags: MsyncFlags) -> io::Result<()> {
- imp::mm::syscalls::msync(addr, len, flags)
+ backend::mm::syscalls::msync(addr, len, flags)
}
diff --git a/vendor/rustix/src/mm/userfaultfd.rs b/vendor/rustix/src/mm/userfaultfd.rs
index 65b4a0dd8..201d54772 100644
--- a/vendor/rustix/src/mm/userfaultfd.rs
+++ b/vendor/rustix/src/mm/userfaultfd.rs
@@ -6,10 +6,10 @@
//! observe and manipulate process memory in magical ways.
#![allow(unsafe_code)]
-use crate::imp;
-use crate::io::{self, OwnedFd};
+use crate::fd::OwnedFd;
+use crate::{backend, io};
-pub use imp::mm::types::UserfaultfdFlags;
+pub use backend::mm::types::UserfaultfdFlags;
/// `userfaultfd(flags)`
///
@@ -26,5 +26,5 @@ pub use imp::mm::types::UserfaultfdFlags;
/// [Linux userfaultfd]: https://www.kernel.org/doc/Documentation/vm/userfaultfd.txt
#[inline]
pub unsafe fn userfaultfd(flags: UserfaultfdFlags) -> io::Result<OwnedFd> {
- imp::mm::syscalls::userfaultfd(flags)
+ backend::mm::syscalls::userfaultfd(flags)
}
diff --git a/vendor/rustix/src/net/addr.rs b/vendor/rustix/src/net/addr.rs
index 59f4a55d7..af9e51a8a 100644
--- a/vendor/rustix/src/net/addr.rs
+++ b/vendor/rustix/src/net/addr.rs
@@ -1,22 +1,17 @@
//! The following is derived from Rust's
-//! library/std/src/net/addr.rs at revision
-//! dca3f1b786efd27be3b325ed1e01e247aa589c3b.
+//! library/std/src/net/socket_addr.rs at revision
+//! f7e8ba28a4785e698a55fb95e4b3e803302de0ff.
//!
-//! This defines `SocketAddr`, `SocketAddrV4`, and `SocketAddrV6`. These are
-//! conceptually platform-independent, however in practice OS's have differing
-//! representations.
+//! All code in this file is licensed MIT or Apache 2.0 at your option.
+//!
+//! This defines `SocketAddr`, `SocketAddrV4`, and `SocketAddrV6` in a
+//! platform-independent way. It is not the native representation.
#![allow(unsafe_code)]
-use crate::imp::c;
-use crate::imp::net::ext::{
- in6_addr_s6_addr, in_addr_s_addr, sockaddr_in6_new, sockaddr_in6_sin6_scope_id,
- sockaddr_in6_sin6_scope_id_mut,
-};
use crate::net::ip::{IpAddr, Ipv4Addr, Ipv6Addr};
use core::cmp::Ordering;
use core::hash;
-use core::mem;
/// An internet socket address, either IPv4 or IPv6.
///
@@ -76,12 +71,11 @@ pub enum SocketAddr {
/// assert_eq!(socket.ip(), &Ipv4Addr::new(127, 0, 0, 1));
/// assert_eq!(socket.port(), 8080);
/// ```
-#[derive(Copy)]
+#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub struct SocketAddrV4 {
- // Do not assume that this struct is implemented as the underlying system representation.
- // The memory layout is not part of the stable interface that std exposes.
- pub(crate) inner: c::sockaddr_in,
+ ip: Ipv4Addr,
+ port: u16,
}
/// An IPv6 socket address.
@@ -110,12 +104,13 @@ pub struct SocketAddrV4 {
/// assert_eq!(socket.ip(), &Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1));
/// assert_eq!(socket.port(), 8080);
/// ```
-#[derive(Copy)]
+#[derive(Copy, Clone, Eq, PartialEq)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub struct SocketAddrV6 {
- // Do not assume that this struct is implemented as the underlying system representation.
- // The memory layout is not part of the stable interface that std exposes.
- pub(crate) inner: c::sockaddr_in6,
+ ip: Ipv6Addr,
+ port: u16,
+ flowinfo: u32,
+ scope_id: u32,
}
impl SocketAddr {
@@ -134,34 +129,14 @@ impl SocketAddr {
/// ```
#[cfg_attr(staged_api, stable(feature = "ip_addr", since = "1.7.0"))]
#[must_use]
- pub fn new(ip: IpAddr, port: u16) -> SocketAddr {
- match ip {
- IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
- IpAddr::V6(a) => SocketAddr::V6(SocketAddrV6::new(a, port, 0, 0)),
- }
- }
-
- /// Returns the IP address associated with this socket address.
- ///
- /// # Examples
- ///
- /// ```
- /// use std::net::{IpAddr, Ipv4Addr, SocketAddr};
- ///
- /// let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
- /// assert_eq!(socket.ip(), IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));
- /// ```
- #[cfg(const_raw_ptr_deref)]
- #[must_use]
- #[cfg_attr(staged_api, stable(feature = "ip_addr", since = "1.7.0"))]
#[cfg_attr(
staged_api,
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
- pub const fn ip(&self) -> IpAddr {
- match *self {
- SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
- SocketAddr::V6(ref a) => IpAddr::V6(*a.ip()),
+ pub const fn new(ip: IpAddr, port: u16) -> SocketAddr {
+ match ip {
+ IpAddr::V4(a) => SocketAddr::V4(SocketAddrV4::new(a, port)),
+ IpAddr::V6(a) => SocketAddr::V6(SocketAddrV6::new(a, port, 0, 0)),
}
}
@@ -175,14 +150,13 @@ impl SocketAddr {
/// let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080);
/// assert_eq!(socket.ip(), IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)));
/// ```
- #[cfg(not(const_raw_ptr_deref))]
#[must_use]
#[cfg_attr(staged_api, stable(feature = "ip_addr", since = "1.7.0"))]
#[cfg_attr(
staged_api,
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
- pub fn ip(&self) -> IpAddr {
+ pub const fn ip(&self) -> IpAddr {
match *self {
SocketAddr::V4(ref a) => IpAddr::V4(*a.ip()),
SocketAddr::V6(ref a) => IpAddr::V6(*a.ip()),
@@ -317,38 +291,12 @@ impl SocketAddrV4 {
/// ```
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use]
- pub fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
- SocketAddrV4 {
- inner: c::sockaddr_in {
- sin_family: c::AF_INET as c::sa_family_t,
- sin_port: port.to_be(),
- sin_addr: ip.inner,
- ..unsafe { mem::zeroed() }
- },
- }
- }
-
- /// Returns the IP address associated with this socket address.
- ///
- /// # Examples
- ///
- /// ```
- /// use std::net::{SocketAddrV4, Ipv4Addr};
- ///
- /// let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
- /// assert_eq!(socket.ip(), &Ipv4Addr::new(127, 0, 0, 1));
- /// ```
- #[cfg(const_raw_ptr_deref)]
- #[must_use]
- #[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[cfg_attr(
staged_api,
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
- pub const fn ip(&self) -> &Ipv4Addr {
- // SAFETY: `Ipv4Addr` is `#[repr(C)] struct { _: in_addr; }`.
- // It is safe to cast from `&in_addr` to `&Ipv4Addr`.
- unsafe { &*(&self.inner.sin_addr as *const c::in_addr as *const Ipv4Addr) }
+ pub const fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4 {
+ SocketAddrV4 { ip, port }
}
/// Returns the IP address associated with this socket address.
@@ -361,17 +309,14 @@ impl SocketAddrV4 {
/// let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
/// assert_eq!(socket.ip(), &Ipv4Addr::new(127, 0, 0, 1));
/// ```
- #[cfg(not(const_raw_ptr_deref))]
#[must_use]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[cfg_attr(
staged_api,
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
- pub fn ip(&self) -> &Ipv4Addr {
- // SAFETY: `Ipv4Addr` is `#[repr(C)] struct { _: in_addr; }`.
- // It is safe to cast from `&in_addr` to `&Ipv4Addr`.
- unsafe { &*(&self.inner.sin_addr as *const c::in_addr as *const Ipv4Addr) }
+ pub const fn ip(&self) -> &Ipv4Addr {
+ &self.ip
}
/// Changes the IP address associated with this socket address.
@@ -387,7 +332,7 @@ impl SocketAddrV4 {
/// ```
#[cfg_attr(staged_api, stable(feature = "sockaddr_setters", since = "1.9.0"))]
pub fn set_ip(&mut self, new_ip: Ipv4Addr) {
- self.inner.sin_addr = new_ip.inner
+ self.ip = new_ip;
}
/// Returns the port number associated with this socket address.
@@ -407,7 +352,7 @@ impl SocketAddrV4 {
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
pub const fn port(&self) -> u16 {
- u16::from_be(self.inner.sin_port)
+ self.port
}
/// Changes the port number associated with this socket address.
@@ -423,7 +368,7 @@ impl SocketAddrV4 {
/// ```
#[cfg_attr(staged_api, stable(feature = "sockaddr_setters", since = "1.9.0"))]
pub fn set_port(&mut self, new_port: u16) {
- self.inner.sin_port = new_port.to_be();
+ self.port = new_port;
}
}
@@ -446,37 +391,17 @@ impl SocketAddrV6 {
/// ```
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use]
- pub fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
- SocketAddrV6 {
- inner: sockaddr_in6_new(
- c::AF_INET6 as c::sa_family_t,
- port.to_be(),
- flowinfo,
- ip.inner,
- scope_id,
- ),
- }
- }
-
- /// Returns the IP address associated with this socket address.
- ///
- /// # Examples
- ///
- /// ```
- /// use std::net::{SocketAddrV6, Ipv6Addr};
- ///
- /// let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0);
- /// assert_eq!(socket.ip(), &Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
- /// ```
- #[cfg(const_raw_ptr_deref)]
- #[must_use]
- #[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[cfg_attr(
staged_api,
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
- pub const fn ip(&self) -> &Ipv6Addr {
- unsafe { &*(&self.inner.sin6_addr as *const c::in6_addr as *const Ipv6Addr) }
+ pub const fn new(ip: Ipv6Addr, port: u16, flowinfo: u32, scope_id: u32) -> SocketAddrV6 {
+ SocketAddrV6 {
+ ip,
+ port,
+ flowinfo,
+ scope_id,
+ }
}
/// Returns the IP address associated with this socket address.
@@ -489,15 +414,14 @@ impl SocketAddrV6 {
/// let socket = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 8080, 0, 0);
/// assert_eq!(socket.ip(), &Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// ```
- #[cfg(not(const_raw_ptr_deref))]
#[must_use]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[cfg_attr(
staged_api,
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
- pub fn ip(&self) -> &Ipv6Addr {
- unsafe { &*(&self.inner.sin6_addr as *const c::in6_addr as *const Ipv6Addr) }
+ pub const fn ip(&self) -> &Ipv6Addr {
+ &self.ip
}
/// Changes the IP address associated with this socket address.
@@ -513,7 +437,7 @@ impl SocketAddrV6 {
/// ```
#[cfg_attr(staged_api, stable(feature = "sockaddr_setters", since = "1.9.0"))]
pub fn set_ip(&mut self, new_ip: Ipv6Addr) {
- self.inner.sin6_addr = new_ip.inner
+ self.ip = new_ip;
}
/// Returns the port number associated with this socket address.
@@ -533,7 +457,7 @@ impl SocketAddrV6 {
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
pub const fn port(&self) -> u16 {
- u16::from_be(self.inner.sin6_port)
+ self.port
}
/// Changes the port number associated with this socket address.
@@ -549,7 +473,7 @@ impl SocketAddrV6 {
/// ```
#[cfg_attr(staged_api, stable(feature = "sockaddr_setters", since = "1.9.0"))]
pub fn set_port(&mut self, new_port: u16) {
- self.inner.sin6_port = new_port.to_be();
+ self.port = new_port;
}
/// Returns the flow information associated with this address.
@@ -579,7 +503,7 @@ impl SocketAddrV6 {
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
pub const fn flowinfo(&self) -> u32 {
- self.inner.sin6_flowinfo
+ self.flowinfo
}
/// Changes the flow information associated with this socket address.
@@ -597,7 +521,7 @@ impl SocketAddrV6 {
/// ```
#[cfg_attr(staged_api, stable(feature = "sockaddr_setters", since = "1.9.0"))]
pub fn set_flowinfo(&mut self, new_flowinfo: u32) {
- self.inner.sin6_flowinfo = new_flowinfo;
+ self.flowinfo = new_flowinfo;
}
/// Returns the scope ID associated with this address.
@@ -622,7 +546,7 @@ impl SocketAddrV6 {
rustc_const_unstable(feature = "const_socketaddr", issue = "82485")
)]
pub const fn scope_id(&self) -> u32 {
- sockaddr_in6_sin6_scope_id(self.inner)
+ self.scope_id
}
/// Changes the scope ID associated with this socket address.
@@ -640,7 +564,7 @@ impl SocketAddrV6 {
/// ```
#[cfg_attr(staged_api, stable(feature = "sockaddr_setters", since = "1.9.0"))]
pub fn set_scope_id(&mut self, new_scope_id: u32) {
- *sockaddr_in6_sin6_scope_id_mut(&mut self.inner) = new_scope_id;
+ self.scope_id = new_scope_id;
}
}
@@ -673,40 +597,6 @@ impl<I: Into<IpAddr>> From<(I, u16)> for SocketAddr {
}
}
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Clone for SocketAddrV4 {
- fn clone(&self) -> SocketAddrV4 {
- *self
- }
-}
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Clone for SocketAddrV6 {
- fn clone(&self) -> SocketAddrV6 {
- *self
- }
-}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl PartialEq for SocketAddrV4 {
- fn eq(&self, other: &SocketAddrV4) -> bool {
- self.inner.sin_port == other.inner.sin_port
- && in_addr_s_addr(self.inner.sin_addr) == in_addr_s_addr(other.inner.sin_addr)
- }
-}
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl PartialEq for SocketAddrV6 {
- fn eq(&self, other: &SocketAddrV6) -> bool {
- self.inner.sin6_port == other.inner.sin6_port
- && in6_addr_s6_addr(self.inner.sin6_addr) == in6_addr_s6_addr(self.inner.sin6_addr)
- && self.inner.sin6_flowinfo == other.inner.sin6_flowinfo
- && sockaddr_in6_sin6_scope_id(self.inner) == sockaddr_in6_sin6_scope_id(other.inner)
- }
-}
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Eq for SocketAddrV4 {}
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Eq for SocketAddrV6 {}
-
#[cfg_attr(staged_api, stable(feature = "socketaddr_ordering", since = "1.45.0"))]
impl PartialOrd for SocketAddrV4 {
fn partial_cmp(&self, other: &SocketAddrV4) -> Option<Ordering> {
@@ -742,18 +632,12 @@ impl Ord for SocketAddrV6 {
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
impl hash::Hash for SocketAddrV4 {
fn hash<H: hash::Hasher>(&self, s: &mut H) {
- (self.inner.sin_port, in_addr_s_addr(self.inner.sin_addr)).hash(s)
+ (self.port, self.ip).hash(s)
}
}
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
impl hash::Hash for SocketAddrV6 {
fn hash<H: hash::Hasher>(&self, s: &mut H) {
- (
- self.inner.sin6_port,
- &in6_addr_s6_addr(self.inner.sin6_addr),
- self.inner.sin6_flowinfo,
- sockaddr_in6_sin6_scope_id(self.inner),
- )
- .hash(s)
+ (self.port, &self.ip, self.flowinfo, self.scope_id).hash(s)
}
}
diff --git a/vendor/rustix/src/net/ip.rs b/vendor/rustix/src/net/ip.rs
index 7c587cc7a..4d921cc10 100644
--- a/vendor/rustix/src/net/ip.rs
+++ b/vendor/rustix/src/net/ip.rs
@@ -1,6 +1,8 @@
//! The following is derived from Rust's
-//! library/std/src/net/ip.rs at revision
-//! dca3f1b786efd27be3b325ed1e01e247aa589c3b.
+//! library/std/src/net/ip_addr.rs at revision
+//! 14230a7f8e117aa049d3ae661fa00ded7edefc68.
+//!
+//! All code in this file is licensed MIT or Apache 2.0 at your option.
//!
//! This defines `IpAddr`, `Ipv4Addr`, and `Ipv6Addr`. Ideally, these should be
//! defined in `core`. See [RFC 2832].
@@ -9,10 +11,7 @@
#![allow(unsafe_code)]
-use crate::imp::c;
-use crate::imp::net::ext::{in6_addr_new, in6_addr_s6_addr, in_addr_new, in_addr_s_addr};
use core::cmp::Ordering;
-use core::hash;
use core::mem::transmute;
/// An IP address, either IPv4 or IPv6.
@@ -20,9 +19,6 @@ use core::mem::transmute;
/// This enum can contain either an [`Ipv4Addr`] or an [`Ipv6Addr`], see their
/// respective documentation for more details.
///
-/// The size of an `IpAddr` instance may vary depending on the target operating
-/// system.
-///
/// # Examples
///
/// ```
@@ -55,9 +51,6 @@ pub enum IpAddr {
///
/// See [`IpAddr`] for a type encompassing both IPv4 and IPv6 addresses.
///
-/// The size of an `Ipv4Addr` struct may vary depending on the target operating
-/// system.
-///
/// [IETF RFC 791]: https://tools.ietf.org/html/rfc791
///
/// # Textual representation
@@ -82,10 +75,10 @@ pub enum IpAddr {
/// assert!("0000000.0.0.0".parse::<Ipv4Addr>().is_err()); // first octet is a zero in octal
/// assert!("0xcb.0x0.0x71.0x00".parse::<Ipv4Addr>().is_err()); // all octets are in hex
/// ```
-#[derive(Copy)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub struct Ipv4Addr {
- pub(crate) inner: c::in_addr,
+ octets: [u8; 4],
}
/// An IPv6 address.
@@ -93,9 +86,6 @@ pub struct Ipv4Addr {
/// IPv6 addresses are defined as 128-bit integers in [IETF RFC 4291].
/// They are usually represented as eight 16-bit segments.
///
-/// The size of an `Ipv6Addr` struct may vary depending on the target operating
-/// system.
-///
/// [IETF RFC 4291]: https://tools.ietf.org/html/rfc4291
///
/// # Embedding IPv4 Addresses
@@ -143,6 +133,8 @@ pub struct Ipv4Addr {
///
/// To convert from an IPv4 address to an IPv4-mapped IPv6 address, use [`Ipv4Addr::to_ipv6_mapped`].
/// Use [`Ipv6Addr::to_ipv4`] to convert an IPv4-mapped IPv6 address to the canonical IPv4 address.
+/// Note that this will also convert the IPv6 loopback address `::1` to `0.0.0.1`. Use
+/// [`Ipv6Addr::to_ipv4_mapped`] to avoid this.
///
/// [IETF RFC 4291 Section 2.5.5.2]: https://datatracker.ietf.org/doc/html/rfc4291#section-2.5.5.2
///
@@ -165,10 +157,10 @@ pub struct Ipv4Addr {
/// assert_eq!("::1".parse(), Ok(localhost));
/// assert_eq!(localhost.is_loopback(), true);
/// ```
-#[derive(Copy)]
+#[derive(Copy, Clone, PartialEq, Eq, Hash)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub struct Ipv6Addr {
- pub(crate) inner: c::in6_addr,
+ octets: [u8; 16],
}
/// Scope of an [IPv6 multicast address] as defined in [IETF RFC 7346 section 2].
@@ -240,7 +232,10 @@ impl IpAddr {
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)).is_unspecified(), true);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)).is_unspecified(), true);
/// ```
- #[cfg_attr(staged_api, rustc_const_stable(feature = "const_ip", since = "1.50.0"))]
+ #[cfg_attr(
+ staged_api,
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
+ )]
#[cfg_attr(staged_api, stable(feature = "ip_shared", since = "1.12.0"))]
#[must_use]
#[inline]
@@ -264,7 +259,10 @@ impl IpAddr {
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)).is_loopback(), true);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0x1)).is_loopback(), true);
/// ```
- #[cfg_attr(staged_api, rustc_const_stable(feature = "const_ip", since = "1.50.0"))]
+ #[cfg_attr(
+ staged_api,
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
+ )]
#[cfg_attr(staged_api, stable(feature = "ip_shared", since = "1.12.0"))]
#[must_use]
#[inline]
@@ -317,7 +315,10 @@ impl IpAddr {
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(224, 254, 0, 0)).is_multicast(), true);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0xff00, 0, 0, 0, 0, 0, 0, 0)).is_multicast(), true);
/// ```
- #[cfg_attr(staged_api, rustc_const_stable(feature = "const_ip", since = "1.50.0"))]
+ #[cfg_attr(
+ staged_api,
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
+ )]
#[cfg_attr(staged_api, stable(feature = "ip_shared", since = "1.12.0"))]
#[must_use]
#[inline]
@@ -398,7 +399,10 @@ impl IpAddr {
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(203, 0, 113, 6)).is_ipv4(), true);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0)).is_ipv4(), false);
/// ```
- #[cfg_attr(staged_api, rustc_const_stable(feature = "const_ip", since = "1.50.0"))]
+ #[cfg_attr(
+ staged_api,
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
+ )]
#[cfg_attr(staged_api, stable(feature = "ipaddr_checker", since = "1.16.0"))]
#[must_use]
#[inline]
@@ -419,7 +423,10 @@ impl IpAddr {
/// assert_eq!(IpAddr::V4(Ipv4Addr::new(203, 0, 113, 6)).is_ipv6(), false);
/// assert_eq!(IpAddr::V6(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0)).is_ipv6(), true);
/// ```
- #[cfg_attr(staged_api, rustc_const_stable(feature = "const_ip", since = "1.50.0"))]
+ #[cfg_attr(
+ staged_api,
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
+ )]
#[cfg_attr(staged_api, stable(feature = "ipaddr_checker", since = "1.16.0"))]
#[must_use]
#[inline]
@@ -470,16 +477,14 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.32.0")
+ rustc_const_stable(feature = "const_ip_32", since = "1.32.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use]
#[inline]
pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
- // `s_addr` is stored as BE on all machine and the array is in BE order.
- // So the native endian conversion method is used so that it's never swapped.
Ipv4Addr {
- inner: in_addr_new(u32::from_ne_bytes([a, b, c, d])),
+ octets: [a, b, c, d],
}
}
@@ -537,14 +542,13 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use]
#[inline]
pub const fn octets(&self) -> [u8; 4] {
- // This returns the order we want because s_addr is stored in big-endian.
- in_addr_s_addr(self.inner).to_ne_bytes()
+ self.octets
}
/// Returns [`true`] for the special 'unspecified' address (`0.0.0.0`).
@@ -564,13 +568,13 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.32.0")
+ rustc_const_stable(feature = "const_ip_32", since = "1.32.0")
)]
#[cfg_attr(staged_api, stable(feature = "ip_shared", since = "1.12.0"))]
#[must_use]
#[inline]
pub const fn is_unspecified(&self) -> bool {
- in_addr_s_addr(self.inner) == 0
+ u32::from_be_bytes(self.octets) == 0
}
/// Returns [`true`] if this is a loopback address (`127.0.0.0/8`).
@@ -589,7 +593,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -623,7 +627,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -654,7 +658,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -663,25 +667,31 @@ impl Ipv4Addr {
matches!(self.octets(), [169, 254, ..])
}
- /// Returns [`true`] if the address appears to be globally routable.
- /// See [iana-ipv4-special-registry][ipv4-sr].
+ /// Returns [`true`] if the address appears to be globally reachable
+ /// as specified by the [IANA IPv4 Special-Purpose Address Registry].
+ /// Whether or not an address is practically reachable will depend on your network configuration.
///
- /// The following return [`false`]:
+ /// Most IPv4 addresses are globally reachable;
+ /// unless they are specifically defined as *not* globally reachable.
///
- /// - private addresses (see [`Ipv4Addr::is_private()`])
- /// - the loopback address (see [`Ipv4Addr::is_loopback()`])
- /// - the link-local address (see [`Ipv4Addr::is_link_local()`])
- /// - the broadcast address (see [`Ipv4Addr::is_broadcast()`])
- /// - addresses used for documentation (see [`Ipv4Addr::is_documentation()`])
- /// - the unspecified address (see [`Ipv4Addr::is_unspecified()`]), and the whole
- /// `0.0.0.0/8` block
- /// - addresses reserved for future protocols, except
- /// `192.0.0.9/32` and `192.0.0.10/32` which are globally routable
- /// - addresses reserved for future use (see [`Ipv4Addr::is_reserved()`]
- /// - addresses reserved for networking devices benchmarking (see
- /// [`Ipv4Addr::is_benchmarking()`])
+ /// Non-exhaustive list of notable addresses that are not globally reachable:
///
- /// [ipv4-sr]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
+ /// - The [unspecified address] ([`is_unspecified`](Ipv4Addr::is_unspecified))
+ /// - Addresses reserved for private use ([`is_private`](Ipv4Addr::is_private))
+ /// - Addresses in the shared address space ([`is_shared`](Ipv4Addr::is_shared))
+ /// - Loopback addresses ([`is_loopback`](Ipv4Addr::is_loopback))
+ /// - Link-local addresses ([`is_link_local`](Ipv4Addr::is_link_local))
+ /// - Addresses reserved for documentation ([`is_documentation`](Ipv4Addr::is_documentation))
+ /// - Addresses reserved for benchmarking ([`is_benchmarking`](Ipv4Addr::is_benchmarking))
+ /// - Reserved addresses ([`is_reserved`](Ipv4Addr::is_reserved))
+ /// - The [broadcast address] ([`is_broadcast`](Ipv4Addr::is_broadcast))
+ ///
+ /// For the complete overview of which addresses are globally reachable, see the table at the [IANA IPv4 Special-Purpose Address Registry].
+ ///
+ /// [IANA IPv4 Special-Purpose Address Registry]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
+ /// [unspecified address]: Ipv4Addr::UNSPECIFIED
+ /// [broadcast address]: Ipv4Addr::BROADCAST
+
///
/// # Examples
///
@@ -690,46 +700,44 @@ impl Ipv4Addr {
///
/// use std::net::Ipv4Addr;
///
- /// // private addresses are not global
+ /// // Most IPv4 addresses are globally reachable:
+ /// assert_eq!(Ipv4Addr::new(80, 9, 12, 3).is_global(), true);
+ ///
+ /// // However some addresses have been assigned a special meaning
+ /// // that makes them not globally reachable. Some examples are:
+ ///
+ /// // The unspecified address (`0.0.0.0`)
+ /// assert_eq!(Ipv4Addr::UNSPECIFIED.is_global(), false);
+ ///
+ /// // Addresses reserved for private use (`10.0.0.0/8`, `172.16.0.0/12`, 192.168.0.0/16)
/// assert_eq!(Ipv4Addr::new(10, 254, 0, 0).is_global(), false);
/// assert_eq!(Ipv4Addr::new(192, 168, 10, 65).is_global(), false);
/// assert_eq!(Ipv4Addr::new(172, 16, 10, 65).is_global(), false);
///
- /// // the 0.0.0.0/8 block is not global
- /// assert_eq!(Ipv4Addr::new(0, 1, 2, 3).is_global(), false);
- /// // in particular, the unspecified address is not global
- /// assert_eq!(Ipv4Addr::new(0, 0, 0, 0).is_global(), false);
+ /// // Addresses in the shared address space (`100.64.0.0/10`)
+ /// assert_eq!(Ipv4Addr::new(100, 100, 0, 0).is_global(), false);
///
- /// // the loopback address is not global
- /// assert_eq!(Ipv4Addr::new(127, 0, 0, 1).is_global(), false);
+ /// // The loopback addresses (`127.0.0.0/8`)
+ /// assert_eq!(Ipv4Addr::LOCALHOST.is_global(), false);
///
- /// // link local addresses are not global
+ /// // Link-local addresses (`169.254.0.0/16`)
/// assert_eq!(Ipv4Addr::new(169, 254, 45, 1).is_global(), false);
///
- /// // the broadcast address is not global
- /// assert_eq!(Ipv4Addr::new(255, 255, 255, 255).is_global(), false);
- ///
- /// // the address space designated for documentation is not global
+ /// // Addresses reserved for documentation (`192.0.2.0/24`, `198.51.100.0/24`, `203.0.113.0/24`)
/// assert_eq!(Ipv4Addr::new(192, 0, 2, 255).is_global(), false);
/// assert_eq!(Ipv4Addr::new(198, 51, 100, 65).is_global(), false);
/// assert_eq!(Ipv4Addr::new(203, 0, 113, 6).is_global(), false);
///
- /// // shared addresses are not global
- /// assert_eq!(Ipv4Addr::new(100, 100, 0, 0).is_global(), false);
- ///
- /// // addresses reserved for protocol assignment are not global
- /// assert_eq!(Ipv4Addr::new(192, 0, 0, 0).is_global(), false);
- /// assert_eq!(Ipv4Addr::new(192, 0, 0, 255).is_global(), false);
+ /// // Addresses reserved for benchmarking (`198.18.0.0/15`)
+ /// assert_eq!(Ipv4Addr::new(198, 18, 0, 0).is_global(), false);
///
- /// // addresses reserved for future use are not global
+ /// // Reserved addresses (`240.0.0.0/4`)
/// assert_eq!(Ipv4Addr::new(250, 10, 20, 30).is_global(), false);
///
- /// // addresses reserved for network devices benchmarking are not global
- /// assert_eq!(Ipv4Addr::new(198, 18, 0, 0).is_global(), false);
+ /// // The broadcast address (`255.255.255.255`)
+ /// assert_eq!(Ipv4Addr::BROADCAST.is_global(), false);
///
- /// // All the other addresses are global
- /// assert_eq!(Ipv4Addr::new(1, 1, 1, 1).is_global(), true);
- /// assert_eq!(Ipv4Addr::new(80, 9, 12, 3).is_global(), true);
+ /// // For a complete overview see the IANA IPv4 Special-Purpose Address Registry.
/// ```
#[cfg_attr(
staged_api,
@@ -739,25 +747,17 @@ impl Ipv4Addr {
#[must_use]
#[inline]
pub const fn is_global(&self) -> bool {
- // check if this address is 192.0.0.9 or 192.0.0.10. These addresses are the only two
- // globally routable addresses in the 192.0.0.0/24 range.
- if u32::from_be_bytes(self.octets()) == 0xc0000009
- || u32::from_be_bytes(self.octets()) == 0xc000000a
- {
- return true;
- }
- !self.is_private()
- && !self.is_loopback()
- && !self.is_link_local()
- && !self.is_broadcast()
- && !self.is_documentation()
- && !self.is_shared()
+ !(self.octets()[0] == 0 // "This network"
+ || self.is_private()
+ || self.is_shared()
+ || self.is_loopback()
+ || self.is_link_local()
// addresses reserved for future protocols (`192.0.0.0/24`)
- && !(self.octets()[0] == 192 && self.octets()[1] == 0 && self.octets()[2] == 0)
- && !self.is_reserved()
- && !self.is_benchmarking()
- // Make sure the address is not in 0.0.0.0/8
- && self.octets()[0] != 0
+ ||(self.octets()[0] == 192 && self.octets()[1] == 0 && self.octets()[2] == 0)
+ || self.is_documentation()
+ || self.is_benchmarking()
+ || self.is_reserved()
+ || self.is_broadcast())
}
/// Returns [`true`] if this address is part of the Shared Address Space defined in
@@ -871,7 +871,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -896,7 +896,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -927,18 +927,16 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
#[inline]
pub const fn is_documentation(&self) -> bool {
- match self.octets() {
- [192, 0, 2, _] => true,
- [198, 51, 100, _] => true,
- [203, 0, 113, _] => true,
- _ => false,
- }
+ matches!(
+ self.octets(),
+ [192, 0, 2, _] | [198, 51, 100, _] | [203, 0, 113, _]
+ )
}
/// Converts this address to an [IPv4-compatible] [`IPv6` address].
@@ -963,7 +961,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use = "this returns the result of the operation, \
@@ -972,7 +970,7 @@ impl Ipv4Addr {
pub const fn to_ipv6_compatible(&self) -> Ipv6Addr {
let [a, b, c, d] = self.octets();
Ipv6Addr {
- inner: in6_addr_new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a, b, c, d]),
+ octets: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, a, b, c, d],
}
}
@@ -993,7 +991,7 @@ impl Ipv4Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv4", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use = "this returns the result of the operation, \
@@ -1002,7 +1000,7 @@ impl Ipv4Addr {
pub const fn to_ipv6_mapped(&self) -> Ipv6Addr {
let [a, b, c, d] = self.octets();
Ipv6Addr {
- inner: in6_addr_new([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, a, b, c, d]),
+ octets: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, a, b, c, d],
}
}
}
@@ -1051,22 +1049,6 @@ impl From<Ipv6Addr> for IpAddr {
}
}
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Clone for Ipv4Addr {
- #[inline]
- fn clone(&self) -> Ipv4Addr {
- *self
- }
-}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl PartialEq for Ipv4Addr {
- #[inline]
- fn eq(&self, other: &Ipv4Addr) -> bool {
- in_addr_s_addr(self.inner) == in_addr_s_addr(other.inner)
- }
-}
-
#[cfg_attr(staged_api, stable(feature = "ip_cmp", since = "1.16.0"))]
impl PartialEq<Ipv4Addr> for IpAddr {
#[inline]
@@ -1090,21 +1072,6 @@ impl PartialEq<IpAddr> for Ipv4Addr {
}
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Eq for Ipv4Addr {}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl hash::Hash for Ipv4Addr {
- #[inline]
- fn hash<H: hash::Hasher>(&self, s: &mut H) {
- // NOTE:
- // * hash in big endian order
- // * in netbsd, `in_addr` has `repr(packed)`, we need to
- // copy `s_addr` to avoid unsafe borrowing
- { in_addr_s_addr(self.inner) }.hash(s)
- }
-}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
impl PartialOrd for Ipv4Addr {
#[inline]
fn partial_cmp(&self, other: &Ipv4Addr) -> Option<Ordering> {
@@ -1138,8 +1105,7 @@ impl PartialOrd<IpAddr> for Ipv4Addr {
impl Ord for Ipv4Addr {
#[inline]
fn cmp(&self, other: &Ipv4Addr) -> Ordering {
- // Compare as native endian
- u32::from_be(in_addr_s_addr(self.inner)).cmp(&u32::from_be(in_addr_s_addr(other.inner)))
+ self.octets.cmp(&other.octets)
}
}
@@ -1152,13 +1118,12 @@ impl From<Ipv4Addr> for u32 {
/// ```
/// use std::net::Ipv4Addr;
///
- /// let addr = Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe);
- /// assert_eq!(0xcafebabe, u32::from(addr));
+ /// let addr = Ipv4Addr::new(0x12, 0x34, 0x56, 0x78);
+ /// assert_eq!(0x12345678, u32::from(addr));
/// ```
#[inline]
fn from(ip: Ipv4Addr) -> u32 {
- let ip = ip.octets();
- u32::from_be_bytes(ip)
+ u32::from_be_bytes(ip.octets)
}
}
@@ -1171,12 +1136,14 @@ impl From<u32> for Ipv4Addr {
/// ```
/// use std::net::Ipv4Addr;
///
- /// let addr = Ipv4Addr::from(0xcafebabe);
- /// assert_eq!(Ipv4Addr::new(0xca, 0xfe, 0xba, 0xbe), addr);
+ /// let addr = Ipv4Addr::from(0x12345678);
+ /// assert_eq!(Ipv4Addr::new(0x12, 0x34, 0x56, 0x78), addr);
/// ```
#[inline]
fn from(ip: u32) -> Ipv4Addr {
- Ipv4Addr::from(ip.to_be_bytes())
+ Ipv4Addr {
+ octets: ip.to_be_bytes(),
+ }
}
}
@@ -1194,7 +1161,7 @@ impl From<[u8; 4]> for Ipv4Addr {
/// ```
#[inline]
fn from(octets: [u8; 4]) -> Ipv4Addr {
- Ipv4Addr::new(octets[0], octets[1], octets[2], octets[3])
+ Ipv4Addr { octets }
}
}
@@ -1230,7 +1197,7 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.32.0")
+ rustc_const_stable(feature = "const_ip_32", since = "1.32.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use]
@@ -1249,9 +1216,7 @@ impl Ipv6Addr {
Ipv6Addr {
// All elements in `addr16` are big endian.
// SAFETY: `[u16; 8]` is always safe to transmute to `[u8; 16]`.
- // rustc_allow_const_fn_unstable: the transmute could be written as stable const
- // code, but that leads to worse code generation (#75085)
- inner: in6_addr_new(unsafe { transmute::<_, [u8; 16]>(addr16) }),
+ octets: unsafe { transmute::<_, [u8; 16]>(addr16) },
}
}
@@ -1293,18 +1258,15 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use]
#[inline]
pub const fn segments(&self) -> [u16; 8] {
- // All elements in `s6_addr` must be big endian.
+ // All elements in `self.octets` must be big endian.
// SAFETY: `[u8; 16]` is always safe to transmute to `[u16; 8]`.
- // rustc_allow_const_fn_unstable: the transmute could be written as stable const code, but
- // that leads to worse code generation (#75085)
- let [a, b, c, d, e, f, g, h] =
- unsafe { transmute::<_, [u16; 8]>(in6_addr_s6_addr(self.inner)) };
+ let [a, b, c, d, e, f, g, h] = unsafe { transmute::<_, [u16; 8]>(self.octets) };
// We want native endian u16
[
u16::from_be(a),
@@ -1334,7 +1296,7 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -1361,7 +1323,7 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -1370,13 +1332,33 @@ impl Ipv6Addr {
u128::from_be_bytes(self.octets()) == u128::from_be_bytes(Ipv6Addr::LOCALHOST.octets())
}
- /// Returns [`true`] if the address appears to be globally routable.
+ /// Returns [`true`] if the address appears to be globally reachable
+ /// as specified by the [IANA IPv6 Special-Purpose Address Registry].
+ /// Whether or not an address is practically reachable will depend on your network configuration.
///
- /// The following return [`false`]:
+ /// Most IPv6 addresses are globally reachable;
+ /// unless they are specifically defined as *not* globally reachable.
///
- /// - the loopback address
- /// - link-local and unique local unicast addresses
- /// - interface-, link-, realm-, admin- and site-local multicast addresses
+ /// Non-exhaustive list of notable addresses that are not globally reachable:
+ /// - The [unspecified address] ([`is_unspecified`](Ipv6Addr::is_unspecified))
+ /// - The [loopback address] ([`is_loopback`](Ipv6Addr::is_loopback))
+ /// - IPv4-mapped addresses
+ /// - Addresses reserved for benchmarking
+ /// - Addresses reserved for documentation ([`is_documentation`](Ipv6Addr::is_documentation))
+ /// - Unique local addresses ([`is_unique_local`](Ipv6Addr::is_unique_local))
+ /// - Unicast addresses with link-local scope ([`is_unicast_link_local`](Ipv6Addr::is_unicast_link_local))
+ ///
+ /// For the complete overview of which addresses are globally reachable, see the table at the [IANA IPv6 Special-Purpose Address Registry].
+ ///
+ /// Note that an address having global scope is not the same as being globally reachable,
+ /// and there is no direct relation between the two concepts: There exist addresses with global scope
+ /// that are not globally reachable (for example unique local addresses),
+ /// and addresses that are globally reachable without having global scope
+ /// (multicast addresses with non-global scope).
+ ///
+ /// [IANA IPv6 Special-Purpose Address Registry]: https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml
+ /// [unspecified address]: Ipv6Addr::UNSPECIFIED
+ /// [loopback address]: Ipv6Addr::LOCALHOST
///
/// # Examples
///
@@ -1385,9 +1367,34 @@ impl Ipv6Addr {
///
/// use std::net::Ipv6Addr;
///
- /// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_global(), true);
- /// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0x1).is_global(), false);
- /// assert_eq!(Ipv6Addr::new(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1).is_global(), true);
+ /// // Most IPv6 addresses are globally reachable:
+ /// assert_eq!(Ipv6Addr::new(0x26, 0, 0x1c9, 0, 0, 0xafc8, 0x10, 0x1).is_global(), true);
+ ///
+ /// // However some addresses have been assigned a special meaning
+ /// // that makes them not globally reachable. Some examples are:
+ ///
+ /// // The unspecified address (`::`)
+ /// assert_eq!(Ipv6Addr::UNSPECIFIED.is_global(), false);
+ ///
+ /// // The loopback address (`::1`)
+ /// assert_eq!(Ipv6Addr::LOCALHOST.is_global(), false);
+ ///
+ /// // IPv4-mapped addresses (`::ffff:0:0/96`)
+ /// assert_eq!(Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).is_global(), false);
+ ///
+ /// // Addresses reserved for benchmarking (`2001:2::/48`)
+ /// assert_eq!(Ipv6Addr::new(0x2001, 2, 0, 0, 0, 0, 0, 1,).is_global(), false);
+ ///
+ /// // Addresses reserved for documentation (`2001:db8::/32`)
+ /// assert_eq!(Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0, 1).is_global(), false);
+ ///
+ /// // Unique local addresses (`fc00::/7`)
+ /// assert_eq!(Ipv6Addr::new(0xfc02, 0, 0, 0, 0, 0, 0, 1).is_global(), false);
+ ///
+ /// // Unicast addresses with link-local scope (`fe80::/10`)
+ /// assert_eq!(Ipv6Addr::new(0xfe81, 0, 0, 0, 0, 0, 0, 1).is_global(), false);
+ ///
+ /// // For a complete overview see the IANA IPv6 Special-Purpose Address Registry.
/// ```
#[cfg_attr(
staged_api,
@@ -1397,11 +1404,31 @@ impl Ipv6Addr {
#[must_use]
#[inline]
pub const fn is_global(&self) -> bool {
- match self.multicast_scope() {
- Some(Ipv6MulticastScope::Global) => true,
- None => self.is_unicast_global(),
- _ => false,
- }
+ !(self.is_unspecified()
+ || self.is_loopback()
+ // IPv4-mapped Address (`::ffff:0:0/96`)
+ || matches!(self.segments(), [0, 0, 0, 0, 0, 0xffff, _, _])
+ // IPv4-IPv6 Translat. (`64:ff9b:1::/48`)
+ || matches!(self.segments(), [0x64, 0xff9b, 1, _, _, _, _, _])
+ // Discard-Only Address Block (`100::/64`)
+ || matches!(self.segments(), [0x100, 0, 0, 0, _, _, _, _])
+ // IETF Protocol Assignments (`2001::/23`)
+ || (matches!(self.segments(), [0x2001, b, _, _, _, _, _, _] if b < 0x200)
+ && !(
+ // Port Control Protocol Anycast (`2001:1::1`)
+ u128::from_be_bytes(self.octets()) == 0x2001_0001_0000_0000_0000_0000_0000_0001
+ // Traversal Using Relays around NAT Anycast (`2001:1::2`)
+ || u128::from_be_bytes(self.octets()) == 0x2001_0001_0000_0000_0000_0000_0000_0002
+ // AMT (`2001:3::/32`)
+ || matches!(self.segments(), [0x2001, 3, _, _, _, _, _, _])
+ // AS112-v6 (`2001:4:112::/48`)
+ || matches!(self.segments(), [0x2001, 4, 0x112, _, _, _, _, _])
+ // ORCHIDv2 (`2001:20::/28`)
+ || matches!(self.segments(), [0x2001, b, _, _, _, _, _, _] if b >= 0x20 && b <= 0x2F)
+ ))
+ || self.is_documentation()
+ || self.is_unique_local()
+ || self.is_unicast_link_local())
}
/// Returns [`true`] if this is a unique local address (`fc00::/7`).
@@ -1613,6 +1640,7 @@ impl Ipv6Addr {
&& !self.is_unique_local()
&& !self.is_unspecified()
&& !self.is_documentation()
+ && !self.is_benchmarking()
}
/// Returns the address's multicast scope if the address is multicast.
@@ -1670,7 +1698,7 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(since = "1.7.0", feature = "ip_17"))]
#[must_use]
@@ -1692,8 +1720,6 @@ impl Ipv6Addr {
/// # Examples
///
/// ```
- /// #![feature(ip)]
- ///
/// use std::net::{Ipv4Addr, Ipv6Addr};
///
/// assert_eq!(Ipv6Addr::new(0xff00, 0, 0, 0, 0, 0, 0, 0).to_ipv4_mapped(), None);
@@ -1705,7 +1731,7 @@ impl Ipv6Addr {
staged_api,
rustc_const_unstable(feature = "const_ipv6", issue = "76205")
)]
- #[cfg_attr(staged_api, unstable(feature = "ip", issue = "27709"))]
+ #[cfg_attr(staged_api, stable(feature = "ipv6_to_ipv4_mapped", since = "1.63.0"))]
#[must_use = "this returns the result of the operation, \
without modifying the original"]
#[inline]
@@ -1723,7 +1749,10 @@ impl Ipv6Addr {
/// or an [IPv4-mapped] address as defined in [IETF RFC 4291 section 2.5.5.2],
/// otherwise returns [`None`].
///
- /// `::a.b.c.d` and `::ffff:a.b.c.d` become `a.b.c.d`
+ /// Note that this will return an [`IPv4` address] for the IPv6 loopback address `::1`. Use
+ /// [`Ipv6Addr::to_ipv4_mapped`] to avoid this.
+ ///
+ /// `::a.b.c.d` and `::ffff:a.b.c.d` become `a.b.c.d`. `::1` becomes `0.0.0.1`.
/// All addresses *not* starting with either all zeroes or `::ffff` will return `None`.
///
/// [`IPv4` address]: Ipv4Addr
@@ -1745,7 +1774,7 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.50.0")
+ rustc_const_stable(feature = "const_ip_50", since = "1.50.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#[must_use = "this returns the result of the operation, \
@@ -1798,29 +1827,13 @@ impl Ipv6Addr {
/// ```
#[cfg_attr(
staged_api,
- rustc_const_stable(feature = "const_ipv6", since = "1.32.0")
+ rustc_const_stable(feature = "const_ip_32", since = "1.32.0")
)]
#[cfg_attr(staged_api, stable(feature = "ipv6_to_octets", since = "1.12.0"))]
#[must_use]
#[inline]
pub const fn octets(&self) -> [u8; 16] {
- in6_addr_s6_addr(self.inner)
- }
-}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Clone for Ipv6Addr {
- #[inline]
- fn clone(&self) -> Ipv6Addr {
- *self
- }
-}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl PartialEq for Ipv6Addr {
- #[inline]
- fn eq(&self, other: &Ipv6Addr) -> bool {
- in6_addr_s6_addr(self.inner) == in6_addr_s6_addr(other.inner)
+ self.octets
}
}
@@ -1847,17 +1860,6 @@ impl PartialEq<Ipv6Addr> for IpAddr {
}
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl Eq for Ipv6Addr {}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
-impl hash::Hash for Ipv6Addr {
- #[inline]
- fn hash<H: hash::Hasher>(&self, s: &mut H) {
- in6_addr_s6_addr(self.inner).hash(s)
- }
-}
-
-#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
impl PartialOrd for Ipv6Addr {
#[inline]
fn partial_cmp(&self, other: &Ipv6Addr) -> Option<Ordering> {
@@ -1912,8 +1914,7 @@ impl From<Ipv6Addr> for u128 {
/// ```
#[inline]
fn from(ip: Ipv6Addr) -> u128 {
- let ip = ip.octets();
- u128::from_be_bytes(ip)
+ u128::from_be_bytes(ip.octets)
}
}
#[cfg_attr(staged_api, stable(feature = "i128", since = "1.26.0"))]
@@ -1964,9 +1965,7 @@ impl From<[u8; 16]> for Ipv6Addr {
/// ```
#[inline]
fn from(octets: [u8; 16]) -> Ipv6Addr {
- Ipv6Addr {
- inner: in6_addr_new(octets),
- }
+ Ipv6Addr { octets }
}
}
diff --git a/vendor/rustix/src/net/send_recv.rs b/vendor/rustix/src/net/send_recv.rs
index 83ccc79d4..041077266 100644
--- a/vendor/rustix/src/net/send_recv.rs
+++ b/vendor/rustix/src/net/send_recv.rs
@@ -3,10 +3,10 @@
#[cfg(unix)]
use crate::net::SocketAddrUnix;
use crate::net::{SocketAddr, SocketAddrAny, SocketAddrV4, SocketAddrV6};
-use crate::{imp, io};
-use imp::fd::{AsFd, BorrowedFd};
+use crate::{backend, io};
+use backend::fd::{AsFd, BorrowedFd};
-pub use imp::net::send_recv::{RecvFlags, SendFlags};
+pub use backend::net::send_recv::{RecvFlags, SendFlags};
/// `recv(fd, buf, flags)`—Reads data from a socket.
///
@@ -22,7 +22,7 @@ pub use imp::net::send_recv::{RecvFlags, SendFlags};
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv
#[inline]
pub fn recv<Fd: AsFd>(fd: Fd, buf: &mut [u8], flags: RecvFlags) -> io::Result<usize> {
- imp::net::syscalls::recv(fd.as_fd(), buf, flags)
+ backend::net::syscalls::recv(fd.as_fd(), buf, flags)
}
/// `send(fd, buf, flags)`—Writes data to a socket.
@@ -39,7 +39,7 @@ pub fn recv<Fd: AsFd>(fd: Fd, buf: &mut [u8], flags: RecvFlags) -> io::Result<us
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send
#[inline]
pub fn send<Fd: AsFd>(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result<usize> {
- imp::net::syscalls::send(fd.as_fd(), buf, flags)
+ backend::net::syscalls::send(fd.as_fd(), buf, flags)
}
/// `recvfrom(fd, buf, flags, addr, len)`—Reads data from a socket and
@@ -61,7 +61,7 @@ pub fn recvfrom<Fd: AsFd>(
buf: &mut [u8],
flags: RecvFlags,
) -> io::Result<(usize, Option<SocketAddrAny>)> {
- imp::net::syscalls::recvfrom(fd.as_fd(), buf, flags)
+ backend::net::syscalls::recvfrom(fd.as_fd(), buf, flags)
}
/// `sendto(fd, buf, flags, addr)`—Writes data to a socket to a specific IP
@@ -93,8 +93,8 @@ fn _sendto(
addr: &SocketAddr,
) -> io::Result<usize> {
match addr {
- SocketAddr::V4(v4) => imp::net::syscalls::sendto_v4(fd, buf, flags, v4),
- SocketAddr::V6(v6) => imp::net::syscalls::sendto_v6(fd, buf, flags, v6),
+ SocketAddr::V4(v4) => backend::net::syscalls::sendto_v4(fd, buf, flags, v4),
+ SocketAddr::V6(v6) => backend::net::syscalls::sendto_v6(fd, buf, flags, v6),
}
}
@@ -127,10 +127,10 @@ fn _sendto_any(
addr: &SocketAddrAny,
) -> io::Result<usize> {
match addr {
- SocketAddrAny::V4(v4) => imp::net::syscalls::sendto_v4(fd, buf, flags, v4),
- SocketAddrAny::V6(v6) => imp::net::syscalls::sendto_v6(fd, buf, flags, v6),
+ SocketAddrAny::V4(v4) => backend::net::syscalls::sendto_v4(fd, buf, flags, v4),
+ SocketAddrAny::V6(v6) => backend::net::syscalls::sendto_v6(fd, buf, flags, v6),
#[cfg(unix)]
- SocketAddrAny::Unix(unix) => imp::net::syscalls::sendto_unix(fd, buf, flags, unix),
+ SocketAddrAny::Unix(unix) => backend::net::syscalls::sendto_unix(fd, buf, flags, unix),
}
}
@@ -155,7 +155,7 @@ pub fn sendto_v4<Fd: AsFd>(
flags: SendFlags,
addr: &SocketAddrV4,
) -> io::Result<usize> {
- imp::net::syscalls::sendto_v4(fd.as_fd(), buf, flags, addr)
+ backend::net::syscalls::sendto_v4(fd.as_fd(), buf, flags, addr)
}
/// `sendto(fd, buf, flags, addr, sizeof(struct sockaddr_in6))`—Writes data
@@ -179,7 +179,7 @@ pub fn sendto_v6<Fd: AsFd>(
flags: SendFlags,
addr: &SocketAddrV6,
) -> io::Result<usize> {
- imp::net::syscalls::sendto_v6(fd.as_fd(), buf, flags, addr)
+ backend::net::syscalls::sendto_v6(fd.as_fd(), buf, flags, addr)
}
/// `sendto(fd, buf, flags, addr, sizeof(struct sockaddr_un))`—Writes data to
@@ -204,7 +204,7 @@ pub fn sendto_unix<Fd: AsFd>(
flags: SendFlags,
addr: &SocketAddrUnix,
) -> io::Result<usize> {
- imp::net::syscalls::sendto_unix(fd.as_fd(), buf, flags, addr)
+ backend::net::syscalls::sendto_unix(fd.as_fd(), buf, flags, addr)
}
// TODO: `recvmsg`, `sendmsg`
diff --git a/vendor/rustix/src/net/socket.rs b/vendor/rustix/src/net/socket.rs
index cd8f149f6..687022afe 100644
--- a/vendor/rustix/src/net/socket.rs
+++ b/vendor/rustix/src/net/socket.rs
@@ -1,11 +1,11 @@
-use crate::imp;
-use crate::io::{self, OwnedFd};
+use crate::fd::OwnedFd;
use crate::net::{SocketAddr, SocketAddrAny, SocketAddrV4, SocketAddrV6};
-use imp::fd::{AsFd, BorrowedFd};
+use crate::{backend, io};
+use backend::fd::{AsFd, BorrowedFd};
#[cfg(unix)]
-pub use imp::net::addr::SocketAddrUnix;
-pub use imp::net::types::{
+pub use backend::net::addr::SocketAddrUnix;
+pub use backend::net::types::{
AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType,
};
@@ -34,7 +34,7 @@ impl Default for Protocol {
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket
#[inline]
pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> io::Result<OwnedFd> {
- imp::net::syscalls::socket(domain, type_, protocol)
+ backend::net::syscalls::socket(domain, type_, protocol)
}
/// `socket_with(domain, type_ | flags, protocol)`—Creates a socket, with
@@ -64,7 +64,7 @@ pub fn socket_with(
flags: SocketFlags,
protocol: Protocol,
) -> io::Result<OwnedFd> {
- imp::net::syscalls::socket_with(domain, type_, flags, protocol)
+ backend::net::syscalls::socket_with(domain, type_, flags, protocol)
}
/// `bind(sockfd, addr)`—Binds a socket to an IP address.
@@ -85,8 +85,8 @@ pub fn bind<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> {
fn _bind(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> {
match addr {
- SocketAddr::V4(v4) => imp::net::syscalls::bind_v4(sockfd, v4),
- SocketAddr::V6(v6) => imp::net::syscalls::bind_v6(sockfd, v6),
+ SocketAddr::V4(v4) => backend::net::syscalls::bind_v4(sockfd, v4),
+ SocketAddr::V6(v6) => backend::net::syscalls::bind_v6(sockfd, v6),
}
}
@@ -109,10 +109,10 @@ pub fn bind_any<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrAny) -> io::Result<()> {
fn _bind_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> {
match addr {
- SocketAddrAny::V4(v4) => imp::net::syscalls::bind_v4(sockfd, v4),
- SocketAddrAny::V6(v6) => imp::net::syscalls::bind_v6(sockfd, v6),
+ SocketAddrAny::V4(v4) => backend::net::syscalls::bind_v4(sockfd, v4),
+ SocketAddrAny::V6(v6) => backend::net::syscalls::bind_v6(sockfd, v6),
#[cfg(unix)]
- SocketAddrAny::Unix(unix) => imp::net::syscalls::bind_unix(sockfd, unix),
+ SocketAddrAny::Unix(unix) => backend::net::syscalls::bind_unix(sockfd, unix),
}
}
@@ -132,7 +132,7 @@ fn _bind_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> {
#[inline]
#[doc(alias = "bind")]
pub fn bind_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
- imp::net::syscalls::bind_v4(sockfd.as_fd(), addr)
+ backend::net::syscalls::bind_v4(sockfd.as_fd(), addr)
}
/// `bind(sockfd, addr, sizeof(struct sockaddr_in6))`—Binds a socket to an
@@ -151,7 +151,7 @@ pub fn bind_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
#[inline]
#[doc(alias = "bind")]
pub fn bind_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
- imp::net::syscalls::bind_v6(sockfd.as_fd(), addr)
+ backend::net::syscalls::bind_v6(sockfd.as_fd(), addr)
}
/// `bind(sockfd, addr, sizeof(struct sockaddr_un))`—Binds a socket to a
@@ -171,7 +171,7 @@ pub fn bind_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
#[inline]
#[doc(alias = "bind")]
pub fn bind_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()> {
- imp::net::syscalls::bind_unix(sockfd.as_fd(), addr)
+ backend::net::syscalls::bind_unix(sockfd.as_fd(), addr)
}
/// `connect(sockfd, addr)`—Initiates a connection to an IP address.
@@ -192,8 +192,8 @@ pub fn connect<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> {
fn _connect(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> {
match addr {
- SocketAddr::V4(v4) => imp::net::syscalls::connect_v4(sockfd, v4),
- SocketAddr::V6(v6) => imp::net::syscalls::connect_v6(sockfd, v6),
+ SocketAddr::V4(v4) => backend::net::syscalls::connect_v4(sockfd, v4),
+ SocketAddr::V6(v6) => backend::net::syscalls::connect_v6(sockfd, v6),
}
}
@@ -216,10 +216,10 @@ pub fn connect_any<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrAny) -> io::Result<()>
fn _connect_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> {
match addr {
- SocketAddrAny::V4(v4) => imp::net::syscalls::connect_v4(sockfd, v4),
- SocketAddrAny::V6(v6) => imp::net::syscalls::connect_v6(sockfd, v6),
+ SocketAddrAny::V4(v4) => backend::net::syscalls::connect_v4(sockfd, v4),
+ SocketAddrAny::V6(v6) => backend::net::syscalls::connect_v6(sockfd, v6),
#[cfg(unix)]
- SocketAddrAny::Unix(unix) => imp::net::syscalls::connect_unix(sockfd, unix),
+ SocketAddrAny::Unix(unix) => backend::net::syscalls::connect_unix(sockfd, unix),
}
}
@@ -239,7 +239,7 @@ fn _connect_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()>
#[inline]
#[doc(alias = "connect")]
pub fn connect_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
- imp::net::syscalls::connect_v4(sockfd.as_fd(), addr)
+ backend::net::syscalls::connect_v4(sockfd.as_fd(), addr)
}
/// `connect(sockfd, addr, sizeof(struct sockaddr_in6))`—Initiates a
@@ -258,7 +258,7 @@ pub fn connect_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> {
#[inline]
#[doc(alias = "connect")]
pub fn connect_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
- imp::net::syscalls::connect_v6(sockfd.as_fd(), addr)
+ backend::net::syscalls::connect_v6(sockfd.as_fd(), addr)
}
/// `connect(sockfd, addr, sizeof(struct sockaddr_un))`—Initiates a
@@ -278,7 +278,7 @@ pub fn connect_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> {
#[inline]
#[doc(alias = "connect")]
pub fn connect_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()> {
- imp::net::syscalls::connect_unix(sockfd.as_fd(), addr)
+ backend::net::syscalls::connect_unix(sockfd.as_fd(), addr)
}
/// `listen(fd, backlog)`—Enables listening for incoming connections.
@@ -295,7 +295,7 @@ pub fn connect_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<(
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen
#[inline]
pub fn listen<Fd: AsFd>(sockfd: Fd, backlog: i32) -> io::Result<()> {
- imp::net::syscalls::listen(sockfd.as_fd(), backlog)
+ backend::net::syscalls::listen(sockfd.as_fd(), backlog)
}
/// `accept(fd, NULL, NULL)`—Accepts an incoming connection.
@@ -319,7 +319,7 @@ pub fn listen<Fd: AsFd>(sockfd: Fd, backlog: i32) -> io::Result<()> {
#[inline]
#[doc(alias = "accept4")]
pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> {
- imp::net::syscalls::accept(sockfd.as_fd())
+ backend::net::syscalls::accept(sockfd.as_fd())
}
/// `accept4(fd, NULL, NULL, flags)`—Accepts an incoming connection, with
@@ -341,7 +341,7 @@ pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> {
#[inline]
#[doc(alias = "accept4")]
pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<OwnedFd> {
- imp::net::syscalls::accept_with(sockfd.as_fd(), flags)
+ backend::net::syscalls::accept_with(sockfd.as_fd(), flags)
}
/// `accept(fd, &addr, &len)`—Accepts an incoming connection and returns the
@@ -362,7 +362,7 @@ pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<Owned
#[inline]
#[doc(alias = "accept4")]
pub fn acceptfrom<Fd: AsFd>(sockfd: Fd) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
- imp::net::syscalls::acceptfrom(sockfd.as_fd())
+ backend::net::syscalls::acceptfrom(sockfd.as_fd())
}
/// `accept4(fd, &addr, &len, flags)`—Accepts an incoming connection and
@@ -383,7 +383,7 @@ pub fn acceptfrom_with<Fd: AsFd>(
sockfd: Fd,
flags: AcceptFlags,
) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> {
- imp::net::syscalls::acceptfrom_with(sockfd.as_fd(), flags)
+ backend::net::syscalls::acceptfrom_with(sockfd.as_fd(), flags)
}
/// `shutdown(fd, how)`—Closes the read and/or write sides of a stream.
@@ -400,7 +400,7 @@ pub fn acceptfrom_with<Fd: AsFd>(
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-shutdown
#[inline]
pub fn shutdown<Fd: AsFd>(sockfd: Fd, how: Shutdown) -> io::Result<()> {
- imp::net::syscalls::shutdown(sockfd.as_fd(), how)
+ backend::net::syscalls::shutdown(sockfd.as_fd(), how)
}
/// `getsockname(fd, addr, len)`—Returns the address a socket is bound to.
@@ -417,7 +417,7 @@ pub fn shutdown<Fd: AsFd>(sockfd: Fd, how: Shutdown) -> io::Result<()> {
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockname
#[inline]
pub fn getsockname<Fd: AsFd>(sockfd: Fd) -> io::Result<SocketAddrAny> {
- imp::net::syscalls::getsockname(sockfd.as_fd())
+ backend::net::syscalls::getsockname(sockfd.as_fd())
}
/// `getpeername(fd, addr, len)`—Returns the address a socket is connected
@@ -435,5 +435,5 @@ pub fn getsockname<Fd: AsFd>(sockfd: Fd) -> io::Result<SocketAddrAny> {
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getpeername
#[inline]
pub fn getpeername<Fd: AsFd>(sockfd: Fd) -> io::Result<Option<SocketAddrAny>> {
- imp::net::syscalls::getpeername(sockfd.as_fd())
+ backend::net::syscalls::getpeername(sockfd.as_fd())
}
diff --git a/vendor/rustix/src/net/socket_addr_any.rs b/vendor/rustix/src/net/socket_addr_any.rs
index 4970dbf74..287c6c1ee 100644
--- a/vendor/rustix/src/net/socket_addr_any.rs
+++ b/vendor/rustix/src/net/socket_addr_any.rs
@@ -12,11 +12,11 @@
#[cfg(unix)]
use crate::net::SocketAddrUnix;
use crate::net::{AddressFamily, SocketAddrV4, SocketAddrV6};
-use crate::{imp, io};
+use crate::{backend, io};
#[cfg(feature = "std")]
use core::fmt;
-pub use imp::net::addr::SocketAddrStorage;
+pub use backend::net::addr::SocketAddrStorage;
/// `struct sockaddr_storage` as a Rust enum.
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
@@ -37,10 +37,10 @@ impl SocketAddrAny {
#[inline]
pub const fn address_family(&self) -> AddressFamily {
match self {
- SocketAddrAny::V4(_) => AddressFamily::INET,
- SocketAddrAny::V6(_) => AddressFamily::INET6,
+ Self::V4(_) => AddressFamily::INET,
+ Self::V6(_) => AddressFamily::INET6,
#[cfg(unix)]
- SocketAddrAny::Unix(_) => AddressFamily::UNIX,
+ Self::Unix(_) => AddressFamily::UNIX,
}
}
@@ -53,7 +53,7 @@ impl SocketAddrAny {
/// `storage` must point to valid memory for encoding the socket
/// address.
pub unsafe fn write(&self, storage: *mut SocketAddrStorage) -> usize {
- imp::net::write_sockaddr::write_sockaddr(self, storage)
+ backend::net::write_sockaddr::write_sockaddr(self, storage)
}
/// Reads a platform-specific encoding of a socket address from
@@ -64,7 +64,7 @@ impl SocketAddrAny {
/// `storage` must point to valid memory for decoding a socket
/// address.
pub unsafe fn read(storage: *const SocketAddrStorage, len: usize) -> io::Result<Self> {
- imp::net::read_sockaddr::read_sockaddr(storage, len)
+ backend::net::read_sockaddr::read_sockaddr(storage, len)
}
}
@@ -72,10 +72,10 @@ impl SocketAddrAny {
impl fmt::Debug for SocketAddrAny {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
- SocketAddrAny::V4(v4) => v4.fmt(fmt),
- SocketAddrAny::V6(v6) => v6.fmt(fmt),
+ Self::V4(v4) => v4.fmt(fmt),
+ Self::V6(v6) => v6.fmt(fmt),
#[cfg(unix)]
- SocketAddrAny::Unix(unix) => unix.fmt(fmt),
+ Self::Unix(unix) => unix.fmt(fmt),
}
}
}
diff --git a/vendor/rustix/src/net/socketpair.rs b/vendor/rustix/src/net/socketpair.rs
index 68a58f3e9..4a9568ce7 100644
--- a/vendor/rustix/src/net/socketpair.rs
+++ b/vendor/rustix/src/net/socketpair.rs
@@ -1,6 +1,6 @@
-use crate::imp;
-use crate::io::{self, OwnedFd};
+use crate::fd::OwnedFd;
use crate::net::{AddressFamily, Protocol, SocketFlags, SocketType};
+use crate::{backend, io};
/// `socketpair(domain, type_ | accept_flags, protocol)`
///
@@ -17,5 +17,5 @@ pub fn socketpair(
flags: SocketFlags,
protocol: Protocol,
) -> io::Result<(OwnedFd, OwnedFd)> {
- imp::net::syscalls::socketpair(domain, type_, flags, protocol)
+ backend::net::syscalls::socketpair(domain, type_, flags, protocol)
}
diff --git a/vendor/rustix/src/net/sockopt.rs b/vendor/rustix/src/net/sockopt.rs
index f5b149b37..436d5bf86 100644
--- a/vendor/rustix/src/net/sockopt.rs
+++ b/vendor/rustix/src/net/sockopt.rs
@@ -7,11 +7,11 @@
#![doc(alias = "setsockopt")]
use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
-use crate::{imp, io};
+use crate::{backend, io};
+use backend::fd::AsFd;
use core::time::Duration;
-use imp::fd::AsFd;
-pub use imp::net::types::Timeout;
+pub use backend::net::types::Timeout;
/// `getsockopt(fd, SOL_SOCKET, SO_TYPE)`—Returns the type of a socket.
///
@@ -32,7 +32,7 @@ pub use imp::net::types::Timeout;
#[inline]
#[doc(alias = "SO_TYPE")]
pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> {
- imp::net::syscalls::sockopt::get_socket_type(fd.as_fd())
+ backend::net::syscalls::sockopt::get_socket_type(fd.as_fd())
}
/// `setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, value)`
@@ -54,7 +54,7 @@ pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> {
#[inline]
#[doc(alias = "SO_REUSEADDR")]
pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_socket_reuseaddr(fd.as_fd(), value)
+ backend::net::syscalls::sockopt::set_socket_reuseaddr(fd.as_fd(), value)
}
/// `setsockopt(fd, SOL_SOCKET, SO_BROADCAST, broadcast)`
@@ -76,7 +76,7 @@ pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
#[inline]
#[doc(alias = "SO_BROADCAST")]
pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_socket_broadcast(fd.as_fd(), broadcast)
+ backend::net::syscalls::sockopt::set_socket_broadcast(fd.as_fd(), broadcast)
}
/// `getsockopt(fd, SOL_SOCKET, SO_BROADCAST)`
@@ -98,7 +98,7 @@ pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()>
#[inline]
#[doc(alias = "SO_BROADCAST")]
pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- imp::net::syscalls::sockopt::get_socket_broadcast(fd.as_fd())
+ backend::net::syscalls::sockopt::get_socket_broadcast(fd.as_fd())
}
/// `setsockopt(fd, SOL_SOCKET, SO_LINGER, linger)`
@@ -120,7 +120,7 @@ pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
#[inline]
#[doc(alias = "SO_LINGER")]
pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_socket_linger(fd.as_fd(), linger)
+ backend::net::syscalls::sockopt::set_socket_linger(fd.as_fd(), linger)
}
/// `getsockopt(fd, SOL_SOCKET, SO_LINGER)`
@@ -142,7 +142,7 @@ pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Resu
#[inline]
#[doc(alias = "SO_LINGER")]
pub fn get_socket_linger<Fd: AsFd>(fd: Fd) -> io::Result<Option<Duration>> {
- imp::net::syscalls::sockopt::get_socket_linger(fd.as_fd())
+ backend::net::syscalls::sockopt::get_socket_linger(fd.as_fd())
}
/// `setsockopt(fd, SOL_SOCKET, SO_PASSCRED, passcred)`
@@ -157,7 +157,7 @@ pub fn get_socket_linger<Fd: AsFd>(fd: Fd) -> io::Result<Option<Duration>> {
#[inline]
#[doc(alias = "SO_PASSCRED")]
pub fn set_socket_passcred<Fd: AsFd>(fd: Fd, passcred: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_socket_passcred(fd.as_fd(), passcred)
+ backend::net::syscalls::sockopt::set_socket_passcred(fd.as_fd(), passcred)
}
/// `getsockopt(fd, SOL_SOCKET, SO_PASSCRED)`
@@ -172,7 +172,7 @@ pub fn set_socket_passcred<Fd: AsFd>(fd: Fd, passcred: bool) -> io::Result<()> {
#[inline]
#[doc(alias = "SO_PASSCRED")]
pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- imp::net::syscalls::sockopt::get_socket_passcred(fd.as_fd())
+ backend::net::syscalls::sockopt::get_socket_passcred(fd.as_fd())
}
/// `setsockopt(fd, SOL_SOCKET, id, timeout)`—Set the sending
@@ -200,7 +200,7 @@ pub fn set_socket_timeout<Fd: AsFd>(
id: Timeout,
timeout: Option<Duration>,
) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_socket_timeout(fd.as_fd(), id, timeout)
+ backend::net::syscalls::sockopt::set_socket_timeout(fd.as_fd(), id, timeout)
}
/// `getsockopt(fd, SOL_SOCKET, id)`—Get the sending or receiving timeout.
@@ -223,7 +223,7 @@ pub fn set_socket_timeout<Fd: AsFd>(
#[doc(alias = "SO_RCVTIMEO")]
#[doc(alias = "SO_SNDTIMEO")]
pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Duration>> {
- imp::net::syscalls::sockopt::get_socket_timeout(fd.as_fd(), id)
+ backend::net::syscalls::sockopt::get_socket_timeout(fd.as_fd(), id)
}
/// `setsockopt(fd, IPPROTO_IP, IP_TTL, ttl)`
@@ -244,7 +244,7 @@ pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Du
#[inline]
#[doc(alias = "IP_TTL")]
pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ip_ttl(fd.as_fd(), ttl)
+ backend::net::syscalls::sockopt::set_ip_ttl(fd.as_fd(), ttl)
}
/// `getsockopt(fd, IPPROTO_IP, IP_TTL)`
@@ -266,7 +266,7 @@ pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> {
#[inline]
#[doc(alias = "IP_TTL")]
pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- imp::net::syscalls::sockopt::get_ip_ttl(fd.as_fd())
+ backend::net::syscalls::sockopt::get_ip_ttl(fd.as_fd())
}
/// `setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, only_v6)`
@@ -288,7 +288,7 @@ pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
#[inline]
#[doc(alias = "IPV6_V6ONLY")]
pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ipv6_v6only(fd.as_fd(), only_v6)
+ backend::net::syscalls::sockopt::set_ipv6_v6only(fd.as_fd(), only_v6)
}
/// `getsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY)`
@@ -310,7 +310,7 @@ pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> {
#[inline]
#[doc(alias = "IPV6_V6ONLY")]
pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- imp::net::syscalls::sockopt::get_ipv6_v6only(fd.as_fd())
+ backend::net::syscalls::sockopt::get_ipv6_v6only(fd.as_fd())
}
/// `setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, multicast_loop)`
@@ -332,7 +332,7 @@ pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
#[inline]
#[doc(alias = "IP_MULTICAST_LOOP")]
pub fn set_ip_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ip_multicast_loop(fd.as_fd(), multicast_loop)
+ backend::net::syscalls::sockopt::set_ip_multicast_loop(fd.as_fd(), multicast_loop)
}
/// `getsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP)`
@@ -354,7 +354,7 @@ pub fn set_ip_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Resu
#[inline]
#[doc(alias = "IP_MULTICAST_LOOP")]
pub fn get_ip_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- imp::net::syscalls::sockopt::get_ip_multicast_loop(fd.as_fd())
+ backend::net::syscalls::sockopt::get_ip_multicast_loop(fd.as_fd())
}
/// `setsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL, multicast_ttl)`
@@ -376,7 +376,7 @@ pub fn get_ip_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
#[inline]
#[doc(alias = "IP_MULTICAST_TTL")]
pub fn set_ip_multicast_ttl<Fd: AsFd>(fd: Fd, multicast_ttl: u32) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ip_multicast_ttl(fd.as_fd(), multicast_ttl)
+ backend::net::syscalls::sockopt::set_ip_multicast_ttl(fd.as_fd(), multicast_ttl)
}
/// `getsockopt(fd, IPPROTO_IP, IP_MULTICAST_TTL)`
@@ -398,7 +398,7 @@ pub fn set_ip_multicast_ttl<Fd: AsFd>(fd: Fd, multicast_ttl: u32) -> io::Result<
#[inline]
#[doc(alias = "IP_MULTICAST_TTL")]
pub fn get_ip_multicast_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- imp::net::syscalls::sockopt::get_ip_multicast_ttl(fd.as_fd())
+ backend::net::syscalls::sockopt::get_ip_multicast_ttl(fd.as_fd())
}
/// `setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, multicast_loop)`
@@ -420,7 +420,7 @@ pub fn get_ip_multicast_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
#[inline]
#[doc(alias = "IPV6_MULTICAST_LOOP")]
pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ipv6_multicast_loop(fd.as_fd(), multicast_loop)
+ backend::net::syscalls::sockopt::set_ipv6_multicast_loop(fd.as_fd(), multicast_loop)
}
/// `getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_LOOP)`
@@ -442,7 +442,51 @@ pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Re
#[inline]
#[doc(alias = "IPV6_MULTICAST_LOOP")]
pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- imp::net::syscalls::sockopt::get_ipv6_multicast_loop(fd.as_fd())
+ backend::net::syscalls::sockopt::get_ipv6_multicast_loop(fd.as_fd())
+}
+
+/// `setsockopt(fd, IPPROTO_IP, IPV6_MULTICAST_HOPS, multicast_hops)`
+///
+/// # References
+/// - [POSIX `setsockopt`]
+/// - [POSIX `netinet/in.h`]
+/// - [Linux `setsockopt`]
+/// - [Linux `ipv6`]
+/// - [Winsock2 `setsockopt`]
+/// - [Winsock2 `IPPROTO_IPV6` options]
+///
+/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html
+/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
+/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html
+/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+#[inline]
+#[doc(alias = "IP_MULTICAST_TTL")]
+pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_ipv6_multicast_hops(fd.as_fd(), multicast_hops)
+}
+
+/// `getsockopt(fd, IPPROTO_IP, IPV6_MULTICAST_HOPS)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/in.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `ipv6`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_IPV6` options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
+#[inline]
+#[doc(alias = "IP_MULTICAST_TTL")]
+pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
+ backend::net::syscalls::sockopt::get_ipv6_multicast_hops(fd.as_fd())
}
/// `setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, multiaddr, interface)`
@@ -468,7 +512,7 @@ pub fn set_ip_add_membership<Fd: AsFd>(
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr,
) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ip_add_membership(fd.as_fd(), multiaddr, interface)
+ backend::net::syscalls::sockopt::set_ip_add_membership(fd.as_fd(), multiaddr, interface)
}
/// `setsockopt(fd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, multiaddr, interface)`
@@ -497,7 +541,7 @@ pub fn set_ipv6_add_membership<Fd: AsFd>(
multiaddr: &Ipv6Addr,
interface: u32,
) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ipv6_add_membership(fd.as_fd(), multiaddr, interface)
+ backend::net::syscalls::sockopt::set_ipv6_add_membership(fd.as_fd(), multiaddr, interface)
}
/// `setsockopt(fd, IPPROTO_IP, IP_DROP_MEMBERSHIP, multiaddr, interface)`
@@ -523,7 +567,7 @@ pub fn set_ip_drop_membership<Fd: AsFd>(
multiaddr: &Ipv4Addr,
interface: &Ipv4Addr,
) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ip_drop_membership(fd.as_fd(), multiaddr, interface)
+ backend::net::syscalls::sockopt::set_ip_drop_membership(fd.as_fd(), multiaddr, interface)
}
/// `setsockopt(fd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, multiaddr, interface)`
@@ -552,7 +596,7 @@ pub fn set_ipv6_drop_membership<Fd: AsFd>(
multiaddr: &Ipv6Addr,
interface: u32,
) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_ipv6_drop_membership(fd.as_fd(), multiaddr, interface)
+ backend::net::syscalls::sockopt::set_ipv6_drop_membership(fd.as_fd(), multiaddr, interface)
}
/// `setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, nodelay)`
@@ -574,7 +618,7 @@ pub fn set_ipv6_drop_membership<Fd: AsFd>(
#[inline]
#[doc(alias = "TCP_NODELAY")]
pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> {
- imp::net::syscalls::sockopt::set_tcp_nodelay(fd.as_fd(), nodelay)
+ backend::net::syscalls::sockopt::set_tcp_nodelay(fd.as_fd(), nodelay)
}
/// `getsockopt(fd, IPPROTO_TCP, TCP_NODELAY)`
@@ -596,5 +640,5 @@ pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> {
#[inline]
#[doc(alias = "TCP_NODELAY")]
pub fn get_tcp_nodelay<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
- imp::net::syscalls::sockopt::get_tcp_nodelay(fd.as_fd())
+ backend::net::syscalls::sockopt::get_tcp_nodelay(fd.as_fd())
}
diff --git a/vendor/rustix/src/net/wsa.rs b/vendor/rustix/src/net/wsa.rs
index e2a70c97b..3367ca95c 100644
--- a/vendor/rustix/src/net/wsa.rs
+++ b/vendor/rustix/src/net/wsa.rs
@@ -1,6 +1,6 @@
use crate::io;
use core::mem::MaybeUninit;
-use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAData, WSAGetLastError, WSAStartup};
+use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAGetLastError, WSAStartup, WSADATA};
/// `WSAStartup()`—Initialize process-wide Windows support for sockets.
///
@@ -11,7 +11,7 @@ use windows_sys::Win32::Networking::WinSock::{WSACleanup, WSAData, WSAGetLastErr
/// - [Winsock2]
///
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsastartup
-pub fn wsa_startup() -> io::Result<WSAData> {
+pub fn wsa_startup() -> io::Result<WSADATA> {
// Request version 2.2, which has been the latest version since far older
// versions of Windows than we support here. For more information about
// the version, see [here].
diff --git a/vendor/rustix/src/param/auxv.rs b/vendor/rustix/src/param/auxv.rs
index 6aec061f7..03be2a29d 100644
--- a/vendor/rustix/src/param/auxv.rs
+++ b/vendor/rustix/src/param/auxv.rs
@@ -1,3 +1,4 @@
+use crate::backend;
#[cfg(any(
linux_raw,
all(
@@ -9,7 +10,6 @@
)
))]
use crate::ffi::CStr;
-use crate::imp;
/// `sysconf(_SC_PAGESIZE)`—Returns the process' page size.
///
@@ -28,7 +28,7 @@ use crate::imp;
#[doc(alias = "_SC_PAGE_SIZE")]
#[doc(alias = "getpagesize")]
pub fn page_size() -> usize {
- imp::param::auxv::page_size()
+ backend::param::auxv::page_size()
}
/// `sysconf(_SC_CLK_TCK)`—Returns the process' clock ticks per second.
@@ -43,7 +43,7 @@ pub fn page_size() -> usize {
#[inline]
#[doc(alias = "_SC_CLK_TCK")]
pub fn clock_ticks_per_second() -> u64 {
- imp::param::auxv::clock_ticks_per_second()
+ backend::param::auxv::clock_ticks_per_second()
}
/// `(getauxval(AT_HWCAP), getauxval(AT_HWCAP2)`—Returns the Linux "hwcap"
@@ -68,7 +68,7 @@ pub fn clock_ticks_per_second() -> u64 {
))]
#[inline]
pub fn linux_hwcap() -> (usize, usize) {
- imp::param::auxv::linux_hwcap()
+ backend::param::auxv::linux_hwcap()
}
/// `getauxval(AT_EXECFN)`—Returns the Linux "execfn" string.
@@ -92,5 +92,5 @@ pub fn linux_hwcap() -> (usize, usize) {
))]
#[inline]
pub fn linux_execfn() -> &'static CStr {
- imp::param::auxv::linux_execfn()
+ backend::param::auxv::linux_execfn()
}
diff --git a/vendor/rustix/src/param/init.rs b/vendor/rustix/src/param/init.rs
index e66ff82bb..d261fabd2 100644
--- a/vendor/rustix/src/param/init.rs
+++ b/vendor/rustix/src/param/init.rs
@@ -7,7 +7,7 @@
//! operates on raw pointers.
#![allow(unsafe_code)]
-use crate::imp;
+use crate::backend;
/// Initialize process-wide state.
///
@@ -19,5 +19,5 @@ use crate::imp;
#[inline]
#[doc(hidden)]
pub unsafe fn init(envp: *mut *mut u8) {
- imp::param::auxv::init(envp)
+ backend::param::auxv::init(envp)
}
diff --git a/vendor/rustix/src/param/mod.rs b/vendor/rustix/src/param/mod.rs
index 5169d0a51..c47aca985 100644
--- a/vendor/rustix/src/param/mod.rs
+++ b/vendor/rustix/src/param/mod.rs
@@ -7,10 +7,7 @@
#[cfg(feature = "param")]
mod auxv;
-#[cfg(any(
- target_vendor = "mustang",
- not(any(target_env = "gnu", target_env = "musl")),
-))]
+#[cfg(target_vendor = "mustang")]
mod init;
#[cfg(feature = "param")]
@@ -30,8 +27,5 @@ pub use auxv::page_size;
)
))]
pub use auxv::{linux_execfn, linux_hwcap};
-#[cfg(any(
- target_vendor = "mustang",
- not(any(target_env = "gnu", target_env = "musl")),
-))]
+#[cfg(target_vendor = "mustang")]
pub use init::init;
diff --git a/vendor/rustix/src/path/arg.rs b/vendor/rustix/src/path/arg.rs
index 7f66f71f2..0ea673d19 100644
--- a/vendor/rustix/src/path/arg.rs
+++ b/vendor/rustix/src/path/arg.rs
@@ -15,7 +15,8 @@ use alloc::borrow::Cow;
use alloc::borrow::ToOwned;
use alloc::string::String;
use alloc::vec::Vec;
-use core::str;
+use core::mem::MaybeUninit;
+use core::{ptr, slice, str};
#[cfg(feature = "std")]
use std::ffi::{OsStr, OsString};
#[cfg(feature = "std")]
@@ -931,6 +932,7 @@ impl Arg for DecInt {
}
/// Runs a closure with `bytes` passed in as a `&CStr`.
+#[allow(unsafe_code, clippy::int_plus_one)]
#[inline]
fn with_c_str<T, F>(bytes: &[u8], f: F) -> io::Result<T>
where
@@ -946,10 +948,26 @@ where
if bytes.len() >= SMALL_PATH_BUFFER_SIZE {
return with_c_str_slow_path(bytes, f);
}
- let mut buffer: [u8; SMALL_PATH_BUFFER_SIZE] = [0_u8; SMALL_PATH_BUFFER_SIZE];
- // Copy the bytes in; the buffer already has zeros for the trailing NUL.
- buffer[..bytes.len()].copy_from_slice(bytes);
- f(CStr::from_bytes_with_nul(&buffer[..=bytes.len()]).map_err(|_cstr_err| io::Errno::INVAL)?)
+
+ // Taken from
+ // https://github.com/rust-lang/rust/blob/a00f8ba7fcac1b27341679c51bf5a3271fa82df3/library/std/src/sys/common/small_c_string.rs
+ let mut buf = MaybeUninit::<[u8; SMALL_PATH_BUFFER_SIZE]>::uninit();
+ let buf_ptr = buf.as_mut_ptr() as *mut u8;
+
+ // SAFETY: bytes.len() < SMALL_PATH_BUFFER_SIZE which means we have space for
+ // bytes.len() + 1 u8s:
+ debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE);
+ unsafe {
+ ptr::copy_nonoverlapping(bytes.as_ptr(), buf_ptr, bytes.len());
+ buf_ptr.add(bytes.len()).write(0);
+ }
+
+ // SAFETY: we just wrote the bytes above and they will remain valid for the
+ // duration of f b/c buf doesn't get dropped until the end of the function.
+ match CStr::from_bytes_with_nul(unsafe { slice::from_raw_parts(buf_ptr, bytes.len() + 1) }) {
+ Ok(s) => f(s),
+ Err(_) => Err(io::Errno::INVAL),
+ }
}
/// The slow path which handles any length. In theory OS's only support up
diff --git a/vendor/rustix/src/path/dec_int.rs b/vendor/rustix/src/path/dec_int.rs
index 4006fb06c..d0975694b 100644
--- a/vendor/rustix/src/path/dec_int.rs
+++ b/vendor/rustix/src/path/dec_int.rs
@@ -6,8 +6,8 @@
//! `str::from_utf8_unchecked`on the buffer that it filled itself.
#![allow(unsafe_code)]
+use crate::backend::fd::{AsFd, AsRawFd};
use crate::ffi::CStr;
-use crate::imp::fd::{AsFd, AsRawFd};
#[cfg(feature = "std")]
use core::fmt;
use core::fmt::Write;
diff --git a/vendor/rustix/src/process/chdir.rs b/vendor/rustix/src/process/chdir.rs
index d8e251074..4951e5670 100644
--- a/vendor/rustix/src/process/chdir.rs
+++ b/vendor/rustix/src/process/chdir.rs
@@ -1,9 +1,9 @@
use crate::ffi::CString;
use crate::path::SMALL_PATH_BUFFER_SIZE;
-use crate::{imp, io, path};
+use crate::{backend, io, path};
use alloc::vec::Vec;
#[cfg(not(target_os = "fuchsia"))]
-use imp::fd::AsFd;
+use backend::fd::AsFd;
/// `chdir(path)`—Change the current working directory.
///
@@ -15,7 +15,7 @@ use imp::fd::AsFd;
/// [Linux]: https://man7.org/linux/man-pages/man2/chdir.2.html
#[inline]
pub fn chdir<P: path::Arg>(path: P) -> io::Result<()> {
- path.into_with_c_str(imp::process::syscalls::chdir)
+ path.into_with_c_str(backend::process::syscalls::chdir)
}
/// `fchdir(fd)`—Change the current working directory.
@@ -29,7 +29,7 @@ pub fn chdir<P: path::Arg>(path: P) -> io::Result<()> {
#[cfg(not(target_os = "fuchsia"))]
#[inline]
pub fn fchdir<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::process::syscalls::fchdir(fd.as_fd())
+ backend::process::syscalls::fchdir(fd.as_fd())
}
/// `getcwd()`—Return the current working directory.
@@ -56,7 +56,7 @@ fn _getcwd(mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.resize(buffer.capacity(), 0_u8);
loop {
- match imp::process::syscalls::getcwd(&mut buffer) {
+ match backend::process::syscalls::getcwd(&mut buffer) {
Err(io::Errno::RANGE) => {
buffer.reserve(1); // use `Vec` reallocation strategy to grow capacity exponentially
buffer.resize(buffer.capacity(), 0_u8);
diff --git a/vendor/rustix/src/process/exit.rs b/vendor/rustix/src/process/exit.rs
index 26a2340ab..56db99b4f 100644
--- a/vendor/rustix/src/process/exit.rs
+++ b/vendor/rustix/src/process/exit.rs
@@ -1,4 +1,4 @@
-use crate::imp;
+use crate::backend;
/// `EXIT_SUCCESS` for use with [`exit`].
///
@@ -10,7 +10,7 @@ use crate::imp;
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
/// [Linux]: https://man7.org/linux/man-pages/man3/exit.3.html
-pub const EXIT_SUCCESS: i32 = imp::process::types::EXIT_SUCCESS;
+pub const EXIT_SUCCESS: i32 = backend::process::types::EXIT_SUCCESS;
/// `EXIT_FAILURE` for use with [`exit`].
///
@@ -22,7 +22,7 @@ pub const EXIT_SUCCESS: i32 = imp::process::types::EXIT_SUCCESS;
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
/// [Linux]: https://man7.org/linux/man-pages/man3/exit.3.html
-pub const EXIT_FAILURE: i32 = imp::process::types::EXIT_FAILURE;
+pub const EXIT_FAILURE: i32 = backend::process::types::EXIT_FAILURE;
/// The exit status used by a process terminated with `SIGABRT` signal.
///
@@ -31,4 +31,4 @@ pub const EXIT_FAILURE: i32 = imp::process::types::EXIT_FAILURE;
///
/// [Linux]: https://tldp.org/LDP/abs/html/exitcodes.html
#[cfg(not(target_os = "wasi"))]
-pub const EXIT_SIGNALED_SIGABRT: i32 = imp::process::types::EXIT_SIGNALED_SIGABRT;
+pub const EXIT_SIGNALED_SIGABRT: i32 = backend::process::types::EXIT_SIGNALED_SIGABRT;
diff --git a/vendor/rustix/src/process/id.rs b/vendor/rustix/src/process/id.rs
index 5f6ff5bfb..e7fff7e53 100644
--- a/vendor/rustix/src/process/id.rs
+++ b/vendor/rustix/src/process/id.rs
@@ -7,21 +7,21 @@
//! integer values.
#![allow(unsafe_code)]
-use crate::{imp, io};
+use crate::{backend, io};
#[cfg(any(target_os = "android", target_os = "linux"))]
-use imp::process::types::RawCpuid;
+use backend::process::types::RawCpuid;
/// The raw integer value of a Unix user ID.
-pub use imp::process::types::RawUid;
+pub use backend::process::types::RawUid;
/// The raw integer value of a Unix group ID.
-pub use imp::process::types::RawGid;
+pub use backend::process::types::RawGid;
/// The raw integer value of a Unix process ID.
-pub use imp::process::types::RawPid;
+pub use backend::process::types::RawPid;
/// The raw integer value of a Unix process ID.
-pub use imp::process::types::RawNonZeroPid;
+pub use backend::process::types::RawNonZeroPid;
/// `uid_t`—A Unix user ID.
#[repr(transparent)]
@@ -194,7 +194,7 @@ impl Cpuid {
#[inline]
#[must_use]
pub fn getuid() -> Uid {
- imp::process::syscalls::getuid()
+ backend::process::syscalls::getuid()
}
/// `geteuid()`—Returns the process' effective user ID.
@@ -208,7 +208,7 @@ pub fn getuid() -> Uid {
#[inline]
#[must_use]
pub fn geteuid() -> Uid {
- imp::process::syscalls::geteuid()
+ backend::process::syscalls::geteuid()
}
/// `getgid()`—Returns the process' real group ID.
@@ -222,7 +222,7 @@ pub fn geteuid() -> Uid {
#[inline]
#[must_use]
pub fn getgid() -> Gid {
- imp::process::syscalls::getgid()
+ backend::process::syscalls::getgid()
}
/// `getegid()`—Returns the process' effective group ID.
@@ -236,7 +236,7 @@ pub fn getgid() -> Gid {
#[inline]
#[must_use]
pub fn getegid() -> Gid {
- imp::process::syscalls::getegid()
+ backend::process::syscalls::getegid()
}
/// `getpid()`—Returns the process' ID.
@@ -250,7 +250,7 @@ pub fn getegid() -> Gid {
#[inline]
#[must_use]
pub fn getpid() -> Pid {
- imp::process::syscalls::getpid()
+ backend::process::syscalls::getpid()
}
/// `getppid()`—Returns the parent process' ID.
@@ -264,7 +264,34 @@ pub fn getpid() -> Pid {
#[inline]
#[must_use]
pub fn getppid() -> Option<Pid> {
- imp::process::syscalls::getppid()
+ backend::process::syscalls::getppid()
+}
+
+/// `getpgid(pid)`—Returns the process group ID of the given process.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgid.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/getpgid.2.html
+#[inline]
+pub fn getpgid(pid: Option<Pid>) -> io::Result<Pid> {
+ backend::process::syscalls::getpgid(pid)
+}
+
+/// `getpgrp()`—Returns the process' group ID.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpgrp.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/getpgrp.2.html
+#[inline]
+#[must_use]
+pub fn getpgrp() -> Pid {
+ backend::process::syscalls::getpgrp()
}
/// `setsid()`—Create a new session.
@@ -277,7 +304,7 @@ pub fn getppid() -> Option<Pid> {
/// [Linux]: https://man7.org/linux/man-pages/man2/setsid.2.html
#[inline]
pub fn setsid() -> io::Result<Pid> {
- imp::process::syscalls::setsid()
+ backend::process::syscalls::setsid()
}
// translate_fchown_args returns the raw value of the IDs. In case of `None`
diff --git a/vendor/rustix/src/process/kill.rs b/vendor/rustix/src/process/kill.rs
index d8daaf8da..69cfba261 100644
--- a/vendor/rustix/src/process/kill.rs
+++ b/vendor/rustix/src/process/kill.rs
@@ -1,7 +1,7 @@
use crate::process::Pid;
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::process::types::Signal;
+pub use backend::process::types::Signal;
/// `kill(pid, sig)`—Sends a signal to a process.
///
@@ -14,7 +14,7 @@ pub use imp::process::types::Signal;
#[inline]
#[doc(alias = "kill")]
pub fn kill_process(pid: Pid, sig: Signal) -> io::Result<()> {
- imp::process::syscalls::kill_process(pid, sig)
+ backend::process::syscalls::kill_process(pid, sig)
}
/// `kill(-pid, sig)`—Sends a signal to all processes in a process group.
@@ -32,7 +32,7 @@ pub fn kill_process(pid: Pid, sig: Signal) -> io::Result<()> {
#[inline]
#[doc(alias = "kill")]
pub fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
- imp::process::syscalls::kill_process_group(pid, sig)
+ backend::process::syscalls::kill_process_group(pid, sig)
}
/// `kill(0, sig)`—Sends a signal to all processes in the current process
@@ -47,5 +47,5 @@ pub fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> {
#[inline]
#[doc(alias = "kill")]
pub fn kill_current_process_group(sig: Signal) -> io::Result<()> {
- imp::process::syscalls::kill_current_process_group(sig)
+ backend::process::syscalls::kill_current_process_group(sig)
}
diff --git a/vendor/rustix/src/process/membarrier.rs b/vendor/rustix/src/process/membarrier.rs
index 0062f273b..b64deb82e 100644
--- a/vendor/rustix/src/process/membarrier.rs
+++ b/vendor/rustix/src/process/membarrier.rs
@@ -7,9 +7,9 @@
#![allow(unsafe_code)]
use crate::process::Cpuid;
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::process::types::MembarrierCommand;
+pub use backend::process::types::MembarrierCommand;
#[cfg(any(target_os = "android", target_os = "linux"))]
bitflags::bitflags! {
@@ -66,7 +66,7 @@ impl MembarrierQuery {
#[inline]
#[doc(alias = "MEMBARRIER_CMD_QUERY")]
pub fn membarrier_query() -> MembarrierQuery {
- imp::process::syscalls::membarrier_query()
+ backend::process::syscalls::membarrier_query()
}
/// `membarrier(cmd, 0, 0)`—Perform a memory barrier.
@@ -77,7 +77,7 @@ pub fn membarrier_query() -> MembarrierQuery {
/// [Linux]: https://man7.org/linux/man-pages/man2/membarrier.2.html
#[inline]
pub fn membarrier(cmd: MembarrierCommand) -> io::Result<()> {
- imp::process::syscalls::membarrier(cmd)
+ backend::process::syscalls::membarrier(cmd)
}
/// `membarrier(cmd, MEMBARRIER_CMD_FLAG_CPU, cpu)`—Perform a memory barrier
@@ -89,5 +89,5 @@ pub fn membarrier(cmd: MembarrierCommand) -> io::Result<()> {
/// [Linux]: https://man7.org/linux/man-pages/man2/membarrier.2.html
#[inline]
pub fn membarrier_cpu(cmd: MembarrierCommand, cpu: Cpuid) -> io::Result<()> {
- imp::process::syscalls::membarrier_cpu(cmd, cpu)
+ backend::process::syscalls::membarrier_cpu(cmd, cpu)
}
diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs
index 45673c0ea..e6baa1935 100644
--- a/vendor/rustix/src/process/mod.rs
+++ b/vendor/rustix/src/process/mod.rs
@@ -9,8 +9,12 @@ mod id;
mod kill;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod membarrier;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+mod prctl;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] // WASI doesn't have [gs]etpriority.
mod priority;
+#[cfg(target_os = "freebsd")]
+mod procctl;
#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
mod rlimit;
#[cfg(any(
@@ -39,8 +43,8 @@ pub use exit::{EXIT_FAILURE, EXIT_SUCCESS};
pub use id::Cpuid;
#[cfg(not(target_os = "wasi"))]
pub use id::{
- getegid, geteuid, getgid, getpid, getppid, getuid, setsid, Gid, Pid, RawGid, RawNonZeroPid,
- RawPid, RawUid, Uid,
+ getegid, geteuid, getgid, getpgid, getpgrp, getpid, getppid, getuid, setsid, Gid, Pid, RawGid,
+ RawNonZeroPid, RawPid, RawUid, Uid,
};
#[cfg(not(target_os = "wasi"))]
pub use kill::{kill_current_process_group, kill_process, kill_process_group, Signal};
@@ -48,6 +52,8 @@ pub use kill::{kill_current_process_group, kill_process, kill_process_group, Sig
pub use membarrier::{
membarrier, membarrier_cpu, membarrier_query, MembarrierCommand, MembarrierQuery,
};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use prctl::*;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
pub use priority::nice;
#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
@@ -55,6 +61,8 @@ pub use priority::{
getpriority_pgrp, getpriority_process, getpriority_user, setpriority_pgrp, setpriority_process,
setpriority_user,
};
+#[cfg(target_os = "freebsd")]
+pub use procctl::*;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use rlimit::prlimit;
#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
@@ -73,4 +81,5 @@ pub use uname::{uname, Uname};
pub use wait::{wait, waitpid, WaitOptions, WaitStatus};
#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "fs")]
pub(crate) use id::translate_fchown_args;
diff --git a/vendor/rustix/src/process/prctl.rs b/vendor/rustix/src/process/prctl.rs
new file mode 100644
index 000000000..49927be25
--- /dev/null
+++ b/vendor/rustix/src/process/prctl.rs
@@ -0,0 +1,1120 @@
+//! Bindings for the Linux `prctl` system call.
+//!
+//! There are similarities (but also differences) with FreeBSD's `procctl` system call, whose
+//! interface is located in the `procctl.rs` file.
+
+#![allow(unsafe_code)]
+
+use core::convert::{TryFrom, TryInto};
+use core::mem::MaybeUninit;
+use core::ptr::NonNull;
+use core::{mem, ptr};
+
+use bitflags::bitflags;
+
+use crate::backend::c::{c_int, c_uint, c_void};
+use crate::backend::process::syscalls;
+use crate::backend::process::types::Signal;
+use crate::fd::{AsRawFd, BorrowedFd};
+use crate::ffi::CStr;
+use crate::io;
+use crate::process::{Pid, RawPid};
+
+//
+// Helper functions.
+//
+
+#[inline]
+pub(crate) unsafe fn prctl_1arg(option: c_int) -> io::Result<c_int> {
+ const NULL: *mut c_void = ptr::null_mut();
+ syscalls::prctl(option, NULL, NULL, NULL, NULL)
+}
+
+#[inline]
+pub(crate) unsafe fn prctl_2args(option: c_int, arg2: *mut c_void) -> io::Result<c_int> {
+ const NULL: *mut c_void = ptr::null_mut();
+ syscalls::prctl(option, arg2, NULL, NULL, NULL)
+}
+
+#[inline]
+pub(crate) unsafe fn prctl_3args(
+ option: c_int,
+ arg2: *mut c_void,
+ arg3: *mut c_void,
+) -> io::Result<c_int> {
+ syscalls::prctl(option, arg2, arg3, ptr::null_mut(), ptr::null_mut())
+}
+
+#[inline]
+pub(crate) unsafe fn prctl_get_at_arg2_optional<P>(option: i32) -> io::Result<P> {
+ let mut value: MaybeUninit<P> = MaybeUninit::uninit();
+ prctl_2args(option, value.as_mut_ptr().cast())?;
+ Ok(value.assume_init())
+}
+
+#[inline]
+pub(crate) unsafe fn prctl_get_at_arg2<P, T>(option: i32) -> io::Result<T>
+where
+ P: Default,
+ T: TryFrom<P, Error = io::Errno>,
+{
+ let mut value: P = Default::default();
+ prctl_2args(option, ((&mut value) as *mut P).cast())?;
+ TryFrom::try_from(value)
+}
+
+//
+// PR_GET_PDEATHSIG/PR_SET_PDEATHSIG
+//
+
+const PR_GET_PDEATHSIG: c_int = 2;
+
+/// Get the current value of the parent process death signal.
+///
+/// # References
+/// - [Linux: `prctl(PR_GET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
+///
+/// [Linux: `prctl(PR_GET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn parent_process_death_signal() -> io::Result<Option<Signal>> {
+ unsafe { prctl_get_at_arg2_optional::<c_int>(PR_GET_PDEATHSIG) }.map(Signal::from_raw)
+}
+
+const PR_SET_PDEATHSIG: c_int = 1;
+
+/// Set the parent-death signal of the calling process.
+///
+/// # References
+/// - [Linux: `prctl(PR_SET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
+///
+/// [Linux: `prctl(PR_SET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn set_parent_process_death_signal(signal: Option<Signal>) -> io::Result<()> {
+ let signal = signal.map_or(0_usize, |signal| signal as usize);
+ unsafe { prctl_2args(PR_SET_PDEATHSIG, signal as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_DUMPABLE/PR_SET_DUMPABLE
+//
+
+const PR_GET_DUMPABLE: c_int = 3;
+
+const SUID_DUMP_DISABLE: i32 = 0;
+const SUID_DUMP_USER: i32 = 1;
+const SUID_DUMP_ROOT: i32 = 2;
+
+/// `SUID_DUMP_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(i32)]
+pub enum DumpableBehavior {
+ /// Not dumpable.
+ NotDumpable = SUID_DUMP_DISABLE,
+ /// Dumpable.
+ Dumpable = SUID_DUMP_USER,
+ /// Dumpable but only readable by root.
+ DumpableReadableOnlyByRoot = SUID_DUMP_ROOT,
+}
+
+impl TryFrom<i32> for DumpableBehavior {
+ type Error = io::Errno;
+
+ fn try_from(value: i32) -> Result<Self, Self::Error> {
+ match value {
+ SUID_DUMP_DISABLE => Ok(Self::NotDumpable),
+ SUID_DUMP_USER => Ok(Self::Dumpable),
+ SUID_DUMP_ROOT => Ok(Self::DumpableReadableOnlyByRoot),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get the current state of the calling process's `dumpable` attribute.
+///
+/// # References
+/// - [`prctl(PR_GET_DUMPABLE,...)`]
+///
+/// [`prctl(PR_GET_DUMPABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn dumpable_behavior() -> io::Result<DumpableBehavior> {
+ unsafe { prctl_1arg(PR_GET_DUMPABLE) }.and_then(TryInto::try_into)
+}
+
+const PR_SET_DUMPABLE: c_int = 4;
+
+/// Set the state of the `dumpable` attribute, which determines whether the process can be traced
+/// and whether core dumps are produced for the calling process upon delivery of a signal whose
+/// default behavior is to produce a core dump.
+///
+/// A similar function with the same name is available on FreeBSD (as part of the `procctl`
+/// interface), but it has an extra argument which allows to select a process other then the
+/// current process.
+///
+/// # References
+/// - [`prctl(PR_SET_DUMPABLE,...)`]
+///
+/// [`prctl(PR_SET_DUMPABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_dumpable_behavior(config: DumpableBehavior) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_DUMPABLE, config as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_UNALIGN/PR_SET_UNALIGN
+//
+
+const PR_GET_UNALIGN: c_int = 5;
+
+bitflags! {
+ /// `PR_UNALIGN_*`.
+ pub struct UnalignedAccessControl: u32 {
+ /// Silently fix up unaligned user accesses.
+ const NO_PRINT = 1;
+ /// Generate `SIGBUS` on unaligned user access.
+ const SIGBUS = 2;
+ }
+}
+
+/// Get unaligned access control bits.
+///
+/// # References
+/// - [`prctl(PR_GET_UNALIGN,...)`]
+///
+/// [`prctl(PR_GET_UNALIGN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn unaligned_access_control() -> io::Result<UnalignedAccessControl> {
+ let r = unsafe { prctl_get_at_arg2_optional::<c_uint>(PR_GET_UNALIGN)? };
+ UnalignedAccessControl::from_bits(r).ok_or(io::Errno::RANGE)
+}
+
+const PR_SET_UNALIGN: c_int = 6;
+
+/// Set unaligned access control bits.
+///
+/// # References
+/// - [`prctl(PR_SET_UNALIGN,...)`]
+///
+/// [`prctl(PR_SET_UNALIGN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_unaligned_access_control(config: UnalignedAccessControl) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_UNALIGN, config.bits() as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_FPEMU/PR_SET_FPEMU
+//
+
+const PR_GET_FPEMU: c_int = 9;
+
+bitflags! {
+ /// `PR_FPEMU_*`.
+ pub struct FloatingPointEmulationControl: u32 {
+ /// Silently emulate floating point operations accesses.
+ const NO_PRINT = 1;
+ /// Don't emulate floating point operations, send `SIGFPE` instead.
+ const SIGFPE = 2;
+ }
+}
+
+/// Get floating point emulation control bits.
+///
+/// # References
+/// - [`prctl(PR_GET_FPEMU,...)`]
+///
+/// [`prctl(PR_GET_FPEMU,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn floating_point_emulation_control() -> io::Result<FloatingPointEmulationControl> {
+ let r = unsafe { prctl_get_at_arg2_optional::<c_uint>(PR_GET_FPEMU)? };
+ FloatingPointEmulationControl::from_bits(r).ok_or(io::Errno::RANGE)
+}
+
+const PR_SET_FPEMU: c_int = 10;
+
+/// Set floating point emulation control bits.
+///
+/// # References
+/// - [`prctl(PR_SET_FPEMU,...)`]
+///
+/// [`prctl(PR_SET_FPEMU,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_floating_point_emulation_control(
+ config: FloatingPointEmulationControl,
+) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_FPEMU, config.bits() as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_FPEXC/PR_SET_FPEXC
+//
+
+const PR_GET_FPEXC: c_int = 11;
+
+bitflags! {
+ /// Zero means floating point exceptions are disabled.
+ pub struct FloatingPointExceptionMode: u32 {
+ /// Async non-recoverable exception mode.
+ const NONRECOV = 1;
+ /// Async recoverable exception mode.
+ const ASYNC = 2;
+ /// Precise exception mode.
+ const PRECISE = 3;
+
+ /// Use FPEXC for floating point exception enables.
+ const SW_ENABLE = 0x80;
+ /// Floating point divide by zero.
+ const DIV = 0x01_0000;
+ /// Floating point overflow.
+ const OVF = 0x02_0000;
+ /// Floating point underflow.
+ const UND = 0x04_0000;
+ /// Floating point inexact result.
+ const RES = 0x08_0000;
+ /// Floating point invalid operation.
+ const INV = 0x10_0000;
+ }
+}
+
+/// Get floating point exception mode.
+///
+/// # References
+/// - [`prctl(PR_GET_FPEXC,...)`]
+///
+/// [`prctl(PR_GET_FPEXC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn floating_point_exception_mode() -> io::Result<Option<FloatingPointExceptionMode>> {
+ unsafe { prctl_get_at_arg2_optional::<c_uint>(PR_GET_FPEXC) }
+ .map(FloatingPointExceptionMode::from_bits)
+}
+
+const PR_SET_FPEXC: c_int = 12;
+
+/// Set floating point exception mode.
+///
+/// # References
+/// - [`prctl(PR_SET_FPEXC,...)`]
+///
+/// [`prctl(PR_SET_FPEXC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_floating_point_exception_mode(
+ config: Option<FloatingPointExceptionMode>,
+) -> io::Result<()> {
+ let config = config.as_ref().map_or(0, FloatingPointExceptionMode::bits);
+ unsafe { prctl_2args(PR_SET_FPEXC, config as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_TIMING/PR_SET_TIMING
+//
+
+const PR_GET_TIMING: c_int = 13;
+
+const PR_TIMING_STATISTICAL: i32 = 0;
+const PR_TIMING_TIMESTAMP: i32 = 1;
+
+/// `PR_TIMING_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(i32)]
+pub enum TimingMethod {
+ /// Normal, traditional, statistical process timing.
+ Statistical = PR_TIMING_STATISTICAL,
+ /// Accurate timestamp based process timing.
+ TimeStamp = PR_TIMING_TIMESTAMP,
+}
+
+impl TryFrom<i32> for TimingMethod {
+ type Error = io::Errno;
+
+ fn try_from(value: i32) -> Result<Self, Self::Error> {
+ match value {
+ PR_TIMING_STATISTICAL => Ok(Self::Statistical),
+ PR_TIMING_TIMESTAMP => Ok(Self::TimeStamp),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get which process timing method is currently in use.
+///
+/// # References
+/// - [`prctl(PR_GET_TIMING,...)`]
+///
+/// [`prctl(PR_GET_TIMING,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn timing_method() -> io::Result<TimingMethod> {
+ unsafe { prctl_1arg(PR_GET_TIMING) }.and_then(TryInto::try_into)
+}
+
+const PR_SET_TIMING: c_int = 14;
+
+/// Set whether to use (normal, traditional) statistical process timing or accurate
+/// timestamp-based process timing.
+///
+/// # References
+/// - [`prctl(PR_SET_TIMING,...)`]
+///
+/// [`prctl(PR_SET_TIMING,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_timing_method(method: TimingMethod) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_TIMING, method as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_ENDIAN/PR_SET_ENDIAN
+//
+
+const PR_GET_ENDIAN: c_int = 19;
+
+const PR_ENDIAN_BIG: u32 = 0;
+const PR_ENDIAN_LITTLE: u32 = 1;
+const PR_ENDIAN_PPC_LITTLE: u32 = 2;
+
+/// `PR_ENDIAN_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum EndianMode {
+ /// Big endian mode.
+ Big = PR_ENDIAN_BIG,
+ /// True little endian mode.
+ Little = PR_ENDIAN_LITTLE,
+ /// `PowerPC` pseudo little endian.
+ PowerPCLittle = PR_ENDIAN_PPC_LITTLE,
+}
+
+impl TryFrom<u32> for EndianMode {
+ type Error = io::Errno;
+
+ fn try_from(value: u32) -> Result<Self, Self::Error> {
+ match value {
+ PR_ENDIAN_BIG => Ok(Self::Big),
+ PR_ENDIAN_LITTLE => Ok(Self::Little),
+ PR_ENDIAN_PPC_LITTLE => Ok(Self::PowerPCLittle),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get the endianness of the calling process.
+///
+/// # References
+/// - [`prctl(PR_GET_ENDIAN,...)`]
+///
+/// [`prctl(PR_GET_ENDIAN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn endian_mode() -> io::Result<EndianMode> {
+ unsafe { prctl_get_at_arg2::<c_uint, _>(PR_GET_ENDIAN) }
+}
+
+const PR_SET_ENDIAN: c_int = 20;
+
+/// Set the endianness of the calling process.
+///
+/// # References
+/// - [`prctl(PR_SET_ENDIAN,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_ENDIAN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn set_endian_mode(mode: EndianMode) -> io::Result<()> {
+ prctl_2args(PR_SET_ENDIAN, mode as usize as *mut _).map(|_r| ())
+}
+
+//
+// PR_GET_TSC/PR_SET_TSC
+//
+
+const PR_GET_TSC: c_int = 25;
+
+const PR_TSC_ENABLE: u32 = 1;
+const PR_TSC_SIGSEGV: u32 = 2;
+
+/// `PR_TSC_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum TimeStampCounterReadability {
+ /// Allow the use of the timestamp counter.
+ Readable = PR_TSC_ENABLE,
+ /// Throw a `SIGSEGV` instead of reading the TSC.
+ RaiseSIGSEGV = PR_TSC_SIGSEGV,
+}
+
+impl TryFrom<u32> for TimeStampCounterReadability {
+ type Error = io::Errno;
+
+ fn try_from(value: u32) -> Result<Self, Self::Error> {
+ match value {
+ PR_TSC_ENABLE => Ok(Self::Readable),
+ PR_TSC_SIGSEGV => Ok(Self::RaiseSIGSEGV),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get the state of the flag determining if the timestamp counter can be read.
+///
+/// # References
+/// - [`prctl(PR_GET_TSC,...)`]
+///
+/// [`prctl(PR_GET_TSC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn time_stamp_counter_readability() -> io::Result<TimeStampCounterReadability> {
+ unsafe { prctl_get_at_arg2::<c_uint, _>(PR_GET_TSC) }
+}
+
+const PR_SET_TSC: c_int = 26;
+
+/// Set the state of the flag determining if the timestamp counter can be read by the process.
+///
+/// # References
+/// - [`prctl(PR_SET_TSC,...)`]
+///
+/// [`prctl(PR_SET_TSC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_time_stamp_counter_readability(
+ readability: TimeStampCounterReadability,
+) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_TSC, readability as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_TASK_PERF_EVENTS_DISABLE/PR_TASK_PERF_EVENTS_ENABLE
+//
+
+const PR_TASK_PERF_EVENTS_DISABLE: c_int = 31;
+const PR_TASK_PERF_EVENTS_ENABLE: c_int = 32;
+
+/// Enable or disable all performance counters attached to the calling process.
+///
+/// # References
+/// - [`prctl(PR_TASK_PERF_EVENTS_ENABLE,...)`]
+/// - [`prctl(PR_TASK_PERF_EVENTS_DISABLE,...)`]
+///
+/// [`prctl(PR_TASK_PERF_EVENTS_ENABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [`prctl(PR_TASK_PERF_EVENTS_DISABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn configure_performance_counters(enable: bool) -> io::Result<()> {
+ let option = if enable {
+ PR_TASK_PERF_EVENTS_ENABLE
+ } else {
+ PR_TASK_PERF_EVENTS_DISABLE
+ };
+
+ unsafe { prctl_1arg(option) }.map(|_r| ())
+}
+
+//
+// PR_MCE_KILL_GET/PR_MCE_KILL
+//
+
+const PR_MCE_KILL_GET: c_int = 34;
+
+const PR_MCE_KILL_LATE: u32 = 0;
+const PR_MCE_KILL_EARLY: u32 = 1;
+const PR_MCE_KILL_DEFAULT: u32 = 2;
+
+/// `PR_MCE_KILL_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum MachineCheckMemoryCorruptionKillPolicy {
+ /// Late kill policy.
+ Late = PR_MCE_KILL_LATE,
+ /// Early kill policy.
+ Early = PR_MCE_KILL_EARLY,
+ /// System-wide default policy.
+ Default = PR_MCE_KILL_DEFAULT,
+}
+
+impl TryFrom<u32> for MachineCheckMemoryCorruptionKillPolicy {
+ type Error = io::Errno;
+
+ fn try_from(value: u32) -> Result<Self, Self::Error> {
+ match value {
+ PR_MCE_KILL_LATE => Ok(Self::Late),
+ PR_MCE_KILL_EARLY => Ok(Self::Early),
+ PR_MCE_KILL_DEFAULT => Ok(Self::Default),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get the current per-process machine check kill policy.
+///
+/// # References
+/// - [`prctl(PR_MCE_KILL_GET,...)`]
+///
+/// [`prctl(PR_MCE_KILL_GET,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn machine_check_memory_corruption_kill_policy(
+) -> io::Result<MachineCheckMemoryCorruptionKillPolicy> {
+ let r = unsafe { prctl_1arg(PR_MCE_KILL_GET)? } as c_uint;
+ MachineCheckMemoryCorruptionKillPolicy::try_from(r)
+}
+
+const PR_MCE_KILL: c_int = 33;
+
+const PR_MCE_KILL_CLEAR: usize = 0;
+const PR_MCE_KILL_SET: usize = 1;
+
+/// Set the machine check memory corruption kill policy for the calling thread.
+///
+/// # References
+/// - [`prctl(PR_MCE_KILL,...)`]
+///
+/// [`prctl(PR_MCE_KILL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_machine_check_memory_corruption_kill_policy(
+ policy: Option<MachineCheckMemoryCorruptionKillPolicy>,
+) -> io::Result<()> {
+ let (sub_operation, policy) = if let Some(policy) = policy {
+ (PR_MCE_KILL_SET, policy as usize as *mut _)
+ } else {
+ (PR_MCE_KILL_CLEAR, ptr::null_mut())
+ };
+
+ unsafe { prctl_3args(PR_MCE_KILL, sub_operation as *mut _, policy) }.map(|_r| ())
+}
+
+//
+// PR_SET_MM
+//
+
+const PR_SET_MM: c_int = 35;
+
+const PR_SET_MM_START_CODE: u32 = 1;
+const PR_SET_MM_END_CODE: u32 = 2;
+const PR_SET_MM_START_DATA: u32 = 3;
+const PR_SET_MM_END_DATA: u32 = 4;
+const PR_SET_MM_START_STACK: u32 = 5;
+const PR_SET_MM_START_BRK: u32 = 6;
+const PR_SET_MM_BRK: u32 = 7;
+const PR_SET_MM_ARG_START: u32 = 8;
+const PR_SET_MM_ARG_END: u32 = 9;
+const PR_SET_MM_ENV_START: u32 = 10;
+const PR_SET_MM_ENV_END: u32 = 11;
+const PR_SET_MM_AUXV: usize = 12;
+const PR_SET_MM_EXE_FILE: usize = 13;
+const PR_SET_MM_MAP: usize = 14;
+const PR_SET_MM_MAP_SIZE: usize = 15;
+
+/// `PR_SET_MM_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum VirtualMemoryMapAddress {
+ /// Set the address above which the program text can run.
+ CodeStart = PR_SET_MM_START_CODE,
+ /// Set the address below which the program text can run.
+ CodeEnd = PR_SET_MM_END_CODE,
+ /// Set the address above which initialized and uninitialized (bss) data are placed.
+ DataStart = PR_SET_MM_START_DATA,
+ /// Set the address below which initialized and uninitialized (bss) data are placed.
+ DataEnd = PR_SET_MM_END_DATA,
+ /// Set the start address of the stack.
+ StackStart = PR_SET_MM_START_STACK,
+ /// Set the address above which the program heap can be expanded with `brk` call.
+ BrkStart = PR_SET_MM_START_BRK,
+ /// Set the current `brk` value.
+ BrkCurrent = PR_SET_MM_BRK,
+ /// Set the address above which the program command line is placed.
+ ArgStart = PR_SET_MM_ARG_START,
+ /// Set the address below which the program command line is placed.
+ ArgEnd = PR_SET_MM_ARG_END,
+ /// Set the address above which the program environment is placed.
+ EnvironmentStart = PR_SET_MM_ENV_START,
+ /// Set the address below which the program environment is placed.
+ EnvironmentEnd = PR_SET_MM_ENV_END,
+}
+
+/// Modify certain kernel memory map descriptor addresses of the calling process.
+///
+/// # References
+/// - [`prctl(PR_SET_MM,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_MM,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn set_virtual_memory_map_address(
+ option: VirtualMemoryMapAddress,
+ address: Option<NonNull<c_void>>,
+) -> io::Result<()> {
+ let address = address.map_or_else(ptr::null_mut, NonNull::as_ptr);
+ prctl_3args(PR_SET_MM, option as usize as *mut _, address).map(|_r| ())
+}
+
+/// Supersede the `/proc/pid/exe` symbolic link with a new one pointing to a new executable file.
+///
+/// # References
+/// - [`prctl(PR_SET_MM,PR_SET_MM_EXE_FILE,...)`]
+///
+/// [`prctl(PR_SET_MM,PR_SET_MM_EXE_FILE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_executable_file(fd: BorrowedFd) -> io::Result<()> {
+ let fd = usize::try_from(fd.as_raw_fd()).map_err(|_r| io::Errno::RANGE)?;
+ unsafe { prctl_3args(PR_SET_MM, PR_SET_MM_EXE_FILE as *mut _, fd as *mut _) }.map(|_r| ())
+}
+
+/// Set a new auxiliary vector.
+///
+/// # References
+/// - [`prctl(PR_SET_MM,PR_SET_MM_AUXV,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_MM,PR_SET_MM_AUXV,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn set_auxiliary_vector(auxv: &[*const c_void]) -> io::Result<()> {
+ syscalls::prctl(
+ PR_SET_MM,
+ PR_SET_MM_AUXV as *mut _,
+ auxv.as_ptr() as *mut _,
+ auxv.len() as *mut _,
+ ptr::null_mut(),
+ )
+ .map(|_r| ())
+}
+
+/// Get the size of the [`PrctlMmMap`] the kernel expects.
+///
+/// # References
+/// - [`prctl(PR_SET_MM,PR_SET_MM_MAP_SIZE,...)`]
+///
+/// [`prctl(PR_SET_MM,PR_SET_MM_MAP_SIZE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn virtual_memory_map_config_struct_size() -> io::Result<usize> {
+ let mut value: c_uint = 0;
+ let value_ptr = (&mut value) as *mut c_uint;
+ unsafe { prctl_3args(PR_SET_MM, PR_SET_MM_MAP_SIZE as *mut _, value_ptr.cast())? };
+ Ok(value as usize)
+}
+
+/// This structure provides new memory descriptor map which mostly modifies `/proc/pid/stat[m]`
+/// output for a task.
+/// This mostly done in a sake of checkpoint/restore functionality.
+#[repr(C)]
+#[derive(Debug, Clone)]
+pub struct PrctlMmMap {
+ /// Code section start address.
+ pub start_code: u64,
+ /// Code section end address.
+ pub end_code: u64,
+ /// Data section start address.
+ pub start_data: u64,
+ /// Data section end address.
+ pub end_data: u64,
+ /// brk() start address.
+ pub start_brk: u64,
+ /// brk() current address.
+ pub brk: u64,
+ /// Stack start address.
+ pub start_stack: u64,
+ /// Program command line start address.
+ pub arg_start: u64,
+ /// Program command line end address.
+ pub arg_end: u64,
+ /// Program environment start address.
+ pub env_start: u64,
+ /// Program environment end address.
+ pub env_end: u64,
+ /// Auxiliary vector start address.
+ pub auxv: *mut u64,
+ /// Auxiliary vector size.
+ pub auxv_size: u32,
+ /// File descriptor of executable file that was used to create this process.
+ pub exe_fd: u32,
+}
+
+/// Provides one-shot access to all the addresses by passing in a [`PrctlMmMap`].
+///
+/// # References
+/// - [`prctl(PR_SET_MM,PR_SET_MM_MAP,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_MM,PR_SET_MM_MAP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn configure_virtual_memory_map(config: &PrctlMmMap) -> io::Result<()> {
+ syscalls::prctl(
+ PR_SET_MM,
+ PR_SET_MM_MAP as *mut _,
+ config as *const PrctlMmMap as *mut _,
+ mem::size_of::<PrctlMmMap>() as *mut _,
+ ptr::null_mut(),
+ )
+ .map(|_r| ())
+}
+
+//
+// PR_SET_PTRACER
+//
+
+const PR_SET_PTRACER: c_int = 0x59_61_6d_61;
+
+const PR_SET_PTRACER_ANY: usize = usize::MAX;
+
+/// Process ptracer.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub enum PTracer {
+ /// None.
+ None,
+ /// Disable `ptrace` restrictions for the calling process.
+ Any,
+ /// Specific process.
+ ProcessID(Pid),
+}
+
+/// Declare that the ptracer process can `ptrace` the calling process as if it were a direct
+/// process ancestor.
+///
+/// # References
+/// - [`prctl(PR_SET_PTRACER,...)`]
+///
+/// [`prctl(PR_SET_PTRACER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_ptracer(tracer: PTracer) -> io::Result<()> {
+ let pid = match tracer {
+ PTracer::None => ptr::null_mut(),
+ PTracer::Any => PR_SET_PTRACER_ANY as *mut _,
+ PTracer::ProcessID(pid) => pid.as_raw_nonzero().get() as usize as *mut _,
+ };
+
+ unsafe { prctl_2args(PR_SET_PTRACER, pid) }.map(|_r| ())
+}
+
+//
+// PR_GET_CHILD_SUBREAPER/PR_SET_CHILD_SUBREAPER
+//
+
+const PR_GET_CHILD_SUBREAPER: c_int = 37;
+
+/// Get the `child subreaper` setting of the calling process.
+///
+/// # References
+/// - [`prctl(PR_GET_CHILD_SUBREAPER,...)`]
+///
+/// [`prctl(PR_GET_CHILD_SUBREAPER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn child_subreaper() -> io::Result<Option<Pid>> {
+ unsafe {
+ let r = prctl_get_at_arg2_optional::<c_uint>(PR_GET_CHILD_SUBREAPER)?;
+ Ok(Pid::from_raw(r as RawPid))
+ }
+}
+
+const PR_SET_CHILD_SUBREAPER: c_int = 36;
+
+/// Set the `child subreaper` attribute of the calling process.
+///
+/// # References
+/// - [`prctl(PR_SET_CHILD_SUBREAPER,...)`]
+///
+/// [`prctl(PR_SET_CHILD_SUBREAPER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_child_subreaper(pid: Option<Pid>) -> io::Result<()> {
+ let pid = pid.map_or(0_usize, |pid| pid.as_raw_nonzero().get() as usize);
+ unsafe { prctl_2args(PR_SET_CHILD_SUBREAPER, pid as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_FP_MODE/PR_SET_FP_MODE
+//
+
+const PR_GET_FP_MODE: c_int = 46;
+
+const PR_FP_MODE_FR: u32 = 1_u32 << 0;
+const PR_FP_MODE_FRE: u32 = 1_u32 << 1;
+
+/// `PR_FP_MODE_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum FloatingPointMode {
+ /// 64-bit floating point registers.
+ FloatingPointRegisters = PR_FP_MODE_FR,
+ /// Enable emulation of 32-bit floating-point mode.
+ FloatingPointEmulation = PR_FP_MODE_FRE,
+}
+
+impl TryFrom<u32> for FloatingPointMode {
+ type Error = io::Errno;
+
+ fn try_from(value: u32) -> Result<Self, Self::Error> {
+ match value {
+ PR_FP_MODE_FR => Ok(Self::FloatingPointRegisters),
+ PR_FP_MODE_FRE => Ok(Self::FloatingPointEmulation),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get the current floating point mode.
+///
+/// # References
+/// - [`prctl(PR_GET_FP_MODE,...)`]
+///
+/// [`prctl(PR_GET_FP_MODE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn floating_point_mode() -> io::Result<FloatingPointMode> {
+ let r = unsafe { prctl_1arg(PR_GET_FP_MODE)? } as c_uint;
+ FloatingPointMode::try_from(r)
+}
+
+const PR_SET_FP_MODE: c_int = 45;
+
+/// Allow control of the floating point mode from user space.
+///
+/// # References
+/// - [`prctl(PR_SET_FP_MODE,...)`]
+///
+/// [`prctl(PR_SET_FP_MODE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_floating_point_mode(mode: FloatingPointMode) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_FP_MODE, mode as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_SPECULATION_CTRL/PR_SET_SPECULATION_CTRL
+//
+
+const PR_GET_SPECULATION_CTRL: c_int = 52;
+
+const PR_SPEC_STORE_BYPASS: u32 = 0;
+const PR_SPEC_INDIRECT_BRANCH: u32 = 1;
+const PR_SPEC_L1D_FLUSH: u32 = 2;
+
+/// `PR_SPEC_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum SpeculationFeature {
+ /// Set the state of the speculative store bypass misfeature.
+ SpeculativeStoreBypass = PR_SPEC_STORE_BYPASS,
+ /// Set the state of the indirect branch speculation misfeature.
+ IndirectBranchSpeculation = PR_SPEC_INDIRECT_BRANCH,
+ /// Flush L1D Cache on context switch out of the task.
+ FlushL1DCacheOnContextSwitchOutOfTask = PR_SPEC_L1D_FLUSH,
+}
+
+impl TryFrom<u32> for SpeculationFeature {
+ type Error = io::Errno;
+
+ fn try_from(value: u32) -> Result<Self, Self::Error> {
+ match value {
+ PR_SPEC_STORE_BYPASS => Ok(Self::SpeculativeStoreBypass),
+ PR_SPEC_INDIRECT_BRANCH => Ok(Self::IndirectBranchSpeculation),
+ PR_SPEC_L1D_FLUSH => Ok(Self::FlushL1DCacheOnContextSwitchOutOfTask),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+bitflags! {
+ /// `PR_SPEC_*`.
+ pub struct SpeculationFeatureControl: u32 {
+ /// The speculation feature is enabled, mitigation is disabled.
+ const ENABLE = 1_u32 << 1;
+ /// The speculation feature is disabled, mitigation is enabled.
+ const DISABLE = 1_u32 << 2;
+ /// The speculation feature is disabled, mitigation is enabled, and it cannot be undone.
+ const FORCE_DISABLE = 1_u32 << 3;
+ /// The speculation feature is disabled, mitigation is enabled, and the state will be cleared on `execve`.
+ const DISABLE_NOEXEC = 1_u32 << 4;
+ }
+}
+
+bitflags! {
+ /// Zero means the processors are not vulnerable.
+ pub struct SpeculationFeatureState: u32 {
+ /// Mitigation can be controlled per thread by `PR_SET_SPECULATION_CTRL`.
+ const PRCTL = 1_u32 << 0;
+ /// The speculation feature is enabled, mitigation is disabled.
+ const ENABLE = 1_u32 << 1;
+ /// The speculation feature is disabled, mitigation is enabled.
+ const DISABLE = 1_u32 << 2;
+ /// The speculation feature is disabled, mitigation is enabled, and it cannot be undone.
+ const FORCE_DISABLE = 1_u32 << 3;
+ /// The speculation feature is disabled, mitigation is enabled, and the state will be cleared on `execve`.
+ const DISABLE_NOEXEC = 1_u32 << 4;
+ }
+}
+
+/// Get the state of the speculation misfeature.
+///
+/// # References
+/// - [`prctl(PR_GET_SPECULATION_CTRL,...)`]
+///
+/// [`prctl(PR_GET_SPECULATION_CTRL,...)`]: https://www.kernel.org/doc/html/v5.18/userspace-api/spec_ctrl.html
+#[inline]
+pub fn speculative_feature_state(
+ feature: SpeculationFeature,
+) -> io::Result<Option<SpeculationFeatureState>> {
+ let r = unsafe { prctl_2args(PR_GET_SPECULATION_CTRL, feature as usize as *mut _)? } as c_uint;
+ Ok(SpeculationFeatureState::from_bits(r))
+}
+
+const PR_SET_SPECULATION_CTRL: c_int = 53;
+
+/// Sets the state of the speculation misfeature.
+///
+/// # References
+/// - [`prctl(PR_SET_SPECULATION_CTRL,...)`]
+///
+/// [`prctl(PR_SET_SPECULATION_CTRL,...)`]: https://www.kernel.org/doc/html/v5.18/userspace-api/spec_ctrl.html
+#[inline]
+pub fn control_speculative_feature(
+ feature: SpeculationFeature,
+ config: SpeculationFeatureControl,
+) -> io::Result<()> {
+ let feature = feature as usize as *mut _;
+ let config = config.bits() as usize as *mut _;
+ unsafe { prctl_3args(PR_SET_SPECULATION_CTRL, feature, config) }.map(|_r| ())
+}
+
+//
+// PR_GET_IO_FLUSHER/PR_SET_IO_FLUSHER
+//
+
+const PR_GET_IO_FLUSHER: c_int = 58;
+
+/// Get the `IO_FLUSHER` state of the caller.
+///
+/// # References
+/// - [`prctl(PR_GET_IO_FLUSHER,...)`]
+///
+/// [`prctl(PR_GET_IO_FLUSHER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn is_io_flusher() -> io::Result<bool> {
+ unsafe { prctl_1arg(PR_GET_IO_FLUSHER) }.map(|r| r != 0)
+}
+
+const PR_SET_IO_FLUSHER: c_int = 57;
+
+/// Put the process in the `IO_FLUSHER` state, allowing it to make progress when
+/// allocating memory.
+///
+/// # References
+/// - [`prctl(PR_SET_IO_FLUSHER,...)`]
+///
+/// [`prctl(PR_SET_IO_FLUSHER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn configure_io_flusher_behavior(enable: bool) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_IO_FLUSHER, enable as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_PAC_GET_ENABLED_KEYS/PR_PAC_SET_ENABLED_KEYS
+//
+
+const PR_PAC_GET_ENABLED_KEYS: c_int = 61;
+
+bitflags! {
+ /// `PR_PAC_AP*`.
+ pub struct PointerAuthenticationKeys: u32 {
+ /// Instruction authentication key `A`.
+ const INSTRUCTION_AUTHENTICATION_KEY_A = 1_u32 << 0;
+ /// Instruction authentication key `B`.
+ const INSTRUCTION_AUTHENTICATION_KEY_B = 1_u32 << 1;
+ /// Data authentication key `A`.
+ const DATA_AUTHENTICATION_KEY_A = 1_u32 << 2;
+ /// Data authentication key `B`.
+ const DATA_AUTHENTICATION_KEY_B = 1_u32 << 3;
+ /// Generic authentication `A` key.
+ const GENERIC_AUTHENTICATION_KEY_A = 1_u32 << 4;
+ }
+}
+
+/// Get enabled pointer authentication keys.
+///
+/// # References
+/// - [`prctl(PR_PAC_GET_ENABLED_KEYS,...)`]
+///
+/// [`prctl(PR_PAC_GET_ENABLED_KEYS,...)`]: https://www.kernel.org/doc/html/v5.18/arm64/pointer-authentication.html
+#[inline]
+pub fn enabled_pointer_authentication_keys() -> io::Result<PointerAuthenticationKeys> {
+ let r = unsafe { prctl_1arg(PR_PAC_GET_ENABLED_KEYS)? } as c_uint;
+ PointerAuthenticationKeys::from_bits(r).ok_or(io::Errno::RANGE)
+}
+
+const PR_PAC_SET_ENABLED_KEYS: c_int = 60;
+
+/// Set enabled pointer authentication keys.
+///
+/// # References
+/// - [`prctl(PR_PAC_SET_ENABLED_KEYS,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_PAC_SET_ENABLED_KEYS,...)`]: https://www.kernel.org/doc/html/v5.18/arm64/pointer-authentication.html
+#[inline]
+pub unsafe fn configure_pointer_authentication_keys(
+ config: impl Iterator<Item = (PointerAuthenticationKeys, bool)>,
+) -> io::Result<()> {
+ let mut affected_keys: u32 = 0;
+ let mut enabled_keys: u32 = 0;
+
+ for (key, enable) in config {
+ let key = key.bits();
+ affected_keys |= key;
+
+ if enable {
+ enabled_keys |= key;
+ } else {
+ enabled_keys &= !key;
+ }
+ }
+
+ if affected_keys == 0 {
+ return Ok(()); // Nothing to do.
+ }
+
+ prctl_3args(
+ PR_PAC_SET_ENABLED_KEYS,
+ affected_keys as usize as *mut _,
+ enabled_keys as usize as *mut _,
+ )
+ .map(|_r| ())
+}
+
+//
+// PR_SET_VMA
+//
+
+const PR_SET_VMA: c_int = 0x53_56_4d_41;
+
+const PR_SET_VMA_ANON_NAME: usize = 0;
+
+/// Set the name for a virtual memory region.
+///
+/// # References
+/// - [`prctl(PR_SET_VMA,PR_SET_VMA_ANON_NAME,...)`]
+///
+/// [`prctl(PR_SET_VMA,PR_SET_VMA_ANON_NAME,...)`]: https://lwn.net/Articles/867818/
+#[inline]
+pub fn set_virtual_memory_region_name(region: &[u8], name: Option<&CStr>) -> io::Result<()> {
+ unsafe {
+ syscalls::prctl(
+ PR_SET_VMA,
+ PR_SET_VMA_ANON_NAME as *mut _,
+ region.as_ptr() as *mut _,
+ region.len() as *mut _,
+ name.map_or_else(ptr::null, CStr::as_ptr) as *mut _,
+ )
+ .map(|_r| ())
+ }
+}
diff --git a/vendor/rustix/src/process/priority.rs b/vendor/rustix/src/process/priority.rs
index ae43a0b75..4835ceaa2 100644
--- a/vendor/rustix/src/process/priority.rs
+++ b/vendor/rustix/src/process/priority.rs
@@ -1,5 +1,5 @@
use crate::process::{Pid, Uid};
-use crate::{imp, io};
+use crate::{backend, io};
/// `nice()`—Adjust the scheduling priority of the current process.
///
@@ -11,7 +11,7 @@ use crate::{imp, io};
/// [Linux]: https://man7.org/linux/man-pages/man2/nice.2.html
#[inline]
pub fn nice(inc: i32) -> io::Result<i32> {
- imp::process::syscalls::nice(inc)
+ backend::process::syscalls::nice(inc)
}
/// `getpriority(PRIO_USER, uid)`—Get the scheduling priority of the given
@@ -29,7 +29,7 @@ pub fn nice(inc: i32) -> io::Result<i32> {
#[inline]
#[doc(alias = "getpriority")]
pub fn getpriority_user(uid: Uid) -> io::Result<i32> {
- imp::process::syscalls::getpriority_user(uid)
+ backend::process::syscalls::getpriority_user(uid)
}
/// `getpriority(PRIO_PGRP, gid)`—Get the scheduling priority of the given
@@ -49,7 +49,7 @@ pub fn getpriority_user(uid: Uid) -> io::Result<i32> {
#[inline]
#[doc(alias = "getpriority")]
pub fn getpriority_pgrp(pgid: Option<Pid>) -> io::Result<i32> {
- imp::process::syscalls::getpriority_pgrp(pgid)
+ backend::process::syscalls::getpriority_pgrp(pgid)
}
/// `getpriority(PRIO_PROCESS, pid)`—Get the scheduling priority of the given
@@ -69,7 +69,7 @@ pub fn getpriority_pgrp(pgid: Option<Pid>) -> io::Result<i32> {
#[inline]
#[doc(alias = "getpriority")]
pub fn getpriority_process(pid: Option<Pid>) -> io::Result<i32> {
- imp::process::syscalls::getpriority_process(pid)
+ backend::process::syscalls::getpriority_process(pid)
}
/// `setpriority(PRIO_USER, uid)`—Get the scheduling priority of the given
@@ -87,7 +87,7 @@ pub fn getpriority_process(pid: Option<Pid>) -> io::Result<i32> {
#[inline]
#[doc(alias = "setpriority")]
pub fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> {
- imp::process::syscalls::setpriority_user(uid, priority)
+ backend::process::syscalls::setpriority_user(uid, priority)
}
/// `setpriority(PRIO_PGRP, pgid)`—Get the scheduling priority of the given
@@ -107,7 +107,7 @@ pub fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> {
#[inline]
#[doc(alias = "setpriority")]
pub fn setpriority_pgrp(pgid: Option<Pid>, priority: i32) -> io::Result<()> {
- imp::process::syscalls::setpriority_pgrp(pgid, priority)
+ backend::process::syscalls::setpriority_pgrp(pgid, priority)
}
/// `setpriority(PRIO_PROCESS, pid)`—Get the scheduling priority of the given
@@ -127,5 +127,5 @@ pub fn setpriority_pgrp(pgid: Option<Pid>, priority: i32) -> io::Result<()> {
#[inline]
#[doc(alias = "setpriority")]
pub fn setpriority_process(pid: Option<Pid>, priority: i32) -> io::Result<()> {
- imp::process::syscalls::setpriority_process(pid, priority)
+ backend::process::syscalls::setpriority_process(pid, priority)
}
diff --git a/vendor/rustix/src/process/procctl.rs b/vendor/rustix/src/process/procctl.rs
new file mode 100644
index 000000000..ff842513f
--- /dev/null
+++ b/vendor/rustix/src/process/procctl.rs
@@ -0,0 +1,180 @@
+//! Bindings for the FreeBSD `procctl` system call.
+//!
+//! There are similarities (but also differences) with Linux's `prctl` system call, whose interface
+//! is located in the `prctl.rs` file.
+
+#![allow(unsafe_code)]
+
+use core::mem::MaybeUninit;
+
+use crate::backend::c::{c_int, c_uint, c_void};
+use crate::backend::process::syscalls;
+use crate::backend::process::types::{RawId, Signal};
+use crate::io;
+use crate::process::{Pid, RawPid};
+
+//
+// Helper functions.
+//
+
+/// Subset of `idtype_t` C enum, with only the values allowed by `procctl`.
+#[repr(i32)]
+pub enum IdType {
+ /// Process id.
+ Pid = 0,
+ /// Process group id.
+ Pgid = 2,
+}
+
+/// A process selector for use with the `procctl` interface.
+///
+/// `None` represents the current process. `Some((IdType::Pid, pid))` represents the process
+/// with pid `pid`. `Some((IdType::Pgid, pgid))` represents the control processes belonging to
+/// the process group with id `pgid`.
+pub type ProcSelector = Option<(IdType, Pid)>;
+fn proc_selector_to_raw(selector: ProcSelector) -> (IdType, RawPid) {
+ match selector {
+ Some((idtype, id)) => (idtype, id.as_raw_nonzero().get()),
+ None => (IdType::Pid, 0),
+ }
+}
+
+#[inline]
+pub(crate) unsafe fn procctl(
+ option: c_int,
+ process: ProcSelector,
+ data: *mut c_void,
+) -> io::Result<()> {
+ let (idtype, id) = proc_selector_to_raw(process);
+ syscalls::procctl(idtype as c_uint, id as RawId, option, data)
+}
+
+#[inline]
+pub(crate) unsafe fn procctl_set<P>(
+ option: c_int,
+ process: ProcSelector,
+ data: &P,
+) -> io::Result<()> {
+ procctl(option, process, (data as *const P as *mut P).cast())
+}
+
+#[inline]
+pub(crate) unsafe fn procctl_get_optional<P>(
+ option: c_int,
+ process: ProcSelector,
+) -> io::Result<P> {
+ let mut value: MaybeUninit<P> = MaybeUninit::uninit();
+ procctl(option, process, value.as_mut_ptr().cast())?;
+ Ok(value.assume_init())
+}
+
+//
+// PROC_PDEATHSIG_STATUS/PROC_PDEATHSIG_CTL
+//
+
+const PROC_PDEATHSIG_STATUS: c_int = 12;
+
+/// Get the current value of the parent process death signal.
+///
+/// # References
+/// - [Linux: `prctl(PR_GET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
+///
+/// [Linux: `prctl(PR_GET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn parent_process_death_signal() -> io::Result<Option<Signal>> {
+ unsafe { procctl_get_optional::<c_int>(PROC_PDEATHSIG_STATUS, None) }.map(Signal::from_raw)
+}
+
+const PROC_PDEATHSIG_CTL: c_int = 11;
+
+/// Set the parent-death signal of the calling process.
+///
+/// # References
+/// - [Linux: `prctl(PR_SET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
+///
+/// [Linux: `prctl(PR_SET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn set_parent_process_death_signal(signal: Option<Signal>) -> io::Result<()> {
+ let signal = signal.map_or(0, |signal| signal as c_int);
+ unsafe { procctl_set::<c_int>(PROC_PDEATHSIG_CTL, None, &signal) }
+}
+
+//
+// PROC_TRACE_CTL
+//
+
+const PROC_TRACE_CTL: c_int = 7;
+
+const PROC_TRACE_CTL_ENABLE: i32 = 1;
+const PROC_TRACE_CTL_DISABLE: i32 = 2;
+const PROC_TRACE_CTL_DISABLE_EXEC: i32 = 3;
+
+/// `PROC_TRACE_CTL_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(i32)]
+pub enum DumpableBehavior {
+ /// Not dumpable.
+ NotDumpable = PROC_TRACE_CTL_DISABLE,
+ /// Dumpable.
+ Dumpable = PROC_TRACE_CTL_ENABLE,
+ /// Not dumpable, and this behaviour is preserved across `execve` calls.
+ NotDumpableExecPreserved = PROC_TRACE_CTL_DISABLE_EXEC,
+}
+
+/// Set the state of the `dumpable` attribute for the process indicated by `idtype` and `id`.
+/// This determines whether the process can be traced and whether core dumps are produced for
+/// the process upon delivery of a signal whose default behavior is to produce a core dump.
+///
+/// This is similar to `set_dumpable_behavior` on Linux, with the exception that on FreeBSD
+/// there is an extra argument `process`. When `process` is set to `None`, the operation is
+/// performed for the current process, like on Linux.
+///
+/// # References
+/// - [`procctl(PROC_TRACE_CTL,...)`]
+///
+/// [`procctl(PROC_TRACE_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn set_dumpable_behavior(process: ProcSelector, config: DumpableBehavior) -> io::Result<()> {
+ unsafe { procctl(PROC_TRACE_CTL, process, config as usize as *mut _) }
+}
+
+//
+// PROC_TRACE_STATUS
+//
+
+const PROC_TRACE_STATUS: c_int = 8;
+
+/// Tracing status as returned by [`trace_status`].
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub enum TracingStatus {
+ /// Tracing is disabled for the process.
+ NotTraceble,
+ /// Tracing is not disabled for the process, but not debugger/tracer is attached.
+ Tracable,
+ /// The process is being traced by the process whose pid is stored in the first
+ /// component of this variant.
+ BeingTraced(Pid),
+}
+
+/// Get the tracing status of the process indicated by `idtype` and `id`.
+///
+/// # References
+/// - [`procctl(PROC_TRACE_STATUS,...)`]
+///
+/// [`procctl(PROC_TRACE_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn trace_status(process: ProcSelector) -> io::Result<TracingStatus> {
+ let val = unsafe { procctl_get_optional::<c_int>(PROC_TRACE_STATUS, process) }?;
+ match val {
+ -1 => Ok(TracingStatus::NotTraceble),
+ 0 => Ok(TracingStatus::Tracable),
+ pid => {
+ let pid = unsafe { Pid::from_raw(pid as RawPid) }.ok_or(io::Errno::RANGE)?;
+ Ok(TracingStatus::BeingTraced(pid))
+ }
+ }
+}
diff --git a/vendor/rustix/src/process/rlimit.rs b/vendor/rustix/src/process/rlimit.rs
index ffb22d2ae..e8216af79 100644
--- a/vendor/rustix/src/process/rlimit.rs
+++ b/vendor/rustix/src/process/rlimit.rs
@@ -1,8 +1,8 @@
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::process::Pid;
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::process::types::Resource;
+pub use backend::process::types::Resource;
/// `struct rlimit`—Current and maximum values used in [`getrlimit`],
/// [`setrlimit`], and [`prlimit`].
@@ -24,7 +24,7 @@ pub struct Rlimit {
/// [Linux]: https://man7.org/linux/man-pages/man2/getrlimit.2.html
#[inline]
pub fn getrlimit(resource: Resource) -> Rlimit {
- imp::process::syscalls::getrlimit(resource)
+ backend::process::syscalls::getrlimit(resource)
}
/// `setrlimit(resource, new)`—Set a process resource limit value.
@@ -37,7 +37,7 @@ pub fn getrlimit(resource: Resource) -> Rlimit {
/// [Linux]: https://man7.org/linux/man-pages/man2/setrlimit.2.html
#[inline]
pub fn setrlimit(resource: Resource, new: Rlimit) -> io::Result<()> {
- imp::process::syscalls::setrlimit(resource, new)
+ backend::process::syscalls::setrlimit(resource, new)
}
/// `prlimit(pid, resource, new)`—Get and set a process resource limit value.
@@ -49,5 +49,5 @@ pub fn setrlimit(resource: Resource, new: Rlimit) -> io::Result<()> {
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
pub fn prlimit(pid: Option<Pid>, resource: Resource, new: Rlimit) -> io::Result<Rlimit> {
- imp::process::syscalls::prlimit(pid, resource, new)
+ backend::process::syscalls::prlimit(pid, resource, new)
}
diff --git a/vendor/rustix/src/process/sched.rs b/vendor/rustix/src/process/sched.rs
index 56ba95a6b..88e661670 100644
--- a/vendor/rustix/src/process/sched.rs
+++ b/vendor/rustix/src/process/sched.rs
@@ -1,5 +1,5 @@
use crate::process::Pid;
-use crate::{imp, io};
+use crate::{backend, io};
/// `CpuSet` represents a bit-mask of CPUs.
///
@@ -15,18 +15,18 @@ use crate::{imp, io};
#[repr(C)]
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct CpuSet {
- cpu_set: imp::process::types::RawCpuSet,
+ cpu_set: backend::process::types::RawCpuSet,
}
impl CpuSet {
/// The maximum number of CPU in `CpuSet`.
- pub const MAX_CPU: usize = imp::process::types::CPU_SETSIZE;
+ pub const MAX_CPU: usize = backend::process::types::CPU_SETSIZE;
/// Create a new and empty `CpuSet`.
#[inline]
pub fn new() -> Self {
Self {
- cpu_set: imp::process::types::raw_cpu_set_new(),
+ cpu_set: backend::process::types::raw_cpu_set_new(),
}
}
@@ -35,7 +35,7 @@ impl CpuSet {
/// `field` is the CPU id to test.
#[inline]
pub fn is_set(&self, field: usize) -> bool {
- imp::process::cpu_set::CPU_ISSET(field, &self.cpu_set)
+ backend::process::cpu_set::CPU_ISSET(field, &self.cpu_set)
}
/// Add a CPU to `CpuSet`.
@@ -43,7 +43,7 @@ impl CpuSet {
/// `field` is the CPU id to add.
#[inline]
pub fn set(&mut self, field: usize) {
- imp::process::cpu_set::CPU_SET(field, &mut self.cpu_set)
+ backend::process::cpu_set::CPU_SET(field, &mut self.cpu_set)
}
/// Remove a CPU from `CpuSet`.
@@ -51,20 +51,20 @@ impl CpuSet {
/// `field` is the CPU id to remove.
#[inline]
pub fn unset(&mut self, field: usize) {
- imp::process::cpu_set::CPU_CLR(field, &mut self.cpu_set)
+ backend::process::cpu_set::CPU_CLR(field, &mut self.cpu_set)
}
/// Count the number of CPUs set in the `CpuSet`.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
pub fn count(&self) -> u32 {
- imp::process::cpu_set::CPU_COUNT(&self.cpu_set)
+ backend::process::cpu_set::CPU_COUNT(&self.cpu_set)
}
/// Zeroes the `CpuSet`.
#[inline]
pub fn clear(&mut self) {
- imp::process::cpu_set::CPU_ZERO(&mut self.cpu_set)
+ backend::process::cpu_set::CPU_ZERO(&mut self.cpu_set)
}
}
@@ -89,7 +89,7 @@ impl Default for CpuSet {
/// [Linux]: https://man7.org/linux/man-pages/man2/sched_setaffinity.2.html
#[inline]
pub fn sched_setaffinity(pid: Option<Pid>, cpuset: &CpuSet) -> io::Result<()> {
- imp::process::syscalls::sched_setaffinity(pid, &cpuset.cpu_set)
+ backend::process::syscalls::sched_setaffinity(pid, &cpuset.cpu_set)
}
/// `sched_getaffinity(pid)`—Get a thread's CPU affinity mask.
@@ -106,5 +106,5 @@ pub fn sched_setaffinity(pid: Option<Pid>, cpuset: &CpuSet) -> io::Result<()> {
#[inline]
pub fn sched_getaffinity(pid: Option<Pid>) -> io::Result<CpuSet> {
let mut cpuset = CpuSet::new();
- imp::process::syscalls::sched_getaffinity(pid, &mut cpuset.cpu_set).and(Ok(cpuset))
+ backend::process::syscalls::sched_getaffinity(pid, &mut cpuset.cpu_set).and(Ok(cpuset))
}
diff --git a/vendor/rustix/src/process/sched_yield.rs b/vendor/rustix/src/process/sched_yield.rs
index 24367773f..0324f67cb 100644
--- a/vendor/rustix/src/process/sched_yield.rs
+++ b/vendor/rustix/src/process/sched_yield.rs
@@ -1,4 +1,4 @@
-use crate::imp;
+use crate::backend;
/// `sched_yield()`—Hints to the OS that other processes should run.
///
@@ -12,5 +12,5 @@ use crate::imp;
/// [Linux]: https://man7.org/linux/man-pages/man2/sched_yield.2.html
#[inline]
pub fn sched_yield() {
- imp::process::syscalls::sched_yield()
+ backend::process::syscalls::sched_yield()
}
diff --git a/vendor/rustix/src/process/uname.rs b/vendor/rustix/src/process/uname.rs
index a17d0be7a..95dec2699 100644
--- a/vendor/rustix/src/process/uname.rs
+++ b/vendor/rustix/src/process/uname.rs
@@ -6,20 +6,20 @@
//! kernel into `&str` references, which assumes that they're NUL-terminated.
#![allow(unsafe_code)]
+use crate::backend;
use crate::ffi::CStr;
-use crate::imp;
use core::fmt;
/// `uname()`—Returns high-level information about the runtime OS and
/// hardware.
#[inline]
pub fn uname() -> Uname {
- Uname(imp::process::syscalls::uname())
+ Uname(backend::process::syscalls::uname())
}
/// `struct utsname`—Return type for [`uname`].
#[doc(alias = "utsname")]
-pub struct Uname(imp::process::types::RawUname);
+pub struct Uname(backend::process::types::RawUname);
impl Uname {
/// `sysname`—Operating system release name
diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs
index 383b34d06..a4bd1b528 100644
--- a/vendor/rustix/src/process/wait.rs
+++ b/vendor/rustix/src/process/wait.rs
@@ -1,16 +1,16 @@
use crate::process::Pid;
-use crate::{imp, io};
+use crate::{backend, io};
use bitflags::bitflags;
bitflags! {
/// Options for modifying the behavior of wait/waitpid
pub struct WaitOptions: u32 {
/// Return immediately if no child has exited.
- const NOHANG = imp::process::wait::WNOHANG as _;
+ const NOHANG = backend::process::wait::WNOHANG as _;
/// Return if a child has stopped (but not traced via `ptrace(2)`)
- const UNTRACED = imp::process::wait::WUNTRACED as _;
+ const UNTRACED = backend::process::wait::WUNTRACED as _;
/// Return if a stopped child has been resumed by delivery of `SIGCONT`
- const CONTINUED = imp::process::wait::WCONTINUED as _;
+ const CONTINUED = backend::process::wait::WCONTINUED as _;
}
}
@@ -34,13 +34,13 @@ impl WaitStatus {
/// Returns whether the process is currently stopped.
#[inline]
pub fn stopped(self) -> bool {
- imp::process::wait::WIFSTOPPED(self.0 as _)
+ backend::process::wait::WIFSTOPPED(self.0 as _)
}
/// Returns whether the process has continued from a job control stop.
#[inline]
pub fn continued(self) -> bool {
- imp::process::wait::WIFCONTINUED(self.0 as _)
+ backend::process::wait::WIFCONTINUED(self.0 as _)
}
/// Returns the number of the signal that stopped the process,
@@ -48,7 +48,7 @@ impl WaitStatus {
#[inline]
pub fn stopping_signal(self) -> Option<u32> {
if self.stopped() {
- Some(imp::process::wait::WSTOPSIG(self.0 as _) as _)
+ Some(backend::process::wait::WSTOPSIG(self.0 as _) as _)
} else {
None
}
@@ -58,8 +58,8 @@ impl WaitStatus {
/// if it exited normally.
#[inline]
pub fn exit_status(self) -> Option<u32> {
- if imp::process::wait::WIFEXITED(self.0 as _) {
- Some(imp::process::wait::WEXITSTATUS(self.0 as _) as _)
+ if backend::process::wait::WIFEXITED(self.0 as _) {
+ Some(backend::process::wait::WEXITSTATUS(self.0 as _) as _)
} else {
None
}
@@ -69,8 +69,8 @@ impl WaitStatus {
/// if the process was terminated by a signal.
#[inline]
pub fn terminating_signal(self) -> Option<u32> {
- if imp::process::wait::WIFSIGNALED(self.0 as _) {
- Some(imp::process::wait::WTERMSIG(self.0 as _) as _)
+ if backend::process::wait::WIFSIGNALED(self.0 as _) {
+ Some(backend::process::wait::WTERMSIG(self.0 as _) as _)
} else {
None
}
@@ -104,7 +104,7 @@ impl WaitStatus {
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn waitpid(pid: Option<Pid>, waitopts: WaitOptions) -> io::Result<Option<WaitStatus>> {
- Ok(imp::process::syscalls::waitpid(pid, waitopts)?.map(|(_, status)| status))
+ Ok(backend::process::syscalls::waitpid(pid, waitopts)?.map(|(_, status)| status))
}
/// `wait(waitopts)`—Wait for any of the children of calling process to
@@ -125,5 +125,5 @@ pub fn waitpid(pid: Option<Pid>, waitopts: WaitOptions) -> io::Result<Option<Wai
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn wait(waitopts: WaitOptions) -> io::Result<Option<(Pid, WaitStatus)>> {
- imp::process::syscalls::wait(waitopts)
+ backend::process::syscalls::wait(waitopts)
}
diff --git a/vendor/rustix/src/rand/getrandom.rs b/vendor/rustix/src/rand/getrandom.rs
index f5d7e365d..83043800d 100644
--- a/vendor/rustix/src/rand/getrandom.rs
+++ b/vendor/rustix/src/rand/getrandom.rs
@@ -1,7 +1,7 @@
-use crate::{imp, io};
+use crate::{backend, io};
/// `GRND_*`
-pub use imp::rand::types::GetRandomFlags;
+pub use backend::rand::types::GetRandomFlags;
/// `getrandom(buf, flags)`—Reads a sequence of random bytes.
///
@@ -17,5 +17,5 @@ pub use imp::rand::types::GetRandomFlags;
/// [Linux]: https://man7.org/linux/man-pages/man2/getrandom.2.html
#[inline]
pub fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
- imp::rand::syscalls::getrandom(buf, flags)
+ backend::rand::syscalls::getrandom(buf, flags)
}
diff --git a/vendor/rustix/src/runtime.rs b/vendor/rustix/src/runtime.rs
index 187da6341..84baeb463 100644
--- a/vendor/rustix/src/runtime.rs
+++ b/vendor/rustix/src/runtime.rs
@@ -19,45 +19,47 @@
//! serious problems.
#![allow(unsafe_code)]
+use crate::backend;
#[cfg(linux_raw)]
use crate::ffi::CStr;
#[cfg(linux_raw)]
+#[cfg(feature = "fs")]
use crate::fs::AtFlags;
-use crate::imp;
#[cfg(linux_raw)]
use crate::io;
#[cfg(linux_raw)]
use crate::process::Pid;
#[cfg(linux_raw)]
-use core::ffi::c_void;
+#[cfg(feature = "fs")]
+use backend::fd::AsFd;
#[cfg(linux_raw)]
-use imp::fd::AsFd;
+use core::ffi::c_void;
#[cfg(linux_raw)]
#[cfg(target_arch = "x86")]
#[inline]
pub unsafe fn set_thread_area(u_info: &mut UserDesc) -> io::Result<()> {
- imp::runtime::syscalls::tls::set_thread_area(u_info)
+ backend::runtime::syscalls::tls::set_thread_area(u_info)
}
#[cfg(linux_raw)]
#[cfg(target_arch = "arm")]
#[inline]
pub unsafe fn arm_set_tls(data: *mut c_void) -> io::Result<()> {
- imp::runtime::syscalls::tls::arm_set_tls(data)
+ backend::runtime::syscalls::tls::arm_set_tls(data)
}
#[cfg(linux_raw)]
#[cfg(target_arch = "x86_64")]
#[inline]
pub unsafe fn set_fs(data: *mut c_void) {
- imp::runtime::syscalls::tls::set_fs(data)
+ backend::runtime::syscalls::tls::set_fs(data)
}
#[cfg(linux_raw)]
#[inline]
pub unsafe fn set_tid_address(data: *mut c_void) -> Pid {
- imp::runtime::syscalls::tls::set_tid_address(data)
+ backend::runtime::syscalls::tls::set_tid_address(data)
}
/// `prctl(PR_SET_NAME, name)`
@@ -74,12 +76,12 @@ pub unsafe fn set_tid_address(data: *mut c_void) -> Pid {
#[cfg(linux_raw)]
#[inline]
pub unsafe fn set_thread_name(name: &CStr) -> io::Result<()> {
- imp::runtime::syscalls::tls::set_thread_name(name)
+ backend::runtime::syscalls::tls::set_thread_name(name)
}
#[cfg(linux_raw)]
#[cfg(target_arch = "x86")]
-pub use imp::runtime::tls::UserDesc;
+pub use backend::runtime::tls::UserDesc;
/// `syscall(SYS_exit, status)`—Exit the current thread.
///
@@ -89,7 +91,7 @@ pub use imp::runtime::tls::UserDesc;
#[cfg(linux_raw)]
#[inline]
pub unsafe fn exit_thread(status: i32) -> ! {
- imp::runtime::syscalls::tls::exit_thread(status)
+ backend::runtime::syscalls::tls::exit_thread(status)
}
/// Exit all the threads in the current process' thread group.
@@ -112,7 +114,7 @@ pub unsafe fn exit_thread(status: i32) -> ! {
#[doc(alias = "_Exit")]
#[inline]
pub fn exit_group(status: i32) -> ! {
- imp::process::syscalls::exit_group(status)
+ backend::process::syscalls::exit_group(status)
}
/// Return fields from the main executable segment headers ("phdrs") relevant
@@ -120,7 +122,7 @@ pub fn exit_group(status: i32) -> ! {
#[cfg(linux_raw)]
#[inline]
pub fn startup_tls_info() -> StartupTlsInfo {
- imp::runtime::tls::startup_tls_info()
+ backend::runtime::tls::startup_tls_info()
}
/// `(getauxval(AT_PHDR), getauxval(AT_PHNUM))`—Returns the address and
@@ -134,11 +136,11 @@ pub fn startup_tls_info() -> StartupTlsInfo {
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
pub fn exe_phdrs() -> (*const c_void, usize) {
- imp::param::auxv::exe_phdrs()
+ backend::param::auxv::exe_phdrs()
}
#[cfg(linux_raw)]
-pub use imp::runtime::tls::StartupTlsInfo;
+pub use backend::runtime::tls::StartupTlsInfo;
/// `fork()`—Creates a new process by duplicating the calling process.
///
@@ -219,7 +221,7 @@ pub use imp::runtime::tls::StartupTlsInfo;
/// [async-signal-safe]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03
#[cfg(linux_raw)]
pub unsafe fn fork() -> io::Result<Option<Pid>> {
- imp::runtime::syscalls::fork()
+ backend::runtime::syscalls::fork()
}
/// `execveat(dirfd, path.as_c_str(), argv, envp, flags)`—Execute a new
@@ -236,6 +238,8 @@ pub unsafe fn fork() -> io::Result<Option<Pid>> {
/// [Linux]: https://man7.org/linux/man-pages/man2/execveat.2.html
#[cfg(linux_raw)]
#[inline]
+#[cfg(feature = "fs")]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
pub unsafe fn execveat<Fd: AsFd>(
dirfd: Fd,
path: &CStr,
@@ -243,7 +247,7 @@ pub unsafe fn execveat<Fd: AsFd>(
envp: *const *const u8,
flags: AtFlags,
) -> io::Errno {
- imp::runtime::syscalls::execveat(dirfd.as_fd(), path, argv, envp, flags)
+ backend::runtime::syscalls::execveat(dirfd.as_fd(), path, argv, envp, flags)
}
/// `execve(path.as_c_str(), argv, envp)`—Execute a new command using the
@@ -261,5 +265,5 @@ pub unsafe fn execveat<Fd: AsFd>(
#[cfg(linux_raw)]
#[inline]
pub unsafe fn execve(path: &CStr, argv: *const *const u8, envp: *const *const u8) -> io::Errno {
- imp::runtime::syscalls::execve(path, argv, envp)
+ backend::runtime::syscalls::execve(path, argv, envp)
}
diff --git a/vendor/rustix/src/termios/cf.rs b/vendor/rustix/src/termios/cf.rs
index d28b65e03..d79eab5c8 100644
--- a/vendor/rustix/src/termios/cf.rs
+++ b/vendor/rustix/src/termios/cf.rs
@@ -1,40 +1,40 @@
use crate::termios::{Speed, Termios};
-use crate::{imp, io};
+use crate::{backend, io};
/// `cfgetospeed(termios)`
#[inline]
#[must_use]
pub fn cfgetospeed(termios: &Termios) -> Speed {
- imp::termios::syscalls::cfgetospeed(termios)
+ backend::termios::syscalls::cfgetospeed(termios)
}
/// `cfgetispeed(termios)`
#[inline]
#[must_use]
pub fn cfgetispeed(termios: &Termios) -> Speed {
- imp::termios::syscalls::cfgetispeed(termios)
+ backend::termios::syscalls::cfgetispeed(termios)
}
/// `cfmakeraw(termios)`
#[inline]
pub fn cfmakeraw(termios: &mut Termios) {
- imp::termios::syscalls::cfmakeraw(termios)
+ backend::termios::syscalls::cfmakeraw(termios)
}
/// `cfsetospeed(termios, speed)`
#[inline]
pub fn cfsetospeed(termios: &mut Termios, speed: Speed) -> io::Result<()> {
- imp::termios::syscalls::cfsetospeed(termios, speed)
+ backend::termios::syscalls::cfsetospeed(termios, speed)
}
/// `cfsetispeed(termios, speed)`
#[inline]
pub fn cfsetispeed(termios: &mut Termios, speed: Speed) -> io::Result<()> {
- imp::termios::syscalls::cfsetispeed(termios, speed)
+ backend::termios::syscalls::cfsetispeed(termios, speed)
}
/// `cfsetspeed(termios, speed)`
#[inline]
pub fn cfsetspeed(termios: &mut Termios, speed: Speed) -> io::Result<()> {
- imp::termios::syscalls::cfsetspeed(termios, speed)
+ backend::termios::syscalls::cfsetspeed(termios, speed)
}
diff --git a/vendor/rustix/src/termios/constants.rs b/vendor/rustix/src/termios/constants.rs
index 5c10c12ed..e96f139eb 100644
--- a/vendor/rustix/src/termios/constants.rs
+++ b/vendor/rustix/src/termios/constants.rs
@@ -1,102 +1,142 @@
-use crate::imp;
+use crate::backend;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B1000000;
+pub use backend::termios::types::B1000000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B1152000;
+pub use backend::termios::types::B1152000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B1500000;
+pub use backend::termios::types::B1500000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B2000000;
+pub use backend::termios::types::B2000000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B2500000;
+pub use backend::termios::types::B2500000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B3000000;
+pub use backend::termios::types::B3000000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B3500000;
+pub use backend::termios::types::B3500000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B4000000;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
-pub use imp::termios::types::B460800;
+pub use backend::termios::types::B4000000;
+#[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+)))]
+pub use backend::termios::types::B460800;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B500000;
+pub use backend::termios::types::B500000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::B576000;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
-pub use imp::termios::types::B921600;
+pub use backend::termios::types::B576000;
+#[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+)))]
+pub use backend::termios::types::B921600;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::BRKINT;
+pub use backend::termios::types::BRKINT;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -107,8 +147,9 @@ pub use imp::termios::types::BRKINT;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::BS0;
+pub use backend::termios::types::BS0;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -121,8 +162,9 @@ pub use imp::termios::types::BS0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::BS1;
+pub use backend::termios::types::BS1;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -132,54 +174,61 @@ pub use imp::termios::types::BS1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::BSDLY;
+pub use backend::termios::types::BSDLY;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
)))]
-pub use imp::termios::types::CBAUD;
+pub use backend::termios::types::CBAUD;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CBAUDEX;
+pub use backend::termios::types::CBAUDEX;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
)))]
-pub use imp::termios::types::CIBAUD;
+pub use backend::termios::types::CIBAUD;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CLOCAL;
+pub use backend::termios::types::CLOCAL;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CMSPAR;
+pub use backend::termios::types::CMSPAR;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -190,8 +239,9 @@ pub use imp::termios::types::CMSPAR;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CR0;
+pub use backend::termios::types::CR0;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -204,8 +254,9 @@ pub use imp::termios::types::CR0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CR1;
+pub use backend::termios::types::CR1;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -218,8 +269,9 @@ pub use imp::termios::types::CR1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CR2;
+pub use backend::termios::types::CR2;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -232,8 +284,9 @@ pub use imp::termios::types::CR2;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CR3;
+pub use backend::termios::types::CR3;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -243,56 +296,66 @@ pub use imp::termios::types::CR3;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::CRDLY;
+pub use backend::termios::types::CRDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CREAD;
+pub use backend::termios::types::CREAD;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::CRTSCTS;
+pub use backend::termios::types::CRTSCTS;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CS5;
+pub use backend::termios::types::CS5;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CS6;
+pub use backend::termios::types::CS6;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CS7;
+pub use backend::termios::types::CS7;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CS8;
+pub use backend::termios::types::CS8;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CSIZE;
+pub use backend::termios::types::CSIZE;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::CSTOPB;
+pub use backend::termios::types::CSTOPB;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ECHO;
+pub use backend::termios::types::ECHO;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::ECHOCTL;
+pub use backend::termios::types::ECHOCTL;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ECHOE;
+pub use backend::termios::types::ECHOE;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ECHOK;
+pub use backend::termios::types::ECHOK;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::ECHOKE;
+pub use backend::termios::types::ECHOKE;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ECHONL;
+pub use backend::termios::types::ECHONL;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::ECHOPRT;
+pub use backend::termios::types::ECHOPRT;
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::EXTA;
+pub use backend::termios::types::EXTA;
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::EXTB;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::EXTPROC;
+pub use backend::termios::types::EXTB;
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox"
+)))]
+pub use backend::termios::types::EXTPROC;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -303,8 +366,9 @@ pub use imp::termios::types::EXTPROC;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::FF0;
+pub use backend::termios::types::FF0;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -317,8 +381,9 @@ pub use imp::termios::types::FF0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::FF1;
+pub use backend::termios::types::FF1;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -329,32 +394,38 @@ pub use imp::termios::types::FF1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::FFDLY;
+pub use backend::termios::types::FFDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::FLUSHO;
+pub use backend::termios::types::FLUSHO;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::HUPCL;
+pub use backend::termios::types::HUPCL;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ICRNL;
+pub use backend::termios::types::ICRNL;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::IEXTEN;
+pub use backend::termios::types::IEXTEN;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::IGNBRK;
+pub use backend::termios::types::IGNBRK;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::IGNCR;
+pub use backend::termios::types::IGNCR;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::IGNPAR;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::IMAXBEL;
+pub use backend::termios::types::IGNPAR;
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox"
+)))]
+pub use backend::termios::types::IMAXBEL;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::INLCR;
+pub use backend::termios::types::INLCR;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::INPCK;
+pub use backend::termios::types::INPCK;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ISIG;
+pub use backend::termios::types::ISIG;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ISTRIP;
+pub use backend::termios::types::ISTRIP;
#[cfg(any(
linux_raw,
all(
@@ -362,25 +433,27 @@ pub use imp::termios::types::ISTRIP;
any(target_os = "haiku", target_os = "illumos", target_os = "solaris"),
)
))]
-pub use imp::termios::types::IUCLC;
+pub use backend::termios::types::IUCLC;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::IUTF8;
+pub use backend::termios::types::IUTF8;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::IXANY;
+pub use backend::termios::types::IXANY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::IXOFF;
+pub use backend::termios::types::IXOFF;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::IXON;
+pub use backend::termios::types::IXON;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -391,8 +464,9 @@ pub use imp::termios::types::IXON;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::NL0;
+pub use backend::termios::types::NL0;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -403,8 +477,9 @@ pub use imp::termios::types::NL0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::NL1;
+pub use backend::termios::types::NL1;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -414,12 +489,13 @@ pub use imp::termios::types::NL1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::NLDLY;
+pub use backend::termios::types::NLDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::NOFLSH;
+pub use backend::termios::types::NOFLSH;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::OCRNL;
+pub use backend::termios::types::OCRNL;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -428,7 +504,7 @@ pub use imp::termios::types::OCRNL;
target_os = "netbsd",
target_os = "openbsd",
)))]
-pub use imp::termios::types::OFDEL;
+pub use backend::termios::types::OFDEL;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -437,7 +513,7 @@ pub use imp::termios::types::OFDEL;
target_os = "netbsd",
target_os = "openbsd",
)))]
-pub use imp::termios::types::OFILL;
+pub use backend::termios::types::OFILL;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -446,24 +522,25 @@ pub use imp::termios::types::OFILL;
target_os = "netbsd",
target_os = "redox",
)))]
-pub use imp::termios::types::OLCUC;
+pub use backend::termios::types::OLCUC;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ONLCR;
+pub use backend::termios::types::ONLCR;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ONLRET;
+pub use backend::termios::types::ONLRET;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::ONOCR;
+pub use backend::termios::types::ONOCR;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::OPOST;
+pub use backend::termios::types::OPOST;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::PARENB;
+pub use backend::termios::types::PARENB;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::PARMRK;
+pub use backend::termios::types::PARMRK;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::PARODD;
+pub use backend::termios::types::PARODD;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use imp::termios::types::PENDIN;
+pub use backend::termios::types::PENDIN;
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
@@ -471,8 +548,9 @@ pub use imp::termios::types::PENDIN;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::TAB0;
+pub use backend::termios::types::TAB0;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -485,8 +563,9 @@ pub use imp::termios::types::TAB0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::TAB1;
+pub use backend::termios::types::TAB1;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -499,10 +578,12 @@ pub use imp::termios::types::TAB1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::TAB2;
+pub use backend::termios::types::TAB2;
#[cfg(not(any(
all(libc, target_env = "musl"),
+ target_os = "dragonfly",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "illumos",
@@ -511,29 +592,34 @@ pub use imp::termios::types::TAB2;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::TAB3;
+pub use backend::termios::types::TAB3;
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::TABDLY;
+pub use backend::termios::types::TABDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use imp::termios::types::TOSTOP;
+pub use backend::termios::types::TOSTOP;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::VSWTC;
+pub use backend::termios::types::VSWTC;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
@@ -544,8 +630,9 @@ pub use imp::termios::types::VSWTC;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::VT0;
+pub use backend::termios::types::VT0;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -558,8 +645,9 @@ pub use imp::termios::types::VT0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::VT1;
+pub use backend::termios::types::VT1;
#[cfg(not(any(
all(libc, target_env = "musl"),
target_os = "dragonfly",
@@ -570,26 +658,31 @@ pub use imp::termios::types::VT1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::VTDLY;
+pub use backend::termios::types::VTDLY;
#[cfg(any(linux_raw, all(libc, any(target_arch = "s390x", target_os = "haiku"))))]
-pub use imp::termios::types::XCASE;
+pub use backend::termios::types::XCASE;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
-pub use imp::termios::types::XTABS;
-pub use imp::termios::types::{
+pub use backend::termios::types::XTABS;
+pub use backend::termios::types::{
B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300, B38400, B4800,
- B50, B57600, B600, B75, B9600, ICANON, VDISCARD, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL,
- VLNEXT, VMIN, VQUIT, VREPRINT, VSTART, VSTOP, VSUSP, VTIME, VWERASE,
+ B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL, VMIN, VQUIT,
+ VSTART, VSTOP, VSUSP, VTIME,
};
+#[cfg(not(target_os = "haiku"))]
+pub use backend::termios::types::{VDISCARD, VLNEXT, VREPRINT, VWERASE};
/// Translate from a `Speed` code to a speed value `u32`.
///
@@ -597,123 +690,163 @@ pub use imp::termios::types::{
/// let speed = rustix::termios::speed_value(rustix::termios::B57600);
/// assert_eq!(speed, Some(57600));
/// ```
-pub fn speed_value(speed: imp::termios::types::Speed) -> Option<u32> {
+pub fn speed_value(speed: backend::termios::types::Speed) -> Option<u32> {
match speed {
- imp::termios::types::B0 => Some(0),
- imp::termios::types::B50 => Some(50),
- imp::termios::types::B75 => Some(75),
- imp::termios::types::B110 => Some(110),
- imp::termios::types::B134 => Some(134),
- imp::termios::types::B150 => Some(150),
- imp::termios::types::B200 => Some(200),
- imp::termios::types::B300 => Some(300),
- imp::termios::types::B600 => Some(600),
- imp::termios::types::B1200 => Some(1200),
- imp::termios::types::B1800 => Some(1800),
- imp::termios::types::B2400 => Some(2400),
- imp::termios::types::B4800 => Some(4800),
- imp::termios::types::B9600 => Some(9600),
- imp::termios::types::B19200 => Some(19200),
- imp::termios::types::B38400 => Some(38400),
- imp::termios::types::B57600 => Some(57600),
- imp::termios::types::B115200 => Some(115_200),
- imp::termios::types::B230400 => Some(230_400),
- #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
- imp::termios::types::B460800 => Some(460_800),
+ backend::termios::types::B0 => Some(0),
+ backend::termios::types::B50 => Some(50),
+ backend::termios::types::B75 => Some(75),
+ backend::termios::types::B110 => Some(110),
+ backend::termios::types::B134 => Some(134),
+ backend::termios::types::B150 => Some(150),
+ backend::termios::types::B200 => Some(200),
+ backend::termios::types::B300 => Some(300),
+ backend::termios::types::B600 => Some(600),
+ backend::termios::types::B1200 => Some(1200),
+ backend::termios::types::B1800 => Some(1800),
+ backend::termios::types::B2400 => Some(2400),
+ backend::termios::types::B4800 => Some(4800),
+ backend::termios::types::B9600 => Some(9600),
+ backend::termios::types::B19200 => Some(19200),
+ backend::termios::types::B38400 => Some(38400),
+ backend::termios::types::B57600 => Some(57600),
+ backend::termios::types::B115200 => Some(115_200),
+ backend::termios::types::B230400 => Some(230_400),
+ #[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+ )))]
+ backend::termios::types::B460800 => Some(460_800),
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B500000 => Some(500_000),
+ backend::termios::types::B500000 => Some(500_000),
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
+ )))]
+ backend::termios::types::B576000 => Some(576_000),
+ #[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
)))]
- imp::termios::types::B576000 => Some(576_000),
- #[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
- imp::termios::types::B921600 => Some(921_600),
+ backend::termios::types::B921600 => Some(921_600),
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B1000000 => Some(1_000_000),
+ backend::termios::types::B1000000 => Some(1_000_000),
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B1152000 => Some(1_152_000),
+ backend::termios::types::B1152000 => Some(1_152_000),
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B1500000 => Some(1_500_000),
+ backend::termios::types::B1500000 => Some(1_500_000),
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B2000000 => Some(2_000_000),
+ backend::termios::types::B2000000 => Some(2_000_000),
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B2500000 => Some(2_500_000),
+ backend::termios::types::B2500000 => Some(2_500_000),
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B3000000 => Some(3_000_000),
+ backend::termios::types::B3000000 => Some(3_000_000),
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B3500000 => Some(3_500_000),
+ backend::termios::types::B3500000 => Some(3_500_000),
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
- imp::termios::types::B4000000 => Some(4_000_000),
+ backend::termios::types::B4000000 => Some(4_000_000),
_ => None,
}
}
diff --git a/vendor/rustix/src/termios/mod.rs b/vendor/rustix/src/termios/mod.rs
index 79f2f6b38..ec35f96fb 100644
--- a/vendor/rustix/src/termios/mod.rs
+++ b/vendor/rustix/src/termios/mod.rs
@@ -10,98 +10,138 @@ pub use cf::{cfgetispeed, cfgetospeed, cfmakeraw, cfsetispeed, cfsetospeed, cfse
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B1000000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B1152000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B1500000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B2000000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B2500000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B3000000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B3500000;
#[cfg(not(any(
+ target_arch = "sparc",
+ target_arch = "sparc64",
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B4000000;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+)))]
pub use constants::B460800;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B500000;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::B576000;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "openbsd")))]
+#[cfg(not(any(
+ target_os = "dragonfly",
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "openbsd"
+)))]
pub use constants::B921600;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
pub use constants::BRKINT;
@@ -115,6 +155,7 @@ pub use constants::BRKINT;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::BS0;
#[cfg(not(any(
@@ -129,6 +170,7 @@ pub use constants::BS0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::BS1;
#[cfg(not(any(
@@ -140,11 +182,13 @@ pub use constants::BS1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::BSDLY;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -155,18 +199,21 @@ pub use constants::CBAUD;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CBAUDEX;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
@@ -180,12 +227,14 @@ pub use constants::CLOCAL;
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CMSPAR;
#[cfg(not(any(
@@ -198,6 +247,7 @@ pub use constants::CMSPAR;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CR0;
#[cfg(not(any(
@@ -212,6 +262,7 @@ pub use constants::CR0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CR1;
#[cfg(not(any(
@@ -226,6 +277,7 @@ pub use constants::CR1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CR2;
#[cfg(not(any(
@@ -240,6 +292,7 @@ pub use constants::CR2;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CR3;
#[cfg(not(any(
@@ -251,6 +304,7 @@ pub use constants::CR3;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::CRDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
@@ -285,21 +339,30 @@ pub use constants::ECHONL;
pub use constants::ECHOPRT;
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::EXTA;
#[cfg(not(any(
target_os = "emscripten",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::EXTB;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox"
+)))]
pub use constants::EXTPROC;
#[cfg(not(any(
target_os = "dragonfly",
@@ -311,6 +374,7 @@ pub use constants::EXTPROC;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::FF0;
#[cfg(not(any(
@@ -325,6 +389,7 @@ pub use constants::FF0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::FF1;
#[cfg(not(any(
@@ -337,6 +402,7 @@ pub use constants::FF1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::FFDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
@@ -353,7 +419,12 @@ pub use constants::IGNBRK;
pub use constants::IGNCR;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
pub use constants::IGNPAR;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(
+ target_os = "haiku",
+ target_os = "ios",
+ target_os = "macos",
+ target_os = "redox"
+)))]
pub use constants::IMAXBEL;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
pub use constants::INLCR;
@@ -375,12 +446,14 @@ pub use constants::IUCLC;
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::IUTF8;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
@@ -399,6 +472,7 @@ pub use constants::IXON;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::NL0;
#[cfg(not(any(
@@ -411,6 +485,7 @@ pub use constants::NL0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::NL1;
#[cfg(not(any(
@@ -422,6 +497,7 @@ pub use constants::NL1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::NLDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
@@ -472,6 +548,7 @@ pub use constants::PARODD;
#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
pub use constants::PENDIN;
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "fuchsia",
target_os = "illumos",
target_os = "ios",
@@ -479,6 +556,7 @@ pub use constants::PENDIN;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::TAB0;
#[cfg(not(any(
@@ -493,6 +571,7 @@ pub use constants::TAB0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::TAB1;
#[cfg(not(any(
@@ -507,10 +586,12 @@ pub use constants::TAB1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::TAB2;
#[cfg(not(any(
all(libc, target_env = "musl"),
+ target_os = "dragonfly",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "illumos",
@@ -519,15 +600,18 @@ pub use constants::TAB2;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::TAB3;
#[cfg(not(any(
+ target_os = "dragonfly",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "illumos",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::TABDLY;
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
@@ -535,11 +619,13 @@ pub use constants::TOSTOP;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
+ target_os = "solaris",
)))]
pub use constants::VSWTC;
#[cfg(not(any(
@@ -552,6 +638,7 @@ pub use constants::VSWTC;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::VT0;
#[cfg(not(any(
@@ -566,6 +653,7 @@ pub use constants::VT0;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::VT1;
#[cfg(not(any(
@@ -578,6 +666,7 @@ pub use constants::VT1;
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::VTDLY;
#[cfg(any(linux_raw, all(libc, any(target_arch = "s390x", target_os = "haiku"))))]
@@ -585,19 +674,23 @@ pub use constants::XCASE;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "illumos",
target_os = "ios",
target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
+ target_os = "solaris",
)))]
pub use constants::XTABS;
pub use constants::{
speed_value, B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300,
- B38400, B4800, B50, B57600, B600, B75, B9600, ICANON, VDISCARD, VEOF, VEOL, VEOL2, VERASE,
- VINTR, VKILL, VLNEXT, VMIN, VQUIT, VREPRINT, VSTART, VSTOP, VSUSP, VTIME, VWERASE,
+ B38400, B4800, B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL,
+ VMIN, VQUIT, VSTART, VSTOP, VSUSP, VTIME,
};
+#[cfg(not(target_os = "haiku"))]
+pub use constants::{VDISCARD, VLNEXT, VREPRINT, VWERASE};
pub use tc::{
tcdrain, tcflow, tcflush, tcgetattr, tcgetpgrp, tcgetsid, tcgetwinsize, tcsendbreak, tcsetattr,
tcsetpgrp, tcsetwinsize, Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios,
diff --git a/vendor/rustix/src/termios/tc.rs b/vendor/rustix/src/termios/tc.rs
index b44eafde3..e1a87b623 100644
--- a/vendor/rustix/src/termios/tc.rs
+++ b/vendor/rustix/src/termios/tc.rs
@@ -1,8 +1,8 @@
use crate::fd::AsFd;
use crate::process::Pid;
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::termios::types::{
+pub use backend::termios::types::{
Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios, Winsize,
};
@@ -22,7 +22,7 @@ pub use imp::termios::types::{
#[inline]
#[doc(alias = "TCGETS")]
pub fn tcgetattr<Fd: AsFd>(fd: Fd) -> io::Result<Termios> {
- imp::termios::syscalls::tcgetattr(fd.as_fd())
+ backend::termios::syscalls::tcgetattr(fd.as_fd())
}
/// `tcgetwinsize(fd)`—Get the current terminal window size.
@@ -37,7 +37,7 @@ pub fn tcgetattr<Fd: AsFd>(fd: Fd) -> io::Result<Termios> {
#[inline]
#[doc(alias = "TIOCGWINSZ")]
pub fn tcgetwinsize<Fd: AsFd>(fd: Fd) -> io::Result<Winsize> {
- imp::termios::syscalls::tcgetwinsize(fd.as_fd())
+ backend::termios::syscalls::tcgetwinsize(fd.as_fd())
}
/// `tcgetpgrp(fd)`—Get the terminal foreground process group.
@@ -54,7 +54,7 @@ pub fn tcgetwinsize<Fd: AsFd>(fd: Fd) -> io::Result<Winsize> {
#[inline]
#[doc(alias = "TIOCGPGRP")]
pub fn tcgetpgrp<Fd: AsFd>(fd: Fd) -> io::Result<Pid> {
- imp::termios::syscalls::tcgetpgrp(fd.as_fd())
+ backend::termios::syscalls::tcgetpgrp(fd.as_fd())
}
/// `tcsetpgrp(fd, pid)`—Set the terminal foreground process group.
@@ -71,7 +71,7 @@ pub fn tcgetpgrp<Fd: AsFd>(fd: Fd) -> io::Result<Pid> {
#[inline]
#[doc(alias = "TIOCSPGRP")]
pub fn tcsetpgrp<Fd: AsFd>(fd: Fd, pid: Pid) -> io::Result<()> {
- imp::termios::syscalls::tcsetpgrp(fd.as_fd(), pid)
+ backend::termios::syscalls::tcsetpgrp(fd.as_fd(), pid)
}
/// `tcsetattr(fd)`—Set terminal attributes.
@@ -93,7 +93,7 @@ pub fn tcsetattr<Fd: AsFd>(
optional_actions: OptionalActions,
termios: &Termios,
) -> io::Result<()> {
- imp::termios::syscalls::tcsetattr(fd.as_fd(), optional_actions, termios)
+ backend::termios::syscalls::tcsetattr(fd.as_fd(), optional_actions, termios)
}
/// `tcsendbreak(fd, 0)`—Transmit zero-valued bits.
@@ -115,7 +115,7 @@ pub fn tcsetattr<Fd: AsFd>(
#[inline]
#[doc(alias = "TCSBRK")]
pub fn tcsendbreak<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::termios::syscalls::tcsendbreak(fd.as_fd())
+ backend::termios::syscalls::tcsendbreak(fd.as_fd())
}
/// `tcdrain(fd, duration)`—Wait until all pending output has been written.
@@ -130,7 +130,7 @@ pub fn tcsendbreak<Fd: AsFd>(fd: Fd) -> io::Result<()> {
/// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html
#[inline]
pub fn tcdrain<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- imp::termios::syscalls::tcdrain(fd.as_fd())
+ backend::termios::syscalls::tcdrain(fd.as_fd())
}
/// `tcflush(fd, queue_selector)`—Wait until all pending output has been
@@ -147,7 +147,7 @@ pub fn tcdrain<Fd: AsFd>(fd: Fd) -> io::Result<()> {
#[inline]
#[doc(alias = "TCFLSH")]
pub fn tcflush<Fd: AsFd>(fd: Fd, queue_selector: QueueSelector) -> io::Result<()> {
- imp::termios::syscalls::tcflush(fd.as_fd(), queue_selector)
+ backend::termios::syscalls::tcflush(fd.as_fd(), queue_selector)
}
/// `tcflow(fd, action)`—Suspend or resume transmission or reception.
@@ -163,7 +163,7 @@ pub fn tcflush<Fd: AsFd>(fd: Fd, queue_selector: QueueSelector) -> io::Result<()
#[inline]
#[doc(alias = "TCXONC")]
pub fn tcflow<Fd: AsFd>(fd: Fd, action: Action) -> io::Result<()> {
- imp::termios::syscalls::tcflow(fd.as_fd(), action)
+ backend::termios::syscalls::tcflow(fd.as_fd(), action)
}
/// `tcgetsid(fd)`—Return the session ID of the current session with `fd` as
@@ -178,7 +178,7 @@ pub fn tcflow<Fd: AsFd>(fd: Fd, action: Action) -> io::Result<()> {
#[inline]
#[doc(alias = "TIOCGSID")]
pub fn tcgetsid<Fd: AsFd>(fd: Fd) -> io::Result<Pid> {
- imp::termios::syscalls::tcgetsid(fd.as_fd())
+ backend::termios::syscalls::tcgetsid(fd.as_fd())
}
/// `tcsetwinsize(fd)`—Set the current terminal window size.
@@ -192,5 +192,5 @@ pub fn tcgetsid<Fd: AsFd>(fd: Fd) -> io::Result<Pid> {
#[inline]
#[doc(alias = "TIOCSWINSZ")]
pub fn tcsetwinsize<Fd: AsFd>(fd: Fd, winsize: Winsize) -> io::Result<()> {
- imp::termios::syscalls::tcsetwinsize(fd.as_fd(), winsize)
+ backend::termios::syscalls::tcsetwinsize(fd.as_fd(), winsize)
}
diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs
index 1651a3c3b..9a1692330 100644
--- a/vendor/rustix/src/termios/tty.rs
+++ b/vendor/rustix/src/termios/tty.rs
@@ -1,19 +1,20 @@
//! Functions which operate on file descriptors which might be terminals.
-use crate::imp;
+use crate::backend;
#[cfg(any(
all(linux_raw, feature = "procfs"),
all(libc, not(any(target_os = "fuchsia", target_os = "wasi"))),
))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
use crate::io;
-use imp::fd::AsFd;
+use backend::fd::AsFd;
#[cfg(any(
all(linux_raw, feature = "procfs"),
all(libc, not(any(target_os = "fuchsia", target_os = "wasi"))),
))]
use {
- crate::ffi::CString, crate::path::SMALL_PATH_BUFFER_SIZE, alloc::vec::Vec, imp::fd::BorrowedFd,
+ crate::ffi::CString, crate::path::SMALL_PATH_BUFFER_SIZE, alloc::vec::Vec,
+ backend::fd::BorrowedFd,
};
/// `isatty(fd)`—Tests whether a file descriptor refers to a terminal.
@@ -26,7 +27,7 @@ use {
/// [Linux]: https://man7.org/linux/man-pages/man3/isatty.3.html
#[inline]
pub fn isatty<Fd: AsFd>(fd: Fd) -> bool {
- imp::termios::syscalls::isatty(fd.as_fd())
+ backend::termios::syscalls::isatty(fd.as_fd())
}
/// `ttyname_r(fd)`
@@ -57,7 +58,7 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.resize(buffer.capacity(), 0_u8);
loop {
- match imp::termios::syscalls::ttyname(dirfd, &mut buffer) {
+ match backend::termios::syscalls::ttyname(dirfd, &mut buffer) {
Err(io::Errno::RANGE) => {
buffer.reserve(1); // use `Vec` reallocation strategy to grow capacity exponentially
buffer.resize(buffer.capacity(), 0_u8);
diff --git a/vendor/rustix/src/thread/clock.rs b/vendor/rustix/src/thread/clock.rs
index 206703088..57672fa17 100644
--- a/vendor/rustix/src/thread/clock.rs
+++ b/vendor/rustix/src/thread/clock.rs
@@ -1,6 +1,6 @@
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::time::types::Timespec;
+pub use backend::time::types::Timespec;
#[cfg(not(any(
target_os = "dragonfly",
@@ -12,7 +12,7 @@ pub use imp::time::types::Timespec;
target_os = "redox",
target_os = "wasi",
)))]
-pub use imp::time::types::ClockId;
+pub use backend::time::types::ClockId;
/// `clock_nanosleep(id, 0, request, remain)`—Sleeps for a duration on a
/// given clock.
@@ -30,6 +30,7 @@ pub use imp::time::types::ClockId;
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
@@ -38,7 +39,7 @@ pub use imp::time::types::ClockId;
)))]
#[inline]
pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRelativeResult {
- imp::thread::syscalls::clock_nanosleep_relative(id, request)
+ backend::thread::syscalls::clock_nanosleep_relative(id, request)
}
/// `clock_nanosleep(id, TIMER_ABSTIME, request, NULL)`—Sleeps until an
@@ -57,6 +58,7 @@ pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRel
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
@@ -65,7 +67,7 @@ pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRel
)))]
#[inline]
pub fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::Result<()> {
- imp::thread::syscalls::clock_nanosleep_absolute(id, request)
+ backend::thread::syscalls::clock_nanosleep_absolute(id, request)
}
/// `nanosleep(request, remain)`—Sleeps for a duration.
@@ -80,7 +82,7 @@ pub fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::Result<(
/// [Linux]: https://man7.org/linux/man-pages/man2/nanosleep.2.html
#[inline]
pub fn nanosleep(request: &Timespec) -> NanosleepRelativeResult {
- imp::thread::syscalls::nanosleep(request)
+ backend::thread::syscalls::nanosleep(request)
}
/// A return type for `nanosleep` and `clock_nanosleep_relative`.
diff --git a/vendor/rustix/src/thread/futex.rs b/vendor/rustix/src/thread/futex.rs
index df5b561f1..7c4399f7a 100644
--- a/vendor/rustix/src/thread/futex.rs
+++ b/vendor/rustix/src/thread/futex.rs
@@ -7,9 +7,9 @@
#![allow(unsafe_code)]
use crate::thread::Timespec;
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::thread::{FutexFlags, FutexOperation};
+pub use backend::thread::{FutexFlags, FutexOperation};
/// `futex(uaddr, op, val, utime, uaddr2, val3)`
///
@@ -34,5 +34,5 @@ pub unsafe fn futex(
uaddr2: *mut u32,
val3: u32,
) -> io::Result<usize> {
- imp::thread::syscalls::futex(uaddr, op, flags, val, utime, uaddr2, val3)
+ backend::thread::syscalls::futex(uaddr, op, flags, val, utime, uaddr2, val3)
}
diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs
index 964d2654c..0d2fef026 100644
--- a/vendor/rustix/src/thread/id.rs
+++ b/vendor/rustix/src/thread/id.rs
@@ -1,4 +1,4 @@
-use crate::imp;
+use crate::backend;
use crate::process::Pid;
/// `gettid()`—Returns the thread ID.
@@ -13,5 +13,5 @@ use crate::process::Pid;
#[inline]
#[must_use]
pub fn gettid() -> Pid {
- imp::thread::syscalls::gettid()
+ backend::thread::syscalls::gettid()
}
diff --git a/vendor/rustix/src/thread/mod.rs b/vendor/rustix/src/thread/mod.rs
index ac48b435b..b1dc849d9 100644
--- a/vendor/rustix/src/thread/mod.rs
+++ b/vendor/rustix/src/thread/mod.rs
@@ -6,11 +6,16 @@ mod clock;
mod futex;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod id;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+mod prctl;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+mod setns;
#[cfg(not(any(
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
+ target_os = "haiku",
target_os = "ios",
target_os = "macos",
target_os = "openbsd",
@@ -24,3 +29,7 @@ pub use clock::{nanosleep, NanosleepRelativeResult, Timespec};
pub use futex::{futex, FutexFlags, FutexOperation};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use id::gettid;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use prctl::*;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use setns::*;
diff --git a/vendor/rustix/src/thread/prctl.rs b/vendor/rustix/src/thread/prctl.rs
new file mode 100644
index 000000000..a2191f7c3
--- /dev/null
+++ b/vendor/rustix/src/thread/prctl.rs
@@ -0,0 +1,989 @@
+#![allow(unsafe_code)]
+
+use core::convert::TryFrom;
+use core::mem::MaybeUninit;
+use core::num::NonZeroU64;
+use core::ptr;
+use core::ptr::NonNull;
+use core::sync::atomic::AtomicU8;
+
+use bitflags::bitflags;
+
+use crate::backend::c::{c_int, c_uint, c_void};
+use crate::backend::process::syscalls;
+use crate::ffi::{CStr, CString};
+use crate::io;
+use crate::process::{
+ prctl_1arg, prctl_2args, prctl_3args, prctl_get_at_arg2_optional, Pid,
+ PointerAuthenticationKeys,
+};
+
+//
+// PR_GET_KEEPCAPS/PR_SET_KEEPCAPS
+//
+
+const PR_GET_KEEPCAPS: c_int = 7;
+
+/// Get the current state of the calling thread's `keep capabilities` flag.
+///
+/// # References
+/// - [`prctl(PR_GET_KEEPCAPS,...)`]
+///
+/// [`prctl(PR_GET_KEEPCAPS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn get_keep_capabilities() -> io::Result<bool> {
+ unsafe { prctl_1arg(PR_GET_KEEPCAPS) }.map(|r| r != 0)
+}
+
+const PR_SET_KEEPCAPS: c_int = 8;
+
+/// Set the state of the calling thread's `keep capabilities` flag.
+///
+/// # References
+/// - [`prctl(PR_SET_KEEPCAPS,...)`]
+///
+/// [`prctl(PR_SET_KEEPCAPS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_keep_capabilities(enable: bool) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_KEEPCAPS, enable as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_NAME/PR_SET_NAME
+//
+
+const PR_GET_NAME: c_int = 16;
+
+/// Get the name of the calling thread.
+///
+/// # References
+/// - [`prctl(PR_GET_NAME,...)`]
+///
+/// [`prctl(PR_GET_NAME,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn name() -> io::Result<CString> {
+ let mut buffer = [0_u8; 16];
+ unsafe { prctl_2args(PR_GET_NAME, buffer.as_mut_ptr().cast())? };
+
+ let len = buffer.iter().position(|&x| x == 0_u8).unwrap_or(0);
+ CString::new(&buffer[..len]).map_err(|_r| io::Errno::ILSEQ)
+}
+
+const PR_SET_NAME: c_int = 15;
+
+/// Set the name of the calling thread.
+///
+/// # References
+/// - [`prctl(PR_SET_NAME,...)`]
+///
+/// [`prctl(PR_SET_NAME,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_name(name: &CStr) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_NAME, name.as_ptr() as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_SECCOMP/PR_SET_SECCOMP
+//
+
+//const PR_GET_SECCOMP: c_int = 21;
+
+const SECCOMP_MODE_DISABLED: i32 = 0;
+const SECCOMP_MODE_STRICT: i32 = 1;
+const SECCOMP_MODE_FILTER: i32 = 2;
+
+/// `SECCOMP_MODE_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(i32)]
+pub enum SecureComputingMode {
+ /// Secure computing is not in use.
+ Disabled = SECCOMP_MODE_DISABLED,
+ /// Use hard-coded filter.
+ Strict = SECCOMP_MODE_STRICT,
+ /// Use user-supplied filter.
+ Filter = SECCOMP_MODE_FILTER,
+}
+
+impl TryFrom<i32> for SecureComputingMode {
+ type Error = io::Errno;
+
+ fn try_from(value: i32) -> Result<Self, Self::Error> {
+ match value {
+ SECCOMP_MODE_DISABLED => Ok(Self::Disabled),
+ SECCOMP_MODE_STRICT => Ok(Self::Strict),
+ SECCOMP_MODE_FILTER => Ok(Self::Filter),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/*
+/// Get the secure computing mode of the calling thread.
+///
+/// If the caller is not in secure computing mode, this returns [`SecureComputingMode::Disabled`].
+/// If the caller is in strict secure computing mode, then this call will cause a `SIGKILL` signal
+/// to be sent to the process.
+/// If the caller is in filter mode, and this system call is allowed by the seccomp filters,
+/// it returns [`SecureComputingMode::Filter`]; otherwise, the process is killed with
+/// a `SIGKILL` signal.
+///
+/// Since Linux 3.8, the Seccomp field of the `/proc/[pid]/status` file provides a method
+/// of obtaining the same information, without the risk that the process is killed; see `proc(5)`.
+///
+/// # References
+/// - [`prctl(PR_GET_SECCOMP,...)`]
+///
+/// [`prctl(PR_GET_SECCOMP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn secure_computing_mode() -> io::Result<SecureComputingMode> {
+ unsafe { prctl_1arg(PR_GET_SECCOMP) }.and_then(TryInto::try_into)
+}
+*/
+
+const PR_SET_SECCOMP: c_int = 22;
+
+/// Set the secure computing mode for the calling thread, to limit the available system calls.
+///
+/// # References
+/// - [`prctl(PR_SET_SECCOMP,...)`]
+///
+/// [`prctl(PR_SET_SECCOMP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_secure_computing_mode(mode: SecureComputingMode) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_SECCOMP, mode as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_CAPBSET_READ/PR_CAPBSET_DROP
+//
+
+const PR_CAPBSET_READ: c_int = 23;
+
+const CAP_CHOWN: u32 = 0;
+const CAP_DAC_OVERRIDE: u32 = 1;
+const CAP_DAC_READ_SEARCH: u32 = 2;
+const CAP_FOWNER: u32 = 3;
+const CAP_FSETID: u32 = 4;
+const CAP_KILL: u32 = 5;
+const CAP_SETGID: u32 = 6;
+const CAP_SETUID: u32 = 7;
+const CAP_SETPCAP: u32 = 8;
+const CAP_LINUX_IMMUTABLE: u32 = 9;
+const CAP_NET_BIND_SERVICE: u32 = 10;
+const CAP_NET_BROADCAST: u32 = 11;
+const CAP_NET_ADMIN: u32 = 12;
+const CAP_NET_RAW: u32 = 13;
+const CAP_IPC_LOCK: u32 = 14;
+const CAP_IPC_OWNER: u32 = 15;
+const CAP_SYS_MODULE: u32 = 16;
+const CAP_SYS_RAWIO: u32 = 17;
+const CAP_SYS_CHROOT: u32 = 18;
+const CAP_SYS_PTRACE: u32 = 19;
+const CAP_SYS_PACCT: u32 = 20;
+const CAP_SYS_ADMIN: u32 = 21;
+const CAP_SYS_BOOT: u32 = 22;
+const CAP_SYS_NICE: u32 = 23;
+const CAP_SYS_RESOURCE: u32 = 24;
+const CAP_SYS_TIME: u32 = 25;
+const CAP_SYS_TTY_CONFIG: u32 = 26;
+const CAP_MKNOD: u32 = 27;
+const CAP_LEASE: u32 = 28;
+const CAP_AUDIT_WRITE: u32 = 29;
+const CAP_AUDIT_CONTROL: u32 = 30;
+const CAP_SETFCAP: u32 = 31;
+const CAP_MAC_OVERRIDE: u32 = 32;
+const CAP_MAC_ADMIN: u32 = 33;
+const CAP_SYSLOG: u32 = 34;
+const CAP_WAKE_ALARM: u32 = 35;
+const CAP_BLOCK_SUSPEND: u32 = 36;
+const CAP_AUDIT_READ: u32 = 37;
+const CAP_PERFMON: u32 = 38;
+const CAP_BPF: u32 = 39;
+const CAP_CHECKPOINT_RESTORE: u32 = 40;
+
+/// Linux per-thread capability.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum Capability {
+ /// In a system with the `_POSIX_CHOWN_RESTRICTED` option defined, this overrides
+ /// the restriction of changing file ownership and group ownership.
+ ChangeOwnership = CAP_CHOWN,
+ /// Override all DAC access, including ACL execute access if `_POSIX_ACL` is defined.
+ /// Excluding DAC access covered by [`Capability::LinuxImmutable`].
+ DACOverride = CAP_DAC_OVERRIDE,
+ /// Overrides all DAC restrictions regarding read and search on files and directories,
+ /// including ACL restrictions if `_POSIX_ACL` is defined. Excluding DAC access covered
+ /// by [`Capability::LinuxImmutable`].
+ DACReadSearch = CAP_DAC_READ_SEARCH,
+ /// Overrides all restrictions about allowed operations on files, where file owner ID must be
+ /// equal to the user ID, except where [`Capability::FileSetID`] is applicable.
+ /// It doesn't override MAC and DAC restrictions.
+ FileOwner = CAP_FOWNER,
+ /// Overrides the following restrictions that the effective user ID shall match the file owner
+ /// ID when setting the `S_ISUID` and `S_ISGID` bits on that file; that the effective group ID
+ /// (or one of the supplementary group IDs) shall match the file owner ID when setting the
+ /// `S_ISGID` bit on that file; that the `S_ISUID` and `S_ISGID` bits are cleared on successful
+ /// return from `chown` (not implemented).
+ FileSetID = CAP_FSETID,
+ /// Overrides the restriction that the real or effective user ID of a process sending a signal
+ /// must match the real or effective user ID of the process receiving the signal.
+ Kill = CAP_KILL,
+ /// Allows `setgid` manipulation. Allows `setgroups`. Allows forged gids on socket
+ /// credentials passing.
+ SetGroupID = CAP_SETGID,
+ /// Allows `set*uid` manipulation (including fsuid). Allows forged pids on socket
+ /// credentials passing.
+ SetUserID = CAP_SETUID,
+ /// Without VFS support for capabilities:
+ /// - Transfer any capability in your permitted set to any pid.
+ /// - remove any capability in your permitted set from any pid.
+ /// With VFS support for capabilities (neither of above, but)
+ /// - Add any capability from current's capability bounding set to the current process'
+ /// inheritable set.
+ /// - Allow taking bits out of capability bounding set.
+ /// - Allow modification of the securebits for a process.
+ SetPermittedCapabilities = CAP_SETPCAP,
+ /// Allow modification of `S_IMMUTABLE` and `S_APPEND` file attributes.
+ LinuxImmutable = CAP_LINUX_IMMUTABLE,
+ /// Allows binding to TCP/UDP sockets below 1024. Allows binding to ATM VCIs below 32.
+ NetBindService = CAP_NET_BIND_SERVICE,
+ /// Allow broadcasting, listen to multicast.
+ NetBroadcast = CAP_NET_BROADCAST,
+ /// Allow interface configuration. Allow administration of IP firewall, masquerading and
+ /// accounting. Allow setting debug option on sockets. Allow modification of routing tables.
+ /// Allow setting arbitrary process / process group ownership on sockets. Allow binding to any
+ /// address for transparent proxying (also via [`Capability::NetRaw`]). Allow setting TOS
+ /// (type of service). Allow setting promiscuous mode. Allow clearing driver statistics.
+ /// Allow multicasting. Allow read/write of device-specific registers. Allow activation of ATM
+ /// control sockets.
+ NetAdmin = CAP_NET_ADMIN,
+ /// Allow use of `RAW` sockets. Allow use of `PACKET` sockets. Allow binding to any address for
+ /// transparent proxying (also via [`Capability::NetAdmin`]).
+ NetRaw = CAP_NET_RAW,
+ /// Allow locking of shared memory segments. Allow mlock and mlockall (which doesn't really have
+ /// anything to do with IPC).
+ IPCLock = CAP_IPC_LOCK,
+ /// Override IPC ownership checks.
+ IPCOwner = CAP_IPC_OWNER,
+ /// Insert and remove kernel modules - modify kernel without limit.
+ SystemModule = CAP_SYS_MODULE,
+ /// Allow ioperm/iopl access. Allow sending USB messages to any device via `/dev/bus/usb`.
+ SystemRawIO = CAP_SYS_RAWIO,
+ /// Allow use of `chroot`.
+ SystemChangeRoot = CAP_SYS_CHROOT,
+ /// Allow `ptrace` of any process.
+ SystemProcessTrace = CAP_SYS_PTRACE,
+ /// Allow configuration of process accounting.
+ SystemProcessAccounting = CAP_SYS_PACCT,
+ /// Allow configuration of the secure attention key. Allow administration of the random device.
+ /// Allow examination and configuration of disk quotas. Allow setting the domainname.
+ /// Allow setting the hostname. Allow `mount` and `umount`, setting up new smb connection.
+ /// Allow some autofs root ioctls. Allow nfsservctl. Allow `VM86_REQUEST_IRQ`.
+ /// Allow to read/write pci config on alpha. Allow `irix_prctl` on mips (setstacksize).
+ /// Allow flushing all cache on m68k (`sys_cacheflush`). Allow removing semaphores.
+ /// Used instead of [`Capability::ChangeOwnership`] to "chown" IPC message queues, semaphores
+ /// and shared memory. Allow locking/unlocking of shared memory segment. Allow turning swap
+ /// on/off. Allow forged pids on socket credentials passing. Allow setting readahead and
+ /// flushing buffers on block devices. Allow setting geometry in floppy driver. Allow turning
+ /// DMA on/off in `xd` driver. Allow administration of md devices (mostly the above, but some
+ /// extra ioctls). Allow tuning the ide driver. Allow access to the nvram device. Allow
+ /// administration of `apm_bios`, serial and bttv (TV) device. Allow manufacturer commands in
+ /// isdn CAPI support driver. Allow reading non-standardized portions of pci configuration
+ /// space. Allow DDI debug ioctl on sbpcd driver. Allow setting up serial ports. Allow sending
+ /// raw qic-117 commands. Allow enabling/disabling tagged queuing on SCSI controllers and
+ /// sending arbitrary SCSI commands. Allow setting encryption key on loopback filesystem.
+ /// Allow setting zone reclaim policy. Allow everything under
+ /// [`Capability::BerkeleyPacketFilters`] and [`Capability::PerformanceMonitoring`] for backward
+ /// compatibility.
+ SystemAdmin = CAP_SYS_ADMIN,
+ /// Allow use of `reboot`.
+ SystemBoot = CAP_SYS_BOOT,
+ /// Allow raising priority and setting priority on other (different UID) processes. Allow use of
+ /// FIFO and round-robin (realtime) scheduling on own processes and setting the scheduling
+ /// algorithm used by another process. Allow setting cpu affinity on other processes.
+ /// Allow setting realtime ioprio class. Allow setting ioprio class on other processes.
+ SystemNice = CAP_SYS_NICE,
+ /// Override resource limits. Set resource limits. Override quota limits. Override reserved
+ /// space on ext2 filesystem. Modify data journaling mode on ext3 filesystem (uses journaling
+ /// resources). NOTE: ext2 honors fsuid when checking for resource overrides, so you can
+ /// override using fsuid too. Override size restrictions on IPC message queues. Allow more than
+ /// 64hz interrupts from the real-time clock. Override max number of consoles on console
+ /// allocation. Override max number of keymaps. Control memory reclaim behavior.
+ SystemResource = CAP_SYS_RESOURCE,
+ /// Allow manipulation of system clock. Allow `irix_stime` on mips. Allow setting the real-time
+ /// clock.
+ SystemTime = CAP_SYS_TIME,
+ /// Allow configuration of tty devices. Allow `vhangup` of tty.
+ SystemTTYConfig = CAP_SYS_TTY_CONFIG,
+ /// Allow the privileged aspects of `mknod`.
+ MakeNode = CAP_MKNOD,
+ /// Allow taking of leases on files.
+ Lease = CAP_LEASE,
+ /// Allow writing the audit log via unicast netlink socket.
+ AuditWrite = CAP_AUDIT_WRITE,
+ /// Allow configuration of audit via unicast netlink socket.
+ AuditControl = CAP_AUDIT_CONTROL,
+ /// Set or remove capabilities on files. Map `uid=0` into a child user namespace.
+ SetFileCapabilities = CAP_SETFCAP,
+ /// Override MAC access. The base kernel enforces no MAC policy. An LSM may enforce a MAC
+ /// policy, and if it does and it chooses to implement capability based overrides of that
+ /// policy, this is the capability it should use to do so.
+ MACOverride = CAP_MAC_OVERRIDE,
+ /// Allow MAC configuration or state changes. The base kernel requires no MAC configuration.
+ /// An LSM may enforce a MAC policy, and if it does and it chooses to implement capability based
+ /// checks on modifications to that policy or the data required to maintain it, this is the
+ /// capability it should use to do so.
+ MACAdmin = CAP_MAC_ADMIN,
+ /// Allow configuring the kernel's `syslog` (`printk` behaviour).
+ SystemLog = CAP_SYSLOG,
+ /// Allow triggering something that will wake the system.
+ WakeAlarm = CAP_WAKE_ALARM,
+ /// Allow preventing system suspends.
+ BlockSuspend = CAP_BLOCK_SUSPEND,
+ /// Allow reading the audit log via multicast netlink socket.
+ AuditRead = CAP_AUDIT_READ,
+ /// Allow system performance and observability privileged operations using `perf_events`,
+ /// `i915_perf` and other kernel subsystems.
+ PerformanceMonitoring = CAP_PERFMON,
+ /// This capability allows the following BPF operations:
+ /// - Creating all types of BPF maps
+ /// - Advanced verifier features
+ /// - Indirect variable access
+ /// - Bounded loops
+ /// - BPF to BPF function calls
+ /// - Scalar precision tracking
+ /// - Larger complexity limits
+ /// - Dead code elimination
+ /// - And potentially other features
+ /// - Loading BPF Type Format (BTF) data
+ /// - Retrieve `xlated` and JITed code of BPF programs
+ /// - Use `bpf_spin_lock` helper
+ ///
+ /// [`Capability::PerformanceMonitoring`] relaxes the verifier checks further:
+ /// - BPF progs can use of pointer-to-integer conversions
+ /// - speculation attack hardening measures are bypassed
+ /// - `bpf_probe_read` to read arbitrary kernel memory is allowed
+ /// - `bpf_trace_printk` to print kernel memory is allowed
+ ///
+ /// [`Capability::SystemAdmin`] is required to use bpf_probe_write_user.
+ ///
+ /// [`Capability::SystemAdmin`] is required to iterate system wide loaded
+ /// programs, maps, links, BTFs and convert their IDs to file descriptors.
+ ///
+ /// [`Capability::PerformanceMonitoring`] and [`Capability::BerkeleyPacketFilters`] are required
+ /// to load tracing programs.
+ /// [`Capability::NetAdmin`] and [`Capability::BerkeleyPacketFilters`] are required to load
+ /// networking programs.
+ BerkeleyPacketFilters = CAP_BPF,
+ /// Allow checkpoint/restore related operations. Allow PID selection during `clone3`.
+ /// Allow writing to `ns_last_pid`.
+ CheckpointRestore = CAP_CHECKPOINT_RESTORE,
+}
+
+/// Check if the specified capability is in the calling thread's capability bounding set.
+///
+/// # References
+/// - [`prctl(PR_CAPBSET_READ,...)`]
+///
+/// [`prctl(PR_CAPBSET_READ,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn is_in_capability_bounding_set(capability: Capability) -> io::Result<bool> {
+ unsafe { prctl_2args(PR_CAPBSET_READ, capability as usize as *mut _) }.map(|r| r != 0)
+}
+
+const PR_CAPBSET_DROP: c_int = 24;
+
+/// If the calling thread has the [`Capability::SetPermittedCapabilities`] capability within its
+/// user namespace, then drop the specified capability from the thread's capability bounding set.
+///
+/// # References
+/// - [`prctl(PR_CAPBSET_DROP,...)`]
+///
+/// [`prctl(PR_CAPBSET_DROP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn remove_capability_from_capability_bounding_set(capability: Capability) -> io::Result<()> {
+ unsafe { prctl_2args(PR_CAPBSET_DROP, capability as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_SECUREBITS/PR_SET_SECUREBITS
+//
+
+const PR_GET_SECUREBITS: c_int = 27;
+
+bitflags! {
+ /// `SECBIT_*`.
+ pub struct CapabilitiesSecureBits: u32 {
+ /// If this bit is set, then the kernel does not grant capabilities when
+ /// a `set-user-ID-root` program is executed, or when a process with an effective or real
+ /// UID of 0 calls `execve`.
+ const NO_ROOT = 1_u32 << 0;
+ /// Set [`NO_ROOT`] irreversibly.
+ const NO_ROOT_LOCKED = 1_u32 << 1;
+ /// Setting this flag stops the kernel from adjusting the process's permitted, effective,
+ /// and ambient capability sets when the thread's effective and filesystem UIDs are switched
+ /// between zero and nonzero values.
+ const NO_SETUID_FIXUP = 1_u32 << 2;
+ /// Set [`NO_SETUID_FIXUP`] irreversibly.
+ const NO_SETUID_FIXUP_LOCKED = 1_u32 << 3;
+ /// Setting this flag allows a thread that has one or more 0 UIDs to retain capabilities in
+ /// its permitted set when it switches all of its UIDs to nonzero values.
+ const KEEP_CAPS = 1_u32 << 4;
+ /// Set [`KEEP_CAPS`] irreversibly.
+ const KEEP_CAPS_LOCKED = 1_u32 << 5;
+ /// Setting this flag disallows raising ambient capabilities via the `prctl`'s
+ /// `PR_CAP_AMBIENT_RAISE` operation.
+ const NO_CAP_AMBIENT_RAISE = 1_u32 << 6;
+ /// Set [`NO_CAP_AMBIENT_RAISE`] irreversibly.
+ const NO_CAP_AMBIENT_RAISE_LOCKED = 1_u32 << 7;
+ }
+}
+
+/// Get the `securebits` flags of the calling thread.
+///
+/// # References
+/// - [`prctl(PR_GET_SECUREBITS,...)`]
+///
+/// [`prctl(PR_GET_SECUREBITS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn capabilities_secure_bits() -> io::Result<CapabilitiesSecureBits> {
+ let r = unsafe { prctl_1arg(PR_GET_SECUREBITS)? } as c_uint;
+ CapabilitiesSecureBits::from_bits(r).ok_or(io::Errno::RANGE)
+}
+
+const PR_SET_SECUREBITS: c_int = 28;
+
+/// Set the `securebits` flags of the calling thread.
+///
+/// # References
+/// - [`prctl(PR_SET_SECUREBITS,...)`]
+///
+/// [`prctl(PR_SET_SECUREBITS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_capabilities_secure_bits(bits: CapabilitiesSecureBits) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_SECUREBITS, bits.bits() as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_TIMERSLACK/PR_SET_TIMERSLACK
+//
+
+const PR_GET_TIMERSLACK: c_int = 30;
+
+/// Get the `current` timer slack value of the calling thread.
+///
+/// # References
+/// - [`prctl(PR_GET_TIMERSLACK,...)`]
+///
+/// [`prctl(PR_GET_TIMERSLACK,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn current_timer_slack() -> io::Result<u64> {
+ unsafe { prctl_1arg(PR_GET_TIMERSLACK) }.map(|r| r as u64)
+}
+
+const PR_SET_TIMERSLACK: c_int = 29;
+
+/// Sets the `current` timer slack value for the calling thread.
+///
+/// # References
+/// - [`prctl(PR_SET_TIMERSLACK,...)`]
+///
+/// [`prctl(PR_SET_TIMERSLACK,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_current_timer_slack(value: Option<NonZeroU64>) -> io::Result<()> {
+ let value = usize::try_from(value.map_or(0, NonZeroU64::get)).map_err(|_r| io::Errno::RANGE)?;
+ unsafe { prctl_2args(PR_SET_TIMERSLACK, value as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_NO_NEW_PRIVS/PR_SET_NO_NEW_PRIVS
+//
+
+const PR_GET_NO_NEW_PRIVS: c_int = 39;
+
+/// Get the value of the `no_new_privs` attribute for the calling thread.
+///
+/// # References
+/// - [`prctl(PR_GET_NO_NEW_PRIVS,...)`]
+///
+/// [`prctl(PR_GET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn no_new_privs() -> io::Result<bool> {
+ unsafe { prctl_1arg(PR_GET_NO_NEW_PRIVS) }.map(|r| r != 0)
+}
+
+const PR_SET_NO_NEW_PRIVS: c_int = 38;
+
+/// Set the calling thread's `no_new_privs` attribute.
+///
+/// # References
+/// - [`prctl(PR_SET_NO_NEW_PRIVS,...)`]
+///
+/// [`prctl(PR_SET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn set_no_new_privs(no_new_privs: bool) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_NO_NEW_PRIVS, no_new_privs as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_GET_TID_ADDRESS
+//
+
+const PR_GET_TID_ADDRESS: c_int = 40;
+
+/// Get the `clear_child_tid` address set by `set_tid_address`
+/// and `clone`'s `CLONE_CHILD_CLEARTID` flag.
+///
+/// # References
+/// - [`prctl(PR_GET_TID_ADDRESS,...)`]
+///
+/// [`prctl(PR_GET_TID_ADDRESS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn get_clear_child_tid_address() -> io::Result<Option<NonNull<c_void>>> {
+ unsafe { prctl_get_at_arg2_optional::<*mut c_void>(PR_GET_TID_ADDRESS) }.map(NonNull::new)
+}
+
+//
+// PR_GET_THP_DISABLE/PR_SET_THP_DISABLE
+//
+
+const PR_GET_THP_DISABLE: c_int = 42;
+
+/// Get the current setting of the `THP disable` flag for the calling thread.
+///
+/// # References
+/// - [`prctl(PR_GET_THP_DISABLE,...)`]
+///
+/// [`prctl(PR_GET_THP_DISABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn transparent_huge_pages_are_disabled() -> io::Result<bool> {
+ unsafe { prctl_1arg(PR_GET_THP_DISABLE) }.map(|r| r != 0)
+}
+
+const PR_SET_THP_DISABLE: c_int = 41;
+
+/// Set the state of the `THP disable` flag for the calling thread.
+///
+/// # References
+/// - [`prctl(PR_SET_THP_DISABLE,...)`]
+///
+/// [`prctl(PR_SET_THP_DISABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn disable_transparent_huge_pages(thp_disable: bool) -> io::Result<()> {
+ unsafe { prctl_2args(PR_SET_THP_DISABLE, thp_disable as usize as *mut _) }.map(|_r| ())
+}
+
+//
+// PR_CAP_AMBIENT
+//
+
+const PR_CAP_AMBIENT: c_int = 47;
+
+const PR_CAP_AMBIENT_IS_SET: usize = 1;
+
+/// Check if the specified capability is in the ambient set.
+///
+/// # References
+/// - [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_IS_SET,...)`]
+///
+/// [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_IS_SET,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn capability_is_in_ambient_capability_set(capability: Capability) -> io::Result<bool> {
+ let cap = capability as usize as *mut _;
+ unsafe { prctl_3args(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET as *mut _, cap) }.map(|r| r != 0)
+}
+
+const PR_CAP_AMBIENT_CLEAR_ALL: usize = 4;
+
+/// Remove all capabilities from the ambient set.
+///
+/// # References
+/// - [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_CLEAR_ALL,...)`]
+///
+/// [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_CLEAR_ALL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn clear_ambient_capability_set() -> io::Result<()> {
+ unsafe { prctl_2args(PR_CAP_AMBIENT, PR_CAP_AMBIENT_CLEAR_ALL as *mut _) }.map(|_r| ())
+}
+
+const PR_CAP_AMBIENT_RAISE: usize = 2;
+const PR_CAP_AMBIENT_LOWER: usize = 3;
+
+/// Add or remove the specified capability to the ambient set.
+///
+/// # References
+/// - [`prctl(PR_CAP_AMBIENT,...)`]
+///
+/// [`prctl(PR_CAP_AMBIENT,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn configure_capability_in_ambient_capability_set(
+ capability: Capability,
+ enable: bool,
+) -> io::Result<()> {
+ let sub_operation = if enable {
+ PR_CAP_AMBIENT_RAISE
+ } else {
+ PR_CAP_AMBIENT_LOWER
+ };
+ let cap = capability as usize as *mut _;
+
+ unsafe { prctl_3args(PR_CAP_AMBIENT, sub_operation as *mut _, cap) }.map(|_r| ())
+}
+
+//
+// PR_SVE_GET_VL/PR_SVE_SET_VL
+//
+
+const PR_SVE_GET_VL: c_int = 51;
+
+const PR_SVE_VL_LEN_MASK: u32 = 0xffff;
+const PR_SVE_VL_INHERIT: u32 = 1_u32 << 17;
+
+/// Scalable Vector Extension vector length configuration.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct SVEVectorLengthConfig {
+ /// Vector length in bytes.
+ pub vector_length_in_bytes: u32,
+ /// Vector length inherited across `execve`.
+ pub vector_length_inherited_across_execve: bool,
+}
+
+/// Get the thread's current SVE vector length configuration.
+///
+/// # References
+/// - [`prctl(PR_SVE_GET_VL,...)`]
+///
+/// [`prctl(PR_SVE_GET_VL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn sve_vector_length_configuration() -> io::Result<SVEVectorLengthConfig> {
+ let bits = unsafe { prctl_1arg(PR_SVE_GET_VL)? } as c_uint;
+ Ok(SVEVectorLengthConfig {
+ vector_length_in_bytes: bits & PR_SVE_VL_LEN_MASK,
+ vector_length_inherited_across_execve: (bits & PR_SVE_VL_INHERIT) != 0,
+ })
+}
+
+const PR_SVE_SET_VL: c_int = 50;
+
+const PR_SVE_SET_VL_ONEXEC: u32 = 1_u32 << 18;
+
+/// Configure the thread's vector length of Scalable Vector Extension.
+///
+/// # References
+/// - [`prctl(PR_SVE_SET_VL,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SVE_SET_VL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn set_sve_vector_length_configuration(
+ vector_length_in_bytes: usize,
+ vector_length_inherited_across_execve: bool,
+ defer_change_to_next_execve: bool,
+) -> io::Result<()> {
+ let vector_length_in_bytes =
+ u32::try_from(vector_length_in_bytes).map_err(|_r| io::Errno::RANGE)?;
+
+ let mut bits = vector_length_in_bytes & PR_SVE_VL_LEN_MASK;
+
+ if vector_length_inherited_across_execve {
+ bits |= PR_SVE_VL_INHERIT;
+ }
+
+ if defer_change_to_next_execve {
+ bits |= PR_SVE_SET_VL_ONEXEC;
+ }
+
+ prctl_2args(PR_SVE_SET_VL, bits as usize as *mut _).map(|_r| ())
+}
+
+//
+// PR_PAC_RESET_KEYS
+//
+
+const PR_PAC_RESET_KEYS: c_int = 54;
+
+/// Securely reset the thread's pointer authentication keys to fresh random values generated
+/// by the kernel.
+///
+/// # References
+/// - [`prctl(PR_PAC_RESET_KEYS,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_PAC_RESET_KEYS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn reset_pointer_authentication_keys(
+ keys: Option<PointerAuthenticationKeys>,
+) -> io::Result<()> {
+ let keys = keys.as_ref().map_or(0_u32, PointerAuthenticationKeys::bits);
+ prctl_2args(PR_PAC_RESET_KEYS, keys as usize as *mut _).map(|_r| ())
+}
+
+//
+// PR_GET_TAGGED_ADDR_CTRL/PR_SET_TAGGED_ADDR_CTRL
+//
+
+const PR_GET_TAGGED_ADDR_CTRL: c_int = 56;
+
+const PR_MTE_TAG_SHIFT: u32 = 3;
+const PR_MTE_TAG_MASK: u32 = 0xffff_u32 << PR_MTE_TAG_SHIFT;
+
+bitflags! {
+ /// Zero means addresses that are passed for the purpose of being dereferenced by the kernel must be untagged.
+ pub struct TaggedAddressMode: u32 {
+ /// Addresses that are passed for the purpose of being dereferenced by the kernel may be tagged.
+ const ENABLED = 1_u32 << 0;
+ /// Synchronous tag check fault mode.
+ const TCF_SYNC = 1_u32 << 1;
+ /// Asynchronous tag check fault mode.
+ const TCF_ASYNC = 1_u32 << 2;
+ }
+}
+
+/// Get the current tagged address mode for the calling thread.
+///
+/// # References
+/// - [`prctl(PR_GET_TAGGED_ADDR_CTRL,...)`]
+///
+/// [`prctl(PR_GET_TAGGED_ADDR_CTRL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub fn current_tagged_address_mode() -> io::Result<(Option<TaggedAddressMode>, u32)> {
+ let r = unsafe { prctl_1arg(PR_GET_TAGGED_ADDR_CTRL)? } as c_uint;
+ let mode = r & 0b111_u32;
+ let mte_tag = (r & PR_MTE_TAG_MASK) >> PR_MTE_TAG_SHIFT;
+ Ok((TaggedAddressMode::from_bits(mode), mte_tag))
+}
+
+const PR_SET_TAGGED_ADDR_CTRL: c_int = 55;
+
+/// Controls support for passing tagged user-space addresses to the kernel.
+///
+/// # References
+/// - [`prctl(PR_SET_TAGGED_ADDR_CTRL,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_TAGGED_ADDR_CTRL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn set_current_tagged_address_mode(
+ mode: Option<TaggedAddressMode>,
+ mte_tag: u32,
+) -> io::Result<()> {
+ let config = mode.as_ref().map_or(0_u32, TaggedAddressMode::bits)
+ | ((mte_tag << PR_MTE_TAG_SHIFT) & PR_MTE_TAG_MASK);
+ prctl_2args(PR_SET_TAGGED_ADDR_CTRL, config as usize as *mut _).map(|_r| ())
+}
+
+//
+// PR_SET_SYSCALL_USER_DISPATCH
+//
+
+const PR_SET_SYSCALL_USER_DISPATCH: c_int = 59;
+
+const PR_SYS_DISPATCH_OFF: usize = 0;
+
+/// Disable Syscall User Dispatch mechanism.
+///
+/// # References
+/// - [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_OFF,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_OFF,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn disable_syscall_user_dispatch() -> io::Result<()> {
+ prctl_2args(PR_SET_SYSCALL_USER_DISPATCH, PR_SYS_DISPATCH_OFF as *mut _).map(|_r| ())
+}
+
+const PR_SYS_DISPATCH_ON: usize = 1;
+
+/// Allow system calls to be executed.
+const SYSCALL_DISPATCH_FILTER_ALLOW: u8 = 0;
+/// Block system calls from executing.
+const SYSCALL_DISPATCH_FILTER_BLOCK: u8 = 1;
+
+/// Value of the fast switch flag controlling system calls user dispatch mechanism without the need
+/// to issue a syscall.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u8)]
+pub enum SysCallUserDispatchFastSwitch {
+ /// System calls are allowed to execute.
+ Allow = SYSCALL_DISPATCH_FILTER_ALLOW,
+ /// System calls are blocked from executing.
+ Block = SYSCALL_DISPATCH_FILTER_BLOCK,
+}
+
+impl TryFrom<u8> for SysCallUserDispatchFastSwitch {
+ type Error = io::Errno;
+
+ fn try_from(value: u8) -> Result<Self, Self::Error> {
+ match value {
+ SYSCALL_DISPATCH_FILTER_ALLOW => Ok(Self::Allow),
+ SYSCALL_DISPATCH_FILTER_BLOCK => Ok(Self::Block),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Enable Syscall User Dispatch mechanism.
+///
+/// # References
+/// - [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_ON,...)`]
+///
+/// # Safety
+///
+/// Please ensure the conditions necessary to safely call this function,
+/// as detailed in the references above.
+///
+/// [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_ON,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+#[inline]
+pub unsafe fn enable_syscall_user_dispatch(
+ always_allowed_region: &[u8],
+ fast_switch_flag: &AtomicU8,
+) -> io::Result<()> {
+ syscalls::prctl(
+ PR_SET_SYSCALL_USER_DISPATCH,
+ PR_SYS_DISPATCH_ON as *mut _,
+ always_allowed_region.as_ptr() as *mut _,
+ always_allowed_region.len() as *mut _,
+ fast_switch_flag as *const AtomicU8 as *mut _,
+ )
+ .map(|_r| ())
+}
+
+//
+// PR_SCHED_CORE
+//
+
+const PR_SCHED_CORE: c_int = 62;
+
+const PR_SCHED_CORE_GET: usize = 0;
+
+const PR_SCHED_CORE_SCOPE_THREAD: u32 = 0;
+const PR_SCHED_CORE_SCOPE_THREAD_GROUP: u32 = 1;
+const PR_SCHED_CORE_SCOPE_PROCESS_GROUP: u32 = 2;
+
+/// `PR_SCHED_CORE_SCOPE_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum CoreSchedulingScope {
+ /// Operation will be performed for the thread.
+ Thread = PR_SCHED_CORE_SCOPE_THREAD,
+ /// Operation will be performed for all tasks in the task group of the process.
+ ThreadGroup = PR_SCHED_CORE_SCOPE_THREAD_GROUP,
+ /// Operation will be performed for all processes in the process group.
+ ProcessGroup = PR_SCHED_CORE_SCOPE_PROCESS_GROUP,
+}
+
+impl TryFrom<u32> for CoreSchedulingScope {
+ type Error = io::Errno;
+
+ fn try_from(value: u32) -> Result<Self, Self::Error> {
+ match value {
+ PR_SCHED_CORE_SCOPE_THREAD => Ok(Self::Thread),
+ PR_SCHED_CORE_SCOPE_THREAD_GROUP => Ok(Self::ThreadGroup),
+ PR_SCHED_CORE_SCOPE_PROCESS_GROUP => Ok(Self::ProcessGroup),
+ _ => Err(io::Errno::RANGE),
+ }
+ }
+}
+
+/// Get core scheduling cookie of a process.
+///
+/// # References
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_GET,...)`]
+///
+/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_GET,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
+#[inline]
+pub fn core_scheduling_cookie(pid: Pid, scope: CoreSchedulingScope) -> io::Result<u64> {
+ let mut value: MaybeUninit<u64> = MaybeUninit::uninit();
+ unsafe {
+ syscalls::prctl(
+ PR_SCHED_CORE,
+ PR_SCHED_CORE_GET as *mut _,
+ pid.as_raw_nonzero().get() as usize as *mut _,
+ scope as usize as *mut _,
+ value.as_mut_ptr().cast(),
+ )?;
+ Ok(value.assume_init())
+ }
+}
+
+const PR_SCHED_CORE_CREATE: usize = 1;
+
+/// Create unique core scheduling cookie.
+///
+/// # References
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_CREATE,...)`]
+///
+/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_CREATE,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
+#[inline]
+pub fn create_core_scheduling_cookie(pid: Pid, scope: CoreSchedulingScope) -> io::Result<()> {
+ unsafe {
+ syscalls::prctl(
+ PR_SCHED_CORE,
+ PR_SCHED_CORE_CREATE as *mut _,
+ pid.as_raw_nonzero().get() as usize as *mut _,
+ scope as usize as *mut _,
+ ptr::null_mut(),
+ )
+ .map(|_r| ())
+ }
+}
+
+const PR_SCHED_CORE_SHARE_TO: usize = 2;
+
+/// Push core scheduling cookie to a process.
+///
+/// # References
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_TO,...)`]
+///
+/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_TO,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
+#[inline]
+pub fn push_core_scheduling_cookie(pid: Pid, scope: CoreSchedulingScope) -> io::Result<()> {
+ unsafe {
+ syscalls::prctl(
+ PR_SCHED_CORE,
+ PR_SCHED_CORE_SHARE_TO as *mut _,
+ pid.as_raw_nonzero().get() as usize as *mut _,
+ scope as usize as *mut _,
+ ptr::null_mut(),
+ )
+ .map(|_r| ())
+ }
+}
+
+const PR_SCHED_CORE_SHARE_FROM: usize = 3;
+
+/// Pull core scheduling cookie from a process.
+///
+/// # References
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_FROM,...)`]
+///
+/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_FROM,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
+#[inline]
+pub fn pull_core_scheduling_cookie(pid: Pid, scope: CoreSchedulingScope) -> io::Result<()> {
+ unsafe {
+ syscalls::prctl(
+ PR_SCHED_CORE,
+ PR_SCHED_CORE_SHARE_FROM as *mut _,
+ pid.as_raw_nonzero().get() as usize as *mut _,
+ scope as usize as *mut _,
+ ptr::null_mut(),
+ )
+ .map(|_r| ())
+ }
+}
diff --git a/vendor/rustix/src/thread/setns.rs b/vendor/rustix/src/thread/setns.rs
new file mode 100644
index 000000000..0a5564ae1
--- /dev/null
+++ b/vendor/rustix/src/thread/setns.rs
@@ -0,0 +1,89 @@
+#![allow(unsafe_code)]
+
+use bitflags::bitflags;
+use linux_raw_sys::general::{
+ CLONE_NEWCGROUP, CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID, CLONE_NEWTIME,
+ CLONE_NEWUSER, CLONE_NEWUTS,
+};
+
+use crate::backend::c::c_int;
+use crate::backend::thread::syscalls;
+use crate::fd::BorrowedFd;
+use crate::io;
+
+bitflags! {
+ /// Thread name space type.
+ pub struct ThreadNameSpaceType: u32 {
+ /// Time name space.
+ const TIME = CLONE_NEWTIME;
+ /// Mount name space.
+ const MOUNT = CLONE_NEWNS;
+ /// Control group (CGroup) name space.
+ const CONTROL_GROUP = CLONE_NEWCGROUP;
+ /// `Host name` and `NIS domain name` (UTS) name space.
+ const HOST_NAME_AND_NIS_DOMAIN_NAME = CLONE_NEWUTS;
+ /// Inter-process communication (IPC) name space.
+ const INTER_PROCESS_COMMUNICATION = CLONE_NEWIPC;
+ /// User name space.
+ const USER = CLONE_NEWUSER;
+ /// Process ID name space.
+ const PROCESS_ID = CLONE_NEWPID;
+ /// Network name space.
+ const NETWORK = CLONE_NEWNET;
+ }
+}
+
+/// Type of name space referred to by a link.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(u32)]
+pub enum LinkNameSpaceType {
+ /// Time name space.
+ Time = CLONE_NEWTIME,
+ /// Mount name space.
+ Mount = CLONE_NEWNS,
+ /// Control group (CGroup) name space.
+ ControlGroup = CLONE_NEWCGROUP,
+ /// `Host name` and `NIS domain name` (UTS) name space.
+ HostNameAndNISDomainName = CLONE_NEWUTS,
+ /// Inter-process communication (IPC) name space.
+ InterProcessCommunication = CLONE_NEWIPC,
+ /// User name space.
+ User = CLONE_NEWUSER,
+ /// Process ID name space.
+ ProcessID = CLONE_NEWPID,
+ /// Network name space.
+ Network = CLONE_NEWNET,
+}
+
+/// Reassociate the calling thread with the namespace associated with link referred to by `fd`.
+///
+/// `fd` must refer to one of the magic links in a `/proc/[pid]/ns/` directory, or a bind mount
+/// to such a link.
+///
+/// # References
+/// - [`setns`]
+///
+/// [`setns`]: https://man7.org/linux/man-pages/man2/setns.2.html
+pub fn move_into_link_name_space(
+ fd: BorrowedFd,
+ allowed_type: Option<LinkNameSpaceType>,
+) -> io::Result<()> {
+ let allowed_type = allowed_type.map_or(0, |t| t as c_int);
+ syscalls::setns(fd, allowed_type).map(|_r| ())
+}
+
+/// Atomically move the calling thread into one or more of the same namespaces as the thread
+/// referred to by `fd`.
+///
+/// `fd` must refer to a thread ID. See: `pidfd_open` and `clone`.
+///
+/// # References
+/// - [`setns`]
+///
+/// [`setns`]: https://man7.org/linux/man-pages/man2/setns.2.html
+pub fn move_into_thread_name_spaces(
+ fd: BorrowedFd,
+ allowed_types: ThreadNameSpaceType,
+) -> io::Result<()> {
+ syscalls::setns(fd, allowed_types.bits() as c_int).map(|_r| ())
+}
diff --git a/vendor/rustix/src/time/clock.rs b/vendor/rustix/src/time/clock.rs
index 32d888749..2e23f91b8 100644
--- a/vendor/rustix/src/time/clock.rs
+++ b/vendor/rustix/src/time/clock.rs
@@ -1,10 +1,10 @@
-use crate::{imp, io};
+use crate::{backend, io};
-pub use imp::time::types::{Nsecs, Secs, Timespec};
+pub use backend::time::types::{Nsecs, Secs, Timespec};
/// `clockid_t`
#[cfg(any(not(target_os = "wasi")))]
-pub use imp::time::types::{ClockId, DynamicClockId};
+pub use backend::time::types::{ClockId, DynamicClockId};
/// `clock_getres(id)`—Returns the resolution of a clock.
///
@@ -18,7 +18,7 @@ pub use imp::time::types::{ClockId, DynamicClockId};
#[inline]
#[must_use]
pub fn clock_getres(id: ClockId) -> Timespec {
- imp::time::syscalls::clock_getres(id)
+ backend::time::syscalls::clock_getres(id)
}
/// `clock_gettime(id)`—Returns the current value of a clock.
@@ -38,7 +38,7 @@ pub fn clock_getres(id: ClockId) -> Timespec {
#[inline]
#[must_use]
pub fn clock_gettime(id: ClockId) -> Timespec {
- imp::time::syscalls::clock_gettime(id)
+ backend::time::syscalls::clock_gettime(id)
}
/// Like [`clock_gettime`] but with support for dynamic clocks.
@@ -52,5 +52,5 @@ pub fn clock_gettime(id: ClockId) -> Timespec {
#[cfg(not(target_os = "wasi"))]
#[inline]
pub fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> {
- imp::time::syscalls::clock_gettime_dynamic(id)
+ backend::time::syscalls::clock_gettime_dynamic(id)
}
diff --git a/vendor/rustix/src/time/timerfd.rs b/vendor/rustix/src/time/timerfd.rs
index 5abe6ff52..7f661f7d9 100644
--- a/vendor/rustix/src/time/timerfd.rs
+++ b/vendor/rustix/src/time/timerfd.rs
@@ -1,8 +1,7 @@
-use crate::fd::AsFd;
-use crate::imp;
-use crate::io::{self, OwnedFd};
+use crate::fd::{AsFd, OwnedFd};
+use crate::{backend, io};
-pub use imp::time::types::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags};
+pub use backend::time::types::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags};
/// `timerfd_create(clockid, flags)`—Create a timer.
///
@@ -12,7 +11,7 @@ pub use imp::time::types::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTime
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_create.2.html
#[inline]
pub fn timerfd_create(clockid: TimerfdClockId, flags: TimerfdFlags) -> io::Result<OwnedFd> {
- imp::time::syscalls::timerfd_create(clockid, flags)
+ backend::time::syscalls::timerfd_create(clockid, flags)
}
/// `timerfd_settime(clockid, flags, new_value)`—Set the time on a timer.
@@ -27,7 +26,7 @@ pub fn timerfd_settime<Fd: AsFd>(
flags: TimerfdTimerFlags,
new_value: &Itimerspec,
) -> io::Result<Itimerspec> {
- imp::time::syscalls::timerfd_settime(fd.as_fd(), flags, new_value)
+ backend::time::syscalls::timerfd_settime(fd.as_fd(), flags, new_value)
}
/// `timerfd_gettime(clockid, flags)`—Query a timer.
@@ -38,5 +37,5 @@ pub fn timerfd_settime<Fd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/timerfd_gettime.2.html
#[inline]
pub fn timerfd_gettime<Fd: AsFd>(fd: Fd) -> io::Result<Itimerspec> {
- imp::time::syscalls::timerfd_gettime(fd.as_fd())
+ backend::time::syscalls::timerfd_gettime(fd.as_fd())
}
diff --git a/vendor/rustix/src/utils.rs b/vendor/rustix/src/utils.rs
index efbbe81aa..dcbadb260 100644
--- a/vendor/rustix/src/utils.rs
+++ b/vendor/rustix/src/utils.rs
@@ -11,3 +11,19 @@ pub(crate) const fn as_ptr<T>(t: &T) -> *const T {
pub(crate) fn as_mut_ptr<T>(t: &mut T) -> *mut T {
t
}
+
+/// Convert a `*mut c_void` to a `*mut T`, checking that it is not null,
+/// misaligned, or pointing to a region of memory that wraps around the address
+/// space.
+#[allow(dead_code)]
+pub(crate) fn check_raw_pointer<T>(value: *mut core::ffi::c_void) -> Option<core::ptr::NonNull<T>> {
+ if (value as usize)
+ .checked_add(core::mem::size_of::<T>())
+ .is_none()
+ || (value as usize) % core::mem::align_of::<T>() != 0
+ {
+ return None;
+ }
+
+ core::ptr::NonNull::new(value.cast())
+}
diff --git a/vendor/rustix/tests/backends.rs b/vendor/rustix/tests/backends.rs
deleted file mode 100644
index 4b88bd11c..000000000
--- a/vendor/rustix/tests/backends.rs
+++ /dev/null
@@ -1,109 +0,0 @@
-use std::process::Command;
-
-#[test]
-fn test_backends() {
- // Pick an arbitrary platform where linux_raw is enabled by default and
- // ensure that the use-default crate uses it.
- #[cfg(all(target_os = "linux", target_arch = "aarch64"))]
- {
- assert!(
- !has_dependency("test-crates/use-default", &[], &[], &["RUSTFLAGS"], "libc"),
- "use-default depends on libc"
- );
- assert!(
- has_dependency(
- "test-crates/use-default",
- &[],
- &[],
- &["RUSTFLAGS"],
- "linux-raw-sys"
- ),
- "use-default does not depend on linux-raw-sys"
- );
- }
-
- #[cfg(windows)]
- let libc_dep = "windows-sys";
- #[cfg(unix)]
- let libc_dep = "libc";
-
- // Test the use-libc crate, which enables the "use-libc" cargo feature.
- assert!(
- has_dependency("test-crates/use-libc", &[], &[], &["RUSTFLAGS"], libc_dep),
- "use-libc doesn't depend on {}",
- libc_dep
- );
-
- // Test the use-default crate with `--cfg=rustix_use_libc`.
- assert!(
- has_dependency(
- "test-crates/use-default",
- &[],
- &[("RUSTFLAGS", "--cfg=rustix_use_libc")],
- &[],
- libc_dep
- ),
- "use-default with --cfg=rustix_use_libc does not depend on {}",
- libc_dep
- );
- assert!(
- !has_dependency(
- "test-crates/use-default",
- &[],
- &[("RUSTFLAGS", "--cfg=rustix_use_libc")],
- &[],
- "linux-raw-sys"
- ),
- "use-default with --cfg=rustix_use_libc depends on linux-raw-sys"
- );
-
- // Test the use-default crate with `--features=rustix/use-libc`.
- assert!(
- has_dependency(
- "test-crates/use-default",
- &["--features=rustix/use-libc"],
- &[],
- &[],
- libc_dep
- ),
- "use-default with --features=rustix/use-libc does not depend on {}",
- libc_dep
- );
-}
-
-/// Test whether the crate at directory `dir` has a dependency on `dependency`,
-/// setting the environment variables `envs` and unsetting the environment
-/// variables `remove_envs` when running `cargo`.
-fn has_dependency(
- dir: &str,
- args: &[&str],
- envs: &[(&str, &str)],
- remove_envs: &[&str],
- dependency: &str,
-) -> bool {
- let mut command = Command::new("cargo");
-
- command
- .arg("tree")
- .arg("--quiet")
- .arg("--edges=normal")
- .arg(&format!("--invert={}", dependency))
- .current_dir(dir);
-
- command.args(args);
- for (key, value) in envs {
- command.env(key, value);
- }
- for key in remove_envs {
- command.env_remove(key);
- }
-
- let child = command.output().unwrap();
-
- // `cargo tree --invert=foo` can fail in two different ways: it exits with
- // a non-zero status if the dependency is not present in the Cargo.toml
- // configuration, and it exists with a zero status and prints nothing if
- // the dependency is present but optional and not enabled. So we check for
- // both here.
- child.status.success() && !child.stdout.is_empty()
-}
diff --git a/vendor/rustix/tests/fs/cwd.rs b/vendor/rustix/tests/fs/cwd.rs
deleted file mode 100644
index 749c84f24..000000000
--- a/vendor/rustix/tests/fs/cwd.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-/// Make sure we can use `cwd` in const contexts.
-#[allow(dead_code)]
-const CWD: rustix::fd::BorrowedFd<'static> = rustix::fs::cwd();
diff --git a/vendor/rustix/tests/fs/dir.rs b/vendor/rustix/tests/fs/dir.rs
deleted file mode 100644
index f5120be96..000000000
--- a/vendor/rustix/tests/fs/dir.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-#[test]
-fn test_dir() {
- let t = rustix::fs::openat(
- rustix::fs::cwd(),
- rustix::cstr!("."),
- rustix::fs::OFlags::RDONLY | rustix::fs::OFlags::CLOEXEC,
- rustix::fs::Mode::empty(),
- )
- .unwrap();
-
- let dir = rustix::fs::Dir::read_from(&t).unwrap();
-
- let _file = rustix::fs::openat(
- &t,
- rustix::cstr!("Cargo.toml"),
- rustix::fs::OFlags::RDONLY | rustix::fs::OFlags::CLOEXEC,
- rustix::fs::Mode::empty(),
- )
- .unwrap();
-
- let mut saw_dot = false;
- let mut saw_dotdot = false;
- let mut saw_cargo_toml = false;
- for entry in dir {
- let entry = entry.unwrap();
- if entry.file_name() == rustix::cstr!(".") {
- saw_dot = true;
- } else if entry.file_name() == rustix::cstr!("..") {
- saw_dotdot = true;
- } else if entry.file_name() == rustix::cstr!("Cargo.toml") {
- saw_cargo_toml = true;
- }
- }
- assert!(saw_dot);
- assert!(saw_dotdot);
- assert!(saw_cargo_toml);
-}
diff --git a/vendor/rustix/tests/fs/fcntl.rs b/vendor/rustix/tests/fs/fcntl.rs
deleted file mode 100644
index 1f8b78387..000000000
--- a/vendor/rustix/tests/fs/fcntl.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_fcntl_dupfd_cloexec() {
- use rustix::fd::AsFd;
- use std::os::unix::io::AsRawFd;
-
- let file = rustix::fs::openat(
- rustix::fs::cwd(),
- "Cargo.toml",
- rustix::fs::OFlags::RDONLY,
- rustix::fs::Mode::empty(),
- )
- .unwrap();
-
- let new = rustix::fs::fcntl_dupfd_cloexec(&file, 700).unwrap();
- assert_eq!(new.as_fd().as_raw_fd(), 700);
-}
diff --git a/vendor/rustix/tests/fs/file.rs b/vendor/rustix/tests/fs/file.rs
deleted file mode 100644
index 5c09f640d..000000000
--- a/vendor/rustix/tests/fs/file.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_file() {
- #[cfg(not(target_os = "illumos"))]
- rustix::fs::accessat(
- rustix::fs::cwd(),
- "Cargo.toml",
- rustix::fs::Access::READ_OK,
- rustix::fs::AtFlags::empty(),
- )
- .unwrap();
-
- assert_eq!(
- rustix::fs::openat(
- rustix::fs::cwd(),
- "Cagro.motl",
- rustix::fs::OFlags::RDONLY,
- rustix::fs::Mode::empty(),
- )
- .unwrap_err(),
- rustix::io::Errno::NOENT
- );
-
- let file = rustix::fs::openat(
- rustix::fs::cwd(),
- "Cargo.toml",
- rustix::fs::OFlags::RDONLY,
- rustix::fs::Mode::empty(),
- )
- .unwrap();
-
- assert_eq!(
- rustix::fs::openat(
- &file,
- "Cargo.toml",
- rustix::fs::OFlags::RDONLY,
- rustix::fs::Mode::empty(),
- )
- .unwrap_err(),
- rustix::io::Errno::NOTDIR
- );
-
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- )))]
- rustix::fs::fadvise(&file, 0, 10, rustix::fs::Advice::Normal).unwrap();
-
- assert_eq!(
- rustix::fs::fcntl_getfd(&file).unwrap(),
- rustix::fs::FdFlags::empty()
- );
- assert_eq!(
- rustix::fs::fcntl_getfl(&file).unwrap(),
- rustix::fs::OFlags::empty()
- );
-
- let stat = rustix::fs::fstat(&file).unwrap();
- assert!(stat.st_size > 0);
- assert!(stat.st_blocks > 0);
-
- #[cfg(not(any(
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "redox",
- target_os = "wasi",
- )))]
- // not implemented in libc for netbsd yet
- {
- let statfs = rustix::fs::fstatfs(&file).unwrap();
- assert!(statfs.f_blocks > 0);
- }
-
- #[cfg(feature = "net")]
- assert_eq!(rustix::io::is_read_write(&file).unwrap(), (true, false));
-
- assert_ne!(rustix::io::ioctl_fionread(&file).unwrap(), 0);
-}
diff --git a/vendor/rustix/tests/fs/flock.rs b/vendor/rustix/tests/fs/flock.rs
deleted file mode 100644
index 1b7df6ffd..000000000
--- a/vendor/rustix/tests/fs/flock.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_flock() {
- use rustix::fs::{cwd, flock, openat, FlockOperation, Mode, OFlags};
-
- let f = openat(cwd(), "Cargo.toml", OFlags::RDONLY, Mode::empty()).unwrap();
- flock(&f, FlockOperation::LockExclusive).unwrap();
- flock(&f, FlockOperation::Unlock).unwrap();
- let g = openat(cwd(), "Cargo.toml", OFlags::RDONLY, Mode::empty()).unwrap();
- flock(&g, FlockOperation::LockExclusive).unwrap();
- flock(&g, FlockOperation::Unlock).unwrap();
- drop(f);
- drop(g);
-
- let f = openat(cwd(), "Cargo.toml", OFlags::RDONLY, Mode::empty()).unwrap();
- flock(&f, FlockOperation::LockShared).unwrap();
- let g = openat(cwd(), "Cargo.toml", OFlags::RDONLY, Mode::empty()).unwrap();
- flock(&g, FlockOperation::LockShared).unwrap();
- flock(&f, FlockOperation::Unlock).unwrap();
- flock(&g, FlockOperation::Unlock).unwrap();
- drop(f);
- drop(g);
-
- let f = openat(cwd(), "Cargo.toml", OFlags::RDONLY, Mode::empty()).unwrap();
- flock(&f, FlockOperation::LockShared).unwrap();
- flock(&f, FlockOperation::LockExclusive).unwrap();
- flock(&f, FlockOperation::Unlock).unwrap();
- let g = openat(cwd(), "Cargo.toml", OFlags::RDONLY, Mode::empty()).unwrap();
- flock(&g, FlockOperation::LockShared).unwrap();
- flock(&g, FlockOperation::LockExclusive).unwrap();
- flock(&g, FlockOperation::Unlock).unwrap();
- drop(f);
- drop(g);
-}
diff --git a/vendor/rustix/tests/fs/futimens.rs b/vendor/rustix/tests/fs/futimens.rs
deleted file mode 100644
index 81f8b8a27..000000000
--- a/vendor/rustix/tests/fs/futimens.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_futimens() {
- use rustix::fs::{cwd, fstat, futimens, openat, Mode, OFlags, Timespec, Timestamps};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- let foo = openat(
- &dir,
- "foo",
- OFlags::CREATE | OFlags::WRONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
-
- let times = Timestamps {
- last_access: Timespec {
- tv_sec: 44000,
- tv_nsec: 45000,
- },
- last_modification: Timespec {
- tv_sec: 46000,
- tv_nsec: 47000,
- },
- };
- futimens(&foo, &times).unwrap();
-
- let after = fstat(&foo).unwrap();
-
- assert_eq!(times.last_modification.tv_sec as u64, after.st_mtime as u64);
- #[cfg(not(target_os = "netbsd"))]
- assert_eq!(
- times.last_modification.tv_nsec as u64,
- after.st_mtime_nsec as u64
- );
- #[cfg(target_os = "netbsd")]
- assert_eq!(
- times.last_modification.tv_nsec as u64,
- after.st_mtimensec as u64
- );
-}
diff --git a/vendor/rustix/tests/fs/invalid_offset.rs b/vendor/rustix/tests/fs/invalid_offset.rs
deleted file mode 100644
index 995e302a1..000000000
--- a/vendor/rustix/tests/fs/invalid_offset.rs
+++ /dev/null
@@ -1,182 +0,0 @@
-//! Tests for extreme `u64` file offsets.
-//!
-//! POSIX-ish interfaces tend to use signed integers for file offsets, while
-//! Rust APIs tend to use `u64`. Test that extreme `u64` values in APIs that
-//! take file offsets are properly diagnosed.
-//!
-//! These tests are disabled on ios/macos since those platforms kill the
-//! process with `SIGXFSZ` instead of returning an error.
-
-#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
-
-use rustix::io::SeekFrom;
-
-#[test]
-fn invalid_offset_seek() {
- use rustix::fs::{cwd, openat, seek, Mode, OFlags};
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let file = openat(
- &dir,
- "foo",
- OFlags::WRONLY | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- seek(&file, SeekFrom::Start(u64::MAX)).unwrap_err();
- seek(&file, SeekFrom::Start(i64::MAX as u64 + 1)).unwrap_err();
- seek(&file, SeekFrom::End(-1)).unwrap_err();
- seek(&file, SeekFrom::End(i64::MIN)).unwrap_err();
- seek(&file, SeekFrom::Current(-1)).unwrap_err();
- seek(&file, SeekFrom::Current(i64::MIN)).unwrap_err();
-}
-
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
-)))]
-#[test]
-fn invalid_offset_fallocate() {
- use rustix::fs::{cwd, fallocate, openat, FallocateFlags, Mode, OFlags};
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let file = openat(
- &dir,
- "foo",
- OFlags::WRONLY | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- fallocate(&file, FallocateFlags::empty(), u64::MAX, 1).unwrap_err();
- fallocate(&file, FallocateFlags::empty(), i64::MAX as u64 + 1, 1).unwrap_err();
- fallocate(&file, FallocateFlags::empty(), 0, u64::MAX).unwrap_err();
- fallocate(&file, FallocateFlags::empty(), 0, i64::MAX as u64 + 1).unwrap_err();
-}
-
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
-)))]
-#[test]
-fn invalid_offset_fadvise() {
- use rustix::fs::{cwd, fadvise, openat, Advice, Mode, OFlags};
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let file = openat(
- &dir,
- "foo",
- OFlags::WRONLY | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- // `fadvise` never fails on invalid offsets.
- fadvise(&file, i64::MAX as u64, i64::MAX as u64, Advice::Normal).unwrap();
- fadvise(&file, u64::MAX, 0, Advice::Normal).unwrap();
- fadvise(&file, i64::MAX as u64, 1, Advice::Normal).unwrap();
- fadvise(&file, 1, i64::MAX as u64, Advice::Normal).unwrap();
- fadvise(&file, i64::MAX as u64 + 1, 0, Advice::Normal).unwrap();
- fadvise(&file, u64::MAX, i64::MAX as u64, Advice::Normal).unwrap();
-
- // `fadvise` fails on invalid lengths.
- fadvise(&file, u64::MAX, u64::MAX, Advice::Normal).unwrap_err();
- fadvise(&file, i64::MAX as u64, u64::MAX, Advice::Normal).unwrap_err();
- fadvise(&file, 0, u64::MAX, Advice::Normal).unwrap_err();
- fadvise(&file, u64::MAX, i64::MAX as u64 + 1, Advice::Normal).unwrap_err();
- fadvise(&file, i64::MAX as u64 + 1, u64::MAX, Advice::Normal).unwrap_err();
- fadvise(&file, i64::MAX as u64, i64::MAX as u64 + 1, Advice::Normal).unwrap_err();
- fadvise(&file, 0, i64::MAX as u64 + 1, Advice::Normal).unwrap_err();
-}
-
-#[test]
-fn invalid_offset_pread() {
- use rustix::fs::{cwd, openat, Mode, OFlags};
- use rustix::io::pread;
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let file = openat(
- &dir,
- "foo",
- OFlags::RDWR | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- let mut buf = [0_u8; 1];
- pread(&file, &mut buf, u64::MAX).unwrap_err();
- pread(&file, &mut buf, i64::MAX as u64 + 1).unwrap_err();
-}
-
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-#[test]
-fn invalid_offset_pwrite() {
- use rustix::fs::{cwd, openat, Mode, OFlags};
- use rustix::io::pwrite;
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let file = openat(
- &dir,
- "foo",
- OFlags::WRONLY | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- let buf = [0_u8; 1];
- pwrite(&file, &buf, u64::MAX).unwrap_err();
- pwrite(&file, &buf, i64::MAX as u64 + 1).unwrap_err();
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn invalid_offset_copy_file_range() {
- use rustix::fs::{copy_file_range, cwd, openat, Mode, OFlags};
- use rustix::io::write;
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let foo = openat(
- &dir,
- "foo",
- OFlags::RDWR | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
- let bar = openat(
- &dir,
- "bar",
- OFlags::WRONLY | OFlags::TRUNC | OFlags::CREATE,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
- write(&foo, b"a").unwrap();
-
- let mut off_in = u64::MAX;
- let mut off_out = 0;
- copy_file_range(&foo, Some(&mut off_in), &bar, Some(&mut off_out), 1).unwrap_err();
-
- let mut off_in = i64::MAX as u64 + 1;
- let mut off_out = 0;
- copy_file_range(&foo, Some(&mut off_in), &bar, Some(&mut off_out), 1).unwrap_err();
-
- let mut off_in = 0;
- let mut off_out = u64::MAX;
- copy_file_range(&foo, Some(&mut off_in), &bar, Some(&mut off_out), 1).unwrap_err();
-
- let mut off_in = 0;
- let mut off_out = i64::MAX as u64;
- copy_file_range(&foo, Some(&mut off_in), &bar, Some(&mut off_out), 1).unwrap_err();
-
- let mut off_in = 0;
- let mut off_out = i64::MAX as u64 + 1;
- copy_file_range(&foo, Some(&mut off_in), &bar, Some(&mut off_out), 1).unwrap_err();
-}
diff --git a/vendor/rustix/tests/fs/long_paths.rs b/vendor/rustix/tests/fs/long_paths.rs
deleted file mode 100644
index dbc2fa6ea..000000000
--- a/vendor/rustix/tests/fs/long_paths.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_long_paths() {
- use rustix::fs::{cwd, mkdirat, openat, Mode, OFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- #[cfg(libc)]
- const PATH_MAX: usize = libc::PATH_MAX as usize;
- #[cfg(linux_raw)]
- const PATH_MAX: usize = linux_raw_sys::general::PATH_MAX as usize;
-
- mkdirat(&dir, "a", Mode::RUSR | Mode::XUSR | Mode::WUSR).unwrap();
-
- let mut long_path = String::new();
- for _ in 0..PATH_MAX / 5 {
- long_path.push_str("a/../");
- }
-
- let mut too_long_path = String::new();
- for _ in 0..PATH_MAX / 4 {
- too_long_path.push_str("a/../");
- }
-
- let _ = openat(&dir, &long_path, OFlags::RDONLY, Mode::empty()).unwrap();
- let _ = openat(&dir, &too_long_path, OFlags::RDONLY, Mode::empty()).unwrap_err();
-}
diff --git a/vendor/rustix/tests/fs/main.rs b/vendor/rustix/tests/fs/main.rs
deleted file mode 100644
index 23928a6ba..000000000
--- a/vendor/rustix/tests/fs/main.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-//! Tests for [`rustix::fs`].
-
-#![cfg(feature = "fs")]
-#![cfg(not(windows))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg_attr(core_c_str, feature(core_c_str))]
-
-mod cwd;
-mod dir;
-mod fcntl;
-mod file;
-#[cfg(not(target_os = "wasi"))]
-mod flock;
-mod futimens;
-mod invalid_offset;
-mod long_paths;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-mod makedev;
-mod mkdirat;
-mod mknodat;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-mod openat;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-mod openat2;
-mod readdir;
-mod renameat;
-#[cfg(not(any(
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-// not implemented in libc for netbsd yet
-mod statfs;
-mod utimensat;
-mod y2038;
diff --git a/vendor/rustix/tests/fs/makedev.rs b/vendor/rustix/tests/fs/makedev.rs
deleted file mode 100644
index 79b5199e8..000000000
--- a/vendor/rustix/tests/fs/makedev.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-use rustix::fs::{major, makedev, minor};
-
-#[test]
-fn makedev_roundtrip() {
- let maj = 0x2324_2526;
- let min = 0x6564_6361;
- let dev = makedev(maj, min);
- assert_eq!(maj, major(dev));
- assert_eq!(min, minor(dev));
-}
diff --git a/vendor/rustix/tests/fs/mkdirat.rs b/vendor/rustix/tests/fs/mkdirat.rs
deleted file mode 100644
index 884588037..000000000
--- a/vendor/rustix/tests/fs/mkdirat.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_mkdirat() {
- use rustix::fs::{cwd, mkdirat, openat, statat, unlinkat, AtFlags, FileType, Mode, OFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- mkdirat(&dir, "foo", Mode::RWXU).unwrap();
- let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
- assert_eq!(FileType::from_raw_mode(stat.st_mode), FileType::Directory);
- unlinkat(&dir, "foo", AtFlags::REMOVEDIR).unwrap();
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_mkdirat_with_o_path() {
- use rustix::fs::{cwd, mkdirat, openat, statat, unlinkat, AtFlags, FileType, Mode, OFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::PATH,
- Mode::empty(),
- )
- .unwrap();
-
- mkdirat(&dir, "foo", Mode::RWXU).unwrap();
- let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
- assert_eq!(FileType::from_raw_mode(stat.st_mode), FileType::Directory);
- unlinkat(&dir, "foo", AtFlags::REMOVEDIR).unwrap();
-}
diff --git a/vendor/rustix/tests/fs/mknodat.rs b/vendor/rustix/tests/fs/mknodat.rs
deleted file mode 100644
index fa1c84f69..000000000
--- a/vendor/rustix/tests/fs/mknodat.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
-#[test]
-fn test_mknodat() {
- use rustix::fs::{cwd, mknodat, openat, statat, unlinkat, AtFlags, FileType, Mode, OFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- // Create a regular file. Not supported on FreeBSD or OpenBSD.
- #[cfg(not(any(target_os = "freebsd", target_os = "openbsd")))]
- {
- mknodat(&dir, "foo", FileType::RegularFile, Mode::empty(), 0).unwrap();
- let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
- assert_eq!(FileType::from_raw_mode(stat.st_mode), FileType::RegularFile);
- unlinkat(&dir, "foo", AtFlags::empty()).unwrap();
- }
-
- mknodat(&dir, "foo", FileType::Fifo, Mode::empty(), 0).unwrap();
- let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
- assert_eq!(FileType::from_raw_mode(stat.st_mode), FileType::Fifo);
- unlinkat(&dir, "foo", AtFlags::empty()).unwrap();
-}
diff --git a/vendor/rustix/tests/fs/openat.rs b/vendor/rustix/tests/fs/openat.rs
deleted file mode 100644
index 564574dc1..000000000
--- a/vendor/rustix/tests/fs/openat.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-use std::fs::File;
-
-use io_lifetimes::{FromFd, IntoFd};
-use rustix::fs::{cwd, openat, Mode, OFlags};
-use std::io::Write;
-
-#[test]
-fn test_openat_tmpfile() {
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
- let f = match openat(
- &dir,
- ".",
- OFlags::WRONLY | OFlags::CLOEXEC | OFlags::TMPFILE,
- Mode::from_bits_truncate(0o644),
- ) {
- Ok(f) => Ok(Some(File::from_fd(f.into_fd()))),
- // TODO: Factor out the `Err`, once we no longer support Rust 1.48.
- Err(rustix::io::Errno::OPNOTSUPP)
- | Err(rustix::io::Errno::ISDIR)
- | Err(rustix::io::Errno::NOENT) => Ok(None),
- Err(e) => Err(e),
- };
- if let Some(mut f) = f.unwrap() {
- write!(f, "hello world").unwrap();
- }
-}
diff --git a/vendor/rustix/tests/fs/openat2.rs b/vendor/rustix/tests/fs/openat2.rs
deleted file mode 100644
index 0b1d86fe2..000000000
--- a/vendor/rustix/tests/fs/openat2.rs
+++ /dev/null
@@ -1,184 +0,0 @@
-use rustix::fd::AsFd;
-use rustix::fs::{cwd, mkdirat, openat, openat2, symlinkat, Mode, OFlags, ResolveFlags};
-use rustix::io::OwnedFd;
-use rustix::{io, path};
-use std::os::unix::io::AsRawFd;
-
-/// Like `openat2`, but keep retrying until it fails or succeeds.
-fn openat2_more<Fd: AsFd, P: path::Arg>(
- dirfd: Fd,
- path: P,
- oflags: OFlags,
- mode: Mode,
- resolve: ResolveFlags,
-) -> io::Result<OwnedFd> {
- let path = path.as_cow_c_str().unwrap().into_owned();
- loop {
- match openat2(dirfd.as_fd(), &path, oflags, mode, resolve) {
- Ok(file) => return Ok(file),
- Err(io::Errno::AGAIN) => continue,
- Err(err) => return Err(err),
- }
- }
-}
-
-#[test]
-fn test_openat2() {
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- // Detect whether `openat2` is available.
- match openat2(
- &dir,
- ".",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- ) {
- Ok(_file) => (),
- Err(io::Errno::NOSYS) => return,
- Err(_err) => return,
- }
-
- // Create a file.
- let _ = openat2_more(
- &dir,
- "test.txt",
- OFlags::WRONLY | OFlags::CREATE | OFlags::TRUNC | OFlags::CLOEXEC,
- Mode::RUSR,
- ResolveFlags::empty(),
- )
- .unwrap();
-
- // Test `NO_SYMLINKS`.
- symlinkat("test.txt", &dir, "symlink.txt").unwrap();
- let _ = openat2_more(
- &dir,
- "symlink.txt",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &dir,
- "symlink.txt",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::NO_MAGICLINKS,
- )
- .unwrap();
- let _ = openat2_more(
- &dir,
- "symlink.txt",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::NO_SYMLINKS,
- )
- .unwrap_err();
-
- // Test `NO_MAGICLINKS`.
- let test = openat2_more(
- &dir,
- "test.txt",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &dir,
- &format!("/proc/self/fd/{}", test.as_fd().as_raw_fd()),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &dir,
- &format!("/proc/self/fd/{}", test.as_fd().as_raw_fd()),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::NO_SYMLINKS,
- )
- .unwrap_err();
- let _ = openat2_more(
- &dir,
- &format!("/proc/self/fd/{}", test.as_fd().as_raw_fd()),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::NO_MAGICLINKS,
- )
- .unwrap_err();
-
- // Test `NO_XDEV`.
- let root = openat2_more(
- &dir,
- "/",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &root,
- "proc",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &root,
- "proc",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::NO_XDEV,
- )
- .unwrap_err();
-
- // Test `BENEATH`.
- let _ = openat2_more(
- &dir,
- "..",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &dir,
- "..",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::BENEATH,
- )
- .unwrap_err();
-
- // Test `IN_ROOT`.
- let _ = openat2_more(
- &dir,
- "/proc",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::empty(),
- )
- .unwrap();
- let _ = openat2_more(
- &dir,
- "/proc",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::IN_ROOT,
- )
- .unwrap_err();
- mkdirat(&dir, "proc", Mode::RUSR | Mode::XUSR).unwrap();
- let _ = openat2_more(
- &dir,
- "/proc",
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- ResolveFlags::IN_ROOT,
- )
- .unwrap();
-}
diff --git a/vendor/rustix/tests/fs/readdir.rs b/vendor/rustix/tests/fs/readdir.rs
deleted file mode 100644
index 8925660a9..000000000
--- a/vendor/rustix/tests/fs/readdir.rs
+++ /dev/null
@@ -1,68 +0,0 @@
-#![cfg(not(target_os = "redox"))]
-
-use rustix::fs::{Dir, DirEntry};
-use std::collections::HashMap;
-
-#[test]
-fn dir_entries() {
- let tmpdir = tempfile::tempdir().expect("construct tempdir");
- let dirfd = std::fs::File::open(tmpdir.path()).expect("open tempdir as file");
- let mut dir = Dir::read_from(dirfd).expect("construct Dir from dirfd");
-
- let entries = read_entries(&mut dir);
- assert_eq!(entries.len(), 0, "no files in directory");
-
- let _f1 = std::fs::File::create(tmpdir.path().join("file1")).expect("create file1");
-
- let entries = read_entries(&mut dir);
- assert!(
- entries.get("file1").is_some(),
- "directory contains `file1`: {:?}",
- entries
- );
- assert_eq!(entries.len(), 1);
-
- let _f2 = std::fs::File::create(tmpdir.path().join("file2")).expect("create file1");
- let entries = read_entries(&mut dir);
- assert!(
- entries.get("file1").is_some(),
- "directory contains `file1`: {:?}",
- entries
- );
- assert!(
- entries.get("file2").is_some(),
- "directory contains `file2`: {:?}",
- entries
- );
- assert_eq!(entries.len(), 2);
-}
-
-fn read_entries(dir: &mut Dir) -> HashMap<String, DirEntry> {
- dir.rewind();
- let mut out = HashMap::new();
- loop {
- match dir.read() {
- Some(e) => {
- let e = e.expect("non-error entry");
- let name = e.file_name().to_str().expect("utf8 filename").to_owned();
- if name != "." && name != ".." {
- out.insert(name, e);
- }
- }
- None => break,
- }
- }
- out
-}
-
-#[test]
-fn dir_from_openat() {
- let dirfd = rustix::fs::openat(
- rustix::fs::cwd(),
- ".",
- rustix::fs::OFlags::RDONLY,
- rustix::fs::Mode::empty(),
- )
- .expect("open cwd as file");
- let _dir = Dir::read_from(dirfd).expect("construct Dir from dirfd");
-}
diff --git a/vendor/rustix/tests/fs/renameat.rs b/vendor/rustix/tests/fs/renameat.rs
deleted file mode 100644
index 2eea2e77a..000000000
--- a/vendor/rustix/tests/fs/renameat.rs
+++ /dev/null
@@ -1,104 +0,0 @@
-#[cfg(any(target_os = "android", target_os = "linux"))]
-use rustix::fs::Stat;
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-fn same(a: &Stat, b: &Stat) -> bool {
- a.st_ino == b.st_ino && a.st_dev == b.st_dev
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_renameat() {
- use rustix::fs::{cwd, openat, renameat, statat, AtFlags, Mode, OFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::PATH,
- Mode::empty(),
- )
- .unwrap();
-
- let _ = openat(&dir, "foo", OFlags::CREATE | OFlags::WRONLY, Mode::empty()).unwrap();
- let before = statat(&dir, "foo", AtFlags::empty()).unwrap();
- renameat(&dir, "foo", &dir, "bar").unwrap();
- let renamed = statat(&dir, "bar", AtFlags::empty()).unwrap();
- assert!(same(&before, &renamed));
-}
-
-/// Like `test_renameat` but the file already exists, so `renameat`
-/// overwrites it.
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_renameat_overwrite() {
- use rustix::fs::{cwd, openat, renameat, statat, AtFlags, Mode, OFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::PATH,
- Mode::empty(),
- )
- .unwrap();
-
- let _ = openat(&dir, "foo", OFlags::CREATE | OFlags::WRONLY, Mode::empty()).unwrap();
- let _ = openat(&dir, "bar", OFlags::CREATE | OFlags::WRONLY, Mode::empty()).unwrap();
- let before = statat(&dir, "foo", AtFlags::empty()).unwrap();
- renameat(&dir, "foo", &dir, "bar").unwrap();
- let renamed = statat(&dir, "bar", AtFlags::empty()).unwrap();
- assert!(same(&before, &renamed));
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_renameat_with() {
- use rustix::fs::{cwd, openat, renameat_with, statat, AtFlags, Mode, OFlags, RenameFlags};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::PATH,
- Mode::empty(),
- )
- .unwrap();
-
- let _ = openat(&dir, "foo", OFlags::CREATE | OFlags::WRONLY, Mode::empty()).unwrap();
- let before = statat(&dir, "foo", AtFlags::empty()).unwrap();
-
- match renameat_with(&dir, "foo", &dir, "red", RenameFlags::empty()) {
- Ok(()) => (),
- Err(e) if e == rustix::io::Errno::NOSYS => return,
- Err(e) => unreachable!("unexpected error from renameat_with: {:?}", e),
- }
-
- let renamed = statat(&dir, "red", AtFlags::empty()).unwrap();
- assert!(same(&before, &renamed));
-
- let _ = openat(
- &dir,
- "green",
- OFlags::CREATE | OFlags::WRONLY,
- Mode::empty(),
- )
- .unwrap();
-
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
- {
- let green = statat(&dir, "green", AtFlags::empty()).unwrap();
-
- renameat_with(&dir, "red", &dir, "green", RenameFlags::NOREPLACE).unwrap_err();
- let renamed = statat(&dir, "red", AtFlags::empty()).unwrap();
- assert!(same(&before, &renamed));
- let orig = statat(&dir, "green", AtFlags::empty()).unwrap();
- assert!(same(&green, &orig));
-
- renameat_with(&dir, "red", &dir, "green", RenameFlags::EXCHANGE).unwrap();
- let renamed = statat(&dir, "red", AtFlags::empty()).unwrap();
- assert!(same(&green, &renamed));
- let orig = statat(&dir, "green", AtFlags::empty()).unwrap();
- assert!(same(&before, &orig));
- }
-}
diff --git a/vendor/rustix/tests/fs/statfs.rs b/vendor/rustix/tests/fs/statfs.rs
deleted file mode 100644
index f8bf2e350..000000000
--- a/vendor/rustix/tests/fs/statfs.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_statfs_abi() {
- use rustix::fs::{FsWord, StatFs, NFS_SUPER_MAGIC, PROC_SUPER_MAGIC};
-
- // Ensure these all have consistent types.
- let t: StatFs = unsafe { std::mem::zeroed() };
- let _s: FsWord = t.f_type;
- let _u: FsWord = PROC_SUPER_MAGIC;
- let _v: FsWord = NFS_SUPER_MAGIC;
-
- // Ensure that after all the platform-specific dancing we have to do, this
- // constant comes out with the correct value.
- #[cfg(all(libc, not(target_env = "musl")))]
- {
- assert_eq!(
- i128::from(PROC_SUPER_MAGIC),
- i128::from(libc::PROC_SUPER_MAGIC)
- );
- assert_eq!(
- i128::from(NFS_SUPER_MAGIC),
- i128::from(libc::NFS_SUPER_MAGIC)
- );
- }
-
- #[cfg(linux_raw)]
- {
- assert_eq!(
- i128::from(PROC_SUPER_MAGIC),
- i128::from(linux_raw_sys::general::PROC_SUPER_MAGIC)
- );
- assert_eq!(
- i128::from(NFS_SUPER_MAGIC),
- i128::from(linux_raw_sys::general::NFS_SUPER_MAGIC)
- );
- }
-
- assert_eq!(PROC_SUPER_MAGIC, 0x0000_9fa0);
- assert_eq!(NFS_SUPER_MAGIC, 0x0000_6969);
-}
-
-#[test]
-fn test_statfs() {
- let statfs = rustix::fs::statfs("Cargo.toml").unwrap();
- let f_blocks = statfs.f_blocks;
- assert_ne!(f_blocks, 0);
- // Previously we checked f_files != 0 here, but at least btrfs doesn't set
- // that.
-}
diff --git a/vendor/rustix/tests/fs/utimensat.rs b/vendor/rustix/tests/fs/utimensat.rs
deleted file mode 100644
index f0fb7e27b..000000000
--- a/vendor/rustix/tests/fs/utimensat.rs
+++ /dev/null
@@ -1,127 +0,0 @@
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_utimensat() {
- use rustix::fs::{cwd, openat, statat, utimensat, AtFlags, Mode, OFlags, Timespec, Timestamps};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
-
- let _ = openat(
- &dir,
- "foo",
- OFlags::CREATE | OFlags::WRONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
-
- let times = Timestamps {
- last_access: Timespec {
- tv_sec: 44000,
- tv_nsec: 45000,
- },
- last_modification: Timespec {
- tv_sec: 46000,
- tv_nsec: 47000,
- },
- };
- utimensat(&dir, "foo", &times, AtFlags::empty()).unwrap();
-
- let after = statat(&dir, "foo", AtFlags::empty()).unwrap();
-
- assert_eq!(times.last_modification.tv_sec as u64, after.st_mtime as u64);
- #[cfg(not(target_os = "netbsd"))]
- assert_eq!(
- times.last_modification.tv_nsec as u64,
- after.st_mtime_nsec as u64
- );
- #[cfg(target_os = "netbsd")]
- assert_eq!(
- times.last_modification.tv_nsec as u64,
- after.st_mtimensec as u64
- );
- assert!(times.last_access.tv_sec as u64 >= after.st_atime as u64);
- #[cfg(not(target_os = "netbsd"))]
- assert!(
- times.last_access.tv_sec as u64 > after.st_atime as u64
- || times.last_access.tv_nsec as u64 >= after.st_atime_nsec as u64
- );
- #[cfg(target_os = "netbsd")]
- assert!(
- times.last_access.tv_sec as u64 > after.st_atime as u64
- || times.last_access.tv_nsec as u64 >= after.st_atimensec as u64
- );
-}
-
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_utimensat_noent() {
- use rustix::fs::{cwd, openat, utimensat, AtFlags, Mode, OFlags, Timespec, Timestamps};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
-
- let times = Timestamps {
- last_access: Timespec {
- tv_sec: 44000,
- tv_nsec: 45000,
- },
- last_modification: Timespec {
- tv_sec: 46000,
- tv_nsec: 47000,
- },
- };
- assert_eq!(
- utimensat(&dir, "foo", &times, AtFlags::empty()).unwrap_err(),
- rustix::io::Errno::NOENT
- );
-}
-
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#[test]
-fn test_utimensat_notdir() {
- use rustix::fs::{cwd, openat, utimensat, AtFlags, Mode, OFlags, Timespec, Timestamps};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(
- cwd(),
- tmp.path(),
- OFlags::RDONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
-
- let foo = openat(
- &dir,
- "foo",
- OFlags::CREATE | OFlags::WRONLY | OFlags::CLOEXEC,
- Mode::empty(),
- )
- .unwrap();
-
- let times = Timestamps {
- last_access: Timespec {
- tv_sec: 44000,
- tv_nsec: 45000,
- },
- last_modification: Timespec {
- tv_sec: 46000,
- tv_nsec: 47000,
- },
- };
- assert_eq!(
- utimensat(&foo, "bar", &times, AtFlags::empty()).unwrap_err(),
- rustix::io::Errno::NOTDIR
- );
-}
diff --git a/vendor/rustix/tests/fs/y2038.rs b/vendor/rustix/tests/fs/y2038.rs
deleted file mode 100644
index 4299d709b..000000000
--- a/vendor/rustix/tests/fs/y2038.rs
+++ /dev/null
@@ -1,146 +0,0 @@
-/// Test that we can set a file timestamp to a date past the year 2038 with
-/// `utimensat` and read it back again.
-///
-/// See tests/time/y2038.rs for more information about y2038 testing.
-#[cfg(not(all(target_env = "musl", target_pointer_width = "32")))]
-#[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
-#[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))]
-#[test]
-fn test_y2038_with_utimensat() {
- use rustix::fs::{
- cwd, fstat, openat, statat, utimensat, AtFlags, Mode, OFlags, Timespec, Timestamps,
- };
- use std::convert::TryInto;
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(&cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- let m_sec = 1_u64 << 32;
- let m_nsec = 17_u32;
- let a_sec = m_sec + 1;
- let a_nsec = m_nsec + 1;
-
- let timestamps = Timestamps {
- last_modification: Timespec {
- tv_sec: m_sec as _,
- tv_nsec: m_nsec as _,
- },
- last_access: Timespec {
- tv_sec: a_sec as _,
- tv_nsec: a_nsec as _,
- },
- };
- let _ = openat(&dir, "foo", OFlags::CREATE | OFlags::WRONLY, Mode::RUSR).unwrap();
-
- match utimensat(&dir, "foo", &timestamps, AtFlags::empty()) {
- Ok(()) => (),
-
- // On 32-bit platforms, accept `EOVERFLOW`, meaning that y2038 support
- // is not available in this version of the OS.
- #[cfg(target_pointer_width = "32")]
- Err(rustix::io::Errno::OVERFLOW) => return,
-
- Err(e) => panic!("unexpected error: {:?}", e),
- }
-
- // Use `statat` to read back the timestamp.
- let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
-
- assert_eq!(
- TryInto::<u64>::try_into(stat.st_mtime).unwrap() as u64,
- m_sec
- );
- assert_eq!(stat.st_mtime_nsec as u32, m_nsec);
- assert!(TryInto::<u64>::try_into(stat.st_atime).unwrap() as u64 >= a_sec);
- assert!(
- TryInto::<u64>::try_into(stat.st_atime).unwrap() as u64 > a_sec
- || stat.st_atime_nsec as u32 >= a_nsec
- );
-
- // Now test the same thing, but with `fstat`.
- let file = openat(&dir, "foo", OFlags::RDONLY, Mode::empty()).unwrap();
- let stat = fstat(&file).unwrap();
-
- assert_eq!(
- TryInto::<u64>::try_into(stat.st_mtime).unwrap() as u64,
- m_sec
- );
- assert_eq!(stat.st_mtime_nsec as u32, m_nsec);
- assert!(TryInto::<u64>::try_into(stat.st_atime).unwrap() as u64 >= a_sec);
- assert!(
- TryInto::<u64>::try_into(stat.st_atime).unwrap() as u64 > a_sec
- || stat.st_atime_nsec as u32 >= a_nsec
- );
-}
-
-/// Test that we can set a file timestamp to a date past the year 2038 with
-/// `futimens` and read it back again.
-///
-/// See tests/time/y2038.rs for more information about y2038 testing.
-#[cfg(not(all(target_env = "musl", target_pointer_width = "32")))]
-#[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
-#[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))]
-#[test]
-fn test_y2038_with_futimens() {
- use rustix::fs::{
- cwd, fstat, futimens, openat, statat, AtFlags, Mode, OFlags, Timespec, Timestamps,
- };
- use std::convert::TryInto;
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(&cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- let m_sec = 1_u64 << 32;
- let m_nsec = 17_u32;
- let a_sec = m_sec + 1;
- let a_nsec = m_nsec + 1;
-
- let timestamps = Timestamps {
- last_modification: Timespec {
- tv_sec: m_sec as _,
- tv_nsec: m_nsec as _,
- },
- last_access: Timespec {
- tv_sec: a_sec as _,
- tv_nsec: a_nsec as _,
- },
- };
- let file = openat(&dir, "foo", OFlags::CREATE | OFlags::WRONLY, Mode::RUSR).unwrap();
-
- match futimens(&file, &timestamps) {
- Ok(()) => (),
-
- // On 32-bit platforms, accept `EOVERFLOW`, meaning that y2038 support
- // is not available in this version of the OS.
- #[cfg(target_pointer_width = "32")]
- Err(rustix::io::Errno::OVERFLOW) => return,
-
- Err(e) => panic!("unexpected error: {:?}", e),
- }
-
- // Use `statat` to read back the timestamp.
- let stat = statat(&dir, "foo", AtFlags::empty()).unwrap();
-
- assert_eq!(TryInto::<u64>::try_into(stat.st_mtime).unwrap(), m_sec);
- assert_eq!(stat.st_mtime_nsec as u32, m_nsec);
- assert!(TryInto::<u64>::try_into(stat.st_atime).unwrap() >= a_sec);
- assert!(
- TryInto::<u64>::try_into(stat.st_atime).unwrap() > a_sec
- || stat.st_atime_nsec as u32 >= a_nsec
- );
-
- // Now test the same thing, but with `fstat`.
- let file = openat(&dir, "foo", OFlags::RDONLY, Mode::empty()).unwrap();
- let stat = fstat(&file).unwrap();
-
- assert_eq!(
- TryInto::<u64>::try_into(stat.st_mtime).unwrap() as u64,
- m_sec
- );
- assert_eq!(stat.st_mtime_nsec as u32, m_nsec);
- assert!(TryInto::<u64>::try_into(stat.st_atime).unwrap() as u64 >= a_sec);
- assert!(
- TryInto::<u64>::try_into(stat.st_atime).unwrap() as u64 > a_sec
- || stat.st_atime_nsec as u32 >= a_nsec
- );
-}
diff --git a/vendor/rustix/tests/io/dup2_to_replace_stdio.rs b/vendor/rustix/tests/io/dup2_to_replace_stdio.rs
deleted file mode 100644
index b07ec17f0..000000000
--- a/vendor/rustix/tests/io/dup2_to_replace_stdio.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-#![cfg(not(target_os = "wasi"))]
-
-use std::env;
-use std::process::Command;
-
-/// Use `dup2` to replace the stdin and stdout file descriptors.
-#[test]
-fn dup2_to_replace_stdio() {
- // This test modifies the stdio file descriptors, so we run it in a
- // separate process so that it doesn't interfere with the test harness.
- assert!(Command::new(env::var("CARGO").unwrap())
- .arg("run")
- .arg("--example")
- .arg("dup2_to_replace_stdio")
- .status()
- .unwrap()
- .success());
-}
diff --git a/vendor/rustix/tests/io/epoll.rs b/vendor/rustix/tests/io/epoll.rs
deleted file mode 100644
index 4cfe305fe..000000000
--- a/vendor/rustix/tests/io/epoll.rs
+++ /dev/null
@@ -1,103 +0,0 @@
-#![cfg(any(target_os = "android", target_os = "linux"))]
-
-use rustix::fd::AsFd;
-use rustix::io::epoll::{self, Epoll};
-use rustix::io::{ioctl_fionbio, read, write, OwnedFd};
-use rustix::net::{
- accept, bind_v4, connect_v4, getsockname, listen, socket, AddressFamily, Ipv4Addr, Protocol,
- SocketAddrAny, SocketAddrV4, SocketType,
-};
-use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
-use std::sync::{Arc, Condvar, Mutex};
-use std::thread;
-
-const BUFFER_SIZE: usize = 20;
-
-fn server(ready: Arc<(Mutex<u16>, Condvar)>) {
- let listen_sock = socket(AddressFamily::INET, SocketType::STREAM, Protocol::default()).unwrap();
- bind_v4(&listen_sock, &SocketAddrV4::new(Ipv4Addr::LOCALHOST, 0)).unwrap();
- listen(&listen_sock, 1).unwrap();
-
- let who = match getsockname(&listen_sock).unwrap() {
- SocketAddrAny::V4(addr) => addr,
- _ => panic!(),
- };
-
- {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- *port = who.port();
- cvar.notify_all();
- }
-
- let epoll = Epoll::new(epoll::CreateFlags::CLOEXEC, epoll::Owning::<OwnedFd>::new()).unwrap();
-
- // Test into conversions.
- let fd: OwnedFd = epoll.into();
- let epoll: Epoll<epoll::Owning<OwnedFd>> = fd.into();
- let fd: RawFd = epoll.into_raw_fd();
- let epoll = unsafe { Epoll::<epoll::Owning<OwnedFd>>::from_raw_fd(fd) };
-
- let raw_listen_sock = listen_sock.as_fd().as_raw_fd();
- epoll.add(listen_sock, epoll::EventFlags::IN).unwrap();
-
- let mut event_list = epoll::EventVec::with_capacity(4);
- loop {
- epoll.wait(&mut event_list, -1).unwrap();
- for (_event_flags, target) in &event_list {
- if target.as_raw_fd() == raw_listen_sock {
- let conn_sock = accept(&*target).unwrap();
- ioctl_fionbio(&conn_sock, true).unwrap();
- epoll
- .add(conn_sock, epoll::EventFlags::OUT | epoll::EventFlags::ET)
- .unwrap();
- } else {
- write(&*target, b"hello\n").unwrap();
- let _ = epoll.del(target).unwrap();
- }
- }
- }
-}
-
-fn client(ready: Arc<(Mutex<u16>, Condvar)>) {
- let port = {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- while *port == 0 {
- port = cvar.wait(port).unwrap();
- }
- *port
- };
-
- let addr = SocketAddrV4::new(Ipv4Addr::LOCALHOST, port);
- let mut buffer = vec![0; BUFFER_SIZE];
-
- for _ in 0..16 {
- let data_socket =
- socket(AddressFamily::INET, SocketType::STREAM, Protocol::default()).unwrap();
- connect_v4(&data_socket, &addr).unwrap();
-
- let nread = read(&data_socket, &mut buffer).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "hello\n");
- }
-}
-
-#[test]
-fn test_epoll() {
- let ready = Arc::new((Mutex::new(0_u16), Condvar::new()));
- let ready_clone = Arc::clone(&ready);
-
- let _server = thread::Builder::new()
- .name("server".to_string())
- .spawn(move || {
- server(ready);
- })
- .unwrap();
- let client = thread::Builder::new()
- .name("client".to_string())
- .spawn(move || {
- client(ready_clone);
- })
- .unwrap();
- client.join().unwrap();
-}
diff --git a/vendor/rustix/tests/io/error.rs b/vendor/rustix/tests/io/error.rs
deleted file mode 100644
index 128d3b59a..000000000
--- a/vendor/rustix/tests/io/error.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#[test]
-fn test_error() {
- assert_eq!(
- rustix::io::Errno::INVAL,
- rustix::io::Errno::from_raw_os_error(rustix::io::Errno::INVAL.raw_os_error())
- );
- #[cfg(not(windows))]
- assert_eq!(rustix::io::Errno::INVAL.raw_os_error(), libc::EINVAL);
- #[cfg(windows)]
- assert_eq!(
- rustix::io::Errno::INVAL.raw_os_error(),
- windows_sys::Win32::Networking::WinSock::WSAEINVAL
- );
-}
diff --git a/vendor/rustix/tests/io/eventfd.rs b/vendor/rustix/tests/io/eventfd.rs
deleted file mode 100644
index 11bc8ae55..000000000
--- a/vendor/rustix/tests/io/eventfd.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_eventfd() {
- use rustix::io::{eventfd, read, write, EventfdFlags};
- use std::mem::size_of;
- use std::thread;
-
- let efd = eventfd(0, EventfdFlags::CLOEXEC).unwrap();
-
- let child = thread::spawn(move || {
- for u in [1_u64, 3, 6, 11, 5000].iter() {
- assert_eq!(write(&efd, &u.to_ne_bytes()).unwrap(), size_of::<u64>());
- }
- efd
- });
-
- let efd = child.join().unwrap();
-
- let mut bytes = [0_u8; size_of::<u64>()];
- let s = read(&efd, &mut bytes).unwrap();
- assert_eq!(s, bytes.len());
- let u = u64::from_ne_bytes(bytes);
- assert_eq!(u, 5021);
-}
diff --git a/vendor/rustix/tests/io/from_into.rs b/vendor/rustix/tests/io/from_into.rs
deleted file mode 100644
index 94d915993..000000000
--- a/vendor/rustix/tests/io/from_into.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-#[cfg(feature = "fs")]
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_owned() {
- use rustix::fd::AsFd;
- #[cfg(unix)]
- use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd};
- #[cfg(target_os = "wasi")]
- use std::os::wasi::io::{AsRawFd, FromRawFd, IntoRawFd};
-
- let file = rustix::fs::openat(
- rustix::fs::cwd(),
- "Cargo.toml",
- rustix::fs::OFlags::RDONLY,
- rustix::fs::Mode::empty(),
- )
- .unwrap();
-
- let raw = file.as_raw_fd();
- assert_eq!(raw, file.as_fd().as_raw_fd());
-
- let inner = file.into_raw_fd();
- assert_eq!(raw, inner);
-
- let new = unsafe { rustix::io::OwnedFd::from_raw_fd(inner) };
- let mut buf = [0_u8; 4];
- let _ = rustix::io::read(&new, &mut buf).unwrap();
-}
diff --git a/vendor/rustix/tests/io/ioctl.rs b/vendor/rustix/tests/io/ioctl.rs
deleted file mode 100644
index e260e4884..000000000
--- a/vendor/rustix/tests/io/ioctl.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// `is_read_write` is not yet implemented on Windows. And `ioctl_fionread`
-// on Windows doesn't work on files.
-#[cfg(not(windows))]
-#[test]
-fn test_ioctls() {
- let file = std::fs::File::open("Cargo.toml").unwrap();
-
- assert_eq!(rustix::io::is_read_write(&file).unwrap(), (true, false));
-
- assert_eq!(
- rustix::io::ioctl_fionread(&file).unwrap(),
- file.metadata().unwrap().len()
- );
-}
diff --git a/vendor/rustix/tests/io/main.rs b/vendor/rustix/tests/io/main.rs
deleted file mode 100644
index bdd044809..000000000
--- a/vendor/rustix/tests/io/main.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-//! Tests for [`rustix::io`].
-
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(not(feature = "rustc-dep-of-std"))]
-#[cfg(not(windows))]
-#[cfg(not(target_os = "wasi"))]
-mod dup2_to_replace_stdio;
-#[cfg(not(feature = "rustc-dep-of-std"))] // TODO
-#[cfg(not(windows))]
-#[cfg(feature = "net")]
-#[cfg(not(target_os = "wasi"))]
-mod epoll;
-mod error;
-#[cfg(not(windows))]
-#[cfg(not(target_os = "wasi"))]
-mod eventfd;
-#[cfg(not(windows))]
-mod from_into;
-#[cfg(not(target_os = "redox"))]
-mod ioctl;
-mod poll;
-#[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))]
-mod procfs;
-#[cfg(not(windows))]
-#[cfg(not(target_os = "redox"))] // redox doesn't have cwd/openat
-#[cfg(not(target_os = "wasi"))] // wasi support for S_IRUSR etc. submitted to libc in #2264
-mod read_write;
-#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "android"))]
-mod seals;
diff --git a/vendor/rustix/tests/io/poll.rs b/vendor/rustix/tests/io/poll.rs
deleted file mode 100644
index ff2da695b..000000000
--- a/vendor/rustix/tests/io/poll.rs
+++ /dev/null
@@ -1,63 +0,0 @@
-use rustix::fd::{AsFd, AsRawFd, FromRawFd, IntoRawFd, OwnedFd};
-#[cfg(not(windows))]
-use rustix::io::{poll, retry_on_intr};
-use rustix::io::{PollFd, PollFlags};
-
-#[cfg(not(windows))]
-#[test]
-fn test_poll() {
- use rustix::io::{pipe, read, write};
-
- // Create a pipe.
- let (reader, writer) = pipe().unwrap();
- let mut poll_fds = [PollFd::new(&reader, PollFlags::IN)];
- assert_eq!(poll_fds[0].as_fd().as_raw_fd(), reader.as_fd().as_raw_fd());
-
- // `poll` should say there's nothing ready to be read from the pipe.
- let num = retry_on_intr(|| poll(&mut poll_fds, 0)).unwrap();
- assert_eq!(num, 0);
- assert!(poll_fds[0].revents().is_empty());
- assert_eq!(poll_fds[0].as_fd().as_raw_fd(), reader.as_fd().as_raw_fd());
-
- // Write a byte to the pipe.
- assert_eq!(retry_on_intr(|| write(&writer, b"a")).unwrap(), 1);
-
- // `poll` should now say there's data to be read.
- let num = retry_on_intr(|| poll(&mut poll_fds, -1)).unwrap();
- assert_eq!(num, 1);
- assert_eq!(poll_fds[0].revents(), PollFlags::IN);
- assert_eq!(poll_fds[0].as_fd().as_raw_fd(), reader.as_fd().as_raw_fd());
-
- let mut temp = poll_fds[0].clone();
- assert_eq!(temp.revents(), PollFlags::IN);
- temp.clear_revents();
- assert!(temp.revents().is_empty());
-
- // Read the byte from the pipe.
- let mut buf = [b'\0'];
- assert_eq!(retry_on_intr(|| read(&reader, &mut buf)).unwrap(), 1);
- assert_eq!(buf[0], b'a');
- assert_eq!(poll_fds[0].as_fd().as_raw_fd(), reader.as_fd().as_raw_fd());
-
- // Poll should now say there's no more data to be read.
- let num = retry_on_intr(|| poll(&mut poll_fds, 0)).unwrap();
- assert_eq!(num, 0);
- assert!(poll_fds[0].revents().is_empty());
- assert_eq!(poll_fds[0].as_fd().as_raw_fd(), reader.as_fd().as_raw_fd());
-}
-
-#[test]
-fn test_poll_fd_set_fd() {
- // Make up some file descriptors so that we can test that set_fd works.
- let a = unsafe { OwnedFd::from_raw_fd(777) };
- let mut poll_fd = PollFd::new(&a, PollFlags::empty());
- assert_eq!(poll_fd.as_fd().as_raw_fd(), 777);
-
- let b = unsafe { OwnedFd::from_raw_fd(888) };
- poll_fd.set_fd(&b);
- assert_eq!(poll_fd.as_fd().as_raw_fd(), 888);
-
- // Don't attempt to close our made-up file descriptors.
- let _ = a.into_raw_fd();
- let _ = b.into_raw_fd();
-}
diff --git a/vendor/rustix/tests/io/procfs.rs b/vendor/rustix/tests/io/procfs.rs
deleted file mode 100644
index 4c4256bd7..000000000
--- a/vendor/rustix/tests/io/procfs.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-use io_lifetimes::raw::AsRawFilelike;
-
-#[test]
-fn test_proc_self() {
- // Verify that this API works at all
- let fd = rustix::io::proc_self_fd().unwrap();
- assert_ne!(fd.as_raw_filelike(), 0);
-}
diff --git a/vendor/rustix/tests/io/read_write.rs b/vendor/rustix/tests/io/read_write.rs
deleted file mode 100644
index 65186bf21..000000000
--- a/vendor/rustix/tests/io/read_write.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-#[cfg(feature = "fs")]
-use std::io::{IoSlice, IoSliceMut};
-
-#[cfg(feature = "fs")]
-#[test]
-fn test_readwrite_pv() {
- use rustix::fs::{cwd, openat, Mode, OFlags};
- use rustix::io::{preadv, pwritev};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let foo = openat(
- &dir,
- "foo",
- OFlags::RDWR | OFlags::CREATE | OFlags::TRUNC,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- // For most targets, just call `pwritev`.
- #[cfg(not(any(target_os = "ios", target_os = "macos")))]
- {
- pwritev(&foo, &[IoSlice::new(b"hello")], 200).unwrap();
- }
- // macOS only has pwritev in newer versions; allow it to fail with `ENOSYS`.
- #[cfg(any(target_os = "ios", target_os = "macos"))]
- {
- match pwritev(&foo, &[IoSlice::new(b"hello")], 200) {
- Ok(_) => (),
- Err(rustix::io::Errno::NOSYS) => return,
- Err(err) => Err(err).unwrap(),
- }
- }
- pwritev(&foo, &[IoSlice::new(b"world")], 300).unwrap();
- let mut buf = [0_u8; 5];
- preadv(&foo, &mut [IoSliceMut::new(&mut buf)], 200).unwrap();
- assert_eq!(&buf, b"hello");
- preadv(&foo, &mut [IoSliceMut::new(&mut buf)], 300).unwrap();
- assert_eq!(&buf, b"world");
-}
-
-#[cfg(feature = "fs")]
-#[test]
-fn test_readwrite_p() {
- use rustix::fs::{cwd, openat, Mode, OFlags};
- use rustix::io::{pread, pwrite};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let foo = openat(
- &dir,
- "foo",
- OFlags::RDWR | OFlags::CREATE | OFlags::TRUNC,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- pwrite(&foo, b"hello", 200).unwrap();
- pwrite(&foo, b"world", 300).unwrap();
- let mut buf = [0_u8; 5];
- pread(&foo, &mut buf, 200).unwrap();
- assert_eq!(&buf, b"hello");
- pread(&foo, &mut buf, 300).unwrap();
- assert_eq!(&buf, b"world");
-}
-
-#[cfg(feature = "fs")]
-#[test]
-fn test_readwrite_v() {
- use rustix::fs::{cwd, openat, seek, Mode, OFlags};
- use rustix::io::{readv, writev, SeekFrom};
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let foo = openat(
- &dir,
- "foo",
- OFlags::RDWR | OFlags::CREATE | OFlags::TRUNC,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- writev(&foo, &[IoSlice::new(b"hello")]).unwrap();
- writev(&foo, &[IoSlice::new(b"world")]).unwrap();
- seek(&foo, SeekFrom::Start(0)).unwrap();
- let mut buf = [0_u8; 5];
- readv(&foo, &mut [IoSliceMut::new(&mut buf)]).unwrap();
- assert_eq!(&buf, b"hello");
- readv(&foo, &mut [IoSliceMut::new(&mut buf)]).unwrap();
- assert_eq!(&buf, b"world");
-}
-
-#[cfg(feature = "fs")]
-#[test]
-fn test_readwrite() {
- use rustix::fs::{cwd, openat, seek, Mode, OFlags};
- use rustix::io::{read, write};
- use std::io::SeekFrom;
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
- let foo = openat(
- &dir,
- "foo",
- OFlags::RDWR | OFlags::CREATE | OFlags::TRUNC,
- Mode::RUSR | Mode::WUSR,
- )
- .unwrap();
-
- write(&foo, b"hello").unwrap();
- write(&foo, b"world").unwrap();
- seek(&foo, SeekFrom::Start(0)).unwrap();
- let mut buf = [0_u8; 5];
- read(&foo, &mut buf).unwrap();
- assert_eq!(&buf, b"hello");
- read(&foo, &mut buf).unwrap();
- assert_eq!(&buf, b"world");
-}
diff --git a/vendor/rustix/tests/io/seals.rs b/vendor/rustix/tests/io/seals.rs
deleted file mode 100644
index ff971fa75..000000000
--- a/vendor/rustix/tests/io/seals.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-#[cfg(feature = "fs")]
-#[test]
-fn test_seals() {
- use rustix::fd::FromFd;
- use rustix::fs::{
- fcntl_add_seals, fcntl_get_seals, ftruncate, memfd_create, MemfdFlags, SealFlags,
- };
- use std::fs::File;
- use std::io::Write;
-
- let fd = match memfd_create("test", MemfdFlags::CLOEXEC | MemfdFlags::ALLOW_SEALING) {
- Ok(fd) => fd,
- Err(rustix::io::Errno::NOSYS) => return,
- Err(err) => Err(err).unwrap(),
- };
- let mut file = File::from_fd(fd.into());
-
- let old = fcntl_get_seals(&file).unwrap();
- assert_eq!(old, SealFlags::empty());
-
- writeln!(&mut file, "Hello!").unwrap();
-
- fcntl_add_seals(&file, SealFlags::GROW).unwrap();
-
- let now = fcntl_get_seals(&file).unwrap();
- assert_eq!(now, SealFlags::GROW);
-
- // We sealed growing, so this should fail.
- writeln!(&mut file, "World?").unwrap_err();
-
- // We can still shrink for now.
- ftruncate(&mut file, 1).unwrap();
-
- fcntl_add_seals(&file, SealFlags::SHRINK).unwrap();
-
- let now = fcntl_get_seals(&file).unwrap();
- assert_eq!(now, SealFlags::GROW | SealFlags::SHRINK);
-
- // We sealed shrinking, so this should fail.
- ftruncate(&mut file, 0).unwrap_err();
-}
diff --git a/vendor/rustix/tests/mm/main.rs b/vendor/rustix/tests/mm/main.rs
deleted file mode 100644
index ee746d900..000000000
--- a/vendor/rustix/tests/mm/main.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! Tests for [`rustix::mm`].
-
-#![cfg(feature = "mm")]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(not(windows))]
-#[cfg(not(target_os = "wasi"))]
-mod mlock;
-#[cfg(not(windows))]
-mod mmap;
-#[cfg(not(windows))]
-mod prot;
diff --git a/vendor/rustix/tests/mm/mlock.rs b/vendor/rustix/tests/mm/mlock.rs
deleted file mode 100644
index c4a1a83b5..000000000
--- a/vendor/rustix/tests/mm/mlock.rs
+++ /dev/null
@@ -1,79 +0,0 @@
-//! Tests for `mlock`.
-//!
-//! We can't easily test that it actually locks memory, but we can test that we
-//! can call it and either get success or a reasonable error message.
-
-use std::ffi::c_void;
-
-#[test]
-fn test_mlock() {
- let mut buf = vec![0_u8; 4096];
-
- unsafe {
- match rustix::mm::mlock(buf.as_mut_ptr().cast::<c_void>(), buf.len()) {
- Ok(()) => rustix::mm::munlock(buf.as_mut_ptr().cast::<c_void>(), buf.len()).unwrap(),
- // Tests won't always have enough memory or permissions, and that's ok.
- Err(rustix::io::Errno::PERM) | Err(rustix::io::Errno::NOMEM) => {}
- // But they shouldn't fail otherwise.
- Err(other) => Err(other).unwrap(),
- }
- }
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_mlock_with() {
- let mut buf = vec![0_u8; 4096];
-
- unsafe {
- match rustix::mm::mlock_with(
- buf.as_mut_ptr().cast::<c_void>(),
- buf.len(),
- rustix::mm::MlockFlags::empty(),
- ) {
- Ok(()) => rustix::mm::munlock(buf.as_mut_ptr().cast::<c_void>(), buf.len()).unwrap(),
- // Tests won't always have enough memory or permissions, and that's ok.
- Err(rustix::io::Errno::PERM)
- | Err(rustix::io::Errno::NOMEM)
- | Err(rustix::io::Errno::NOSYS) => {}
- // But they shouldn't fail otherwise.
- Err(other) => Err(other).unwrap(),
- }
- }
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_mlock_with_onfault() {
- // With glibc, `mlock2` with `MLOCK_ONFAULT` returns `EINVAL` if the
- // `mlock2` system call returns `ENOSYS`. That's not what we want
- // here though, because `ENOSYS` just means the OS doesn't have
- // `mlock2`, while `EINVAL` may indicate a bug in rustix.
- //
- // To work around this, we use `libc::syscall` to make a `mlock2`
- // syscall directly to test for `ENOSYS`, before running the main
- // test below.
- unsafe {
- if libc::syscall(libc::SYS_mlock2, 0, 0) == -1 && libc_errno::errno().0 == libc::ENOSYS {
- return;
- }
- }
-
- let mut buf = vec![0_u8; 4096];
-
- unsafe {
- match rustix::mm::mlock_with(
- buf.as_mut_ptr().cast::<c_void>(),
- buf.len(),
- rustix::mm::MlockFlags::ONFAULT,
- ) {
- Ok(()) => rustix::mm::munlock(buf.as_mut_ptr().cast::<c_void>(), buf.len()).unwrap(),
- // Tests won't always have enough memory or permissions, and that's ok.
- Err(rustix::io::Errno::PERM)
- | Err(rustix::io::Errno::NOMEM)
- | Err(rustix::io::Errno::NOSYS) => {}
- // But they shouldn't fail otherwise.
- Err(other) => Err(other).unwrap(),
- }
- }
-}
diff --git a/vendor/rustix/tests/mm/mmap.rs b/vendor/rustix/tests/mm/mmap.rs
deleted file mode 100644
index 6b27287d7..000000000
--- a/vendor/rustix/tests/mm/mmap.rs
+++ /dev/null
@@ -1,163 +0,0 @@
-#![cfg(not(target_os = "wasi"))]
-
-#[cfg(feature = "fs")]
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_mmap() {
- use rustix::fs::{cwd, openat, Mode, OFlags};
- use rustix::io::write;
- use rustix::mm::{mmap, munmap, MapFlags, ProtFlags};
- use std::ptr::null_mut;
- use std::slice;
-
- let tmp = tempfile::tempdir().unwrap();
- let dir = openat(cwd(), tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap();
-
- let file = openat(
- &dir,
- "foo",
- OFlags::CREATE | OFlags::WRONLY | OFlags::TRUNC,
- Mode::RUSR,
- )
- .unwrap();
- write(&file, &[b'a'; 8192]).unwrap();
- drop(file);
-
- let file = openat(&dir, "foo", OFlags::RDONLY, Mode::empty()).unwrap();
- unsafe {
- let addr = mmap(
- null_mut(),
- 8192,
- ProtFlags::READ,
- MapFlags::PRIVATE,
- &file,
- 0,
- )
- .unwrap();
- let slice = slice::from_raw_parts(addr.cast::<u8>(), 8192);
- assert_eq!(slice, &[b'a'; 8192]);
-
- munmap(addr, 8192).unwrap();
- }
-
- let file = openat(&dir, "foo", OFlags::RDONLY, Mode::empty()).unwrap();
- unsafe {
- assert_eq!(
- mmap(
- null_mut(),
- 8192,
- ProtFlags::READ,
- MapFlags::PRIVATE,
- &file,
- u64::MAX,
- )
- .unwrap_err()
- .raw_os_error(),
- libc::EINVAL
- );
- }
-}
-
-#[test]
-fn test_mmap_anonymous() {
- use rustix::mm::{mmap_anonymous, munmap, MapFlags, ProtFlags};
- use std::ptr::null_mut;
- use std::slice;
-
- unsafe {
- let addr = mmap_anonymous(null_mut(), 8192, ProtFlags::READ, MapFlags::PRIVATE).unwrap();
- let slice = slice::from_raw_parts(addr.cast::<u8>(), 8192);
- assert_eq!(slice, &[b'\0'; 8192]);
-
- munmap(addr, 8192).unwrap();
- }
-}
-
-#[test]
-fn test_mprotect() {
- use rustix::mm::{mmap_anonymous, mprotect, munmap, MapFlags, MprotectFlags, ProtFlags};
- use std::ptr::null_mut;
- use std::slice;
-
- unsafe {
- let addr = mmap_anonymous(null_mut(), 8192, ProtFlags::READ, MapFlags::PRIVATE).unwrap();
-
- mprotect(addr, 8192, MprotectFlags::empty()).unwrap();
- mprotect(addr, 8192, MprotectFlags::READ).unwrap();
-
- let slice = slice::from_raw_parts(addr.cast::<u8>(), 8192);
- assert_eq!(slice, &[b'\0'; 8192]);
-
- munmap(addr, 8192).unwrap();
- }
-}
-
-#[test]
-fn test_mlock() {
- use rustix::mm::{mlock, mmap_anonymous, munlock, munmap, MapFlags, ProtFlags};
- #[cfg(any(target_os = "android", target_os = "linux"))]
- use rustix::mm::{mlock_with, MlockFlags};
- use std::ptr::null_mut;
-
- unsafe {
- let addr = mmap_anonymous(null_mut(), 8192, ProtFlags::READ, MapFlags::PRIVATE).unwrap();
-
- mlock(addr, 8192).unwrap();
- munlock(addr, 8192).unwrap();
-
- #[cfg(any(target_os = "android", target_os = "linux"))]
- {
- match mlock_with(addr, 8192, MlockFlags::empty()) {
- Err(rustix::io::Errno::NOSYS) => (),
- Err(err) => Err(err).unwrap(),
- Ok(()) => munlock(addr, 8192).unwrap(),
- }
-
- #[cfg(linux_raw)] // libc doesn't expose `MLOCK_UNFAULT` yet.
- {
- match mlock_with(addr, 8192, MlockFlags::ONFAULT) {
- Err(rustix::io::Errno::NOSYS) => (),
- Err(err) => Err(err).unwrap(),
- Ok(()) => munlock(addr, 8192).unwrap(),
- }
- munlock(addr, 8192).unwrap();
- }
- }
-
- munmap(addr, 8192).unwrap();
- }
-}
-
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_madvise() {
- use rustix::mm::{madvise, mmap_anonymous, munmap, Advice, MapFlags, ProtFlags};
- use std::ptr::null_mut;
-
- unsafe {
- let addr = mmap_anonymous(null_mut(), 8192, ProtFlags::READ, MapFlags::PRIVATE).unwrap();
-
- madvise(addr, 8192, Advice::Normal).unwrap();
- madvise(addr, 8192, Advice::DontNeed).unwrap();
-
- #[cfg(any(target_os = "android", target_os = "linux"))]
- madvise(addr, 8192, Advice::LinuxDontNeed).unwrap();
-
- munmap(addr, 8192).unwrap();
- }
-}
-
-#[test]
-fn test_msync() {
- use rustix::mm::{mmap_anonymous, msync, munmap, MapFlags, MsyncFlags, ProtFlags};
- use std::ptr::null_mut;
-
- unsafe {
- let addr = mmap_anonymous(null_mut(), 8192, ProtFlags::READ, MapFlags::PRIVATE).unwrap();
-
- msync(addr, 8192, MsyncFlags::SYNC).unwrap();
- msync(addr, 8192, MsyncFlags::ASYNC).unwrap();
-
- munmap(addr, 8192).unwrap();
- }
-}
diff --git a/vendor/rustix/tests/mm/prot.rs b/vendor/rustix/tests/mm/prot.rs
deleted file mode 100644
index 6c86a8f2a..000000000
--- a/vendor/rustix/tests/mm/prot.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#[test]
-fn test_prot_flags() {
- assert_eq!(libc::PROT_NONE, 0);
-}
diff --git a/vendor/rustix/tests/net/addr.rs b/vendor/rustix/tests/net/addr.rs
deleted file mode 100644
index 124413132..000000000
--- a/vendor/rustix/tests/net/addr.rs
+++ /dev/null
@@ -1,92 +0,0 @@
-#[test]
-fn encode_decode() {
- #[cfg(unix)]
- use rustix::net::SocketAddrUnix;
- use rustix::net::{
- Ipv4Addr, Ipv6Addr, SocketAddrAny, SocketAddrStorage, SocketAddrV4, SocketAddrV6,
- };
-
- unsafe {
- let orig = SocketAddrV4::new(Ipv4Addr::new(2, 3, 5, 6), 33);
- let mut encoded = std::mem::MaybeUninit::<SocketAddrStorage>::uninit();
- let len = SocketAddrAny::V4(orig).write(encoded.as_mut_ptr());
- let decoded = SocketAddrAny::read(encoded.as_ptr(), len).unwrap();
- assert_eq!(decoded, SocketAddrAny::V4(orig));
-
- let orig = SocketAddrV6::new(Ipv6Addr::new(2, 3, 5, 6, 8, 9, 11, 12), 33, 34, 36);
- let mut encoded = std::mem::MaybeUninit::<SocketAddrStorage>::uninit();
- let len = SocketAddrAny::V6(orig).write(encoded.as_mut_ptr());
- let decoded = SocketAddrAny::read(encoded.as_ptr(), len).unwrap();
- assert_eq!(decoded, SocketAddrAny::V6(orig));
-
- #[cfg(not(windows))]
- {
- let orig = SocketAddrUnix::new("/path/to/socket").unwrap();
- let mut encoded = std::mem::MaybeUninit::<SocketAddrStorage>::uninit();
- let len = SocketAddrAny::Unix(orig.clone()).write(encoded.as_mut_ptr());
- let decoded = SocketAddrAny::read(encoded.as_ptr(), len).unwrap();
- assert_eq!(decoded, SocketAddrAny::Unix(orig));
- }
- }
-}
-
-#[cfg(not(windows))]
-#[test]
-fn test_unix_addr() {
- use rustix::cstr;
- use rustix::net::SocketAddrUnix;
-
- assert_eq!(
- SocketAddrUnix::new("/").unwrap().path().unwrap(),
- cstr!("/")
- );
- assert_eq!(
- SocketAddrUnix::new("//").unwrap().path().unwrap(),
- cstr!("//")
- );
- assert_eq!(
- SocketAddrUnix::new("/foo/bar").unwrap().path().unwrap(),
- cstr!("/foo/bar")
- );
- assert_eq!(
- SocketAddrUnix::new("foo").unwrap().path().unwrap(),
- cstr!("foo")
- );
- SocketAddrUnix::new("/foo\0/bar").unwrap_err();
- assert!(SocketAddrUnix::new("").unwrap().path().is_none());
-
- #[cfg(any(target_os = "android", target_os = "linux"))]
- {
- assert!(SocketAddrUnix::new("foo")
- .unwrap()
- .abstract_name()
- .is_none());
-
- assert_eq!(
- SocketAddrUnix::new_abstract_name(b"test")
- .unwrap()
- .abstract_name()
- .unwrap(),
- b"test"
- );
- assert_eq!(
- SocketAddrUnix::new_abstract_name(b"")
- .unwrap()
- .abstract_name()
- .unwrap(),
- b""
- );
- assert_eq!(
- SocketAddrUnix::new_abstract_name(b"this\0that")
- .unwrap()
- .abstract_name()
- .unwrap(),
- b"this\0that"
- );
- SocketAddrUnix::new_abstract_name(&[b'a'; 500]).unwrap_err();
- assert!(SocketAddrUnix::new_abstract_name(b"test")
- .unwrap()
- .path()
- .is_none());
- }
-}
diff --git a/vendor/rustix/tests/net/connect_bind_send.rs b/vendor/rustix/tests/net/connect_bind_send.rs
deleted file mode 100644
index 84720975f..000000000
--- a/vendor/rustix/tests/net/connect_bind_send.rs
+++ /dev/null
@@ -1,487 +0,0 @@
-use rustix::net::{
- AddressFamily, Ipv6Addr, Protocol, RecvFlags, SendFlags, SocketAddrAny, SocketAddrV4,
- SocketAddrV6, SocketType,
-};
-use std::net::{IpAddr, Ipv4Addr, SocketAddr};
-
-/// Test `connect_any`.
-#[test]
-fn net_v4_connect_any() -> std::io::Result<()> {
- let localhost = IpAddr::V4(Ipv4Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Similar, but with V6.
-#[test]
-fn net_v6_connect_any() -> std::io::Result<()> {
- let localhost = IpAddr::V6(Ipv6Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Test `connect` with a `SocketAddr`.
-#[test]
-fn net_v4_connect() -> std::io::Result<()> {
- let localhost = IpAddr::V4(Ipv4Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let local_addr = match local_addr {
- SocketAddrAny::V4(v4) => SocketAddr::V4(v4),
- other => panic!("unexpected socket address {:?}", other),
- };
- let sender = rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::connect(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Similar, but use V6.
-#[test]
-fn net_v6_connect() -> std::io::Result<()> {
- let localhost = IpAddr::V6(Ipv6Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let local_addr = match local_addr {
- SocketAddrAny::V6(v6) => SocketAddr::V6(v6),
- other => panic!("unexpected socket address {:?}", other),
- };
- let sender = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::connect(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Test `bind_any`.
-#[test]
-fn net_v4_bind_any() -> std::io::Result<()> {
- let localhost = Ipv4Addr::LOCALHOST;
- let addr = SocketAddrAny::V4(SocketAddrV4::new(localhost, 0));
- let listener =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::bind_any(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Similar, but use V6.
-#[test]
-fn net_v6_bind_any() -> std::io::Result<()> {
- let localhost = Ipv6Addr::LOCALHOST;
- let addr = SocketAddrAny::V6(SocketAddrV6::new(localhost, 0, 0, 0));
- let listener = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::bind_any(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Test `sendto`.
-#[test]
-fn net_v4_sendto() -> std::io::Result<()> {
- let localhost = IpAddr::V4(Ipv4Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let local_addr = match local_addr {
- SocketAddrAny::V4(v4) => SocketAddr::V4(v4),
- other => panic!("unexpected socket address {:?}", other),
- };
- let n = rustix::net::sendto(&sender, request, SendFlags::empty(), &local_addr).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let (n, from) =
- rustix::net::recvfrom(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
- assert!(from.is_none());
-
- Ok(())
-}
-
-/// Similar, but with V6.
-#[test]
-fn net_v6_sendto() -> std::io::Result<()> {
- let localhost = IpAddr::V6(Ipv6Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let local_addr = match local_addr {
- SocketAddrAny::V6(v6) => SocketAddr::V6(v6),
- other => panic!("unexpected socket address {:?}", other),
- };
- let n = rustix::net::sendto(&sender, request, SendFlags::empty(), &local_addr).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let (n, from) =
- rustix::net::recvfrom(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
- assert!(from.is_none());
-
- Ok(())
-}
-
-/// Test `sendto_any`.
-#[test]
-fn net_v4_sendto_any() -> std::io::Result<()> {
- let localhost = IpAddr::V4(Ipv4Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n =
- rustix::net::sendto_any(&sender, request, SendFlags::empty(), &local_addr).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let (n, from) =
- rustix::net::recvfrom(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
- assert!(from.is_none());
-
- Ok(())
-}
-
-/// Test `sendto_any`.
-#[test]
-fn net_v6_sendto_any() -> std::io::Result<()> {
- let localhost = IpAddr::V6(Ipv6Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n =
- rustix::net::sendto_any(&sender, request, SendFlags::empty(), &local_addr).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let accepted = rustix::net::accept(&listener).expect("accept");
- let mut response = [0_u8; 128];
- let (n, from) =
- rustix::net::recvfrom(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
- assert!(from.is_none());
-
- Ok(())
-}
-
-/// Test `acceptfrom`.
-#[test]
-fn net_v4_acceptfrom() -> std::io::Result<()> {
- let localhost = IpAddr::V4(Ipv4Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default())?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let (accepted, from) = rustix::net::acceptfrom(&listener).expect("accept");
-
- assert_ne!(from.clone().unwrap(), local_addr);
-
- let from = match from.unwrap() {
- SocketAddrAny::V4(v4) => v4,
- other => panic!("unexpected socket address {:?}", other),
- };
- let local_addr = match local_addr {
- SocketAddrAny::V4(v4) => v4,
- other => panic!("unexpected socket address {:?}", other),
- };
-
- assert_eq!(from.clone().ip(), local_addr.ip());
- assert_ne!(from.clone().port(), local_addr.port());
-
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
-
-/// Similar, but with V6.
-#[test]
-fn net_v6_acceptfrom() -> std::io::Result<()> {
- let localhost = IpAddr::V6(Ipv6Addr::LOCALHOST);
- let addr = SocketAddr::new(localhost, 0);
- let listener = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::bind(&listener, &addr).expect("bind");
- rustix::net::listen(&listener, 1).expect("listen");
-
- let local_addr = rustix::net::getsockname(&listener)?;
- let sender = rustix::net::socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )?;
- rustix::net::connect_any(&sender, &local_addr).expect("connect");
- let request = b"Hello, World!!!";
- let n = rustix::net::send(&sender, request, SendFlags::empty()).expect("send");
- drop(sender);
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- let (accepted, from) = rustix::net::acceptfrom(&listener).expect("accept");
-
- assert_ne!(from.clone().unwrap(), local_addr);
-
- let from = match from.unwrap() {
- SocketAddrAny::V6(v6) => v6,
- other => panic!("unexpected socket address {:?}", other),
- };
- let local_addr = match local_addr {
- SocketAddrAny::V6(v6) => v6,
- other => panic!("unexpected socket address {:?}", other),
- };
-
- assert_eq!(from.clone().ip(), local_addr.ip());
- assert_ne!(from.clone().port(), local_addr.port());
-
- let mut response = [0_u8; 128];
- let n = rustix::net::recv(&accepted, &mut response, RecvFlags::empty()).expect("recv");
-
- // Not strictly required, but it makes the test simpler.
- assert_eq!(n, request.len());
-
- assert_eq!(request, &response[..n]);
-
- Ok(())
-}
diff --git a/vendor/rustix/tests/net/main.rs b/vendor/rustix/tests/net/main.rs
deleted file mode 100644
index 0745282aa..000000000
--- a/vendor/rustix/tests/net/main.rs
+++ /dev/null
@@ -1,32 +0,0 @@
-//! Tests for [`rustix::net`].
-
-#![cfg(feature = "net")]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg_attr(core_c_str, feature(core_c_str))]
-
-mod addr;
-mod connect_bind_send;
-mod poll;
-mod sockopt;
-#[cfg(unix)]
-mod unix;
-mod v4;
-mod v6;
-
-/// Windows requires us to call a setup function before using any of the
-/// socket APIs.
-#[cfg(windows)]
-#[ctor::ctor]
-fn windows_startup() {
- let _ = rustix::net::wsa_startup().unwrap();
-}
-
-/// Windows requires us to call a cleanup function after using any of the
-/// socket APIs.
-#[cfg(windows)]
-#[ctor::dtor]
-fn windows_shutdown() {
- rustix::net::wsa_cleanup().unwrap();
-}
diff --git a/vendor/rustix/tests/net/poll.rs b/vendor/rustix/tests/net/poll.rs
deleted file mode 100644
index 7933983f2..000000000
--- a/vendor/rustix/tests/net/poll.rs
+++ /dev/null
@@ -1,119 +0,0 @@
-//! The same as v6.rs, but with `poll` calls.
-
-#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
-
-use rustix::io::{poll, PollFd, PollFlags};
-use rustix::net::{
- accept, bind_v6, connect_v6, getsockname, listen, recv, send, socket, AddressFamily, Ipv6Addr,
- Protocol, RecvFlags, SendFlags, SocketAddrAny, SocketAddrV6, SocketType,
-};
-use std::sync::{Arc, Condvar, Mutex};
-use std::thread;
-
-const BUFFER_SIZE: usize = 20;
-
-fn server(ready: Arc<(Mutex<u16>, Condvar)>) {
- let connection_socket = socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )
- .unwrap();
-
- let name = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 0, 0, 0);
- bind_v6(&connection_socket, &name).unwrap();
-
- let who = match getsockname(&connection_socket).unwrap() {
- SocketAddrAny::V6(addr) => addr,
- _ => panic!(),
- };
-
- listen(&connection_socket, 1).unwrap();
-
- {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- *port = who.port();
- cvar.notify_all();
- }
-
- let mut buffer = vec![0; BUFFER_SIZE];
- let data_socket = accept(&connection_socket).unwrap();
-
- let mut fds = [PollFd::new(&data_socket, PollFlags::IN)];
- assert_eq!(poll(&mut fds, -1).unwrap(), 1);
- assert!(fds[0].revents().intersects(PollFlags::IN));
- assert!(!fds[0].revents().intersects(PollFlags::OUT));
-
- let expected_nread = rustix::io::ioctl_fionread(&data_socket).unwrap();
- let nread = recv(&data_socket, &mut buffer, RecvFlags::empty()).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "hello, world");
- assert_eq!(expected_nread, nread as u64);
-
- let mut fds = [PollFd::new(&data_socket, PollFlags::OUT)];
- assert_eq!(poll(&mut fds, -1).unwrap(), 1);
- assert!(!fds[0].revents().intersects(PollFlags::IN));
- assert!(fds[0].revents().intersects(PollFlags::OUT));
-
- send(&data_socket, b"goodnight, moon", SendFlags::empty()).unwrap();
-}
-
-fn client(ready: Arc<(Mutex<u16>, Condvar)>) {
- let port = {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- while *port == 0 {
- port = cvar.wait(port).unwrap();
- }
- *port
- };
-
- let addr = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), port, 0, 0);
- let mut buffer = vec![0; BUFFER_SIZE];
-
- let data_socket = socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )
- .unwrap();
- connect_v6(&data_socket, &addr).unwrap();
-
- let mut fds = [PollFd::new(&data_socket, PollFlags::OUT)];
- assert_eq!(poll(&mut fds, -1).unwrap(), 1);
- assert!(!fds[0].revents().intersects(PollFlags::IN));
- assert!(fds[0].revents().intersects(PollFlags::OUT));
-
- send(&data_socket, b"hello, world", SendFlags::empty()).unwrap();
-
- let mut fds = [PollFd::new(&data_socket, PollFlags::IN)];
- assert_eq!(poll(&mut fds, -1).unwrap(), 1);
- assert!(fds[0].revents().intersects(PollFlags::IN));
- assert!(!fds[0].revents().intersects(PollFlags::OUT));
-
- let expected_nread = rustix::io::ioctl_fionread(&data_socket).unwrap();
- let nread = recv(&data_socket, &mut buffer, RecvFlags::empty()).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "goodnight, moon");
- assert_eq!(expected_nread, nread as u64);
-}
-
-#[test]
-fn test_poll() {
- let ready = Arc::new((Mutex::new(0_u16), Condvar::new()));
- let ready_clone = Arc::clone(&ready);
-
- let server = thread::Builder::new()
- .name("server".to_string())
- .spawn(move || {
- server(ready);
- })
- .unwrap();
- let client = thread::Builder::new()
- .name("client".to_string())
- .spawn(move || {
- client(ready_clone);
- })
- .unwrap();
- client.join().unwrap();
- server.join().unwrap();
-}
diff --git a/vendor/rustix/tests/net/sockopt.rs b/vendor/rustix/tests/net/sockopt.rs
deleted file mode 100644
index 8e4cf52e8..000000000
--- a/vendor/rustix/tests/net/sockopt.rs
+++ /dev/null
@@ -1,158 +0,0 @@
-#[test]
-fn test_sockopts() {
- use rustix::net::{AddressFamily, Protocol, SocketType};
- use std::time::Duration;
-
- let s =
- rustix::net::socket(AddressFamily::INET, SocketType::STREAM, Protocol::default()).unwrap();
-
- // On a new socket we shouldn't have a timeout yet.
- assert!(
- rustix::net::sockopt::get_socket_timeout(&s, rustix::net::sockopt::Timeout::Recv)
- .unwrap()
- .is_none()
- );
- assert_eq!(
- rustix::net::sockopt::get_socket_type(&s).unwrap(),
- SocketType::STREAM
- );
- #[cfg(not(windows))]
- assert_eq!(
- rustix::net::sockopt::get_socket_broadcast(&s).unwrap(),
- false
- );
- // On a new socket we shouldn't have a linger yet.
- assert!(rustix::net::sockopt::get_socket_linger(&s)
- .unwrap()
- .is_none());
- #[cfg(any(target_os = "android", target_os = "linux"))]
- assert_eq!(
- rustix::net::sockopt::get_socket_passcred(&s).unwrap(),
- false
- );
- assert_ne!(rustix::net::sockopt::get_ip_ttl(&s).unwrap(), 0);
- assert_ne!(rustix::net::sockopt::get_ip_ttl(&s).unwrap(), 77);
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- assert_eq!(
- rustix::net::sockopt::get_ip_multicast_loop(&s).unwrap(),
- true
- );
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- assert_eq!(rustix::net::sockopt::get_ip_multicast_ttl(&s).unwrap(), 1);
- assert_eq!(rustix::net::sockopt::get_tcp_nodelay(&s).unwrap(), false);
-
- // Set a timeout.
- rustix::net::sockopt::set_socket_timeout(
- &s,
- rustix::net::sockopt::Timeout::Recv,
- Some(Duration::new(1, 1)),
- )
- .unwrap();
-
- // Check that we have a timeout of at least the time we set.
- if cfg!(not(target_os = "freebsd")) {
- assert!(
- rustix::net::sockopt::get_socket_timeout(&s, rustix::net::sockopt::Timeout::Recv)
- .unwrap()
- .unwrap()
- >= Duration::new(1, 1)
- );
- } else {
- // On FreeBSD <= 12, it appears the system rounds the timeout down.
- assert!(
- rustix::net::sockopt::get_socket_timeout(&s, rustix::net::sockopt::Timeout::Recv)
- .unwrap()
- .unwrap()
- >= Duration::new(1, 0)
- );
- }
-
- #[cfg(not(windows))]
- {
- // Set the broadcast flag;
- rustix::net::sockopt::set_socket_broadcast(&s, true).unwrap();
-
- // Check that the broadcast flag is set. This has no effect on stream
- // sockets, and not all platforms even remember the value.
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- assert_eq!(
- rustix::net::sockopt::get_socket_broadcast(&s).unwrap(),
- true
- );
- }
-
- // Set a linger.
- rustix::net::sockopt::set_socket_linger(&s, Some(Duration::new(1, 1))).unwrap();
-
- // Check that we have a linger of at least the time we set.
- assert!(
- dbg!(rustix::net::sockopt::get_socket_linger(&s)
- .unwrap()
- .unwrap())
- >= Duration::new(1, 1)
- );
-
- #[cfg(any(target_os = "android", target_os = "linux"))]
- {
- // Set the passcred flag;
- rustix::net::sockopt::set_socket_passcred(&s, true).unwrap();
-
- // Check that the passcred flag is set.
- assert_eq!(rustix::net::sockopt::get_socket_passcred(&s).unwrap(), true);
- }
-
- // Set the ip ttl.
- rustix::net::sockopt::set_ip_ttl(&s, 77).unwrap();
-
- // Check the ip ttl.
- assert_eq!(rustix::net::sockopt::get_ip_ttl(&s).unwrap(), 77);
-
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
- {
- // Set the multicast loop flag;
- rustix::net::sockopt::set_ip_multicast_loop(&s, false).unwrap();
-
- // Check that the multicast loop flag is set.
- assert_eq!(
- rustix::net::sockopt::get_ip_multicast_loop(&s).unwrap(),
- false
- );
- }
-
- // Set the nodelay flag;
- rustix::net::sockopt::set_tcp_nodelay(&s, true).unwrap();
-
- // Check that the nodelay flag is set.
- assert_eq!(rustix::net::sockopt::get_tcp_nodelay(&s).unwrap(), true);
-}
diff --git a/vendor/rustix/tests/net/unix.rs b/vendor/rustix/tests/net/unix.rs
deleted file mode 100644
index 21a6542f8..000000000
--- a/vendor/rustix/tests/net/unix.rs
+++ /dev/null
@@ -1,147 +0,0 @@
-//! Test a simple Unix-domain socket server and client.
-//!
-//! The client sends lists of integers and the server sends back sums.
-
-// This test uses `AF_UNIX` with `SOCK_SEQPACKET` which is unsupported on macOS.
-#![cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
-// This test uses `DecInt`.
-#![cfg(feature = "itoa")]
-#![cfg(feature = "fs")]
-
-use rustix::fs::{cwd, unlinkat, AtFlags};
-use rustix::io::{read, write};
-use rustix::net::{
- accept, bind_unix, connect_unix, listen, socket, AddressFamily, Protocol, SocketAddrUnix,
- SocketType,
-};
-use rustix::path::DecInt;
-use std::path::Path;
-use std::str::FromStr;
-use std::sync::{Arc, Condvar, Mutex};
-use std::thread;
-
-const BUFFER_SIZE: usize = 20;
-
-fn server(ready: Arc<(Mutex<bool>, Condvar)>, path: &Path) {
- let connection_socket = socket(
- AddressFamily::UNIX,
- SocketType::SEQPACKET,
- Protocol::default(),
- )
- .unwrap();
-
- let name = SocketAddrUnix::new(path).unwrap();
- bind_unix(&connection_socket, &name).unwrap();
- listen(&connection_socket, 1).unwrap();
-
- {
- let (lock, cvar) = &*ready;
- let mut started = lock.lock().unwrap();
- *started = true;
- cvar.notify_all();
- }
-
- let mut buffer = vec![0; BUFFER_SIZE];
- 'exit: loop {
- let data_socket = accept(&connection_socket).unwrap();
- let mut sum = 0;
- loop {
- let nread = read(&data_socket, &mut buffer).unwrap();
-
- if &buffer[..nread] == b"exit" {
- break 'exit;
- }
- if &buffer[..nread] == b"sum" {
- break;
- }
-
- sum += i32::from_str(&String::from_utf8_lossy(&buffer[..nread])).unwrap();
- }
-
- write(&data_socket, DecInt::new(sum).as_bytes()).unwrap();
- }
-
- unlinkat(cwd(), path, AtFlags::empty()).unwrap();
-}
-
-fn client(ready: Arc<(Mutex<bool>, Condvar)>, path: &Path, runs: &[(&[&str], i32)]) {
- {
- let (lock, cvar) = &*ready;
- let mut started = lock.lock().unwrap();
- while !*started {
- started = cvar.wait(started).unwrap();
- }
- }
-
- let addr = SocketAddrUnix::new(path).unwrap();
- let mut buffer = vec![0; BUFFER_SIZE];
-
- for (args, sum) in runs {
- let data_socket = socket(
- AddressFamily::UNIX,
- SocketType::SEQPACKET,
- Protocol::default(),
- )
- .unwrap();
- connect_unix(&data_socket, &addr).unwrap();
-
- for arg in *args {
- write(&data_socket, arg.as_bytes()).unwrap();
- }
- write(&data_socket, b"sum").unwrap();
-
- let nread = read(&data_socket, &mut buffer).unwrap();
- assert_eq!(
- i32::from_str(&String::from_utf8_lossy(&buffer[..nread])).unwrap(),
- *sum
- );
- }
-
- let data_socket = socket(
- AddressFamily::UNIX,
- SocketType::SEQPACKET,
- Protocol::default(),
- )
- .unwrap();
- connect_unix(&data_socket, &addr).unwrap();
- write(&data_socket, b"exit").unwrap();
-}
-
-#[test]
-fn test_unix() {
- let ready = Arc::new((Mutex::new(false), Condvar::new()));
- let ready_clone = Arc::clone(&ready);
-
- let tmp = tempfile::tempdir().unwrap();
- let path = tmp.path().join("soccer");
- let send_path = path.to_owned();
- let server = thread::Builder::new()
- .name("server".to_string())
- .spawn(move || {
- server(ready, &send_path);
- })
- .unwrap();
- let send_path = path.to_owned();
- let client = thread::Builder::new()
- .name("client".to_string())
- .spawn(move || {
- client(
- ready_clone,
- &send_path,
- &[
- (&["1", "2"], 3),
- (&["4", "77", "103"], 184),
- (&["5", "78", "104"], 187),
- (&[], 0),
- ],
- );
- })
- .unwrap();
- client.join().unwrap();
- server.join().unwrap();
-}
diff --git a/vendor/rustix/tests/net/v4.rs b/vendor/rustix/tests/net/v4.rs
deleted file mode 100644
index 0908057be..000000000
--- a/vendor/rustix/tests/net/v4.rs
+++ /dev/null
@@ -1,86 +0,0 @@
-//! Test a simple IPv4 socket server and client.
-//!
-//! The client send a message and the server sends one back.
-
-#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
-
-use rustix::net::{
- accept, bind_v4, connect_v4, getsockname, listen, recv, send, socket, AddressFamily, Ipv4Addr,
- Protocol, RecvFlags, SendFlags, SocketAddrAny, SocketAddrV4, SocketType,
-};
-use std::sync::{Arc, Condvar, Mutex};
-use std::thread;
-
-const BUFFER_SIZE: usize = 20;
-
-fn server(ready: Arc<(Mutex<u16>, Condvar)>) {
- let connection_socket =
- socket(AddressFamily::INET, SocketType::STREAM, Protocol::default()).unwrap();
-
- let name = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0);
- bind_v4(&connection_socket, &name).unwrap();
-
- let who = match getsockname(&connection_socket).unwrap() {
- SocketAddrAny::V4(addr) => addr,
- _ => panic!(),
- };
-
- listen(&connection_socket, 1).unwrap();
-
- {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- *port = who.port();
- cvar.notify_all();
- }
-
- let mut buffer = vec![0; BUFFER_SIZE];
- let data_socket = accept(&connection_socket).unwrap();
- let nread = recv(&data_socket, &mut buffer, RecvFlags::empty()).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "hello, world");
-
- send(&data_socket, b"goodnight, moon", SendFlags::empty()).unwrap();
-}
-
-fn client(ready: Arc<(Mutex<u16>, Condvar)>) {
- let port = {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- while *port == 0 {
- port = cvar.wait(port).unwrap();
- }
- *port
- };
-
- let addr = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), port);
- let mut buffer = vec![0; BUFFER_SIZE];
-
- let data_socket = socket(AddressFamily::INET, SocketType::STREAM, Protocol::default()).unwrap();
- connect_v4(&data_socket, &addr).unwrap();
-
- send(&data_socket, b"hello, world", SendFlags::empty()).unwrap();
-
- let nread = recv(&data_socket, &mut buffer, RecvFlags::empty()).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "goodnight, moon");
-}
-
-#[test]
-fn test_v4() {
- let ready = Arc::new((Mutex::new(0_u16), Condvar::new()));
- let ready_clone = Arc::clone(&ready);
-
- let server = thread::Builder::new()
- .name("server".to_string())
- .spawn(move || {
- server(ready);
- })
- .unwrap();
- let client = thread::Builder::new()
- .name("client".to_string())
- .spawn(move || {
- client(ready_clone);
- })
- .unwrap();
- client.join().unwrap();
- server.join().unwrap();
-}
diff --git a/vendor/rustix/tests/net/v6.rs b/vendor/rustix/tests/net/v6.rs
deleted file mode 100644
index 07205be89..000000000
--- a/vendor/rustix/tests/net/v6.rs
+++ /dev/null
@@ -1,95 +0,0 @@
-//! Test a simple IPv6 socket server and client.
-//!
-//! The client send a message and the server sends one back.
-
-#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
-
-use rustix::net::{
- accept, bind_v6, connect_v6, getsockname, listen, recv, send, socket, AddressFamily, Ipv6Addr,
- Protocol, RecvFlags, SendFlags, SocketAddrAny, SocketAddrV6, SocketType,
-};
-use std::sync::{Arc, Condvar, Mutex};
-use std::thread;
-
-const BUFFER_SIZE: usize = 20;
-
-fn server(ready: Arc<(Mutex<u16>, Condvar)>) {
- let connection_socket = socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )
- .unwrap();
-
- let name = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), 0, 0, 0);
- bind_v6(&connection_socket, &name).unwrap();
-
- let who = match getsockname(&connection_socket).unwrap() {
- SocketAddrAny::V6(addr) => addr,
- _ => panic!(),
- };
-
- listen(&connection_socket, 1).unwrap();
-
- {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- *port = who.port();
- cvar.notify_all();
- }
-
- let mut buffer = vec![0; BUFFER_SIZE];
- let data_socket = accept(&connection_socket).unwrap();
- let nread = recv(&data_socket, &mut buffer, RecvFlags::empty()).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "hello, world");
-
- send(&data_socket, b"goodnight, moon", SendFlags::empty()).unwrap();
-}
-
-fn client(ready: Arc<(Mutex<u16>, Condvar)>) {
- let port = {
- let (lock, cvar) = &*ready;
- let mut port = lock.lock().unwrap();
- while *port == 0 {
- port = cvar.wait(port).unwrap();
- }
- *port
- };
-
- let addr = SocketAddrV6::new(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1), port, 0, 0);
- let mut buffer = vec![0; BUFFER_SIZE];
-
- let data_socket = socket(
- AddressFamily::INET6,
- SocketType::STREAM,
- Protocol::default(),
- )
- .unwrap();
- connect_v6(&data_socket, &addr).unwrap();
-
- send(&data_socket, b"hello, world", SendFlags::empty()).unwrap();
-
- let nread = recv(&data_socket, &mut buffer, RecvFlags::empty()).unwrap();
- assert_eq!(String::from_utf8_lossy(&buffer[..nread]), "goodnight, moon");
-}
-
-#[test]
-fn test_v6() {
- let ready = Arc::new((Mutex::new(0_u16), Condvar::new()));
- let ready_clone = Arc::clone(&ready);
-
- let server = thread::Builder::new()
- .name("server".to_string())
- .spawn(move || {
- server(ready);
- })
- .unwrap();
- let client = thread::Builder::new()
- .name("client".to_string())
- .spawn(move || {
- client(ready_clone);
- })
- .unwrap();
- client.join().unwrap();
- server.join().unwrap();
-}
diff --git a/vendor/rustix/tests/param/auxv.rs b/vendor/rustix/tests/param/auxv.rs
deleted file mode 100644
index 90a088101..000000000
--- a/vendor/rustix/tests/param/auxv.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-#[cfg(any(
- all(target_os = "android", target_pointer_width = "64"),
- target_os = "linux",
-))]
-use rustix::param::linux_hwcap;
-use rustix::param::{clock_ticks_per_second, page_size};
-
-#[test]
-fn test_page_size() {
- let size = page_size();
- assert_ne!(size, 0);
- assert!(size.is_power_of_two());
- assert_eq!(size, page_size());
- assert_eq!(size, unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize });
-}
-
-#[test]
-fn test_clock_ticks_per_second() {
- let size = clock_ticks_per_second();
- assert_ne!(size, 0);
- assert_eq!(size, unsafe { libc::sysconf(libc::_SC_CLK_TCK) as u64 });
-}
-
-#[cfg(any(
- all(target_os = "android", target_pointer_width = "64"),
- target_os = "linux",
-))]
-#[test]
-fn test_linux_hwcap() {
- weak!(fn getauxval(libc::c_ulong) -> libc::c_ulong);
-
- if let Some(libc_getauxval) = getauxval.get() {
- let (_hwcap, hwcap2) = linux_hwcap();
-
- // GLIBC seems to return a different value than `LD_SHOW_AUXV=1` reports.
- #[cfg(not(target_env = "gnu"))]
- assert_eq!(_hwcap, unsafe { libc_getauxval(libc::AT_HWCAP) } as usize);
-
- assert_eq!(hwcap2, unsafe { libc_getauxval(libc::AT_HWCAP2) } as usize);
- }
-}
diff --git a/vendor/rustix/tests/param/main.rs b/vendor/rustix/tests/param/main.rs
deleted file mode 100644
index e350a6f1f..000000000
--- a/vendor/rustix/tests/param/main.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//! Tests for [`rustix::param`].
-
-#![cfg(feature = "param")]
-#![cfg(not(windows))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg_attr(core_c_str, feature(core_c_str))]
-
-#[cfg(not(target_os = "wasi"))]
-#[macro_use]
-mod weak;
-
-#[cfg(not(target_os = "wasi"))]
-mod auxv;
diff --git a/vendor/rustix/tests/param/weak.rs b/vendor/rustix/tests/param/weak.rs
deleted file mode 100644
index 377a8a5a1..000000000
--- a/vendor/rustix/tests/param/weak.rs
+++ /dev/null
@@ -1,201 +0,0 @@
-// Implementation derived from `weak` in Rust's
-// library/std/src/sys/unix/weak.rs at revision
-// fd0cb0cdc21dd9c06025277d772108f8d42cb25f.
-
-//! Support for "weak linkage" to symbols on Unix
-//!
-//! Some I/O operations we do in libstd require newer versions of OSes but we
-//! need to maintain binary compatibility with older releases for now. In order
-//! to use the new functionality when available we use this module for
-//! detection.
-//!
-//! One option to use here is weak linkage, but that is unfortunately only
-//! really workable on Linux. Hence, use dlsym to get the symbol value at
-//! runtime. This is also done for compatibility with older versions of glibc,
-//! and to avoid creating dependencies on `GLIBC_PRIVATE` symbols. It assumes
-//! that we've been dynamically linked to the library the symbol comes from,
-//! but that is currently always the case for things like libpthread/libc.
-//!
-//! A long time ago this used weak linkage for the `__pthread_get_minstack`
-//! symbol, but that caused Debian to detect an unnecessarily strict versioned
-//! dependency on libc6 (#23628).
-
-// There are a variety of `#[cfg]`s controlling which targets are involved in
-// each instance of `weak!` and `syscall!`. Rather than trying to unify all of
-// that, we'll just allow that some unix targets don't use this module at all.
-#![allow(dead_code, unused_macros)]
-#![allow(clippy::doc_markdown)]
-
-use core::ffi::c_void;
-use core::ptr::null_mut;
-use core::sync::atomic::{self, AtomicPtr, Ordering};
-use core::{marker, mem};
-use rustix::ffi::CStr;
-
-const NULL: *mut c_void = null_mut();
-const INVALID: *mut c_void = 1 as *mut c_void;
-
-macro_rules! weak {
- (fn $name:ident($($t:ty),*) -> $ret:ty) => (
- #[allow(non_upper_case_globals)]
- static $name: $crate::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
- $crate::weak::Weak::new(concat!(stringify!($name), '\0'));
- )
-}
-
-pub(crate) struct Weak<F> {
- name: &'static str,
- addr: AtomicPtr<c_void>,
- _marker: marker::PhantomData<F>,
-}
-
-impl<F> Weak<F> {
- pub(crate) const fn new(name: &'static str) -> Self {
- Self {
- name,
- addr: AtomicPtr::new(INVALID),
- _marker: marker::PhantomData,
- }
- }
-
- pub(crate) fn get(&self) -> Option<F> {
- assert_eq!(mem::size_of::<F>(), mem::size_of::<usize>());
- unsafe {
- // Relaxed is fine here because we fence before reading through the
- // pointer (see the comment below).
- match self.addr.load(Ordering::Relaxed) {
- INVALID => self.initialize(),
- NULL => None,
- addr => {
- let func = mem::transmute_copy::<*mut c_void, F>(&addr);
- // The caller is presumably going to read through this value
- // (by calling the function we've dlsymed). This means we'd
- // need to have loaded it with at least C11's consume
- // ordering in order to be guaranteed that the data we read
- // from the pointer isn't from before the pointer was
- // stored. Rust has no equivalent to memory_order_consume,
- // so we use an acquire fence (sorry, ARM).
- //
- // Now, in practice this likely isn't needed even on CPUs
- // where relaxed and consume mean different things. The
- // symbols we're loading are probably present (or not) at
- // init, and even if they aren't the runtime dynamic loader
- // is extremely likely have sufficient barriers internally
- // (possibly implicitly, for example the ones provided by
- // invoking `mprotect`).
- //
- // That said, none of that's *guaranteed*, and so we fence.
- atomic::fence(Ordering::Acquire);
- Some(func)
- }
- }
- }
- }
-
- // Cold because it should only happen during first-time initialization.
- #[cold]
- unsafe fn initialize(&self) -> Option<F> {
- let val = fetch(self.name);
- // This synchronizes with the acquire fence in `get`.
- self.addr.store(val, Ordering::Release);
-
- match val {
- NULL => None,
- addr => Some(mem::transmute_copy::<*mut c_void, F>(&addr)),
- }
- }
-}
-
-unsafe fn fetch(name: &str) -> *mut c_void {
- let name = match CStr::from_bytes_with_nul(name.as_bytes()) {
- Ok(c_str) => c_str,
- Err(..) => return null_mut(),
- };
- libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr())
-}
-
-#[cfg(not(any(target_os = "android", target_os = "linux")))]
-macro_rules! syscall {
- (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- errno::set_errno(errno::Errno(libc::ENOSYS));
- -1
- }
- }
- )
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-macro_rules! syscall {
- (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- unsafe fn $name($($arg_name:$t),*) -> $ret {
- // This looks like a hack, but concat_idents only accepts idents
- // (not paths).
- use libc::*;
-
- trait AsSyscallArg {
- type SyscallArgType;
- fn as_syscall_arg(self) -> Self::SyscallArgType;
- }
-
- // Pass pointer types as pointers, to preserve provenance.
- impl<T> AsSyscallArg for *mut T {
- type SyscallArgType = *mut T;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self }
- }
- impl<T> AsSyscallArg for *const T {
- type SyscallArgType = *const T;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self }
- }
-
- // Pass `BorrowedFd` values as the integer value.
- impl AsSyscallArg for $crate::fd::BorrowedFd<'_> {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType {
- $crate::fd::AsRawFd::as_raw_fd(&self) as _
- }
- }
-
- // Coerce integer values into `c_long`.
- impl AsSyscallArg for i32 {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
- impl AsSyscallArg for u32 {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
- impl AsSyscallArg for usize {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
-
- syscall(
- concat_idents!(SYS_, $name),
- $($arg_name.as_syscall_arg()),*
- ) as $ret
- }
- )
-}
-
-macro_rules! weakcall {
- ($vis:vis fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- $vis unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
- // interposition, but if it's not found just fail.
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- errno::set_errno(errno::Errno(libc::ENOSYS));
- -1
- }
- }
- )
-}
diff --git a/vendor/rustix/tests/path/arg.rs b/vendor/rustix/tests/path/arg.rs
deleted file mode 100644
index 0eb511be1..000000000
--- a/vendor/rustix/tests/path/arg.rs
+++ /dev/null
@@ -1,167 +0,0 @@
-use rustix::ffi::{CStr, CString};
-use rustix::io;
-use rustix::path::Arg;
-#[cfg(feature = "itoa")]
-use rustix::path::DecInt;
-use std::borrow::Cow;
-use std::ffi::{OsStr, OsString};
-use std::path::{Component, Components, Iter, Path, PathBuf};
-
-#[test]
-fn test_arg() {
- use rustix::cstr;
- use std::borrow::Borrow;
-
- let t: &str = "hello";
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: String = "hello".to_owned();
- assert_eq!("hello", Arg::as_str(&t).unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: &OsStr = OsStr::new("hello");
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: OsString = OsString::from("hello".to_owned());
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: &Path = Path::new("hello");
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: PathBuf = PathBuf::from("hello".to_owned());
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: &CStr = cstr!("hello");
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: CString = cstr!("hello").to_owned();
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(
- cstr!("hello"),
- Borrow::borrow(&Arg::as_cow_c_str(&t).unwrap())
- );
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Components = Path::new("hello").components();
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Component = Path::new("hello").components().next().unwrap();
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Iter = Path::new("hello").iter();
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Cow<'_, str> = Cow::Borrowed("hello");
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Cow<'_, str> = Cow::Owned("hello".to_owned());
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Cow<'_, OsStr> = Cow::Borrowed(OsStr::new("hello"));
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Cow<'_, OsStr> = Cow::Owned(OsString::from("hello".to_owned()));
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Cow<'_, CStr> = Cow::Borrowed(cstr!("hello"));
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Cow<'_, CStr> = Cow::Owned(cstr!("hello").to_owned());
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: &[u8] = b"hello";
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- let t: Vec<u8> = b"hello".to_vec();
- assert_eq!("hello", t.as_str().unwrap());
- assert_eq!("hello".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("hello"), Borrow::borrow(&t.into_c_str().unwrap()));
-
- #[cfg(feature = "itoa")]
- {
- let t: DecInt = DecInt::new(43110);
- assert_eq!("43110", t.as_str());
- assert_eq!("43110".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(cstr!("43110"), Borrow::borrow(&t.as_cow_c_str().unwrap()));
- assert_eq!(cstr!("43110"), t.as_c_str());
- assert_eq!(cstr!("43110"), Borrow::borrow(&t.into_c_str().unwrap()));
- }
-}
-
-#[test]
-fn test_invalid() {
- use std::borrow::Borrow;
-
- let t: &[u8] = b"hello\xc0world";
- assert_eq!(t.as_str().unwrap_err(), io::Errno::INVAL);
- assert_eq!("hello\u{fffd}world".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(
- b"hello\xc0world\0",
- Borrow::<CStr>::borrow(&t.as_cow_c_str().unwrap()).to_bytes_with_nul()
- );
- assert_eq!(
- b"hello\xc0world\0",
- Borrow::<CStr>::borrow(&t.into_c_str().unwrap()).to_bytes_with_nul()
- );
-}
-
-#[test]
-fn test_embedded_nul() {
- let t: &[u8] = b"hello\0world";
- assert_eq!("hello\0world", t.as_str().unwrap());
- assert_eq!("hello\0world".to_owned(), Arg::to_string_lossy(&t));
- assert_eq!(t.as_cow_c_str().unwrap_err(), io::Errno::INVAL);
- assert_eq!(t.into_c_str().unwrap_err(), io::Errno::INVAL);
-}
diff --git a/vendor/rustix/tests/path/dec_int.rs b/vendor/rustix/tests/path/dec_int.rs
deleted file mode 100644
index 6ce1a5123..000000000
--- a/vendor/rustix/tests/path/dec_int.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-use rustix::path::DecInt;
-
-#[test]
-fn test_dec_int() {
- assert_eq!(DecInt::new(0).as_ref().to_str().unwrap(), "0");
- assert_eq!(DecInt::new(-1).as_ref().to_str().unwrap(), "-1");
- assert_eq!(DecInt::new(789).as_ref().to_str().unwrap(), "789");
- assert_eq!(
- DecInt::new(i64::MIN).as_ref().to_str().unwrap(),
- i64::MIN.to_string()
- );
- assert_eq!(
- DecInt::new(i64::MAX).as_ref().to_str().unwrap(),
- i64::MAX.to_string()
- );
- assert_eq!(
- DecInt::new(u64::MAX).as_ref().to_str().unwrap(),
- u64::MAX.to_string()
- );
-}
diff --git a/vendor/rustix/tests/path/main.rs b/vendor/rustix/tests/path/main.rs
deleted file mode 100644
index 3215c7e5e..000000000
--- a/vendor/rustix/tests/path/main.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! Tests for [`rustix::path`].
-
-#![cfg(any(feature = "fs", feature = "net"))]
-#![cfg(not(windows))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg_attr(core_c_str, feature(core_c_str))]
-#![cfg_attr(alloc_c_string, feature(alloc_c_string))]
-
-#[cfg(not(feature = "rustc-dep-of-std"))]
-mod arg;
-#[cfg(feature = "itoa")]
-mod dec_int;
diff --git a/vendor/rustix/tests/process/cpu_set.rs b/vendor/rustix/tests/process/cpu_set.rs
deleted file mode 100644
index c4d9edf08..000000000
--- a/vendor/rustix/tests/process/cpu_set.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_cpu_set() {
- let set = rustix::process::sched_getaffinity(None).unwrap();
-
- let mut count = 0;
- for i in 0..rustix::process::CpuSet::MAX_CPU {
- if set.is_set(i) {
- count += 1;
- }
- }
-
- assert_eq!(count, set.count());
-}
diff --git a/vendor/rustix/tests/process/id.rs b/vendor/rustix/tests/process/id.rs
deleted file mode 100644
index 10095fa60..000000000
--- a/vendor/rustix/tests/process/id.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-use rustix::process;
-
-#[test]
-fn test_getuid() {
- assert_eq!(process::getuid(), process::getuid());
- unsafe {
- assert_eq!(process::getuid().as_raw(), libc::getuid());
- assert_eq!(process::getuid().is_root(), libc::getuid() == 0);
- }
-}
-
-#[test]
-fn test_getgid() {
- assert_eq!(process::getgid(), process::getgid());
- unsafe {
- assert_eq!(process::getgid().as_raw(), libc::getgid());
- assert_eq!(process::getgid().is_root(), libc::getgid() == 0);
- }
-}
-
-#[test]
-fn test_geteuid() {
- assert_eq!(process::geteuid(), process::geteuid());
- unsafe {
- assert_eq!(process::geteuid().as_raw(), libc::geteuid());
- assert_eq!(process::geteuid().is_root(), libc::geteuid() == 0);
- }
-}
-
-#[test]
-fn test_getegid() {
- assert_eq!(process::getegid(), process::getegid());
- unsafe {
- assert_eq!(process::getegid().as_raw(), libc::getegid());
- assert_eq!(process::getegid().is_root(), libc::getegid() == 0);
- }
-}
-
-#[test]
-fn test_getpid() {
- assert_eq!(process::getpid(), process::getpid());
- unsafe {
- assert_eq!(
- process::getpid().as_raw_nonzero().get() as libc::pid_t,
- libc::getpid()
- );
- assert_eq!(process::getpid().is_init(), libc::getpid() == 1);
- }
-}
-
-#[test]
-fn test_getppid() {
- assert_eq!(process::getppid(), process::getppid());
- unsafe {
- assert_eq!(
- process::Pid::as_raw(process::getppid()) as libc::pid_t,
- libc::getppid()
- );
- if let Some(ppid) = process::getppid() {
- assert_eq!(ppid.is_init(), libc::getppid() == 1);
- } else {
- assert_eq!(libc::getppid(), 0);
- }
- }
-}
diff --git a/vendor/rustix/tests/process/main.rs b/vendor/rustix/tests/process/main.rs
deleted file mode 100644
index 90aa34c59..000000000
--- a/vendor/rustix/tests/process/main.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-//! Tests for [`rustix::process`].
-
-#![cfg(feature = "process")]
-#![cfg(not(windows))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg_attr(core_c_str, feature(core_c_str))]
-
-#[cfg(not(target_os = "wasi"))]
-#[macro_use]
-mod weak;
-
-mod cpu_set;
-#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
-mod id;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-mod membarrier;
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] // WASI doesn't have [gs]etpriority.
-mod priority;
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
-mod rlimit;
-mod sched_yield;
-#[cfg(not(target_os = "wasi"))] // WASI doesn't have uname.
-mod uname;
-#[cfg(not(target_os = "wasi"))] // WASI doesn't have waitpid.
-mod wait;
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-mod working_directory;
diff --git a/vendor/rustix/tests/process/membarrier.rs b/vendor/rustix/tests/process/membarrier.rs
deleted file mode 100644
index ed9b00c1a..000000000
--- a/vendor/rustix/tests/process/membarrier.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-#[test]
-fn test_membarrier() {
- use rustix::process::{membarrier, membarrier_query, MembarrierCommand, MembarrierQuery};
-
- let query: MembarrierQuery = membarrier_query();
-
- // Supported registration commands should succeed.
- for cmd in [
- MembarrierCommand::RegisterGlobalExpedited,
- MembarrierCommand::RegisterPrivateExpedited,
- MembarrierCommand::RegisterPrivateExpeditedSyncCore,
- MembarrierCommand::RegisterPrivateExpeditedRseq,
- ]
- .iter()
- .copied()
- {
- if query.contains_command(cmd) {
- membarrier(cmd).unwrap();
- }
- }
-
- // All supported commands should now succeed, and all unsupported
- // commands should fail.
- for cmd in [
- MembarrierCommand::Global,
- MembarrierCommand::GlobalExpedited,
- MembarrierCommand::PrivateExpedited,
- MembarrierCommand::PrivateExpeditedSyncCore,
- MembarrierCommand::PrivateExpeditedRseq,
- ]
- .iter()
- .copied()
- {
- if query.contains_command(cmd) {
- membarrier(cmd).unwrap();
- } else {
- membarrier(cmd).unwrap_err();
- }
- }
-}
diff --git a/vendor/rustix/tests/process/priority.rs b/vendor/rustix/tests/process/priority.rs
deleted file mode 100644
index 7feb1467a..000000000
--- a/vendor/rustix/tests/process/priority.rs
+++ /dev/null
@@ -1,83 +0,0 @@
-use rustix::process::nice;
-#[cfg(not(target_os = "redox"))]
-use rustix::process::{getpriority_process, setpriority_process};
-
-#[cfg(not(target_os = "freebsd"))] // FreeBSD's nice(3) doesn't return the old value.
-#[test]
-fn test_priorities() {
- let old = nice(0).unwrap();
-
- #[cfg(not(target_os = "redox"))]
- {
- let get_prio = getpriority_process(None).unwrap();
- assert_eq!(get_prio, old);
- }
-
- // Lower the priority by one.
- let new = nice(1).unwrap();
-
- // If the test wasn't running with the lowest priority initially, test that
- // we were able to lower the priority.
- if old < 19 {
- assert_eq!(old + 1, new);
- }
-
- let get = nice(0).unwrap();
- assert_eq!(new, get);
-
- #[cfg(not(target_os = "redox"))]
- {
- let get_prio = getpriority_process(None).unwrap();
- assert_eq!(get_prio, new);
-
- setpriority_process(None, get + 1).unwrap();
- let now = getpriority_process(None).unwrap();
-
- // If the test wasn't running with the lowest priority initially, test
- // that we were able to lower the priority.
- if get < 19 {
- assert_eq!(get + 1, now);
- }
- setpriority_process(None, get + 10000).unwrap();
- let now = getpriority_process(None).unwrap();
- // Linux's max is 19; Darwin's max is 20.
- assert!(now >= 19 && now <= 20);
- // Darwin appears to return `EPERM` on an out of range `nice`.
- if let Ok(again) = nice(1) {
- assert_eq!(now, again);
- }
- }
-}
-
-/// FreeBSD's `nice` doesn't return the new nice value, so use a specialized
-/// test.
-#[cfg(target_os = "freebsd")]
-#[test]
-fn test_priorities() {
- let start = getpriority_process(None).unwrap();
-
- let _ = nice(0).unwrap();
-
- let now = getpriority_process(None).unwrap();
- assert_eq!(start, now);
-
- let _ = nice(1).unwrap();
-
- let now = getpriority_process(None).unwrap();
- assert_eq!(start + 1, now);
-
- setpriority_process(None, start + 2).unwrap();
-
- let now = getpriority_process(None).unwrap();
- assert_eq!(start + 2, now);
-
- setpriority_process(None, 10000).unwrap();
-
- let now = getpriority_process(None).unwrap();
- assert_eq!(now, 20);
-
- let _ = nice(1).unwrap();
-
- let now = getpriority_process(None).unwrap();
- assert_eq!(now, 20);
-}
diff --git a/vendor/rustix/tests/process/proc.rs b/vendor/rustix/tests/process/proc.rs
deleted file mode 100644
index e85d85883..000000000
--- a/vendor/rustix/tests/process/proc.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-#[test]
-fn test_proc_funcs() {
- let _maps = rustix::io::proc_self_maps().unwrap();
- let _pagemap = rustix::io::proc_self_pagemap().unwrap();
-}
diff --git a/vendor/rustix/tests/process/rlimit.rs b/vendor/rustix/tests/process/rlimit.rs
deleted file mode 100644
index b01f9204c..000000000
--- a/vendor/rustix/tests/process/rlimit.rs
+++ /dev/null
@@ -1,51 +0,0 @@
-use rustix::process::{Resource, Rlimit};
-
-#[test]
-fn test_getrlimit() {
- let lim = rustix::process::getrlimit(Resource::Stack);
- assert_ne!(lim.current, Some(0));
- assert_ne!(lim.maximum, Some(0));
-}
-
-#[test]
-fn test_setrlimit() {
- let old = rustix::process::getrlimit(Resource::Core);
- let new = Rlimit {
- current: Some(0),
- maximum: Some(4096),
- };
- assert_ne!(old, new);
- rustix::process::setrlimit(Resource::Core, new.clone()).unwrap();
-
- let lim = rustix::process::getrlimit(Resource::Core);
- assert_eq!(lim, new);
-
- #[cfg(any(target_os = "android", target_os = "linux"))]
- {
- let new = Rlimit {
- current: Some(0),
- maximum: Some(0),
- };
-
- let first = rustix::process::getrlimit(Resource::Core);
-
- let old = match rustix::process::prlimit(None, Resource::Core, new.clone()) {
- Ok(rlimit) => rlimit,
- Err(rustix::io::Errno::NOSYS) => return,
- Err(e) => Err(e).unwrap(),
- };
-
- assert_eq!(first, old);
-
- let other = Rlimit {
- current: Some(0),
- maximum: Some(0),
- };
-
- let again =
- rustix::process::prlimit(Some(rustix::process::getpid()), Resource::Core, other)
- .unwrap();
-
- assert_eq!(again, new);
- }
-}
diff --git a/vendor/rustix/tests/process/sched_yield.rs b/vendor/rustix/tests/process/sched_yield.rs
deleted file mode 100644
index eacf17d5e..000000000
--- a/vendor/rustix/tests/process/sched_yield.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use rustix::process::sched_yield;
-
-#[test]
-fn test_sched_yield() {
- // Just make sure we can call it.
- sched_yield();
-}
diff --git a/vendor/rustix/tests/process/uname.rs b/vendor/rustix/tests/process/uname.rs
deleted file mode 100644
index bc944c49e..000000000
--- a/vendor/rustix/tests/process/uname.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#[test]
-fn test_uname() {
- let name: rustix::process::Uname = rustix::process::uname();
-
- assert!(!name.sysname().to_bytes().is_empty());
- assert!(!name.nodename().to_bytes().is_empty());
- assert!(!name.release().to_bytes().is_empty());
- assert!(!name.version().to_bytes().is_empty());
- assert!(!name.machine().to_bytes().is_empty());
-
- #[cfg(any(target_os = "android", target_os = "linux"))]
- assert!(!name.domainname().to_bytes().is_empty());
-}
diff --git a/vendor/rustix/tests/process/wait.rs b/vendor/rustix/tests/process/wait.rs
deleted file mode 100644
index a1f25a631..000000000
--- a/vendor/rustix/tests/process/wait.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-use libc::{kill, SIGSTOP};
-use rustix::process;
-use serial_test::serial;
-use std::process::{Command, Stdio};
-
-// These tests must execute serially to prevent race condition, where
-// `test_wait` waits for the child process spawned in `test_waitpid`, causing
-// the tests to get stuck.
-
-#[test]
-#[serial]
-fn test_waitpid() {
- let child = Command::new("yes")
- .stdout(Stdio::null())
- .stderr(Stdio::null())
- .spawn()
- .expect("failed to execute child");
- unsafe { kill(child.id() as _, SIGSTOP) };
-
- let pid = unsafe { process::Pid::from_raw(child.id() as _) };
- let status = process::waitpid(pid, process::WaitOptions::UNTRACED)
- .expect("failed to wait")
- .unwrap();
- assert!(status.stopped());
-}
diff --git a/vendor/rustix/tests/process/weak.rs b/vendor/rustix/tests/process/weak.rs
deleted file mode 100644
index d4f00f999..000000000
--- a/vendor/rustix/tests/process/weak.rs
+++ /dev/null
@@ -1,201 +0,0 @@
-// Implementation derived from `weak` in Rust's
-// library/std/src/sys/unix/weak.rs at revision
-// fd0cb0cdc21dd9c06025277d772108f8d42cb25f.
-
-//! Support for "weak linkage" to symbols on Unix
-//!
-//! Some I/O operations we do in libstd require newer versions of OSes but we
-//! need to maintain binary compatibility with older releases for now. In order
-//! to use the new functionality when available we use this module for
-//! detection.
-//!
-//! One option to use here is weak linkage, but that is unfortunately only
-//! really workable on Linux. Hence, use dlsym to get the symbol value at
-//! runtime. This is also done for compatibility with older versions of glibc,
-//! and to avoid creating dependencies on `GLIBC_PRIVATE` symbols. It assumes
-//! that we've been dynamically linked to the library the symbol comes from,
-//! but that is currently always the case for things like libpthread/libc.
-//!
-//! A long time ago this used weak linkage for the `__pthread_get_minstack`
-//! symbol, but that caused Debian to detect an unnecessarily strict versioned
-//! dependency on libc6 (#23628).
-
-// There are a variety of `#[cfg]`s controlling which targets are involved in
-// each instance of `weak!` and `syscall!`. Rather than trying to unify all of
-// that, we'll just allow that some unix targets don't use this module at all.
-#![allow(dead_code, unused_macros)]
-#![allow(clippy::doc_markdown)]
-
-use core::ffi::c_void;
-use core::ptr::null_mut;
-use core::sync::atomic::{self, AtomicPtr, Ordering};
-use core::{marker, mem};
-use rustix::ffi::CStr;
-
-const NULL: *mut c_void = null_mut();
-const INVALID: *mut c_void = 1 as *mut c_void;
-
-macro_rules! weak {
- (fn $name:ident($($t:ty),*) -> $ret:ty) => (
- #[allow(non_upper_case_globals)]
- static $name: $crate::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
- $crate::weak::Weak::new(concat!(stringify!($name), '\0'));
- )
-}
-
-pub(crate) struct Weak<F> {
- name: &'static str,
- addr: AtomicPtr<c_void>,
- _marker: marker::PhantomData<F>,
-}
-
-impl<F> Weak<F> {
- pub(crate) const fn new(name: &'static str) -> Self {
- Self {
- name,
- addr: AtomicPtr::new(INVALID),
- _marker: marker::PhantomData,
- }
- }
-
- pub(crate) fn get(&self) -> Option<F> {
- assert_eq!(mem::size_of::<F>(), mem::size_of::<usize>());
- unsafe {
- // Relaxed is fine here because we fence before reading through the
- // pointer (see the comment below).
- match self.addr.load(Ordering::Relaxed) {
- INVALID => self.initialize(),
- NULL => None,
- addr => {
- let func = mem::transmute_copy::<*mut c_void, F>(&addr);
- // The caller is presumably going to read through this value
- // (by calling the function we've dlsymed). This means we'd
- // need to have loaded it with at least C11's consume
- // ordering in order to be guaranteed that the data we read
- // from the pointer isn't from before the pointer was
- // stored. Rust has no equivalent to memory_order_consume,
- // so we use an acquire fence (sorry, ARM).
- //
- // Now, in practice this likely isn't needed even on CPUs
- // where relaxed and consume mean different things. The
- // symbols we're loading are probably present (or not) at
- // init, and even if they aren't the runtime dynamic loader
- // is extremely likely have sufficient barriers internally
- // (possibly implicitly, for example the ones provided by
- // invoking `mprotect`).
- //
- // That said, none of that's *guaranteed*, and so we fence.
- atomic::fence(Ordering::Acquire);
- Some(func)
- }
- }
- }
- }
-
- // Cold because it should only happen during first-time initialization.
- #[cold]
- unsafe fn initialize(&self) -> Option<F> {
- let val = fetch(self.name);
- // This synchronizes with the acquire fence in `get`.
- self.addr.store(val, Ordering::Release);
-
- match val {
- NULL => None,
- addr => Some(mem::transmute_copy::<*mut c_void, F>(&addr)),
- }
- }
-}
-
-unsafe fn fetch(name: &str) -> *mut c_void {
- let name = match CStr::from_bytes_with_nul(name.as_bytes()) {
- Ok(c_str) => c_str,
- Err(..) => return null_mut(),
- };
- libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr().cast())
-}
-
-#[cfg(not(any(target_os = "android", target_os = "linux")))]
-macro_rules! syscall {
- (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- errno::set_errno(errno::Errno(libc::ENOSYS));
- -1
- }
- }
- )
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-macro_rules! syscall {
- (fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- unsafe fn $name($($arg_name:$t),*) -> $ret {
- // This looks like a hack, but concat_idents only accepts idents
- // (not paths).
- use libc::*;
-
- trait AsSyscallArg {
- type SyscallArgType;
- fn as_syscall_arg(self) -> Self::SyscallArgType;
- }
-
- // Pass pointer types as pointers, to preserve provenance.
- impl<T> AsSyscallArg for *mut T {
- type SyscallArgType = *mut T;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self }
- }
- impl<T> AsSyscallArg for *const T {
- type SyscallArgType = *const T;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self }
- }
-
- // Pass `BorrowedFd` values as the integer value.
- impl AsSyscallArg for $crate::fd::BorrowedFd<'_> {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType {
- $crate::fd::AsRawFd::as_raw_fd(&self) as _
- }
- }
-
- // Coerce integer values into `c_long`.
- impl AsSyscallArg for i32 {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
- impl AsSyscallArg for u32 {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
- impl AsSyscallArg for usize {
- type SyscallArgType = c::c_long;
- fn as_syscall_arg(self) -> Self::SyscallArgType { self as _ }
- }
-
- syscall(
- concat_idents!(SYS_, $name),
- $($arg_name.as_syscall_arg()),*
- ) as $ret
- }
- )
-}
-
-macro_rules! weakcall {
- ($vis:vis fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
- $vis unsafe fn $name($($arg_name: $t),*) -> $ret {
- weak! { fn $name($($t),*) -> $ret }
-
- // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
- // interposition, but if it's not found just fail.
- if let Some(fun) = $name.get() {
- fun($($arg_name),*)
- } else {
- errno::set_errno(errno::Errno(libc::ENOSYS));
- -1
- }
- }
- )
-}
diff --git a/vendor/rustix/tests/process/working_directory.rs b/vendor/rustix/tests/process/working_directory.rs
deleted file mode 100644
index 1c3262bb9..000000000
--- a/vendor/rustix/tests/process/working_directory.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-#![cfg(feature = "fs")]
-
-#[cfg(not(target_os = "macos"))]
-use rustix::fs::{Mode, OFlags};
-use tempfile::{tempdir, TempDir};
-
-#[allow(unused)]
-fn tmpdir() -> TempDir {
- tempdir().expect("expected to be able to create a temporary directory")
-}
-
-/// Disable this test on macos because GHA has a weird system folder structure
-/// that makes this test fail.
-#[cfg(not(target_os = "macos"))]
-#[test]
-fn test_changing_working_directory() {
- let tmpdir = tmpdir();
-
- let orig_cwd = rustix::process::getcwd(Vec::new()).expect("get the cwd");
- let orig_fd_cwd = rustix::fs::openat(rustix::fs::cwd(), ".", OFlags::RDONLY, Mode::empty())
- .expect("get a fd for the current directory");
-
- rustix::process::chdir(tmpdir.path()).expect("changing dir to the tmp");
- let ch1_cwd = rustix::process::getcwd(Vec::new()).expect("get the cwd");
-
- assert_ne!(orig_cwd, ch1_cwd, "The cwd hasn't changed!");
- assert_eq!(
- ch1_cwd.to_string_lossy(),
- tmpdir.path().to_string_lossy(),
- "The cwd is not the same as the tmpdir"
- );
-
- #[cfg(not(target_os = "fuchsia"))]
- rustix::process::fchdir(orig_fd_cwd).expect("changing dir to the original");
- #[cfg(target_os = "fushcia")]
- rustix::process::chdir(orig_cwd).expect("changing dir to the original");
- let ch2_cwd = rustix::process::getcwd(ch1_cwd).expect("get the cwd");
-
- assert_eq!(
- orig_cwd, ch2_cwd,
- "The cwd wasn't changed back to the its original position"
- );
-}
diff --git a/vendor/rustix/tests/rand/getrandom.rs b/vendor/rustix/tests/rand/getrandom.rs
deleted file mode 100644
index ac316e447..000000000
--- a/vendor/rustix/tests/rand/getrandom.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use rustix::rand::{getrandom, GetRandomFlags};
-
-#[test]
-fn test_getrandom() {
- let mut buf = [0_u8; 256];
- let _ = getrandom(&mut buf, GetRandomFlags::empty());
-}
diff --git a/vendor/rustix/tests/rand/main.rs b/vendor/rustix/tests/rand/main.rs
deleted file mode 100644
index 9dac8027f..000000000
--- a/vendor/rustix/tests/rand/main.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//! Tests for [`rustix::rand`].
-
-#![cfg(feature = "rand")]
-#![cfg(not(windows))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
-mod getrandom;
diff --git a/vendor/rustix/tests/termios/isatty.rs b/vendor/rustix/tests/termios/isatty.rs
deleted file mode 100644
index 5e6fae73d..000000000
--- a/vendor/rustix/tests/termios/isatty.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-use rustix::fd::AsRawFd;
-use rustix::termios::{isatty, tcgetwinsize};
-use tempfile::{tempdir, TempDir};
-
-#[allow(unused)]
-fn tmpdir() -> TempDir {
- tempdir().expect("expected to be able to create a temporary directory")
-}
-
-#[test]
-fn std_file_is_not_terminal() {
- let tmpdir = tempfile::tempdir().unwrap();
- assert!(!isatty(
- &std::fs::File::create(tmpdir.path().join("file")).unwrap()
- ));
- assert!(!isatty(
- &std::fs::File::open(tmpdir.path().join("file")).unwrap()
- ));
-}
-
-#[test]
-fn stdout_stderr_terminals() {
- // This test is flaky under qemu.
- if std::env::vars().any(|var| var.0.starts_with("CARGO_TARGET_") && var.0.ends_with("_RUNNER"))
- {
- return;
- }
-
- // Compare `isatty` against `libc::isatty`.
- assert_eq!(isatty(&std::io::stdout()), unsafe {
- libc::isatty(std::io::stdout().as_raw_fd()) != 0
- });
- assert_eq!(isatty(&std::io::stderr()), unsafe {
- libc::isatty(std::io::stderr().as_raw_fd()) != 0
- });
-
- // Compare `isatty` against `tcgetwinsize`.
- assert_eq!(
- isatty(&std::io::stdout()),
- tcgetwinsize(&std::io::stdout()).is_ok()
- );
- assert_eq!(
- isatty(&std::io::stderr()),
- tcgetwinsize(&std::io::stderr()).is_ok()
- );
-}
-
-#[test]
-fn stdio_descriptors() {
- #[cfg(unix)]
- use std::os::unix::io::AsRawFd;
- #[cfg(target_os = "wasi")]
- use std::os::wasi::io::AsRawFd;
-
- unsafe {
- assert_eq!(
- rustix::io::stdin().as_raw_fd(),
- std::io::stdin().as_raw_fd()
- );
- assert_eq!(
- rustix::io::stdout().as_raw_fd(),
- std::io::stdout().as_raw_fd()
- );
- assert_eq!(
- rustix::io::stderr().as_raw_fd(),
- std::io::stderr().as_raw_fd()
- );
- }
-}
diff --git a/vendor/rustix/tests/termios/main.rs b/vendor/rustix/tests/termios/main.rs
deleted file mode 100644
index d9ad9338b..000000000
--- a/vendor/rustix/tests/termios/main.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//! Tests for [`rustix::termios`].
-
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-#![cfg(feature = "termios")]
-
-#[cfg(not(windows))]
-mod isatty;
-#[cfg(not(windows))]
-mod ttyname;
diff --git a/vendor/rustix/tests/termios/ttyname.rs b/vendor/rustix/tests/termios/ttyname.rs
deleted file mode 100644
index 636178c31..000000000
--- a/vendor/rustix/tests/termios/ttyname.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-use rustix::io;
-use rustix::termios::{isatty, ttyname};
-use std::fs::File;
-
-#[test]
-fn test_ttyname_ok() {
- let file = File::open("/dev/stdin").unwrap();
- if isatty(&file) {
- assert!(ttyname(&file, Vec::new())
- .unwrap()
- .into_string()
- .unwrap()
- .starts_with("/dev/"));
- }
-}
-
-#[test]
-fn test_ttyname_not_tty() {
- let file = File::open("Cargo.toml").unwrap();
- assert_eq!(ttyname(&file, Vec::new()).unwrap_err(), io::Errno::NOTTY);
-
- let file = File::open("/dev/null").unwrap();
- assert_eq!(ttyname(&file, Vec::new()).unwrap_err(), io::Errno::NOTTY);
-}
diff --git a/vendor/rustix/tests/thread/clocks.rs b/vendor/rustix/tests/thread/clocks.rs
deleted file mode 100644
index cf14df777..000000000
--- a/vendor/rustix/tests/thread/clocks.rs
+++ /dev/null
@@ -1,212 +0,0 @@
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-use rustix::thread::{clock_nanosleep_absolute, clock_nanosleep_relative, ClockId};
-#[cfg(not(target_os = "redox"))]
-use {
- rustix::io,
- rustix::thread::{nanosleep, NanosleepRelativeResult, Timespec},
-};
-
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_invalid_nanosleep() {
- match nanosleep(&Timespec {
- tv_sec: 0,
- tv_nsec: 1_000_000_000,
- }) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match nanosleep(&Timespec {
- tv_sec: 0,
- tv_nsec: !0,
- }) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match nanosleep(&Timespec {
- tv_sec: !0,
- tv_nsec: 1_000_000_000,
- }) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match nanosleep(&Timespec {
- tv_sec: !0,
- tv_nsec: !0,
- }) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
-}
-
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-#[test]
-fn test_invalid_nanosleep_absolute() {
- match clock_nanosleep_absolute(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: 0,
- tv_nsec: 1000000000,
- },
- ) {
- Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match clock_nanosleep_absolute(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: 0,
- tv_nsec: !0,
- },
- ) {
- Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match clock_nanosleep_absolute(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: !0,
- tv_nsec: 1_000_000_000,
- },
- ) {
- Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match clock_nanosleep_absolute(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: !0,
- tv_nsec: !0,
- },
- ) {
- Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
-}
-
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-#[test]
-fn test_invalid_nanosleep_relative() {
- match clock_nanosleep_relative(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: 0,
- tv_nsec: 1_000_000_000,
- },
- ) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match clock_nanosleep_relative(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: 0,
- tv_nsec: !0,
- },
- ) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match clock_nanosleep_relative(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: !0,
- tv_nsec: 1_000_000_000,
- },
- ) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
- match clock_nanosleep_relative(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: !0,
- tv_nsec: !0,
- },
- ) {
- NanosleepRelativeResult::Err(io::Errno::INVAL) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
-}
-
-#[cfg(not(target_os = "redox"))]
-#[test]
-fn test_zero_nanosleep() {
- match nanosleep(&Timespec {
- tv_sec: 0,
- tv_nsec: 0,
- }) {
- NanosleepRelativeResult::Ok => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
-}
-
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-#[test]
-fn test_zero_nanosleep_absolute() {
- match clock_nanosleep_absolute(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: 0,
- tv_nsec: 0,
- },
- ) {
- Ok(()) => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
-}
-
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-#[test]
-fn test_zero_nanosleep_relative() {
- match clock_nanosleep_relative(
- ClockId::Monotonic,
- &Timespec {
- tv_sec: 0,
- tv_nsec: 0,
- },
- ) {
- NanosleepRelativeResult::Ok => (),
- otherwise => panic!("unexpected resut: {:?}", otherwise),
- }
-}
diff --git a/vendor/rustix/tests/thread/id.rs b/vendor/rustix/tests/thread/id.rs
deleted file mode 100644
index 7aa5abba5..000000000
--- a/vendor/rustix/tests/thread/id.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-use rustix::thread;
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_gettid() {
- assert_eq!(thread::gettid(), thread::gettid());
-}
diff --git a/vendor/rustix/tests/thread/main.rs b/vendor/rustix/tests/thread/main.rs
deleted file mode 100644
index 0fc9b42c4..000000000
--- a/vendor/rustix/tests/thread/main.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//! Tests for [`rustix::thread`].
-
-#![cfg(feature = "thread")]
-#![cfg(not(windows))]
-
-#[cfg(not(any(target_os = "redox")))]
-mod clocks;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-mod id;
diff --git a/vendor/rustix/tests/time/dynamic_clocks.rs b/vendor/rustix/tests/time/dynamic_clocks.rs
deleted file mode 100644
index a7e1e6792..000000000
--- a/vendor/rustix/tests/time/dynamic_clocks.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-#![cfg(not(any(target_os = "redox", target_os = "wasi")))]
-
-use rustix::fd::AsFd;
-use rustix::time::{clock_gettime_dynamic, ClockId, DynamicClockId};
-
-#[test]
-fn test_known_clocks() {
- clock_gettime_dynamic(DynamicClockId::Known(ClockId::Realtime)).unwrap();
- clock_gettime_dynamic(DynamicClockId::Known(ClockId::Monotonic)).unwrap();
-}
-
-#[test]
-fn test_dynamic_clocks() {
- let file = std::fs::File::open("Cargo.toml").unwrap();
- clock_gettime_dynamic(DynamicClockId::Dynamic(file.as_fd())).unwrap_err();
-}
-
-#[cfg(any(target_os = "android", target_os = "linux"))]
-#[test]
-fn test_conditional_clocks() {
- let _ = clock_gettime_dynamic(DynamicClockId::Tai);
-}
diff --git a/vendor/rustix/tests/time/main.rs b/vendor/rustix/tests/time/main.rs
deleted file mode 100644
index 43283bca2..000000000
--- a/vendor/rustix/tests/time/main.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//! Tests for [`rustix::time`].
-
-#![cfg(feature = "time")]
-#![cfg(not(windows))]
-#![cfg_attr(target_os = "wasi", feature(wasi_ext))]
-#![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
-
-mod dynamic_clocks;
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-mod monotonic;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-mod timerfd;
-mod timespec;
-mod y2038;
diff --git a/vendor/rustix/tests/time/monotonic.rs b/vendor/rustix/tests/time/monotonic.rs
deleted file mode 100644
index 89470f2b4..000000000
--- a/vendor/rustix/tests/time/monotonic.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#[cfg(feature = "thread")]
-use rustix::thread::nanosleep;
-use rustix::time::{clock_gettime, ClockId, Timespec};
-
-/// Attempt to test that the monotonic clock is monotonic. Time may or may not
-/// advance, but it shouldn't regress.
-#[test]
-fn test_monotonic_clock() {
- let a = clock_gettime(ClockId::Monotonic);
- let b = clock_gettime(ClockId::Monotonic);
- if b.tv_sec == a.tv_sec {
- assert!(b.tv_nsec >= a.tv_nsec);
- } else {
- assert!(b.tv_sec > a.tv_sec);
- }
-}
-
-/// With the "thread" feature, we can sleep so that we're guaranteed that time
-/// has advanced.
-#[cfg(feature = "thread")]
-#[test]
-fn test_monotonic_clock_with_sleep_1s() {
- let a = clock_gettime(ClockId::Monotonic);
- let _rem = nanosleep(&Timespec {
- tv_sec: 1,
- tv_nsec: 0,
- });
- let b = clock_gettime(ClockId::Monotonic);
- assert!(b.tv_sec > a.tv_sec);
-}
-
-/// With the "thread" feature, we can sleep so that we're guaranteed that time
-/// has advanced.
-#[cfg(feature = "thread")]
-#[test]
-fn test_monotonic_clock_with_sleep_1ms() {
- let a = clock_gettime(ClockId::Monotonic);
- let _rem = nanosleep(&Timespec {
- tv_sec: 0,
- tv_nsec: 1_000_000,
- });
- let b = clock_gettime(ClockId::Monotonic);
- assert!(b.tv_sec >= a.tv_sec);
- assert!(b.tv_sec != a.tv_sec || b.tv_nsec > a.tv_nsec);
-}
diff --git a/vendor/rustix/tests/time/timerfd.rs b/vendor/rustix/tests/time/timerfd.rs
deleted file mode 100644
index 6ad4dd72e..000000000
--- a/vendor/rustix/tests/time/timerfd.rs
+++ /dev/null
@@ -1,75 +0,0 @@
-use rustix::time::{
- timerfd_create, timerfd_gettime, timerfd_settime, Itimerspec, TimerfdClockId, TimerfdFlags,
- TimerfdTimerFlags, Timespec,
-};
-
-#[test]
-fn test_timerfd() {
- let fd = timerfd_create(TimerfdClockId::Monotonic, TimerfdFlags::CLOEXEC).unwrap();
-
- let set = Itimerspec {
- it_interval: Timespec {
- tv_sec: 0,
- tv_nsec: 0,
- },
- it_value: Timespec {
- tv_sec: 1,
- tv_nsec: 2,
- },
- };
- let _old: Itimerspec = timerfd_settime(&fd, TimerfdTimerFlags::ABSTIME, &set).unwrap();
-
- // Wait for the timer to expire.
- let mut buf = [0_u8; 8];
- assert_eq!(rustix::io::read(&fd, &mut buf), Ok(8));
- assert!(u64::from_ne_bytes(buf) >= 1);
-
- let new = timerfd_gettime(&fd).unwrap();
-
- // The timer counts down.
- assert_eq!(set.it_interval.tv_sec, new.it_interval.tv_sec);
- assert_eq!(set.it_interval.tv_nsec, new.it_interval.tv_nsec);
- assert!(new.it_value.tv_sec <= set.it_value.tv_sec);
- assert!(
- new.it_value.tv_nsec < set.it_value.tv_nsec || new.it_value.tv_sec < set.it_value.tv_sec
- );
-}
-
-/// Similar, but set an interval for a repeated timer. Don't check that the
-/// times are monotonic because that would race with the timer repeating.
-#[test]
-fn test_timerfd_with_interval() {
- let fd = timerfd_create(TimerfdClockId::Monotonic, TimerfdFlags::CLOEXEC).unwrap();
-
- let set = Itimerspec {
- it_interval: Timespec {
- tv_sec: 0,
- tv_nsec: 6,
- },
- it_value: Timespec {
- tv_sec: 1,
- tv_nsec: 7,
- },
- };
- let _old: Itimerspec = timerfd_settime(&fd, TimerfdTimerFlags::ABSTIME, &set).unwrap();
-
- // Wait for the timer to expire.
- let mut buf = [0_u8; 8];
- assert_eq!(rustix::io::read(&fd, &mut buf), Ok(8));
- assert!(u64::from_ne_bytes(buf) >= 1);
-
- let new = timerfd_gettime(&fd).unwrap();
-
- assert_eq!(set.it_interval.tv_sec, new.it_interval.tv_sec);
- assert_eq!(set.it_interval.tv_nsec, new.it_interval.tv_nsec);
-
- // Wait for the timer to expire again.
- let mut buf = [0_u8; 8];
- assert_eq!(rustix::io::read(&fd, &mut buf), Ok(8));
- assert!(u64::from_ne_bytes(buf) >= 1);
-
- let new = timerfd_gettime(&fd).unwrap();
-
- assert_eq!(set.it_interval.tv_sec, new.it_interval.tv_sec);
- assert_eq!(set.it_interval.tv_nsec, new.it_interval.tv_nsec);
-}
diff --git a/vendor/rustix/tests/time/timespec.rs b/vendor/rustix/tests/time/timespec.rs
deleted file mode 100644
index 6d892dcfe..000000000
--- a/vendor/rustix/tests/time/timespec.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-#[test]
-fn test_timespec_layout() {
- #[cfg(not(target_os = "redox"))]
- use rustix::fs::{UTIME_NOW, UTIME_OMIT};
- use rustix::time::{Nsecs, Secs, Timespec};
-
- let tv_sec: Secs = 0;
- let tv_nsec: Nsecs = 0;
- let _ = Timespec { tv_sec, tv_nsec };
-
- #[cfg(not(target_os = "redox"))]
- let _ = Timespec {
- tv_sec,
- tv_nsec: UTIME_NOW,
- };
- #[cfg(not(target_os = "redox"))]
- let _ = Timespec {
- tv_sec,
- tv_nsec: UTIME_OMIT,
- };
- let _ = Timespec { tv_sec, tv_nsec: 0 };
- let _ = Timespec {
- tv_sec,
- tv_nsec: 999_999_999,
- };
-}
diff --git a/vendor/rustix/tests/time/y2038.rs b/vendor/rustix/tests/time/y2038.rs
deleted file mode 100644
index 45a073d19..000000000
--- a/vendor/rustix/tests/time/y2038.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-/// Test that `Timespec` and `Secs` support a 64-bit number of seconds,
-/// avoiding the y2038 bug.
-///
-/// The Rust Musl target and libc crate are currently using Musl 1.1. It is
-/// expected to update to Musl 1.2 at some point, at which point it'll gain a
-/// 64-bit `time_t`.
-///
-/// 32-bit Android is [not y2038 compatible]. In theory we could use
-/// `libc::syscall` and call the new syscalls ourselves, however that doesn't
-/// seem worth the effort on a platform that will likely never support add
-/// such support itself.
-///
-/// [not y2038 compatible]: https://android.googlesource.com/platform/bionic/+/refs/heads/master/docs/32-bit-abi.md#is-32_bit-on-lp32-y2038
-#[cfg(not(all(target_env = "musl", target_pointer_width = "32")))]
-#[cfg(not(all(target_os = "android", target_pointer_width = "32")))]
-#[cfg(not(all(target_os = "emscripten", target_pointer_width = "32")))]
-#[test]
-fn test_y2038() {
- use rustix::time::{Secs, Timespec};
-
- let tv_sec: i64 = 0;
- let _ = Timespec { tv_sec, tv_nsec: 0 };
- let _: Secs = tv_sec;
-
- #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
- {
- use rustix::time::Itimerspec;
-
- let _ = Itimerspec {
- it_interval: Timespec { tv_sec, tv_nsec: 0 },
- it_value: Timespec { tv_sec, tv_nsec: 0 },
- };
- }
-}
-
-#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
-#[test]
-fn test_y2038_with_timerfd() {
- use rustix::time::{
- timerfd_create, timerfd_gettime, timerfd_settime, Itimerspec, TimerfdClockId, TimerfdFlags,
- TimerfdTimerFlags, Timespec,
- };
-
- let fd = timerfd_create(TimerfdClockId::Monotonic, TimerfdFlags::CLOEXEC).unwrap();
-
- let set = Itimerspec {
- it_interval: Timespec {
- tv_sec: (1_u64 << 32) as _,
- tv_nsec: 20,
- },
- it_value: Timespec {
- tv_sec: (1_u64 << 32) as _,
- tv_nsec: 21,
- },
- };
- let _old: Itimerspec = match timerfd_settime(&fd, TimerfdTimerFlags::ABSTIME, &set) {
- Ok(i) => i,
-
- // On 32-bit and mips64 platforms, accept `EOVERFLOW`, meaning that
- // y2038 support in `timerfd` APIs is not available on this platform
- // or this version of the platform.
- #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
- Err(rustix::io::Errno::OVERFLOW) => return,
-
- Err(e) => panic!("unexpected error: {:?}", e),
- };
-
- let new = timerfd_gettime(&fd).unwrap();
-
- // The timer counts down.
- assert_eq!(set.it_interval.tv_sec, new.it_interval.tv_sec);
- assert_eq!(set.it_interval.tv_nsec, new.it_interval.tv_nsec);
- assert!(new.it_value.tv_sec <= set.it_value.tv_sec);
- assert!(
- new.it_value.tv_nsec < set.it_value.tv_nsec || new.it_value.tv_sec < set.it_value.tv_sec
- );
-}