summaryrefslogtreecommitdiffstats
path: root/vendor/rustix
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /vendor/rustix
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix')
-rw-r--r--vendor/rustix/.cargo-checksum.json2
-rw-r--r--vendor/rustix/Cargo.toml31
-rw-r--r--vendor/rustix/README.md7
-rw-r--r--vendor/rustix/benches/mod.rs32
-rw-r--r--vendor/rustix/build.rs15
-rw-r--r--vendor/rustix/src/backend/libc/c.rs21
-rw-r--r--vendor/rustix/src/backend/libc/conv.rs11
-rw-r--r--vendor/rustix/src/backend/libc/event/epoll.rs26
-rw-r--r--vendor/rustix/src/backend/libc/event/mod.rs2
-rw-r--r--vendor/rustix/src/backend/libc/event/poll_fd.rs9
-rw-r--r--vendor/rustix/src/backend/libc/event/syscalls.rs26
-rw-r--r--vendor/rustix/src/backend/libc/event/types.rs22
-rw-r--r--vendor/rustix/src/backend/libc/fs/inotify.rs31
-rw-r--r--vendor/rustix/src/backend/libc/fs/makedev.rs12
-rw-r--r--vendor/rustix/src/backend/libc/fs/mod.rs10
-rw-r--r--vendor/rustix/src/backend/libc/fs/syscalls.rs111
-rw-r--r--vendor/rustix/src/backend/libc/fs/types.rs97
-rw-r--r--vendor/rustix/src/backend/libc/io/errno.rs28
-rw-r--r--vendor/rustix/src/backend/libc/io/syscalls.rs57
-rw-r--r--vendor/rustix/src/backend/libc/io/types.rs9
-rw-r--r--vendor/rustix/src/backend/libc/io/windows_syscalls.rs29
-rw-r--r--vendor/rustix/src/backend/libc/mm/types.rs39
-rw-r--r--vendor/rustix/src/backend/libc/mount/types.rs31
-rw-r--r--vendor/rustix/src/backend/libc/net/addr.rs32
-rw-r--r--vendor/rustix/src/backend/libc/net/ext.rs17
-rw-r--r--vendor/rustix/src/backend/libc/net/msghdr.rs23
-rw-r--r--vendor/rustix/src/backend/libc/net/read_sockaddr.rs24
-rw-r--r--vendor/rustix/src/backend/libc/net/send_recv.rs19
-rw-r--r--vendor/rustix/src/backend/libc/net/syscalls.rs106
-rw-r--r--vendor/rustix/src/backend/libc/net/write_sockaddr.rs28
-rw-r--r--vendor/rustix/src/backend/libc/pipe/syscalls.rs12
-rw-r--r--vendor/rustix/src/backend/libc/pipe/types.rs6
-rw-r--r--vendor/rustix/src/backend/libc/process/syscalls.rs33
-rw-r--r--vendor/rustix/src/backend/libc/process/types.rs5
-rw-r--r--vendor/rustix/src/backend/libc/pty/syscalls.rs27
-rw-r--r--vendor/rustix/src/backend/libc/rand/types.rs3
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs70
-rw-r--r--vendor/rustix/src/backend/libc/thread/futex.rs43
-rw-r--r--vendor/rustix/src/backend/libc/thread/mod.rs2
-rw-r--r--vendor/rustix/src/backend/libc/thread/syscalls.rs122
-rw-r--r--vendor/rustix/src/backend/libc/time/syscalls.rs2
-rw-r--r--vendor/rustix/src/backend/libc/time/types.rs17
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/aarch64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/arm.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs24
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mips.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mips32r6.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mips64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mips64r6.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/mod.rs19
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/powerpc64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs)4
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/riscv64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/thumb.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/x86.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs)7
-rw-r--r--vendor/rustix/src/backend/linux_raw/arch/x86_64.rs (renamed from vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs)2
-rw-r--r--vendor/rustix/src/backend/linux_raw/c.rs34
-rw-r--r--vendor/rustix/src/backend/linux_raw/conv.rs20
-rw-r--r--vendor/rustix/src/backend/linux_raw/elf.rs181
-rw-r--r--vendor/rustix/src/backend/linux_raw/event/epoll.rs22
-rw-r--r--vendor/rustix/src/backend/linux_raw/event/mod.rs1
-rw-r--r--vendor/rustix/src/backend/linux_raw/event/poll_fd.rs5
-rw-r--r--vendor/rustix/src/backend/linux_raw/event/syscalls.rs24
-rw-r--r--vendor/rustix/src/backend/linux_raw/event/types.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/inotify.rs13
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/mod.rs8
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/syscalls.rs135
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/types.rs55
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/errno.rs28
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/syscalls.rs70
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/types.rs9
-rw-r--r--vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/mm/types.rs21
-rw-r--r--vendor/rustix/src/backend/linux_raw/mod.rs11
-rw-r--r--vendor/rustix/src/backend/linux_raw/mount/types.rs31
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/addr.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/msghdr.rs39
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/send_recv.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/syscalls.rs139
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/auxv.rs258
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/init.rs149
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs47
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/mod.rs11
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs159
-rw-r--r--vendor/rustix/src/backend/linux_raw/pid/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs15
-rw-r--r--vendor/rustix/src/backend/linux_raw/pipe/types.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/prctl/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/syscalls.rs37
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/types.rs10
-rw-r--r--vendor/rustix/src/backend/linux_raw/pty/syscalls.rs38
-rw-r--r--vendor/rustix/src/backend/linux_raw/rand/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/rand/types.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs17
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/tls.rs39
-rw-r--r--vendor/rustix/src/backend/linux_raw/system/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/syscalls.rs39
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/futex.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/mod.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/syscalls.rs5
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/types.rs14
-rw-r--r--vendor/rustix/src/backend/linux_raw/ugid/syscalls.rs3
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso.rs27
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs9
-rw-r--r--vendor/rustix/src/bitcast.rs4
-rw-r--r--vendor/rustix/src/check_types.rs6
-rw-r--r--vendor/rustix/src/event/kqueue.rs20
-rw-r--r--vendor/rustix/src/event/mod.rs18
-rw-r--r--vendor/rustix/src/event/port.rs5
-rw-r--r--vendor/rustix/src/ffi.rs7
-rw-r--r--vendor/rustix/src/fs/abs.rs36
-rw-r--r--vendor/rustix/src/fs/at.rs27
-rw-r--r--vendor/rustix/src/fs/fcntl.rs2
-rw-r--r--vendor/rustix/src/fs/fd.rs6
-rw-r--r--vendor/rustix/src/fs/ioctl.rs52
-rw-r--r--vendor/rustix/src/fs/mod.rs4
-rw-r--r--vendor/rustix/src/fs/mount.rs10
-rw-r--r--vendor/rustix/src/fs/raw_dir.rs6
-rw-r--r--vendor/rustix/src/fs/seek_from.rs29
-rw-r--r--vendor/rustix/src/fs/statx.rs29
-rw-r--r--vendor/rustix/src/fs/xattr.rs3
-rw-r--r--vendor/rustix/src/io/errno.rs25
-rw-r--r--vendor/rustix/src/io/ioctl.rs23
-rw-r--r--vendor/rustix/src/io_uring.rs89
-rw-r--r--vendor/rustix/src/ioctl/bsd.rs24
-rw-r--r--vendor/rustix/src/ioctl/linux.rs83
-rw-r--r--vendor/rustix/src/ioctl/mod.rs338
-rw-r--r--vendor/rustix/src/ioctl/patterns.rs202
-rw-r--r--vendor/rustix/src/lib.rs85
-rw-r--r--vendor/rustix/src/maybe_polyfill/no_std/mod.rs11
-rw-r--r--vendor/rustix/src/maybe_polyfill/no_std/net/ip_addr.rs2
-rw-r--r--vendor/rustix/src/maybe_polyfill/no_std/os/fd/owned.rs36
-rw-r--r--vendor/rustix/src/maybe_polyfill/std/mod.rs10
-rw-r--r--vendor/rustix/src/net/send_recv/msg.rs12
-rw-r--r--vendor/rustix/src/net/socket.rs9
-rw-r--r--vendor/rustix/src/net/sockopt.rs398
-rw-r--r--vendor/rustix/src/net/types.rs567
-rw-r--r--vendor/rustix/src/param/init.rs4
-rw-r--r--vendor/rustix/src/param/mod.rs4
-rw-r--r--vendor/rustix/src/path/arg.rs140
-rw-r--r--vendor/rustix/src/pid.rs20
-rw-r--r--vendor/rustix/src/pipe.rs20
-rw-r--r--vendor/rustix/src/prctl.rs3
-rw-r--r--vendor/rustix/src/process/chdir.rs10
-rw-r--r--vendor/rustix/src/process/exit.rs6
-rw-r--r--vendor/rustix/src/process/id.rs6
-rw-r--r--vendor/rustix/src/process/ioctl.rs35
-rw-r--r--vendor/rustix/src/process/membarrier.rs49
-rw-r--r--vendor/rustix/src/process/mod.rs4
-rw-r--r--vendor/rustix/src/process/pidfd.rs7
-rw-r--r--vendor/rustix/src/process/pidfd_getfd.rs9
-rw-r--r--vendor/rustix/src/process/prctl.rs7
-rw-r--r--vendor/rustix/src/process/procctl.rs3
-rw-r--r--vendor/rustix/src/process/wait.rs16
-rw-r--r--vendor/rustix/src/procfs.rs29
-rw-r--r--vendor/rustix/src/pty.rs42
-rw-r--r--vendor/rustix/src/rand/getrandom.rs1
-rw-r--r--vendor/rustix/src/runtime.rs79
-rw-r--r--vendor/rustix/src/system.rs26
-rw-r--r--vendor/rustix/src/termios/ioctl.rs17
-rw-r--r--vendor/rustix/src/termios/tty.rs11
-rw-r--r--vendor/rustix/src/termios/types.rs12
-rw-r--r--vendor/rustix/src/thread/futex.rs2
-rw-r--r--vendor/rustix/src/thread/id.rs9
-rw-r--r--vendor/rustix/src/thread/libcap.rs3
-rw-r--r--vendor/rustix/src/thread/mod.rs9
-rw-r--r--vendor/rustix/src/thread/prctl.rs38
-rw-r--r--vendor/rustix/src/thread/setns.rs10
-rw-r--r--vendor/rustix/src/utils.rs34
-rw-r--r--vendor/rustix/src/weak.rs34
171 files changed, 4082 insertions, 1891 deletions
diff --git a/vendor/rustix/.cargo-checksum.json b/vendor/rustix/.cargo-checksum.json
index 01994bd27..5c53c42f8 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.toml":"63bed0f7d3eb2eff11ad1d4ed658f9bfa1541eecafd7b99aebc683c4a9f92596","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"20e6d4bc5a33c81e9a4a04abe8ac611658deb4ab0794cd792f0568f287b68da7","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"7abf49bced798168a4f57916654305a6c5d048d12e0ad43d30ab14f24b5e527a","build.rs":"36956bd7e6b5a2d5e66e9a91eae41d76bd75b4a25d5427dc22ad48307ef25cc1","src/backend/libc/c.rs":"63b26c669135e7717ed1ff579ace2b238e815164b96a78be031b732645a271d9","src/backend/libc/conv.rs":"71cb0f653fa95705bcea2173840b78dd02f94735db970f8081231320e0478cb9","src/backend/libc/event/epoll.rs":"598e246866f46834f57d5385439d4c40654f899d3b9f252b6f72eeb18628d661","src/backend/libc/event/mod.rs":"7f8547c599b8263eb791890bbe4a0b22fe2676d007ffdcc3e07b2e48d1c994db","src/backend/libc/event/poll_fd.rs":"d342bb16fd8a7ea695e7264c76d8c1d00ab2182ff70ed57a98c25afe9aa16819","src/backend/libc/event/syscalls.rs":"85c7bf53182d606c466af7ceadb2f9bdd7bbdf8b00a7dd5b02e099a3f6bb83ee","src/backend/libc/event/types.rs":"5a520d60f67bf07be9229177ce872dc70bf366760a2b81fecba6d522b2179868","src/backend/libc/event/windows_syscalls.rs":"ebfac665c6676c4b803134ab8806be8aa2e96bdbc7799a19c544cd9069b35787","src/backend/libc/fs/dir.rs":"4ff9b5f3b6fad06cfb641cf74511c4b80186b426e8c2d67a1b6cba08466b5d4f","src/backend/libc/fs/inotify.rs":"4e0e1f31ed6a53cbc56119bb974a464acd9c7797d2699a29cb399311ce49323d","src/backend/libc/fs/makedev.rs":"797e7e31dd363b8f649f370424e23a210be4536b580a78cb0f4c5d375da0aab0","src/backend/libc/fs/mod.rs":"5fa5a19401054cbf8d339192508aa7ad60fb2b0543256dbfbda128c05dedf645","src/backend/libc/fs/syscalls.rs":"1657b2a1f385ca96787648b89cd777657baeeacd96c4f752260b7a97c1fff1a1","src/backend/libc/fs/types.rs":"39a6c7ca6e755a050efe167b9cfd7146898f18ac5b1b40878107f5a9378b2d17","src/backend/libc/io/errno.rs":"01783934c204b775c12a4da055405ab543f63e5b127b55e305efc47708c7f679","src/backend/libc/io/mod.rs":"746647bd864e4ec7717925b6d176cebdb392b7d015070244cc48d92780351dd6","src/backend/libc/io/syscalls.rs":"fd71e78eef9f2ae247fb7d5c92c54d4c32161784dc258848db458f89023faf41","src/backend/libc/io/types.rs":"2248c2ba2c4b6ecbbb9f6c8dc2814734e8cd05e664c2aab409a243e034ff338b","src/backend/libc/io/windows_syscalls.rs":"73d3e609d30dfbb1a032f3ac667b3c65cb8a05a1d54c90bbb253021c85fd496a","src/backend/libc/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/io_uring/syscalls.rs":"5af8146d5971c833e6fd657f652c618b31f854e1b0811864fba9b658cb633e19","src/backend/libc/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mm/syscalls.rs":"858e5bb3bc850b6a2d5ce69b3c8e40ab7cf75d392fe3a022119e5edd0c538db5","src/backend/libc/mm/types.rs":"db3b5af83e07a68eaa7f70e04871e818acd5542c135e92b4a38af555e076540e","src/backend/libc/mod.rs":"e572b4461d4fe9a399b5db9c8395d6559ffe69586c76506d53d5d7fb37bb87cf","src/backend/libc/mount/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mount/syscalls.rs":"1bc87501a078616d0190d2e85de55f3f968b8cb79d49bd9eb839a350eed26089","src/backend/libc/mount/types.rs":"6744dc82723d2e08af1d69b7421642bc1b687d89f9116643df9d2e7a9b1d1c39","src/backend/libc/net/addr.rs":"72f504c3a97eaa49d3013db30b55c5c8f711a097b98023ffcbb527d04cf0a014","src/backend/libc/net/ext.rs":"d1274fd3ab84bbb8b73f45efe6dbd63f82b09d889a6b2aae07f15970dbb6c6c2","src/backend/libc/net/mod.rs":"605b818c6f4c536c96e052d9b843eeca79dccd1d3cf1c8b87e60c8539b8122b4","src/backend/libc/net/msghdr.rs":"67f7ed2c41e843bf2c00c9fef4280af24cf2e897c3b31e0a916415237c8f88e4","src/backend/libc/net/read_sockaddr.rs":"62b8a444cb9a0a9031d462f96f401db14b851551dd3dc58eec06570d7fec06c2","src/backend/libc/net/send_recv.rs":"eb8b0b3d291a176b5a2e4818b683819aee395d860bd566b898c2e1ba4e115886","src/backend/libc/net/syscalls.rs":"add5e53e685f9cb417e56359ee0ccbaa4b04a3769377b5b44ad728fe52e17463","src/backend/libc/net/write_sockaddr.rs":"68aa587ff61c1d3c77ce2ab905bc5765b305d545335b321ef923a4f1c50c3683","src/backend/libc/param/auxv.rs":"fdc85b7c33bcd05a16471e42eb4228c48c98c642443635ba5fc3e9a45438d6d3","src/backend/libc/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/backend/libc/pid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/pid/syscalls.rs":"49ea679b96c0741d048e82964038f9a931bc3cf3a0b59c7db3df89629b9c49e6","src/backend/libc/pipe/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/pipe/syscalls.rs":"0bf55fdd9f4e351ec8fbd8cf895ed44f513d230ffd51929229c68d87ff2b18ab","src/backend/libc/pipe/types.rs":"ba9f7827ebbf4c2488ccd612beb59b66ced3be2e14a467660bc60aa0332be11d","src/backend/libc/prctl/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/prctl/syscalls.rs":"8a2684f444a7555098dce2b92270d81cefdae902716c6e5d59bd7b0657e8a29d","src/backend/libc/process/cpu_set.rs":"b3d36b01b53b0b6c61a20ed8a69d48eccdd90cc17f82f2926ef1e844f002d0b7","src/backend/libc/process/mod.rs":"d7dc401255bad2e55ffff365339cdc3aad306861d269ad727a817d3cd7763166","src/backend/libc/process/syscalls.rs":"b47392bd1aad96ca93ce421d8877e8b6e6da725db7bb521936ca07e4d1bec114","src/backend/libc/process/types.rs":"e8e54a21e7450157a8471571727c1c7af169ede372329c0e5d82a2e0193ba76e","src/backend/libc/process/wait.rs":"0cc556aed976b4bbb3965f74fd76b8216c755fce25043b7b21ce54afa07c9773","src/backend/libc/pty/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/pty/syscalls.rs":"c4ec64720854f3b83307f67dfc75ab911b3a0378cc2e519054aae045d181f445","src/backend/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/rand/syscalls.rs":"78c7201e6bcb75e9cab9486d1878861319f865de2b2c46437be68690bd17bf13","src/backend/libc/rand/types.rs":"7d473c7ee8f19fbcec31f61b28ba6a68e1233f64f37b3b496d396c0197af63e1","src/backend/libc/system/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/system/syscalls.rs":"846dfb59afe40bbfc78e57afa76f0616d62d25da2daadcd872aea6fa32aafc3b","src/backend/libc/system/types.rs":"6871e16aee14fe2ae03cea798c3e509ffe44778a9c0e5608fd73e2e015876d7e","src/backend/libc/termios/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/termios/syscalls.rs":"a7a31994e9bea74cbcbfb66a7d66253d6aca74d8657201a483b82ee4fe5ec7fc","src/backend/libc/thread/mod.rs":"0de5f67a684b9fd7628d3009d2ea5fd51b8770e8b387eed14f59152157844287","src/backend/libc/thread/syscalls.rs":"fe4dfeb072972eac5e2a8de05d7f5c33fd2580a4ce486c5003497d717bbfd176","src/backend/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/time/syscalls.rs":"3b0b99271d898ebe173b12fa00f8013fce69e9fa4564428b68d4867c52729597","src/backend/libc/time/types.rs":"e93f3bd1ce4b8696b44c2be6d6308300185a5cc32abc5e3e84ffd9bf6b4597f0","src/backend/libc/ugid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/ugid/syscalls.rs":"8edf91b8790add23902c9f5418da6b0723a371677f29f490e0c8af852f0f1a0c","src/backend/libc/winsock_c.rs":"3bf3884fd250eca806ffdf96da68e29c133a697810b78b333ea449e523e58562","src/backend/linux_raw/arch/asm/aarch64.rs":"67011427b3cecd29ee716113d952e70d63574c96d1d3ea3c75d46250bde9ca44","src/backend/linux_raw/arch/asm/arm.rs":"7760d51aef17a69a797eb96fd61f7fade0d55bc87ec9a3e77fa6bb6aebaecdbb","src/backend/linux_raw/arch/asm/mips.rs":"d00c84cfdb4e37bdee9a2daa0a7b3298afbb4ebe288702203cb43d9c2617012d","src/backend/linux_raw/arch/asm/mips32r6.rs":"6c2661361ba0ac5caa8458f502c6cca266ce59a43ab552b7882c07cb64b9d149","src/backend/linux_raw/arch/asm/mips64.rs":"ab5455c9b2511ba6b67a66873cd8b53bf77471249fd2779d6437ebb4934087b5","src/backend/linux_raw/arch/asm/mips64r6.rs":"a67262dc9cbd583ecfff93953726dabfd6574714d4646aff27582ff034a28cb9","src/backend/linux_raw/arch/asm/mod.rs":"1ac43073fc3d28879ab46d9220344785db4ef761a21d0357e4fe564157e6f1a6","src/backend/linux_raw/arch/asm/powerpc64.rs":"dcd12314184441f5f7705bea6b829103c7abc9062db366ae5584023a38252a36","src/backend/linux_raw/arch/asm/riscv64.rs":"58a58203e9cac2ed21e4a7b26692c5d56d3c2bcddb3f60a648efd18a02129f3c","src/backend/linux_raw/arch/asm/thumb.rs":"82b88c9a3b6837f28a738cc760fc2403e7014abdb2c35d2bdbc8073235ae2863","src/backend/linux_raw/arch/asm/x86.rs":"bfe81e7c527cdbcc98e4ec10c96f64ce543bb4d7ebdeb5ab020794f09e75545d","src/backend/linux_raw/arch/asm/x86_64.rs":"7c893ca306b3b8a5980c525dc5fa23187a0526bc9f7ac637204d88a1d596df5d","src/backend/linux_raw/arch/mod.rs":"31b3753c763ce3d2dd92db926123fc5eb6e0ba66a09f5574b6ebb11c836dcf6b","src/backend/linux_raw/c.rs":"389243294a968dbd3ca3b4e60ea6323c76ef4b963d0b2a360956d9c9c167c7a5","src/backend/linux_raw/conv.rs":"027816a35e624a90b141ce3f84e8634f9626f9da41130a0f777a60484776318e","src/backend/linux_raw/elf.rs":"ff5017040b29a8cf8d5077a0c73943bfa5e3862eaab37ee1c3b08a1122968bbe","src/backend/linux_raw/event/epoll.rs":"6c27660b015889140ad11657ad08dc32dd52fbc6b0d0a6571885792040e19156","src/backend/linux_raw/event/mod.rs":"72e46b04637e2d1d2a6b97af616144995399e489d1fe916faf835d72fc8c64cd","src/backend/linux_raw/event/poll_fd.rs":"8495da1687b15f7880a576ac8d197c941627a53874f0823467a3e4e3ad5640f2","src/backend/linux_raw/event/syscalls.rs":"f996db9f1f9f2b9bdaf33ef3a80a63ab9b1a65ae956700fd88d355e046ce2890","src/backend/linux_raw/event/types.rs":"4edf9c7c399c91f359bc2370a407fa5ab537a84eed26c593ce5bf6dd82c6c6a0","src/backend/linux_raw/fs/dir.rs":"d871468c08ea22868f308ce53feb1dbab8740d577441a4f3aadd358baa843d27","src/backend/linux_raw/fs/inotify.rs":"c05e201e4f562256388c933cd3f24a3c3a578bd19513284856bb3eb1218906c0","src/backend/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/backend/linux_raw/fs/mod.rs":"e22bf30f312f6a05f1e79f7834c33a3c9821514da05fa4786fc31867203a4c74","src/backend/linux_raw/fs/syscalls.rs":"8d8639d24f1d42abbbee6f1d9db77d1c2f49867d9eac52f3f93331b9a2389445","src/backend/linux_raw/fs/types.rs":"3cf024ce2515c151a25ea25f19a21fb61b0deac58f88db841f88b2938fd07034","src/backend/linux_raw/io/errno.rs":"8d6a8d702ddec05c0ec5b518b9c4d6c9b54d390ea9b362e60f2032284c40b112","src/backend/linux_raw/io/mod.rs":"7ae2324427892cca6f5ab53858d847b165f790a72ec25f3d99fb15f0506c9f27","src/backend/linux_raw/io/syscalls.rs":"b079441386e5eb835b258871ae813dcd39fd8aeef4fc96bee187a45b0544bda7","src/backend/linux_raw/io/types.rs":"59d031dd1e769ecbaedaaa3ffc513a7f7154fc48abbb46023166fa38a46f0c61","src/backend/linux_raw/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/io_uring/syscalls.rs":"b87fa95c16b2d3ca8fd5d72368bda37b8b8ddbb19df3a884efc6eeec393c86d1","src/backend/linux_raw/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mm/syscalls.rs":"369abe984aa972d8083fee20d764a8d57df242c66f897066367416f2fcc832a3","src/backend/linux_raw/mm/types.rs":"74dd9772c7208d6ad2d3830277eb1f67d5b2392553be23c8a64181c21ca1dc37","src/backend/linux_raw/mod.rs":"eb94a0ff0f7dad9e114d19bcd9bf5b320b9e8570ce74277756aaf038c815e23f","src/backend/linux_raw/mount/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mount/syscalls.rs":"3947261b5d46b9737f02dc5352c3a3a35c63c461fd75bcd8ae6619dfc0bfb54d","src/backend/linux_raw/mount/types.rs":"4241f270fc362834dd2cee3eb360e5b5d2bb0300eb07f0ca1bc81363e501c65c","src/backend/linux_raw/net/addr.rs":"fa6c4ea03ed465188bdb2113a9815549084b501c35654b46a00de226c7ea5463","src/backend/linux_raw/net/mod.rs":"bc9c9c4a8c06b1fb8c57555261176dfb1f3e858a1d89cd2f88e1f31fc126c001","src/backend/linux_raw/net/msghdr.rs":"6c0e1dfc0c9f79e69d3a645f0b4228bf6b29fed920af5f1efa6bbacd0a681c51","src/backend/linux_raw/net/read_sockaddr.rs":"24075ac4c05fab5fe44aae4445cdd12ec7e474f047150baa9b768741d6b9693d","src/backend/linux_raw/net/send_recv.rs":"aa5107094a1e5c6ce57bc2956d0ac63f24a7e61270f61ab2a353f9c832da0e4e","src/backend/linux_raw/net/syscalls.rs":"76c162e5cfa81621b1c2689695efd72066633fa7deedf83b71c255f0c4b176f7","src/backend/linux_raw/net/write_sockaddr.rs":"69ee7d6f754126f9399250d51bcdb306ab6a9ae816bc8fe21d0a9cabd49052ef","src/backend/linux_raw/param/auxv.rs":"890976e7ba6ff456326e3e325b9594b75ee4173bcd7eadc7929ff1b65520b118","src/backend/linux_raw/param/libc_auxv.rs":"16e8ffc7eab03c4aade2bb01908731ce15526041ae5e1767315b90c9f64eaa2a","src/backend/linux_raw/param/mod.rs":"db21fc1b0ea5568b8649890fa38a878bfcdcf7398f6cf1640176b37bcc6ce990","src/backend/linux_raw/param/mustang_auxv.rs":"0adbb54a06b8c7b2df17462d98e1fe72bec02e4e577313add0cb7363262f0d6b","src/backend/linux_raw/pid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/pid/syscalls.rs":"ce3ca4c72096479340364d16f09918e192ffd3a0436a26eb61aad7e7dac3cdcd","src/backend/linux_raw/pipe/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/pipe/syscalls.rs":"ec53a8b3ac23fc3fc2983615e34a210077947dbdf9b6a55477844fdae7e6b306","src/backend/linux_raw/pipe/types.rs":"73db762965df510bf3c908f906acf3a6df182d98d4ba1ebe45a52a4b51751e7e","src/backend/linux_raw/prctl/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/prctl/syscalls.rs":"01aa9cd77341dcd1efab9f3ac28447d0fbc41ed44d65e52301b347fdd1627e50","src/backend/linux_raw/process/cpu_set.rs":"dfdcbdf35aff6a3e08e7d38193bf18c12ca8aa64eb0dc417667be82dcc0f7c55","src/backend/linux_raw/process/mod.rs":"fb393c70a9c63ef9a6bf1fb5a2dc94f07d6b0b6987cc5231c15c607015dafd68","src/backend/linux_raw/process/syscalls.rs":"06313394d332fe385ce2053ae2980cb939665c1d091867d131adf18bd9e7a5dc","src/backend/linux_raw/process/types.rs":"d66049cfbdb27e31586f0ff2e53b6adbe0ebb296a876372e9d0d805d10ac5f51","src/backend/linux_raw/process/wait.rs":"921aee4b0048746087f52615a98edc2aa0fb4b53d6df44be4533098df55d1b05","src/backend/linux_raw/pty/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/pty/syscalls.rs":"8e0c6bb4a488440b39e5df9aa343bdffa6b28a0213246bc699f8b9676a170fa5","src/backend/linux_raw/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/rand/syscalls.rs":"fb401466368de62ec4ff76bc230f9246623b003fe7452912e1365f443d3eeeb3","src/backend/linux_raw/rand/types.rs":"787a59629343688cac0fdabd1b7552b400b9188073a1e0394eacc6e0997e1bfe","src/backend/linux_raw/reg.rs":"39b6234971122d247054bda8c2dc3b44493be30482635baa9e2fcbe048e78cbd","src/backend/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/backend/linux_raw/runtime/syscalls.rs":"21497bfe3d0f82de278f07bf53a11a04ffaa595b4ff1af92627940ff2029b8fc","src/backend/linux_raw/runtime/tls.rs":"2b8fc61a33ca9b47f854afbb8e3f8b20f9f9416b8884aefe46388c8173c8ae47","src/backend/linux_raw/system/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/system/syscalls.rs":"a9bec6662f122b1ec310d417bd9ddc16df13b50de6526d2170aa4d72292c2b14","src/backend/linux_raw/system/types.rs":"1ceab8d738a71043473b26e97fa3fd79d588a86d4774cbc9b9e1d4f1447a016e","src/backend/linux_raw/termios/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/termios/syscalls.rs":"6c85a0cb459ad473f60ab640e3813b65a8e943bc4a86e09d9db6021cb8b0e2cb","src/backend/linux_raw/thread/futex.rs":"3a130db9f6176dc95fdc14ce61a6bcdcc2c28e82a29ddae3e05f347a189fdd14","src/backend/linux_raw/thread/mod.rs":"f7132a68c9db1b4a796781b9e8d0ac268a1ddb713e510bfd43425564ec9b39c4","src/backend/linux_raw/thread/syscalls.rs":"5845d1c0a3548f87a114493c345e18dc32875bd7d35a6abcf1241ced9b024c09","src/backend/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/backend/linux_raw/time/syscalls.rs":"a7870ef9daaf3fb2ac50f853df6dbcd935a3b2d70e720b80184208f602a918e6","src/backend/linux_raw/time/types.rs":"50d84ee6288f06bf4b526781c84e7252f3c09ecdb0626856d94a1a61c2e2c579","src/backend/linux_raw/ugid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/ugid/syscalls.rs":"844b2bed42b9a3c06845dbae1d020bbab5757d23ea3ad7a440e3cd87ff993f72","src/backend/linux_raw/vdso.rs":"a5abab80f023088162fd81dc306b6bd86bd61b2018a191b384f57facb1d48d0a","src/backend/linux_raw/vdso_wrappers.rs":"7b5711e13d0d7112d57876014b932adfca13c0e1260150dd5f43152170366e82","src/bitcast.rs":"fe6bdc7fc31fa3b360c44a841c9a0f143629172729c6aaeae76841c74c122ff3","src/check_types.rs":"fe4fc1a0930a25037dac954e7843a4d4c321dd7d1acb25916cdc9cfd4b37974b","src/clockid.rs":"1d2e1cfcf23160b55d6b046d235edf2eb2408f072a8bdef3e3a3871885abdd5a","src/cstr.rs":"9e3fcd57d6af382a9a4f24b97a29eeb05a3ccd5c8fefd666884f6e4438b3c4a3","src/event/eventfd.rs":"81cbd08f7bdf40a6ce1ca692b63da1dc8ba925282990668d9d68f1203e839fa1","src/event/kqueue.rs":"b267ca1badc43d977e2c5435092f161caab50ea04e258772dbebe1f02f3f5966","src/event/mod.rs":"6010c924a0a079945eec796465a7108119d512db74709ea0105ed19051c0f55a","src/event/poll.rs":"0ee583dbd457a573a82a06c04a2a24bd2c76e751d27a435507d55338e2871327","src/event/port.rs":"da588ff0f694bb1f99e288708bfc07353bd1274020c13dce30df5d7f3b42b0f3","src/ffi.rs":"0c6b9a6f20ffb31a827412c0381c6fff09e68265f29d94c5470940e22c5334a2","src/fs/abs.rs":"1bd62a3aa971468ca7a51a3fbbb59188852b7bc099b55dcb8ce2b1344db5f877","src/fs/at.rs":"d5bd107c89c16d3ead53d6281973e188497c9e35a49c5f2ad89916552071e05f","src/fs/constants.rs":"24076a01f8bfc126b0905e9bc0521d2c3a3abc6c3b8c86ddb1e545070d097127","src/fs/copy_file_range.rs":"d3b644374390d482b2ff749a2459458872b57d0dcf9670368739b7833509a7c2","src/fs/cwd.rs":"9f429a79ace6e17455634da09216ee0ad3d067a4541518b3193ae6a8d9ff1e26","src/fs/dir.rs":"347a52f4ca9ac6321c52e802e97ec90d1b4c62ec955c8996fc17f8f5aed69966","src/fs/fadvise.rs":"beef66ebe1310fb92628240b2cde68f744c78e50f6ff61bb1404bd4868d9cae8","src/fs/fcntl.rs":"bc8e12ba9c01abeac2d89af63e2618c08366e9bf8d093a3d8c399426c786db60","src/fs/fcntl_apple.rs":"e2f23f038083621bcdecc98d02ce1023508afaecdb2ed0fba5c8b70f955301e5","src/fs/fcopyfile.rs":"ec95929cbbe02cf49233a785e5238931bb107b7903cc5bc95e4231de960995f2","src/fs/fd.rs":"6b64b27b4727e00ae1a44cf04f9627326679ecc2d7ea274195e1204aa60c2d50","src/fs/file_type.rs":"fefd865f91011f66126213b0994773d99e373b468c31e866002228c98c64ad85","src/fs/getpath.rs":"28f6970fc1bbc37bb35c84724b59eac436ea7407a4522e18c2bdacb1fdd2edd9","src/fs/id.rs":"1b5c8a8baf9a9bb1f895f97189cea4e5982a0d35b192afeec6340a6c6222e0cb","src/fs/ioctl.rs":"1b222e725402d775813877b73f40f8ac2b513439485d326fbd49e3f4ebedce3b","src/fs/makedev.rs":"85520b484cb7c15ab71ea1c368578ea3b7e484d82f8510db92b6ce9f7ca341ae","src/fs/memfd_create.rs":"15a8f28e040cffd8c24c7903483440f88853b2e538ad48d80f3c00b4b2befdea","src/fs/mod.rs":"8a3ab65aa3fa9a66ea55ef1ec3db72cab938b2b0deb4e079dd6efd737f91d480","src/fs/mount.rs":"be6d26c58d49913838ad32c206187c2c6e7e1ca9e5da0990dfe87aaa2d7851b3","src/fs/openat2.rs":"4a95c15dab533a41201b5fa25c8a212956b7571d58cad696bdaf45af8aef96db","src/fs/raw_dir.rs":"6314094d92d6a51ab14d9d67e72427f3bb778543f2bb12632fd02cf439d52c2d","src/fs/seek_from.rs":"d7616a45e8a449df28b075ddded4d7c95d6c4575d6fe0cf0ca7b6625e9dc7eeb","src/fs/sendfile.rs":"e3b2058741cf4b1698f34d84bb37130cf2b72806d522a16fe541e832cde136cb","src/fs/statx.rs":"239d447477f8ac368c8ddf9975c71509c47881f647f59cd941ac07954d8a77f9","src/fs/sync.rs":"a3b23543834281f347b0f873bd38154d31d404871188ac08f2b20b9196234cfd","src/fs/xattr.rs":"1d4d7f144716ac8fcae6b728ea23d27db8d3d1d7d2ec3dc31a1dea8e9d6a7eff","src/io/close.rs":"0aa3cd05a8fed8e5244f97b8b6c2e7f65ed93a4e5435c6329852bb3da7514440","src/io/dup.rs":"a8a59c5d345dc54c57ded890720c33eb78c4d53917c71e8bb6317f7ed122cb87","src/io/errno.rs":"11b40196e7ae2c3f7dfa4a329573fb73676a5a7f90767bc5a49e8d4f379643b5","src/io/fcntl.rs":"c0f7bd7fce1119b0c1d0085b7ab77d5df02470ae3e06035428a2452dacbec296","src/io/ioctl.rs":"69d85054f32523c9b88b9bbee536d3299cfddba0e08f608d950e8a7cc4464e07","src/io/is_read_write.rs":"1bfb9ee5d58e0b29b44af12fe2668c7bccc841358698dcde47f1519ff9bb73b4","src/io/mod.rs":"75f1d0646be1d4c7c08b5887d8119b0103be8c25c43ccd4e0e97015508c0bb8f","src/io/read_write.rs":"54ba528b11601af1338bb0c71a41b256a0033076d30b3946c3fd0bdfa61dd021","src/io_uring.rs":"7093958a57bdaadd75f1800f07e359fd97c6f99c3fa01d263b4b1e57d44b2c4f","src/lib.rs":"2af15f86a2250abd5ef582bd6feedd45ec6740573a0518ae9422f5fb1f2d8a23","src/maybe_polyfill/no_std/io/mod.rs":"77889bb5c5a4f2e50e38379cdaa5d0fef4b0cafc3da056735df01f6deae75747","src/maybe_polyfill/no_std/mod.rs":"d4d98cf838b65dc3ceb0f6d4a950d9348695c3084448bd844e47b909960bbb47","src/maybe_polyfill/no_std/net/ip_addr.rs":"080dd17c44b395b46b0d9e70da76f376540f92ece65f79e3d242c0a272d3b451","src/maybe_polyfill/no_std/net/mod.rs":"b0ee611c454679226a15bf647e7779995f3fe9c8e0507930a0d0613eb414b7c2","src/maybe_polyfill/no_std/net/socket_addr.rs":"bfeb32d32c176cde76323abcffebfc47e9898fb8d7ce3668c602dc8451086a2d","src/maybe_polyfill/no_std/os/fd/mod.rs":"d9dfe2a2c25be727847bcdfe6f4898685af2521850298178ca8d46a8e2ceee88","src/maybe_polyfill/no_std/os/fd/owned.rs":"4ce3234f8ab2cc8a7b749531336f4f6b6297eff0e20a01190be2c10409a0c066","src/maybe_polyfill/no_std/os/fd/raw.rs":"9cedb353580b932879ddc4dee9936212fefb6d42530dc5cec519a0779d5dee33","src/maybe_polyfill/no_std/os/mod.rs":"27dab639a765827644005d5f2fcc7c825310606b889cc8dd83f54c9528350dc0","src/maybe_polyfill/no_std/os/windows/io/mod.rs":"5bbcc05c83fee5026dd744a994e0458469466d5be39081baa62df07753b92fd2","src/maybe_polyfill/no_std/os/windows/io/raw.rs":"4c32609a489dd938a49328b5637cb3bafb96437f2f9f269ab66d7d3cb90247f6","src/maybe_polyfill/no_std/os/windows/io/socket.rs":"c658f42f24eff44a661f2adfd24a11af80fe9897f3e2af4dc5d2c64808308d65","src/maybe_polyfill/no_std/os/windows/mod.rs":"fdb416f8f231a4e778b5f985b9ae712ece5e1a1402963ad1a5f6a8b9843795f4","src/maybe_polyfill/std/mod.rs":"dd6e219564e224fa7cc9fdab2e45935f13ad062da53d0b6d259a695c7aec1847","src/mm/madvise.rs":"3c262b3713a73fafcedf1b04bb12c048bb11d47ca43c959e5dfa48c27651f4f0","src/mm/mmap.rs":"fc32e308a24c6f351d74306943d67a68093a0b6555b4bdf6cd755bf43795f406","src/mm/mod.rs":"b3a6cb838986d45825b912355cedead761211a494ca6f89b2367a2d2157e340e","src/mm/msync.rs":"9dcfe5f54235e9314a595edb8d548ac79d222bbcc58bb3263cf7e96d603b23ad","src/mm/userfaultfd.rs":"8073443bd181ff0b3ba4d0b1ae67370b4864035a0c8b4898cd709dc47c518ae7","src/mount/fsopen.rs":"160e384e9175fd98669cda1cf3590bb195c2ba7e1c724e9ea06e692595e58ba1","src/mount/mod.rs":"5f0c9df4727592695deb1cd63ae1de021b03dcd9d0d1b68e1f34d12a7136cb19","src/mount/mount_unmount.rs":"8ad11675e5d762d33fbefbed06a6a9f9e52a9b689bd06662446152614321ab77","src/mount/types.rs":"601ae3e10b7dc496fed7f3b40a80e81c6edd7bf13189d7be45c3212d4c684c39","src/net/mod.rs":"a6bc55f9e086caf46a7c00783498d73a328a66f2a991f1ec65d5f13931377b0f","src/net/send_recv/mod.rs":"f33e39c7b228cd8109823b0a0a1aa397cddad504d49e69b36f74c5b84e5070e5","src/net/send_recv/msg.rs":"f4854380a7ead4696f427409836d6fc9edd916e38248a350c6208e655b0663a7","src/net/socket.rs":"6bb087ab208a1e06d535fa11e2aa4a9f96da6e73b697fca93e2a3c89178c4434","src/net/socket_addr_any.rs":"d07f9e9ef8873aa5bfd85f669952299286ef6f2cc5b9fea383856432e61b850f","src/net/socketpair.rs":"56f4885c31d2664cd16e18a9a88792a4912fedd953cec36dba67e8581fd57921","src/net/sockopt.rs":"b72ffea1f6e3efd315e7d72fceefc5071d7e6a9c14c999755fd15ad0ae466ddd","src/net/types.rs":"61c0e5aaf636734832018dc80541772741e6c8447befcc1d6e1bdbe4815cd70c","src/net/wsa.rs":"6e546b42f50a851fc833c57cda76cfb347203ed4b0dea574a3d325bf5a2ebf80","src/param/auxv.rs":"988872f9bec2e12f35765ae8963cbb9535d4acaedd4c9a4d07ced6feb70e0aaa","src/param/init.rs":"671d8974f0d9b82e79076d1f4deabe0273a874a329f74b8aad26e07b86791ba3","src/param/mod.rs":"53ee190cf5266a2e057af9412acc50359369470a04dbfe2e6e92a90de15aff57","src/path/arg.rs":"4a4bf9b59334900b51ac250365b2a1838670f83a6df9c9c3f6a35bd7d4784170","src/path/dec_int.rs":"fad9793b89eac526953b994cbed6b614f01c25108f9763e19fb98029feda93a4","src/path/mod.rs":"6b1b949c94bcc47e0f08a3f8e8db5b61ff497d0dfd3e0655f51c01d3e4b7dfd6","src/pid.rs":"2ef7ac7944d8a2e4c1e764d78c5b7e223704243b78c3c15348e9ea0fe1638117","src/pipe.rs":"e57b6f40af317e07d49f0a5ca98016cd358d8de2989be9a04775b6937ab05fb2","src/prctl.rs":"a1c85a401538d614f5539871f9a03f9a345b24cfbc845e953deb9f8b96986e2a","src/process/chdir.rs":"9d0397bc91bad5bf1c0afec5b3e6dd9cb7de6e54c3d0b760b33a4996a4cb1b25","src/process/chroot.rs":"2b5f6124eb19f26ad2705174f7ad50cdc0a5d15abd59ffcf55421228d82130b4","src/process/exit.rs":"98d55e9a419737cd88327d8eb484b892e2a12706e5dd05e5e43552af8b6a806a","src/process/id.rs":"402475cba98cc7e724943bfd218862f76c08b8d200a7b38bb5067bba2a837ef1","src/process/ioctl.rs":"6b9527094ad3617057e95268d515bce032656642e7ee55fcc686e4a9cbf01499","src/process/kill.rs":"7b879e5cff8a064acd0e7488f4e21bd4e4a8506ce380688b72cc48d283ff9c89","src/process/membarrier.rs":"77b1080dc50cf0bf48959bd2388c519f0b73ac231cc329be43f04525217b7e94","src/process/mod.rs":"21e5e4f55e81c447d76970442473678f6345d12a61b3227caf09460cfb82e0e4","src/process/pidfd.rs":"948b88cd986c17074fc895f277eec49066a52ab461fa341b7119ce648b28fcb6","src/process/pidfd_getfd.rs":"14aab7cc5578ca4753a7a42dcc8b4ea03748564b542675a50bae8e128348b23e","src/process/prctl.rs":"3f949bbc03c00cb68fab7db8c1bda71741f8d9439b9e25a8521d7cbb0693491d","src/process/priority.rs":"f135482e71ea8aa0daf92b9f238051178a4c904070fa8409622f94155df3c544","src/process/procctl.rs":"7668f8302515316cc70addfe8da4af47ea8872d4acacd72d1c87c0ecb627e8e9","src/process/rlimit.rs":"10b79de3ced0e64059a94c879742d46a35a6176c776d8eed75031d5e6340283d","src/process/sched.rs":"7c3bfc5be624e7d7f5e043c3ee0b0566fcab3d684d61c272e7b4233410ab1c42","src/process/sched_yield.rs":"6565faa3928b66ddc74a65e893e15edfa4b9be4f7e5f5f68527501a7f6bc3350","src/process/umask.rs":"1a0f31a842303c978e3f05ec191e2b5e96104c09c6596473b42b1fac34898a50","src/process/wait.rs":"5bceb8b2d6144aadc203ed3d7dd24536e0ad4bbef45c3fb9369559dd9284693d","src/procfs.rs":"55d19dfe0dbff098639b7e559defddfd52bdd73a0cd7fde2e026a702c4e4b70b","src/pty.rs":"602c58dcfa248a5e7f9389851a52f99dfb0e115fc9a70f732d69b0a1d127fae5","src/rand/getrandom.rs":"15255b5c5f76cf61ac4fac8b7ac6621049f2b5d2549ec319cdd69ab1ae4d07d2","src/rand/mod.rs":"cab59332aadd9b679f5b22cbb222d48ee028af5eb9fd4a4d43922da659b895d7","src/runtime.rs":"952cea05413e3ba1fa4fdc4755bf1d0fc0c21a5c8878f2cccc6a533119c193f8","src/signal.rs":"c071b4f011deef19a679d7a832d5408a3cd68627161d6510008d6312266a2611","src/static_assertions.rs":"39986672f489949be1d6469f0c30fb7d2eaa21bdaa2702a8c150b2b150bf5535","src/stdio.rs":"a5de2d7d9c3c5a901f88b6acf4754687c958a2f3a93c7945c2b8fcb948d468af","src/system.rs":"853b3ddaa10b90226f6d9a0ef7890739ce2fbd150c362c912df6afd19664253c","src/termios/ioctl.rs":"fd1db1ee473e884eedc5858e7697d4a00b6ed7d878af85abdb76771225bd2e48","src/termios/mod.rs":"b44b7caa60b6f458657ed58a0e0eca41bb4e6d6be4b0f042bbb8ab7056cebe4b","src/termios/tc.rs":"e41312d15464b83b2457c2502fc3f3b9998cfb02ba68739026dd4285cc7130ac","src/termios/tty.rs":"a3ebab3b73db76fb5594be1bb4ec888a28a63637f8cd0211fdb1b3b645cc2ca2","src/termios/types.rs":"c30ab7e4e32ffe896b75eda882c7672b5d8b36d9d87f3a1e4bf31f213a43d0e2","src/thread/clock.rs":"469326c822dfb63405ee8537552cedde0b344978280e6645bbadd47dedc71e18","src/thread/futex.rs":"4e78c84589b535ca9ca633633696ef212393a98f2890b181acaa8f908fbc5ae2","src/thread/id.rs":"f25a6dbcff0e0e7a429ce5e8406afcba3b74f10ad3065c015f8e728fd6880e53","src/thread/libcap.rs":"ee1f320d860a3decbec8052897d9e9484591e4b0b64b3b5b419f4d43d144422e","src/thread/mod.rs":"6fc33eb022c4ab7f950dfb4fae6ab70b1acbcdbeacd909ae1848e7e54076c310","src/thread/prctl.rs":"f6da23203fc2087cd3b36b910901cd6cd86d5ac6f2fcb09feb1270d6c486a1a7","src/thread/setns.rs":"ba37cbedcd5b6ef1e09422fbb8caa9fd94e25ebf6930fc7ccc778944cd078cb3","src/time/clock.rs":"e59a29f1bed8c31c3d5b6fad60f2d4fa6cab8dd8e86148bb3693a5e3a1ce735f","src/time/mod.rs":"43afee938c80d124d04d4ba190c03f4d21d1e3bfc154fff309211e4f6eabe940","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/timespec.rs":"79c7af1bfb12b56fd482b778dd783d82c6f3233b26bb11ae3dceb454036b1da7","src/ugid.rs":"6616c6e35b7e43aee5b150f1efae7a50711e0947943c9a96833dbe214ad9e85f","src/utils.rs":"337626dd40ebae8cf0cac74dd9efc6974f30522bea305fe99799a9848950771e","src/weak.rs":"22070a3fa6e526d851bac81c551aa5cb4f9e609687075999c6d50973eeec3a98"},"package":"1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f"} \ No newline at end of file
+{"files":{"CODE_OF_CONDUCT.md":"f210602311e3f74b32f46237fd55f4ce36d798e85e3db1432ec667f63a7ffc44","CONTRIBUTING.md":"fb570c76cf924cd75b77bed52b0dbe1e87ce224dc3428c48d98301710dcc331e","COPYRIGHT":"377c2e7c53250cc5905c0b0532d35973392af16ffb9596a41d99d202cf3617c9","Cargo.toml":"7a5aed49d976d82bee1f69df0c99e9c5ef0995c4b8a6bb9d50de9ec52019ce99","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"cbf71e9852fbab808eca12411e9dea24f898c6c259422c75f0afc5840db8f22e","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"e260e67273aa0a37cffdc5cd451699335b8ee656c17275a0d0f2b4563c6018ca","build.rs":"15fa8ef2de968e5efba61f6017dfb2bbe2c14e5a647014c0b57d0de860af3e5c","src/backend/libc/c.rs":"112c419aa77ed4dae188f9b1df9822b6984a77e48fd9a7dbfca2ee44bd8e12d3","src/backend/libc/conv.rs":"c4b4a6fdcf2f9295ab0498229a780942b031a2847ddf2466f90884bfb30255f8","src/backend/libc/event/epoll.rs":"b74f268a6c189f6617abb7683a0c8b40834fd80de9b60efca4b6823887f396b7","src/backend/libc/event/mod.rs":"4514349e9b409aaa0cdc5a6485507eb03f531a065a6fe142c6dc07b538541532","src/backend/libc/event/poll_fd.rs":"06e2ce2fb30a45b90279ae753a67085e9f818a1b16d99cc92c525e2c46d61d51","src/backend/libc/event/syscalls.rs":"295a930521b345192caaf916b39189299f81f5f7c9f1aaed235baf3bf6f2f5fa","src/backend/libc/event/types.rs":"09e813690f44752708485e5a5ee59a43834a4a3e9577f2739b310c3ea8b4b64e","src/backend/libc/event/windows_syscalls.rs":"ebfac665c6676c4b803134ab8806be8aa2e96bdbc7799a19c544cd9069b35787","src/backend/libc/fs/dir.rs":"4ff9b5f3b6fad06cfb641cf74511c4b80186b426e8c2d67a1b6cba08466b5d4f","src/backend/libc/fs/inotify.rs":"5f56d6a98fbba82369d392680f2e4750f2985b44979aa6356b906ad21e828619","src/backend/libc/fs/makedev.rs":"89c679a0ef18dd41b3c6223bce0f329ad35bf6cadbf16e47b33fad3f312ba4a6","src/backend/libc/fs/mod.rs":"576b6fcce723fcd5fc76637abd3b3565b00ca0bac309b63aecd6b8ee005fa81d","src/backend/libc/fs/syscalls.rs":"95182e261d01245b2b803ae7cbddb6b13a852e39499e73b27f7e133faecf174c","src/backend/libc/fs/types.rs":"1b7ccb8a7908e9250b79d82cc5347ed61dd1cd46059ff305cba299676b3c34ce","src/backend/libc/io/errno.rs":"74a28780c2c570c0dd3bf36258115c071f6c94cc4912cbc71c469f630f3575d0","src/backend/libc/io/mod.rs":"746647bd864e4ec7717925b6d176cebdb392b7d015070244cc48d92780351dd6","src/backend/libc/io/syscalls.rs":"380d9be17ec7e46fdc24682aeae6410dcd8b10fd129090b479bb8ee405d9b5c6","src/backend/libc/io/types.rs":"8df53d41d72a39f334ed124707cb501e83b3624b769c80b78c62bd45179bc04a","src/backend/libc/io/windows_syscalls.rs":"fab3fa099aa89cea56a6edc651dd37750e581534f4f45b04a7e425f130b08468","src/backend/libc/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/io_uring/syscalls.rs":"5af8146d5971c833e6fd657f652c618b31f854e1b0811864fba9b658cb633e19","src/backend/libc/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mm/syscalls.rs":"858e5bb3bc850b6a2d5ce69b3c8e40ab7cf75d392fe3a022119e5edd0c538db5","src/backend/libc/mm/types.rs":"118d7febf1dd559fccbb1275fc450216f2b7c8901fc393a4684a2a86b554af26","src/backend/libc/mod.rs":"e572b4461d4fe9a399b5db9c8395d6559ffe69586c76506d53d5d7fb37bb87cf","src/backend/libc/mount/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mount/syscalls.rs":"1bc87501a078616d0190d2e85de55f3f968b8cb79d49bd9eb839a350eed26089","src/backend/libc/mount/types.rs":"8e2b66822cd1148e5fe4023f5608f36afb0d47bad454db9560fbca4b0dbd2b6f","src/backend/libc/net/addr.rs":"b6644e0169c6681084704e9ca231863364d81e3d3cb5d3689e0df8acf7b4ec16","src/backend/libc/net/ext.rs":"0ec74196ace553c9bff355e2e35ad3b70cab46e32f8f7194715e4528fe1f54bc","src/backend/libc/net/mod.rs":"605b818c6f4c536c96e052d9b843eeca79dccd1d3cf1c8b87e60c8539b8122b4","src/backend/libc/net/msghdr.rs":"f82825d40d8872e2e804cde32bbcc68bef43a5f48ad857fb1030550c4eb44838","src/backend/libc/net/read_sockaddr.rs":"4f9998daed06db74ddd25148c56b0a2b0636e0cfe457e19279f7f044b8b8bbdc","src/backend/libc/net/send_recv.rs":"1487ddff61de085915d9ac2e721a15a39307110b3008acffd2653810f00474a3","src/backend/libc/net/syscalls.rs":"bf19b7a9eaf67366e738f1c8f4535bfe097033ca326628529c83d62075125ec9","src/backend/libc/net/write_sockaddr.rs":"14e941b5a11e4d7a17182860c47b1ee972b56ff7f0aadbcc6ab2c8740b13cea9","src/backend/libc/param/auxv.rs":"fdc85b7c33bcd05a16471e42eb4228c48c98c642443635ba5fc3e9a45438d6d3","src/backend/libc/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/backend/libc/pid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/pid/syscalls.rs":"49ea679b96c0741d048e82964038f9a931bc3cf3a0b59c7db3df89629b9c49e6","src/backend/libc/pipe/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/pipe/syscalls.rs":"8affde100f6a9dfc762b79d1e48be5c1039be414f8ef7d5a6acaba882a68d259","src/backend/libc/pipe/types.rs":"1e797beb383bb2e4038f1de21bea204caec4a4922b25a6ef84dbbe6e953e78b0","src/backend/libc/prctl/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/prctl/syscalls.rs":"8a2684f444a7555098dce2b92270d81cefdae902716c6e5d59bd7b0657e8a29d","src/backend/libc/process/cpu_set.rs":"b3d36b01b53b0b6c61a20ed8a69d48eccdd90cc17f82f2926ef1e844f002d0b7","src/backend/libc/process/mod.rs":"d7dc401255bad2e55ffff365339cdc3aad306861d269ad727a817d3cd7763166","src/backend/libc/process/syscalls.rs":"b0b66f4ab88bf92fa906a2691de932fcc5ca6d29052e8cc782ba293318845c24","src/backend/libc/process/types.rs":"5b2d6ba1ba1e5f0db9dc07335df140f957fbe8ce9db5ddb74d2341fc986fe962","src/backend/libc/process/wait.rs":"0cc556aed976b4bbb3965f74fd76b8216c755fce25043b7b21ce54afa07c9773","src/backend/libc/pty/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/pty/syscalls.rs":"ff7068696e23103bbb75fc7e32db09941b864f132e9fbab407e7a5216d0059c4","src/backend/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/rand/syscalls.rs":"78c7201e6bcb75e9cab9486d1878861319f865de2b2c46437be68690bd17bf13","src/backend/libc/rand/types.rs":"7763e6b40e4b9df825fdd2aa5ba1770da999137d04776561167116c58f8fa618","src/backend/libc/system/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/system/syscalls.rs":"846dfb59afe40bbfc78e57afa76f0616d62d25da2daadcd872aea6fa32aafc3b","src/backend/libc/system/types.rs":"6871e16aee14fe2ae03cea798c3e509ffe44778a9c0e5608fd73e2e015876d7e","src/backend/libc/termios/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/termios/syscalls.rs":"94ac755d74b93fd2904a25862e74585848713770d15038c6b29ed743f565b0ab","src/backend/libc/thread/futex.rs":"b666828653b12634bbd7fd709acf69641b648ec40962a1d4f904c5db14d2eff5","src/backend/libc/thread/mod.rs":"fa710053974d7f16a6c49242ee6c10a3b9e1143452b9daeaed8837302a679fff","src/backend/libc/thread/syscalls.rs":"120cb13fe7ffdef7a52ca1d141d31bf189176e9f5862f87bb171d54370a682a9","src/backend/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/time/syscalls.rs":"f82e0725c5af8a52e61ee83aad2c77694f2f7a72ac1e6eb284109a70ac6edc38","src/backend/libc/time/types.rs":"d4e55d2b9fb8de772c8bf5bba157472c49a12c25502e62a9c599a2e6d3196a5b","src/backend/libc/ugid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/ugid/syscalls.rs":"8edf91b8790add23902c9f5418da6b0723a371677f29f490e0c8af852f0f1a0c","src/backend/libc/winsock_c.rs":"3bf3884fd250eca806ffdf96da68e29c133a697810b78b333ea449e523e58562","src/backend/linux_raw/arch/aarch64.rs":"2a255c9135bc8a321c180f52b88eb2b158bc9170cd222149caeae63c24587d44","src/backend/linux_raw/arch/arm.rs":"165bccb5883d0136e55d42091183765f83d86e9d37a7cb2cec9ae8af32774db6","src/backend/linux_raw/arch/mips.rs":"24af364aa93fd4b9917639d473336490a143f0d1723b09f388e72d534160ee51","src/backend/linux_raw/arch/mips32r6.rs":"e436a2ade34f2f7c58b8924462b07a2499dfc951e1e1318d51759444fb8b658e","src/backend/linux_raw/arch/mips64.rs":"897da9ddc877963ad59464d7f81dc59df8a7e91251e6adea14cfd946e2740a1c","src/backend/linux_raw/arch/mips64r6.rs":"3c08aea13c1139fb0dfbe74ca3d0147f007c3aa2eda641afb82c46f6aa4f6cd1","src/backend/linux_raw/arch/mod.rs":"37eaeea601d39be00d170856a31a8ec6a27b0d3ac22ab3ee642ab0e45dee237d","src/backend/linux_raw/arch/powerpc64.rs":"dfb001f8636a5e46d728900b0804fe6c374e5e18a6f0e76d7d62e0c07da74477","src/backend/linux_raw/arch/riscv64.rs":"41d33242d941030f46077dc2b1bc4c7913fe7630d693a5a7eef966bcf38f9d8b","src/backend/linux_raw/arch/thumb.rs":"2fd979ab421248c0a4c592bc0cefee63edc26528f469b71b63eaed35356e42e8","src/backend/linux_raw/arch/x86.rs":"81c73c0a13925854b54db754f533dec565b1db2d9586e210a2450c6f5915171d","src/backend/linux_raw/arch/x86_64.rs":"e929036a1f3cf93ba538f4523b241605cc7b5e61f84ffe6d9d5cdbcb6f73e543","src/backend/linux_raw/c.rs":"a75bef457e00f9584389bc670ced30c3153fce290c0660674b55b1bcc49eef72","src/backend/linux_raw/conv.rs":"bd1a3254b0d540536443fe73c2be2d2b4f955a282026bd028de3dfc387e7821e","src/backend/linux_raw/event/epoll.rs":"9a53e7e0fdb3c1ece8b1fae75e7a11578fd3495122a7e00dc6debd67f4dfa2f4","src/backend/linux_raw/event/mod.rs":"8ae516c22aa6c1a8a7f568a3c95329d6a4b4fe26ba19aa5cf075a92ffdee9d75","src/backend/linux_raw/event/poll_fd.rs":"78d040f7ce0574fc18cebf6b7766c210a3254abdbafe175f51c6b460fa19c514","src/backend/linux_raw/event/syscalls.rs":"52a784855ede12e5e1ccacc7a39fd2e2712ab3270c757924dbf488432d7b7d03","src/backend/linux_raw/event/types.rs":"2ffdcb728587dbc25d302527f4a52296b96013d5199c946291b059ba4f7d466f","src/backend/linux_raw/fs/dir.rs":"d871468c08ea22868f308ce53feb1dbab8740d577441a4f3aadd358baa843d27","src/backend/linux_raw/fs/inotify.rs":"d1c79249e2faddff46ac1c2c460f6e00032d7629c17e294acb00d5914fa09ffc","src/backend/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/backend/linux_raw/fs/mod.rs":"8689e46f9c4c3e1190ae5fe39176c573cccac10b3739472128ca237f41e2686a","src/backend/linux_raw/fs/syscalls.rs":"cdaef997f619da52866e7428cc24f9e5c815fdc0ff53a381a9857dc39e9c2e90","src/backend/linux_raw/fs/types.rs":"0012ca496df786dc0e53f31d29e7c5505702aa89effe8d614a6299f707fbdd1f","src/backend/linux_raw/io/errno.rs":"8f15d735435b722466696094aed8b612b8526658ab7e079f386037cf8a3b1a6e","src/backend/linux_raw/io/mod.rs":"7ae2324427892cca6f5ab53858d847b165f790a72ec25f3d99fb15f0506c9f27","src/backend/linux_raw/io/syscalls.rs":"026f99b397ae521ac4b2ba41acec6547018073a9da5fa355aa8f9ac61298c172","src/backend/linux_raw/io/types.rs":"0cfffdc2fc9c33faa4055f9686db5922676f17d5c069362bae3745f39da3594a","src/backend/linux_raw/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/io_uring/syscalls.rs":"0f7c9cb7ccddf5687e4b9e5b23558871a452a29ac6095a0184a06c47b9b18eb6","src/backend/linux_raw/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mm/syscalls.rs":"369abe984aa972d8083fee20d764a8d57df242c66f897066367416f2fcc832a3","src/backend/linux_raw/mm/types.rs":"9aca15c809df0322bd7a3e7b47b63220bb2727a34b38ce599d69e684d867da68","src/backend/linux_raw/mod.rs":"a0a14bac204a57ea0bb2937f74f22f5bd5992288287727cea7c7c7c4d930f2ca","src/backend/linux_raw/mount/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mount/syscalls.rs":"3947261b5d46b9737f02dc5352c3a3a35c63c461fd75bcd8ae6619dfc0bfb54d","src/backend/linux_raw/mount/types.rs":"8d39c4d6e555c88de5da3115a301562fafdcb3942aa69a0e01d42de8edb1c78f","src/backend/linux_raw/net/addr.rs":"fbb6c071a8ebc2c557c7013d36d4b540c1ff6ed63103d0a8abcacd8977fbf5c8","src/backend/linux_raw/net/mod.rs":"bc9c9c4a8c06b1fb8c57555261176dfb1f3e858a1d89cd2f88e1f31fc126c001","src/backend/linux_raw/net/msghdr.rs":"3198339ccd00224aefdba74e9144818fe387222066a387a9dfd95fd8c48cf9d9","src/backend/linux_raw/net/read_sockaddr.rs":"24075ac4c05fab5fe44aae4445cdd12ec7e474f047150baa9b768741d6b9693d","src/backend/linux_raw/net/send_recv.rs":"0ae37eac8b545cc1cdc149c601ed831d5c9acc3d229f9436029f3ba443a880f8","src/backend/linux_raw/net/syscalls.rs":"2e0532ade90118af2c1c6f48d01d90df06d719fdaf3d356df567927f2a47dabb","src/backend/linux_raw/net/write_sockaddr.rs":"0eeeb7ec8dadf95503a2f89fdc933b8f9c7e45e03fdb343ce490b6cc8eec0f96","src/backend/linux_raw/param/auxv.rs":"ed9e040cc3fbdd39862ab7388d33d6598e1ac72ba3350d1356d4c09e3e641c7e","src/backend/linux_raw/param/init.rs":"8616665e4db7d8b44fe8f8552c4ef16164bbdc0354e285f72372cabb90fe47a3","src/backend/linux_raw/param/libc_auxv.rs":"6f6aa41d463554a6fba09aa7b32e328c3ce70b74739fca0c8437610f1d923362","src/backend/linux_raw/param/mod.rs":"2e6a1a1c00351b9c88bd615aa923f71d76208df5626dd9bea03067f28f81dc31","src/backend/linux_raw/pid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/pid/syscalls.rs":"eef6aa01830ddd510b83f507da2002c03e58318b73744be2c06ebbe33c4f194f","src/backend/linux_raw/pipe/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/pipe/syscalls.rs":"366c730fc3e991bddb9f5a15b8c3917a8e6ace6d1d5a9113b2749e476faf6f83","src/backend/linux_raw/pipe/types.rs":"9d4bd3da7cd078d42574ad7d6b7554e301a1a7e97b292a77993a6d263726ef1e","src/backend/linux_raw/prctl/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/prctl/syscalls.rs":"a18b224307e0d27bda9b7b85c75cd6c7ddfe39f5ce52efb7bb0bf0585b757343","src/backend/linux_raw/process/cpu_set.rs":"dfdcbdf35aff6a3e08e7d38193bf18c12ca8aa64eb0dc417667be82dcc0f7c55","src/backend/linux_raw/process/mod.rs":"fb393c70a9c63ef9a6bf1fb5a2dc94f07d6b0b6987cc5231c15c607015dafd68","src/backend/linux_raw/process/syscalls.rs":"375d0a61b1c8099d82bf75c9652abb766c6ed8963a292c83e1b6473573eae241","src/backend/linux_raw/process/types.rs":"6811ba822bc12a1a6336649151b4adb1f5d3365684a31c07f01953ea9547743d","src/backend/linux_raw/process/wait.rs":"921aee4b0048746087f52615a98edc2aa0fb4b53d6df44be4533098df55d1b05","src/backend/linux_raw/pty/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/pty/syscalls.rs":"ae09c4aecc0ae87b1ca58d82efc58007b9dddaae78460d615f48da19d1cd0f89","src/backend/linux_raw/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/rand/syscalls.rs":"a84f70251672e92f253838bf05e989434f67373233e88d21d8835cbb792b1fe3","src/backend/linux_raw/rand/types.rs":"b7217c98f2da4ecf89225f36eb52c396ba2a73debdeca739ba864a9030b6a23d","src/backend/linux_raw/reg.rs":"39b6234971122d247054bda8c2dc3b44493be30482635baa9e2fcbe048e78cbd","src/backend/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/backend/linux_raw/runtime/syscalls.rs":"fc9c9edbe07dd7644ab75c51a1597a31467a3421301503a072bef93e6df07643","src/backend/linux_raw/runtime/tls.rs":"8d3c5c1e84fce4e3808997176fd40110afd9ce7589f5291ef682caa81549210f","src/backend/linux_raw/system/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/system/syscalls.rs":"4689360343c414bbf99516478076b512bcdad8c9a33aa76756185eae81c84412","src/backend/linux_raw/system/types.rs":"1ceab8d738a71043473b26e97fa3fd79d588a86d4774cbc9b9e1d4f1447a016e","src/backend/linux_raw/termios/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/termios/syscalls.rs":"c8bcd3cd180ea4a78842551a4095e5d18f4c5ea029c2286f636e1237f22bfd0f","src/backend/linux_raw/thread/futex.rs":"0aa0f9f5be6a79de81e82c9f11f1bf8831f682a4b2f6cb29669e1591636f084e","src/backend/linux_raw/thread/mod.rs":"6ad4a4b90b9234e79900b27ebbe8837e3a7a36aec532912e3e253edce5225067","src/backend/linux_raw/thread/syscalls.rs":"0e3dca63be7322e1e9c58456b28eb8548abb9f08b4436b87b139e891c01c446d","src/backend/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/backend/linux_raw/time/syscalls.rs":"451da0bbb66accdf58ee7f2f8746a93b22ee985907a08717a3d3b1650457d878","src/backend/linux_raw/time/types.rs":"56cb936dc36af759e06d0b7bcfa7db02818dff6084c1d1d9a538a6d5945032d5","src/backend/linux_raw/ugid/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/ugid/syscalls.rs":"8c86d251db33b399a1d1cbb8e87afe650b78db84f444d3251309b7a0480b54f7","src/backend/linux_raw/vdso.rs":"d6daee00f7b790970b490a4182a24c143372faa8ccbbfde56db570519481a3a7","src/backend/linux_raw/vdso_wrappers.rs":"60bbde4bed863e067e7c6804b03f2620d06d7459fb3cd1560d4ab1a0cd99df69","src/bitcast.rs":"67b2d5b65afa37730003e96c37b3e890fe51eb2438a69673d75bae7d9b036aa2","src/check_types.rs":"bc31f9b293bfbf272284ed4d0da24e941206a1ac3f18d3abb0b1a61f1ede1dae","src/clockid.rs":"1d2e1cfcf23160b55d6b046d235edf2eb2408f072a8bdef3e3a3871885abdd5a","src/cstr.rs":"9e3fcd57d6af382a9a4f24b97a29eeb05a3ccd5c8fefd666884f6e4438b3c4a3","src/event/eventfd.rs":"81cbd08f7bdf40a6ce1ca692b63da1dc8ba925282990668d9d68f1203e839fa1","src/event/kqueue.rs":"f13f40b97c4413902115408fc2f340e7c82bba42d2468015b007e8ac6ef23132","src/event/mod.rs":"c581952b280963c685473ea36cbf156d5c0c0b74eab80a6ce4f1de42bda4f9be","src/event/poll.rs":"0ee583dbd457a573a82a06c04a2a24bd2c76e751d27a435507d55338e2871327","src/event/port.rs":"4e51ff150e5d17cbd44aa64a38b99c15e26eaaf2e350768b5dcacdfde4fa5212","src/ffi.rs":"c2b8b38c02d72749aceb715c496726caba1f1fa989ad3856d0103a2fafed89ed","src/fs/abs.rs":"d5cd89622f45386dc6a44356dfa5cce7a493a2a69b398c22096e5426b73a6cca","src/fs/at.rs":"dc65a4a70c718e56b3f1d7e8520a99ef57aecb0f2b0fe7e2d9248f9648729ba5","src/fs/constants.rs":"24076a01f8bfc126b0905e9bc0521d2c3a3abc6c3b8c86ddb1e545070d097127","src/fs/copy_file_range.rs":"d3b644374390d482b2ff749a2459458872b57d0dcf9670368739b7833509a7c2","src/fs/cwd.rs":"9f429a79ace6e17455634da09216ee0ad3d067a4541518b3193ae6a8d9ff1e26","src/fs/dir.rs":"347a52f4ca9ac6321c52e802e97ec90d1b4c62ec955c8996fc17f8f5aed69966","src/fs/fadvise.rs":"beef66ebe1310fb92628240b2cde68f744c78e50f6ff61bb1404bd4868d9cae8","src/fs/fcntl.rs":"2085102d05d0ba963e100ab3e3f19dac4ff27d142fbf798626d20a2a596ba96d","src/fs/fcntl_apple.rs":"e2f23f038083621bcdecc98d02ce1023508afaecdb2ed0fba5c8b70f955301e5","src/fs/fcopyfile.rs":"ec95929cbbe02cf49233a785e5238931bb107b7903cc5bc95e4231de960995f2","src/fs/fd.rs":"7ea8cc7da291004d3f19ce6b91af1245d7c385807217076747533e9768a5c1ed","src/fs/file_type.rs":"fefd865f91011f66126213b0994773d99e373b468c31e866002228c98c64ad85","src/fs/getpath.rs":"28f6970fc1bbc37bb35c84724b59eac436ea7407a4522e18c2bdacb1fdd2edd9","src/fs/id.rs":"1b5c8a8baf9a9bb1f895f97189cea4e5982a0d35b192afeec6340a6c6222e0cb","src/fs/ioctl.rs":"e798eb41bbc201c375bc295ad2928c2467b45b4fbbff3c82236dccbc0d6391a5","src/fs/makedev.rs":"85520b484cb7c15ab71ea1c368578ea3b7e484d82f8510db92b6ce9f7ca341ae","src/fs/memfd_create.rs":"15a8f28e040cffd8c24c7903483440f88853b2e538ad48d80f3c00b4b2befdea","src/fs/mod.rs":"ecd20bf01d651b1866b198c4fc0dc8e7d681eb581e28708c8a0abd062de137ce","src/fs/mount.rs":"c96cacbe65aff4c43fc2f5be03baf2b523bda151ade1828b691de1d040d3b2e6","src/fs/openat2.rs":"4a95c15dab533a41201b5fa25c8a212956b7571d58cad696bdaf45af8aef96db","src/fs/raw_dir.rs":"c24d1f963a753397a52fb2f8c49650e067dfc3a297988c0737e458f33a454b3a","src/fs/seek_from.rs":"a9efa0feb9ac789cf47667e91efee2e3f2dcde16cb3b7a928c99da640fa0e0d6","src/fs/sendfile.rs":"e3b2058741cf4b1698f34d84bb37130cf2b72806d522a16fe541e832cde136cb","src/fs/statx.rs":"2884f75e77f9a1c59dbf55cdcd38429104af0364cbbadc550f4840c6fcf19c54","src/fs/sync.rs":"a3b23543834281f347b0f873bd38154d31d404871188ac08f2b20b9196234cfd","src/fs/xattr.rs":"b976eece822f69e768d91e61d86ee990ea18097b20f7ebeedaaf718c61b48962","src/io/close.rs":"0aa3cd05a8fed8e5244f97b8b6c2e7f65ed93a4e5435c6329852bb3da7514440","src/io/dup.rs":"a8a59c5d345dc54c57ded890720c33eb78c4d53917c71e8bb6317f7ed122cb87","src/io/errno.rs":"58a4d20ba0924e4d514e3c876fbe08982f1623187642ae14780815e65989c8c8","src/io/fcntl.rs":"c0f7bd7fce1119b0c1d0085b7ab77d5df02470ae3e06035428a2452dacbec296","src/io/ioctl.rs":"a47a5ec14607142f2c2ffcb93d016b8e86c8b15ba94b56b35382b545db62ea34","src/io/is_read_write.rs":"1bfb9ee5d58e0b29b44af12fe2668c7bccc841358698dcde47f1519ff9bb73b4","src/io/mod.rs":"75f1d0646be1d4c7c08b5887d8119b0103be8c25c43ccd4e0e97015508c0bb8f","src/io/read_write.rs":"54ba528b11601af1338bb0c71a41b256a0033076d30b3946c3fd0bdfa61dd021","src/io_uring.rs":"9ac767310d9bf50a7419c212180b0a0bcc4c7f25903fb6e4c31161be277f6fb7","src/ioctl/bsd.rs":"e33772530b1b2d1e7d61ce53d9267e68d88f7f5df13301f90412d89a46c6faaa","src/ioctl/linux.rs":"286833dd01aa72c0b06e1d734e2d84303455626f5d7ea4a71619411e75a1e965","src/ioctl/mod.rs":"f90f5e91a7362ba94261f2e1c75ecf1f21722a722cc279bc1dddcb840b72cd42","src/ioctl/patterns.rs":"ce7a10d1d4f6bc96c054871f383937ccec5452866ff1ef524a7a811a37b28702","src/lib.rs":"0e8f18006a86e69bee387c91f7598c4b81ca33425dee7c97fa433dd7a7c729e2","src/maybe_polyfill/no_std/io/mod.rs":"77889bb5c5a4f2e50e38379cdaa5d0fef4b0cafc3da056735df01f6deae75747","src/maybe_polyfill/no_std/mod.rs":"ec94a4aab4bc475785e469d10fd6bc95667e1d47d958e9cff3a19049d88c8c80","src/maybe_polyfill/no_std/net/ip_addr.rs":"046327ee244f758f2bc31d3be305d8cd0dfd8342aac1add8259e999b4b46c4a7","src/maybe_polyfill/no_std/net/mod.rs":"b0ee611c454679226a15bf647e7779995f3fe9c8e0507930a0d0613eb414b7c2","src/maybe_polyfill/no_std/net/socket_addr.rs":"bfeb32d32c176cde76323abcffebfc47e9898fb8d7ce3668c602dc8451086a2d","src/maybe_polyfill/no_std/os/fd/mod.rs":"d9dfe2a2c25be727847bcdfe6f4898685af2521850298178ca8d46a8e2ceee88","src/maybe_polyfill/no_std/os/fd/owned.rs":"283c656a4d40b60d137c9412a04d22878e9849056311a7464061af8523c81c08","src/maybe_polyfill/no_std/os/fd/raw.rs":"9cedb353580b932879ddc4dee9936212fefb6d42530dc5cec519a0779d5dee33","src/maybe_polyfill/no_std/os/mod.rs":"27dab639a765827644005d5f2fcc7c825310606b889cc8dd83f54c9528350dc0","src/maybe_polyfill/no_std/os/windows/io/mod.rs":"5bbcc05c83fee5026dd744a994e0458469466d5be39081baa62df07753b92fd2","src/maybe_polyfill/no_std/os/windows/io/raw.rs":"4c32609a489dd938a49328b5637cb3bafb96437f2f9f269ab66d7d3cb90247f6","src/maybe_polyfill/no_std/os/windows/io/socket.rs":"c658f42f24eff44a661f2adfd24a11af80fe9897f3e2af4dc5d2c64808308d65","src/maybe_polyfill/no_std/os/windows/mod.rs":"fdb416f8f231a4e778b5f985b9ae712ece5e1a1402963ad1a5f6a8b9843795f4","src/maybe_polyfill/std/mod.rs":"7c16c86cc73e226e65ead598e4018238b22000a345040b706bf1e1b3eba115fc","src/mm/madvise.rs":"3c262b3713a73fafcedf1b04bb12c048bb11d47ca43c959e5dfa48c27651f4f0","src/mm/mmap.rs":"fc32e308a24c6f351d74306943d67a68093a0b6555b4bdf6cd755bf43795f406","src/mm/mod.rs":"b3a6cb838986d45825b912355cedead761211a494ca6f89b2367a2d2157e340e","src/mm/msync.rs":"9dcfe5f54235e9314a595edb8d548ac79d222bbcc58bb3263cf7e96d603b23ad","src/mm/userfaultfd.rs":"8073443bd181ff0b3ba4d0b1ae67370b4864035a0c8b4898cd709dc47c518ae7","src/mount/fsopen.rs":"160e384e9175fd98669cda1cf3590bb195c2ba7e1c724e9ea06e692595e58ba1","src/mount/mod.rs":"5f0c9df4727592695deb1cd63ae1de021b03dcd9d0d1b68e1f34d12a7136cb19","src/mount/mount_unmount.rs":"8ad11675e5d762d33fbefbed06a6a9f9e52a9b689bd06662446152614321ab77","src/mount/types.rs":"601ae3e10b7dc496fed7f3b40a80e81c6edd7bf13189d7be45c3212d4c684c39","src/net/mod.rs":"a6bc55f9e086caf46a7c00783498d73a328a66f2a991f1ec65d5f13931377b0f","src/net/send_recv/mod.rs":"f33e39c7b228cd8109823b0a0a1aa397cddad504d49e69b36f74c5b84e5070e5","src/net/send_recv/msg.rs":"19caae23209c8de1939687055c230d832a3e45c1dc92cc4fc785edcd7789e849","src/net/socket.rs":"bc825a94831557bf4c2cabd8ef5ae21ffe0986c24f9ada564eefa66270f69ae9","src/net/socket_addr_any.rs":"d07f9e9ef8873aa5bfd85f669952299286ef6f2cc5b9fea383856432e61b850f","src/net/socketpair.rs":"56f4885c31d2664cd16e18a9a88792a4912fedd953cec36dba67e8581fd57921","src/net/sockopt.rs":"3587396e3a595d5e0b5335506b1f506ccfe00219b3ae34092c12f0a4b4a822db","src/net/types.rs":"efe80f74de928ef88f57adcf65310db165eb58015e34d3d9c4e13fec81c4061a","src/net/wsa.rs":"6e546b42f50a851fc833c57cda76cfb347203ed4b0dea574a3d325bf5a2ebf80","src/param/auxv.rs":"988872f9bec2e12f35765ae8963cbb9535d4acaedd4c9a4d07ced6feb70e0aaa","src/param/init.rs":"a31c0e5cea61a1a999767fe74f87c0d59eeb6bce66578b842fe0e0c32be27a55","src/param/mod.rs":"25b10acd5b1da8faa6f5204e6b0379b38bfab667916e886cca64bea01a42dec2","src/path/arg.rs":"ca42e3283e52461b048923f527473847094d61c8f900a090cdef8a220d04e3d5","src/path/dec_int.rs":"fad9793b89eac526953b994cbed6b614f01c25108f9763e19fb98029feda93a4","src/path/mod.rs":"6b1b949c94bcc47e0f08a3f8e8db5b61ff497d0dfd3e0655f51c01d3e4b7dfd6","src/pid.rs":"26bddad73b279de3e496d2ae8d3304e652a0072da82558f688a702c8b05e5c95","src/pipe.rs":"84b90fc1c7f657738c40ffe10715054b69b6f5294015e49a9bb31afa6975e137","src/prctl.rs":"c9daa9397460a27ed6e31fc454fc40dff83720312a002b66f4c178fc005379ec","src/process/chdir.rs":"2c1ebf9bcf8141a98fca814fa88a659674b54f3b6325276fdd52e4f97746b0b0","src/process/chroot.rs":"2b5f6124eb19f26ad2705174f7ad50cdc0a5d15abd59ffcf55421228d82130b4","src/process/exit.rs":"48de66e5504a00cb375d8f415ce63b6225a3f5204268d40726a7d0fbba43f587","src/process/id.rs":"d815b4985336cb0d56efe27e329b9979d7891fba0f32ee52b6732105c593658c","src/process/ioctl.rs":"5b920ab0a7c9e7b5d50235ce4065304ee272f4edb3252bd7d625f1c0d9d78a10","src/process/kill.rs":"7b879e5cff8a064acd0e7488f4e21bd4e4a8506ce380688b72cc48d283ff9c89","src/process/membarrier.rs":"d6c8821ec73019040c926f4e1018f399c286e87074ab9c6692370c88772af044","src/process/mod.rs":"0ef104be820068409648ed83739a51a7dcf07612088f9a6ed6c7ebdb6ad54092","src/process/pidfd.rs":"4be2fba21430ba84244e11c636c91201bc1d1dffff3e63a4da84cc96f501786b","src/process/pidfd_getfd.rs":"cbc42a1548280ae76c3c66e851fd53cc2a3d4c089cb5798c17a2cdf654f0e229","src/process/prctl.rs":"818c7512af581e933d0136b5034966be790fef1bd007c0f0519ebab360ea8da7","src/process/priority.rs":"f135482e71ea8aa0daf92b9f238051178a4c904070fa8409622f94155df3c544","src/process/procctl.rs":"3a1c705ea6405dd1d653f6fec374167c3228ff85cbf8de38629ac32b1e9babbb","src/process/rlimit.rs":"10b79de3ced0e64059a94c879742d46a35a6176c776d8eed75031d5e6340283d","src/process/sched.rs":"7c3bfc5be624e7d7f5e043c3ee0b0566fcab3d684d61c272e7b4233410ab1c42","src/process/sched_yield.rs":"6565faa3928b66ddc74a65e893e15edfa4b9be4f7e5f5f68527501a7f6bc3350","src/process/umask.rs":"1a0f31a842303c978e3f05ec191e2b5e96104c09c6596473b42b1fac34898a50","src/process/wait.rs":"1af98ca39d8816233d2ff8b2ba562afff23265e31fcff2fdd4b2556fdc0cb505","src/procfs.rs":"be94a10adf18c57b555f89814471f598426d2c1be09aad3b4bafc95330ebf174","src/pty.rs":"b68e7420b993c2c454a1b965e9852fc546c6f1b6e63f9cfecf81be50935d502c","src/rand/getrandom.rs":"1c8166a02a74f5593bb4673ef907524df04cbc1568020a5ab2ff7f4aa1283f8b","src/rand/mod.rs":"cab59332aadd9b679f5b22cbb222d48ee028af5eb9fd4a4d43922da659b895d7","src/runtime.rs":"3d3707d74d56520a8317a4f2b0fc0b3dcaed4d18e4bdb3a431015702893d535a","src/signal.rs":"c071b4f011deef19a679d7a832d5408a3cd68627161d6510008d6312266a2611","src/static_assertions.rs":"39986672f489949be1d6469f0c30fb7d2eaa21bdaa2702a8c150b2b150bf5535","src/stdio.rs":"a5de2d7d9c3c5a901f88b6acf4754687c958a2f3a93c7945c2b8fcb948d468af","src/system.rs":"714bcc2a26ea19ac3f019198d7a25e455aaeaec850c1d173706a082fed3ee031","src/termios/ioctl.rs":"a1ac967f7811a482f8bb53847c37c8359f518cd26da9df7b816ba678a0139623","src/termios/mod.rs":"b44b7caa60b6f458657ed58a0e0eca41bb4e6d6be4b0f042bbb8ab7056cebe4b","src/termios/tc.rs":"e41312d15464b83b2457c2502fc3f3b9998cfb02ba68739026dd4285cc7130ac","src/termios/tty.rs":"d59d1fd32dd1db4ad9492d9d55da563bd0477919ee954260d2be274e4516749e","src/termios/types.rs":"8b76a0eeecdd36f2f2056b73d4ecd9ddc22da205d8c87b85e8a4f957c37e511e","src/thread/clock.rs":"469326c822dfb63405ee8537552cedde0b344978280e6645bbadd47dedc71e18","src/thread/futex.rs":"985f9a0dce1e2a4892ae7f26bd1bf119ceae3f9fa6b4707e166624fc1cee76d4","src/thread/id.rs":"ad72db4fea9fccb728310bbfd01ef8c00f6cc60fa2a750f6349646a134f7009b","src/thread/libcap.rs":"a3e316e6d0f58b075125fa939b9b824e1595de20a23d341a36999416b0d10d36","src/thread/mod.rs":"98634ece0b882f123ad887017692f2a4d94a23a1dec278ed660b3497cac5cceb","src/thread/prctl.rs":"ebb271914bcf4f9bf4251434e283e4f06c52a3a38628462dadf02bec84a81b99","src/thread/setns.rs":"730badd8db8ce7b905767b341211f1226eeeb38019727bf994eb64f2531b7b7f","src/time/clock.rs":"e59a29f1bed8c31c3d5b6fad60f2d4fa6cab8dd8e86148bb3693a5e3a1ce735f","src/time/mod.rs":"43afee938c80d124d04d4ba190c03f4d21d1e3bfc154fff309211e4f6eabe940","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/timespec.rs":"79c7af1bfb12b56fd482b778dd783d82c6f3233b26bb11ae3dceb454036b1da7","src/ugid.rs":"6616c6e35b7e43aee5b150f1efae7a50711e0947943c9a96833dbe214ad9e85f","src/utils.rs":"9ae76f8a41d6cc350cdd58c9084b5c3a5a708eeecd769783debdbcbaef442182","src/weak.rs":"c7cf03bf2aeba494b1999ab32183fa8c603ab72e254c0e312a67f168877e410d"},"package":"747c788e9ce8e92b12cd485c49ddf90723550b654b32508f979b71a7b1ecda4f"} \ No newline at end of file
diff --git a/vendor/rustix/Cargo.toml b/vendor/rustix/Cargo.toml
index 8b9e45319..728c75d8c 100644
--- a/vendor/rustix/Cargo.toml
+++ b/vendor/rustix/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2021"
rust-version = "1.63"
name = "rustix"
-version = "0.38.6"
+version = "0.38.14"
authors = [
"Dan Gohman <dev@sunfishcode.online>",
"Jakub Konka <kubkon@jakubkonka.com>",
@@ -78,7 +78,7 @@ optional = true
package = "rustc-std-workspace-alloc"
[dependencies.bitflags]
-version = "2.3.3"
+version = "2.4.0"
default-features = false
[dependencies.compiler_builtins]
@@ -99,7 +99,7 @@ default-features = false
version = "1.0"
[dev-dependencies.libc]
-version = "0.2.147"
+version = "0.2.148"
[dev-dependencies.libc_errno]
version = "0.3.1"
@@ -139,6 +139,7 @@ all-apis = [
"thread",
"time",
]
+alloc = []
cc = []
default = [
"std",
@@ -175,18 +176,25 @@ pty = [
rand = []
runtime = ["linux-raw-sys/prctl"]
rustc-dep-of-std = [
- "core",
- "alloc",
- "compiler_builtins",
+ "dep:core",
+ "dep:alloc",
+ "dep:compiler_builtins",
"linux-raw-sys/rustc-dep-of-std",
"bitflags/rustc-dep-of-std",
+ "compiler_builtins?/rustc-dep-of-std",
+]
+std = [
+ "bitflags/std",
+ "alloc",
+ "libc?/std",
+ "libc_errno?/std",
]
-std = ["bitflags/std"]
stdio = []
system = ["linux-raw-sys/system"]
termios = []
thread = ["linux-raw-sys/prctl"]
time = []
+use-explicitly-provided-auxv = []
use-libc = [
"libc_errno",
"libc",
@@ -206,9 +214,10 @@ default-features = false
version = "0.4"
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))".dependencies.libc]
-version = "0.2.147"
+version = "0.2.148"
features = ["extra_traits"]
optional = true
+default-features = false
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))".dependencies.libc_errno]
version = "0.3.1"
@@ -217,18 +226,20 @@ default-features = false
package = "errno"
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))".dependencies.linux-raw-sys]
-version = "0.4.3"
+version = "0.4.7"
features = [
"general",
"errno",
"ioctl",
"no_std",
+ "elf",
]
default-features = false
[target."cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))".dependencies.libc]
-version = "0.2.147"
+version = "0.2.148"
features = ["extra_traits"]
+default-features = false
[target."cfg(all(not(windows), any(rustix_use_libc, miri, not(all(target_os = \"linux\", target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"riscv64\", all(rustix_use_experimental_asm, target_arch = \"powerpc64\"), all(rustix_use_experimental_asm, target_arch = \"mips\"), all(rustix_use_experimental_asm, target_arch = \"mips32r6\"), all(rustix_use_experimental_asm, target_arch = \"mips64\"), all(rustix_use_experimental_asm, target_arch = \"mips64r6\"), target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))".dependencies.libc_errno]
version = "0.3.1"
diff --git a/vendor/rustix/README.md b/vendor/rustix/README.md
index 985a60fde..96def6e1f 100644
--- a/vendor/rustix/README.md
+++ b/vendor/rustix/README.md
@@ -77,7 +77,7 @@ by default. The rest of the API is conditional with cargo feature flags:
| |
| `use-libc` | Enable the libc backend.
-[`rustix::event`]: https://docs.rs/rustix/*/rustix/fs/index.html
+[`rustix::event`]: https://docs.rs/rustix/*/rustix/event/index.html
[`rustix::fs`]: https://docs.rs/rustix/*/rustix/fs/index.html
[`rustix::io_uring`]: https://docs.rs/rustix/*/rustix/io_uring/index.html
[`rustix::mm`]: https://docs.rs/rustix/*/rustix/mm/index.html
@@ -107,8 +107,8 @@ struct that's 64-bit even on 32-bit platforms.
## Similar crates
-`rustix` is similar to [`nix`], [`simple_libc`], [`unix`], [`nc`], and
-[`uapi`]. `rustix` is architected for [I/O safety] with most APIs using
+`rustix` is similar to [`nix`], [`simple_libc`], [`unix`], [`nc`], [`uapi`],
+and [`rusl`]. `rustix` is architected for [I/O safety] with most APIs using
[`OwnedFd`] and [`AsFd`] to manipulate file descriptors rather than `File` or
even `c_int`, and supporting multiple backends so that it can use direct
syscalls while still being usable on all platforms `libc` supports. Like `nix`,
@@ -155,6 +155,7 @@ version of this crate.
[`nc`]: https://crates.io/crates/nc
[`simple_libc`]: https://crates.io/crates/simple_libc
[`uapi`]: https://crates.io/crates/uapi
+[`rusl`]: https://lib.rs/crates/rusl
[`relibc`]: https://github.com/redox-os/relibc
[`syscall`]: https://crates.io/crates/syscall
[`sc`]: https://crates.io/crates/sc
diff --git a/vendor/rustix/benches/mod.rs b/vendor/rustix/benches/mod.rs
index 97828d431..cd3cb323b 100644
--- a/vendor/rustix/benches/mod.rs
+++ b/vendor/rustix/benches/mod.rs
@@ -4,7 +4,7 @@
//! the "fs", "time", and "process" cargo features.
//!
//! ```sh
-//! RUSTFLAGS=--cfg=criterion cargo bench --features=fs,time,process
+//! RUSTFLAGS=--cfg=criterion cargo bench --features=fs,time,process,stdio
//! ```
#[cfg(any(
@@ -12,6 +12,7 @@
not(feature = "fs"),
not(feature = "process"),
not(feature = "time"),
+ not(feature = "stdio"),
windows,
target_os = "emscripten",
target_os = "redox",
@@ -19,7 +20,7 @@
))]
fn main() {
unimplemented!(
- "Add --cfg=criterion to RUSTFLAGS and enable the \"fs\", \"time\", and \"process\" cargo \
+ "Add --cfg=criterion to RUSTFLAGS and enable the \"fs\", \"time\", \"process\", and \"stdio\" cargo \
features."
)
}
@@ -29,6 +30,7 @@ fn main() {
not(feature = "fs"),
not(feature = "process"),
not(feature = "time"),
+ not(feature = "stdio"),
windows,
target_os = "emscripten",
target_os = "redox",
@@ -41,6 +43,7 @@ use criterion::{criterion_group, criterion_main};
not(feature = "fs"),
not(feature = "process"),
not(feature = "time"),
+ not(feature = "stdio"),
windows,
target_os = "emscripten",
target_os = "redox",
@@ -107,6 +110,27 @@ mod suite {
});
}
+ pub(super) fn simple_fstat(c: &mut Criterion) {
+ use rustix::fs::fstat;
+
+ c.bench_function("simple fstat", |b| {
+ b.iter(|| {
+ fstat(rustix::stdio::stdin()).unwrap();
+ })
+ });
+ }
+
+ pub(super) fn simple_fstat_libc(c: &mut Criterion) {
+ c.bench_function("simple fstat libc", |b| {
+ b.iter(|| {
+ let mut s = std::mem::MaybeUninit::<libc::stat>::uninit();
+ unsafe {
+ assert_eq!(libc::fstat(libc::STDIN_FILENO, s.as_mut_ptr()), 0);
+ }
+ })
+ });
+ }
+
#[cfg(not(target_os = "wasi"))]
pub(super) fn simple_clock_gettime(c: &mut Criterion) {
use rustix::time::{clock_gettime, ClockId};
@@ -160,6 +184,7 @@ mod suite {
not(feature = "fs"),
not(feature = "process"),
not(feature = "time"),
+ not(feature = "stdio"),
windows,
target_os = "emscripten",
target_os = "redox",
@@ -171,6 +196,8 @@ criterion_group!(
suite::simple_statat_libc,
suite::simple_statat_libc_cstr,
suite::simple_statat_cstr,
+ suite::simple_fstat,
+ suite::simple_fstat_libc,
suite::simple_clock_gettime,
suite::simple_clock_gettime_libc,
suite::simple_getpid,
@@ -181,6 +208,7 @@ criterion_group!(
not(feature = "fs"),
not(feature = "process"),
not(feature = "time"),
+ not(feature = "stdio"),
windows,
target_os = "emscripten",
target_os = "redox",
diff --git a/vendor/rustix/build.rs b/vendor/rustix/build.rs
index cf7cf6edf..28891caea 100644
--- a/vendor/rustix/build.rs
+++ b/vendor/rustix/build.rs
@@ -2,7 +2,7 @@ use std::env::var;
use std::io::Write;
/// The directory for inline asm.
-const ASM_PATH: &str = "src/backend/linux_raw/arch/asm";
+const ASM_PATH: &str = "src/backend/linux_raw/arch";
fn main() {
// Don't rerun this on changes other than build.rs, as we only depend on
@@ -34,6 +34,9 @@ fn main() {
// enable the libc backend even if rustix is depended on transitively.
let cfg_use_libc = var("CARGO_CFG_RUSTIX_USE_LIBC").is_ok();
+ // Check for `--features=rustc-dep-of-std`.
+ let rustc_dep_of_std = var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
+
// Check for eg. `RUSTFLAGS=--cfg=rustix_use_experimental_features`. This
// is a rustc flag rather than a cargo feature flag because it's
// experimental and not something we want accidentally enabled via
@@ -52,7 +55,10 @@ fn main() {
// If experimental features are enabled, auto-detect and use available
// features.
- if rustix_use_experimental_features {
+ if rustc_dep_of_std {
+ use_feature("rustc_attrs");
+ use_feature("core_intrinsics");
+ } else if rustix_use_experimental_features {
use_feature_or_nothing("rustc_attrs");
use_feature_or_nothing("core_intrinsics");
}
@@ -71,6 +77,11 @@ fn main() {
use_feature("static_assertions");
}
+ // WASI support can utilize wasi_ext if present.
+ if os == "wasi" {
+ use_feature_or_nothing("wasi_ext");
+ }
+
// If the libc backend is requested, or if we're not on a platform for
// which we have linux_raw support, use the libc backend.
//
diff --git a/vendor/rustix/src/backend/libc/c.rs b/vendor/rustix/src/backend/libc/c.rs
index f9e94416c..eb89fa43a 100644
--- a/vendor/rustix/src/backend/libc/c.rs
+++ b/vendor/rustix/src/backend/libc/c.rs
@@ -1,3 +1,5 @@
+//! Libc and supplemental types and constants.
+
#![allow(unused_imports)]
// Import everything from libc, but we'll add some stuff and override some
@@ -12,6 +14,10 @@ pub(crate) const PROC_SUPER_MAGIC: u32 = 0x0000_9fa0;
#[cfg(all(linux_kernel, target_env = "musl"))]
pub(crate) const NFS_SUPER_MAGIC: u32 = 0x0000_6969;
+#[cfg(feature = "process")]
+#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
+pub(crate) const EXIT_SIGNALED_SIGABRT: c_int = 128 + SIGABRT as c_int;
+
// TODO: Upstream these.
#[cfg(all(linux_kernel, feature = "net"))]
pub(crate) const ETH_P_TSN: c_int = linux_raw_sys::if_ether::ETH_P_TSN as _;
@@ -77,6 +83,9 @@ pub(crate) const IUCLC: tcflag_t = linux_raw_sys::general::IUCLC as _;
#[cfg(all(linux_kernel, feature = "termios"))]
pub(crate) const XCASE: tcflag_t = linux_raw_sys::general::XCASE as _;
+#[cfg(target_os = "aix")]
+pub(crate) const MSG_DONTWAIT: c_int = libc::MSG_NONBLOCK;
+
// On PowerPC, the regular `termios` has the `termios2` fields and there is no
// `termios2`. linux-raw-sys has aliases `termios2` to `termios` to cover this
// difference, but we still need to manually import it since `libc` doesn't
@@ -104,13 +113,15 @@ pub(super) use libc::open64 as open;
pub(super) use libc::posix_fallocate64 as posix_fallocate;
#[cfg(any(all(linux_like, not(target_os = "android")), target_os = "aix"))]
pub(super) use libc::{blkcnt64_t as blkcnt_t, rlim64_t as rlim_t};
+// TODO: AIX has `stat64x`, `fstat64x`, `lstat64x`, and `stat64xat`; add them
+// to the upstream libc crate and implement rustix's `statat` etc. with them.
#[cfg(target_os = "aix")]
pub(super) use libc::{
- blksize64_t as blksize_t, fstat64 as fstat, fstatat, fstatfs64 as fstatfs,
- fstatvfs64 as fstatvfs, ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino_t,
- lseek64 as lseek, mmap, off64_t as off_t, openat, posix_fadvise64 as posix_fadvise, preadv,
- pwritev, rlimit64 as rlimit, setrlimit64 as setrlimit, statfs64 as statfs,
- statvfs64 as statvfs, RLIM_INFINITY,
+ blksize64_t as blksize_t, fstat64 as fstat, fstatfs64 as fstatfs, fstatvfs64 as fstatvfs,
+ ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino_t, lseek64 as lseek, mmap,
+ off64_t as off_t, openat, posix_fadvise64 as posix_fadvise, preadv, pwritev,
+ rlimit64 as rlimit, setrlimit64 as setrlimit, statfs64 as statfs, statvfs64 as statvfs,
+ RLIM_INFINITY,
};
#[cfg(linux_like)]
pub(super) use libc::{
diff --git a/vendor/rustix/src/backend/libc/conv.rs b/vendor/rustix/src/backend/libc/conv.rs
index baf2a05ed..19bf0a7db 100644
--- a/vendor/rustix/src/backend/libc/conv.rs
+++ b/vendor/rustix/src/backend/libc/conv.rs
@@ -3,7 +3,7 @@
//! for converting between rustix's types and libc types.
use super::c;
-#[cfg(not(any(windows, target_os = "espidf")))]
+#[cfg(all(feature = "alloc", not(any(windows, target_os = "espidf"))))]
use super::fd::IntoRawFd;
use super::fd::{AsRawFd, BorrowedFd, FromRawFd, LibcFd, OwnedFd, RawFd};
#[cfg(not(windows))]
@@ -27,7 +27,10 @@ pub(super) fn borrowed_fd(fd: BorrowedFd<'_>) -> LibcFd {
fd.as_raw_fd() as LibcFd
}
-#[cfg(not(any(windows, target_os = "espidf", target_os = "redox")))]
+#[cfg(all(
+ feature = "alloc",
+ not(any(windows, target_os = "espidf", target_os = "redox"))
+))]
#[inline]
pub(super) fn owned_fd(fd: OwnedFd) -> LibcFd {
fd.into_raw_fd() as LibcFd
@@ -133,7 +136,7 @@ pub(super) fn ret_discarded_fd(raw: LibcFd) -> io::Result<()> {
}
}
-#[cfg(not(any(windows, target_os = "wasi")))]
+#[cfg(all(feature = "alloc", not(any(windows, target_os = "wasi"))))]
#[inline]
pub(super) fn ret_discarded_char_ptr(raw: *mut c::c_char) -> io::Result<()> {
if raw.is_null() {
@@ -205,6 +208,7 @@ pub(crate) fn msg_iov_len(len: usize) -> c::c_int {
bsd,
solarish,
target_env = "musl",
+ target_os = "aix",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "haiku",
@@ -221,6 +225,7 @@ pub(crate) fn msg_control_len(len: usize) -> c::socklen_t {
solarish,
windows,
target_env = "musl",
+ target_os = "aix",
target_os = "emscripten",
target_os = "espidf",
target_os = "fuchsia",
diff --git a/vendor/rustix/src/backend/libc/event/epoll.rs b/vendor/rustix/src/backend/libc/event/epoll.rs
index c59a38cd4..a6087a167 100644
--- a/vendor/rustix/src/backend/libc/event/epoll.rs
+++ b/vendor/rustix/src/backend/libc/event/epoll.rs
@@ -92,6 +92,9 @@ bitflags! {
pub struct CreateFlags: u32 {
/// `EPOLL_CLOEXEC`
const CLOEXEC = bitcast!(c::EPOLL_CLOEXEC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -145,6 +148,9 @@ bitflags! {
/// `EPOLLEXCLUSIVE`
#[cfg(not(target_os = "android"))]
const EXCLUSIVE = bitcast!(c::EPOLLEXCLUSIVE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -160,11 +166,11 @@ pub fn create(flags: CreateFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::epoll_create1(bitflags_bits!(flags))) }
}
-/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
-/// epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an epoll
+/// object.
///
-/// This registers interest in any of the events set in `events` occurring
-/// on the file descriptor associated with `data`.
+/// This registers interest in any of the events set in `events` occurring on
+/// the file descriptor associated with `data`.
///
/// If [`delete`] is not called on the I/O source passed into this function
/// before the I/O source is `close`d, then the `epoll` will act as if the I/O
@@ -198,8 +204,8 @@ pub fn add(
}
}
-/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
-/// a given epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in a
+/// given epoll object.
///
/// This sets the events of interest with `target` to `events`.
#[doc(alias = "epoll_ctl")]
@@ -229,8 +235,8 @@ pub fn modify(
}
}
-/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
-/// a given epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in a
+/// given epoll object.
#[doc(alias = "epoll_ctl")]
pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
// SAFETY: We're calling `epoll_ctl` via FFI and we know how it
@@ -341,8 +347,8 @@ impl EventData {
/// Return the value as a `u64`.
///
- /// If the stored value was a pointer, the pointer is zero-extended to
- /// a `u64`.
+ /// If the stored value was a pointer, the pointer is zero-extended to a
+ /// `u64`.
#[inline]
pub fn u64(self) -> u64 {
unsafe { self.as_u64 }
diff --git a/vendor/rustix/src/backend/libc/event/mod.rs b/vendor/rustix/src/backend/libc/event/mod.rs
index 6aed4612a..44e8a090a 100644
--- a/vendor/rustix/src/backend/libc/event/mod.rs
+++ b/vendor/rustix/src/backend/libc/event/mod.rs
@@ -5,5 +5,5 @@ pub(crate) mod types;
#[cfg_attr(windows, path = "windows_syscalls.rs")]
pub(crate) mod syscalls;
-#[cfg(linux_kernel)]
+#[cfg(all(feature = "alloc", linux_kernel))]
pub mod epoll;
diff --git a/vendor/rustix/src/backend/libc/event/poll_fd.rs b/vendor/rustix/src/backend/libc/event/poll_fd.rs
index a06812aaa..3f795d5aa 100644
--- a/vendor/rustix/src/backend/libc/event/poll_fd.rs
+++ b/vendor/rustix/src/backend/libc/event/poll_fd.rs
@@ -47,6 +47,9 @@ bitflags! {
not(any(target_arch = "sparc", target_arch = "sparc64"))),
)]
const RDHUP = c::POLLRDHUP;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -112,7 +115,7 @@ impl<'fd> PollFd<'fd> {
/// Returns the ready events.
#[inline]
pub fn revents(&self) -> PollFlags {
- // Use `unwrap()` here because in theory we know we know all the bits
+ // Use `.unwrap()` here because in theory we know we know all the bits
// the OS might set here, but OS's have added extensions in the past.
PollFlags::from_bits(self.pollfd.revents).unwrap()
}
@@ -123,7 +126,7 @@ impl<'fd> AsFd for PollFd<'fd> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
// SAFETY: Our constructors and `set_fd` require `pollfd.fd` to be
- // valid for the `fd lifetime.
+ // valid for the `'fd` lifetime.
unsafe { BorrowedFd::borrow_raw(self.pollfd.fd) }
}
}
@@ -133,7 +136,7 @@ impl<'fd> AsSocket for PollFd<'fd> {
#[inline]
fn as_socket(&self) -> BorrowedFd<'_> {
// SAFETY: Our constructors and `set_fd` require `pollfd.fd` to be
- // valid for the `fd lifetime.
+ // valid for the `'fd` lifetime.
unsafe { BorrowedFd::borrow_raw(self.pollfd.fd as RawFd) }
}
}
diff --git a/vendor/rustix/src/backend/libc/event/syscalls.rs b/vendor/rustix/src/backend/libc/event/syscalls.rs
index eac88d4bb..f2dcdf5ad 100644
--- a/vendor/rustix/src/backend/libc/event/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/event/syscalls.rs
@@ -5,7 +5,7 @@ use crate::backend::conv::ret_c_int;
#[cfg(any(apple, netbsdlike, target_os = "dragonfly", target_os = "solaris"))]
use crate::backend::conv::ret_owned_fd;
use crate::event::PollFd;
-#[cfg(any(linux_kernel, bsd, solarish))]
+#[cfg(any(linux_kernel, bsd, solarish, target_os = "espidf"))]
use crate::fd::OwnedFd;
use crate::io;
#[cfg(any(bsd, solarish))]
@@ -15,12 +15,22 @@ use {
crate::backend::conv::ret, crate::event::port::Event, crate::utils::as_mut_ptr,
core::ptr::null_mut,
};
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
use {crate::backend::conv::ret_owned_fd, crate::event::EventfdFlags};
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
use {crate::event::kqueue::Event, crate::utils::as_ptr, core::ptr::null};
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> {
#[cfg(linux_kernel)]
unsafe {
@@ -45,18 +55,18 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd>
ret_owned_fd(eventfd(initval, bitflags_bits!(flags)))
}
- #[cfg(target_os = "illumos")]
+ #[cfg(any(target_os = "illumos", target_os = "espidf"))]
unsafe {
ret_owned_fd(c::eventfd(initval, bitflags_bits!(flags)))
}
}
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
pub(crate) fn kqueue() -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::kqueue()) }
}
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
pub(crate) unsafe fn kevent(
kq: BorrowedFd<'_>,
changelist: &[Event],
@@ -137,7 +147,7 @@ pub(crate) fn port_get(
Ok(Event(unsafe { event.assume_init() }))
}
-#[cfg(solarish)]
+#[cfg(all(feature = "alloc", solarish))]
pub(crate) fn port_getn(
port: BorrowedFd<'_>,
timeout: Option<&mut c::timespec>,
diff --git a/vendor/rustix/src/backend/libc/event/types.rs b/vendor/rustix/src/backend/libc/event/types.rs
index 632b1be63..af052a434 100644
--- a/vendor/rustix/src/backend/libc/event/types.rs
+++ b/vendor/rustix/src/backend/libc/event/types.rs
@@ -1,7 +1,19 @@
#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
-use {crate::backend::c, bitflags::bitflags};
+use crate::backend::c;
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
+use bitflags::bitflags;
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
bitflags! {
/// `EFD_*` flags for use with [`eventfd`].
///
@@ -10,10 +22,16 @@ bitflags! {
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct EventfdFlags: u32 {
/// `EFD_CLOEXEC`
+ #[cfg(not(target_os = "espidf"))]
const CLOEXEC = bitcast!(c::EFD_CLOEXEC);
/// `EFD_NONBLOCK`
+ #[cfg(not(target_os = "espidf"))]
const NONBLOCK = bitcast!(c::EFD_NONBLOCK);
/// `EFD_SEMAPHORE`
+ #[cfg(not(target_os = "espidf"))]
const SEMAPHORE = bitcast!(c::EFD_SEMAPHORE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/fs/inotify.rs b/vendor/rustix/src/backend/libc/fs/inotify.rs
index 05d4d904f..fea2fad06 100644
--- a/vendor/rustix/src/backend/libc/fs/inotify.rs
+++ b/vendor/rustix/src/backend/libc/fs/inotify.rs
@@ -17,6 +17,9 @@ bitflags! {
const CLOEXEC = bitcast!(c::IN_CLOEXEC);
/// `IN_NONBLOCK`
const NONBLOCK = bitcast!(c::IN_NONBLOCK);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -71,6 +74,9 @@ bitflags! {
const ONESHOT = c::IN_ONESHOT;
/// `IN_ONLYDIR`
const ONLYDIR = c::IN_ONLYDIR;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -98,22 +104,23 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
path: P,
flags: WatchFlags,
) -> io::Result<i32> {
- let path = path.as_cow_c_str().unwrap();
- // SAFETY: The fd and path we are passing is guaranteed valid by the type
- // system.
- unsafe {
- ret_c_int(c::inotify_add_watch(
- borrowed_fd(inot),
- c_str(&path),
- flags.bits(),
- ))
- }
+ path.into_with_c_str(|path| {
+ // SAFETY: The fd and path we are passing is guaranteed valid by the type
+ // system.
+ unsafe {
+ ret_c_int(c::inotify_add_watch(
+ borrowed_fd(inot),
+ c_str(path),
+ flags.bits(),
+ ))
+ }
+ })
}
/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify
///
-/// The watch descriptor provided should have previously been returned
-/// by [`inotify_add_watch`] and not previously have been removed.
+/// The watch descriptor provided should have previously been returned by
+/// [`inotify_add_watch`] and not previously have been removed.
#[doc(alias = "inotify_rm_watch")]
pub fn inotify_remove_watch(inot: BorrowedFd<'_>, wd: i32) -> io::Result<()> {
// Android's `inotify_rm_watch` takes `u32` despite that
diff --git a/vendor/rustix/src/backend/libc/fs/makedev.rs b/vendor/rustix/src/backend/libc/fs/makedev.rs
index 640d5005b..aa1210283 100644
--- a/vendor/rustix/src/backend/libc/fs/makedev.rs
+++ b/vendor/rustix/src/backend/libc/fs/makedev.rs
@@ -30,8 +30,8 @@ pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
- // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit,
- // so we do it ourselves.
+ // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, so we do
+ // it ourselves.
((u64::from(maj) & 0xffff_f000_u64) << 32)
| ((u64::from(maj) & 0x0000_0fff_u64) << 8)
| ((u64::from(min) & 0xffff_ff00_u64) << 12)
@@ -86,8 +86,8 @@ pub(crate) fn major(dev: Dev) -> u32 {
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
#[inline]
pub(crate) fn major(dev: Dev) -> u32 {
- // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit,
- // so we do it ourselves.
+ // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, so we do
+ // it ourselves.
(((dev >> 31 >> 1) & 0xffff_f000) | ((dev >> 8) & 0x0000_0fff)) as u32
}
@@ -125,8 +125,8 @@ pub(crate) fn minor(dev: Dev) -> u32 {
#[cfg(all(target_os = "android", target_pointer_width = "32"))]
#[inline]
pub(crate) fn minor(dev: Dev) -> u32 {
- // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit,
- // so we do it ourselves.
+ // 32-bit Android's `dev_t` is 32-bit, but its `st_dev` is 64-bit, so we do
+ // it ourselves.
(((dev >> 12) & 0xffff_ff00) | (dev & 0x0000_00ff)) as u32
}
diff --git a/vendor/rustix/src/backend/libc/fs/mod.rs b/vendor/rustix/src/backend/libc/fs/mod.rs
index 17b4da70f..9a0b1d3e5 100644
--- a/vendor/rustix/src/backend/libc/fs/mod.rs
+++ b/vendor/rustix/src/backend/libc/fs/mod.rs
@@ -1,4 +1,4 @@
-#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
+#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
pub(crate) mod dir;
#[cfg(linux_kernel)]
pub mod inotify;
@@ -12,3 +12,11 @@ pub(crate) mod makedev;
#[cfg(not(windows))]
pub(crate) mod syscalls;
pub(crate) mod types;
+
+// TODO: Fix linux-raw-sys to define ioctl codes for sparc.
+#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
+pub(crate) const EXT4_IOC_RESIZE_FS: crate::ioctl::RawOpcode = 0x8008_6610;
+
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+pub(crate) const EXT4_IOC_RESIZE_FS: crate::ioctl::RawOpcode =
+ linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS as crate::ioctl::RawOpcode;
diff --git a/vendor/rustix/src/backend/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs
index 698bf34ad..5df25daa9 100644
--- a/vendor/rustix/src/backend/libc/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs
@@ -1,9 +1,9 @@
//! libc syscalls supporting `rustix::fs`.
use crate::backend::c;
-use crate::backend::conv::{
- borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd, ret_usize,
-};
+#[cfg(any(apple, linux_kernel, feature = "alloc"))]
+use crate::backend::conv::ret_usize;
+use crate::backend::conv::{borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd};
use crate::fd::{BorrowedFd, OwnedFd};
use crate::ffi::CStr;
#[cfg(apple)]
@@ -90,6 +90,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<Owned
target_arch = "aarch64",
target_arch = "riscv32",
target_arch = "riscv64",
+ target_arch = "csky",
target_arch = "loongarch64"
))]
{
@@ -101,6 +102,7 @@ fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<Owned
target_arch = "aarch64",
target_arch = "riscv32",
target_arch = "riscv64",
+ target_arch = "csky",
target_arch = "loongarch64"
)))]
unsafe {
@@ -128,8 +130,8 @@ pub(crate) fn open(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result<OwnedF
return open_via_syscall(path, oflags, mode);
}
- // On these platforms, `mode_t` is `u16` and can't be passed directly to
- // a variadic function.
+ // On these platforms, `mode_t` is `u16` and can't be passed directly to a
+ // variadic function.
#[cfg(any(
apple,
freebsdlike,
@@ -191,8 +193,8 @@ pub(crate) fn openat(
return openat_via_syscall(dirfd, path, oflags, mode);
}
- // On these platforms, `mode_t` is `u16` and can't be passed directly to
- // a variadic function.
+ // On these platforms, `mode_t` is `u16` and can't be passed directly to a
+ // variadic function.
#[cfg(any(
apple,
freebsdlike,
@@ -246,6 +248,7 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
}
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
unsafe {
@@ -255,7 +258,7 @@ pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
}
}
-#[cfg(not(target_os = "redox"))]
+#[cfg(all(feature = "alloc", not(target_os = "redox")))]
#[inline]
pub(crate) fn readlinkat(
dirfd: BorrowedFd<'_>,
@@ -615,7 +618,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result<Stat> {
}
}
-#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
+#[cfg(not(any(target_os = "aix", target_os = "espidf", target_os = "redox")))]
pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<Stat> {
// See the comments in `fstat` about using `crate::fs::statx` here.
#[cfg(all(
@@ -785,9 +788,6 @@ pub(crate) fn utimensat(
unsafe {
use crate::utils::as_ptr;
- // Assert that `Timestamps` has the expected layout.
- let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone());
-
ret(c::utimensat(
borrowed_fd(dirfd),
c_str(path),
@@ -823,9 +823,6 @@ pub(crate) fn utimensat(
// If we have `utimensat`, use it.
if let Some(have_utimensat) = utimensat.get() {
- // Assert that `Timestamps` has the expected layout.
- let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone());
-
return ret(have_utimensat(
borrowed_fd(dirfd),
c_str(path),
@@ -1094,9 +1091,6 @@ pub(crate) fn copy_file_range(
) via SYS_copy_file_range -> c::ssize_t
}
- #[cfg(test)]
- assert_eq_size!(c::loff_t, u64);
-
let mut off_in_val: c::loff_t = 0;
let mut off_out_val: c::loff_t = 0;
// Silently cast; we'll get `EINVAL` if the value is negative.
@@ -1234,9 +1228,9 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
}
SeekFrom::End(offset) => (c::SEEK_END, offset),
SeekFrom::Current(offset) => (c::SEEK_CUR, offset),
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ #[cfg(any(apple, freebsdlike, linux_kernel, solarish))]
SeekFrom::Data(offset) => (c::SEEK_DATA, offset),
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ #[cfg(any(apple, freebsdlike, linux_kernel, solarish))]
SeekFrom::Hole(offset) => (c::SEEK_HOLE, offset),
};
@@ -1273,6 +1267,14 @@ pub(crate) fn fchmod(fd: BorrowedFd<'_>, mode: Mode) -> io::Result<()> {
unsafe { ret(fchmod(borrowed_fd(fd), mode.bits() as c::mode_t)) }
}
+#[cfg(not(target_os = "wasi"))]
+pub(crate) fn chown(path: &CStr, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
+ unsafe {
+ let (ow, gr) = crate::ugid::translate_fchown_args(owner, group);
+ ret(c::chown(c_str(path), ow, gr))
+ }
+}
+
#[cfg(linux_kernel)]
pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
// Use `c::syscall` rather than `c::fchown` because some libc
@@ -1420,7 +1422,10 @@ fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs {
f_files: from.f_files as u64,
f_ffree: from.f_ffree as u64,
f_favail: from.f_ffree as u64,
+ #[cfg(not(target_os = "aix"))]
f_fsid: from.f_fsid as u64,
+ #[cfg(target_os = "aix")]
+ f_fsid: ((from.f_fsid.val[0] as u64) << 32) | from.f_fsid.val[1],
f_flag: StatVfsMountFlags::from_bits_retain(from.f_flag as u64),
f_namemax: from.f_namemax as u64,
}
@@ -1453,9 +1458,6 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
unsafe {
use crate::utils::as_ptr;
- // Assert that `Timestamps` has the expected layout.
- let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone());
-
ret(c::futimens(borrowed_fd(fd), as_ptr(times).cast()))
}
@@ -1480,9 +1482,6 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
// If we have `futimens`, use it.
if let Some(have_futimens) = futimens.get() {
- // Assert that `Timestamps` has the expected layout.
- let _ = core::mem::transmute::<Timestamps, [c::timespec; 2]>(times.clone());
-
return ret(have_futimens(borrowed_fd(fd), as_ptr(times).cast()));
}
@@ -2049,12 +2048,12 @@ pub(crate) fn fcntl_fullfsync(fd: BorrowedFd<'_>) -> io::Result<()> {
}
#[cfg(apple)]
-pub(crate) fn fcntl_nocache(fd: BorrowedFd, value: bool) -> io::Result<()> {
+pub(crate) fn fcntl_nocache(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_NOCACHE, value as c::c_int)) }
}
#[cfg(apple)]
-pub(crate) fn fcntl_global_nocache(fd: BorrowedFd, value: bool) -> io::Result<()> {
+pub(crate) fn fcntl_global_nocache(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
unsafe {
ret(c::fcntl(
borrowed_fd(fd),
@@ -2420,51 +2419,15 @@ pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> {
}
}
-#[cfg(linux_kernel)]
-#[inline]
-pub(crate) fn ioctl_blksszget(fd: BorrowedFd) -> io::Result<u32> {
- let mut result = MaybeUninit::<c::c_uint>::uninit();
- unsafe {
- ret(c::ioctl(borrowed_fd(fd), c::BLKSSZGET, result.as_mut_ptr()))?;
- Ok(result.assume_init() as u32)
- }
-}
-
-#[cfg(linux_kernel)]
-#[inline]
-pub(crate) fn ioctl_blkpbszget(fd: BorrowedFd) -> io::Result<u32> {
- let mut result = MaybeUninit::<c::c_uint>::uninit();
- unsafe {
- ret(c::ioctl(
- borrowed_fd(fd),
- c::BLKPBSZGET,
- result.as_mut_ptr(),
- ))?;
- Ok(result.assume_init() as u32)
- }
-}
-
-// Sparc lacks `FICLONE`.
-#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
-pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe {
- ret(c::ioctl(
- borrowed_fd(fd),
- c::FICLONE as _,
- borrowed_fd(src_fd),
- ))
- }
-}
-
-#[cfg(linux_kernel)]
-#[inline]
-pub(crate) fn ext4_ioc_resize_fs(fd: BorrowedFd<'_>, blocks: u64) -> io::Result<()> {
- // TODO: Fix linux-raw-sys to define ioctl codes for sparc.
- #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
- const EXT4_IOC_RESIZE_FS: u32 = 0x8008_6610;
-
- #[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
- use linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS;
+#[test]
+fn test_sizes() {
+ #[cfg(linux_kernel)]
+ assert_eq_size!(c::loff_t, u64);
- unsafe { ret(c::ioctl(borrowed_fd(fd), EXT4_IOC_RESIZE_FS as _, &blocks)) }
+ // Assert that `Timestamps` has the expected layout. If we're not fixing
+ // y2038, libc's type should match ours. If we are, it's smaller.
+ #[cfg(not(fix_y2038))]
+ assert_eq_size!([c::timespec; 2], Timestamps);
+ #[cfg(fix_y2038)]
+ assert!(core::mem::size_of::<[c::timespec; 2]>() < core::mem::size_of::<Timestamps>());
}
diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs
index 955bdaa29..cf86861dc 100644
--- a/vendor/rustix/src/backend/libc/fs/types.rs
+++ b/vendor/rustix/src/backend/libc/fs/types.rs
@@ -20,6 +20,9 @@ bitflags! {
/// `F_OK`
const EXISTS = c::F_OK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -73,6 +76,9 @@ bitflags! {
/// `AT_STATX_DONT_SYNC`
#[cfg(all(target_os = "linux", target_env = "gnu"))]
const STATX_DONT_SYNC = bitcast!(c::AT_STATX_DONT_SYNC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -86,64 +92,67 @@ bitflags! {
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct Mode: RawMode {
/// `S_IRWXU`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const RWXU = c::S_IRWXU as RawMode;
/// `S_IRUSR`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const RUSR = c::S_IRUSR as RawMode;
/// `S_IWUSR`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const WUSR = c::S_IWUSR as RawMode;
/// `S_IXUSR`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const XUSR = c::S_IXUSR as RawMode;
/// `S_IRWXG`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const RWXG = c::S_IRWXG as RawMode;
/// `S_IRGRP`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const RGRP = c::S_IRGRP as RawMode;
/// `S_IWGRP`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const WGRP = c::S_IWGRP as RawMode;
/// `S_IXGRP`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const XGRP = c::S_IXGRP as RawMode;
/// `S_IRWXO`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const RWXO = c::S_IRWXO as RawMode;
/// `S_IROTH`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const ROTH = c::S_IROTH as RawMode;
/// `S_IWOTH`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const WOTH = c::S_IWOTH as RawMode;
/// `S_IXOTH`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const XOTH = c::S_IXOTH as RawMode;
/// `S_ISUID`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const SUID = c::S_ISUID as RawMode;
/// `S_ISGID`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const SGID = c::S_ISGID as RawMode;
/// `S_ISVTX`
- #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags.
+ #[cfg(not(target_os = "espidf"))]
const SVTX = c::S_ISVTX as RawMode;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -249,6 +258,8 @@ bitflags! {
const WRONLY = bitcast!(c::O_WRONLY);
/// `O_RDWR`
+ ///
+ /// This is not equal to `RDONLY | WRONLY`. It's a distinct flag.
const RDWR = bitcast!(c::O_RDWR);
/// `O_NOCTTY`
@@ -316,6 +327,9 @@ bitflags! {
/// `O_EMPTY_PATH`
#[cfg(target_os = "freebsd")]
const EMPTY_PATH = bitcast!(c::O_EMPTY_PATH);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -332,6 +346,9 @@ bitflags! {
/// `CLONE_NOOWNERCOPY`
const NOOWNERCOPY = 2;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -374,6 +391,9 @@ bitflags! {
/// `COPYFILE_ALL`
const ALL = copyfile::ALL;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -402,6 +422,9 @@ bitflags! {
/// `RESOLVE_CACHED` (since Linux 5.12)
const CACHED = 0x20;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -421,6 +444,9 @@ bitflags! {
/// `RENAME_WHITEOUT`
const WHITEOUT = bitcast!(c::RENAME_WHITEOUT);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -497,6 +523,7 @@ impl FileType {
/// Construct a `FileType` from the `d_type` field of a `c::dirent`.
#[cfg(not(any(
solarish,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -595,6 +622,9 @@ bitflags! {
const HUGE_2GB = c::MFD_HUGE_2GB;
/// `MFD_HUGE_16GB`
const HUGE_16GB = c::MFD_HUGE_16GB;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -608,17 +638,20 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct SealFlags: u32 {
- /// `F_SEAL_SEAL`.
- const SEAL = bitcast!(c::F_SEAL_SEAL);
- /// `F_SEAL_SHRINK`.
- const SHRINK = bitcast!(c::F_SEAL_SHRINK);
- /// `F_SEAL_GROW`.
- const GROW = bitcast!(c::F_SEAL_GROW);
- /// `F_SEAL_WRITE`.
- const WRITE = bitcast!(c::F_SEAL_WRITE);
- /// `F_SEAL_FUTURE_WRITE` (since Linux 5.1)
- #[cfg(linux_kernel)]
- const FUTURE_WRITE = bitcast!(c::F_SEAL_FUTURE_WRITE);
+ /// `F_SEAL_SEAL`.
+ const SEAL = bitcast!(c::F_SEAL_SEAL);
+ /// `F_SEAL_SHRINK`.
+ const SHRINK = bitcast!(c::F_SEAL_SHRINK);
+ /// `F_SEAL_GROW`.
+ const GROW = bitcast!(c::F_SEAL_GROW);
+ /// `F_SEAL_WRITE`.
+ const WRITE = bitcast!(c::F_SEAL_WRITE);
+ /// `F_SEAL_FUTURE_WRITE` (since Linux 5.1)
+ #[cfg(linux_kernel)]
+ const FUTURE_WRITE = bitcast!(c::F_SEAL_FUTURE_WRITE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -677,6 +710,9 @@ bitflags! {
/// `STATX_ALL`
const ALL = c::STATX_ALL;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -735,6 +771,9 @@ bitflags! {
/// `STATX_ALL`
const ALL = 0xfff;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -817,6 +856,9 @@ bitflags! {
target_os = "wasi",
)))]
const UNSHARE_RANGE = bitcast!(c::FALLOC_FL_UNSHARE_RANGE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -866,6 +908,9 @@ bitflags! {
/// `ST_SYNCHRONOUS`
#[cfg(any(linux_kernel, target_os = "emscripten", target_os = "fuchsia"))]
const SYNCHRONOUS = c::ST_SYNCHRONOUS as u64;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/io/errno.rs b/vendor/rustix/src/backend/libc/io/errno.rs
index aabd45f8c..1448fe7bd 100644
--- a/vendor/rustix/src/backend/libc/io/errno.rs
+++ b/vendor/rustix/src/backend/libc/io/errno.rs
@@ -6,10 +6,32 @@
use crate::backend::c;
use libc_errno::errno;
-/// The error type for `rustix` APIs.
+/// `errno`—An error code.
///
-/// This is similar to `std::io::Error`, but only holds an OS error code,
-/// and no extra error value.
+/// The error type for `rustix` APIs. This is similar to [`std::io::Error`],
+/// but only holds an OS error code, and no extra error value.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html
+/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno
+/// [NetBSD]: https://man.netbsd.org/errno.2
+/// [OpenBSD]: https://man.openbsd.org/errno.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=errno&section=2
+/// [illumos]: https://illumos.org/man/3C/errno
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
+/// [`std::io::Error`]: Result
#[repr(transparent)]
#[doc(alias = "errno")]
#[derive(Eq, PartialEq, Hash, Copy, Clone)]
diff --git a/vendor/rustix/src/backend/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs
index 362af11ee..19ecfa9b6 100644
--- a/vendor/rustix/src/backend/libc/io/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/syscalls.rs
@@ -15,6 +15,7 @@ use crate::io::DupFlags;
#[cfg(linux_kernel)]
use crate::io::ReadWriteFlags;
use crate::io::{self, FdFlags};
+use crate::ioctl::{IoctlOutput, RawOpcode};
use core::cmp::min;
#[cfg(all(feature = "fs", feature = "net"))]
use libc_errno::errno;
@@ -78,7 +79,7 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result<
}
#[cfg(not(target_os = "espidf"))]
-pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result<usize> {
+pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
unsafe {
ret_usize(c::readv(
borrowed_fd(fd),
@@ -89,7 +90,7 @@ pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result<u
}
#[cfg(not(target_os = "espidf"))]
-pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize> {
+pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice<'_>]) -> io::Result<usize> {
unsafe {
ret_usize(c::writev(
borrowed_fd(fd),
@@ -108,7 +109,7 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize>
)))]
pub(crate) fn preadv(
fd: BorrowedFd<'_>,
- bufs: &mut [IoSliceMut],
+ bufs: &mut [IoSliceMut<'_>],
offset: u64,
) -> io::Result<usize> {
// Silently cast; we'll get `EINVAL` if the value is negative.
@@ -130,7 +131,7 @@ pub(crate) fn preadv(
target_os = "redox",
target_os = "solaris"
)))]
-pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::Result<usize> {
+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;
unsafe {
@@ -146,7 +147,7 @@ pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::
#[cfg(linux_kernel)]
pub(crate) fn preadv2(
fd: BorrowedFd<'_>,
- bufs: &mut [IoSliceMut],
+ bufs: &mut [IoSliceMut<'_>],
offset: u64,
flags: ReadWriteFlags,
) -> io::Result<usize> {
@@ -166,7 +167,7 @@ pub(crate) fn preadv2(
#[cfg(linux_kernel)]
pub(crate) fn pwritev2(
fd: BorrowedFd<'_>,
- bufs: &[IoSlice],
+ bufs: &[IoSlice<'_>],
offset: u64,
flags: ReadWriteFlags,
) -> io::Result<usize> {
@@ -203,25 +204,22 @@ pub(crate) unsafe fn close(raw_fd: RawFd) {
let _ = c::close(raw_fd as c::c_int);
}
-#[cfg(not(target_os = "espidf"))]
-pub(crate) fn ioctl_fionread(fd: BorrowedFd<'_>) -> io::Result<u64> {
- use core::mem::MaybeUninit;
-
- let mut nread = MaybeUninit::<c::c_int>::uninit();
- unsafe {
- ret(c::ioctl(borrowed_fd(fd), c::FIONREAD, nread.as_mut_ptr()))?;
- // `FIONREAD` returns the number of bytes silently casted to a `c_int`,
- // even when this is lossy. The best we can do is convert it back to a
- // `u64` without sign-extending it back first.
- Ok(u64::from(nread.assume_init() as c::c_uint))
- }
+#[inline]
+pub(crate) unsafe fn ioctl(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> io::Result<IoctlOutput> {
+ ret_c_int(c::ioctl(borrowed_fd(fd), request, arg))
}
-pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
- unsafe {
- let data = value as c::c_int;
- ret(c::ioctl(borrowed_fd(fd), c::FIONBIO, &data))
- }
+#[inline]
+pub(crate) unsafe fn ioctl_readonly(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> io::Result<IoctlOutput> {
+ ioctl(fd, request, arg)
}
#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
@@ -302,11 +300,13 @@ pub(crate) fn dup(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::dup(borrowed_fd(fd))) }
}
+#[allow(clippy::needless_pass_by_ref_mut)]
#[cfg(not(target_os = "wasi"))]
pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> {
unsafe { ret_discarded_fd(c::dup2(borrowed_fd(fd), borrowed_fd(new.as_fd()))) }
}
+#[allow(clippy::needless_pass_by_ref_mut)]
#[cfg(not(any(
apple,
target_os = "aix",
@@ -342,14 +342,3 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, _flags: DupFlags) -> i
// have an `&mut OwnedFd` which means `fd` doesn't alias it.
dup2(fd, new)
}
-
-#[cfg(apple)]
-pub(crate) fn ioctl_fioclex(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe {
- ret(c::ioctl(
- borrowed_fd(fd),
- c::FIOCLEX,
- core::ptr::null_mut::<u8>(),
- ))
- }
-}
diff --git a/vendor/rustix/src/backend/libc/io/types.rs b/vendor/rustix/src/backend/libc/io/types.rs
index 8743336f2..eaf3eae71 100644
--- a/vendor/rustix/src/backend/libc/io/types.rs
+++ b/vendor/rustix/src/backend/libc/io/types.rs
@@ -11,6 +11,9 @@ bitflags! {
pub struct FdFlags: u32 {
/// `FD_CLOEXEC`
const CLOEXEC = bitcast!(c::FD_CLOEXEC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -33,6 +36,9 @@ bitflags! {
const NOWAIT = linux_raw_sys::general::RWF_NOWAIT;
/// `RWF_APPEND` (since Linux 4.16)
const APPEND = linux_raw_sys::general::RWF_APPEND;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -52,5 +58,8 @@ bitflags! {
target_os = "redox",
)))] // Android 5.0 has dup3, but libc doesn't have bindings
const CLOEXEC = bitcast!(c::O_CLOEXEC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/io/windows_syscalls.rs b/vendor/rustix/src/backend/libc/io/windows_syscalls.rs
index c87a2a247..049221d2f 100644
--- a/vendor/rustix/src/backend/libc/io/windows_syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/windows_syscalls.rs
@@ -1,27 +1,30 @@
//! Windows system calls in the `io` module.
use crate::backend::c;
-use crate::backend::conv::{borrowed_fd, ret};
+use crate::backend::conv::{borrowed_fd, ret_c_int};
use crate::backend::fd::LibcFd;
use crate::fd::{BorrowedFd, RawFd};
use crate::io;
-use core::mem::MaybeUninit;
+use crate::ioctl::{IoctlOutput, RawOpcode};
pub(crate) unsafe fn close(raw_fd: RawFd) {
let _ = c::close(raw_fd as LibcFd);
}
-pub(crate) fn ioctl_fionread(fd: BorrowedFd<'_>) -> io::Result<u64> {
- let mut nread = MaybeUninit::<c::c_ulong>::uninit();
- unsafe {
- ret(c::ioctl(borrowed_fd(fd), c::FIONREAD, nread.as_mut_ptr()))?;
- Ok(u64::from(nread.assume_init()))
- }
+#[inline]
+pub(crate) unsafe fn ioctl(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> io::Result<IoctlOutput> {
+ ret_c_int(c::ioctl(borrowed_fd(fd), request, arg.cast()))
}
-pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
- unsafe {
- let mut data = value as c::c_uint;
- ret(c::ioctl(borrowed_fd(fd), c::FIONBIO, &mut data))
- }
+#[inline]
+pub(crate) unsafe fn ioctl_readonly(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> io::Result<IoctlOutput> {
+ ioctl(fd, request, arg)
}
diff --git a/vendor/rustix/src/backend/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs
index 6a41cbe56..f0b4ad593 100644
--- a/vendor/rustix/src/backend/libc/mm/types.rs
+++ b/vendor/rustix/src/backend/libc/mm/types.rs
@@ -16,6 +16,9 @@ bitflags! {
const WRITE = bitcast!(c::PROT_WRITE);
/// `PROT_EXEC`
const EXEC = bitcast!(c::PROT_EXEC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -55,6 +58,9 @@ bitflags! {
/// `PROT_ADI`
#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
const ADI = linux_raw_sys::general::PROT_ADI;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -74,6 +80,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
@@ -88,6 +95,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "haiku",
target_os = "nto",
target_os = "redox",
@@ -99,6 +107,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
@@ -111,6 +120,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "haiku",
target_os = "nto",
target_os = "redox",
@@ -120,6 +130,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "haiku",
target_os = "nto",
target_os = "redox",
@@ -129,6 +140,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
@@ -141,6 +153,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
@@ -153,6 +166,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "haiku",
target_os = "nto",
target_os = "redox",
@@ -162,7 +176,12 @@ bitflags! {
#[cfg(freebsdlike)]
const NOCORE = bitcast!(c::MAP_NOCORE);
/// `MAP_NORESERVE`
- #[cfg(not(any(freebsdlike, target_os = "nto", target_os = "redox")))]
+ #[cfg(not(any(
+ freebsdlike,
+ target_os = "aix",
+ target_os = "nto",
+ target_os = "redox",
+ )))]
const NORESERVE = bitcast!(c::MAP_NORESERVE);
/// `MAP_NOSYNC`
#[cfg(freebsdlike)]
@@ -171,6 +190,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "haiku",
target_os = "nto",
target_os = "redox",
@@ -180,6 +200,7 @@ bitflags! {
#[cfg(not(any(
apple,
solarish,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
target_os = "netbsd",
@@ -193,6 +214,7 @@ bitflags! {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "android",
target_os = "emscripten",
target_os = "fuchsia",
@@ -208,6 +230,9 @@ bitflags! {
/// `MAP_UNINITIALIZED`
#[cfg(any())]
const UNINITIALIZED = bitcast!(c::MAP_UNINITIALIZED);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -224,6 +249,9 @@ bitflags! {
pub struct MremapFlags: u32 {
/// `MREMAP_MAYMOVE`
const MAYMOVE = bitcast!(c::MREMAP_MAYMOVE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -243,6 +271,9 @@ bitflags! {
/// file (so that they can be updated with the fresh values just
/// written).
const INVALIDATE = bitcast!(c::MS_INVALIDATE);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -256,6 +287,9 @@ bitflags! {
pub struct MlockFlags: u32 {
/// `MLOCK_ONFAULT`
const ONFAULT = bitcast!(c::MLOCK_ONFAULT);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -403,5 +437,8 @@ bitflags! {
const CLOEXEC = bitcast!(c::O_CLOEXEC);
/// `O_NONBLOCK`
const NONBLOCK = bitcast!(c::O_NONBLOCK);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/mount/types.rs b/vendor/rustix/src/backend/libc/mount/types.rs
index 660e6ae37..069a94444 100644
--- a/vendor/rustix/src/backend/libc/mount/types.rs
+++ b/vendor/rustix/src/backend/libc/mount/types.rs
@@ -54,6 +54,9 @@ bitflags! {
/// `MS_SYNCHRONOUS`
const SYNCHRONOUS = c::MS_SYNCHRONOUS;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -73,6 +76,9 @@ bitflags! {
const EXPIRE = bitcast!(c::MNT_EXPIRE);
/// `UMOUNT_NOFOLLOW`
const NOFOLLOW = bitcast!(c::UMOUNT_NOFOLLOW);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -85,9 +91,11 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct FsOpenFlags: c::c_uint {
-
/// `FSOPEN_CLOEXEC`
const FSOPEN_CLOEXEC = 0x00000001;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -102,6 +110,9 @@ bitflags! {
pub struct FsMountFlags: c::c_uint {
/// `FSMOUNT_CLOEXEC`
const FSMOUNT_CLOEXEC = 0x00000001;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -180,6 +191,9 @@ bitflags! {
/// `MOUNT_ATTR__ATIME_FLAGS`
const MOUNT_ATTR_SIZE_VER0 = 32;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -219,6 +233,9 @@ bitflags! {
/// `MOVE_MOUNT__MASK`
const MOVE_MOUNT__MASK = 0x00000377;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -248,6 +265,9 @@ bitflags! {
/// `AT_SYMLINK_NOFOLLOW`
const AT_SYMLINK_NOFOLLOW = c::AT_SYMLINK_NOFOLLOW as c::c_uint;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -271,6 +291,9 @@ bitflags! {
/// `FSPICK_EMPTY_PATH`
const FSPICK_EMPTY_PATH = 0x00000008;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -294,6 +317,9 @@ bitflags! {
const UNBINDABLE = c::MS_UNBINDABLE;
/// `MS_REC`
const REC = c::MS_REC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -304,6 +330,9 @@ bitflags! {
pub(crate) struct InternalMountFlags: c::c_ulong {
const REMOUNT = c::MS_REMOUNT;
const MOVE = c::MS_MOVE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/net/addr.rs b/vendor/rustix/src/backend/libc/net/addr.rs
index bd2e7dafe..6a140d767 100644
--- a/vendor/rustix/src/backend/libc/net/addr.rs
+++ b/vendor/rustix/src/backend/libc/net/addr.rs
@@ -76,15 +76,17 @@ impl SocketAddrUnix {
fn init() -> c::sockaddr_un {
c::sockaddr_un {
- #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto"))]
sun_len: 0,
sun_family: c::AF_UNIX as _,
#[cfg(any(bsd, target_os = "nto"))]
sun_path: [0; 104],
- #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
+ #[cfg(target_os = "aix")]
+ sun_path: [0; 1023],
}
}
@@ -159,9 +161,7 @@ impl Eq for SocketAddrUnix {}
impl PartialOrd for SocketAddrUnix {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- let self_len = self.len() - offsetof_sun_path();
- let other_len = other.len() - offsetof_sun_path();
- self.unix.sun_path[..self_len].partial_cmp(&other.unix.sun_path[..other_len])
+ Some(self.cmp(other))
}
}
@@ -208,18 +208,32 @@ pub type SocketAddrStorage = c::sockaddr_storage;
#[inline]
pub(crate) fn offsetof_sun_path() -> usize {
let z = c::sockaddr_un {
- #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto"))]
sun_len: 0_u8,
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ ))]
sun_family: 0_u8,
- #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
sun_family: 0_u16,
#[cfg(any(bsd, target_os = "nto"))]
sun_path: [0; 104],
- #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "nto")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
+ #[cfg(target_os = "aix")]
+ sun_path: [0; 1023],
};
(crate::utils::as_ptr(&z.sun_path) as usize) - (crate::utils::as_ptr(&z) as usize)
}
diff --git a/vendor/rustix/src/backend/libc/net/ext.rs b/vendor/rustix/src/backend/libc/net/ext.rs
index 50bd89db6..eb7c20d7d 100644
--- a/vendor/rustix/src/backend/libc/net/ext.rs
+++ b/vendor/rustix/src/backend/libc/net/ext.rs
@@ -78,7 +78,14 @@ pub(crate) const fn sockaddr_in6_sin6_scope_id(addr: &c::sockaddr_in6) -> u32 {
#[cfg(not(windows))]
#[inline]
pub(crate) const fn sockaddr_in6_new(
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sin6_len: u8,
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ ))]
+ sin6_len: u8,
sin6_family: c::sa_family_t,
sin6_port: u16,
sin6_flowinfo: u32,
@@ -86,7 +93,13 @@ pub(crate) const fn sockaddr_in6_new(
sin6_scope_id: u32,
) -> c::sockaddr_in6 {
c::sockaddr_in6 {
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ ))]
sin6_len,
sin6_family,
sin6_port,
diff --git a/vendor/rustix/src/backend/libc/net/msghdr.rs b/vendor/rustix/src/backend/libc/net/msghdr.rs
index e3f873747..2ccd7f20c 100644
--- a/vendor/rustix/src/backend/libc/net/msghdr.rs
+++ b/vendor/rustix/src/backend/libc/net/msghdr.rs
@@ -24,7 +24,7 @@ pub(crate) fn with_recv_msghdr<R>(
let namelen = size_of::<c::sockaddr_storage>() as c::socklen_t;
let mut msghdr = {
- let mut h: c::msghdr = unsafe { zeroed() };
+ let mut h = zero_msghdr();
h.msg_name = name.as_mut_ptr().cast();
h.msg_namelen = namelen;
h.msg_iov = iov.as_mut_ptr().cast();
@@ -53,7 +53,7 @@ pub(crate) fn with_noaddr_msghdr<R>(
f: impl FnOnce(c::msghdr) -> R,
) -> R {
f({
- let mut h: c::msghdr = unsafe { zeroed() };
+ let mut h = zero_msghdr();
h.msg_iov = iov.as_ptr() as _;
h.msg_iovlen = msg_iov_len(iov.len());
h.msg_control = control.as_control_ptr().cast();
@@ -69,10 +69,10 @@ pub(crate) fn with_v4_msghdr<R>(
control: &mut SendAncillaryBuffer<'_, '_, '_>,
f: impl FnOnce(c::msghdr) -> R,
) -> R {
- let encoded = unsafe { encode_sockaddr_v4(addr) };
+ let encoded = encode_sockaddr_v4(addr);
f({
- let mut h: c::msghdr = unsafe { zeroed() };
+ let mut h = zero_msghdr();
h.msg_name = as_ptr(&encoded) as _;
h.msg_namelen = size_of::<SocketAddrV4>() as _;
h.msg_iov = iov.as_ptr() as _;
@@ -90,10 +90,10 @@ pub(crate) fn with_v6_msghdr<R>(
control: &mut SendAncillaryBuffer<'_, '_, '_>,
f: impl FnOnce(c::msghdr) -> R,
) -> R {
- let encoded = unsafe { encode_sockaddr_v6(addr) };
+ let encoded = encode_sockaddr_v6(addr);
f({
- let mut h: c::msghdr = unsafe { zeroed() };
+ let mut h = zero_msghdr();
h.msg_name = as_ptr(&encoded) as _;
h.msg_namelen = size_of::<SocketAddrV6>() as _;
h.msg_iov = iov.as_ptr() as _;
@@ -113,7 +113,7 @@ pub(crate) fn with_unix_msghdr<R>(
f: impl FnOnce(c::msghdr) -> R,
) -> R {
f({
- let mut h: c::msghdr = unsafe { zeroed() };
+ let mut h = zero_msghdr();
h.msg_name = as_ptr(addr) as _;
h.msg_namelen = addr.addr_len();
h.msg_iov = iov.as_ptr() as _;
@@ -123,3 +123,12 @@ pub(crate) fn with_unix_msghdr<R>(
h
})
}
+
+/// Create a zero-initialized message header struct value.
+#[cfg(all(unix, not(target_os = "redox")))]
+pub(crate) fn zero_msghdr() -> c::msghdr {
+ // SAFETY: We can't initialize all the fields by value because on some
+ // platforms the `msghdr` struct in the libc crate contains private padding
+ // fields. But it is still a C type that's meant to be zero-initializable.
+ unsafe { zeroed() }
+}
diff --git a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
index cde851af6..604f24928 100644
--- a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
@@ -26,11 +26,29 @@ struct sockaddr_header {
unsafe fn read_ss_family(storage: *const c::sockaddr_storage) -> u16 {
// Assert that we know the layout of `sockaddr`.
let _ = c::sockaddr {
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ ))]
sa_len: 0_u8,
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ ))]
sa_family: 0_u8,
- #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
sa_family: 0_u16,
#[cfg(not(target_os = "haiku"))]
sa_data: [0; 14],
diff --git a/vendor/rustix/src/backend/libc/net/send_recv.rs b/vendor/rustix/src/backend/libc/net/send_recv.rs
index 26543a1fd..76dc97e78 100644
--- a/vendor/rustix/src/backend/libc/net/send_recv.rs
+++ b/vendor/rustix/src/backend/libc/net/send_recv.rs
@@ -14,6 +14,7 @@ bitflags! {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "nto",
target_os = "haiku",
@@ -32,6 +33,7 @@ bitflags! {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "haiku",
target_os = "nto",
)))]
@@ -41,6 +43,9 @@ bitflags! {
const NOSIGNAL = bitcast!(c::MSG_NOSIGNAL);
/// `MSG_OOB`
const OOB = bitcast!(c::MSG_OOB);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -52,7 +57,15 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct RecvFlags: u32 {
- #[cfg(not(any(apple, solarish, windows, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(
+ apple,
+ solarish,
+ windows,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ )))]
/// `MSG_CMSG_CLOEXEC`
const CMSG_CLOEXEC = bitcast!(c::MSG_CMSG_CLOEXEC);
/// `MSG_DONTWAIT`
@@ -63,6 +76,7 @@ bitflags! {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -76,5 +90,8 @@ bitflags! {
const TRUNC = bitcast!(c::MSG_TRUNC);
/// `MSG_WAITALL`
const WAITALL = bitcast!(c::MSG_WAITALL);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs
index b4550583c..2e968ba3e 100644
--- a/vendor/rustix/src/backend/libc/net/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/net/syscalls.rs
@@ -358,6 +358,7 @@ pub(crate) fn sendmsg_unix(
#[cfg(not(any(
apple,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "redox",
@@ -396,6 +397,7 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<
#[cfg(not(any(
apple,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -427,6 +429,7 @@ pub(crate) fn acceptfrom_with(
#[cfg(any(
apple,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto"
@@ -440,6 +443,7 @@ pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: SocketFlags) -> io::Re
#[cfg(any(
apple,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto"
@@ -517,8 +521,24 @@ pub(crate) mod sockopt {
use super::{c, in6_addr_new, in_addr_new, BorrowedFd};
use crate::io;
use crate::net::sockopt::Timeout;
+ #[cfg(not(any(
+ apple,
+ windows,
+ target_os = "aix",
+ target_os = "dragonfly",
+ target_os = "emscripten",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "netbsd",
+ target_os = "nto",
+ )))]
+ use crate::net::AddressFamily;
use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
use crate::utils::as_mut_ptr;
+ #[cfg(apple)]
+ use c::TCP_KEEPALIVE as TCP_KEEPIDLE;
+ #[cfg(not(any(apple, target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ use c::TCP_KEEPIDLE;
use core::time::Duration;
#[cfg(windows)]
use windows_sys::Win32::Foundation::BOOL;
@@ -597,6 +617,11 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn get_socket_reuseaddr(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_REUSEADDR).map(to_bool)
+ }
+
+ #[inline]
pub(crate) fn set_socket_broadcast(fd: BorrowedFd<'_>, broadcast: bool) -> io::Result<()> {
setsockopt(
fd,
@@ -618,11 +643,7 @@ pub(crate) mod sockopt {
) -> io::Result<()> {
// Convert `linger` to seconds, rounding up.
let l_linger = if let Some(linger) = linger {
- let mut l_linger = linger.as_secs();
- if linger.subsec_nanos() != 0 {
- l_linger = l_linger.checked_add(1).ok_or(io::Errno::INVAL)?;
- }
- l_linger.try_into().map_err(|_e| io::Errno::INVAL)?
+ duration_to_secs(linger)?
} else {
0
};
@@ -810,6 +831,31 @@ pub(crate) mod sockopt {
}
#[inline]
+ #[cfg(not(any(
+ apple,
+ windows,
+ target_os = "aix",
+ target_os = "dragonfly",
+ target_os = "emscripten",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "netbsd",
+ target_os = "nto",
+ )))]
+ pub(crate) fn get_socket_domain(fd: BorrowedFd<'_>) -> io::Result<AddressFamily> {
+ let domain: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_DOMAIN)?;
+ Ok(AddressFamily(
+ domain.try_into().map_err(|_| io::Errno::OPNOTSUPP)?,
+ ))
+ }
+
+ #[inline]
+ #[cfg(not(apple))] // Apple platforms declare the constant, but do not actually implement it.
+ pub(crate) fn get_socket_acceptconn(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_ACCEPTCONN).map(to_bool)
+ }
+
+ #[inline]
pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl)
}
@@ -992,6 +1038,46 @@ pub(crate) mod sockopt {
}
#[inline]
+ #[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ pub(crate) fn set_tcp_keepcnt(fd: BorrowedFd<'_>, count: u32) -> io::Result<()> {
+ setsockopt(fd, c::IPPROTO_TCP as _, c::TCP_KEEPCNT, count)
+ }
+
+ #[inline]
+ #[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ pub(crate) fn get_tcp_keepcnt(fd: BorrowedFd<'_>) -> io::Result<u32> {
+ getsockopt(fd, c::IPPROTO_TCP as _, c::TCP_KEEPCNT)
+ }
+
+ #[inline]
+ #[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ pub(crate) fn set_tcp_keepidle(fd: BorrowedFd<'_>, duration: Duration) -> io::Result<()> {
+ let secs: c::c_uint = duration_to_secs(duration)?;
+ setsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPIDLE, secs)
+ }
+
+ #[inline]
+ #[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ pub(crate) fn get_tcp_keepidle(fd: BorrowedFd<'_>) -> io::Result<Duration> {
+ let secs: c::c_uint = getsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPIDLE)?;
+ Ok(Duration::from_secs(secs as u64))
+ }
+
+ #[inline]
+ #[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ pub(crate) fn set_tcp_keepintvl(fd: BorrowedFd<'_>, duration: Duration) -> io::Result<()> {
+ let secs: c::c_uint = duration_to_secs(duration)?;
+ setsockopt(fd, c::IPPROTO_TCP as _, c::TCP_KEEPINTVL, secs)
+ }
+
+ #[inline]
+ #[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+ pub(crate) fn get_tcp_keepintvl(fd: BorrowedFd<'_>) -> io::Result<Duration> {
+ let secs: c::c_uint = getsockopt(fd, c::IPPROTO_TCP as _, c::TCP_KEEPINTVL)?;
+ Ok(Duration::from_secs(secs as u64))
+ }
+
+ #[inline]
fn to_imr(multiaddr: &Ipv4Addr, interface: &Ipv4Addr) -> c::ip_mreq {
c::ip_mreq {
imr_multiaddr: to_imr_addr(multiaddr),
@@ -1051,4 +1137,14 @@ pub(crate) mod sockopt {
fn to_bool(value: SocketBool) -> bool {
value.0 != 0
}
+
+ /// Convert to seconds, rounding up if necessary.
+ #[inline]
+ fn duration_to_secs<T: TryFrom<u64>>(duration: Duration) -> io::Result<T> {
+ let mut secs = duration.as_secs();
+ if duration.subsec_nanos() != 0 {
+ secs = secs.checked_add(1).ok_or(io::Errno::INVAL)?;
+ }
+ T::try_from(secs).map_err(|_e| io::Errno::INVAL)
+ }
}
diff --git a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
index 46f0ef40a..a354d9a85 100644
--- a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
@@ -21,9 +21,15 @@ pub(crate) unsafe fn write_sockaddr(
}
}
-pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
+pub(crate) fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
c::sockaddr_in {
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ ))]
sin_len: size_of::<c::sockaddr_in>() as _,
sin_family: c::AF_INET as _,
sin_port: u16::to_be(v4.port()),
@@ -41,8 +47,14 @@ unsafe fn write_sockaddr_v4(v4: &SocketAddrV4, storage: *mut SocketAddrStorage)
size_of::<c::sockaddr_in>()
}
-pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
- #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))]
+pub(crate) fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
+ #[cfg(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ ))]
{
sockaddr_in6_new(
size_of::<c::sockaddr_in6>() as _,
@@ -53,7 +65,13 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
v6.scope_id(),
)
}
- #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(
+ bsd,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto"
+ )))]
{
sockaddr_in6_new(
c::AF_INET6 as _,
diff --git a/vendor/rustix/src/backend/libc/pipe/syscalls.rs b/vendor/rustix/src/backend/libc/pipe/syscalls.rs
index 24262cc9a..cff932d55 100644
--- a/vendor/rustix/src/backend/libc/pipe/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/pipe/syscalls.rs
@@ -55,9 +55,9 @@ pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
#[cfg(linux_kernel)]
#[inline]
pub fn splice(
- fd_in: BorrowedFd,
+ fd_in: BorrowedFd<'_>,
off_in: Option<&mut u64>,
- fd_out: BorrowedFd,
+ fd_out: BorrowedFd<'_>,
off_out: Option<&mut u64>,
len: usize,
flags: SpliceFlags,
@@ -80,8 +80,8 @@ pub fn splice(
#[cfg(linux_kernel)]
#[inline]
pub unsafe fn vmsplice(
- fd: BorrowedFd,
- bufs: &[IoSliceRaw],
+ fd: BorrowedFd<'_>,
+ bufs: &[IoSliceRaw<'_>],
flags: SpliceFlags,
) -> io::Result<usize> {
ret_usize(c::vmsplice(
@@ -95,8 +95,8 @@ pub unsafe fn vmsplice(
#[cfg(linux_kernel)]
#[inline]
pub fn tee(
- fd_in: BorrowedFd,
- fd_out: BorrowedFd,
+ fd_in: BorrowedFd<'_>,
+ fd_out: BorrowedFd<'_>,
len: usize,
flags: SpliceFlags,
) -> io::Result<usize> {
diff --git a/vendor/rustix/src/backend/libc/pipe/types.rs b/vendor/rustix/src/backend/libc/pipe/types.rs
index 3fa0464e0..7f5634b17 100644
--- a/vendor/rustix/src/backend/libc/pipe/types.rs
+++ b/vendor/rustix/src/backend/libc/pipe/types.rs
@@ -25,6 +25,9 @@ bitflags! {
const DIRECT = bitcast!(c::O_DIRECT);
/// `O_NONBLOCK`
const NONBLOCK = bitcast!(c::O_NONBLOCK);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -43,6 +46,9 @@ bitflags! {
const MORE = c::SPLICE_F_MORE;
/// `SPLICE_F_GIFT`
const GIFT = c::SPLICE_F_GIFT;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs
index a84385cf1..dd71801d5 100644
--- a/vendor/rustix/src/backend/libc/process/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/process/syscalls.rs
@@ -3,9 +3,11 @@
#[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))]
use super::types::RawCpuSet;
use crate::backend::c;
+#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
+use crate::backend::conv::borrowed_fd;
#[cfg(feature = "fs")]
use crate::backend::conv::c_str;
-#[cfg(all(feature = "fs", not(target_os = "wasi")))]
+#[cfg(all(feature = "alloc", feature = "fs", not(target_os = "wasi")))]
use crate::backend::conv::ret_discarded_char_ptr;
#[cfg(not(any(
target_os = "espidf",
@@ -14,12 +16,14 @@ use crate::backend::conv::ret_discarded_char_ptr;
target_os = "wasi"
)))]
use crate::backend::conv::ret_infallible;
+#[cfg(not(target_os = "wasi"))]
+use crate::backend::conv::ret_pid_t;
#[cfg(linux_kernel)]
use crate::backend::conv::ret_u32;
-#[cfg(not(target_os = "wasi"))]
-use crate::backend::conv::{borrowed_fd, ret_pid_t, ret_usize};
+#[cfg(all(feature = "alloc", not(target_os = "wasi")))]
+use crate::backend::conv::ret_usize;
use crate::backend::conv::{ret, ret_c_int};
-#[cfg(not(target_os = "wasi"))]
+#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
use crate::fd::BorrowedFd;
#[cfg(target_os = "linux")]
use crate::fd::{AsRawFd, OwnedFd, RawFd};
@@ -28,12 +32,14 @@ use crate::ffi::CStr;
#[cfg(feature = "fs")]
use crate::fs::Mode;
use crate::io;
+#[cfg(all(feature = "alloc", not(target_os = "wasi")))]
+use crate::process::Gid;
+#[cfg(not(target_os = "wasi"))]
+use crate::process::Pid;
#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))]
use crate::process::Uid;
#[cfg(linux_kernel)]
use crate::process::{Cpuid, MembarrierCommand, MembarrierQuery};
-#[cfg(not(target_os = "wasi"))]
-use crate::process::{Gid, Pid};
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
use crate::process::{RawPid, Signal, WaitOptions, WaitStatus};
#[cfg(not(any(
@@ -73,7 +79,7 @@ pub(crate) fn chroot(path: &CStr) -> io::Result<()> {
unsafe { ret(c::chroot(c_str(path))) }
}
-#[cfg(feature = "fs")]
+#[cfg(all(feature = "alloc", feature = "fs"))]
#[cfg(not(target_os = "wasi"))]
pub(crate) fn getcwd(buf: &mut [MaybeUninit<u8>]) -> io::Result<()> {
unsafe { ret_discarded_char_ptr(c::getcwd(buf.as_mut_ptr().cast(), buf.len())) }
@@ -612,20 +618,9 @@ pub(crate) fn pidfd_getfd(
}
}
-#[cfg(not(target_os = "wasi"))]
+#[cfg(all(feature = "alloc", not(target_os = "wasi")))]
pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> {
let len = buf.len().try_into().map_err(|_| io::Errno::NOMEM)?;
unsafe { ret_usize(c::getgroups(len, buf.as_mut_ptr().cast()) as isize) }
}
-
-#[cfg(not(any(
- target_os = "aix",
- target_os = "espidf",
- target_os = "redox",
- target_os = "wasi"
-)))]
-#[inline]
-pub(crate) fn ioctl_tiocsctty(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCSCTTY as _, &0_u32)) }
-}
diff --git a/vendor/rustix/src/backend/libc/process/types.rs b/vendor/rustix/src/backend/libc/process/types.rs
index 9c543acd0..26bae3498 100644
--- a/vendor/rustix/src/backend/libc/process/types.rs
+++ b/vendor/rustix/src/backend/libc/process/types.rs
@@ -141,11 +141,6 @@ impl Resource {
pub const Rss: Self = Self::As;
}
-pub const EXIT_SUCCESS: c::c_int = c::EXIT_SUCCESS;
-pub const EXIT_FAILURE: c::c_int = c::EXIT_FAILURE;
-#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + c::SIGABRT;
-
/// A CPU identifier as a raw integer.
#[cfg(linux_kernel)]
pub type RawCpuid = u32;
diff --git a/vendor/rustix/src/backend/libc/pty/syscalls.rs b/vendor/rustix/src/backend/libc/pty/syscalls.rs
index 6688ddb26..cf566045d 100644
--- a/vendor/rustix/src/backend/libc/pty/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/pty/syscalls.rs
@@ -4,9 +4,10 @@ use crate::backend::c;
use crate::backend::conv::{borrowed_fd, ret};
use crate::fd::BorrowedFd;
use crate::io;
-#[cfg(not(target_os = "android"))]
-use {crate::backend::conv::ret_owned_fd, crate::fd::OwnedFd, crate::pty::OpenptFlags};
-#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))]
+#[cfg(all(
+ feature = "alloc",
+ any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia")
+))]
use {
crate::ffi::{CStr, CString},
crate::path::SMALL_PATH_BUFFER_SIZE,
@@ -15,14 +16,20 @@ use {
};
#[cfg(not(linux_kernel))]
+use crate::{backend::conv::ret_owned_fd, fd::OwnedFd, pty::OpenptFlags};
+
+#[cfg(not(linux_kernel))]
#[inline]
pub(crate) fn openpt(flags: OpenptFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(c::posix_openpt(flags.bits() as _)) }
}
-#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))]
+#[cfg(all(
+ feature = "alloc",
+ any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia")
+))]
#[inline]
-pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString> {
+pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
// This code would benefit from having a better way to read into
// uninitialized memory, but that requires `unsafe`.
buffer.clear();
@@ -86,18 +93,12 @@ pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString
}
#[inline]
-pub(crate) fn unlockpt(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn unlockpt(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::unlockpt(borrowed_fd(fd))) }
}
#[cfg(not(linux_kernel))]
#[inline]
-pub(crate) fn grantpt(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn grantpt(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::grantpt(borrowed_fd(fd))) }
}
-
-#[cfg(target_os = "linux")]
-#[inline]
-pub(crate) fn ioctl_tiocgptpeer(fd: BorrowedFd, flags: OpenptFlags) -> io::Result<OwnedFd> {
- unsafe { ret_owned_fd(c::ioctl(borrowed_fd(fd), c::TIOCGPTPEER, flags.bits())) }
-}
diff --git a/vendor/rustix/src/backend/libc/rand/types.rs b/vendor/rustix/src/backend/libc/rand/types.rs
index 730cf3a34..cd436b618 100644
--- a/vendor/rustix/src/backend/libc/rand/types.rs
+++ b/vendor/rustix/src/backend/libc/rand/types.rs
@@ -17,5 +17,8 @@ bitflags! {
const NONBLOCK = c::GRND_NONBLOCK;
/// `GRND_INSECURE`
const INSECURE = c::GRND_INSECURE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index ea284927f..df96595cd 100644
--- a/vendor/rustix/src/backend/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -9,7 +9,7 @@ use crate::backend::c;
use crate::backend::conv::ret_pid_t;
use crate::backend::conv::{borrowed_fd, ret};
use crate::fd::BorrowedFd;
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use crate::ffi::CStr;
#[cfg(any(
@@ -33,19 +33,21 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
// If we have `TCGETS2`, use it, so that we fill in the `c_ispeed` and
// `c_ospeed` fields.
#[cfg(linux_kernel)]
- unsafe {
+ {
use crate::termios::{ControlModes, InputModes, LocalModes, OutputModes, SpecialCodes};
- use core::mem::zeroed;
+ use crate::utils::default_array;
- let mut termios2 = MaybeUninit::<c::termios2>::uninit();
+ let termios2 = unsafe {
+ let mut termios2 = MaybeUninit::<c::termios2>::uninit();
- ret(c::ioctl(
- borrowed_fd(fd),
- c::TCGETS2 as _,
- termios2.as_mut_ptr(),
- ))?;
+ ret(c::ioctl(
+ borrowed_fd(fd),
+ c::TCGETS2 as _,
+ termios2.as_mut_ptr(),
+ ))?;
- let termios2 = termios2.assume_init();
+ termios2.assume_init()
+ };
// Convert from the Linux `termios2` to our `Termios`.
let mut result = Termios {
@@ -54,7 +56,7 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
control_modes: ControlModes::from_bits_retain(termios2.c_cflag),
local_modes: LocalModes::from_bits_retain(termios2.c_lflag),
line_discipline: termios2.c_line,
- special_codes: SpecialCodes(zeroed()),
+ special_codes: SpecialCodes(default_array()),
input_speed: termios2.c_ispeed,
output_speed: termios2.c_ospeed,
};
@@ -90,16 +92,16 @@ pub(crate) fn tcsetpgrp(fd: BorrowedFd<'_>, pid: Pid) -> io::Result<()> {
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub(crate) fn tcsetattr(
- fd: BorrowedFd,
+ fd: BorrowedFd<'_>,
optional_actions: OptionalActions,
termios: &Termios,
) -> io::Result<()> {
// If we have `TCSETS2`, use it, so that we use the `c_ispeed` and
// `c_ospeed` fields.
#[cfg(linux_kernel)]
- unsafe {
+ {
use crate::termios::speed;
- use core::mem::zeroed;
+ use crate::utils::default_array;
use linux_raw_sys::general::{termios2, BOTHER, CBAUD, IBSHIFT};
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
@@ -134,7 +136,7 @@ pub(crate) fn tcsetattr(
c_cflag: termios.control_modes.bits(),
c_lflag: termios.local_modes.bits(),
c_line: termios.line_discipline,
- c_cc: zeroed(),
+ c_cc: default_array(),
c_ispeed: input_speed,
c_ospeed: output_speed,
};
@@ -149,7 +151,7 @@ pub(crate) fn tcsetattr(
.c_cc
.copy_from_slice(&termios.special_codes.0[..nccs]);
- ret(c::ioctl(borrowed_fd(fd), request as _, &termios2))
+ unsafe { ret(c::ioctl(borrowed_fd(fd), request as _, &termios2)) }
}
#[cfg(not(linux_kernel))]
@@ -163,27 +165,27 @@ pub(crate) fn tcsetattr(
}
#[cfg(not(target_os = "wasi"))]
-pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn tcsendbreak(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::tcsendbreak(borrowed_fd(fd), 0)) }
}
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub(crate) fn tcdrain(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn tcdrain(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::tcdrain(borrowed_fd(fd))) }
}
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub(crate) fn tcflush(fd: BorrowedFd, queue_selector: QueueSelector) -> io::Result<()> {
+pub(crate) fn tcflush(fd: BorrowedFd<'_>, queue_selector: QueueSelector) -> io::Result<()> {
unsafe { ret(c::tcflush(borrowed_fd(fd), queue_selector as _)) }
}
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
+pub(crate) fn tcflow(fd: BorrowedFd<'_>, action: Action) -> io::Result<()> {
unsafe { ret(c::tcflow(borrowed_fd(fd), action as _)) }
}
#[cfg(not(target_os = "wasi"))]
-pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
+pub(crate) fn tcgetsid(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
let pid = ret_pid_t(c::tcgetsid(borrowed_fd(fd)))?;
Ok(Pid::from_raw_unchecked(pid))
@@ -191,12 +193,12 @@ pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
}
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub(crate) fn tcsetwinsize(fd: BorrowedFd, winsize: Winsize) -> io::Result<()> {
+pub(crate) fn tcsetwinsize(fd: BorrowedFd<'_>, winsize: Winsize) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCSWINSZ, &winsize)) }
}
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
+pub(crate) fn tcgetwinsize(fd: BorrowedFd<'_>) -> io::Result<Winsize> {
unsafe {
let mut buf = MaybeUninit::<Winsize>::uninit();
ret(c::ioctl(
@@ -208,26 +210,6 @@ pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result<Winsize> {
}
}
-#[cfg(not(any(
- target_os = "espidf",
- 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 = "espidf",
- 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 _)) }
-}
-
#[cfg(not(any(target_os = "espidf", target_os = "nto", target_os = "wasi")))]
#[inline]
pub(crate) fn set_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Result<()> {
@@ -365,7 +347,7 @@ pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool {
unsafe { c::isatty(borrowed_fd(fd)) != 0 }
}
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
pub(crate) fn ttyname(dirfd: BorrowedFd<'_>, buf: &mut [MaybeUninit<u8>]) -> io::Result<usize> {
unsafe {
diff --git a/vendor/rustix/src/backend/libc/thread/futex.rs b/vendor/rustix/src/backend/libc/thread/futex.rs
new file mode 100644
index 000000000..44d96f0f6
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/thread/futex.rs
@@ -0,0 +1,43 @@
+use crate::backend::c;
+
+bitflags::bitflags! {
+ /// `FUTEX_*` flags for use with [`futex`].
+ ///
+ /// [`futex`]: crate::thread::futex
+ #[repr(transparent)]
+ #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+ pub struct FutexFlags: u32 {
+ /// `FUTEX_PRIVATE_FLAG`
+ const PRIVATE = bitcast!(c::FUTEX_PRIVATE_FLAG);
+ /// `FUTEX_CLOCK_REALTIME`
+ const CLOCK_REALTIME = bitcast!(c::FUTEX_CLOCK_REALTIME);
+ }
+}
+
+/// `FUTEX_*` operations for use with [`futex`].
+///
+/// [`futex`]: crate::thread::futex
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
+#[repr(u32)]
+pub enum FutexOperation {
+ /// `FUTEX_WAIT`
+ Wait = bitcast!(c::FUTEX_WAIT),
+ /// `FUTEX_WAKE`
+ Wake = bitcast!(c::FUTEX_WAKE),
+ /// `FUTEX_FD`
+ Fd = bitcast!(c::FUTEX_FD),
+ /// `FUTEX_REQUEUE`
+ Requeue = bitcast!(c::FUTEX_REQUEUE),
+ /// `FUTEX_CMP_REQUEUE`
+ CmpRequeue = bitcast!(c::FUTEX_CMP_REQUEUE),
+ /// `FUTEX_WAKE_OP`
+ WakeOp = bitcast!(c::FUTEX_WAKE_OP),
+ /// `FUTEX_LOCK_PI`
+ LockPi = bitcast!(c::FUTEX_LOCK_PI),
+ /// `FUTEX_UNLOCK_PI`
+ UnlockPi = bitcast!(c::FUTEX_UNLOCK_PI),
+ /// `FUTEX_TRYLOCK_PI`
+ TrylockPi = bitcast!(c::FUTEX_TRYLOCK_PI),
+ /// `FUTEX_WAIT_BITSET`
+ WaitBitset = bitcast!(c::FUTEX_WAIT_BITSET),
+}
diff --git a/vendor/rustix/src/backend/libc/thread/mod.rs b/vendor/rustix/src/backend/libc/thread/mod.rs
index 40e0d1135..4f8c87cd2 100644
--- a/vendor/rustix/src/backend/libc/thread/mod.rs
+++ b/vendor/rustix/src/backend/libc/thread/mod.rs
@@ -1,2 +1,4 @@
+#[cfg(linux_kernel)]
+pub(crate) mod futex;
#[cfg(not(windows))]
pub(crate) mod syscalls;
diff --git a/vendor/rustix/src/backend/libc/thread/syscalls.rs b/vendor/rustix/src/backend/libc/thread/syscalls.rs
index 5260c39f4..846f0e2a8 100644
--- a/vendor/rustix/src/backend/libc/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/thread/syscalls.rs
@@ -10,9 +10,10 @@ use crate::timespec::LibcTimespec;
use core::mem::MaybeUninit;
#[cfg(linux_kernel)]
use {
- crate::backend::conv::{borrowed_fd, ret_c_int},
+ crate::backend::conv::{borrowed_fd, ret_c_int, ret_usize},
crate::fd::BorrowedFd,
crate::pid::Pid,
+ crate::thread::{FutexFlags, FutexOperation},
crate::utils::as_mut_ptr,
};
#[cfg(not(any(
@@ -279,7 +280,7 @@ pub(crate) fn gettid() -> Pid {
#[cfg(linux_kernel)]
#[inline]
-pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
+pub(crate) fn setns(fd: BorrowedFd<'_>, nstype: c::c_int) -> io::Result<c::c_int> {
// `setns` wasn't supported in glibc until 2.14, and musl until 0.9.5,
// so use `syscall`.
weak_or_syscall! {
@@ -390,3 +391,120 @@ pub(crate) fn setresgid_thread(
unsafe { ret(setresgid(rgid.as_raw(), egid.as_raw(), sgid.as_raw())) }
}
+
+// TODO: This could be de-multiplexed.
+#[cfg(linux_kernel)]
+pub(crate) unsafe fn futex(
+ uaddr: *mut u32,
+ op: FutexOperation,
+ flags: FutexFlags,
+ val: u32,
+ utime: *const Timespec,
+ uaddr2: *mut u32,
+ val3: u32,
+) -> io::Result<usize> {
+ #[cfg(all(
+ target_pointer_width = "32",
+ not(any(target_arch = "aarch64", target_arch = "x86_64"))
+ ))]
+ {
+ // TODO: Upstream this to the libc crate.
+ #[allow(non_upper_case_globals)]
+ const SYS_futex_time64: i32 = linux_raw_sys::general::__NR_futex_time64 as i32;
+
+ syscall! {
+ fn futex_time64(
+ uaddr: *mut u32,
+ futex_op: c::c_int,
+ val: u32,
+ timeout: *const Timespec,
+ uaddr2: *mut u32,
+ val3: u32
+ ) via SYS_futex_time64 -> c::ssize_t
+ }
+
+ ret_usize(futex_time64(
+ uaddr,
+ op as i32 | flags.bits() as i32,
+ val,
+ utime,
+ uaddr2,
+ val3,
+ ))
+ .or_else(|err| {
+ // See the comments in `rustix_clock_gettime_via_syscall` about
+ // emulation.
+ if err == io::Errno::NOSYS {
+ futex_old(uaddr, op, flags, val, utime, uaddr2, val3)
+ } else {
+ Err(err)
+ }
+ })
+ }
+
+ #[cfg(any(
+ target_pointer_width = "64",
+ target_arch = "aarch64",
+ target_arch = "x86_64"
+ ))]
+ {
+ syscall! {
+ fn futex(
+ uaddr: *mut u32,
+ futex_op: c::c_int,
+ val: u32,
+ timeout: *const linux_raw_sys::general::__kernel_timespec,
+ uaddr2: *mut u32,
+ val3: u32
+ ) via SYS_futex -> c::c_long
+ }
+
+ ret_usize(futex(
+ uaddr,
+ op as i32 | flags.bits() as i32,
+ val,
+ utime.cast(),
+ uaddr2,
+ val3,
+ ) as isize)
+ }
+}
+
+#[cfg(linux_kernel)]
+#[cfg(all(
+ target_pointer_width = "32",
+ not(any(target_arch = "aarch64", target_arch = "x86_64"))
+))]
+unsafe fn futex_old(
+ uaddr: *mut u32,
+ op: FutexOperation,
+ flags: FutexFlags,
+ val: u32,
+ utime: *const Timespec,
+ uaddr2: *mut u32,
+ val3: u32,
+) -> io::Result<usize> {
+ syscall! {
+ fn futex(
+ uaddr: *mut u32,
+ futex_op: c::c_int,
+ val: u32,
+ timeout: *const linux_raw_sys::general::__kernel_old_timespec,
+ uaddr2: *mut u32,
+ val3: u32
+ ) via SYS_futex -> c::c_long
+ }
+
+ let old_utime = linux_raw_sys::general::__kernel_old_timespec {
+ tv_sec: (*utime).tv_sec.try_into().map_err(|_| io::Errno::INVAL)?,
+ tv_nsec: (*utime).tv_nsec.try_into().map_err(|_| io::Errno::INVAL)?,
+ };
+ ret_usize(futex(
+ uaddr,
+ op as i32 | flags.bits() as i32,
+ val,
+ &old_utime,
+ uaddr2,
+ val3,
+ ) as isize)
+}
diff --git a/vendor/rustix/src/backend/libc/time/syscalls.rs b/vendor/rustix/src/backend/libc/time/syscalls.rs
index 603a3b108..6b1c9fd03 100644
--- a/vendor/rustix/src/backend/libc/time/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/time/syscalls.rs
@@ -109,7 +109,7 @@ pub(crate) fn clock_gettime(id: ClockId) -> Timespec {
clock_gettime_old(id)
}
- // Use `unwrap()` here because `clock_getres` can fail if the clock itself
+ // Use `.unwrap()` here because `clock_getres` can fail if the clock itself
// overflows a number of seconds, but if that happens, the monotonic clocks
// can't maintain their invariants, or the realtime clocks aren't properly
// configured.
diff --git a/vendor/rustix/src/backend/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs
index 75cc61217..4d8c6bdab 100644
--- a/vendor/rustix/src/backend/libc/time/types.rs
+++ b/vendor/rustix/src/backend/libc/time/types.rs
@@ -25,11 +25,12 @@ pub type Itimerspec = c::itimerspec;
/// [`timerfd_settime`]: crate::time::timerfd_settime
#[cfg(any(linux_kernel, target_os = "fuchsia"))]
#[cfg(fix_y2038)]
-#[allow(missing_docs)]
#[repr(C)]
#[derive(Debug, Clone)]
pub struct Itimerspec {
+ /// The interval of an interval timer.
pub it_interval: Timespec,
+ /// Time remaining in the current interval.
pub it_value: Timespec,
}
@@ -86,6 +87,9 @@ bitflags! {
/// `TFD_CLOEXEC`
const CLOEXEC = bitcast!(c::TFD_CLOEXEC);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -103,6 +107,9 @@ bitflags! {
/// `TFD_TIMER_CANCEL_ON_SET`
#[cfg(linux_kernel)]
const CANCEL_ON_SET = bitcast!(c::TFD_TIMER_CANCEL_ON_SET);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -116,10 +123,10 @@ bitflags! {
pub enum TimerfdClockId {
/// `CLOCK_REALTIME`—A clock that tells the “real” time.
///
- /// This is a clock that tells the amount of time elapsed since the
- /// Unix epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so
- /// it is not monotonic. Successive reads may see decreasing times, so it
- /// isn't reliable for measuring durations.
+ /// This is a clock that tells the amount of time elapsed since the Unix
+ /// epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so it is
+ /// not monotonic. Successive reads may see decreasing times, so it isn't
+ /// reliable for measuring durations.
Realtime = bitcast!(c::CLOCK_REALTIME),
/// `CLOCK_MONOTONIC`—A clock that tells an abstract time.
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs b/vendor/rustix/src/backend/linux_raw/arch/aarch64.rs
index 0f4465d51..d4cf2472e 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/aarch64.rs
@@ -53,7 +53,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"svc 0",
in("x8") nr.to_asm(),
in("x0") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs b/vendor/rustix/src/backend/linux_raw/arch/arm.rs
index 9695c6028..77c1f82f4 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/arm.rs
@@ -50,7 +50,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"svc 0",
in("r7") nr.to_asm(),
in("r0") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs
deleted file mode 100644
index 3ea8eb74d..000000000
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-//! Inline asm for making system calls.
-//!
-//! Compilers should really have intrinsics for making system calls. They're
-//! much like regular calls, with custom calling conventions, and calling
-//! conventions are otherwise the compiler's job. But for now, use inline asm.
-//!
-//! The calling conventions for Linux syscalls are [documented here].
-//!
-//! [documented here]: https://man7.org/linux/man-pages/man2/syscall.2.html
-
-#[cfg_attr(target_arch = "aarch64", path = "aarch64.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 = "mips32r6", path = "mips32r6.rs")]
-#[cfg_attr(target_arch = "mips64", path = "mips64.rs")]
-#[cfg_attr(target_arch = "mips64r6", path = "mips64r6.rs")]
-#[cfg_attr(target_arch = "powerpc64", path = "powerpc64.rs")]
-#[cfg_attr(target_arch = "riscv64", path = "riscv64.rs")]
-#[cfg_attr(target_arch = "x86", path = "x86.rs")]
-#[cfg_attr(target_arch = "x86_64", path = "x86_64.rs")]
-mod target_arch;
-
-pub(in crate::backend) use target_arch::*;
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs b/vendor/rustix/src/backend/linux_raw/arch/mips.rs
index b39a16847..37932e02b 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mips.rs
@@ -103,7 +103,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"syscall",
in("$2" /*$v0*/) nr.to_asm(),
in("$4" /*$a0*/) a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs b/vendor/rustix/src/backend/linux_raw/arch/mips32r6.rs
index 718e94fa7..c2d92447b 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mips32r6.rs
@@ -103,7 +103,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"syscall",
in("$2" /*$v0*/) nr.to_asm(),
in("$4" /*$a0*/) a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs b/vendor/rustix/src/backend/linux_raw/arch/mips64.rs
index d3c7d341f..244daf3ef 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mips64.rs
@@ -103,7 +103,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"syscall",
in("$2" /*$v0*/) nr.to_asm(),
in("$4" /*$a0*/) a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs b/vendor/rustix/src/backend/linux_raw/arch/mips64r6.rs
index 0a2ebebce..8c06d9ee9 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mips64r6.rs
@@ -107,7 +107,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"syscall",
in("$2" /*$v0*/) nr.to_asm(),
in("$4" /*$a0*/) a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/mod.rs
index 31a8c11f9..ac9e25fa7 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/mod.rs
@@ -3,6 +3,14 @@
//! This module also has a `choose` submodule which chooses a scheme and is
//! what most of the `rustix` syscalls use.
//!
+//! Compilers should really have intrinsics for making system calls. They're
+//! much like regular calls, with custom calling conventions, and calling
+//! conventions are otherwise the compiler's job. But for now, use inline asm.
+//!
+//! The calling conventions for Linux syscalls are [documented here].
+//!
+//! [documented here]: https://man7.org/linux/man-pages/man2/syscall.2.html
+//!
//! # Safety
//!
//! This contains the inline `asm` statements performing the syscall
@@ -15,6 +23,17 @@
// These functions always use the machine's syscall instruction, even when it
// isn't the fastest option available.
+#[cfg_attr(target_arch = "aarch64", path = "aarch64.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 = "mips32r6", path = "mips32r6.rs")]
+#[cfg_attr(target_arch = "mips64", path = "mips64.rs")]
+#[cfg_attr(target_arch = "mips64r6", path = "mips64r6.rs")]
+#[cfg_attr(target_arch = "powerpc64", path = "powerpc64.rs")]
+#[cfg_attr(target_arch = "riscv64", path = "riscv64.rs")]
+#[cfg_attr(target_arch = "x86", path = "x86.rs")]
+#[cfg_attr(target_arch = "x86_64", path = "x86_64.rs")]
pub(in crate::backend) mod asm;
// On most architectures, the architecture syscall instruction is fast, so use
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs b/vendor/rustix/src/backend/linux_raw/arch/powerpc64.rs
index 8cca7dca7..14866c2dd 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/powerpc64.rs
@@ -15,7 +15,7 @@ use crate::backend::reg::{
use core::arch::asm;
#[inline]
-pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg<R0> {
+pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg<R0> {
let r0;
asm!(
"sc",
@@ -98,7 +98,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"sc",
in("r0") nr.to_asm(),
in("r3") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs b/vendor/rustix/src/backend/linux_raw/arch/riscv64.rs
index b1e306266..7b8533d75 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/riscv64.rs
@@ -50,7 +50,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"ecall",
in("a7") nr.to_asm(),
in("a0") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
);
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs b/vendor/rustix/src/backend/linux_raw/arch/thumb.rs
index 398a73dfe..73f9c1c26 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/thumb.rs
@@ -67,7 +67,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"svc 0",
nr = in(reg) nr.to_asm(),
in("r0") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/x86.rs
index ddef4a854..581cde278 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/x86.rs
@@ -144,8 +144,8 @@ pub(in crate::backend) unsafe fn indirect_syscall5(
let r0;
// Oof. a3 should go in esi, and `asm!` won't let us use that register as
// an operand. And we can't request stack slots. And there are no other
- // registers free. Use eax as a temporary pointer to a slice, since it
- // gets clobbered as the return value anyway.
+ // registers free. Use eax as a temporary pointer to a slice, since it gets
+ // clobbered as the return value anyway.
asm!(
"push esi",
"push DWORD PTR [eax + 0]",
@@ -163,7 +163,6 @@ pub(in crate::backend) unsafe fn indirect_syscall5(
FromAsm::from_asm(r0)
}
-#[allow(clippy::too_many_arguments)]
#[inline]
pub(in crate::backend) unsafe fn indirect_syscall6(
callee: SyscallType,
@@ -248,7 +247,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"int $$0x80",
in("eax") nr.to_asm(),
in("ebx") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs b/vendor/rustix/src/backend/linux_raw/arch/x86_64.rs
index 084f5fee4..62f35d90f 100644
--- a/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs
+++ b/vendor/rustix/src/backend/linux_raw/arch/x86_64.rs
@@ -58,7 +58,7 @@ pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: Ar
"syscall",
in("rax") nr.to_asm(),
in("rdi") a0.to_asm(),
- options(noreturn)
+ options(nostack, noreturn)
)
}
diff --git a/vendor/rustix/src/backend/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs
index f336392bb..65ddb1466 100644
--- a/vendor/rustix/src/backend/linux_raw/c.rs
+++ b/vendor/rustix/src/backend/linux_raw/c.rs
@@ -9,6 +9,7 @@
pub type size_t = usize;
pub(crate) use linux_raw_sys::ctypes::*;
pub(crate) use linux_raw_sys::errno::EINVAL;
+pub(crate) use linux_raw_sys::ioctl::{FIONBIO, FIONREAD};
// Import the kernel's `uid_t` and `gid_t` if they're 32-bit.
#[cfg(not(any(target_arch = "arm", target_arch = "sparc", target_arch = "x86")))]
pub(crate) use linux_raw_sys::general::{__kernel_gid_t as gid_t, __kernel_uid_t as uid_t};
@@ -25,7 +26,7 @@ pub(crate) use linux_raw_sys::general::epoll_event;
feature = "fs",
all(
not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
+ not(feature = "use-explicitly-provided-auxv"),
any(
feature = "param",
feature = "runtime",
@@ -39,6 +40,8 @@ pub(crate) use linux_raw_sys::general::{
XATTR_REPLACE,
};
+pub(crate) use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FICLONE};
+
#[cfg(feature = "io_uring")]
pub(crate) use linux_raw_sys::{general::open_how, io_uring::*};
@@ -65,10 +68,10 @@ pub(crate) use linux_raw_sys::{
IP_MULTICAST_TTL, IP_TTL, MSG_CMSG_CLOEXEC, MSG_CONFIRM, MSG_DONTROUTE, MSG_DONTWAIT,
MSG_EOR, MSG_ERRQUEUE, MSG_MORE, MSG_NOSIGNAL, MSG_OOB, MSG_PEEK, MSG_TRUNC, MSG_WAITALL,
SCM_CREDENTIALS, SCM_RIGHTS, SHUT_RD, SHUT_RDWR, SHUT_WR, SOCK_DGRAM, SOCK_RAW, SOCK_RDM,
- SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_KEEPALIVE, SO_LINGER,
- SO_PASSCRED, SO_RCVBUF, SO_RCVTIMEO_NEW, SO_RCVTIMEO_NEW as SO_RCVTIMEO, SO_RCVTIMEO_OLD,
- SO_REUSEADDR, SO_SNDBUF, SO_SNDTIMEO_NEW, SO_SNDTIMEO_NEW as SO_SNDTIMEO, SO_SNDTIMEO_OLD,
- SO_TYPE, TCP_NODELAY,
+ SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_DOMAIN, SO_ERROR, SO_KEEPALIVE,
+ SO_LINGER, SO_PASSCRED, SO_RCVBUF, SO_RCVTIMEO_NEW, SO_RCVTIMEO_NEW as SO_RCVTIMEO,
+ SO_RCVTIMEO_OLD, SO_REUSEADDR, SO_SNDBUF, SO_SNDTIMEO_NEW, SO_SNDTIMEO_NEW as SO_SNDTIMEO,
+ SO_SNDTIMEO_OLD, SO_TYPE, TCP_NODELAY,
},
netlink::*,
};
@@ -76,12 +79,25 @@ pub(crate) use linux_raw_sys::{
#[cfg(any(feature = "process", feature = "runtime"))]
pub(crate) use linux_raw_sys::general::siginfo_t;
+#[cfg(any(feature = "process", feature = "runtime"))]
+pub(crate) const EXIT_SUCCESS: c_int = 0;
+#[cfg(any(feature = "process", feature = "runtime"))]
+pub(crate) const EXIT_FAILURE: c_int = 1;
#[cfg(feature = "process")]
-pub(crate) use linux_raw_sys::general::{
- CLD_CONTINUED, CLD_DUMPED, CLD_EXITED, CLD_KILLED, CLD_STOPPED, CLD_TRAPPED,
- O_NONBLOCK as PIDFD_NONBLOCK, P_ALL, P_PID, P_PIDFD,
+pub(crate) const EXIT_SIGNALED_SIGABRT: c_int = 128 + linux_raw_sys::general::SIGABRT as c_int;
+
+#[cfg(feature = "process")]
+pub(crate) use linux_raw_sys::{
+ general::{
+ CLD_CONTINUED, CLD_DUMPED, CLD_EXITED, CLD_KILLED, CLD_STOPPED, CLD_TRAPPED,
+ O_NONBLOCK as PIDFD_NONBLOCK, P_ALL, P_PID, P_PIDFD,
+ },
+ ioctl::TIOCSCTTY,
};
+#[cfg(feature = "pty")]
+pub(crate) use linux_raw_sys::ioctl::TIOCGPTPEER;
+
#[cfg(feature = "termios")]
pub(crate) use linux_raw_sys::{
general::{
@@ -99,7 +115,7 @@ pub(crate) use linux_raw_sys::{
VKILL, VLNEXT, VMIN, VQUIT, VREPRINT, VSTART, VSTOP, VSUSP, VSWTC, VT0, VT1, VTDLY, VTIME,
VWERASE, XCASE, XTABS,
},
- ioctl::{TCGETS2, TCSETS2, TCSETSF2, TCSETSW2},
+ ioctl::{TCGETS2, TCSETS2, TCSETSF2, TCSETSW2, TIOCEXCL, TIOCNXCL},
};
// On MIPS, `TCSANOW` et al have `TCSETS` added to them, so we need it to
diff --git a/vendor/rustix/src/backend/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs
index c87136f8f..f915db140 100644
--- a/vendor/rustix/src/backend/linux_raw/conv.rs
+++ b/vendor/rustix/src/backend/linux_raw/conv.rs
@@ -186,45 +186,45 @@ pub(super) fn no_fd<'a, Num: ArgNumber>() -> ArgReg<'a, Num> {
}
#[inline]
-pub(super) fn slice_just_addr<T: Sized, Num: ArgNumber>(v: &[T]) -> ArgReg<Num> {
+pub(super) fn slice_just_addr<T: Sized, Num: ArgNumber>(v: &[T]) -> ArgReg<'_, Num> {
let mut_ptr = v.as_ptr() as *mut T;
raw_arg(mut_ptr.cast())
}
#[inline]
-pub(super) fn slice_just_addr_mut<T: Sized, Num: ArgNumber>(v: &mut [T]) -> ArgReg<Num> {
+pub(super) fn slice_just_addr_mut<T: Sized, Num: ArgNumber>(v: &mut [T]) -> ArgReg<'_, Num> {
raw_arg(v.as_mut_ptr().cast())
}
#[inline]
pub(super) fn slice<T: Sized, Num0: ArgNumber, Num1: ArgNumber>(
v: &[T],
-) -> (ArgReg<Num0>, ArgReg<Num1>) {
+) -> (ArgReg<'_, Num0>, ArgReg<'_, Num1>) {
(slice_just_addr(v), pass_usize(v.len()))
}
#[inline]
pub(super) fn slice_mut<T: Sized, Num0: ArgNumber, Num1: ArgNumber>(
v: &mut [T],
-) -> (ArgReg<Num0>, ArgReg<Num1>) {
+) -> (ArgReg<'_, Num0>, ArgReg<'_, Num1>) {
(raw_arg(v.as_mut_ptr().cast()), pass_usize(v.len()))
}
#[inline]
-pub(super) fn by_ref<T: Sized, Num: ArgNumber>(t: &T) -> ArgReg<Num> {
+pub(super) fn by_ref<T: Sized, Num: ArgNumber>(t: &T) -> ArgReg<'_, Num> {
let mut_ptr = as_ptr(t) as *mut T;
raw_arg(mut_ptr.cast())
}
#[inline]
-pub(super) fn by_mut<T: Sized, Num: ArgNumber>(t: &mut T) -> ArgReg<Num> {
+pub(super) fn by_mut<T: Sized, Num: ArgNumber>(t: &mut T) -> ArgReg<'_, Num> {
raw_arg(as_mut_ptr(t).cast())
}
/// Convert an optional mutable reference into a `usize` for passing to a
/// syscall.
#[inline]
-pub(super) fn opt_mut<T: Sized, Num: ArgNumber>(t: Option<&mut T>) -> ArgReg<Num> {
+pub(super) fn opt_mut<T: Sized, Num: ArgNumber>(t: Option<&mut T>) -> ArgReg<'_, Num> {
// This optimizes into the equivalent of `transmute(t)`, and has the
// advantage of not requiring `unsafe`.
match t {
@@ -237,7 +237,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<T: Sized, Num: ArgNumber>(t: Option<&T>) -> ArgReg<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 {
@@ -300,7 +300,7 @@ pub(super) fn socklen_t<'a, Num: ArgNumber>(i: socklen_t) -> ArgReg<'a, Num> {
feature = "fs",
all(
not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
+ not(feature = "use-explicitly-provided-auxv"),
any(
feature = "param",
feature = "runtime",
@@ -581,7 +581,7 @@ impl<'a, Num: ArgNumber> From<crate::event::EventfdFlags> for ArgReg<'a, Num> {
}
}
-#[cfg(feature = "event")]
+#[cfg(all(feature = "alloc", feature = "event"))]
impl<'a, Num: ArgNumber> From<crate::event::epoll::CreateFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::event::epoll::CreateFlags) -> Self {
diff --git a/vendor/rustix/src/backend/linux_raw/elf.rs b/vendor/rustix/src/backend/linux_raw/elf.rs
deleted file mode 100644
index 415f79f88..000000000
--- a/vendor/rustix/src/backend/linux_raw/elf.rs
+++ /dev/null
@@ -1,181 +0,0 @@
-//! 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'];
-pub(super) const EI_CLASS: usize = 4;
-pub(super) const EI_DATA: usize = 5;
-pub(super) const EI_VERSION: usize = 6;
-pub(super) const EI_OSABI: usize = 7;
-pub(super) const EI_ABIVERSION: usize = 8;
-pub(super) const EV_CURRENT: u8 = 1;
-#[cfg(target_pointer_width = "32")]
-pub(super) const ELFCLASS: u8 = 1; // ELFCLASS32
-#[cfg(target_pointer_width = "64")]
-pub(super) const ELFCLASS: u8 = 2; // ELFCLASS64
-#[cfg(target_endian = "little")]
-pub(super) const ELFDATA: u8 = 1; // ELFDATA2LSB
-#[cfg(target_endian = "big")]
-pub(super) const ELFDATA: u8 = 2; // ELFDATA2MSB
-pub(super) const ELFOSABI_SYSV: u8 = 0;
-pub(super) const ELFOSABI_LINUX: u8 = 3;
-// At present all of our supported platforms use 0.
-pub(super) const ELFABIVERSION: u8 = 0;
-pub(super) const ET_DYN: u16 = 3;
-pub(super) const EI_NIDENT: usize = 16;
-pub(super) const SHN_UNDEF: u16 = 0;
-pub(super) const SHN_ABS: u16 = 0xfff1;
-pub(super) const PN_XNUM: u16 = 0xffff;
-pub(super) const PT_LOAD: u32 = 1;
-pub(super) const PT_DYNAMIC: u32 = 2;
-pub(super) const PT_INTERP: u32 = 3;
-pub(super) const PT_PHDR: u32 = 6;
-pub(super) const PT_TLS: u32 = 7;
-pub(super) const PT_GNU_STACK: u32 = 0x6474_e551;
-pub(super) const PT_GNU_RELRO: u32 = 0x6474_e552;
-pub(super) const PF_X: u32 = 1;
-pub(super) const PF_W: u32 = 2;
-pub(super) const PF_R: u32 = 4;
-pub(super) const DT_NULL: i32 = 0;
-pub(super) const DT_HASH: i32 = 4;
-pub(super) const DT_STRTAB: i32 = 5;
-pub(super) const DT_SYMTAB: i32 = 6;
-pub(super) const DT_SYMENT: i32 = 11;
-pub(super) const DT_VERSYM: i32 = 0x6fff_fff0;
-pub(super) const DT_VERDEF: i32 = 0x6fff_fffc;
-pub(super) const STB_WEAK: u8 = 2;
-pub(super) const STB_GLOBAL: u8 = 1;
-pub(super) const STT_NOTYPE: u8 = 0;
-pub(super) const STT_FUNC: u8 = 2;
-pub(super) const STN_UNDEF: u32 = 0;
-pub(super) const VER_FLG_BASE: u16 = 0x1;
-pub(super) const VER_DEF_CURRENT: u16 = 1;
-pub(super) const STV_DEFAULT: u8 = 0;
-#[cfg(target_arch = "arm")]
-pub(super) const EM_CURRENT: u16 = 40; // EM_ARM
-#[cfg(target_arch = "x86")]
-pub(super) const EM_CURRENT: u16 = 3; // EM_386
-#[cfg(target_arch = "powerpc64")]
-pub(super) const EM_CURRENT: u16 = 21; // EM_PPC64
-#[cfg(any(
- target_arch = "mips",
- target_arch = "mips32r6",
- target_arch = "mips64",
- target_arch = "mips64r6"
-))]
-pub(super) const EM_CURRENT: u16 = 8; // EM_MIPS
-#[cfg(target_arch = "x86_64")]
-pub(super) const EM_CURRENT: u16 = 62; // EM_X86_64
-#[cfg(target_arch = "aarch64")]
-pub(super) const EM_CURRENT: u16 = 183; // EM_AARCH64
-#[cfg(target_arch = "riscv64")]
-pub(super) const EM_CURRENT: u16 = 243; // EM_RISCV
-
-#[inline]
-pub(super) const fn ELF_ST_VISIBILITY(o: u8) -> u8 {
- o & 0x03
-}
-
-#[inline]
-pub(super) const fn ELF_ST_BIND(val: u8) -> u8 {
- val >> 4
-}
-
-#[inline]
-pub(super) const fn ELF_ST_TYPE(val: u8) -> u8 {
- val & 0xf
-}
-
-#[repr(C)]
-pub(super) struct Elf_Ehdr {
- pub(super) e_ident: [u8; EI_NIDENT],
- pub(super) e_type: u16,
- pub(super) e_machine: u16,
- pub(super) e_version: u32,
- pub(super) e_entry: usize,
- pub(super) e_phoff: usize,
- pub(super) e_shoff: usize,
- pub(super) e_flags: u32,
- pub(super) e_ehsize: u16,
- pub(super) e_phentsize: u16,
- pub(super) e_phnum: u16,
- pub(super) e_shentsize: u16,
- pub(super) e_shnum: u16,
- pub(super) e_shstrndx: u16,
-}
-
-#[cfg(target_pointer_width = "32")]
-#[repr(C)]
-pub(super) struct Elf_Phdr {
- pub(super) p_type: u32,
- pub(super) p_offset: usize,
- pub(super) p_vaddr: usize,
- pub(super) p_paddr: usize,
- pub(super) p_filesz: usize,
- pub(super) p_memsz: usize,
- pub(super) p_flags: u32,
- pub(super) p_align: usize,
-}
-
-#[cfg(target_pointer_width = "64")]
-#[repr(C)]
-pub(super) struct Elf_Phdr {
- pub(super) p_type: u32,
- pub(super) p_flags: u32,
- pub(super) p_offset: usize,
- pub(super) p_vaddr: usize,
- pub(super) p_paddr: usize,
- pub(super) p_filesz: usize,
- pub(super) p_memsz: usize,
- pub(super) p_align: usize,
-}
-
-#[cfg(target_pointer_width = "32")]
-#[repr(C)]
-pub(super) struct Elf_Sym {
- pub(super) st_name: u32,
- pub(super) st_value: usize,
- pub(super) st_size: usize,
- pub(super) st_info: u8,
- pub(super) st_other: u8,
- pub(super) st_shndx: u16,
-}
-
-#[cfg(target_pointer_width = "64")]
-#[repr(C)]
-pub(super) struct Elf_Sym {
- pub(super) st_name: u32,
- pub(super) st_info: u8,
- pub(super) st_other: u8,
- pub(super) st_shndx: u16,
- pub(super) st_value: usize,
- pub(super) st_size: usize,
-}
-
-#[repr(C)]
-pub(super) struct Elf_Dyn {
- pub(super) d_tag: i32,
- pub(super) d_val: usize,
-}
-
-#[repr(C)]
-pub(super) struct Elf_Verdef {
- pub(super) vd_version: u16,
- pub(super) vd_flags: u16,
- pub(super) vd_ndx: u16,
- pub(super) vd_cnt: u16,
- pub(super) vd_hash: u32,
- pub(super) vd_aux: u32,
- pub(super) vd_next: u32,
-}
-
-#[repr(C)]
-pub(super) struct Elf_Verdaux {
- pub(super) vda_name: u32,
- pub(super) _vda_next: u32,
-}
diff --git a/vendor/rustix/src/backend/linux_raw/event/epoll.rs b/vendor/rustix/src/backend/linux_raw/event/epoll.rs
index 6577feb51..ecd48b784 100644
--- a/vendor/rustix/src/backend/linux_raw/event/epoll.rs
+++ b/vendor/rustix/src/backend/linux_raw/event/epoll.rs
@@ -92,6 +92,9 @@ bitflags! {
pub struct CreateFlags: c::c_uint {
/// `EPOLL_CLOEXEC`
const CLOEXEC = linux_raw_sys::general::EPOLL_CLOEXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -144,6 +147,9 @@ bitflags! {
/// `EPOLLEXCLUSIVE`
const EXCLUSIVE = linux_raw_sys::general::EPOLLEXCLUSIVE as u32;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -160,8 +166,8 @@ pub fn create(flags: CreateFlags) -> io::Result<OwnedFd> {
/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
/// epoll object.
///
-/// This registers interest in any of the events set in `events` occurring
-/// on the file descriptor associated with `data`.
+/// This registers interest in any of the events set in `events` occurring on
+/// the file descriptor associated with `data`.
///
/// If [`delete`] is not called on the I/O source passed into this function
/// before the I/O source is `close`d, then the `epoll` will act as if the I/O
@@ -191,8 +197,8 @@ pub fn add(
}
}
-/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
-/// a given epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in a
+/// given epoll object.
///
/// This sets the events of interest with `target` to `events`.
#[doc(alias = "epoll_ctl")]
@@ -218,8 +224,8 @@ pub fn modify(
}
}
-/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
-/// a given epoll object.
+/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in a
+/// given epoll object.
#[doc(alias = "epoll_ctl")]
#[inline]
pub fn delete(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
@@ -317,8 +323,8 @@ impl EventData {
/// Return the value as a `u64`.
///
- /// If the stored value was a pointer, the pointer is zero-extended to
- /// a `u64`.
+ /// If the stored value was a pointer, the pointer is zero-extended to a
+ /// `u64`.
#[inline]
pub fn u64(self) -> u64 {
unsafe { self.as_u64 }
diff --git a/vendor/rustix/src/backend/linux_raw/event/mod.rs b/vendor/rustix/src/backend/linux_raw/event/mod.rs
index 605de2538..4148a8c7f 100644
--- a/vendor/rustix/src/backend/linux_raw/event/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/event/mod.rs
@@ -1,3 +1,4 @@
+#[cfg(feature = "alloc")]
pub mod epoll;
pub(crate) mod poll_fd;
pub(crate) mod syscalls;
diff --git a/vendor/rustix/src/backend/linux_raw/event/poll_fd.rs b/vendor/rustix/src/backend/linux_raw/event/poll_fd.rs
index 906efe0ef..c56c9152d 100644
--- a/vendor/rustix/src/backend/linux_raw/event/poll_fd.rs
+++ b/vendor/rustix/src/backend/linux_raw/event/poll_fd.rs
@@ -30,6 +30,9 @@ bitflags! {
const NVAL = linux_raw_sys::general::POLLNVAL as u16;
/// `POLLRDHUP`
const RDHUP = linux_raw_sys::general::POLLRDHUP as u16;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -81,7 +84,7 @@ impl<'fd> PollFd<'fd> {
/// Returns the ready events.
#[inline]
pub fn revents(&self) -> PollFlags {
- // Use `unwrap()` here because in theory we know we know all the bits
+ // Use `.unwrap()` here because in theory we know we know all the bits
// the OS might set here, but OS's have added extensions in the past.
PollFlags::from_bits(self.revents).unwrap()
}
diff --git a/vendor/rustix/src/backend/linux_raw/event/syscalls.rs b/vendor/rustix/src/backend/linux_raw/event/syscalls.rs
index 6d6b35d75..a8003b004 100644
--- a/vendor/rustix/src/backend/linux_raw/event/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/event/syscalls.rs
@@ -3,17 +3,20 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
-use crate::backend::conv::{
- by_ref, c_int, c_uint, pass_usize, raw_fd, ret, ret_owned_fd, ret_usize, slice_mut, zero,
-};
-use crate::event::{epoll, EventfdFlags, PollFd};
-use crate::fd::{BorrowedFd, OwnedFd};
+use crate::backend::conv::{c_int, c_uint, ret_owned_fd, ret_usize, slice_mut};
+use crate::event::{EventfdFlags, PollFd};
+use crate::fd::OwnedFd;
use crate::io;
-use linux_raw_sys::general::{EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD};
+#[cfg(feature = "alloc")]
+use {
+ crate::backend::conv::{by_ref, pass_usize, raw_fd, ret, zero},
+ crate::event::epoll,
+ crate::fd::BorrowedFd,
+ linux_raw_sys::general::{EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD},
+};
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
use {
crate::backend::conv::{opt_ref, size_of},
@@ -49,11 +52,13 @@ pub(crate) fn poll(fds: &mut [PollFd<'_>], timeout: c::c_int) -> io::Result<usiz
}
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn epoll_create(flags: epoll::CreateFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(syscall_readonly!(__NR_epoll_create1, flags)) }
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) unsafe fn epoll_add(
epfd: BorrowedFd<'_>,
@@ -69,6 +74,7 @@ pub(crate) unsafe fn epoll_add(
))
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) unsafe fn epoll_mod(
epfd: BorrowedFd<'_>,
@@ -84,6 +90,7 @@ pub(crate) unsafe fn epoll_mod(
))
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) unsafe fn epoll_del(epfd: BorrowedFd<'_>, fd: c::c_int) -> io::Result<()> {
ret(syscall_readonly!(
@@ -95,6 +102,7 @@ pub(crate) unsafe fn epoll_del(epfd: BorrowedFd<'_>, fd: c::c_int) -> io::Result
))
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn epoll_wait(
epfd: BorrowedFd<'_>,
diff --git a/vendor/rustix/src/backend/linux_raw/event/types.rs b/vendor/rustix/src/backend/linux_raw/event/types.rs
index e6273959c..3821f8f64 100644
--- a/vendor/rustix/src/backend/linux_raw/event/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/event/types.rs
@@ -14,5 +14,8 @@ bitflags! {
const NONBLOCK = linux_raw_sys::general::EFD_NONBLOCK;
/// `EFD_SEMAPHORE`
const SEMAPHORE = linux_raw_sys::general::EFD_SEMAPHORE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
index cb9d87b82..ef205ffdf 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
@@ -17,6 +17,9 @@ bitflags! {
const CLOEXEC = linux_raw_sys::general::IN_CLOEXEC;
/// `IN_NONBLOCK`
const NONBLOCK = linux_raw_sys::general::IN_NONBLOCK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -71,6 +74,9 @@ bitflags! {
const ONESHOT = linux_raw_sys::general::IN_ONESHOT;
/// `IN_ONLYDIR`
const ONLYDIR = linux_raw_sys::general::IN_ONLYDIR;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -99,14 +105,13 @@ pub fn inotify_add_watch<P: crate::path::Arg>(
path: P,
flags: WatchFlags,
) -> io::Result<i32> {
- let path = path.as_cow_c_str().unwrap();
- syscalls::inotify_add_watch(inot, &path, flags)
+ path.into_with_c_str(|path| syscalls::inotify_add_watch(inot, path, flags))
}
/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify
///
-/// The watch descriptor provided should have previously been returned
-/// by [`inotify_add_watch`] and not previously have been removed.
+/// The watch descriptor provided should have previously been returned by
+/// [`inotify_add_watch`] and not previously have been removed.
#[doc(alias = "inotify_rm_watch")]
#[inline]
pub fn inotify_remove_watch(inot: BorrowedFd<'_>, wd: i32) -> io::Result<()> {
diff --git a/vendor/rustix/src/backend/linux_raw/fs/mod.rs b/vendor/rustix/src/backend/linux_raw/fs/mod.rs
index acf43ce4f..ba72c5b6d 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/mod.rs
@@ -1,5 +1,13 @@
+#[cfg(feature = "alloc")]
pub(crate) mod dir;
pub mod inotify;
pub(crate) mod makedev;
pub(crate) mod syscalls;
pub(crate) mod types;
+
+// TODO: Fix linux-raw-sys to define ioctl codes for sparc.
+#[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))]
+pub(crate) const EXT4_IOC_RESIZE_FS: u32 = 0x8008_6610;
+
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+pub(crate) use linux_raw_sys::ioctl::EXT4_IOC_RESIZE_FS;
diff --git a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
index b3d4cd66c..e72afb8ab 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
@@ -32,15 +32,14 @@ use crate::fs::{
StatVfsMountFlags, StatxFlags, Timestamps, Uid, XattrFlags,
};
use crate::io;
-use core::mem::{transmute, zeroed, MaybeUninit};
+use core::mem::MaybeUninit;
#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))]
use linux_raw_sys::general::stat as linux_stat64;
use linux_raw_sys::general::{
- __kernel_fsid_t, __kernel_timespec, open_how, statx, AT_EACCESS, AT_FDCWD, AT_REMOVEDIR,
- AT_SYMLINK_NOFOLLOW, F_ADD_SEALS, F_GETFL, F_GET_SEALS, F_SETFL, SEEK_CUR, SEEK_DATA, SEEK_END,
- SEEK_HOLE, SEEK_SET, STATX__RESERVED,
+ __kernel_fsid_t, open_how, statx, AT_EACCESS, AT_FDCWD, AT_REMOVEDIR, AT_SYMLINK_NOFOLLOW,
+ F_ADD_SEALS, F_GETFL, F_GET_SEALS, F_SETFL, SEEK_CUR, SEEK_DATA, SEEK_END, SEEK_HOLE, SEEK_SET,
+ STATX__RESERVED,
};
-use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, EXT4_IOC_RESIZE_FS, FICLONE};
#[cfg(target_pointer_width = "32")]
use {
crate::backend::conv::{hi, lo, slice_just_addr},
@@ -160,6 +159,30 @@ pub(crate) fn chownat(
}
#[inline]
+pub(crate) fn chown(path: &CStr, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
+ // Most architectures have a `chown` syscall.
+ #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))]
+ unsafe {
+ let (ow, gr) = crate::ugid::translate_fchown_args(owner, group);
+ ret(syscall_readonly!(__NR_chown, path, c_uint(ow), c_uint(gr)))
+ }
+
+ // Aarch64 and RISC-V don't, so use `fchownat`.
+ #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
+ unsafe {
+ let (ow, gr) = crate::ugid::translate_fchown_args(owner, group);
+ ret(syscall_readonly!(
+ __NR_fchownat,
+ raw_fd(AT_FDCWD),
+ path,
+ c_uint(ow),
+ c_uint(gr),
+ zero()
+ ))
+ }
+}
+
+#[inline]
pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
unsafe {
let (ow, gr) = crate::ugid::translate_fchown_args(owner, group);
@@ -207,9 +230,7 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
}
SeekFrom::End(offset) => (SEEK_END, offset),
SeekFrom::Current(offset) => (SEEK_CUR, offset),
- #[cfg(target_os = "linux")]
SeekFrom::Data(offset) => (SEEK_DATA, offset),
- #[cfg(target_os = "linux")]
SeekFrom::Hole(offset) => (SEEK_HOLE, offset),
};
_seek(fd, offset, whence)
@@ -915,6 +936,7 @@ fn statfs_to_statvfs(statfs: StatFs) -> StatVfs {
}
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
let (buf_addr_mut, buf_len) = slice_mut(buf);
@@ -929,6 +951,7 @@ pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result<usize> {
}
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn readlinkat(
dirfd: BorrowedFd<'_>,
@@ -1028,38 +1051,37 @@ pub(crate) fn fcntl_lock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::R
FlockOperation::NonBlockingUnlock => (F_SETLK, F_UNLCK),
};
- unsafe {
- let lock = flock {
- l_type: l_type as _,
+ let lock = flock {
+ l_type: l_type as _,
- // When `l_len` is zero, this locks all the bytes from
- // `l_whence`/`l_start` to the end of the file, even as the
- // file grows dynamically.
- l_whence: SEEK_SET as _,
- l_start: 0,
- l_len: 0,
+ // When `l_len` is zero, this locks all the bytes from
+ // `l_whence`/`l_start` to the end of the file, even as the
+ // file grows dynamically.
+ l_whence: SEEK_SET as _,
+ l_start: 0,
+ l_len: 0,
- ..zeroed()
- };
+ // Unused.
+ l_pid: 0,
+ };
- #[cfg(target_pointer_width = "32")]
- {
- ret(syscall_readonly!(
- __NR_fcntl64,
- fd,
- c_uint(cmd),
- by_ref(&lock)
- ))
- }
- #[cfg(target_pointer_width = "64")]
- {
- ret(syscall_readonly!(
- __NR_fcntl,
- fd,
- c_uint(cmd),
- by_ref(&lock)
- ))
- }
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fcntl64,
+ fd,
+ c_uint(cmd),
+ by_ref(&lock)
+ ))
+ }
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_fcntl,
+ fd,
+ c_uint(cmd),
+ by_ref(&lock)
+ ))
}
}
@@ -1235,6 +1257,7 @@ pub(crate) fn mkdirat(dirfd: BorrowedFd<'_>, path: &CStr, mode: Mode) -> io::Res
unsafe { ret(syscall_readonly!(__NR_mkdirat, dirfd, path, mode)) }
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn getdents(fd: BorrowedFd<'_>, dirent: &mut [u8]) -> io::Result<usize> {
let (dirent_addr_mut, dirent_len) = slice_mut(dirent);
@@ -1269,9 +1292,6 @@ fn _utimensat(
times: &Timestamps,
flags: AtFlags,
) -> io::Result<()> {
- // Assert that `Timestamps` has the expected layout.
- let _ = unsafe { transmute::<Timestamps, [__kernel_timespec; 2]>(times.clone()) };
-
// `utimensat_time64` was introduced in Linux 5.1. The old `utimensat`
// syscall is not y2038-compatible on 32-bit architectures.
#[cfg(target_pointer_width = "32")]
@@ -1626,37 +1646,10 @@ pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_fremovexattr, fd, name)) }
}
-#[inline]
-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))?;
- Ok(result.assume_init() as u32)
- }
-}
-
-#[inline]
-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))?;
- Ok(result.assume_init() as u32)
- }
-}
-
-#[inline]
-pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(FICLONE), src_fd)) }
-}
+#[test]
+fn test_sizes() {
+ assert_eq_size!(linux_raw_sys::general::__kernel_loff_t, u64);
-#[inline]
-pub(crate) fn ext4_ioc_resize_fs(fd: BorrowedFd<'_>, blocks: u64) -> io::Result<()> {
- unsafe {
- ret(syscall_readonly!(
- __NR_ioctl,
- fd,
- c_uint(EXT4_IOC_RESIZE_FS),
- by_ref(&blocks)
- ))
- }
+ // Assert that `Timestamps` has the expected layout.
+ assert_eq_size!([linux_raw_sys::general::__kernel_timespec; 2], Timestamps);
}
diff --git a/vendor/rustix/src/backend/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs
index e18dc0b4d..6e2e14f1e 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs
@@ -19,6 +19,9 @@ bitflags! {
/// `F_OK`
const EXISTS = linux_raw_sys::general::F_OK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -57,6 +60,9 @@ bitflags! {
/// `AT_STATX_DONT_SYNC`
const STATX_DONT_SYNC = linux_raw_sys::general::AT_STATX_DONT_SYNC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -113,6 +119,9 @@ bitflags! {
/// `S_ISVTX`
const SVTX = linux_raw_sys::general::S_ISVTX;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -210,6 +219,8 @@ bitflags! {
const WRONLY = linux_raw_sys::general::O_WRONLY;
/// `O_RDWR`
+ ///
+ /// This is not equal to `RDONLY | WRONLY`. It's a distinct flag.
const RDWR = linux_raw_sys::general::O_RDWR;
/// `O_NOCTTY`
@@ -238,6 +249,9 @@ bitflags! {
/// `O_DIRECT`
const DIRECT = linux_raw_sys::general::O_DIRECT;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -265,6 +279,9 @@ bitflags! {
/// `RESOLVE_CACHED` (since Linux 5.12)
const CACHED = linux_raw_sys::general::RESOLVE_CACHED as u64;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -283,6 +300,9 @@ bitflags! {
/// `RENAME_WHITEOUT`
const WHITEOUT = linux_raw_sys::general::RENAME_WHITEOUT;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -432,6 +452,9 @@ bitflags! {
const HUGE_2GB = linux_raw_sys::general::MFD_HUGE_2GB;
/// `MFD_HUGE_16GB`
const HUGE_16GB = linux_raw_sys::general::MFD_HUGE_16GB;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -444,16 +467,19 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct SealFlags: u32 {
- /// `F_SEAL_SEAL`.
- const SEAL = linux_raw_sys::general::F_SEAL_SEAL;
- /// `F_SEAL_SHRINK`.
- const SHRINK = linux_raw_sys::general::F_SEAL_SHRINK;
- /// `F_SEAL_GROW`.
- const GROW = linux_raw_sys::general::F_SEAL_GROW;
- /// `F_SEAL_WRITE`.
- const WRITE = linux_raw_sys::general::F_SEAL_WRITE;
- /// `F_SEAL_FUTURE_WRITE` (since Linux 5.1)
- const FUTURE_WRITE = linux_raw_sys::general::F_SEAL_FUTURE_WRITE;
+ /// `F_SEAL_SEAL`.
+ const SEAL = linux_raw_sys::general::F_SEAL_SEAL;
+ /// `F_SEAL_SHRINK`.
+ const SHRINK = linux_raw_sys::general::F_SEAL_SHRINK;
+ /// `F_SEAL_GROW`.
+ const GROW = linux_raw_sys::general::F_SEAL_GROW;
+ /// `F_SEAL_WRITE`.
+ const WRITE = linux_raw_sys::general::F_SEAL_WRITE;
+ /// `F_SEAL_FUTURE_WRITE` (since Linux 5.1)
+ const FUTURE_WRITE = linux_raw_sys::general::F_SEAL_FUTURE_WRITE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -511,6 +537,9 @@ bitflags! {
/// `STATX_ALL`
const ALL = linux_raw_sys::general::STATX_ALL;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -535,6 +564,9 @@ bitflags! {
const INSERT_RANGE = linux_raw_sys::general::FALLOC_FL_INSERT_RANGE;
/// `FALLOC_FL_UNSHARE_RANGE`
const UNSHARE_RANGE = linux_raw_sys::general::FALLOC_FL_UNSHARE_RANGE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -569,6 +601,9 @@ bitflags! {
/// `ST_SYNCHRONOUS`
const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS as u64;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/io/errno.rs b/vendor/rustix/src/backend/linux_raw/io/errno.rs
index af057e2da..7730a7237 100644
--- a/vendor/rustix/src/backend/linux_raw/io/errno.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/errno.rs
@@ -16,10 +16,32 @@ use crate::backend::reg::{RetNumber, RetReg};
use crate::io;
use linux_raw_sys::errno;
-/// The error type for `rustix` APIs.
+/// `errno`—An error code.
///
-/// This is similar to `std::io::Error`, but only holds an OS error code,
-/// and no extra error value.
+/// The error type for `rustix` APIs. This is similar to [`std::io::Error`],
+/// but only holds an OS error code, and no extra error value.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+/// - [Winsock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html
+/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno
+/// [NetBSD]: https://man.netbsd.org/errno.2
+/// [OpenBSD]: https://man.openbsd.org/errno.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=errno&section=2
+/// [illumos]: https://illumos.org/man/3C/errno
+/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
+/// [`std::io::Error`]: Result
#[repr(transparent)]
#[doc(alias = "errno")]
#[derive(Eq, PartialEq, Hash, Copy, Clone)]
diff --git a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
index 88eed3d72..d2cbba0c3 100644
--- a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
@@ -10,16 +10,11 @@
use crate::backend::conv::loff_t_from_u64;
#[cfg(all(
target_pointer_width = "32",
- any(
- target_arch = "arm",
- target_arch = "mips",
- target_arch = "mips32r6",
- target_arch = "power"
- ),
+ any(target_arch = "arm", target_arch = "mips", target_arch = "mips32r6"),
))]
use crate::backend::conv::zero;
use crate::backend::conv::{
- by_ref, c_uint, raw_fd, ret, ret_c_uint, ret_discarded_fd, ret_owned_fd, ret_usize, slice,
+ c_uint, raw_fd, ret, ret_c_int, ret_c_uint, ret_discarded_fd, ret_owned_fd, ret_usize, slice,
slice_mut,
};
#[cfg(target_pointer_width = "32")]
@@ -27,12 +22,11 @@ use crate::backend::conv::{hi, lo};
use crate::backend::{c, MAX_IOV};
use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
use crate::io::{self, DupFlags, FdFlags, IoSlice, IoSliceMut, ReadWriteFlags};
+use crate::ioctl::{IoctlOutput, RawOpcode};
#[cfg(all(feature = "fs", feature = "net"))]
use crate::net::{RecvFlags, SendFlags};
use core::cmp;
-use core::mem::MaybeUninit;
use linux_raw_sys::general::{F_DUPFD_CLOEXEC, F_GETFD, F_SETFD};
-use linux_raw_sys::ioctl::{FIONBIO, FIONREAD};
#[inline]
pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> {
@@ -48,12 +42,7 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], pos: u64) -> io::Result<
// <https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/arch/arm64/kernel/sys32.c#L75>
#[cfg(all(
target_pointer_width = "32",
- any(
- target_arch = "arm",
- target_arch = "mips",
- target_arch = "mips32r6",
- target_arch = "power"
- ),
+ any(target_arch = "arm", target_arch = "mips", target_arch = "mips32r6"),
))]
unsafe {
ret_usize(syscall!(
@@ -68,12 +57,7 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], pos: u64) -> io::Result<
}
#[cfg(all(
target_pointer_width = "32",
- not(any(
- target_arch = "arm",
- target_arch = "mips",
- target_arch = "mips32r6",
- target_arch = "power"
- )),
+ not(any(target_arch = "arm", target_arch = "mips", target_arch = "mips32r6")),
))]
unsafe {
ret_usize(syscall!(
@@ -183,12 +167,7 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result<usi
// <https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/arch/arm64/kernel/sys32.c#L81-L83>
#[cfg(all(
target_pointer_width = "32",
- any(
- target_arch = "arm",
- target_arch = "mips",
- target_arch = "mips32r6",
- target_arch = "power"
- ),
+ any(target_arch = "arm", target_arch = "mips", target_arch = "mips32r6"),
))]
unsafe {
ret_usize(syscall_readonly!(
@@ -203,12 +182,7 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result<usi
}
#[cfg(all(
target_pointer_width = "32",
- not(any(
- target_arch = "arm",
- target_arch = "mips",
- target_arch = "mips32r6",
- target_arch = "power"
- )),
+ not(any(target_arch = "arm", target_arch = "mips", target_arch = "mips32r6")),
))]
unsafe {
ret_usize(syscall_readonly!(
@@ -307,25 +281,21 @@ pub(crate) unsafe fn close(fd: RawFd) {
}
#[inline]
-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))?;
- Ok(result.assume_init() as u64)
- }
+pub(crate) unsafe fn ioctl(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> io::Result<IoctlOutput> {
+ ret_c_int(syscall!(__NR_ioctl, fd, c_uint(request), arg))
}
#[inline]
-pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
- unsafe {
- let data = c::c_int::from(value);
- ret(syscall_readonly!(
- __NR_ioctl,
- fd,
- c_uint(FIONBIO),
- by_ref(&data)
- ))
- }
+pub(crate) unsafe fn ioctl_readonly(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> io::Result<IoctlOutput> {
+ ret_c_int(syscall_readonly!(__NR_ioctl, fd, c_uint(request), arg))
}
#[cfg(all(feature = "fs", feature = "net"))]
@@ -376,6 +346,7 @@ pub(crate) fn dup(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(syscall_readonly!(__NR_dup, fd)) }
}
+#[allow(clippy::needless_pass_by_ref_mut)]
#[inline]
pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> {
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
@@ -392,6 +363,7 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> {
}
}
+#[allow(clippy::needless_pass_by_ref_mut)]
#[inline]
pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> {
unsafe { ret_discarded_fd(syscall_readonly!(__NR_dup3, fd, new.as_fd(), flags)) }
diff --git a/vendor/rustix/src/backend/linux_raw/io/types.rs b/vendor/rustix/src/backend/linux_raw/io/types.rs
index c06134440..fb7e913a0 100644
--- a/vendor/rustix/src/backend/linux_raw/io/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/types.rs
@@ -11,6 +11,9 @@ bitflags! {
pub struct FdFlags: c::c_uint {
/// `FD_CLOEXEC`
const CLOEXEC = linux_raw_sys::general::FD_CLOEXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -32,6 +35,9 @@ bitflags! {
const NOWAIT = linux_raw_sys::general::RWF_NOWAIT;
/// `RWF_APPEND` (since Linux 4.16)
const APPEND = linux_raw_sys::general::RWF_APPEND;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -44,5 +50,8 @@ bitflags! {
pub struct DupFlags: c::c_uint {
/// `O_CLOEXEC`
const CLOEXEC = linux_raw_sys::general::O_CLOEXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
index 90c82c129..d10cd1395 100644
--- a/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend::syscalls` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::conv::{by_mut, c_uint, pass_usize, ret_c_uint, ret_owned_fd};
use crate::fd::{BorrowedFd, OwnedFd};
diff --git a/vendor/rustix/src/backend/linux_raw/mm/types.rs b/vendor/rustix/src/backend/linux_raw/mm/types.rs
index 2d5eebc58..0dfb41050 100644
--- a/vendor/rustix/src/backend/linux_raw/mm/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/mm/types.rs
@@ -16,6 +16,9 @@ bitflags! {
const WRITE = linux_raw_sys::general::PROT_WRITE;
/// `PROT_EXEC`
const EXEC = linux_raw_sys::general::PROT_EXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -52,6 +55,9 @@ bitflags! {
/// `PROT_ADI`
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
const ADI = linux_raw_sys::general::PROT_ADI;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -99,6 +105,9 @@ bitflags! {
/// `MAP_UNINITIALIZED`
#[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6")))]
const UNINITIALIZED = linux_raw_sys::general::MAP_UNINITIALIZED;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -116,6 +125,9 @@ bitflags! {
const MAYMOVE = linux_raw_sys::general::MREMAP_MAYMOVE;
/// `MREMAP_DONTUNMAP` (since Linux 5.7)
const DONTUNMAP = linux_raw_sys::general::MREMAP_DONTUNMAP;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -135,6 +147,9 @@ bitflags! {
/// file (so that they can be updated with the fresh values just
/// written).
const INVALIDATE = linux_raw_sys::general::MS_INVALIDATE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -147,6 +162,9 @@ bitflags! {
pub struct MlockFlags: u32 {
/// `MLOCK_ONFAULT`
const ONFAULT = linux_raw_sys::general::MLOCK_ONFAULT;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -239,5 +257,8 @@ bitflags! {
const CLOEXEC = linux_raw_sys::general::O_CLOEXEC;
/// `O_NONBLOCK`
const NONBLOCK = linux_raw_sys::general::O_NONBLOCK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs
index c3018930f..9a07467f4 100644
--- a/vendor/rustix/src/backend/linux_raw/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mod.rs
@@ -17,13 +17,6 @@
#[macro_use]
mod arch;
mod conv;
-#[cfg(any(
- feature = "param",
- feature = "runtime",
- feature = "time",
- target_arch = "x86"
-))]
-mod elf;
mod reg;
#[cfg(any(feature = "time", target_arch = "x86"))]
mod vdso;
@@ -36,7 +29,7 @@ pub(crate) mod event;
feature = "fs",
all(
not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
+ not(feature = "use-explicitly-provided-auxv"),
any(
feature = "param",
feature = "runtime",
@@ -104,7 +97,7 @@ pub(crate) mod prctl;
feature = "thread",
all(
not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
+ not(feature = "use-explicitly-provided-auxv"),
any(
feature = "param",
feature = "runtime",
diff --git a/vendor/rustix/src/backend/linux_raw/mount/types.rs b/vendor/rustix/src/backend/linux_raw/mount/types.rs
index 808710c13..221f8f315 100644
--- a/vendor/rustix/src/backend/linux_raw/mount/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/mount/types.rs
@@ -56,6 +56,9 @@ bitflags! {
/// `MS_NOSYMFOLLOW`
const NOSYMFOLLOW = linux_raw_sys::general::MS_NOSYMFOLLOW;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -74,6 +77,9 @@ bitflags! {
const EXPIRE = linux_raw_sys::general::MNT_EXPIRE;
/// `UMOUNT_NOFOLLOW`
const NOFOLLOW = linux_raw_sys::general::UMOUNT_NOFOLLOW;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -85,9 +91,11 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct FsOpenFlags: c::c_uint {
-
/// `FSOPEN_CLOEXEC`
const FSOPEN_CLOEXEC = linux_raw_sys::general::FSOPEN_CLOEXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -101,6 +109,9 @@ bitflags! {
pub struct FsMountFlags: c::c_uint {
/// `FSMOUNT_CLOEXEC`
const FSMOUNT_CLOEXEC = linux_raw_sys::general::FSMOUNT_CLOEXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -177,6 +188,9 @@ bitflags! {
/// `MOUNT_ATTR__ATIME_FLAGS`
const MOUNT_ATTR_SIZE_VER0 = linux_raw_sys::general::MOUNT_ATTR_SIZE_VER0;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -215,6 +229,9 @@ bitflags! {
/// `MOVE_MOUNT__MASK`
const MOVE_MOUNT__MASK = linux_raw_sys::general::MOVE_MOUNT__MASK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -243,6 +260,9 @@ bitflags! {
/// `AT_SYMLINK_NOFOLLOW`
const AT_SYMLINK_NOFOLLOW = linux_raw_sys::general::AT_SYMLINK_NOFOLLOW;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -265,6 +285,9 @@ bitflags! {
/// `FSPICK_EMPTY_PATH`
const FSPICK_EMPTY_PATH = linux_raw_sys::general::FSPICK_EMPTY_PATH;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -287,6 +310,9 @@ bitflags! {
const UNBINDABLE = linux_raw_sys::general::MS_UNBINDABLE;
/// `MS_REC`
const REC = linux_raw_sys::general::MS_REC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -296,6 +322,9 @@ bitflags! {
pub(crate) struct InternalMountFlags: c::c_uint {
const REMOUNT = linux_raw_sys::general::MS_REMOUNT;
const MOVE = linux_raw_sys::general::MS_MOVE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/net/addr.rs b/vendor/rustix/src/backend/linux_raw/net/addr.rs
index 4a203ed16..e6b307a16 100644
--- a/vendor/rustix/src/backend/linux_raw/net/addr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/addr.rs
@@ -117,9 +117,7 @@ impl Eq for SocketAddrUnix {}
impl PartialOrd for SocketAddrUnix {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
- let self_len = self.len() - offsetof_sun_path();
- let other_len = other.len() - offsetof_sun_path();
- self.unix.sun_path[..self_len].partial_cmp(&other.unix.sun_path[..other_len])
+ Some(self.cmp(other))
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/net/msghdr.rs b/vendor/rustix/src/backend/linux_raw/net/msghdr.rs
index 3c435bcfa..659093920 100644
--- a/vendor/rustix/src/backend/linux_raw/net/msghdr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/msghdr.rs
@@ -12,7 +12,7 @@ use crate::io::{self, IoSlice, IoSliceMut};
use crate::net::{RecvAncillaryBuffer, SendAncillaryBuffer, SocketAddrV4, SocketAddrV6};
use crate::utils::as_ptr;
-use core::mem::{size_of, zeroed, MaybeUninit};
+use core::mem::{size_of, MaybeUninit};
use core::ptr::null_mut;
fn msg_iov_len(len: usize) -> c::size_t {
@@ -42,9 +42,7 @@ pub(crate) fn with_recv_msghdr<R>(
msg_iovlen: msg_iov_len(iov.len()),
msg_control: control.as_control_ptr().cast(),
msg_controllen: msg_control_len(control.control_len()),
-
- // Zero-initialize any padding bytes.
- ..unsafe { zeroed() }
+ msg_flags: 0,
};
let res = f(&mut msghdr);
@@ -72,9 +70,7 @@ pub(crate) fn with_noaddr_msghdr<R>(
msg_iovlen: msg_iov_len(iov.len()),
msg_control: control.as_control_ptr().cast(),
msg_controllen: msg_control_len(control.control_len()),
-
- // Zero-initialize any padding bytes.
- ..unsafe { zeroed() }
+ msg_flags: 0,
})
}
@@ -85,7 +81,7 @@ pub(crate) fn with_v4_msghdr<R>(
control: &mut SendAncillaryBuffer<'_, '_, '_>,
f: impl FnOnce(c::msghdr) -> R,
) -> R {
- let encoded = unsafe { encode_sockaddr_v4(addr) };
+ let encoded = encode_sockaddr_v4(addr);
f(c::msghdr {
msg_name: as_ptr(&encoded) as _,
@@ -94,9 +90,7 @@ pub(crate) fn with_v4_msghdr<R>(
msg_iovlen: msg_iov_len(iov.len()),
msg_control: control.as_control_ptr().cast(),
msg_controllen: msg_control_len(control.control_len()),
-
- // Zero-initialize any padding bytes.
- ..unsafe { zeroed() }
+ msg_flags: 0,
})
}
@@ -107,7 +101,7 @@ pub(crate) fn with_v6_msghdr<R>(
control: &mut SendAncillaryBuffer<'_, '_, '_>,
f: impl FnOnce(c::msghdr) -> R,
) -> R {
- let encoded = unsafe { encode_sockaddr_v6(addr) };
+ let encoded = encode_sockaddr_v6(addr);
f(c::msghdr {
msg_name: as_ptr(&encoded) as _,
@@ -116,9 +110,7 @@ pub(crate) fn with_v6_msghdr<R>(
msg_iovlen: msg_iov_len(iov.len()),
msg_control: control.as_control_ptr().cast(),
msg_controllen: msg_control_len(control.control_len()),
-
- // Zero-initialize any padding bytes.
- ..unsafe { zeroed() }
+ msg_flags: 0,
})
}
@@ -136,8 +128,19 @@ pub(crate) fn with_unix_msghdr<R>(
msg_iovlen: msg_iov_len(iov.len()),
msg_control: control.as_control_ptr().cast(),
msg_controllen: msg_control_len(control.control_len()),
-
- // Zero-initialize any padding bytes.
- ..unsafe { zeroed() }
+ msg_flags: 0,
})
}
+
+/// Create a zero-initialized message header struct value.
+pub(crate) fn zero_msghdr() -> c::msghdr {
+ c::msghdr {
+ msg_name: null_mut(),
+ msg_namelen: 0,
+ msg_iov: null_mut(),
+ msg_iovlen: 0,
+ msg_control: null_mut(),
+ msg_controllen: 0,
+ msg_flags: 0,
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/net/send_recv.rs b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
index 6e39a13aa..43b35341a 100644
--- a/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs
@@ -23,6 +23,9 @@ bitflags! {
const NOSIGNAL = c::MSG_NOSIGNAL;
/// `MSG_OOB`
const OOB = c::MSG_OOB;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -48,5 +51,8 @@ bitflags! {
const TRUNC = c::MSG_TRUNC;
/// `MSG_WAITALL`
const WAITALL = c::MSG_WAITALL;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
index df35e63c8..e5ebcc1dd 100644
--- a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use super::msghdr::{
with_noaddr_msghdr, with_recv_msghdr, with_unix_msghdr, with_v4_msghdr, with_v6_msghdr,
@@ -51,7 +50,7 @@ pub(crate) fn socket(
ret_owned_fd(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SOCKET),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
family.into(),
type_.into(),
protocol.into(),
@@ -81,7 +80,7 @@ pub(crate) fn socket_with(
ret_owned_fd(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SOCKET),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
family.into(),
(type_, flags).into(),
protocol.into(),
@@ -116,7 +115,7 @@ pub(crate) fn socketpair(
ret(syscall!(
__NR_socketcall,
x86_sys(SYS_SOCKETPAIR),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
family.into(),
(type_, flags).into(),
protocol.into(),
@@ -140,7 +139,7 @@ pub(crate) fn accept(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
let fd = ret_owned_fd(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_ACCEPT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[fd.into(), zero(), zero()])
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[fd.into(), zero(), zero()])
))?;
Ok(fd)
}
@@ -158,7 +157,7 @@ pub(crate) fn accept_with(fd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<
let fd = ret_owned_fd(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_ACCEPT4),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[fd.into(), zero(), zero(), flags.into()])
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[fd.into(), zero(), zero(), flags.into()])
))?;
Ok(fd)
}
@@ -188,7 +187,7 @@ pub(crate) fn acceptfrom(fd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<Sock
let fd = ret_owned_fd(syscall!(
__NR_socketcall,
x86_sys(SYS_ACCEPT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
(&mut storage).into(),
by_mut(&mut addrlen),
@@ -229,7 +228,7 @@ pub(crate) fn acceptfrom_with(
let fd = ret_owned_fd(syscall!(
__NR_socketcall,
x86_sys(SYS_ACCEPT4),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
(&mut storage).into(),
by_mut(&mut addrlen),
@@ -262,7 +261,7 @@ pub(crate) fn recvmsg(
ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_RECVMSG),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
sockfd.into(),
by_mut(msghdr),
msg_flags.into(),
@@ -301,7 +300,7 @@ pub(crate) fn sendmsg(
ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_SENDMSG),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
sockfd.into(),
by_ref(&msghdr),
msg_flags.into()
@@ -331,7 +330,7 @@ pub(crate) fn sendmsg_v4(
ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_SENDMSG),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
sockfd.into(),
by_ref(&msghdr),
msg_flags.into(),
@@ -361,7 +360,7 @@ pub(crate) fn sendmsg_v6(
ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_SENDMSG),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
sockfd.into(),
by_ref(&msghdr),
msg_flags.into()
@@ -391,7 +390,7 @@ pub(crate) fn sendmsg_unix(
ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_SENDMSG),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
sockfd.into(),
by_ref(&msghdr),
msg_flags.into()
@@ -418,7 +417,7 @@ pub(crate) fn shutdown(fd: BorrowedFd<'_>, how: Shutdown) -> io::Result<()> {
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SHUTDOWN),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[fd.into(), c_uint(how as c::c_uint)])
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[fd.into(), c_uint(how as c::c_uint)])
))
}
}
@@ -461,7 +460,12 @@ pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Resu
ret_usize(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SEND),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[fd.into(), buf_addr, buf_len, flags.into()])
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
+ fd.into(),
+ buf_addr,
+ buf_len,
+ flags.into()
+ ])
))
}
}
@@ -492,7 +496,7 @@ pub(crate) fn sendto_v4(
ret_usize(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SENDTO),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
buf_addr,
buf_len,
@@ -530,7 +534,7 @@ pub(crate) fn sendto_v6(
ret_usize(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SENDTO),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
buf_addr,
buf_len,
@@ -568,7 +572,7 @@ pub(crate) fn sendto_unix(
ret_usize(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SENDTO),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
buf_addr,
buf_len,
@@ -618,7 +622,7 @@ pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io::
ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_RECV),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
buf_addr_mut,
buf_len,
@@ -659,7 +663,7 @@ pub(crate) fn recvfrom(
let nread = ret_usize(syscall!(
__NR_socketcall,
x86_sys(SYS_RECVFROM),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
buf_addr_mut,
buf_len,
@@ -700,7 +704,7 @@ pub(crate) fn getpeername(fd: BorrowedFd<'_>) -> io::Result<Option<SocketAddrAny
ret(syscall!(
__NR_socketcall,
x86_sys(SYS_GETPEERNAME),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
(&mut storage).into(),
by_mut(&mut addrlen),
@@ -737,7 +741,7 @@ pub(crate) fn getsockname(fd: BorrowedFd<'_>) -> io::Result<SocketAddrAny> {
ret(syscall!(
__NR_socketcall,
x86_sys(SYS_GETSOCKNAME),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
(&mut storage).into(),
by_mut(&mut addrlen),
@@ -766,7 +770,7 @@ pub(crate) fn bind_v4(fd: BorrowedFd<'_>, addr: &SocketAddrV4) -> io::Result<()>
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_BIND),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
by_ref(&encode_sockaddr_v4(addr)),
size_of::<sockaddr_in, _>(),
@@ -791,7 +795,7 @@ pub(crate) fn bind_v6(fd: BorrowedFd<'_>, addr: &SocketAddrV6) -> io::Result<()>
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_BIND),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
by_ref(&encode_sockaddr_v6(addr)),
size_of::<sockaddr_in6, _>(),
@@ -816,7 +820,7 @@ pub(crate) fn bind_unix(fd: BorrowedFd<'_>, addr: &SocketAddrUnix) -> io::Result
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_BIND),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
by_ref(&addr.unix),
socklen_t(addr.addr_len()),
@@ -841,7 +845,7 @@ pub(crate) fn connect_v4(fd: BorrowedFd<'_>, addr: &SocketAddrV4) -> io::Result<
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_CONNECT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
by_ref(&encode_sockaddr_v4(addr)),
size_of::<sockaddr_in, _>(),
@@ -866,7 +870,7 @@ pub(crate) fn connect_v6(fd: BorrowedFd<'_>, addr: &SocketAddrV6) -> io::Result<
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_CONNECT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
by_ref(&encode_sockaddr_v6(addr)),
size_of::<sockaddr_in6, _>(),
@@ -891,7 +895,7 @@ pub(crate) fn connect_unix(fd: BorrowedFd<'_>, addr: &SocketAddrUnix) -> io::Res
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_CONNECT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
by_ref(&addr.unix),
socklen_t(addr.addr_len()),
@@ -911,7 +915,7 @@ pub(crate) fn listen(fd: BorrowedFd<'_>, backlog: c::c_int) -> io::Result<()> {
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_LISTEN),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[fd.into(), c_int(backlog)])
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[fd.into(), c_int(backlog)])
))
}
}
@@ -920,10 +924,11 @@ pub(crate) mod sockopt {
use super::{c, BorrowedFd};
use crate::io;
use crate::net::sockopt::Timeout;
- use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
+ use crate::net::{AddressFamily, Ipv4Addr, Ipv6Addr, SocketType};
use c::{SO_RCVTIMEO_NEW, SO_RCVTIMEO_OLD, SO_SNDTIMEO_NEW, SO_SNDTIMEO_OLD};
use core::time::Duration;
use linux_raw_sys::general::{__kernel_timespec, timeval};
+ use linux_raw_sys::net::{SO_ACCEPTCONN, TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL};
#[inline]
fn getsockopt<T: Copy>(fd: BorrowedFd<'_>, level: u32, optname: u32) -> io::Result<T> {
@@ -960,7 +965,7 @@ pub(crate) mod sockopt {
ret(syscall!(
__NR_socketcall,
x86_sys(SYS_GETSOCKOPT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
c_uint(level),
c_uint(optname),
@@ -1008,7 +1013,7 @@ pub(crate) mod sockopt {
ret(syscall_readonly!(
__NR_socketcall,
x86_sys(SYS_SETSOCKOPT),
- slice_just_addr::<ArgReg<SocketArg>, _>(&[
+ slice_just_addr::<ArgReg<'_, SocketArg>, _>(&[
fd.into(),
c_uint(level),
c_uint(optname),
@@ -1035,6 +1040,11 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn get_socket_reuseaddr(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET as _, c::SO_REUSEADDR).map(to_bool)
+ }
+
+ #[inline]
pub(crate) fn set_socket_broadcast(fd: BorrowedFd<'_>, broadcast: bool) -> io::Result<()> {
setsockopt(
fd,
@@ -1056,11 +1066,7 @@ pub(crate) mod sockopt {
) -> io::Result<()> {
// Convert `linger` to seconds, rounding up.
let l_linger = if let Some(linger) = linger {
- let mut l_linger = linger.as_secs();
- if linger.subsec_nanos() != 0 {
- l_linger = l_linger.checked_add(1).ok_or(io::Errno::INVAL)?;
- }
- l_linger.try_into().map_err(|_e| io::Errno::INVAL)?
+ duration_to_secs(linger)?
} else {
0
};
@@ -1272,6 +1278,19 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn get_socket_domain(fd: BorrowedFd<'_>) -> io::Result<AddressFamily> {
+ let domain: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_DOMAIN)?;
+ Ok(AddressFamily(
+ domain.try_into().map_err(|_| io::Errno::OPNOTSUPP)?,
+ ))
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_acceptconn(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET as _, SO_ACCEPTCONN).map(to_bool)
+ }
+
+ #[inline]
pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl)
}
@@ -1420,6 +1439,40 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn set_tcp_keepcnt(fd: BorrowedFd<'_>, count: u32) -> io::Result<()> {
+ setsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPCNT, count)
+ }
+
+ #[inline]
+ pub(crate) fn get_tcp_keepcnt(fd: BorrowedFd<'_>) -> io::Result<u32> {
+ getsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPCNT)
+ }
+
+ #[inline]
+ pub(crate) fn set_tcp_keepidle(fd: BorrowedFd<'_>, duration: Duration) -> io::Result<()> {
+ let secs: c::c_uint = duration_to_secs(duration)?;
+ setsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPIDLE, secs)
+ }
+
+ #[inline]
+ pub(crate) fn get_tcp_keepidle(fd: BorrowedFd<'_>) -> io::Result<Duration> {
+ let secs: c::c_uint = getsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPIDLE)?;
+ Ok(Duration::from_secs(secs as u64))
+ }
+
+ #[inline]
+ pub(crate) fn set_tcp_keepintvl(fd: BorrowedFd<'_>, duration: Duration) -> io::Result<()> {
+ let secs: c::c_uint = duration_to_secs(duration)?;
+ setsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPINTVL, secs)
+ }
+
+ #[inline]
+ pub(crate) fn get_tcp_keepintvl(fd: BorrowedFd<'_>) -> io::Result<Duration> {
+ let secs: c::c_uint = getsockopt(fd, c::IPPROTO_TCP as _, TCP_KEEPINTVL)?;
+ Ok(Duration::from_secs(secs as u64))
+ }
+
+ #[inline]
fn to_imr(multiaddr: &Ipv4Addr, interface: &Ipv4Addr) -> c::ip_mreq {
c::ip_mreq {
imr_multiaddr: to_imr_addr(multiaddr),
@@ -1465,4 +1518,14 @@ pub(crate) mod sockopt {
fn to_bool(value: c::c_uint) -> bool {
value != 0
}
+
+ /// Convert to seconds, rounding up if necessary.
+ #[inline]
+ fn duration_to_secs<T: TryFrom<u64>>(duration: Duration) -> io::Result<T> {
+ let mut secs = duration.as_secs();
+ if duration.subsec_nanos() != 0 {
+ secs = secs.checked_add(1).ok_or(io::Errno::INVAL)?;
+ }
+ T::try_from(secs).map_err(|_e| io::Errno::INVAL)
+ }
}
diff --git a/vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs b/vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs
index 28da05cd0..417f76e43 100644
--- a/vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/write_sockaddr.rs
@@ -17,7 +17,7 @@ pub(crate) unsafe fn write_sockaddr(
}
}
-pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
+pub(crate) fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in {
c::sockaddr_in {
sin_family: c::AF_INET as _,
sin_port: u16::to_be(v4.port()),
@@ -34,7 +34,7 @@ unsafe fn write_sockaddr_v4(v4: &SocketAddrV4, storage: *mut SocketAddrStorage)
size_of::<c::sockaddr_in>()
}
-pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
+pub(crate) fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
c::sockaddr_in6 {
sin6_family: c::AF_INET6 as _,
sin6_port: u16::to_be(v6.port()),
diff --git a/vendor/rustix/src/backend/linux_raw/param/auxv.rs b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
index 144ff10cd..8b0423ae4 100644
--- a/vendor/rustix/src/backend/linux_raw/param/auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
@@ -6,24 +6,23 @@
#![allow(unsafe_code)]
use crate::backend::c;
-use crate::backend::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};
+#[cfg(feature = "alloc")]
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::elf::*;
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,
+ AT_BASE, AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_NULL, AT_PAGESZ, AT_SYSINFO_EHDR,
};
+#[cfg(feature = "runtime")]
+use linux_raw_sys::general::{AT_ENTRY, AT_PHDR, AT_PHENT, AT_PHNUM};
#[cfg(feature = "param")]
#[inline]
@@ -83,31 +82,23 @@ pub(crate) fn linux_execfn() -> &'static CStr {
#[cfg(feature = "runtime")]
#[inline]
-pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
+pub(crate) fn exe_phdrs() -> (*const c::c_void, usize, usize) {
let mut phdr = PHDR.load(Relaxed);
+ let mut phent = PHENT.load(Relaxed);
let mut phnum = PHNUM.load(Relaxed);
if phdr.is_null() || phnum == 0 {
init_auxv();
phdr = PHDR.load(Relaxed);
+ phent = PHENT.load(Relaxed);
phnum = PHNUM.load(Relaxed);
}
- (phdr.cast(), phnum)
+ (phdr.cast(), phent, 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.
+/// `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);
@@ -120,15 +111,35 @@ pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
ehdr
}
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn entry() -> usize {
+ let mut entry = ENTRY.load(Relaxed);
+
+ if entry == 0 {
+ init_auxv();
+ entry = ENTRY.load(Relaxed);
+ }
+
+ entry
+}
+
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 EXECFN: AtomicPtr<c::c_char> = AtomicPtr::new(null_mut());
static SYSINFO_EHDR: AtomicPtr<Elf_Ehdr> = AtomicPtr::new(null_mut());
+#[cfg(feature = "runtime")]
static PHDR: AtomicPtr<Elf_Phdr> = AtomicPtr::new(null_mut());
+#[cfg(feature = "runtime")]
+static PHENT: AtomicUsize = AtomicUsize::new(0);
+#[cfg(feature = "runtime")]
static PHNUM: AtomicUsize = AtomicUsize::new(0);
-static EXECFN: AtomicPtr<c::c_char> = AtomicPtr::new(null_mut());
+#[cfg(feature = "runtime")]
+static ENTRY: AtomicUsize = AtomicUsize::new(0);
+#[cfg(feature = "alloc")]
fn pr_get_auxv() -> crate::io::Result<Vec<u8>> {
use super::super::conv::{c_int, pass_usize, ret_usize};
const PR_GET_AUXV: c::c_int = 0x41555856;
@@ -138,7 +149,9 @@ fn pr_get_auxv() -> crate::io::Result<Vec<u8>> {
__NR_prctl,
c_int(PR_GET_AUXV),
buffer.as_ptr(),
- pass_usize(buffer.len())
+ pass_usize(buffer.len()),
+ pass_usize(0),
+ pass_usize(0)
))?
};
if len <= buffer.len() {
@@ -151,28 +164,33 @@ fn pr_get_auxv() -> crate::io::Result<Vec<u8>> {
__NR_prctl,
c_int(PR_GET_AUXV),
buffer.as_ptr(),
- pass_usize(buffer.len())
+ pass_usize(buffer.len()),
+ pass_usize(0),
+ pass_usize(0)
))?
};
assert_eq!(len, buffer.len());
return Ok(buffer);
}
-/// On non-Mustang platforms, we read the aux vector via the `prctl`
-/// `PR_GET_AUXV`, with a fallback to /proc/self/auxv for kernels that don't
-/// support `PR_GET_AUXV`.
+/// If we don't have "use-explicitly-provided-auxv" or "use-libc-auxv", we
+/// read the aux vector via the `prctl` `PR_GET_AUXV`, with a fallback to
+/// /proc/self/auxv for kernels that don't support `PR_GET_AUXV`.
#[cold]
fn init_auxv() {
- match pr_get_auxv() {
- Ok(buffer) => {
- // SAFETY: We assume the kernel returns a valid auxv.
- unsafe {
- init_from_auxp(buffer.as_ptr().cast());
+ #[cfg(feature = "alloc")]
+ {
+ match pr_get_auxv() {
+ Ok(buffer) => {
+ // SAFETY: We assume the kernel returns a valid auxv.
+ unsafe {
+ init_from_aux_iter(AuxPointer(buffer.as_ptr().cast()));
+ }
+ return;
+ }
+ Err(_) => {
+ // Fall back to /proc/self/auxv on error.
}
- return;
- }
- Err(_) => {
- // Fall back to /proc/self/auxv on error.
}
}
@@ -182,10 +200,17 @@ fn init_auxv() {
// auxv records.
let file = crate::fs::open("/proc/self/auxv", OFlags::RDONLY, Mode::empty()).unwrap();
- let _ = init_from_auxv_file(file);
+ #[cfg(feature = "alloc")]
+ init_from_auxv_file(file).unwrap();
+
+ #[cfg(not(feature = "alloc"))]
+ unsafe {
+ init_from_aux_iter(AuxFile(file)).unwrap();
+ }
}
/// Process auxv entries from the open file `auxv`.
+#[cfg(feature = "alloc")]
#[cold]
fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
let mut buffer = Vec::<u8>::with_capacity(512);
@@ -211,7 +236,7 @@ fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
}
// SAFETY: We loaded from an auxv file into the buffer.
- unsafe { init_from_auxp(buffer.as_ptr().cast()) }
+ unsafe { init_from_aux_iter(AuxPointer(buffer.as_ptr().cast())) }
}
/// Process auxv entries from the auxv array pointed to by `auxp`.
@@ -223,37 +248,50 @@ fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
/// The buffer contains `Elf_aux_t` elements, though it need not be aligned;
/// function uses `read_unaligned` to read from it.
#[cold]
-unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) -> Option<()> {
+unsafe fn init_from_aux_iter(aux_iter: impl Iterator<Item = 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();
+ #[cfg(feature = "runtime")]
+ let mut phdr = null_mut();
+ #[cfg(feature = "runtime")]
+ let mut phnum = 0;
+ #[cfg(feature = "runtime")]
let mut phent = 0;
+ #[cfg(feature = "runtime")]
+ let mut entry = 0;
- loop {
- let Elf_auxv_t { a_type, a_val } = read_unaligned(auxp);
-
+ for Elf_auxv_t { a_type, a_val } in aux_iter {
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_EXECFN => execfn = check_raw_pointer::<c::c_char>(a_val as *mut _)?.as_ptr(),
+ AT_SYSINFO_EHDR => sysinfo_ehdr = check_elf_base(a_val as *mut _)?.as_ptr(),
+
+ AT_BASE => {
+ let _ = check_elf_base(a_val.cast())?;
+ }
+
+ #[cfg(feature = "runtime")]
AT_PHDR => phdr = check_raw_pointer::<Elf_Phdr>(a_val as *mut _)?.as_ptr(),
+ #[cfg(feature = "runtime")]
AT_PHNUM => phnum = a_val as usize,
+ #[cfg(feature = "runtime")]
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(),
+ #[cfg(feature = "runtime")]
+ AT_ENTRY => entry = a_val as usize,
+
AT_NULL => break,
_ => (),
}
- auxp = auxp.add(1);
}
+ #[cfg(feature = "runtime")]
assert_eq!(phent, size_of::<Elf_Phdr>());
// The base and sysinfo_ehdr (if present) matches our platform. Accept
@@ -262,86 +300,29 @@ unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) -> Option<()> {
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);
+ #[cfg(feature = "runtime")]
+ PHDR.store(phdr, Relaxed);
+ #[cfg(feature = "runtime")]
+ PHNUM.store(phnum, Relaxed);
+ #[cfg(feature = "runtime")]
+ ENTRY.store(entry, 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.
-#[cold]
-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.
#[cold]
-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 crate::backend::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.
-#[cold]
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 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;
}
@@ -400,15 +381,46 @@ unsafe fn check_elf_base(base: *const Elf_Ehdr) -> Option<NonNull<Elf_Ehdr>> {
Some(NonNull::new_unchecked(as_ptr(hdr) as *mut _))
}
-// ELF ABI
+// Aux reading utilities
+
+// Read auxv records from an array in memory.
+struct AuxPointer(*const Elf_auxv_t);
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct Elf_auxv_t {
- a_type: usize,
+impl Iterator for AuxPointer {
+ type Item = Elf_auxv_t;
- // 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,
+ #[cold]
+ fn next(&mut self) -> Option<Self::Item> {
+ unsafe {
+ let value = read_unaligned(self.0);
+ self.0 = self.0.add(1);
+ Some(value)
+ }
+ }
+}
+
+// Read auxv records from a file.
+#[cfg(not(feature = "alloc"))]
+struct AuxFile(OwnedFd);
+
+#[cfg(not(feature = "alloc"))]
+impl Iterator for AuxFile {
+ type Item = Elf_auxv_t;
+
+ // This implementation does lots of `read`s and it isn't amazing, but
+ // hopefully we won't use it often.
+ #[cold]
+ fn next(&mut self) -> Option<Self::Item> {
+ let mut buf = [0_u8; size_of::<Self::Item>()];
+ let mut slice = &mut buf[..];
+ while !slice.is_empty() {
+ match crate::io::read(&self.0, slice) {
+ Ok(0) => panic!("unexpected end of auxv file"),
+ Ok(n) => slice = &mut slice[n..],
+ Err(crate::io::Errno::INTR) => continue,
+ Err(err) => Err(err).unwrap(),
+ }
+ }
+ Some(unsafe { read_unaligned(buf.as_ptr().cast()) })
+ }
}
diff --git a/vendor/rustix/src/backend/linux_raw/param/init.rs b/vendor/rustix/src/backend/linux_raw/param/init.rs
new file mode 100644
index 000000000..46aae009a
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/param/init.rs
@@ -0,0 +1,149 @@
+//! Linux auxv `init` function, for "use-explicitly-provided-auxv" mode.
+//!
+//! # Safety
+//!
+//! This uses raw pointers to locate and read the kernel-provided auxv array.
+#![allow(unsafe_code)]
+
+use crate::backend::c;
+#[cfg(feature = "param")]
+use crate::ffi::CStr;
+use core::ffi::c_void;
+use core::ptr::{null_mut, read, NonNull};
+use core::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
+use linux_raw_sys::elf::*;
+use linux_raw_sys::general::{
+ AT_CLKTCK, AT_EXECFN, AT_HWCAP, AT_HWCAP2, AT_NULL, AT_PAGESZ, AT_SYSINFO_EHDR,
+};
+#[cfg(feature = "runtime")]
+use linux_raw_sys::general::{AT_ENTRY, AT_PHDR, AT_PHENT, AT_PHNUM};
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn page_size() -> usize {
+ unsafe { PAGE_SIZE.load(Ordering::Relaxed) }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn clock_ticks_per_second() -> u64 {
+ unsafe { CLOCK_TICKS_PER_SECOND.load(Ordering::Relaxed) as u64 }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_hwcap() -> (usize, usize) {
+ unsafe {
+ (
+ HWCAP.load(Ordering::Relaxed),
+ HWCAP2.load(Ordering::Relaxed),
+ )
+ }
+}
+
+#[cfg(feature = "param")]
+#[inline]
+pub(crate) fn linux_execfn() -> &'static CStr {
+ let execfn = unsafe { EXECFN.load(Ordering::Relaxed) };
+
+ // SAFETY: We initialize `EXECFN` to a valid `CStr` pointer, and we assume
+ // the `AT_EXECFN` value provided by the kernel points to a valid C string.
+ unsafe { CStr::from_ptr(execfn.cast()) }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn exe_phdrs() -> (*const c_void, usize, usize) {
+ unsafe {
+ (
+ PHDR.load(Ordering::Relaxed).cast(),
+ PHENT.load(Ordering::Relaxed),
+ PHNUM.load(Ordering::Relaxed),
+ )
+ }
+}
+
+/// `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 { SYSINFO_EHDR.load(Ordering::Relaxed) }
+}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn entry() -> usize {
+ unsafe { ENTRY.load(Ordering::Relaxed) }
+}
+
+static mut PAGE_SIZE: AtomicUsize = AtomicUsize::new(0);
+static mut CLOCK_TICKS_PER_SECOND: AtomicUsize = AtomicUsize::new(0);
+static mut HWCAP: AtomicUsize = AtomicUsize::new(0);
+static mut HWCAP2: AtomicUsize = AtomicUsize::new(0);
+static mut SYSINFO_EHDR: AtomicPtr<Elf_Ehdr> = AtomicPtr::new(null_mut());
+// Initialize `EXECFN` to a valid `CStr` pointer so that we don't need to check
+// for null on every `execfn` call.
+static mut EXECFN: AtomicPtr<c::c_char> = AtomicPtr::new(b"\0".as_ptr() as _);
+// Use `dangling` so that we can always treat it like an empty slice.
+#[cfg(feature = "runtime")]
+static mut PHDR: AtomicPtr<Elf_Phdr> = AtomicPtr::new(NonNull::dangling().as_ptr());
+#[cfg(feature = "runtime")]
+static mut PHENT: AtomicUsize = AtomicUsize::new(0);
+#[cfg(feature = "runtime")]
+static mut PHNUM: AtomicUsize = AtomicUsize::new(0);
+#[cfg(feature = "runtime")]
+static mut ENTRY: AtomicUsize = AtomicUsize::new(0);
+
+/// When "use-explicitly-provided-auxv" is enabled, 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.store(a_val as usize, Ordering::Relaxed),
+ AT_CLKTCK => CLOCK_TICKS_PER_SECOND.store(a_val as usize, Ordering::Relaxed),
+ AT_HWCAP => HWCAP.store(a_val as usize, Ordering::Relaxed),
+ AT_HWCAP2 => HWCAP2.store(a_val as usize, Ordering::Relaxed),
+ AT_EXECFN => EXECFN.store(a_val.cast::<c::c_char>(), Ordering::Relaxed),
+ AT_SYSINFO_EHDR => SYSINFO_EHDR.store(a_val.cast::<Elf_Ehdr>(), Ordering::Relaxed),
+
+ #[cfg(feature = "runtime")]
+ AT_PHDR => PHDR.store(a_val.cast::<Elf_Phdr>(), Ordering::Relaxed),
+ #[cfg(feature = "runtime")]
+ AT_PHNUM => PHNUM.store(a_val as usize, Ordering::Relaxed),
+ #[cfg(feature = "runtime")]
+ AT_PHENT => PHENT.store(a_val as usize, Ordering::Relaxed),
+ #[cfg(feature = "runtime")]
+ AT_ENTRY => ENTRY.store(a_val as usize, Ordering::Relaxed),
+
+ AT_NULL => break,
+ _ => (),
+ }
+ auxp = auxp.add(1);
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
index 97739fcb5..0e6ca6ed5 100644
--- a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
@@ -6,35 +6,39 @@
#![allow(unsafe_code)]
use crate::backend::c;
-use crate::backend::elf::*;
#[cfg(feature = "param")]
use crate::ffi::CStr;
#[cfg(not(feature = "runtime"))]
use core::ptr::null;
-#[cfg(feature = "runtime")]
-use core::slice;
+use linux_raw_sys::elf::*;
// `getauxval` wasn't supported in glibc until 2.16. Also this lets us use
// `*mut` as the return type to preserve strict provenance.
#[cfg(not(feature = "runtime"))]
weak!(fn getauxval(c::c_ulong) -> *mut c::c_void);
-// With the "runtime" feature, go ahead and depend on `getauxval` existing
-// so that we never fail.
+// With the "runtime" feature, go ahead and depend on `getauxval` existing so
+// that we never fail.
#[cfg(feature = "runtime")]
extern "C" {
fn getauxval(type_: c::c_ulong) -> *mut c::c_void;
}
+#[cfg(feature = "runtime")]
const AT_PHDR: c::c_ulong = 3;
+#[cfg(feature = "runtime")]
+const AT_PHENT: c::c_ulong = 4;
+#[cfg(feature = "runtime")]
const AT_PHNUM: c::c_ulong = 5;
+#[cfg(feature = "runtime")]
+const AT_ENTRY: c::c_ulong = 9;
const AT_HWCAP: c::c_ulong = 16;
const AT_HWCAP2: c::c_ulong = 26;
const AT_EXECFN: c::c_ulong = 31;
const AT_SYSINFO_EHDR: c::c_ulong = 33;
-// Declare `sysconf` ourselves so that we don't depend on all of libc
-// just for this.
+// Declare `sysconf` ourselves so that we don't depend on all of libc just for
+// this.
extern "C" {
fn sysconf(name: c::c_int) -> c::c_long;
}
@@ -52,12 +56,16 @@ const _SC_CLK_TCK: c::c_int = 2;
fn test_abi() {
const_assert_eq!(self::_SC_PAGESIZE, ::libc::_SC_PAGESIZE);
const_assert_eq!(self::_SC_CLK_TCK, ::libc::_SC_CLK_TCK);
- const_assert_eq!(self::AT_PHDR, ::libc::AT_PHDR);
- const_assert_eq!(self::AT_PHNUM, ::libc::AT_PHNUM);
const_assert_eq!(self::AT_HWCAP, ::libc::AT_HWCAP);
const_assert_eq!(self::AT_HWCAP2, ::libc::AT_HWCAP2);
const_assert_eq!(self::AT_EXECFN, ::libc::AT_EXECFN);
const_assert_eq!(self::AT_SYSINFO_EHDR, ::libc::AT_SYSINFO_EHDR);
+ #[cfg(feature = "runtime")]
+ const_assert_eq!(self::AT_PHDR, ::libc::AT_PHDR);
+ #[cfg(feature = "runtime")]
+ const_assert_eq!(self::AT_PHNUM, ::libc::AT_PHNUM);
+ #[cfg(feature = "runtime")]
+ const_assert_eq!(self::AT_ENTRY, ::libc::AT_ENTRY);
}
#[cfg(feature = "param")]
@@ -114,24 +122,15 @@ pub(crate) fn linux_execfn() -> &'static CStr {
#[cfg(feature = "runtime")]
#[inline]
-pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
+pub(crate) fn exe_phdrs() -> (*const c::c_void, usize, usize) {
unsafe {
let phdr = getauxval(AT_PHDR) as *const c::c_void;
+ let phent = getauxval(AT_PHENT) as usize;
let phnum = getauxval(AT_PHNUM) as usize;
- (phdr, phnum)
+ (phdr, phent, 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]
@@ -150,3 +149,9 @@ pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
getauxval(AT_SYSINFO_EHDR) as *const Elf_Ehdr
}
}
+
+#[cfg(feature = "runtime")]
+#[inline]
+pub(crate) fn entry() -> usize {
+ unsafe { getauxval(AT_ENTRY) as usize }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/param/mod.rs b/vendor/rustix/src/backend/linux_raw/param/mod.rs
index 956282074..365f01604 100644
--- a/vendor/rustix/src/backend/linux_raw/param/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/mod.rs
@@ -1,12 +1,15 @@
-// On Mustang, origin is in control of program startup and can access the
-// incoming aux values on the stack.
+// With "use-explicitly-provided-auxv" enabled, we expect to be initialized
+// with an explicit `rustix::param::init` call.
//
// 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(feature = "use-explicitly-provided-auxv", path = "init.rs")]
#[cfg_attr(
- all(not(target_vendor = "mustang"), feature = "use-libc-auxv"),
+ all(
+ not(feature = "use-explicitly-provided-auxv"),
+ 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
deleted file mode 100644
index f45a25faf..000000000
--- a/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs
+++ /dev/null
@@ -1,159 +0,0 @@
-//! Linux auxv support, for Mustang.
-//!
-//! # Safety
-//!
-//! This uses raw pointers to locate and read the kernel-provided auxv array.
-#![allow(unsafe_code)]
-
-use crate::backend::c;
-use crate::backend::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/backend/linux_raw/pid/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pid/syscalls.rs
index f36bac048..9665ab3e9 100644
--- a/vendor/rustix/src/backend/linux_raw/pid/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/pid/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::conv::ret_usize_infallible;
use crate::pid::{Pid, RawPid};
diff --git a/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs
index e05094237..ec3e459be 100644
--- a/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::conv::{c_int, c_uint, opt_mut, pass_usize, ret, ret_usize, slice};
use crate::backend::{c, MAX_IOV};
@@ -59,9 +58,9 @@ pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
#[inline]
pub fn splice(
- fd_in: BorrowedFd,
+ fd_in: BorrowedFd<'_>,
off_in: Option<&mut u64>,
- fd_out: BorrowedFd,
+ fd_out: BorrowedFd<'_>,
off_out: Option<&mut u64>,
len: usize,
flags: SpliceFlags,
@@ -81,8 +80,8 @@ pub fn splice(
#[inline]
pub unsafe fn vmsplice(
- fd: BorrowedFd,
- bufs: &[IoSliceRaw],
+ fd: BorrowedFd<'_>,
+ bufs: &[IoSliceRaw<'_>],
flags: SpliceFlags,
) -> io::Result<usize> {
let (bufs_addr, bufs_len) = slice(&bufs[..cmp::min(bufs.len(), MAX_IOV)]);
@@ -91,8 +90,8 @@ pub unsafe fn vmsplice(
#[inline]
pub fn tee(
- fd_in: BorrowedFd,
- fd_out: BorrowedFd,
+ fd_in: BorrowedFd<'_>,
+ fd_out: BorrowedFd<'_>,
len: usize,
flags: SpliceFlags,
) -> io::Result<usize> {
diff --git a/vendor/rustix/src/backend/linux_raw/pipe/types.rs b/vendor/rustix/src/backend/linux_raw/pipe/types.rs
index 90d2d79ab..c950b5d0a 100644
--- a/vendor/rustix/src/backend/linux_raw/pipe/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/pipe/types.rs
@@ -15,6 +15,9 @@ bitflags! {
const DIRECT = linux_raw_sys::general::O_DIRECT;
/// `O_NONBLOCK`
const NONBLOCK = linux_raw_sys::general::O_NONBLOCK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -32,6 +35,9 @@ bitflags! {
const MORE = linux_raw_sys::general::SPLICE_F_MORE;
/// `SPLICE_F_GIFT`
const GIFT = linux_raw_sys::general::SPLICE_F_GIFT;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/prctl/syscalls.rs b/vendor/rustix/src/backend/linux_raw/prctl/syscalls.rs
index 193f4b7b4..1410d5128 100644
--- a/vendor/rustix/src/backend/linux_raw/prctl/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/prctl/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
use crate::backend::conv::{c_int, ret_c_int};
diff --git a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
index 5ec2755ff..c0416bf5a 100644
--- a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
@@ -3,17 +3,16 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use super::types::RawCpuSet;
use crate::backend::c;
-#[cfg(feature = "fs")]
+#[cfg(all(feature = "alloc", feature = "fs"))]
use crate::backend::conv::slice_mut;
use crate::backend::conv::{
by_mut, by_ref, c_int, c_uint, negative_pid, pass_usize, raw_fd, ret, ret_c_int,
ret_c_int_infallible, ret_c_uint, ret_infallible, ret_owned_fd, ret_usize, size_of,
- slice_just_addr, slice_just_addr_mut, zero,
+ slice_just_addr, zero,
};
use crate::fd::{AsRawFd, BorrowedFd, OwnedFd, RawFd};
#[cfg(feature = "fs")]
@@ -21,8 +20,8 @@ use crate::ffi::CStr;
use crate::io;
use crate::pid::RawPid;
use crate::process::{
- Cpuid, Gid, MembarrierCommand, MembarrierQuery, Pid, PidfdFlags, PidfdGetfdFlags, Resource,
- Rlimit, Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions, WaitidStatus,
+ Cpuid, MembarrierCommand, MembarrierQuery, Pid, PidfdFlags, PidfdGetfdFlags, Resource, Rlimit,
+ Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions, WaitidStatus,
};
use crate::signal::Signal;
use crate::utils::as_mut_ptr;
@@ -32,9 +31,10 @@ use linux_raw_sys::general::{
membarrier_cmd, membarrier_cmd_flag, rlimit, rlimit64, PRIO_PGRP, PRIO_PROCESS, PRIO_USER,
RLIM64_INFINITY, RLIM_INFINITY,
};
-use linux_raw_sys::ioctl::TIOCSCTTY;
#[cfg(feature = "fs")]
use {crate::backend::conv::ret_c_uint_infallible, crate::fs::Mode};
+#[cfg(feature = "alloc")]
+use {crate::backend::conv::slice_just_addr_mut, crate::process::Gid};
#[cfg(feature = "fs")]
#[inline]
@@ -53,7 +53,7 @@ pub(crate) fn chroot(filename: &CStr) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_chroot, filename)) }
}
-#[cfg(feature = "fs")]
+#[cfg(all(feature = "alloc", feature = "fs"))]
#[inline]
pub(crate) fn getcwd(buf: &mut [MaybeUninit<u8>]) -> io::Result<usize> {
let (buf_addr_mut, buf_len) = slice_mut(buf);
@@ -365,12 +365,12 @@ pub(crate) fn prlimit(pid: Option<Pid>, limit: Resource, new: Rlimit) -> io::Res
/// Convert a Rust [`Rlimit`] to a C `rlimit64`.
#[inline]
fn rlimit_from_linux(lim: rlimit64) -> Rlimit {
- let current = if lim.rlim_cur == RLIM64_INFINITY as _ {
+ let current = if lim.rlim_cur as u64 == RLIM64_INFINITY as u64 {
None
} else {
Some(lim.rlim_cur)
};
- let maximum = if lim.rlim_max == RLIM64_INFINITY as _ {
+ let maximum = if lim.rlim_max as u64 == RLIM64_INFINITY as u64 {
None
} else {
Some(lim.rlim_max)
@@ -395,12 +395,12 @@ fn rlimit_to_linux(lim: Rlimit) -> rlimit64 {
/// Like `rlimit_from_linux` but uses Linux's old 32-bit `rlimit`.
#[allow(clippy::useless_conversion)]
fn rlimit_from_linux_old(lim: rlimit) -> Rlimit {
- let current = if lim.rlim_cur == RLIM_INFINITY as _ {
+ let current = if lim.rlim_cur as u32 == RLIM_INFINITY as u32 {
None
} else {
Some(lim.rlim_cur.into())
};
- let maximum = if lim.rlim_max == RLIM_INFINITY as _ {
+ let maximum = if lim.rlim_max as u32 == RLIM_INFINITY as u32 {
None
} else {
Some(lim.rlim_max.into())
@@ -610,6 +610,7 @@ pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(syscall_readonly!(__NR_pidfd_open, pid, flags)) }
}
+#[cfg(feature = "alloc")]
#[inline]
pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> {
let len = buf.len().try_into().map_err(|_| io::Errno::NOMEM)?;
@@ -622,15 +623,3 @@ pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> {
))
}
}
-
-#[inline]
-pub(crate) fn ioctl_tiocsctty(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe {
- ret(syscall_readonly!(
- __NR_ioctl,
- fd,
- c_uint(TIOCSCTTY),
- by_ref(&0_u32)
- ))
- }
-}
diff --git a/vendor/rustix/src/backend/linux_raw/process/types.rs b/vendor/rustix/src/backend/linux_raw/process/types.rs
index f31749b83..841668a60 100644
--- a/vendor/rustix/src/backend/linux_raw/process/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/types.rs
@@ -1,4 +1,3 @@
-use crate::backend::c;
use linux_raw_sys::general::membarrier_cmd;
/// A command for use with [`membarrier`] and [`membarrier_cpu`].
@@ -78,15 +77,6 @@ pub enum Resource {
Rttime = linux_raw_sys::general::RLIMIT_RTTIME,
}
-/// `EXIT_SUCCESS`
-pub const EXIT_SUCCESS: c::c_int = 0;
-/// `EXIT_FAILURE`
-pub const EXIT_FAILURE: c::c_int = 1;
-/// The status value of a child terminated with a [`Signal::Abort`] signal.
-///
-/// [`Signal::Abort`]: crate::process::Signal::Abort
-pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + linux_raw_sys::general::SIGABRT as i32;
-
/// A CPU identifier as a raw integer.
pub type RawCpuid = u32;
diff --git a/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs
index 529564c34..b64344fb9 100644
--- a/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs
@@ -3,22 +3,21 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
-use crate::backend::c;
-use crate::backend::conv::{by_ref, c_uint, ret, ret_owned_fd};
-use crate::fd::{BorrowedFd, OwnedFd};
-use crate::ffi::CString;
+use crate::backend::conv::{by_ref, c_uint, ret};
+use crate::fd::BorrowedFd;
use crate::io;
-use crate::path::DecInt;
-use crate::pty::OpenptFlags;
-use alloc::vec::Vec;
-use core::mem::MaybeUninit;
-use linux_raw_sys::ioctl::{TIOCGPTN, TIOCGPTPEER, TIOCSPTLCK};
+use linux_raw_sys::ioctl::TIOCSPTLCK;
+#[cfg(feature = "alloc")]
+use {
+ crate::backend::c, crate::ffi::CString, crate::path::DecInt, alloc::vec::Vec,
+ core::mem::MaybeUninit, linux_raw_sys::ioctl::TIOCGPTN,
+};
+#[cfg(feature = "alloc")]
#[inline]
-pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString> {
+pub(crate) fn ptsname(fd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
unsafe {
let mut n = MaybeUninit::<c::c_int>::uninit();
ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGPTN), &mut n))?;
@@ -32,7 +31,7 @@ pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec<u8>) -> io::Result<CString
}
#[inline]
-pub(crate) fn unlockpt(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn unlockpt(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe {
ret(syscall_readonly!(
__NR_ioctl,
@@ -42,16 +41,3 @@ pub(crate) fn unlockpt(fd: BorrowedFd) -> io::Result<()> {
))
}
}
-
-#[cfg(target_os = "linux")]
-#[inline]
-pub(crate) fn ioctl_tiocgptpeer(fd: BorrowedFd, flags: OpenptFlags) -> io::Result<OwnedFd> {
- unsafe {
- ret_owned_fd(syscall_readonly!(
- __NR_ioctl,
- fd,
- c_uint(TIOCGPTPEER),
- flags
- ))
- }
-}
diff --git a/vendor/rustix/src/backend/linux_raw/rand/syscalls.rs b/vendor/rustix/src/backend/linux_raw/rand/syscalls.rs
index 95a6efcff..e744f3193 100644
--- a/vendor/rustix/src/backend/linux_raw/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/rand/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::conv::{ret_usize, slice_mut};
use crate::io;
diff --git a/vendor/rustix/src/backend/linux_raw/rand/types.rs b/vendor/rustix/src/backend/linux_raw/rand/types.rs
index 21e950015..47b996d30 100644
--- a/vendor/rustix/src/backend/linux_raw/rand/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/rand/types.rs
@@ -13,5 +13,8 @@ bitflags! {
const NONBLOCK = linux_raw_sys::general::GRND_NONBLOCK;
/// `GRND_INSECURE`
const INSECURE = linux_raw_sys::general::GRND_INSECURE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
index f82e2187b..c1ff3d239 100644
--- a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
#[cfg(target_arch = "x86")]
@@ -93,7 +92,10 @@ pub(crate) mod tls {
ret_infallible(syscall_readonly!(
__NR_arch_prctl,
c_uint(ARCH_SET_FS),
- data
+ data,
+ zero(),
+ zero(),
+ zero()
))
}
@@ -105,7 +107,14 @@ pub(crate) mod tls {
#[inline]
pub(crate) unsafe fn set_thread_name(name: &CStr) -> io::Result<()> {
- ret(syscall_readonly!(__NR_prctl, c_uint(PR_SET_NAME), name))
+ ret(syscall_readonly!(
+ __NR_prctl,
+ c_uint(PR_SET_NAME),
+ name,
+ zero(),
+ zero(),
+ zero()
+ ))
}
#[inline]
diff --git a/vendor/rustix/src/backend/linux_raw/runtime/tls.rs b/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
index 763971591..ad1634894 100644
--- a/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
@@ -7,9 +7,9 @@
#![allow(unsafe_code)]
use crate::backend::c;
-use crate::backend::elf::*;
-use crate::backend::param::auxv::exe_phdrs_slice;
-use core::ptr::null;
+use crate::backend::param::auxv::exe_phdrs;
+use core::ptr::{null, NonNull};
+use linux_raw_sys::elf::*;
/// For use with [`set_thread_area`].
///
@@ -22,26 +22,41 @@ pub(crate) fn startup_tls_info() -> StartupTlsInfo {
let mut tls_phdr = null();
let mut stack_size = 0;
- let phdrs = exe_phdrs_slice();
+ let (first_phdr, phent, phnum) = exe_phdrs();
+ let mut current_phdr = first_phdr.cast::<Elf_Phdr>();
// SAFETY: We assume the phdr array pointer and length the kernel provided
// to the process describe a valid phdr array.
unsafe {
- for phdr in phdrs {
+ let phdrs_end = current_phdr.cast::<u8>().add(phnum * phent).cast();
+ while current_phdr != phdrs_end {
+ let phdr = &*current_phdr;
+ current_phdr = current_phdr.cast::<u8>().add(phent).cast();
+
match phdr.p_type {
- PT_PHDR => base = phdrs.as_ptr().cast::<u8>().sub(phdr.p_vaddr),
+ PT_PHDR => base = first_phdr.cast::<u8>().sub(phdr.p_vaddr),
PT_TLS => tls_phdr = phdr,
PT_GNU_STACK => stack_size = phdr.p_memsz,
_ => {}
}
}
- StartupTlsInfo {
- addr: base.cast::<u8>().add((*tls_phdr).p_vaddr).cast(),
- mem_size: (*tls_phdr).p_memsz,
- file_size: (*tls_phdr).p_filesz,
- align: (*tls_phdr).p_align,
- stack_size,
+ if tls_phdr.is_null() {
+ StartupTlsInfo {
+ addr: NonNull::dangling().as_ptr(),
+ mem_size: 0,
+ file_size: 0,
+ align: 1,
+ stack_size: 0,
+ }
+ } else {
+ StartupTlsInfo {
+ addr: base.cast::<u8>().add((*tls_phdr).p_vaddr).cast(),
+ mem_size: (*tls_phdr).p_memsz,
+ file_size: (*tls_phdr).p_filesz,
+ align: (*tls_phdr).p_align,
+ stack_size,
+ }
}
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/system/syscalls.rs b/vendor/rustix/src/backend/linux_raw/system/syscalls.rs
index 514751d6f..947d5168e 100644
--- a/vendor/rustix/src/backend/linux_raw/system/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/system/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use super::types::RawUname;
use crate::backend::conv::{ret, ret_infallible, slice};
diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
index 8f030e1c3..09100441f 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
@@ -3,27 +3,25 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
use crate::backend::conv::{by_ref, c_uint, ret};
use crate::fd::BorrowedFd;
use crate::io;
use crate::pid::Pid;
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
use crate::procfs;
use crate::termios::{
Action, ControlModes, InputModes, LocalModes, OptionalActions, OutputModes, QueueSelector,
SpecialCodeIndex, Termios, Winsize,
};
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
use crate::{ffi::CStr, fs::FileType, path::DecInt};
use core::mem::MaybeUninit;
use linux_raw_sys::general::IBSHIFT;
use linux_raw_sys::ioctl::{
- TCFLSH, TCSBRK, TCXONC, TIOCEXCL, TIOCGPGRP, TIOCGSID, TIOCGWINSZ, TIOCNXCL, TIOCSPGRP,
- TIOCSWINSZ,
+ TCFLSH, TCSBRK, TCXONC, TIOCGPGRP, TIOCGSID, TIOCGWINSZ, TIOCSPGRP, TIOCSWINSZ,
};
#[inline]
@@ -56,7 +54,7 @@ pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
#[inline]
pub(crate) fn tcsetattr(
- fd: BorrowedFd,
+ fd: BorrowedFd<'_>,
optional_actions: OptionalActions,
termios: &Termios,
) -> io::Result<()> {
@@ -84,17 +82,17 @@ pub(crate) fn tcsetattr(
}
#[inline]
-pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn tcsendbreak(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TCSBRK), c_uint(0))) }
}
#[inline]
-pub(crate) fn tcdrain(fd: BorrowedFd) -> io::Result<()> {
+pub(crate) fn tcdrain(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TCSBRK), c_uint(1))) }
}
#[inline]
-pub(crate) fn tcflush(fd: BorrowedFd, queue_selector: QueueSelector) -> io::Result<()> {
+pub(crate) fn tcflush(fd: BorrowedFd<'_>, queue_selector: QueueSelector) -> io::Result<()> {
unsafe {
ret(syscall_readonly!(
__NR_ioctl,
@@ -106,7 +104,7 @@ pub(crate) fn tcflush(fd: BorrowedFd, queue_selector: QueueSelector) -> io::Resu
}
#[inline]
-pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
+pub(crate) fn tcflow(fd: BorrowedFd<'_>, action: Action) -> io::Result<()> {
unsafe {
ret(syscall_readonly!(
__NR_ioctl,
@@ -118,7 +116,7 @@ pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> {
}
#[inline]
-pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
+pub(crate) fn tcgetsid(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
let mut result = MaybeUninit::<c::pid_t>::uninit();
ret(syscall!(__NR_ioctl, fd, c_uint(TIOCGSID), &mut result))?;
@@ -128,7 +126,7 @@ pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result<Pid> {
}
#[inline]
-pub(crate) fn tcsetwinsize(fd: BorrowedFd, winsize: Winsize) -> io::Result<()> {
+pub(crate) fn tcsetwinsize(fd: BorrowedFd<'_>, winsize: Winsize) -> io::Result<()> {
unsafe {
ret(syscall!(
__NR_ioctl,
@@ -144,16 +142,6 @@ pub(crate) fn tcsetpgrp(fd: BorrowedFd<'_>, pid: Pid) -> io::Result<()> {
unsafe { ret(syscall!(__NR_ioctl, fd, c_uint(TIOCSPGRP), pid)) }
}
-#[inline]
-pub(crate) fn ioctl_tiocexcl(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TIOCEXCL))) }
-}
-
-#[inline]
-pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd<'_>) -> io::Result<()> {
- unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TIOCNXCL))) }
-}
-
/// A wrapper around a conceptual `cfsetspeed` which handles an arbitrary
/// integer speed value.
#[inline]
@@ -240,8 +228,7 @@ pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool {
tcgetwinsize(fd).is_ok()
}
-#[cfg(feature = "procfs")]
-#[allow(unsafe_code)]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [MaybeUninit<u8>]) -> io::Result<usize> {
let fd_stat = crate::backend::fs::syscalls::fstat(fd)?;
@@ -256,7 +243,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [MaybeUninit<u8>]) -> io::Re
// Get a fd to '/proc/self/fd'.
let proc_self_fd = procfs::proc_self_fd()?;
- // Gather the ttyname by reading the 'fd' file inside 'proc_self_fd'.
+ // Gather the ttyname by reading the "fd" file inside `proc_self_fd`.
let r = crate::backend::fs::syscalls::readlinkat(
proc_self_fd,
DecInt::from_fd(fd).as_c_str(),
diff --git a/vendor/rustix/src/backend/linux_raw/thread/futex.rs b/vendor/rustix/src/backend/linux_raw/thread/futex.rs
index 4cde309a5..263e98070 100644
--- a/vendor/rustix/src/backend/linux_raw/thread/futex.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/futex.rs
@@ -9,6 +9,10 @@ bitflags::bitflags! {
const PRIVATE = linux_raw_sys::general::FUTEX_PRIVATE_FLAG;
/// `FUTEX_CLOCK_REALTIME`
const CLOCK_REALTIME = linux_raw_sys::general::FUTEX_CLOCK_REALTIME;
+
+ // This deliberately lacks a `const _ = !0`, so that users can use
+ // `from_bits_truncate` to extract the `SocketFlags` from a flags
+ // value that also includes a `SocketType`.
}
}
diff --git a/vendor/rustix/src/backend/linux_raw/thread/mod.rs b/vendor/rustix/src/backend/linux_raw/thread/mod.rs
index 8bb80c33a..6a002c632 100644
--- a/vendor/rustix/src/backend/linux_raw/thread/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/mod.rs
@@ -1,4 +1,2 @@
-mod futex;
+pub(crate) mod futex;
pub(crate) mod syscalls;
-
-pub use futex::{FutexFlags, FutexOperation};
diff --git a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
index f23b7c2df..0095eed79 100644
--- a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
use crate::backend::conv::{
@@ -274,7 +273,7 @@ unsafe fn futex_old(
}
#[inline]
-pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
+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/backend/linux_raw/time/syscalls.rs b/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
index 634ce2674..27c3652a4 100644
--- a/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::conv::{ret, ret_infallible};
use crate::clockid::ClockId;
diff --git a/vendor/rustix/src/backend/linux_raw/time/types.rs b/vendor/rustix/src/backend/linux_raw/time/types.rs
index 62cb167e6..ab43aed7c 100644
--- a/vendor/rustix/src/backend/linux_raw/time/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/types.rs
@@ -20,6 +20,9 @@ bitflags! {
/// `TFD_CLOEXEC`
const CLOEXEC = linux_raw_sys::general::TFD_CLOEXEC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -35,6 +38,9 @@ bitflags! {
/// `TFD_TIMER_CANCEL_ON_SET`
const CANCEL_ON_SET = linux_raw_sys::general::TFD_TIMER_CANCEL_ON_SET;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -47,10 +53,10 @@ bitflags! {
pub enum TimerfdClockId {
/// `CLOCK_REALTIME`—A clock that tells the “real” time.
///
- /// This is a clock that tells the amount of time elapsed since the
- /// Unix epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so
- /// it is not monotonic. Successive reads may see decreasing times, so it
- /// isn't reliable for measuring durations.
+ /// This is a clock that tells the amount of time elapsed since the Unix
+ /// epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so it is
+ /// not monotonic. Successive reads may see decreasing times, so it isn't
+ /// reliable for measuring durations.
Realtime = linux_raw_sys::general::CLOCK_REALTIME,
/// `CLOCK_MONOTONIC`—A clock that tells an abstract time.
diff --git a/vendor/rustix/src/backend/linux_raw/ugid/syscalls.rs b/vendor/rustix/src/backend/linux_raw/ugid/syscalls.rs
index 12ff6dce1..5f1551e7c 100644
--- a/vendor/rustix/src/backend/linux_raw/ugid/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/ugid/syscalls.rs
@@ -3,8 +3,7 @@
//! # Safety
//!
//! See the `rustix::backend` module documentation for details.
-#![allow(unsafe_code)]
-#![allow(clippy::undocumented_unsafe_blocks)]
+#![allow(unsafe_code, clippy::undocumented_unsafe_blocks)]
use crate::backend::c;
use crate::backend::conv::ret_usize_infallible;
diff --git a/vendor/rustix/src/backend/linux_raw/vdso.rs b/vendor/rustix/src/backend/linux_raw/vdso.rs
index 606aee7d1..1b0ae5375 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso.rs
@@ -13,12 +13,12 @@
#![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};
+use linux_raw_sys::elf::*;
pub(super) struct Vdso {
// Load information
@@ -143,28 +143,31 @@ fn init_from_sysinfo_ehdr() -> Option<Vdso> {
match d.d_tag {
DT_STRTAB => {
vdso.symstrings =
- check_raw_pointer::<u8>(vdso.addr_from_elf(d.d_val)? as *mut _)?.as_ptr();
+ check_raw_pointer::<u8>(vdso.addr_from_elf(d.d_un.d_ptr)? as *mut _)?
+ .as_ptr();
}
DT_SYMTAB => {
vdso.symtab =
- check_raw_pointer::<Elf_Sym>(vdso.addr_from_elf(d.d_val)? as *mut _)?
+ check_raw_pointer::<Elf_Sym>(vdso.addr_from_elf(d.d_un.d_ptr)? as *mut _)?
.as_ptr();
}
DT_HASH => {
- hash =
- check_raw_pointer::<u32>(vdso.addr_from_elf(d.d_val)? as *mut _)?.as_ptr();
+ hash = check_raw_pointer::<u32>(vdso.addr_from_elf(d.d_un.d_ptr)? as *mut _)?
+ .as_ptr();
}
DT_VERSYM => {
vdso.versym =
- check_raw_pointer::<u16>(vdso.addr_from_elf(d.d_val)? as *mut _)?.as_ptr();
+ check_raw_pointer::<u16>(vdso.addr_from_elf(d.d_un.d_ptr)? as *mut _)?
+ .as_ptr();
}
DT_VERDEF => {
- vdso.verdef =
- check_raw_pointer::<Elf_Verdef>(vdso.addr_from_elf(d.d_val)? as *mut _)?
- .as_ptr();
+ vdso.verdef = check_raw_pointer::<Elf_Verdef>(
+ vdso.addr_from_elf(d.d_un.d_ptr)? as *mut _,
+ )?
+ .as_ptr();
}
DT_SYMENT => {
- if d.d_val != size_of::<Elf_Sym>() {
+ if d.d_un.d_ptr != size_of::<Elf_Sym>() {
return None; // Failed
}
}
@@ -194,8 +197,8 @@ fn init_from_sysinfo_ehdr() -> Option<Vdso> {
impl Vdso {
/// Parse the vDSO.
///
- /// Returns `None` if the vDSO can't be located or if it doesn't conform
- /// to our expectations.
+ /// 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()
diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
index 316d26a1c..1ff50415b 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
@@ -287,11 +287,10 @@ unsafe fn _rustix_clock_gettime_via_syscall_old(
clockid: c::c_int,
res: *mut Timespec,
) -> io::Result<()> {
- // Ordinarily `rustix` doesn't like to emulate system calls, but in
- // the case of time APIs, it's specific to Linux, specific to
- // 32-bit architectures *and* specific to old kernel versions, and
- // it's not that hard to fix up here, so that no other code needs
- // to worry about this.
+ // Ordinarily `rustix` doesn't like to emulate system calls, but in the
+ // case of time APIs, it's specific to Linux, specific to 32-bit
+ // architectures *and* specific to old kernel versions, and it's not that
+ // hard to fix up here, so that no other code needs to worry about this.
let mut old_result = MaybeUninit::<__kernel_old_timespec>::uninit();
let r0 = syscall!(__NR_clock_gettime, c_int(clockid), &mut old_result);
match ret(r0) {
diff --git a/vendor/rustix/src/bitcast.rs b/vendor/rustix/src/bitcast.rs
index 3924c29d5..735101766 100644
--- a/vendor/rustix/src/bitcast.rs
+++ b/vendor/rustix/src/bitcast.rs
@@ -1,6 +1,7 @@
+#![allow(unused_macros)]
+
// Ensure that the source and destination types are both primitive integer
// types and the same size, and then bitcast.
-#[allow(unused_macros)]
macro_rules! bitcast {
($x:expr) => {{
if false {
@@ -24,7 +25,6 @@ macro_rules! bitcast {
/// Return a [`bitcast`] of the value of `$x.bits()`, where `$x` is a
/// `bitflags` type.
-#[allow(unused_macros)]
macro_rules! bitflags_bits {
($x:expr) => {{
bitcast!($x.bits())
diff --git a/vendor/rustix/src/check_types.rs b/vendor/rustix/src/check_types.rs
index 861d7d7b5..bea04e0b7 100644
--- a/vendor/rustix/src/check_types.rs
+++ b/vendor/rustix/src/check_types.rs
@@ -1,3 +1,5 @@
+//! Macros for checking that types have the same layout as other types.
+
#![allow(unused_macros)]
/// Check that the size and alignment of a type match the `sys` bindings.
@@ -77,9 +79,9 @@ macro_rules! check_struct {
// Check that we have all the fields.
if false {
+ #[allow(unreachable_code)]
let _test = $name {
- // SAFETY: This code is guarded by `if false`.
- $($field: unsafe { core::mem::zeroed() }),*
+ $($field: panic!()),*
};
}
diff --git a/vendor/rustix/src/event/kqueue.rs b/vendor/rustix/src/event/kqueue.rs
index ff0ffddc0..05ee4d71b 100644
--- a/vendor/rustix/src/event/kqueue.rs
+++ b/vendor/rustix/src/event/kqueue.rs
@@ -99,6 +99,12 @@ impl Event {
self.inner.udata as _
}
+ /// Get the raw data for this event.
+ pub fn data(&self) -> i64 {
+ // On some bsds, data is an isize and not an i64
+ self.inner.data as _
+ }
+
/// Get the filter of this event.
pub fn filter(&self) -> EventFilter {
match self.inner.filter as _ {
@@ -256,6 +262,9 @@ bitflags::bitflags! {
/// TODO
const ERROR = c::EV_ERROR as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -284,6 +293,9 @@ bitflags::bitflags! {
/// The link count of the file has changed.
const LINK = c::NOTE_LINK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -301,11 +313,14 @@ bitflags::bitflags! {
/// The process executed a new process.
const EXEC = c::NOTE_EXEC;
- /// Follow the process through `fork()` calls (write only).
+ /// Follow the process through `fork` calls (write only).
const TRACK = c::NOTE_TRACK;
/// An error has occurred with following the process.
const TRACKERR = c::NOTE_TRACKERR;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -335,6 +350,9 @@ bitflags::bitflags! {
/// Trigger the event.
const TRIGGER = c::NOTE_TRIGGER;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/event/mod.rs b/vendor/rustix/src/event/mod.rs
index 192afdcaa..03abc9f12 100644
--- a/vendor/rustix/src/event/mod.rs
+++ b/vendor/rustix/src/event/mod.rs
@@ -1,15 +1,25 @@
//! Event operations.
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
mod eventfd;
-#[cfg(bsd)]
+#[cfg(all(feature = "alloc", bsd))]
pub mod kqueue;
mod poll;
#[cfg(solarish)]
pub mod port;
-#[cfg(linux_kernel)]
+#[cfg(all(feature = "alloc", linux_kernel))]
pub use crate::backend::event::epoll;
-#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "illumos"))]
+#[cfg(any(
+ linux_kernel,
+ target_os = "freebsd",
+ target_os = "illumos",
+ target_os = "espidf"
+))]
pub use eventfd::{eventfd, EventfdFlags};
pub use poll::{poll, PollFd, PollFlags};
diff --git a/vendor/rustix/src/event/port.rs b/vendor/rustix/src/event/port.rs
index b04f7c496..39fe5ac16 100644
--- a/vendor/rustix/src/event/port.rs
+++ b/vendor/rustix/src/event/port.rs
@@ -72,8 +72,8 @@ pub unsafe fn port_associate_fd(
)
}
-/// `port_dissociate(_, PORT_SOURCE_FD, _)`—Dissociates a file descriptor from
-/// a port.
+/// `port_dissociate(_, PORT_SOURCE_FD, _)`—Dissociates a file descriptor
+/// from a port.
///
/// # Safety
///
@@ -116,6 +116,7 @@ pub fn port_get(port: impl AsFd, timeout: Option<Duration>) -> io::Result<Event>
///
/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_getn/
/// [illumos]: https://illumos.org/man/3C/port_getn
+#[cfg(feature = "alloc")]
pub fn port_getn(
port: impl AsFd,
events: &mut Vec<Event>,
diff --git a/vendor/rustix/src/ffi.rs b/vendor/rustix/src/ffi.rs
index bd04a9cb4..ef9f87d81 100644
--- a/vendor/rustix/src/ffi.rs
+++ b/vendor/rustix/src/ffi.rs
@@ -9,8 +9,7 @@ pub use {
// If we don't have std, we can depend on core and alloc having these features
// in Rust 1.64+.
+#[cfg(all(feature = "alloc", not(feature = "std")))]
+pub use alloc::ffi::{CString, NulError};
#[cfg(not(feature = "std"))]
-pub use {
- alloc::ffi::{CString, NulError},
- core::ffi::{c_char, CStr, FromBytesWithNulError},
-};
+pub use core::ffi::{c_char, CStr, FromBytesWithNulError};
diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs
index 81e991772..f57bd00fe 100644
--- a/vendor/rustix/src/fs/abs.rs
+++ b/vendor/rustix/src/fs/abs.rs
@@ -1,7 +1,6 @@
//! POSIX-style filesystem functions which operate on bare paths.
use crate::fd::OwnedFd;
-use crate::ffi::{CStr, CString};
#[cfg(not(target_os = "espidf"))]
use crate::fs::Access;
#[cfg(not(any(
@@ -17,9 +16,15 @@ use crate::fs::StatFs;
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use crate::fs::StatVfs;
use crate::fs::{Mode, OFlags, Stat};
-use crate::path::SMALL_PATH_BUFFER_SIZE;
+#[cfg(not(target_os = "wasi"))]
+use crate::ugid::{Gid, Uid};
use crate::{backend, io, path};
-use alloc::vec::Vec;
+#[cfg(feature = "alloc")]
+use {
+ crate::ffi::{CStr, CString},
+ crate::path::SMALL_PATH_BUFFER_SIZE,
+ alloc::vec::Vec,
+};
/// `open(path, oflags, mode)`—Opens a file.
///
@@ -101,11 +106,13 @@ pub fn lstat<P: path::Arg>(path: P) -> io::Result<Stat> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html
/// [Linux]: https://man7.org/linux/man-pages/man2/readlink.2.html
+#[cfg(feature = "alloc")]
#[inline]
pub fn readlink<P: path::Arg, B: Into<Vec<u8>>>(path: P, reuse: B) -> io::Result<CString> {
path.into_with_c_str(|path| _readlink(path, reuse.into()))
}
+#[cfg(feature = "alloc")]
fn _readlink(path: &CStr, mut buffer: Vec<u8>) -> io::Result<CString> {
// This code would benefit from having a better way to read into
// uninitialized memory, but that requires `unsafe`.
@@ -170,12 +177,21 @@ pub fn rmdir<P: path::Arg>(path: P) -> io::Result<()> {
/// `link(old_path, new_path)`—Creates a hard link.
///
+/// POSIX leaves it implementation-defined whether `link` follows a symlink in
+/// `old_path`, or creates a new link to the symbolic link itself. On platforms
+/// which have it, [`linkat`] avoids this problem since it has an [`AtFlags`]
+/// paramter and the [`AtFlags::SYMLINK_FOLLOW`] flag determines whether
+/// symlinks should be followed.
+///
/// # References
/// - [POSIX]
/// - [Linux]
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html
/// [Linux]: https://man7.org/linux/man-pages/man2/link.2.html
+/// [`linkat`]: crate::fs::linkat
+/// [`AtFlags`]: crate::fs::AtFlags
+/// [`AtFlags::SYMLINK_FOLLOW`]: crate::fs::AtFlags::SYMLINK_FOLLOW
#[inline]
pub fn link<P: path::Arg, Q: path::Arg>(old_path: P, new_path: Q) -> io::Result<()> {
old_path.into_with_c_str(|old_path| {
@@ -266,3 +282,17 @@ pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> {
pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> {
path.into_with_c_str(backend::fs::syscalls::statvfs)
}
+
+/// `chown(path, owner, group)`—Sets open file or directory ownership.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/chown.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/chown.2.html
+#[cfg(not(target_os = "wasi"))]
+#[inline]
+pub fn chown<P: path::Arg>(path: P, owner: Option<Uid>, group: Option<Gid>) -> io::Result<()> {
+ path.into_with_c_str(|path| backend::fs::syscalls::chown(path, owner, group))
+}
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs
index 5bd90fab5..0434b56ef 100644
--- a/vendor/rustix/src/fs/at.rs
+++ b/vendor/rustix/src/fs/at.rs
@@ -3,26 +3,32 @@
//! The `dirfd` argument to these functions may be a file descriptor for a
//! directory, or the special value [`CWD`].
//!
-//! [`cwd`]: crate::fs::cwd::CWD
+//! [`cwd`]: crate::fs::CWD
use crate::fd::OwnedFd;
-use crate::ffi::{CStr, CString};
#[cfg(apple)]
use crate::fs::CloneFlags;
#[cfg(not(any(apple, target_os = "espidf", target_os = "wasi")))]
use crate::fs::FileType;
#[cfg(linux_kernel)]
use crate::fs::RenameFlags;
+#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
+use crate::fs::Stat;
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
use crate::fs::{Gid, Uid};
use crate::fs::{Mode, OFlags};
-use crate::path::SMALL_PATH_BUFFER_SIZE;
use crate::{backend, io, path};
-use alloc::vec::Vec;
-use backend::fd::{AsFd, BorrowedFd};
+use backend::fd::AsFd;
+#[cfg(feature = "alloc")]
+use {
+ crate::ffi::{CStr, CString},
+ crate::path::SMALL_PATH_BUFFER_SIZE,
+ alloc::vec::Vec,
+ backend::fd::BorrowedFd,
+};
#[cfg(not(target_os = "espidf"))]
use {
- crate::fs::{Access, AtFlags, Stat, Timestamps},
+ crate::fs::{Access, AtFlags, Timestamps},
crate::timespec::Nsecs,
};
@@ -76,6 +82,7 @@ pub fn openat<P: path::Arg, Fd: AsFd>(
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readlinkat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/readlinkat.2.html
+#[cfg(feature = "alloc")]
#[inline]
pub fn readlinkat<P: path::Arg, Fd: AsFd, B: Into<Vec<u8>>>(
dirfd: Fd,
@@ -85,6 +92,7 @@ pub fn readlinkat<P: path::Arg, Fd: AsFd, B: Into<Vec<u8>>>(
path.into_with_c_str(|path| _readlinkat(dirfd.as_fd(), path, reuse.into()))
}
+#[cfg(feature = "alloc")]
#[allow(unsafe_code)]
fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.clear();
@@ -96,8 +104,10 @@ fn _readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, mut buffer: Vec<u8>) -> io::R
debug_assert!(nread <= buffer.capacity());
if nread < buffer.capacity() {
- // SAFETY from the man page:
+ // SAFETY: From the [documentation]:
// "On success, these calls return the number of bytes placed in buf."
+ //
+ // [documentation]: https://man7.org/linux/man-pages/man2/readlinkat.2.html
unsafe {
buffer.set_len(nread);
}
@@ -280,7 +290,8 @@ pub fn symlinkat<P: path::Arg, Q: path::Arg, Fd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatat.2.html
/// [`Mode::from_raw_mode`]: crate::fs::Mode::from_raw_mode
/// [`FileType::from_raw_mode`]: crate::fs::FileType::from_raw_mode
-#[cfg(not(target_os = "espidf"))]
+// TODO: Add `stat64xat` to upstream libc bindings and reenable this for AIX.
+#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
#[inline]
#[doc(alias = "fstatat")]
pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<Stat> {
diff --git a/vendor/rustix/src/fs/fcntl.rs b/vendor/rustix/src/fs/fcntl.rs
index f7f4790cb..facbc9fa3 100644
--- a/vendor/rustix/src/fs/fcntl.rs
+++ b/vendor/rustix/src/fs/fcntl.rs
@@ -15,7 +15,7 @@ use crate::{backend, io};
use backend::fd::AsFd;
use backend::fs::types::OFlags;
-// These `fcntl` functions like in the `io` module because they're not specific
+// These `fcntl` functions live 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(any(target_os = "espidf", target_os = "wasi")))]
diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs
index 43b2e57b1..94de43daa 100644
--- a/vendor/rustix/src/fs/fd.rs
+++ b/vendor/rustix/src/fs/fd.rs
@@ -105,7 +105,7 @@ pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
backend::fs::syscalls::tell(fd.as_fd())
}
-/// `fchmod(fd)`—Sets open file or directory permissions.
+/// `fchmod(fd, mode)`—Sets open file or directory permissions.
///
/// This implementation does not support `O_PATH` file descriptors, even on
/// platforms where the host libc emulates it.
@@ -122,7 +122,7 @@ pub fn fchmod<Fd: AsFd>(fd: Fd, mode: Mode) -> io::Result<()> {
backend::fs::syscalls::fchmod(fd.as_fd(), mode)
}
-/// `fchown(fd)`—Sets open file or directory ownership.
+/// `fchown(fd, owner, group)`—Sets open file or directory ownership.
///
/// # References
/// - [POSIX]
@@ -256,7 +256,7 @@ pub(crate) fn _is_file_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)
let mode = backend::fs::syscalls::fcntl_getfl(fd)?;
// Check for `O_PATH`.
- #[cfg(any(linux_kernel, target_os = "fuchsia", target_os = "emscripten"))]
+ #[cfg(any(linux_kernel, target_os = "emscripten", target_os = "fuchsia"))]
if mode.contains(OFlags::PATH) {
return Ok((false, false));
}
diff --git a/vendor/rustix/src/fs/ioctl.rs b/vendor/rustix/src/fs/ioctl.rs
index 28e0c8588..75222752f 100644
--- a/vendor/rustix/src/fs/ioctl.rs
+++ b/vendor/rustix/src/fs/ioctl.rs
@@ -1,11 +1,17 @@
//! Filesystem-oriented `ioctl` functions.
+#![allow(unsafe_code)]
+
#[cfg(linux_kernel)]
use {
crate::fd::AsFd,
- crate::{backend, io},
+ crate::{backend, io, ioctl},
+ backend::c,
};
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+use crate::fd::{AsRawFd, BorrowedFd};
+
/// `ioctl(fd, BLKSSZGET)`—Returns the logical block size of a block device.
///
/// This is mentioned in the [Linux `openat` manual page].
@@ -15,7 +21,11 @@ use {
#[inline]
#[doc(alias = "BLKSSZGET")]
pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
- backend::fs::syscalls::ioctl_blksszget(fd.as_fd())
+ // SAFETY: BLZSSZGET is a getter opcode that gets a u32.
+ unsafe {
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::BLKSSZGET }>, c::c_uint>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, BLKPBSZGET)`—Returns the physical block size of a block device.
@@ -23,7 +33,11 @@ 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> {
- backend::fs::syscalls::ioctl_blkpbszget(fd.as_fd())
+ // SAFETY: BLKPBSZGET is a getter opcode that gets a u32.
+ unsafe {
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::BLKPBSZGET }>, c::c_uint>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, FICLONE, src_fd)`—Share data between open files.
@@ -38,7 +52,7 @@ pub fn ioctl_blkpbszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
#[inline]
#[doc(alias = "FICLONE")]
pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result<()> {
- backend::fs::syscalls::ioctl_ficlone(fd.as_fd(), src_fd.as_fd())
+ unsafe { ioctl::ioctl(fd, Ficlone(src_fd.as_fd())) }
}
/// `ioctl(fd, EXT4_IOC_RESIZE_FS, blocks)`—Resize ext4 filesystem on fd.
@@ -46,5 +60,33 @@ pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result
#[inline]
#[doc(alias = "EXT4_IOC_RESIZE_FS")]
pub fn ext4_ioc_resize_fs<Fd: AsFd>(fd: Fd, blocks: u64) -> io::Result<()> {
- backend::fs::syscalls::ext4_ioc_resize_fs(fd.as_fd(), blocks)
+ // SAFETY: EXT4_IOC_RESIZE_FS is a pointer setter opcode.
+ unsafe {
+ let ctl = ioctl::Setter::<ioctl::BadOpcode<{ backend::fs::EXT4_IOC_RESIZE_FS }>, u64>::new(
+ blocks,
+ );
+ ioctl::ioctl(fd, ctl)
+ }
+}
+
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+struct Ficlone<'a>(BorrowedFd<'a>);
+
+#[cfg(all(linux_kernel, not(any(target_arch = "sparc", target_arch = "sparc64"))))]
+unsafe impl ioctl::Ioctl for Ficlone<'_> {
+ type Output = ();
+
+ const IS_MUTATING: bool = false;
+ const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::FICLONE as ioctl::RawOpcode);
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ self.0.as_raw_fd() as *mut c::c_void
+ }
+
+ unsafe fn output_from_ptr(
+ _: ioctl::IoctlOutput,
+ _: *mut c::c_void,
+ ) -> io::Result<Self::Output> {
+ Ok(())
+ }
}
diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs
index fbfaa12c9..1ea0d1351 100644
--- a/vendor/rustix/src/fs/mod.rs
+++ b/vendor/rustix/src/fs/mod.rs
@@ -9,7 +9,7 @@ mod copy_file_range;
#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
mod cwd;
-#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
+#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
mod dir;
#[cfg(not(any(
apple,
@@ -71,7 +71,7 @@ pub use copy_file_range::copy_file_range;
#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
pub use cwd::*;
-#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
+#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
pub use dir::{Dir, DirEntry};
#[cfg(not(any(
apple,
diff --git a/vendor/rustix/src/fs/mount.rs b/vendor/rustix/src/fs/mount.rs
index d1e6a8238..0f04b7f69 100644
--- a/vendor/rustix/src/fs/mount.rs
+++ b/vendor/rustix/src/fs/mount.rs
@@ -3,43 +3,53 @@
//! These have been moved to a new `rustix::mount` module.
#[deprecated(note = "rustix::fs::UnmountFlags` moved to `rustix::mount::UnmountFlags`.")]
+#[doc(hidden)]
pub use crate::mount::UnmountFlags;
#[deprecated(note = "rustix::fs::MountFlags` moved to `rustix::mount::MountFlags`.")]
+#[doc(hidden)]
pub use crate::mount::MountFlags;
#[deprecated(
note = "rustix::fs::MountPropagationFlags` moved to `rustix::mount::MountPropagationFlags`."
)]
+#[doc(hidden)]
pub use crate::mount::MountPropagationFlags;
#[deprecated(note = "`rustix::fs::mount` moved to `rustix::mount::mount`.")]
+#[doc(hidden)]
pub use crate::mount::mount;
#[deprecated(note = "`rustix::fs::unmount` moved to `rustix::mount::unmount`.")]
+#[doc(hidden)]
pub use crate::mount::unmount;
#[deprecated(
note = "`rustix::fs::remount` is renamed and moved to `rustix::mount::mount_remount`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_remount as remount;
#[deprecated(
note = "`rustix::fs::bind_mount` is renamed and moved to `rustix::mount::mount_bind`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_bind as bind_mount;
#[deprecated(
note = "`rustix::fs::recursive_bind_mount` is renamed and moved to `rustix::mount::mount_recursive_bind`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_recursive_bind as recursive_bind_mount;
#[deprecated(
note = "`rustix::fs::change_mount` is renamed and moved to `rustix::mount::mount_change`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_change as change_mount;
#[deprecated(
note = "`rustix::fs::move_mount` is renamed and moved to `rustix::mount::mount_move`."
)]
+#[doc(hidden)]
pub use crate::mount::mount_move as move_mount;
diff --git a/vendor/rustix/src/fs/raw_dir.rs b/vendor/rustix/src/fs/raw_dir.rs
index 3131e0649..fd8aefa3a 100644
--- a/vendor/rustix/src/fs/raw_dir.rs
+++ b/vendor/rustix/src/fs/raw_dir.rs
@@ -136,7 +136,7 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
}
}
-/// A raw directory entry, similar to `std::fs::DirEntry`.
+/// A raw directory entry, similar to [`std::fs::DirEntry`].
///
/// Unlike the std version, this may represent the `.` or `..` entries.
pub struct RawDirEntry<'a> {
@@ -193,10 +193,10 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
/// with GAT support once one becomes available.
#[allow(unsafe_code)]
#[allow(clippy::should_implement_trait)]
- pub fn next(&mut self) -> Option<io::Result<RawDirEntry>> {
+ pub fn next(&mut self) -> Option<io::Result<RawDirEntry<'_>>> {
if self.is_buffer_empty() {
match getdents_uninit(self.fd.as_fd(), self.buf) {
- Ok(bytes_read) if bytes_read == 0 => return None,
+ Ok(0) => return None,
Ok(bytes_read) => {
self.initialized = bytes_read;
self.offset = 0;
diff --git a/vendor/rustix/src/fs/seek_from.rs b/vendor/rustix/src/fs/seek_from.rs
index cca23ed62..c08abd2e6 100644
--- a/vendor/rustix/src/fs/seek_from.rs
+++ b/vendor/rustix/src/fs/seek_from.rs
@@ -4,9 +4,12 @@
/// Enumeration of possible methods to seek within an I/O object.
///
-/// It is used by the [`Seek`] trait.
+/// It is used by the [`seek`] function.
///
-/// [`Seek`]: std::io::Seek
+/// This is similar to [`std::io::SeekFrom`], however it adds platform-specific
+/// seek options.
+///
+/// [`seek`]: crate::fs::seek
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub enum SeekFrom {
@@ -30,19 +33,21 @@ pub enum SeekFrom {
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
Current(#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))] i64),
- /// Sets the offset to the current position plus the specified number of bytes,
- /// plus the distance to the next byte which is not in a hole.
+ /// Sets the offset to the current position plus the specified number of
+ /// bytes, plus the distance to the next byte which is not in a hole.
///
- /// If the offset is in a hole at the end of the file, the seek will produce
- /// an `NXIO` error.
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ /// If the offset is in a hole at the end of the file, the seek will fail
+ /// with [`Errno::NXIO`].
+ ///
+ /// [`Errno::NXIO`]: crate::io::Errno::NXIO
+ #[cfg(any(apple, freebsdlike, linux_kernel, solarish))]
Data(i64),
- /// Sets the offset to the current position plus the specified number of bytes,
- /// plus the distance to the next byte which is in a hole.
+ /// Sets the offset to the current position plus the specified number of
+ /// bytes, plus the distance to the next byte which is in a hole.
///
- /// If there is no hole past the offset, it will be set to the end of the file
- /// i.e. there is an implicit hole at the end of any file.
- #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ /// If there is no hole past the offset, it will be set to the end of the
+ /// file i.e. there is an implicit hole at the end of any file.
+ #[cfg(any(apple, freebsdlike, linux_kernel, solarish))]
Hole(i64),
}
diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs
index 32ae84ed3..1791697af 100644
--- a/vendor/rustix/src/fs/statx.rs
+++ b/vendor/rustix/src/fs/statx.rs
@@ -21,6 +21,35 @@ use compat::statx as _statx;
/// # References
/// - [Linux]
///
+/// # Examples
+///
+/// ```
+/// # use std::path::Path;
+/// # use std::io;
+/// # use rustix::fs::{AtFlags, StatxFlags};
+/// # use rustix::fd::BorrowedFd;
+/// /// Try to determine if the provided path is a mount root. Will return `Ok(None)` if
+/// /// the kernel is not new enough to support statx() or [`libc::STATX_ATTR_MOUNT_ROOT`].
+/// fn is_mountpoint(root: BorrowedFd<'_>, path: &Path) -> io::Result<Option<bool>> {
+/// use rustix::fs::{AtFlags, StatxFlags};
+///
+/// let mountroot_flag = libc::STATX_ATTR_MOUNT_ROOT as u64;
+/// match rustix::fs::statx(
+/// root,
+/// path,
+/// AtFlags::NO_AUTOMOUNT | AtFlags::SYMLINK_NOFOLLOW,
+/// StatxFlags::empty(),
+/// ) {
+/// Ok(r) => {
+/// let present = (r.stx_attributes_mask & mountroot_flag) > 0;
+/// Ok(present.then(|| r.stx_attributes & mountroot_flag > 0))
+/// }
+/// Err(e) if e == rustix::io::Errno::NOSYS => Ok(None),
+/// Err(e) => Err(e.into()),
+/// }
+/// }
+/// ```
+///
/// [Linux]: https://man7.org/linux/man-pages/man2/statx.2.html
#[inline]
pub fn statx<P: path::Arg, Fd: AsFd>(
diff --git a/vendor/rustix/src/fs/xattr.rs b/vendor/rustix/src/fs/xattr.rs
index 01fe7d569..53612f71f 100644
--- a/vendor/rustix/src/fs/xattr.rs
+++ b/vendor/rustix/src/fs/xattr.rs
@@ -14,6 +14,9 @@ bitflags! {
/// `XATTR_REPLACE`
const REPLACE = c::XATTR_REPLACE as c::c_uint;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/io/errno.rs b/vendor/rustix/src/io/errno.rs
index 7640d3111..2b72de005 100644
--- a/vendor/rustix/src/io/errno.rs
+++ b/vendor/rustix/src/io/errno.rs
@@ -12,31 +12,6 @@ use std::error;
/// A specialized [`Result`] type for `rustix` APIs.
pub type Result<T> = result::Result<T, Errno>;
-/// `errno`—An error code.
-///
-/// The error type for `rustix` APIs. This is similar to `std::io::Error`, but
-/// only holds an OS error code, and no extra error value.
-///
-/// # References
-/// - [POSIX]
-/// - [Linux]
-/// - [Winsock2]
-/// - [FreeBSD]
-/// - [NetBSD]
-/// - [OpenBSD]
-/// - [DragonFly BSD]
-/// - [illumos]
-/// - [glibc]
-///
-/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html
-/// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html
-/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2
-/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno
-/// [NetBSD]: https://man.netbsd.org/errno.2
-/// [OpenBSD]: https://man.openbsd.org/errno.2
-/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=errno&section=2
-/// [illumos]: https://illumos.org/man/3C/errno
-/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html
pub use backend::io::errno::Errno;
impl Errno {
diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs
index d9bfa1fb3..e85719a4d 100644
--- a/vendor/rustix/src/io/ioctl.rs
+++ b/vendor/rustix/src/io/ioctl.rs
@@ -6,7 +6,10 @@
//! Some ioctls, such as those related to filesystems, terminals, and
//! processes, live in other top-level API modules.
-use crate::{backend, io};
+#![allow(unsafe_code)]
+
+use crate::{backend, io, ioctl};
+use backend::c;
use backend::fd::AsFd;
/// `ioctl(fd, FIOCLEX, NULL)`—Set the close-on-exec flag.
@@ -26,7 +29,11 @@ use backend::fd::AsFd;
#[doc(alias = "FIOCLEX")]
#[doc(alias = "FD_CLOEXEC")]
pub fn ioctl_fioclex<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- backend::io::syscalls::ioctl_fioclex(fd.as_fd())
+ // SAFETY: FIOCLEX is a no-argument setter opcode.
+ unsafe {
+ let ctl = ioctl::NoArg::<ioctl::BadOpcode<{ c::FIOCLEX }>>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, FIONBIO, &value)`—Enables or disables non-blocking mode.
@@ -42,7 +49,11 @@ 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<()> {
- backend::io::syscalls::ioctl_fionbio(fd.as_fd(), value)
+ // SAFETY: FIONBIO is a pointer setter opcode.
+ unsafe {
+ let ctl = ioctl::Setter::<ioctl::BadOpcode<{ c::FIONBIO }>, c::c_int>::new(value.into());
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, FIONREAD)`—Returns the number of bytes ready to be read.
@@ -66,5 +77,9 @@ 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> {
- backend::io::syscalls::ioctl_fionread(fd.as_fd())
+ // SAFETY: FIONREAD is a getter opcode that gets a c_int.
+ unsafe {
+ let ctl = ioctl::Getter::<ioctl::BadOpcode<{ c::FIONREAD }>, c::c_int>::new();
+ ioctl::ioctl(fd, ctl).map(|n| n as u64)
+ }
}
diff --git a/vendor/rustix/src/io_uring.rs b/vendor/rustix/src/io_uring.rs
index 93feb2780..09a4d6d62 100644
--- a/vendor/rustix/src/io_uring.rs
+++ b/vendor/rustix/src/io_uring.rs
@@ -27,7 +27,7 @@
use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
use crate::{backend, io};
use core::ffi::c_void;
-use core::mem::{zeroed, MaybeUninit};
+use core::mem::MaybeUninit;
use core::ptr::{null_mut, write_bytes};
use linux_raw_sys::net;
@@ -120,6 +120,12 @@ bitflags::bitflags! {
/// `IORING_ENTER_EXT_ARG`
const EXT_ARG = sys::IORING_ENTER_EXT_ARG;
+
+ /// `IORING_ENTER_REGISTERED_RING`
+ const REGISTERED_RING = sys::IORING_ENTER_REGISTERED_RING;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -455,6 +461,9 @@ bitflags::bitflags! {
/// `IORING_SETUP_DEFER_TASKRUN`
const DEFER_TASKRUN = sys::IORING_SETUP_DEFER_TASKRUN;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -483,6 +492,9 @@ bitflags::bitflags! {
/// `1 << IOSQE_CQE_SKIP_SUCCESS_BIT`
const CQE_SKIP_SUCCESS = 1 << sys::IOSQE_CQE_SKIP_SUCCESS_BIT as u8;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -502,6 +514,9 @@ bitflags::bitflags! {
/// `IORING_CQE_F_NOTIF`
const NOTIF = bitcast!(sys::IORING_CQE_F_NOTIF);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -512,6 +527,9 @@ bitflags::bitflags! {
pub struct IoringFsyncFlags: u32 {
/// `IORING_FSYNC_DATASYNC`
const DATASYNC = sys::IORING_FSYNC_DATASYNC;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -544,6 +562,9 @@ bitflags::bitflags! {
/// `IORING_LINK_TIMEOUT_UPDATE`
const LINK_TIMEOUT_UPDATE = sys::IORING_LINK_TIMEOUT_UPDATE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -554,6 +575,9 @@ bitflags::bitflags! {
pub struct SpliceFlags: u32 {
/// `SPLICE_F_FD_IN_FIXED`
const FD_IN_FIXED = sys::SPLICE_F_FD_IN_FIXED;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -564,6 +588,9 @@ bitflags::bitflags! {
pub struct IoringMsgringFlags: u32 {
/// `IORING_MSG_RING_CQE_SKIP`
const CQE_SKIP = sys::IORING_MSG_RING_CQE_SKIP;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -583,6 +610,9 @@ bitflags::bitflags! {
/// `IORING_ASYNC_CANCEL_FD`
const FD_FIXED = sys::IORING_ASYNC_CANCEL_FD_FIXED;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -629,6 +659,9 @@ bitflags::bitflags! {
/// `IORING_FEAT_LINKED_FILE`
const LINKED_FILE = sys::IORING_FEAT_LINKED_FILE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -639,6 +672,9 @@ bitflags::bitflags! {
pub struct IoringOpFlags: u16 {
/// `IO_URING_OP_SUPPORTED`
const SUPPORTED = sys::IO_URING_OP_SUPPORTED as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -649,6 +685,9 @@ bitflags::bitflags! {
pub struct IoringRsrcFlags: u32 {
/// `IORING_RSRC_REGISTER_SPARSE`
const REGISTER_SPARSE = sys::IORING_RSRC_REGISTER_SPARSE as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -665,6 +704,9 @@ bitflags::bitflags! {
/// `IORING_SQ_TASKRUN`
const TASKRUN = sys::IORING_SQ_TASKRUN;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -675,6 +717,9 @@ bitflags::bitflags! {
pub struct IoringCqFlags: u32 {
/// `IORING_CQ_EVENTFD_DISABLED`
const EVENTFD_DISABLED = sys::IORING_CQ_EVENTFD_DISABLED;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -694,6 +739,9 @@ bitflags::bitflags! {
/// `IORING_POLL_ADD_LEVEL`
const ADD_LEVEL = sys::IORING_POLL_ADD_LEVEL;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -714,6 +762,9 @@ bitflags::bitflags! {
/// `IORING_SEND_ZC_REPORT_USAGE` (since Linux 6.2)
const ZC_REPORT_USAGE = sys::IORING_SEND_ZC_REPORT_USAGE as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -734,6 +785,9 @@ bitflags::bitflags! {
///
/// See also [`IoringSendFlags::FIXED_BUF`].
const FIXED_BUF = sys::IORING_RECVSEND_FIXED_BUF as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -744,6 +798,9 @@ bitflags::bitflags! {
pub struct IoringAcceptFlags: u16 {
/// `IORING_ACCEPT_MULTISHOT`
const MULTISHOT = sys::IORING_ACCEPT_MULTISHOT as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -766,6 +823,9 @@ bitflags::bitflags! {
/// `MSG_ERRQUEUE`
const ERRQUEUE = net::MSG_ERRQUEUE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -1245,72 +1305,63 @@ pub struct io_uring_buf {
impl Default for ioprio_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(ioprio_union, ioprio)
}
}
impl Default for len_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(len_union, len)
}
}
impl Default for off_or_addr2_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(off_or_addr2_union, off)
}
}
impl Default for addr_or_splice_off_in_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(addr_or_splice_off_in_union, splice_off_in)
}
}
impl Default for addr3_or_cmd_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(addr3_or_cmd_union, addr3)
}
}
impl Default for op_flags_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(op_flags_union, sync_range_flags)
}
}
impl Default for buf_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(buf_union, buf_index)
}
}
impl Default for splice_fd_in_or_file_index_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(splice_fd_in_or_file_index_union, splice_fd_in)
}
}
impl Default for register_or_sqe_op_or_sqe_flags_union {
#[inline]
fn default() -> Self {
- // SAFETY: All of Linux's io_uring structs may be zero-initialized.
- unsafe { zeroed::<Self>() }
+ default_union!(register_or_sqe_op_or_sqe_flags_union, sqe_flags)
}
}
diff --git a/vendor/rustix/src/ioctl/bsd.rs b/vendor/rustix/src/ioctl/bsd.rs
new file mode 100644
index 000000000..66b75b54b
--- /dev/null
+++ b/vendor/rustix/src/ioctl/bsd.rs
@@ -0,0 +1,24 @@
+//! `ioctl` opcode behavior for Linux platforms.
+
+use super::{Direction, RawOpcode};
+
+pub(super) const fn compose_opcode(
+ dir: Direction,
+ group: RawOpcode,
+ num: RawOpcode,
+ size: RawOpcode,
+) -> RawOpcode {
+ let dir = match dir {
+ Direction::None => NONE,
+ Direction::Read => READ,
+ Direction::Write => WRITE,
+ Direction::ReadWrite => READ | WRITE,
+ };
+
+ dir | num | (group << 8) | ((size & IOCPARAM_MASK) << 16)
+}
+
+pub const NONE: RawOpcode = 0x2000_0000;
+pub const WRITE: RawOpcode = 0x4000_0000;
+pub const READ: RawOpcode = 0x8000_0000;
+pub const IOCPARAM_MASK: RawOpcode = 0x1FFF;
diff --git a/vendor/rustix/src/ioctl/linux.rs b/vendor/rustix/src/ioctl/linux.rs
new file mode 100644
index 000000000..9dc278656
--- /dev/null
+++ b/vendor/rustix/src/ioctl/linux.rs
@@ -0,0 +1,83 @@
+//! `ioctl` opcode behavior for Linux platforms.
+
+use super::{Direction, RawOpcode};
+use consts::*;
+
+/// Compose an opcode from its component parts.
+pub(super) const fn compose_opcode(
+ dir: Direction,
+ group: RawOpcode,
+ num: RawOpcode,
+ size: RawOpcode,
+) -> RawOpcode {
+ macro_rules! shift_and_mask {
+ ($val:expr, $shift:expr, $mask:expr) => {{
+ ($val << $shift) & $mask
+ }};
+ }
+
+ let dir = match dir {
+ Direction::None => NONE,
+ Direction::Read => READ,
+ Direction::Write => WRITE,
+ Direction::ReadWrite => READ | WRITE,
+ };
+
+ shift_and_mask!(group, GROUP_SHIFT, GROUP_MASK)
+ | shift_and_mask!(num, NUM_SHIFT, NUM_MASK)
+ | shift_and_mask!(size, SIZE_SHIFT, SIZE_MASK)
+ | shift_and_mask!(dir, DIR_SHIFT, DIR_MASK)
+}
+
+const NUM_BITS: RawOpcode = 8;
+const GROUP_BITS: RawOpcode = 8;
+
+const NUM_SHIFT: RawOpcode = 0;
+const GROUP_SHIFT: RawOpcode = NUM_SHIFT + NUM_BITS;
+const SIZE_SHIFT: RawOpcode = GROUP_SHIFT + GROUP_BITS;
+const DIR_SHIFT: RawOpcode = SIZE_SHIFT + SIZE_BITS;
+
+const NUM_MASK: RawOpcode = (1 << NUM_BITS) - 1;
+const GROUP_MASK: RawOpcode = (1 << GROUP_BITS) - 1;
+const SIZE_MASK: RawOpcode = (1 << SIZE_BITS) - 1;
+const DIR_MASK: RawOpcode = (1 << DIR_BITS) - 1;
+
+#[cfg(any(
+ target_arch = "x86",
+ target_arch = "arm",
+ target_arch = "s390x",
+ target_arch = "x86_64",
+ target_arch = "aarch64",
+ target_arch = "riscv32",
+ target_arch = "riscv64",
+ target_arch = "loongarch64"
+))]
+mod consts {
+ use super::RawOpcode;
+
+ pub(super) const NONE: RawOpcode = 0;
+ pub(super) const READ: RawOpcode = 2;
+ pub(super) const WRITE: RawOpcode = 1;
+ pub(super) const SIZE_BITS: RawOpcode = 14;
+ pub(super) const DIR_BITS: RawOpcode = 2;
+}
+
+#[cfg(any(
+ target_arch = "mips",
+ target_arch = "mips32r6",
+ target_arch = "mips64",
+ target_arch = "mips64r6",
+ target_arch = "powerpc",
+ target_arch = "powerpc64",
+ target_arch = "sparc",
+ target_arch = "sparc64"
+))]
+mod consts {
+ use super::RawOpcode;
+
+ pub(super) const NONE: RawOpcode = 1;
+ pub(super) const READ: RawOpcode = 2;
+ pub(super) const WRITE: RawOpcode = 4;
+ pub(super) const SIZE_BITS: RawOpcode = 13;
+ pub(super) const DIR_BITS: RawOpcode = 3;
+}
diff --git a/vendor/rustix/src/ioctl/mod.rs b/vendor/rustix/src/ioctl/mod.rs
new file mode 100644
index 000000000..bf2215ab6
--- /dev/null
+++ b/vendor/rustix/src/ioctl/mod.rs
@@ -0,0 +1,338 @@
+//! Unsafe `ioctl` API.
+//!
+//! Unix systems expose a number of `ioctl`'s. `ioctl`s have been adopted as a
+//! general purpose system call for making calls into the kernel. In addition
+//! to the wide variety of system calls that are included by default in the
+//! kernel, many drivers expose their own `ioctl`'s for controlling their
+//! behavior, some of which are proprietary. Therefore it is impossible to make
+//! a safe interface for every `ioctl` call, as they all have wildly varying
+//! semantics.
+//!
+//! This module provides an unsafe interface to write your own `ioctl` API. To
+//! start, create a type that implements [`Ioctl`]. Then, pass it to [`ioctl`]
+//! to make the `ioctl` call.
+
+#![allow(unsafe_code)]
+
+use crate::backend::c;
+use crate::fd::{AsFd, BorrowedFd};
+use crate::io::Result;
+
+#[cfg(any(linux_kernel, bsd))]
+use core::mem;
+
+pub use patterns::*;
+
+mod patterns;
+
+#[cfg(linux_kernel)]
+mod linux;
+
+#[cfg(bsd)]
+mod bsd;
+
+#[cfg(linux_kernel)]
+use linux as platform;
+
+#[cfg(bsd)]
+use bsd as platform;
+
+/// Perform an `ioctl` call.
+///
+/// `ioctl` was originally intended to act as a way of modifying the behavior
+/// of files, but has since been adopted as a general purpose system call for
+/// making calls into the kernel. In addition to the default calls exposed by
+/// generic file descriptors, many drivers expose their own `ioctl` calls for
+/// controlling their behavior, some of which are proprietary.
+///
+/// This crate exposes many other `ioctl` interfaces with safe and idiomatic
+/// wrappers, like [`ioctl_fionbio`](crate::io::ioctl_fionbio) and
+/// [`ioctl_fionread`](crate::io::ioctl_fionread). It is recommended to use
+/// those instead of this function, as they are safer and more idiomatic.
+/// For other cases, implement the [`Ioctl`] API and pass it to this function.
+///
+/// See documentation for [`Ioctl`] for more information.
+///
+/// # Safety
+///
+/// While [`Ioctl`] takes much of the unsafety out of `ioctl` calls, it is
+/// still unsafe to call this code with arbitrary device drivers, as it is up
+/// to the device driver to implement the `ioctl` call correctly. It is on the
+/// onus of the protocol between the user and the driver to ensure that the
+/// `ioctl` call is safe to make.
+///
+/// # References
+///
+/// - [Linux]
+/// - [WinSock2]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [Apple]
+/// - [Solaris]
+/// - [illumos]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl.2.html
+/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-ioctlsocket
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2
+/// [NetBSD]: https://man.netbsd.org/ioctl.2
+/// [OpenBSD]: https://man.openbsd.org/ioctl.2
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/ioctl.2.html
+/// [Solaris]: https://docs.oracle.com/cd/E23824_01/html/821-1463/ioctl-2.html
+/// [illumos]: https://illumos.org/man/2/ioctl
+#[inline]
+pub unsafe fn ioctl<F: AsFd, I: Ioctl>(fd: F, mut ioctl: I) -> Result<I::Output> {
+ let fd = fd.as_fd();
+ let request = I::OPCODE.raw();
+ let arg = ioctl.as_ptr();
+
+ // SAFETY: The variant of `Ioctl` asserts that this is a valid IOCTL call to
+ // make.
+ let output = if I::IS_MUTATING {
+ _ioctl(fd, request, arg)?
+ } else {
+ _ioctl_readonly(fd, request, arg)?
+ };
+
+ // SAFETY: The variant of `Ioctl` asserts that this is a valid pointer to the
+ // output data.
+ I::output_from_ptr(output, arg)
+}
+
+unsafe fn _ioctl(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> Result<IoctlOutput> {
+ crate::backend::io::syscalls::ioctl(fd, request, arg)
+}
+
+unsafe fn _ioctl_readonly(
+ fd: BorrowedFd<'_>,
+ request: RawOpcode,
+ arg: *mut c::c_void,
+) -> Result<IoctlOutput> {
+ crate::backend::io::syscalls::ioctl_readonly(fd, request, arg)
+}
+
+/// A trait defining the properties of an `ioctl` command.
+///
+/// Objects implementing this trait can be passed to [`ioctl`] to make an
+/// `ioctl` call. The contents of the object represent the inputs to the
+/// `ioctl` call. The inputs must be convertible to a pointer through the
+/// `as_ptr` method. In most cases, this involves either casting a number to a
+/// pointer, or creating a pointer to the actual data. The latter case is
+/// necessary for `ioctl` calls that modify userspace data.
+///
+/// # Safety
+///
+/// This trait is unsafe to implement because it is impossible to guarantee
+/// that the `ioctl` call is safe. The `ioctl` call may be proprietary, or it
+/// may be unsafe to call in certain circumstances.
+///
+/// By implementing this trait, you guarantee that:
+///
+/// - The `ioctl` call expects the input provided by `as_ptr` and produces the
+/// output as indicated by `output`.
+/// - That `output_from_ptr` can safely take the pointer from `as_ptr` and cast
+/// it to the correct type, *only* after the `ioctl` call.
+/// - That `OPCODE` uniquely identifies the `ioctl` call.
+/// - That, for whatever platforms you are targeting, the `ioctl` call is safe
+/// to make.
+/// - If `IS_MUTATING` is false, that no userspace data will be modified by the
+/// `ioctl` call.
+pub unsafe trait Ioctl {
+ /// The type of the output data.
+ ///
+ /// Given a pointer, one should be able to construct an instance of this
+ /// type.
+ type Output;
+
+ /// The opcode used by this `ioctl` command.
+ ///
+ /// There are different types of opcode depending on the operation. See
+ /// documentation for the [`Opcode`] struct for more information.
+ const OPCODE: Opcode;
+
+ /// Does the `ioctl` mutate any data in the userspace?
+ ///
+ /// If the `ioctl` call does not mutate any data in the userspace, then
+ /// making this `false` enables optimizations that can make the call
+ /// faster. When in doubt, set this to `true`.
+ ///
+ /// # Safety
+ ///
+ /// This should only be set to `false` if the `ioctl` call does not mutate
+ /// any data in the userspace. Undefined behavior may occur if this is set
+ /// to `false` when it should be `true`.
+ const IS_MUTATING: bool;
+
+ /// Get a pointer to the data to be passed to the `ioctl` command.
+ ///
+ /// See trait-level documentation for more information.
+ fn as_ptr(&mut self) -> *mut c::c_void;
+
+ /// Cast the output data to the correct type.
+ ///
+ /// # Safety
+ ///
+ /// The `extract_output` value must be the resulting value after a
+ /// successful `ioctl` call, and `out` is the direct return value of an
+ /// `ioctl` call that did not fail. In this case `extract_output` is the
+ /// pointer that was passed to the `ioctl` call.
+ unsafe fn output_from_ptr(
+ out: IoctlOutput,
+ extract_output: *mut c::c_void,
+ ) -> Result<Self::Output>;
+}
+
+/// The opcode used by an `Ioctl`.
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub struct Opcode {
+ /// The raw opcode.
+ raw: RawOpcode,
+}
+
+impl Opcode {
+ /// Create a new old `Opcode` from a raw opcode.
+ ///
+ /// Rather than being a composition of several attributes, old opcodes are
+ /// just numbers. In general most drivers follow stricter conventions, but
+ /// older drivers may still use this strategy.
+ #[inline]
+ pub const fn old(raw: RawOpcode) -> Self {
+ Self { raw }
+ }
+
+ /// Create a new opcode from a direction, group, number and size.
+ #[cfg(any(linux_kernel, bsd))]
+ #[inline]
+ pub const fn from_components(
+ direction: Direction,
+ group: u8,
+ number: u8,
+ data_size: usize,
+ ) -> Self {
+ if data_size > RawOpcode::MAX as usize {
+ panic!("data size is too large");
+ }
+
+ Self::old(platform::compose_opcode(
+ direction,
+ group as RawOpcode,
+ number as RawOpcode,
+ data_size as RawOpcode,
+ ))
+ }
+
+ /// Create a new non-mutating opcode from a group, a number and the type of
+ /// data.
+ #[cfg(any(linux_kernel, bsd))]
+ #[inline]
+ pub const fn none<T>(group: u8, number: u8) -> Self {
+ Self::from_components(Direction::None, group, number, mem::size_of::<T>())
+ }
+
+ /// Create a new reading opcode from a group, a number and the type of
+ /// data.
+ #[cfg(any(linux_kernel, bsd))]
+ #[inline]
+ pub const fn read<T>(group: u8, number: u8) -> Self {
+ Self::from_components(Direction::Read, group, number, mem::size_of::<T>())
+ }
+
+ /// Create a new writing opcode from a group, a number and the type of
+ /// data.
+ #[cfg(any(linux_kernel, bsd))]
+ #[inline]
+ pub const fn write<T>(group: u8, number: u8) -> Self {
+ Self::from_components(Direction::Write, group, number, mem::size_of::<T>())
+ }
+
+ /// Create a new reading and writing opcode from a group, a number and the
+ /// type of data.
+ #[cfg(any(linux_kernel, bsd))]
+ #[inline]
+ pub const fn read_write<T>(group: u8, number: u8) -> Self {
+ Self::from_components(Direction::ReadWrite, group, number, mem::size_of::<T>())
+ }
+
+ /// Get the raw opcode.
+ #[inline]
+ pub fn raw(self) -> RawOpcode {
+ self.raw
+ }
+}
+
+/// The direction that an `ioctl` is going.
+///
+/// Note that this is relative to userspace. `Read` means reading data from the
+/// kernel, and write means the kernel writing data to userspace.
+#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+pub enum Direction {
+ /// None of the above.
+ None,
+
+ /// Read data from the kernel.
+ Read,
+
+ /// Write data to the kernel.
+ Write,
+
+ /// Read and write data to the kernel.
+ ReadWrite,
+}
+
+/// The type used by the `ioctl` to signify the output.
+pub type IoctlOutput = c::c_int;
+
+/// The type used by the `ioctl` to signify the command.
+pub type RawOpcode = _RawOpcode;
+
+// Under raw Linux, this is an `unsigned int`.
+#[cfg(linux_raw)]
+type _RawOpcode = c::c_uint;
+
+// On libc Linux with GNU libc or uclibc, this is an `unsigned long`.
+#[cfg(all(
+ not(linux_raw),
+ target_os = "linux",
+ any(target_env = "gnu", target_env = "uclibc")
+))]
+type _RawOpcode = c::c_ulong;
+
+// Musl uses `c_int`.
+#[cfg(all(
+ not(linux_raw),
+ target_os = "linux",
+ not(target_env = "gnu"),
+ not(target_env = "uclibc")
+))]
+type _RawOpcode = c::c_int;
+
+// Android uses `c_int`.
+#[cfg(all(not(linux_raw), target_os = "android"))]
+type _RawOpcode = c::c_int;
+
+// BSD, Haiku, and Redox use `unsigned long`.
+#[cfg(any(bsd, target_os = "redox", target_os = "haiku"))]
+type _RawOpcode = c::c_ulong;
+
+// AIX, Emscripten, Fuchsia, Solaris, and WASI use a `int`.
+#[cfg(any(
+ solarish,
+ target_os = "aix",
+ target_os = "fuchsia",
+ target_os = "emscripten",
+ target_os = "wasi",
+ target_os = "nto"
+))]
+type _RawOpcode = c::c_int;
+
+// ESP-IDF uses a `c_uint`.
+#[cfg(target_os = "espidf")]
+type _RawOpcode = c::c_uint;
+
+// Windows has `ioctlsocket`, which uses `i32`.
+#[cfg(windows)]
+type _RawOpcode = i32;
diff --git a/vendor/rustix/src/ioctl/patterns.rs b/vendor/rustix/src/ioctl/patterns.rs
new file mode 100644
index 000000000..4b33d7d80
--- /dev/null
+++ b/vendor/rustix/src/ioctl/patterns.rs
@@ -0,0 +1,202 @@
+//! Implements typical patterns for `ioctl` usage.
+
+use super::{Ioctl, IoctlOutput, Opcode, RawOpcode};
+
+use crate::backend::c;
+use crate::io::Result;
+
+use core::marker::PhantomData;
+use core::{fmt, mem};
+
+/// Implements an `ioctl` with no real arguments.
+pub struct NoArg<Opcode> {
+ /// The opcode.
+ _opcode: PhantomData<Opcode>,
+}
+
+impl<Opcode: CompileTimeOpcode> fmt::Debug for NoArg<Opcode> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_tuple("NoArg").field(&Opcode::OPCODE).finish()
+ }
+}
+
+impl<Opcode: CompileTimeOpcode> NoArg<Opcode> {
+ /// Create a new no-argument `ioctl` object.
+ ///
+ /// # Safety
+ ///
+ /// - `Opcode` must provide a valid opcode.
+ #[inline]
+ pub unsafe fn new() -> Self {
+ Self {
+ _opcode: PhantomData,
+ }
+ }
+}
+
+unsafe impl<Opcode: CompileTimeOpcode> Ioctl for NoArg<Opcode> {
+ type Output = ();
+
+ const IS_MUTATING: bool = false;
+ const OPCODE: self::Opcode = Opcode::OPCODE;
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ core::ptr::null_mut()
+ }
+
+ unsafe fn output_from_ptr(_: IoctlOutput, _: *mut c::c_void) -> Result<Self::Output> {
+ Ok(())
+ }
+}
+
+/// Implements the traditional "getter" pattern for `ioctl`s.
+///
+/// Some `ioctl`s just read data into the userspace. As this is a popular
+/// pattern this structure implements it.
+pub struct Getter<Opcode, Output> {
+ /// The output data.
+ output: mem::MaybeUninit<Output>,
+
+ /// The opcode.
+ _opcode: PhantomData<Opcode>,
+}
+
+impl<Opcode: CompileTimeOpcode, Output> fmt::Debug for Getter<Opcode, Output> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_tuple("Getter").field(&Opcode::OPCODE).finish()
+ }
+}
+
+impl<Opcode: CompileTimeOpcode, Output> Getter<Opcode, Output> {
+ /// Create a new getter-style `ioctl` object.
+ ///
+ /// # Safety
+ ///
+ /// - `Opcode` must provide a valid opcode.
+ /// - For this opcode, `Output` must be the type that the kernel expects to
+ /// write into.
+ #[inline]
+ pub unsafe fn new() -> Self {
+ Self {
+ output: mem::MaybeUninit::uninit(),
+ _opcode: PhantomData,
+ }
+ }
+}
+
+unsafe impl<Opcode: CompileTimeOpcode, Output> Ioctl for Getter<Opcode, Output> {
+ type Output = Output;
+
+ const IS_MUTATING: bool = true;
+ const OPCODE: self::Opcode = Opcode::OPCODE;
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ self.output.as_mut_ptr().cast()
+ }
+
+ unsafe fn output_from_ptr(_: IoctlOutput, ptr: *mut c::c_void) -> Result<Self::Output> {
+ Ok(ptr.cast::<Output>().read())
+ }
+}
+
+/// Implements the pattern for `ioctl`s where a pointer argument is given to
+/// the `ioctl`.
+///
+/// The opcode must be read-only.
+pub struct Setter<Opcode, Input> {
+ /// The input data.
+ input: Input,
+
+ /// The opcode.
+ _opcode: PhantomData<Opcode>,
+}
+
+impl<Opcode: CompileTimeOpcode, Input: fmt::Debug> fmt::Debug for Setter<Opcode, Input> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ f.debug_tuple("Setter")
+ .field(&Opcode::OPCODE)
+ .field(&self.input)
+ .finish()
+ }
+}
+
+impl<Opcode: CompileTimeOpcode, Input> Setter<Opcode, Input> {
+ /// Create a new pointer setter-style `ioctl` object.
+ ///
+ /// # Safety
+ ///
+ /// - `Opcode` must provide a valid opcode.
+ /// - For this opcode, `Input` must be the type that the kernel expects to
+ /// get.
+ #[inline]
+ pub unsafe fn new(input: Input) -> Self {
+ Self {
+ input,
+ _opcode: PhantomData,
+ }
+ }
+}
+
+unsafe impl<Opcode: CompileTimeOpcode, Input> Ioctl for Setter<Opcode, Input> {
+ type Output = ();
+
+ const IS_MUTATING: bool = false;
+ const OPCODE: self::Opcode = Opcode::OPCODE;
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ &mut self.input as *mut Input as *mut c::c_void
+ }
+
+ unsafe fn output_from_ptr(_: IoctlOutput, _: *mut c::c_void) -> Result<Self::Output> {
+ Ok(())
+ }
+}
+
+/// Trait for something that provides an `ioctl` opcode at compile time.
+pub trait CompileTimeOpcode {
+ /// The opcode.
+ const OPCODE: Opcode;
+}
+
+/// Provides a bad opcode at compile time.
+pub struct BadOpcode<const OPCODE: RawOpcode>;
+
+impl<const OPCODE: RawOpcode> CompileTimeOpcode for BadOpcode<OPCODE> {
+ const OPCODE: Opcode = Opcode::old(OPCODE);
+}
+
+/// Provides a read code at compile time.
+#[cfg(any(linux_kernel, bsd))]
+pub struct ReadOpcode<const GROUP: u8, const NUM: u8, Data>(Data);
+
+#[cfg(any(linux_kernel, bsd))]
+impl<const GROUP: u8, const NUM: u8, Data> CompileTimeOpcode for ReadOpcode<GROUP, NUM, Data> {
+ const OPCODE: Opcode = Opcode::read::<Data>(GROUP, NUM);
+}
+
+/// Provides a write code at compile time.
+#[cfg(any(linux_kernel, bsd))]
+pub struct WriteOpcode<const GROUP: u8, const NUM: u8, Data>(Data);
+
+#[cfg(any(linux_kernel, bsd))]
+impl<const GROUP: u8, const NUM: u8, Data> CompileTimeOpcode for WriteOpcode<GROUP, NUM, Data> {
+ const OPCODE: Opcode = Opcode::write::<Data>(GROUP, NUM);
+}
+
+/// Provides a read/write code at compile time.
+#[cfg(any(linux_kernel, bsd))]
+pub struct ReadWriteOpcode<const GROUP: u8, const NUM: u8, Data>(Data);
+
+#[cfg(any(linux_kernel, bsd))]
+impl<const GROUP: u8, const NUM: u8, Data> CompileTimeOpcode for ReadWriteOpcode<GROUP, NUM, Data> {
+ const OPCODE: Opcode = Opcode::read_write::<Data>(GROUP, NUM);
+}
+
+/// Provides a `None` code at compile time.
+#[cfg(any(linux_kernel, bsd))]
+pub struct NoneOpcode<const GROUP: u8, const NUM: u8, Data>(Data);
+
+#[cfg(any(linux_kernel, bsd))]
+impl<const GROUP: u8, const NUM: u8, Data> CompileTimeOpcode for NoneOpcode<GROUP, NUM, Data> {
+ const OPCODE: Opcode = Opcode::none::<Data>(GROUP, NUM);
+}
diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs
index 988525e5f..a23006f9c 100644
--- a/vendor/rustix/src/lib.rs
+++ b/vendor/rustix/src/lib.rs
@@ -55,7 +55,8 @@
//! - Path arguments use [`Arg`], so they accept any string type.
//! - File descriptors are passed and returned via [`AsFd`] and [`OwnedFd`]
//! instead of bare integers, ensuring I/O safety.
-//! - Constants use `enum`s and [`bitflags`] types.
+//! - Constants use `enum`s and [`bitflags`] types, and enable [support for
+//! externally defined flags].
//! - Multiplexed functions (eg. `fcntl`, `ioctl`, etc.) are de-multiplexed.
//! - Variadic functions (eg. `openat`, etc.) are presented as non-variadic.
//! - Functions that return strings automatically allocate sufficient memory
@@ -93,6 +94,7 @@
//! [I/O-safe]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
//! [`Result`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html
//! [`Arg`]: https://docs.rs/rustix/*/rustix/path/trait.Arg.html
+//! [support for externally defined flags]: https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags
#![deny(missing_docs)]
#![allow(stable_features)]
@@ -102,10 +104,11 @@
#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))]
#![cfg_attr(core_ffi_c, feature(core_ffi_c))]
#![cfg_attr(core_c_str, feature(core_c_str))]
-#![cfg_attr(alloc_c_string, feature(alloc_c_string))]
-#![cfg_attr(alloc_ffi, feature(alloc_ffi))]
+#![cfg_attr(all(feature = "alloc", alloc_c_string), feature(alloc_c_string))]
+#![cfg_attr(all(feature = "alloc", alloc_ffi), feature(alloc_ffi))]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "rustc-dep-of-std", feature(ip))]
+#![cfg_attr(feature = "rustc-dep-of-std", allow(internal_features))]
#![cfg_attr(
any(feature = "rustc-dep-of-std", core_intrinsics),
feature(core_intrinsics)
@@ -120,7 +123,7 @@
// conditionalizing all the `use`s for them.
#![cfg_attr(any(target_os = "redox", target_os = "wasi"), allow(unused_imports))]
-#[cfg(not(feature = "rustc-dep-of-std"))]
+#[cfg(all(feature = "alloc", not(feature = "rustc-dep-of-std")))]
extern crate alloc;
// Use `static_assertions` macros if we have them, or a polyfill otherwise.
@@ -137,6 +140,7 @@ mod static_assertions;
#[cfg(not(windows))]
#[macro_use]
pub(crate) mod cstr;
+#[macro_use]
pub(crate) mod utils;
// Polyfill for `std` in `no_std` builds.
#[cfg_attr(feature = "std", path = "maybe_polyfill/std/mod.rs")]
@@ -189,20 +193,7 @@ pub mod event;
#[cfg(not(windows))]
pub mod ffi;
#[cfg(not(windows))]
-#[cfg(any(
- feature = "fs",
- all(
- linux_raw,
- not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
- any(
- feature = "param",
- feature = "runtime",
- feature = "time",
- target_arch = "x86",
- )
- )
-))]
+#[cfg(feature = "fs")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
pub mod fs;
pub mod io;
@@ -210,6 +201,7 @@ pub mod io;
#[cfg(feature = "io_uring")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))]
pub mod io_uring;
+pub mod ioctl;
#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))]
#[cfg(feature = "mm")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "mm")))]
@@ -227,22 +219,7 @@ pub mod net;
#[cfg_attr(doc_cfg, doc(cfg(feature = "param")))]
pub mod param;
#[cfg(not(windows))]
-#[cfg(any(
- feature = "fs",
- feature = "mount",
- feature = "net",
- all(
- linux_raw,
- not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
- any(
- feature = "param",
- feature = "runtime",
- feature = "time",
- target_arch = "x86",
- )
- )
-))]
+#[cfg(any(feature = "fs", feature = "mount", feature = "net"))]
#[cfg_attr(
doc_cfg,
doc(cfg(any(feature = "fs", feature = "mount", feature = "net")))
@@ -294,7 +271,7 @@ pub mod time;
#[cfg(not(windows))]
#[cfg(feature = "runtime")]
#[cfg(linux_raw)]
-#[doc(hidden)]
+#[cfg_attr(not(document_experimental_runtime_api), doc(hidden))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "runtime")))]
pub mod runtime;
@@ -304,6 +281,40 @@ pub mod runtime;
#[cfg(all(feature = "fs", not(feature = "mount")))]
pub(crate) mod mount;
+// Declare "fs" as a non-public module if "fs" isn't enabled but we need it for
+// reading procfs.
+#[cfg(not(windows))]
+#[cfg(not(feature = "fs"))]
+#[cfg(all(
+ linux_raw,
+ not(feature = "use-libc-auxv"),
+ not(feature = "use-explicitly-provided-auxv"),
+ any(
+ feature = "param",
+ feature = "runtime",
+ feature = "time",
+ target_arch = "x86",
+ )
+))]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
+pub(crate) mod fs;
+
+// Similarly, declare `path` as a non-public module if needed.
+#[cfg(not(windows))]
+#[cfg(not(any(feature = "fs", feature = "mount", feature = "net")))]
+#[cfg(all(
+ linux_raw,
+ not(feature = "use-libc-auxv"),
+ not(feature = "use-explicitly-provided-auxv"),
+ any(
+ feature = "param",
+ feature = "runtime",
+ feature = "time",
+ target_arch = "x86",
+ )
+))]
+pub(crate) mod path;
+
// Private modules used by multiple public modules.
#[cfg(not(any(windows, target_os = "espidf")))]
#[cfg(any(feature = "thread", feature = "time", target_arch = "x86"))]
@@ -333,7 +344,7 @@ mod signal;
all(
linux_raw,
not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
+ not(feature = "use-explicitly-provided-auxv"),
any(
feature = "param",
feature = "runtime",
@@ -351,7 +362,7 @@ mod timespec;
all(
linux_raw,
not(feature = "use-libc-auxv"),
- not(target_vendor = "mustang"),
+ not(feature = "use-explicitly-provided-auxv"),
any(
feature = "param",
feature = "runtime",
diff --git a/vendor/rustix/src/maybe_polyfill/no_std/mod.rs b/vendor/rustix/src/maybe_polyfill/no_std/mod.rs
index ab088d862..84bf5b764 100644
--- a/vendor/rustix/src/maybe_polyfill/no_std/mod.rs
+++ b/vendor/rustix/src/maybe_polyfill/no_std/mod.rs
@@ -1,11 +1,12 @@
//! Polyfill of parts of the standard library for `no_std` builds.
//!
-//! All code in this subtree is derived from the standard library and licensed MIT or Apache 2.0
-//! at your option.
+//! All code in this subtree is derived from the standard library and licensed
+//! MIT or Apache 2.0 at your option.
//!
-//! This implementation is used when `std` is not available and polyfills the necessary items from
-//! `std`. When the `std` feature is specified (so the standard library is available), the file
-//! `src/polyfill/std` is used instead, which just imports the respective items from `std`.
+//! This implementation is used when `std` is not available and polyfills the
+//! necessary items from `std`. When the `std` feature is specified (so the
+//! standard library is available), the file `src/polyfill/std` is used
+//! instead, which just imports the respective items from `std`.
#[cfg(not(windows))]
pub mod io;
diff --git a/vendor/rustix/src/maybe_polyfill/no_std/net/ip_addr.rs b/vendor/rustix/src/maybe_polyfill/no_std/net/ip_addr.rs
index ffa5302e3..81415e960 100644
--- a/vendor/rustix/src/maybe_polyfill/no_std/net/ip_addr.rs
+++ b/vendor/rustix/src/maybe_polyfill/no_std/net/ip_addr.rs
@@ -1653,7 +1653,7 @@ impl Ipv6Addr {
&& !self.is_benchmarking()
}
- /// Returns the address's multicast scope if the address is multicast.
+ /// Returns the address' multicast scope if the address is multicast.
///
/// # Examples
///
diff --git a/vendor/rustix/src/maybe_polyfill/no_std/os/fd/owned.rs b/vendor/rustix/src/maybe_polyfill/no_std/os/fd/owned.rs
index 90b6f4712..fffe34bff 100644
--- a/vendor/rustix/src/maybe_polyfill/no_std/os/fd/owned.rs
+++ b/vendor/rustix/src/maybe_polyfill/no_std/os/fd/owned.rs
@@ -115,6 +115,42 @@ impl OwnedFd {
}
}
+impl BorrowedFd<'_> {
+ /// Creates a new `OwnedFd` instance that shares the same underlying file
+ /// description as the existing `BorrowedFd` instance.
+ #[cfg(not(any(target_arch = "wasm32", target_os = "hermit")))]
+ #[cfg_attr(staged_api, stable(feature = "io_safety", since = "1.63.0"))]
+ pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
+ // Avoid using file descriptors below 3 as they are used for stdio
+
+ // 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::io::fcntl_dupfd_cloexec(self, 3)?;
+
+ // 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::io::fcntl_dupfd(self, 3)?;
+
+ Ok(fd)
+ }
+
+ /// Creates a new `OwnedFd` instance that shares the same underlying file
+ /// description as the existing `BorrowedFd` instance.
+ #[cfg(any(target_arch = "wasm32", target_os = "hermit"))]
+ #[cfg_attr(staged_api, stable(feature = "io_safety", since = "1.63.0"))]
+ pub fn try_clone_to_owned(&self) -> crate::io::Result<OwnedFd> {
+ Err(crate::io::const_io_error!(
+ crate::io::ErrorKind::Unsupported,
+ "operation not supported on WASI yet",
+ ))
+ }
+}
+
#[cfg_attr(staged_api, unstable(feature = "io_safety", issue = "87074"))]
impl AsRawFd for BorrowedFd<'_> {
#[inline]
diff --git a/vendor/rustix/src/maybe_polyfill/std/mod.rs b/vendor/rustix/src/maybe_polyfill/std/mod.rs
index 92b5cab5b..bcaceb9fb 100644
--- a/vendor/rustix/src/maybe_polyfill/std/mod.rs
+++ b/vendor/rustix/src/maybe_polyfill/std/mod.rs
@@ -1,8 +1,10 @@
-//! Imports from `std` that would be polyfilled for `no_std` builds (see `src/polyfill/no_std`).
+//! Imports from `std` that would be polyfilled for `no_std` builds (see
+//! `src/polyfill/no_std`).
//!
-//! This implementation is used when `std` is available and just imports the necessary items from
-//! `std`. For `no_std` builds, the file `src/polyfill/no_std` is used instead, which doesn't
-//! depend on the standard library.
+//! This implementation is used when `std` is available and just imports the
+//! necessary items from `std`. For `no_std` builds, the file
+//! `src/polyfill/no_std` is used instead, which doesn't depend on the standard
+//! library.
#[cfg(not(windows))]
pub mod io {
diff --git a/vendor/rustix/src/net/send_recv/msg.rs b/vendor/rustix/src/net/send_recv/msg.rs
index 5fefb2e24..431aefa03 100644
--- a/vendor/rustix/src/net/send_recv/msg.rs
+++ b/vendor/rustix/src/net/send_recv/msg.rs
@@ -107,8 +107,8 @@ impl<'buf, 'slice, 'fd> SendAncillaryBuffer<'buf, 'slice, 'fd> {
/// Returns a pointer to the message data.
pub(crate) fn as_control_ptr(&mut self) -> *mut u8 {
- // When the length is zero, we may be using a `&[]` address, which
- // may be an invalid but non-null pointer, and on some platforms, that
+ // When the length is zero, we may be using a `&[]` address, which may
+ // be an invalid but non-null pointer, and on some platforms, that
// causes `sendmsg` to fail with `EFAULT` or `EINVAL`
#[cfg(not(linux_kernel))]
if self.length == 0 {
@@ -227,8 +227,8 @@ impl<'buf> RecvAncillaryBuffer<'buf> {
/// Returns a pointer to the message data.
pub(crate) fn as_control_ptr(&mut self) -> *mut u8 {
- // When the length is zero, we may be using a `&[]` address, which
- // may be an invalid but non-null pointer, and on some platforms, that
+ // When the length is zero, we may be using a `&[]` address, which may
+ // be an invalid but non-null pointer, and on some platforms, that
// causes `sendmsg` to fail with `EFAULT` or `EINVAL`
#[cfg(not(linux_kernel))]
if self.buffer.is_empty() {
@@ -686,9 +686,9 @@ impl<T> DoubleEndedIterator for AncillaryIter<'_, T> {
mod messages {
use crate::backend::c;
+ use crate::backend::net::msghdr;
use core::iter::FusedIterator;
use core::marker::PhantomData;
- use core::mem::zeroed;
use core::ptr::NonNull;
/// An iterator over the messages in an ancillary buffer.
@@ -709,7 +709,7 @@ mod messages {
/// Create a new iterator over messages from a byte buffer.
pub(super) fn new(buf: &'buf mut [u8]) -> Self {
let msghdr = {
- let mut h: c::msghdr = unsafe { zeroed() };
+ let mut h = msghdr::zero_msghdr();
h.msg_control = buf.as_mut_ptr().cast();
h.msg_controllen = buf.len().try_into().expect("buffer too large for msghdr");
h
diff --git a/vendor/rustix/src/net/socket.rs b/vendor/rustix/src/net/socket.rs
index 23cc00aed..8727ca53b 100644
--- a/vendor/rustix/src/net/socket.rs
+++ b/vendor/rustix/src/net/socket.rs
@@ -13,7 +13,8 @@ pub use backend::net::addr::SocketAddrUnix;
/// however it is not safe in general to rely on this, as file descriptors may
/// be unexpectedly allocated on other threads or in libraries.
///
-/// To pass extra flags such as [`SocketFlags::CLOEXEC`], use [`socket_with`].
+/// To pass extra flags such as [`SocketFlags::CLOEXEC`] or
+/// [`SocketFlags::NONBLOCK`], use [`socket_with`].
///
/// # References
/// - [Beej's Guide to Network Programming]
@@ -82,6 +83,7 @@ pub fn socket(
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socket&section=2
/// [illumos]: https://illumos.org/man/3SOCKET/socket
/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Socket.html
+#[doc(alias("socket"))]
#[inline]
pub fn socket_with(
domain: AddressFamily,
@@ -271,6 +273,10 @@ pub fn bind_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()>
/// `connect(sockfd, addr)`—Initiates a connection to an IP address.
///
+/// On Windows, a non-blocking socket returns [`Errno::WOULDBLOCK`] if the
+/// connection cannot be completed immediately, rather than
+/// `Errno::INPROGRESS`.
+///
/// # References
/// - [Beej's Guide to Network Programming]
/// - [POSIX]
@@ -295,6 +301,7 @@ pub fn bind_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()>
/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect&section=2
/// [illumos]: https://illumos.org/man/3SOCKET/connect
/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html
+/// [`Errno::WOULDBLOCK`]: io::Errno::WOULDBLOCK
pub fn connect<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> {
_connect(sockfd.as_fd(), addr)
}
diff --git a/vendor/rustix/src/net/sockopt.rs b/vendor/rustix/src/net/sockopt.rs
index b21d4a35c..1939155d9 100644
--- a/vendor/rustix/src/net/sockopt.rs
+++ b/vendor/rustix/src/net/sockopt.rs
@@ -6,6 +6,18 @@
#![doc(alias = "getsockopt")]
#![doc(alias = "setsockopt")]
+#[cfg(not(any(
+ apple,
+ windows,
+ target_os = "aix",
+ target_os = "dragonfly",
+ target_os = "emscripten",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "netbsd",
+ target_os = "nto",
+)))]
+use crate::net::AddressFamily;
use crate::net::{Ipv4Addr, Ipv6Addr, SocketType};
use crate::{backend, io};
use backend::c;
@@ -103,6 +115,44 @@ pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> {
backend::net::syscalls::sockopt::set_socket_reuseaddr(fd.as_fd(), value)
}
+/// `getsockopt(fd, SOL_SOCKET, SO_REUSEADDR)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[inline]
+#[doc(alias = "SO_REUSEADDR")]
+pub fn get_socket_reuseaddr<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
+ backend::net::syscalls::sockopt::get_socket_reuseaddr(fd.as_fd())
+}
+
/// `setsockopt(fd, SOL_SOCKET, SO_BROADCAST, broadcast)`
///
/// # References
@@ -712,6 +762,92 @@ pub fn get_socket_send_buffer_size<Fd: AsFd>(fd: Fd) -> io::Result<usize> {
backend::net::syscalls::sockopt::get_socket_send_buffer_size(fd.as_fd())
}
+/// `getsockopt(fd, SOL_SOCKET, SO_DOMAIN)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [Apple]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[cfg(not(any(
+ apple,
+ windows,
+ target_os = "aix",
+ target_os = "dragonfly",
+ target_os = "emscripten",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "netbsd",
+ target_os = "nto",
+)))]
+#[inline]
+#[doc(alias = "SO_DOMAIN")]
+pub fn get_socket_domain<Fd: AsFd>(fd: Fd) -> io::Result<AddressFamily> {
+ backend::net::syscalls::sockopt::get_socket_domain(fd.as_fd())
+}
+
+/// `getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+/// - [FreeBSD]
+/// - [NetBSD]
+/// - [OpenBSD]
+/// - [DragonFly BSD]
+/// - [illumos]
+/// - [glibc `getsockopt`]
+/// - [glibc `SOL_SOCKET` Options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [NetBSD]: https://man.netbsd.org/getsockopt.2
+/// [OpenBSD]: https://man.openbsd.org/getsockopt.2
+/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt
+/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html
+/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html
+#[cfg(not(apple))] // Apple platforms declare the constant, but do not actually implement it.
+#[inline]
+#[doc(alias = "SO_ACCEPTCONN")]
+pub fn get_socket_acceptconn<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
+ backend::net::syscalls::sockopt::get_socket_acceptconn(fd.as_fd())
+}
+
/// `setsockopt(fd, IPPROTO_IP, IP_TTL, ttl)`
///
/// # References
@@ -1629,6 +1765,268 @@ pub fn get_tcp_nodelay<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
backend::net::syscalls::sockopt::get_tcp_nodelay(fd.as_fd())
}
+/// `setsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT, count)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
+#[inline]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+#[doc(alias = "TCP_KEEPCNT")]
+pub fn set_tcp_keepcnt<Fd: AsFd>(fd: Fd, count: u32) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_tcp_keepcnt(fd.as_fd(), count)
+}
+
+/// `getsockopt(fd, IPPROTO_TCP, TCP_KEEPCNT)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
+#[inline]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+#[doc(alias = "TCP_KEEPCNT")]
+pub fn get_tcp_keepcnt<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
+ backend::net::syscalls::sockopt::get_tcp_keepcnt(fd.as_fd())
+}
+
+/// `setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, duration)`
+///
+/// `TCP_KEEPALIVE` on Apple platforms.
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
+#[inline]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+#[doc(alias = "TCP_KEEPIDLE")]
+pub fn set_tcp_keepidle<Fd: AsFd>(fd: Fd, duration: Duration) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_tcp_keepidle(fd.as_fd(), duration)
+}
+
+/// `getsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE)`
+///
+/// `TCP_KEEPALIVE` on Apple platforms.
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
+#[inline]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+#[doc(alias = "TCP_KEEPIDLE")]
+pub fn get_tcp_keepidle<Fd: AsFd>(fd: Fd) -> io::Result<Duration> {
+ backend::net::syscalls::sockopt::get_tcp_keepidle(fd.as_fd())
+}
+
+/// `setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, duration)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
+#[inline]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+#[doc(alias = "TCP_KEEPINTVL")]
+pub fn set_tcp_keepintvl<Fd: AsFd>(fd: Fd, duration: Duration) -> io::Result<()> {
+ backend::net::syscalls::sockopt::set_tcp_keepintvl(fd.as_fd(), duration)
+}
+
+/// `getsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+/// - [Apple `getsockopt`]
+/// - [Apple `tcp`]
+/// - [FreeBSD `getsockopt`]
+/// - [FreeBSD `tcp`]
+/// - [NetBSD `getsockopt`]
+/// - [NetBSD `tcp`]
+/// - [DragonFly BSD `getsockopt`]
+/// - [DragonFly BSD `tcp`]
+/// - [illumos `getsockopt`]
+/// - [illumos `tcp`]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html
+/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html
+/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2
+/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4
+/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2
+/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4
+/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt&section=2
+/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp&section=4
+/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt
+/// [illumos `tcp`]: https://illumos.org/man/4P/tcp
+#[inline]
+#[cfg(not(any(target_os = "openbsd", target_os = "haiku", target_os = "nto")))]
+#[doc(alias = "TCP_KEEPINTVL")]
+pub fn get_tcp_keepintvl<Fd: AsFd>(fd: Fd) -> io::Result<Duration> {
+ backend::net::syscalls::sockopt::get_tcp_keepintvl(fd.as_fd())
+}
+
#[test]
fn test_sizes() {
use c::c_int;
diff --git a/vendor/rustix/src/net/types.rs b/vendor/rustix/src/net/types.rs
index a2c019b42..53116f9c8 100644
--- a/vendor/rustix/src/net/types.rs
+++ b/vendor/rustix/src/net/types.rs
@@ -1,10 +1,9 @@
-#![allow(unsafe_code)]
+//! Types and constants for `rustix::net`.
use crate::backend::c;
use bitflags::bitflags;
/// A type for holding raw integer socket types.
-#[doc(hidden)]
pub type RawSocketType = u32;
/// `SOCK_*` constants for use with [`socket`].
@@ -48,10 +47,14 @@ impl SocketType {
}
/// A type for holding raw integer address families.
-#[doc(hidden)]
pub type RawAddressFamily = c::sa_family_t;
-/// `AF_*` constants.
+/// `AF_*` constants for use with [`socket`], [`socket_with`], and
+/// [`socketpair`].
+///
+/// [`socket`]: crate::net::socket()
+/// [`socket_with`]: crate::net::socket_with
+/// [`socketpair`]: crate::net::socketpair()
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[repr(transparent)]
pub struct AddressFamily(pub(crate) RawAddressFamily);
@@ -85,6 +88,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -98,13 +102,17 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
)))]
pub const AX25: Self = Self(c::AF_AX25 as _);
/// `AF_IPX`
- #[cfg(not(target_os = "espidf"))]
+ #[cfg(not(any(
+ target_os = "espidf",
+ target_os = "aix",
+ )))]
pub const IPX: Self = Self(c::AF_IPX as _);
/// `AF_APPLETALK`
#[cfg(not(target_os = "espidf"))]
@@ -114,6 +122,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -124,6 +133,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -134,6 +144,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -143,6 +154,7 @@ impl AddressFamily {
#[cfg(not(any(
bsd,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -153,6 +165,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -166,6 +179,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -176,6 +190,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -185,6 +200,7 @@ impl AddressFamily {
#[cfg(not(any(
bsd,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -199,6 +215,7 @@ impl AddressFamily {
#[cfg(not(any(
bsd,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -209,6 +226,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -219,6 +237,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -229,6 +248,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -239,6 +259,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -251,6 +272,7 @@ impl AddressFamily {
#[cfg(not(any(
bsd,
solarish,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -261,6 +283,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -271,6 +294,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -281,6 +305,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -291,6 +316,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -301,19 +327,27 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
)))]
pub const TIPC: Self = Self(c::AF_TIPC as _);
/// `AF_BLUETOOTH`
- #[cfg(not(any(apple, solarish, windows, target_os = "espidf")))]
+ #[cfg(not(any(
+ apple,
+ solarish,
+ windows,
+ target_os = "aix",
+ target_os = "espidf",
+ )))]
pub const BLUETOOTH: Self = Self(c::AF_BLUETOOTH as _);
/// `AF_IUCV`
#[cfg(not(any(
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -324,19 +358,27 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
)))]
pub const RXRPC: Self = Self(c::AF_RXRPC as _);
/// `AF_ISDN`
- #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))]
+ #[cfg(not(any(
+ solarish,
+ windows,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ )))]
pub const ISDN: Self = Self(c::AF_ISDN as _);
/// `AF_PHONET`
#[cfg(not(any(
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -347,6 +389,7 @@ impl AddressFamily {
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
@@ -410,7 +453,7 @@ impl AddressFamily {
#[cfg(any(bsd, solarish, target_os = "aix", target_os = "nto"))]
pub const IMPLINK: Self = Self(c::AF_IMPLINK as _);
/// `AF_IEEE80211`
- #[cfg(any(apple, freebsdlike, linuxlike, target_os = "netbsd"))]
+ #[cfg(any(apple, freebsdlike, target_os = "netbsd"))]
pub const IEEE80211: Self = Self(c::AF_IEEE80211 as _);
/// `AF_INET6_SDP`
#[cfg(target_os = "freebsd")]
@@ -437,7 +480,7 @@ impl AddressFamily {
#[cfg(any(netbsdlike, target_os = "dragonfly", target_os = "emscripten", target_os = "fuchsia"))]
pub const MPLS: Self = Self(c::AF_MPLS as _);
/// `AF_NATM`
- #[cfg(any(bsd, target_os = "aix", target_os = "nto"))]
+ #[cfg(any(bsd, target_os = "nto"))]
pub const NATM: Self = Self(c::AF_NATM as _);
/// `AF_NBS`
#[cfg(solarish)]
@@ -497,7 +540,7 @@ impl AddressFamily {
#[cfg(target_os = "freebsd")]
pub const SCLUSTER: Self = Self(c::AF_SCLUSTER as _);
/// `AF_SIP`
- #[cfg(any(apple, target_os = "freebsd", target_os = "opensbd"))]
+ #[cfg(any(apple, target_os = "freebsd", target_os = "openbsd"))]
pub const SIP: Self = Self(c::AF_SIP as _);
/// `AF_SLOW`
#[cfg(target_os = "freebsd")]
@@ -532,9 +575,15 @@ impl AddressFamily {
}
/// A type for holding raw integer protocols.
-#[doc(hidden)]
pub type RawProtocol = core::num::NonZeroU32;
+const fn new_raw_protocol(u: u32) -> RawProtocol {
+ match RawProtocol::new(u) {
+ Some(p) => p,
+ None => panic!("new_raw_protocol: protocol must be non-zero"),
+ }
+}
+
/// `IPPROTO_*` and other constants for use with [`socket`], [`socket_with`],
/// and [`socketpair`] when a nondefault value is desired. See the [`ipproto`],
/// [`sysproto`], and [`netlink`] modules for possible values.
@@ -555,104 +604,105 @@ pub struct Protocol(pub(crate) RawProtocol);
///
/// For `IPPROTO_IP`, pass `None` as the `protocol` argument.
pub mod ipproto {
- use super::{Protocol, RawProtocol};
+ use super::{new_raw_protocol, Protocol};
use crate::backend::c;
/// `IPPROTO_ICMP`
- pub const ICMP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ICMP as _) });
+ pub const ICMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ICMP as _));
/// `IPPROTO_IGMP`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const IGMP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IGMP as _) });
+ pub const IGMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IGMP as _));
/// `IPPROTO_IPIP`
#[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))]
- pub const IPIP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IPIP as _) });
+ pub const IPIP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IPIP as _));
/// `IPPROTO_TCP`
- pub const TCP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_TCP as _) });
+ pub const TCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_TCP as _));
/// `IPPROTO_EGP`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const EGP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_EGP as _) });
+ pub const EGP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_EGP as _));
/// `IPPROTO_PUP`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const PUP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_PUP as _) });
+ pub const PUP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_PUP as _));
/// `IPPROTO_UDP`
- pub const UDP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_UDP as _) });
+ pub const UDP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_UDP as _));
/// `IPPROTO_IDP`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const IDP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IDP as _) });
+ pub const IDP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IDP as _));
/// `IPPROTO_TP`
#[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))]
- pub const TP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_TP as _) });
+ pub const TP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_TP as _));
/// `IPPROTO_DCCP`
#[cfg(not(any(
apple,
solarish,
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
target_os = "openbsd",
)))]
- pub const DCCP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_DCCP as _) });
+ pub const DCCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_DCCP as _));
/// `IPPROTO_IPV6`
- pub const IPV6: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IPV6 as _) });
+ pub const IPV6: Protocol = Protocol(new_raw_protocol(c::IPPROTO_IPV6 as _));
/// `IPPROTO_RSVP`
#[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))]
- pub const RSVP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_RSVP as _) });
+ pub const RSVP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_RSVP as _));
/// `IPPROTO_GRE`
#[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))]
- pub const GRE: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_GRE as _) });
+ pub const GRE: Protocol = Protocol(new_raw_protocol(c::IPPROTO_GRE as _));
/// `IPPROTO_ESP`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const ESP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ESP as _) });
+ pub const ESP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ESP as _));
/// `IPPROTO_AH`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const AH: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_AH as _) });
+ pub const AH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_AH as _));
/// `IPPROTO_MTP`
#[cfg(not(any(
solarish,
netbsdlike,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
)))]
- pub const MTP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_MTP as _) });
+ pub const MTP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MTP as _));
/// `IPPROTO_BEETPH`
#[cfg(not(any(
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto"
)))]
- pub const BEETPH: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_BEETPH as _) });
+ pub const BEETPH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_BEETPH as _));
/// `IPPROTO_ENCAP`
- #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))]
- pub const ENCAP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ENCAP as _) });
+ #[cfg(not(any(
+ solarish,
+ windows,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ )))]
+ pub const ENCAP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ENCAP as _));
/// `IPPROTO_PIM`
- #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const PIM: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_PIM as _) });
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "espidf", target_os = "haiku")))]
+ pub const PIM: Protocol = Protocol(new_raw_protocol(c::IPPROTO_PIM as _));
/// `IPPROTO_COMP`
#[cfg(not(any(
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "espidf",
target_os = "haiku",
target_os = "nto"
)))]
- pub const COMP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_COMP as _) });
+ pub const COMP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_COMP as _));
/// `IPPROTO_SCTP`
#[cfg(not(any(
solarish,
@@ -661,61 +711,57 @@ pub mod ipproto {
target_os = "haiku",
target_os = "openbsd"
)))]
- pub const SCTP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_SCTP as _) });
+ pub const SCTP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_SCTP as _));
/// `IPPROTO_UDPLITE`
#[cfg(not(any(
apple,
netbsdlike,
solarish,
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "espidf",
target_os = "haiku",
target_os = "nto",
)))]
- pub const UDPLITE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_UDPLITE as _) });
+ pub const UDPLITE: Protocol = Protocol(new_raw_protocol(c::IPPROTO_UDPLITE as _));
/// `IPPROTO_MPLS`
#[cfg(not(any(
apple,
solarish,
windows,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "espidf",
target_os = "haiku",
target_os = "netbsd",
target_os = "nto",
)))]
- pub const MPLS: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_MPLS as _) });
+ pub const MPLS: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MPLS as _));
/// `IPPROTO_ETHERNET`
#[cfg(linux_kernel)]
- pub const ETHERNET: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ETHERNET as _) });
+ pub const ETHERNET: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ETHERNET as _));
/// `IPPROTO_RAW`
#[cfg(not(target_os = "espidf"))]
- pub const RAW: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_RAW as _) });
+ pub const RAW: Protocol = Protocol(new_raw_protocol(c::IPPROTO_RAW as _));
/// `IPPROTO_MPTCP`
#[cfg(not(any(
bsd,
solarish,
windows,
+ target_os = "aix",
target_os = "emscripten",
target_os = "espidf",
target_os = "fuchsia",
target_os = "haiku",
target_os = "nto",
)))]
- pub const MPTCP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_MPTCP as _) });
+ pub const MPTCP: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MPTCP as _));
/// `IPPROTO_FRAGMENT`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const FRAGMENT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_FRAGMENT as _) });
+ pub const FRAGMENT: Protocol = Protocol(new_raw_protocol(c::IPPROTO_FRAGMENT as _));
/// `IPPROTO_ICMPV6`
- pub const ICMPV6: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ICMPV6 as _) });
+ pub const ICMPV6: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ICMPV6 as _));
/// `IPPROTO_MH`
#[cfg(not(any(
apple,
@@ -727,30 +773,27 @@ pub mod ipproto {
target_os = "haiku",
target_os = "nto",
)))]
- pub const MH: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_MH as _) });
+ pub const MH: Protocol = Protocol(new_raw_protocol(c::IPPROTO_MH as _));
/// `IPPROTO_ROUTING`
#[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))]
- pub const ROUTING: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ROUTING as _) });
+ pub const ROUTING: Protocol = Protocol(new_raw_protocol(c::IPPROTO_ROUTING as _));
}
/// `SYSPROTO_*` constants.
pub mod sysproto {
#[cfg(apple)]
use {
- super::{Protocol, RawProtocol},
+ super::{new_raw_protocol, Protocol},
crate::backend::c,
};
/// `SYSPROTO_EVENT`
#[cfg(apple)]
- pub const EVENT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::SYSPROTO_EVENT as _) });
+ pub const EVENT: Protocol = Protocol(new_raw_protocol(c::SYSPROTO_EVENT as _));
/// `SYSPROTO_CONTROL`
#[cfg(apple)]
- pub const CONTROL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::SYSPROTO_CONTROL as _) });
+ pub const CONTROL: Protocol = Protocol(new_raw_protocol(c::SYSPROTO_CONTROL as _));
}
/// `NETLINK_*` constants.
@@ -759,566 +802,478 @@ pub mod sysproto {
pub mod netlink {
#[cfg(linux_kernel)]
use {
- super::{Protocol, RawProtocol},
+ super::{new_raw_protocol, Protocol},
crate::backend::c,
};
/// `NETLINK_UNUSED`
#[cfg(linux_kernel)]
- pub const UNUSED: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_UNUSED as _) });
+ pub const UNUSED: Protocol = Protocol(new_raw_protocol(c::NETLINK_UNUSED as _));
/// `NETLINK_USERSOCK`
#[cfg(linux_kernel)]
- pub const USERSOCK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_USERSOCK as _) });
+ pub const USERSOCK: Protocol = Protocol(new_raw_protocol(c::NETLINK_USERSOCK as _));
/// `NETLINK_FIREWALL`
#[cfg(linux_kernel)]
- pub const FIREWALL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_FIREWALL as _) });
+ pub const FIREWALL: Protocol = Protocol(new_raw_protocol(c::NETLINK_FIREWALL as _));
/// `NETLINK_SOCK_DIAG`
#[cfg(linux_kernel)]
- pub const SOCK_DIAG: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_SOCK_DIAG as _) });
+ pub const SOCK_DIAG: Protocol = Protocol(new_raw_protocol(c::NETLINK_SOCK_DIAG as _));
/// `NETLINK_NFLOG`
#[cfg(linux_kernel)]
- pub const NFLOG: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_NFLOG as _) });
+ pub const NFLOG: Protocol = Protocol(new_raw_protocol(c::NETLINK_NFLOG as _));
/// `NETLINK_XFRM`
#[cfg(linux_kernel)]
- pub const XFRM: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_XFRM as _) });
+ pub const XFRM: Protocol = Protocol(new_raw_protocol(c::NETLINK_XFRM as _));
/// `NETLINK_SELINUX`
#[cfg(linux_kernel)]
- pub const SELINUX: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_SELINUX as _) });
+ pub const SELINUX: Protocol = Protocol(new_raw_protocol(c::NETLINK_SELINUX as _));
/// `NETLINK_ISCSI`
#[cfg(linux_kernel)]
- pub const ISCSI: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_ISCSI as _) });
+ pub const ISCSI: Protocol = Protocol(new_raw_protocol(c::NETLINK_ISCSI as _));
/// `NETLINK_AUDIT`
#[cfg(linux_kernel)]
- pub const AUDIT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_AUDIT as _) });
+ pub const AUDIT: Protocol = Protocol(new_raw_protocol(c::NETLINK_AUDIT as _));
/// `NETLINK_FIB_LOOKUP`
#[cfg(linux_kernel)]
- pub const FIB_LOOKUP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_FIB_LOOKUP as _) });
+ pub const FIB_LOOKUP: Protocol = Protocol(new_raw_protocol(c::NETLINK_FIB_LOOKUP as _));
/// `NETLINK_CONNECTOR`
#[cfg(linux_kernel)]
- pub const CONNECTOR: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_CONNECTOR as _) });
+ pub const CONNECTOR: Protocol = Protocol(new_raw_protocol(c::NETLINK_CONNECTOR as _));
/// `NETLINK_NETFILTER`
#[cfg(linux_kernel)]
- pub const NETFILTER: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_NETFILTER as _) });
+ pub const NETFILTER: Protocol = Protocol(new_raw_protocol(c::NETLINK_NETFILTER as _));
/// `NETLINK_IP6_FW`
#[cfg(linux_kernel)]
- pub const IP6_FW: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_IP6_FW as _) });
+ pub const IP6_FW: Protocol = Protocol(new_raw_protocol(c::NETLINK_IP6_FW as _));
/// `NETLINK_DNRTMSG`
#[cfg(linux_kernel)]
- pub const DNRTMSG: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_DNRTMSG as _) });
+ pub const DNRTMSG: Protocol = Protocol(new_raw_protocol(c::NETLINK_DNRTMSG as _));
/// `NETLINK_KOBJECT_UEVENT`
#[cfg(linux_kernel)]
- pub const KOBJECT_UEVENT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_KOBJECT_UEVENT as _) });
+ pub const KOBJECT_UEVENT: Protocol = Protocol(new_raw_protocol(c::NETLINK_KOBJECT_UEVENT as _));
/// `NETLINK_GENERIC`
// This is defined on FreeBSD too, but it has the value 0, so it doesn't
// fit in or `NonZeroU32`. It's unclear whether FreeBSD intends
// `NETLINK_GENERIC` to be the default when Linux has `NETLINK_ROUTE`
// as the default.
#[cfg(linux_kernel)]
- pub const GENERIC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_GENERIC as _) });
+ pub const GENERIC: Protocol = Protocol(new_raw_protocol(c::NETLINK_GENERIC as _));
/// `NETLINK_SCSITRANSPORT`
#[cfg(linux_kernel)]
- pub const SCSITRANSPORT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_SCSITRANSPORT as _) });
+ pub const SCSITRANSPORT: Protocol = Protocol(new_raw_protocol(c::NETLINK_SCSITRANSPORT as _));
/// `NETLINK_ECRYPTFS`
#[cfg(linux_kernel)]
- pub const ECRYPTFS: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_ECRYPTFS as _) });
+ pub const ECRYPTFS: Protocol = Protocol(new_raw_protocol(c::NETLINK_ECRYPTFS as _));
/// `NETLINK_RDMA`
#[cfg(linux_kernel)]
- pub const RDMA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_RDMA as _) });
+ pub const RDMA: Protocol = Protocol(new_raw_protocol(c::NETLINK_RDMA as _));
/// `NETLINK_CRYPTO`
#[cfg(linux_kernel)]
- pub const CRYPTO: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_CRYPTO as _) });
+ pub const CRYPTO: Protocol = Protocol(new_raw_protocol(c::NETLINK_CRYPTO as _));
/// `NETLINK_INET_DIAG`
#[cfg(linux_kernel)]
- pub const INET_DIAG: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_INET_DIAG as _) });
+ pub const INET_DIAG: Protocol = Protocol(new_raw_protocol(c::NETLINK_INET_DIAG as _));
/// `NETLINK_ADD_MEMBERSHIP`
#[cfg(linux_kernel)]
- pub const ADD_MEMBERSHIP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_ADD_MEMBERSHIP as _) });
+ pub const ADD_MEMBERSHIP: Protocol = Protocol(new_raw_protocol(c::NETLINK_ADD_MEMBERSHIP as _));
/// `NETLINK_DROP_MEMBERSHIP`
#[cfg(linux_kernel)]
pub const DROP_MEMBERSHIP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_DROP_MEMBERSHIP as _) });
+ Protocol(new_raw_protocol(c::NETLINK_DROP_MEMBERSHIP as _));
/// `NETLINK_PKTINFO`
#[cfg(linux_kernel)]
- pub const PKTINFO: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_PKTINFO as _) });
+ pub const PKTINFO: Protocol = Protocol(new_raw_protocol(c::NETLINK_PKTINFO as _));
/// `NETLINK_BROADCAST_ERROR`
#[cfg(linux_kernel)]
pub const BROADCAST_ERROR: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_BROADCAST_ERROR as _) });
+ Protocol(new_raw_protocol(c::NETLINK_BROADCAST_ERROR as _));
/// `NETLINK_NO_ENOBUFS`
#[cfg(linux_kernel)]
- pub const NO_ENOBUFS: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_NO_ENOBUFS as _) });
+ pub const NO_ENOBUFS: Protocol = Protocol(new_raw_protocol(c::NETLINK_NO_ENOBUFS as _));
/// `NETLINK_RX_RING`
#[cfg(linux_kernel)]
- pub const RX_RING: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_RX_RING as _) });
+ pub const RX_RING: Protocol = Protocol(new_raw_protocol(c::NETLINK_RX_RING as _));
/// `NETLINK_TX_RING`
#[cfg(linux_kernel)]
- pub const TX_RING: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_TX_RING as _) });
+ pub const TX_RING: Protocol = Protocol(new_raw_protocol(c::NETLINK_TX_RING as _));
/// `NETLINK_LISTEN_ALL_NSID`
#[cfg(linux_kernel)]
pub const LISTEN_ALL_NSID: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_LISTEN_ALL_NSID as _) });
+ Protocol(new_raw_protocol(c::NETLINK_LISTEN_ALL_NSID as _));
/// `NETLINK_LIST_MEMBERSHIPS`
#[cfg(linux_kernel)]
pub const LIST_MEMBERSHIPS: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_LIST_MEMBERSHIPS as _) });
+ Protocol(new_raw_protocol(c::NETLINK_LIST_MEMBERSHIPS as _));
/// `NETLINK_CAP_ACK`
#[cfg(linux_kernel)]
- pub const CAP_ACK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_CAP_ACK as _) });
+ pub const CAP_ACK: Protocol = Protocol(new_raw_protocol(c::NETLINK_CAP_ACK as _));
/// `NETLINK_EXT_ACK`
#[cfg(linux_kernel)]
- pub const EXT_ACK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_EXT_ACK as _) });
+ pub const EXT_ACK: Protocol = Protocol(new_raw_protocol(c::NETLINK_EXT_ACK as _));
/// `NETLINK_GET_STRICT_CHK`
#[cfg(linux_kernel)]
- pub const GET_STRICT_CHK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked(c::NETLINK_GET_STRICT_CHK as _) });
+ pub const GET_STRICT_CHK: Protocol = Protocol(new_raw_protocol(c::NETLINK_GET_STRICT_CHK as _));
}
/// `ETH_P_*` constants.
-///
// These are translated into 16-bit big-endian form because that's what the
-// `AddressFamily::PACKET` address family [expects].
+// [`AddressFamily::PACKET`] address family [expects].
//
// [expects]: https://man7.org/linux/man-pages/man7/packet.7.html
pub mod eth {
#[cfg(linux_kernel)]
use {
- super::{Protocol, RawProtocol},
+ super::{new_raw_protocol, Protocol},
crate::backend::c,
};
/// `ETH_P_LOOP`
#[cfg(linux_kernel)]
- pub const LOOP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_LOOP as u16).to_be() as u32) });
+ pub const LOOP: Protocol = Protocol(new_raw_protocol((c::ETH_P_LOOP as u16).to_be() as u32));
/// `ETH_P_PUP`
#[cfg(linux_kernel)]
- pub const PUP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PUP as u16).to_be() as u32) });
+ pub const PUP: Protocol = Protocol(new_raw_protocol((c::ETH_P_PUP as u16).to_be() as u32));
/// `ETH_P_PUPAT`
#[cfg(linux_kernel)]
- pub const PUPAT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PUPAT as u16).to_be() as u32) });
+ pub const PUPAT: Protocol = Protocol(new_raw_protocol((c::ETH_P_PUPAT as u16).to_be() as u32));
/// `ETH_P_TSN`
#[cfg(linux_kernel)]
- pub const TSN: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_TSN as u16).to_be() as u32) });
+ pub const TSN: Protocol = Protocol(new_raw_protocol((c::ETH_P_TSN as u16).to_be() as u32));
/// `ETH_P_ERSPAN2`
#[cfg(linux_kernel)]
pub const ERSPAN2: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ERSPAN2 as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ERSPAN2 as u16).to_be() as u32));
/// `ETH_P_IP`
#[cfg(linux_kernel)]
- pub const IP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IP as u16).to_be() as u32) });
+ pub const IP: Protocol = Protocol(new_raw_protocol((c::ETH_P_IP as u16).to_be() as u32));
/// `ETH_P_X25`
#[cfg(linux_kernel)]
- pub const X25: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_X25 as u16).to_be() as u32) });
+ pub const X25: Protocol = Protocol(new_raw_protocol((c::ETH_P_X25 as u16).to_be() as u32));
/// `ETH_P_ARP`
#[cfg(linux_kernel)]
- pub const ARP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ARP as u16).to_be() as u32) });
+ pub const ARP: Protocol = Protocol(new_raw_protocol((c::ETH_P_ARP as u16).to_be() as u32));
/// `ETH_P_BPQ`
#[cfg(linux_kernel)]
- pub const BPQ: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_BPQ as u16).to_be() as u32) });
+ pub const BPQ: Protocol = Protocol(new_raw_protocol((c::ETH_P_BPQ as u16).to_be() as u32));
/// `ETH_P_IEEEPUP`
#[cfg(linux_kernel)]
pub const IEEEPUP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IEEEPUP as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_IEEEPUP as u16).to_be() as u32));
/// `ETH_P_IEEEPUPAT`
#[cfg(linux_kernel)]
pub const IEEEPUPAT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IEEEPUPAT as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_IEEEPUPAT as u16).to_be() as u32));
/// `ETH_P_BATMAN`
#[cfg(linux_kernel)]
pub const BATMAN: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_BATMAN as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_BATMAN as u16).to_be() as u32));
/// `ETH_P_DEC`
#[cfg(linux_kernel)]
- pub const DEC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DEC as u16).to_be() as u32) });
+ pub const DEC: Protocol = Protocol(new_raw_protocol((c::ETH_P_DEC as u16).to_be() as u32));
/// `ETH_P_DNA_DL`
#[cfg(linux_kernel)]
pub const DNA_DL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DNA_DL as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_DNA_DL as u16).to_be() as u32));
/// `ETH_P_DNA_RC`
#[cfg(linux_kernel)]
pub const DNA_RC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DNA_RC as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_DNA_RC as u16).to_be() as u32));
/// `ETH_P_DNA_RT`
#[cfg(linux_kernel)]
pub const DNA_RT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DNA_RT as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_DNA_RT as u16).to_be() as u32));
/// `ETH_P_LAT`
#[cfg(linux_kernel)]
- pub const LAT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_LAT as u16).to_be() as u32) });
+ pub const LAT: Protocol = Protocol(new_raw_protocol((c::ETH_P_LAT as u16).to_be() as u32));
/// `ETH_P_DIAG`
#[cfg(linux_kernel)]
- pub const DIAG: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DIAG as u16).to_be() as u32) });
+ pub const DIAG: Protocol = Protocol(new_raw_protocol((c::ETH_P_DIAG as u16).to_be() as u32));
/// `ETH_P_CUST`
#[cfg(linux_kernel)]
- pub const CUST: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CUST as u16).to_be() as u32) });
+ pub const CUST: Protocol = Protocol(new_raw_protocol((c::ETH_P_CUST as u16).to_be() as u32));
/// `ETH_P_SCA`
#[cfg(linux_kernel)]
- pub const SCA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_SCA as u16).to_be() as u32) });
+ pub const SCA: Protocol = Protocol(new_raw_protocol((c::ETH_P_SCA as u16).to_be() as u32));
/// `ETH_P_TEB`
#[cfg(linux_kernel)]
- pub const TEB: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_TEB as u16).to_be() as u32) });
+ pub const TEB: Protocol = Protocol(new_raw_protocol((c::ETH_P_TEB as u16).to_be() as u32));
/// `ETH_P_RARP`
#[cfg(linux_kernel)]
- pub const RARP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_RARP as u16).to_be() as u32) });
+ pub const RARP: Protocol = Protocol(new_raw_protocol((c::ETH_P_RARP as u16).to_be() as u32));
/// `ETH_P_ATALK`
#[cfg(linux_kernel)]
- pub const ATALK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ATALK as u16).to_be() as u32) });
+ pub const ATALK: Protocol = Protocol(new_raw_protocol((c::ETH_P_ATALK as u16).to_be() as u32));
/// `ETH_P_AARP`
#[cfg(linux_kernel)]
- pub const AARP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_AARP as u16).to_be() as u32) });
+ pub const AARP: Protocol = Protocol(new_raw_protocol((c::ETH_P_AARP as u16).to_be() as u32));
/// `ETH_P_8021Q`
#[cfg(linux_kernel)]
pub const P_8021Q: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_8021Q as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_8021Q as u16).to_be() as u32));
/// `ETH_P_ERSPAN`
#[cfg(linux_kernel)]
pub const ERSPAN: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ERSPAN as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ERSPAN as u16).to_be() as u32));
/// `ETH_P_IPX`
#[cfg(linux_kernel)]
- pub const IPX: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IPX as u16).to_be() as u32) });
+ pub const IPX: Protocol = Protocol(new_raw_protocol((c::ETH_P_IPX as u16).to_be() as u32));
/// `ETH_P_IPV6`
#[cfg(linux_kernel)]
- pub const IPV6: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IPV6 as u16).to_be() as u32) });
+ pub const IPV6: Protocol = Protocol(new_raw_protocol((c::ETH_P_IPV6 as u16).to_be() as u32));
/// `ETH_P_PAUSE`
#[cfg(linux_kernel)]
- pub const PAUSE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PAUSE as u16).to_be() as u32) });
+ pub const PAUSE: Protocol = Protocol(new_raw_protocol((c::ETH_P_PAUSE as u16).to_be() as u32));
/// `ETH_P_SLOW`
#[cfg(linux_kernel)]
- pub const SLOW: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_SLOW as u16).to_be() as u32) });
+ pub const SLOW: Protocol = Protocol(new_raw_protocol((c::ETH_P_SLOW as u16).to_be() as u32));
/// `ETH_P_WCCP`
#[cfg(linux_kernel)]
- pub const WCCP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_WCCP as u16).to_be() as u32) });
+ pub const WCCP: Protocol = Protocol(new_raw_protocol((c::ETH_P_WCCP as u16).to_be() as u32));
/// `ETH_P_MPLS_UC`
#[cfg(linux_kernel)]
pub const MPLS_UC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MPLS_UC as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_MPLS_UC as u16).to_be() as u32));
/// `ETH_P_MPLS_MC`
#[cfg(linux_kernel)]
pub const MPLS_MC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MPLS_MC as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_MPLS_MC as u16).to_be() as u32));
/// `ETH_P_ATMMPOA`
#[cfg(linux_kernel)]
pub const ATMMPOA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ATMMPOA as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ATMMPOA as u16).to_be() as u32));
/// `ETH_P_PPP_DISC`
#[cfg(linux_kernel)]
pub const PPP_DISC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PPP_DISC as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PPP_DISC as u16).to_be() as u32));
/// `ETH_P_PPP_SES`
#[cfg(linux_kernel)]
pub const PPP_SES: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PPP_SES as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PPP_SES as u16).to_be() as u32));
/// `ETH_P_LINK_CTL`
#[cfg(linux_kernel)]
pub const LINK_CTL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_LINK_CTL as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_LINK_CTL as u16).to_be() as u32));
/// `ETH_P_ATMFATE`
#[cfg(linux_kernel)]
pub const ATMFATE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ATMFATE as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ATMFATE as u16).to_be() as u32));
/// `ETH_P_PAE`
#[cfg(linux_kernel)]
- pub const PAE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PAE as u16).to_be() as u32) });
+ pub const PAE: Protocol = Protocol(new_raw_protocol((c::ETH_P_PAE as u16).to_be() as u32));
/// `ETH_P_PROFINET`
#[cfg(linux_kernel)]
pub const PROFINET: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PROFINET as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PROFINET as u16).to_be() as u32));
/// `ETH_P_REALTEK`
#[cfg(linux_kernel)]
pub const REALTEK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_REALTEK as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_REALTEK as u16).to_be() as u32));
/// `ETH_P_AOE`
#[cfg(linux_kernel)]
- pub const AOE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_AOE as u16).to_be() as u32) });
+ pub const AOE: Protocol = Protocol(new_raw_protocol((c::ETH_P_AOE as u16).to_be() as u32));
/// `ETH_P_ETHERCAT`
#[cfg(linux_kernel)]
pub const ETHERCAT: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ETHERCAT as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ETHERCAT as u16).to_be() as u32));
/// `ETH_P_8021AD`
#[cfg(linux_kernel)]
pub const P_8021AD: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_8021AD as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_8021AD as u16).to_be() as u32));
/// `ETH_P_802_EX1`
#[cfg(linux_kernel)]
pub const P_802_EX1: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_802_EX1 as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_802_EX1 as u16).to_be() as u32));
/// `ETH_P_PREAUTH`
#[cfg(linux_kernel)]
pub const PREAUTH: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PREAUTH as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PREAUTH as u16).to_be() as u32));
/// `ETH_P_TIPC`
#[cfg(linux_kernel)]
- pub const TIPC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_TIPC as u16).to_be() as u32) });
+ pub const TIPC: Protocol = Protocol(new_raw_protocol((c::ETH_P_TIPC as u16).to_be() as u32));
/// `ETH_P_LLDP`
#[cfg(linux_kernel)]
- pub const LLDP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_LLDP as u16).to_be() as u32) });
+ pub const LLDP: Protocol = Protocol(new_raw_protocol((c::ETH_P_LLDP as u16).to_be() as u32));
/// `ETH_P_MRP`
#[cfg(linux_kernel)]
- pub const MRP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MRP as u16).to_be() as u32) });
+ pub const MRP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MRP as u16).to_be() as u32));
/// `ETH_P_MACSEC`
#[cfg(linux_kernel)]
pub const MACSEC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MACSEC as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_MACSEC as u16).to_be() as u32));
/// `ETH_P_8021AH`
#[cfg(linux_kernel)]
pub const P_8021AH: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_8021AH as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_8021AH as u16).to_be() as u32));
/// `ETH_P_MVRP`
#[cfg(linux_kernel)]
- pub const MVRP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MVRP as u16).to_be() as u32) });
+ pub const MVRP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MVRP as u16).to_be() as u32));
/// `ETH_P_1588`
#[cfg(linux_kernel)]
- pub const P_1588: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_1588 as u16).to_be() as u32) });
+ pub const P_1588: Protocol = Protocol(new_raw_protocol((c::ETH_P_1588 as u16).to_be() as u32));
/// `ETH_P_NCSI`
#[cfg(linux_kernel)]
- pub const NCSI: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_NCSI as u16).to_be() as u32) });
+ pub const NCSI: Protocol = Protocol(new_raw_protocol((c::ETH_P_NCSI as u16).to_be() as u32));
/// `ETH_P_PRP`
#[cfg(linux_kernel)]
- pub const PRP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PRP as u16).to_be() as u32) });
+ pub const PRP: Protocol = Protocol(new_raw_protocol((c::ETH_P_PRP as u16).to_be() as u32));
/// `ETH_P_CFM`
#[cfg(linux_kernel)]
- pub const CFM: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CFM as u16).to_be() as u32) });
+ pub const CFM: Protocol = Protocol(new_raw_protocol((c::ETH_P_CFM as u16).to_be() as u32));
/// `ETH_P_FCOE`
#[cfg(linux_kernel)]
- pub const FCOE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_FCOE as u16).to_be() as u32) });
+ pub const FCOE: Protocol = Protocol(new_raw_protocol((c::ETH_P_FCOE as u16).to_be() as u32));
/// `ETH_P_IBOE`
#[cfg(linux_kernel)]
- pub const IBOE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IBOE as u16).to_be() as u32) });
+ pub const IBOE: Protocol = Protocol(new_raw_protocol((c::ETH_P_IBOE as u16).to_be() as u32));
/// `ETH_P_TDLS`
#[cfg(linux_kernel)]
- pub const TDLS: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_TDLS as u16).to_be() as u32) });
+ pub const TDLS: Protocol = Protocol(new_raw_protocol((c::ETH_P_TDLS as u16).to_be() as u32));
/// `ETH_P_FIP`
#[cfg(linux_kernel)]
- pub const FIP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_FIP as u16).to_be() as u32) });
+ pub const FIP: Protocol = Protocol(new_raw_protocol((c::ETH_P_FIP as u16).to_be() as u32));
/// `ETH_P_80221`
#[cfg(linux_kernel)]
pub const P_80221: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_80221 as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_80221 as u16).to_be() as u32));
/// `ETH_P_HSR`
#[cfg(linux_kernel)]
- pub const HSR: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_HSR as u16).to_be() as u32) });
+ pub const HSR: Protocol = Protocol(new_raw_protocol((c::ETH_P_HSR as u16).to_be() as u32));
/// `ETH_P_NSH`
#[cfg(linux_kernel)]
- pub const NSH: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_NSH as u16).to_be() as u32) });
+ pub const NSH: Protocol = Protocol(new_raw_protocol((c::ETH_P_NSH as u16).to_be() as u32));
/// `ETH_P_LOOPBACK`
#[cfg(linux_kernel)]
pub const LOOPBACK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_LOOPBACK as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_LOOPBACK as u16).to_be() as u32));
/// `ETH_P_QINQ1`
#[cfg(linux_kernel)]
- pub const QINQ1: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_QINQ1 as u16).to_be() as u32) });
+ pub const QINQ1: Protocol = Protocol(new_raw_protocol((c::ETH_P_QINQ1 as u16).to_be() as u32));
/// `ETH_P_QINQ2`
#[cfg(linux_kernel)]
- pub const QINQ2: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_QINQ2 as u16).to_be() as u32) });
+ pub const QINQ2: Protocol = Protocol(new_raw_protocol((c::ETH_P_QINQ2 as u16).to_be() as u32));
/// `ETH_P_QINQ3`
#[cfg(linux_kernel)]
- pub const QINQ3: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_QINQ3 as u16).to_be() as u32) });
+ pub const QINQ3: Protocol = Protocol(new_raw_protocol((c::ETH_P_QINQ3 as u16).to_be() as u32));
/// `ETH_P_EDSA`
#[cfg(linux_kernel)]
- pub const EDSA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_EDSA as u16).to_be() as u32) });
+ pub const EDSA: Protocol = Protocol(new_raw_protocol((c::ETH_P_EDSA as u16).to_be() as u32));
/// `ETH_P_DSA_8021Q`
#[cfg(linux_kernel)]
pub const DSA_8021Q: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DSA_8021Q as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_DSA_8021Q as u16).to_be() as u32));
/// `ETH_P_DSA_A5PSW`
#[cfg(linux_kernel)]
pub const DSA_A5PSW: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DSA_A5PSW as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_DSA_A5PSW as u16).to_be() as u32));
/// `ETH_P_IFE`
#[cfg(linux_kernel)]
- pub const IFE: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IFE as u16).to_be() as u32) });
+ pub const IFE: Protocol = Protocol(new_raw_protocol((c::ETH_P_IFE as u16).to_be() as u32));
/// `ETH_P_AF_IUCV`
#[cfg(linux_kernel)]
pub const AF_IUCV: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_AF_IUCV as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_AF_IUCV as u16).to_be() as u32));
/// `ETH_P_802_3_MIN`
#[cfg(linux_kernel)]
pub const P_802_3_MIN: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_802_3_MIN as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_802_3_MIN as u16).to_be() as u32));
/// `ETH_P_802_3`
#[cfg(linux_kernel)]
pub const P_802_3: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_802_3 as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_802_3 as u16).to_be() as u32));
/// `ETH_P_AX25`
#[cfg(linux_kernel)]
- pub const AX25: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_AX25 as u16).to_be() as u32) });
+ pub const AX25: Protocol = Protocol(new_raw_protocol((c::ETH_P_AX25 as u16).to_be() as u32));
/// `ETH_P_ALL`
#[cfg(linux_kernel)]
- pub const ALL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ALL as u16).to_be() as u32) });
+ pub const ALL: Protocol = Protocol(new_raw_protocol((c::ETH_P_ALL as u16).to_be() as u32));
/// `ETH_P_802_2`
#[cfg(linux_kernel)]
pub const P_802_2: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_802_2 as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_802_2 as u16).to_be() as u32));
/// `ETH_P_SNAP`
#[cfg(linux_kernel)]
- pub const SNAP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_SNAP as u16).to_be() as u32) });
+ pub const SNAP: Protocol = Protocol(new_raw_protocol((c::ETH_P_SNAP as u16).to_be() as u32));
/// `ETH_P_DDCMP`
#[cfg(linux_kernel)]
- pub const DDCMP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DDCMP as u16).to_be() as u32) });
+ pub const DDCMP: Protocol = Protocol(new_raw_protocol((c::ETH_P_DDCMP as u16).to_be() as u32));
/// `ETH_P_WAN_PPP`
#[cfg(linux_kernel)]
pub const WAN_PPP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_WAN_PPP as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_WAN_PPP as u16).to_be() as u32));
/// `ETH_P_PPP_MP`
#[cfg(linux_kernel)]
pub const PPP_MP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PPP_MP as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PPP_MP as u16).to_be() as u32));
/// `ETH_P_LOCALTALK`
#[cfg(linux_kernel)]
pub const LOCALTALK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_LOCALTALK as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_LOCALTALK as u16).to_be() as u32));
/// `ETH_P_CAN`
#[cfg(linux_kernel)]
- pub const CAN: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CAN as u16).to_be() as u32) });
+ pub const CAN: Protocol = Protocol(new_raw_protocol((c::ETH_P_CAN as u16).to_be() as u32));
/// `ETH_P_CANFD`
#[cfg(linux_kernel)]
- pub const CANFD: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CANFD as u16).to_be() as u32) });
+ pub const CANFD: Protocol = Protocol(new_raw_protocol((c::ETH_P_CANFD as u16).to_be() as u32));
/// `ETH_P_CANXL`
#[cfg(linux_kernel)]
- pub const CANXL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CANXL as u16).to_be() as u32) });
+ pub const CANXL: Protocol = Protocol(new_raw_protocol((c::ETH_P_CANXL as u16).to_be() as u32));
/// `ETH_P_PPPTALK`
#[cfg(linux_kernel)]
pub const PPPTALK: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PPPTALK as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PPPTALK as u16).to_be() as u32));
/// `ETH_P_TR_802_2`
#[cfg(linux_kernel)]
pub const TR_802_2: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_TR_802_2 as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_TR_802_2 as u16).to_be() as u32));
/// `ETH_P_MOBITEX`
#[cfg(linux_kernel)]
pub const MOBITEX: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MOBITEX as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_MOBITEX as u16).to_be() as u32));
/// `ETH_P_CONTROL`
#[cfg(linux_kernel)]
pub const CONTROL: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CONTROL as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_CONTROL as u16).to_be() as u32));
/// `ETH_P_IRDA`
#[cfg(linux_kernel)]
- pub const IRDA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_IRDA as u16).to_be() as u32) });
+ pub const IRDA: Protocol = Protocol(new_raw_protocol((c::ETH_P_IRDA as u16).to_be() as u32));
/// `ETH_P_ECONET`
#[cfg(linux_kernel)]
pub const ECONET: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ECONET as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ECONET as u16).to_be() as u32));
/// `ETH_P_HDLC`
#[cfg(linux_kernel)]
- pub const HDLC: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_HDLC as u16).to_be() as u32) });
+ pub const HDLC: Protocol = Protocol(new_raw_protocol((c::ETH_P_HDLC as u16).to_be() as u32));
/// `ETH_P_ARCNET`
#[cfg(linux_kernel)]
pub const ARCNET: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_ARCNET as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_ARCNET as u16).to_be() as u32));
/// `ETH_P_DSA`
#[cfg(linux_kernel)]
- pub const DSA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_DSA as u16).to_be() as u32) });
+ pub const DSA: Protocol = Protocol(new_raw_protocol((c::ETH_P_DSA as u16).to_be() as u32));
/// `ETH_P_TRAILER`
#[cfg(linux_kernel)]
pub const TRAILER: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_TRAILER as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_TRAILER as u16).to_be() as u32));
/// `ETH_P_PHONET`
#[cfg(linux_kernel)]
pub const PHONET: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_PHONET as u16).to_be() as u32) });
+ Protocol(new_raw_protocol((c::ETH_P_PHONET as u16).to_be() as u32));
/// `ETH_P_IEEE802154`
#[cfg(linux_kernel)]
- pub const IEEE802154: Protocol = Protocol(unsafe {
- RawProtocol::new_unchecked((c::ETH_P_IEEE802154 as u16).to_be() as u32)
- });
+ pub const IEEE802154: Protocol =
+ Protocol(new_raw_protocol((c::ETH_P_IEEE802154 as u16).to_be() as u32));
/// `ETH_P_CAIF`
#[cfg(linux_kernel)]
- pub const CAIF: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_CAIF as u16).to_be() as u32) });
+ pub const CAIF: Protocol = Protocol(new_raw_protocol((c::ETH_P_CAIF as u16).to_be() as u32));
/// `ETH_P_XDSA`
#[cfg(linux_kernel)]
- pub const XDSA: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_XDSA as u16).to_be() as u32) });
+ pub const XDSA: Protocol = Protocol(new_raw_protocol((c::ETH_P_XDSA as u16).to_be() as u32));
/// `ETH_P_MAP`
#[cfg(linux_kernel)]
- pub const MAP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MAP as u16).to_be() as u32) });
+ pub const MAP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MAP as u16).to_be() as u32));
/// `ETH_P_MCTP`
#[cfg(linux_kernel)]
- pub const MCTP: Protocol =
- Protocol(unsafe { RawProtocol::new_unchecked((c::ETH_P_MCTP as u16).to_be() as u32) });
+ pub const MCTP: Protocol = Protocol(new_raw_protocol((c::ETH_P_MCTP as u16).to_be() as u32));
}
#[rustfmt::skip]
@@ -1361,12 +1316,23 @@ bitflags! {
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct SocketFlags: c::c_uint {
/// `SOCK_NONBLOCK`
- #[cfg(not(any(apple, windows, target_os = "espidf", target_os = "haiku", target_os = "nto")))]
+ #[cfg(not(any(
+ apple,
+ windows,
+ target_os = "aix",
+ target_os = "espidf",
+ target_os = "haiku",
+ target_os = "nto",
+ )))]
const NONBLOCK = bitcast!(c::SOCK_NONBLOCK);
/// `SOCK_CLOEXEC`
- #[cfg(not(any(apple, windows, target_os = "haiku")))]
+ #[cfg(not(any(apple, windows, target_os = "aix", target_os = "haiku")))]
const CLOEXEC = bitcast!(c::SOCK_CLOEXEC);
+
+ // This deliberately lacks a `const _ = !0`, so that users can use
+ // `from_bits_truncate` to extract the `SocketFlags` from a flags
+ // value that also includes a `SocketType`.
}
}
@@ -1375,8 +1341,8 @@ fn test_sizes() {
use c::c_int;
use core::mem::transmute;
- // Backend code needs to cast these to `c_int` so make sure that cast
- // isn't lossy.
+ // Backend code needs to cast these to `c_int` so make sure that cast isn't
+ // lossy.
assert_eq_size!(RawProtocol, c_int);
assert_eq_size!(Protocol, c_int);
assert_eq_size!(Option<RawProtocol>, c_int);
@@ -1385,13 +1351,14 @@ fn test_sizes() {
assert_eq_size!(SocketType, c_int);
assert_eq_size!(SocketFlags, c_int);
- // Rustix doesn't depend on `Option<Protocol>` matching the ABI of
- // a raw integer for correctness, but it should work nonetheless.
+ // Rustix doesn't depend on `Option<Protocol>` matching the ABI of a raw
+ // integer for correctness, but it should work nonetheless.
+ #[allow(unsafe_code)]
unsafe {
let t: Option<Protocol> = None;
- assert_eq!(0_u32, transmute(t));
+ assert_eq!(0_u32, transmute::<Option<Protocol>, u32>(t));
let t: Option<Protocol> = Some(Protocol::from_raw(RawProtocol::new(4567).unwrap()));
- assert_eq!(4567_u32, transmute(t));
+ assert_eq!(4567_u32, transmute::<Option<Protocol>, u32>(t));
}
}
diff --git a/vendor/rustix/src/param/init.rs b/vendor/rustix/src/param/init.rs
index d261fabd2..09d7c96bd 100644
--- a/vendor/rustix/src/param/init.rs
+++ b/vendor/rustix/src/param/init.rs
@@ -2,8 +2,8 @@
//!
//! # Safety
//!
-//! On mustang, or on any non-glibc non-musl platform, the `init` function must
-//! be called before any other function in this module. It is unsafe because it
+//! When "use-explicitly-provided-auxv" is enabled, the `init` function must be
+//! called before any other function in this module. It is unsafe because it
//! operates on raw pointers.
#![allow(unsafe_code)]
diff --git a/vendor/rustix/src/param/mod.rs b/vendor/rustix/src/param/mod.rs
index dde09772a..905eae7e3 100644
--- a/vendor/rustix/src/param/mod.rs
+++ b/vendor/rustix/src/param/mod.rs
@@ -6,9 +6,9 @@
//! between different processes on the same system.
mod auxv;
-#[cfg(target_vendor = "mustang")]
+#[cfg(feature = "use-explicitly-provided-auxv")]
mod init;
pub use auxv::*;
-#[cfg(target_vendor = "mustang")]
+#[cfg(feature = "use-explicitly-provided-auxv")]
pub use init::init;
diff --git a/vendor/rustix/src/path/arg.rs b/vendor/rustix/src/path/arg.rs
index 64091611c..3b0ad91ae 100644
--- a/vendor/rustix/src/path/arg.rs
+++ b/vendor/rustix/src/path/arg.rs
@@ -5,16 +5,13 @@
//! to rustix APIs with string arguments, and it allows rustix to implement
//! NUL-termination without the need for copying where possible.
-use crate::ffi::{CStr, CString};
+use crate::ffi::CStr;
use crate::io;
#[cfg(feature = "itoa")]
use crate::path::DecInt;
use crate::path::SMALL_PATH_BUFFER_SIZE;
-use alloc::borrow::Cow;
-#[cfg(feature = "itoa")]
+#[cfg(all(feature = "alloc", feature = "itoa"))]
use alloc::borrow::ToOwned;
-use alloc::string::String;
-use alloc::vec::Vec;
use core::mem::MaybeUninit;
use core::{ptr, slice, str};
#[cfg(feature = "std")]
@@ -29,6 +26,10 @@ use std::os::vxworks::ext::ffi::{OsStrExt, OsStringExt};
use std::os::wasi::ffi::{OsStrExt, OsStringExt};
#[cfg(feature = "std")]
use std::path::{Component, Components, Iter, Path, PathBuf};
+#[cfg(feature = "alloc")]
+use {crate::ffi::CString, alloc::borrow::Cow};
+#[cfg(feature = "alloc")]
+use {alloc::string::String, alloc::vec::Vec};
/// A trait for passing path arguments.
///
@@ -65,15 +66,18 @@ pub trait Arg {
/// Returns a view of this string as a string slice.
fn as_str(&self) -> io::Result<&str>;
- /// Returns a potentially-lossy rendering of this string as a `Cow<'_,
- /// str>`.
+ /// Returns a potentially-lossy rendering of this string as a
+ /// `Cow<'_, str>`.
+ #[cfg(feature = "alloc")]
fn to_string_lossy(&self) -> Cow<'_, str>;
/// Returns a view of this string as a maybe-owned [`CStr`].
+ #[cfg(feature = "alloc")]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>>;
/// Consumes `self` and returns a view of this string as a maybe-owned
/// [`CStr`].
+ #[cfg(feature = "alloc")]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
Self: 'b;
@@ -91,11 +95,13 @@ impl Arg for &str {
Ok(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -103,6 +109,7 @@ impl Arg for &str {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -123,17 +130,20 @@ impl Arg for &str {
}
}
+#[cfg(feature = "alloc")]
impl Arg for &String {
#[inline]
fn as_str(&self) -> io::Result<&str> {
Ok(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -141,6 +151,7 @@ impl Arg for &String {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -159,17 +170,20 @@ impl Arg for &String {
}
}
+#[cfg(feature = "alloc")]
impl Arg for String {
#[inline]
fn as_str(&self) -> io::Result<&str> {
Ok(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -177,6 +191,7 @@ impl Arg for String {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -204,11 +219,13 @@ impl Arg for &OsStr {
self.to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
OsStr::to_string_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -216,6 +233,7 @@ impl Arg for &OsStr {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -243,11 +261,13 @@ impl Arg for &OsString {
OsString::as_os_str(self).to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_os_str().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -256,6 +276,7 @@ impl Arg for &OsString {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -281,11 +302,13 @@ impl Arg for OsString {
self.as_os_str().to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_os_str().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -293,6 +316,7 @@ impl Arg for OsString {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -320,11 +344,13 @@ impl Arg for &Path {
self.as_os_str().to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
Path::to_string_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -332,6 +358,7 @@ impl Arg for &Path {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -362,11 +389,13 @@ impl Arg for &PathBuf {
.ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_path().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -375,6 +404,7 @@ impl Arg for &PathBuf {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -400,11 +430,13 @@ impl Arg for PathBuf {
self.as_os_str().to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_os_str().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -412,6 +444,7 @@ impl Arg for PathBuf {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -441,16 +474,19 @@ impl Arg for &CStr {
self.to_str().map_err(|_utf8_err| io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
CStr::to_string_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Borrowed(self))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -469,22 +505,26 @@ impl Arg for &CStr {
}
}
+#[cfg(feature = "alloc")]
impl Arg for &CString {
#[inline]
fn as_str(&self) -> io::Result<&str> {
unimplemented!()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
unimplemented!()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Borrowed(self))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -503,22 +543,26 @@ impl Arg for &CString {
}
}
+#[cfg(feature = "alloc")]
impl Arg for CString {
#[inline]
fn as_str(&self) -> io::Result<&str> {
self.to_str().map_err(|_utf8_err| io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
CStr::to_string_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Borrowed(self))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -537,17 +581,20 @@ impl Arg for CString {
}
}
+#[cfg(feature = "alloc")]
impl<'a> Arg for Cow<'a, str> {
#[inline]
fn as_str(&self) -> io::Result<&str> {
Ok(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
Cow::Borrowed(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -555,6 +602,7 @@ impl<'a> Arg for Cow<'a, str> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -580,17 +628,20 @@ impl<'a> Arg for Cow<'a, str> {
}
#[cfg(feature = "std")]
+#[cfg(feature = "alloc")]
impl<'a> Arg for Cow<'a, OsStr> {
#[inline]
fn as_str(&self) -> io::Result<&str> {
(**self).to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
(**self).to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -598,6 +649,7 @@ impl<'a> Arg for Cow<'a, OsStr> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -622,23 +674,27 @@ impl<'a> Arg for Cow<'a, OsStr> {
}
}
+#[cfg(feature = "alloc")]
impl<'a> Arg for Cow<'a, CStr> {
#[inline]
fn as_str(&self) -> io::Result<&str> {
self.to_str().map_err(|_utf8_err| io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
let borrow: &CStr = core::borrow::Borrow::borrow(self);
borrow.to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Borrowed(self))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -664,11 +720,13 @@ impl<'a> Arg for Component<'a> {
self.as_os_str().to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_os_str().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -676,6 +734,7 @@ impl<'a> Arg for Component<'a> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -703,11 +762,13 @@ impl<'a> Arg for Components<'a> {
self.as_path().to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_path().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -716,6 +777,7 @@ impl<'a> Arg for Components<'a> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -744,11 +806,13 @@ impl<'a> Arg for Iter<'a> {
self.as_path().to_str().ok_or(io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
self.as_path().to_string_lossy()
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -757,6 +821,7 @@ impl<'a> Arg for Iter<'a> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -784,11 +849,13 @@ impl Arg for &[u8] {
str::from_utf8(self).map_err(|_utf8_err| io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
String::from_utf8_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -796,6 +863,7 @@ impl Arg for &[u8] {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -816,17 +884,20 @@ impl Arg for &[u8] {
}
}
+#[cfg(feature = "alloc")]
impl Arg for &Vec<u8> {
#[inline]
fn as_str(&self) -> io::Result<&str> {
str::from_utf8(self).map_err(|_utf8_err| io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
String::from_utf8_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -834,6 +905,7 @@ impl Arg for &Vec<u8> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -854,17 +926,20 @@ impl Arg for &Vec<u8> {
}
}
+#[cfg(feature = "alloc")]
impl Arg for Vec<u8> {
#[inline]
fn as_str(&self) -> io::Result<&str> {
str::from_utf8(self).map_err(|_utf8_err| io::Errno::INVAL)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
String::from_utf8_lossy(self)
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Owned(
@@ -872,6 +947,7 @@ impl Arg for Vec<u8> {
))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -899,16 +975,19 @@ impl Arg for DecInt {
Ok(self.as_str())
}
+ #[cfg(feature = "alloc")]
#[inline]
fn to_string_lossy(&self) -> Cow<'_, str> {
Cow::Borrowed(self.as_str())
}
+ #[cfg(feature = "alloc")]
#[inline]
fn as_cow_c_str(&self) -> io::Result<Cow<'_, CStr>> {
Ok(Cow::Borrowed(self.as_c_str()))
}
+ #[cfg(feature = "alloc")]
#[inline]
fn into_c_str<'b>(self) -> io::Result<Cow<'b, CStr>>
where
@@ -961,19 +1040,58 @@ where
}
// 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.
+ // 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
-/// to `PATH_MAX`, but we let the OS enforce that.
+/// The slow path which handles any length. In theory OS's only support up to
+/// `PATH_MAX`, but we let the OS enforce that.
+#[allow(unsafe_code, clippy::int_plus_one)]
#[cold]
fn with_c_str_slow_path<T, F>(bytes: &[u8], f: F) -> io::Result<T>
where
F: FnOnce(&CStr) -> io::Result<T>,
{
- f(&CString::new(bytes).map_err(|_cstr_err| io::Errno::INVAL)?)
+ #[cfg(feature = "alloc")]
+ {
+ f(&CString::new(bytes).map_err(|_cstr_err| io::Errno::INVAL)?)
+ }
+
+ #[cfg(not(feature = "alloc"))]
+ {
+ #[cfg(libc)]
+ const LARGE_PATH_BUFFER_SIZE: usize = libc::PATH_MAX as usize;
+ #[cfg(linux_raw)]
+ const LARGE_PATH_BUFFER_SIZE: usize = linux_raw_sys::general::PATH_MAX as usize;
+
+ // Taken from
+ // <https://github.com/rust-lang/rust/blob/a00f8ba7fcac1b27341679c51bf5a3271fa82df3/library/std/src/sys/common/small_c_string.rs>
+ let mut buf = MaybeUninit::<[u8; LARGE_PATH_BUFFER_SIZE]>::uninit();
+ let buf_ptr = buf.as_mut_ptr().cast::<u8>();
+
+ // This helps test our safety condition below.
+ if bytes.len() + 1 > LARGE_PATH_BUFFER_SIZE {
+ return Err(io::Errno::NAMETOOLONG);
+ }
+
+ // SAFETY: `bytes.len() < LARGE_PATH_BUFFER_SIZE` which means we have space
+ // for `bytes.len() + 1` u8s:
+ 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),
+ }
+ }
}
diff --git a/vendor/rustix/src/pid.rs b/vendor/rustix/src/pid.rs
index 1b1da6521..3911e4c7a 100644
--- a/vendor/rustix/src/pid.rs
+++ b/vendor/rustix/src/pid.rs
@@ -1,3 +1,5 @@
+//! The `Pid` type.
+
#![allow(unsafe_code)]
use crate::backend::c;
@@ -17,21 +19,21 @@ pub struct Pid(NonZeroI32);
impl Pid {
/// A `Pid` corresponding to the init process (pid 1).
- pub const INIT: Self = Self(
- // SAFETY: One is non-zero.
- unsafe { NonZeroI32::new_unchecked(1) },
- );
+ pub const INIT: Self = Self(match NonZeroI32::new(1) {
+ Some(n) => n,
+ None => panic!("unreachable"),
+ });
/// Converts a `RawPid` into a `Pid`.
///
/// Returns `Some` for strictly positive `RawPid`s. Otherwise, returns
/// `None`.
///
- /// This is always safe because a `Pid` is a number without any guarantees
- /// for the kernel. Non-child `Pid`s are always racy for any syscalls,
- /// but can only cause logic errors. If you want race-free access or
- /// control to non-child processes, please consider other mechanisms
- /// like [pidfd] on Linux.
+ /// This is safe because a `Pid` is a number without any guarantees for the
+ /// kernel. Non-child `Pid`s are always racy for any syscalls, but can only
+ /// cause logic errors. If you want race-free access to or control of
+ /// non-child processes, please consider other mechanisms like [pidfd] on
+ /// Linux.
///
/// [pidfd]: https://man7.org/linux/man-pages/man2/pidfd_open.2.html
#[inline]
diff --git a/vendor/rustix/src/pipe.rs b/vendor/rustix/src/pipe.rs
index 1817401c2..2a45b7a9d 100644
--- a/vendor/rustix/src/pipe.rs
+++ b/vendor/rustix/src/pipe.rs
@@ -106,20 +106,20 @@ pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
backend::pipe::syscalls::pipe_with(flags)
}
-/// `splice(fd_in, off_in, fd_out, off_out, len, flags)`—Transfer data between
-/// a file and a pipe.
+/// `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.
+/// 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.
+/// Passing `None` causes the read/write to start from the file offset, and the
+/// file offset is adjusted appropriately.
///
/// # References
/// - [Linux]
@@ -165,7 +165,7 @@ pub fn splice<FdIn: AsFd, FdOut: AsFd>(
#[inline]
pub unsafe fn vmsplice<PipeFd: AsFd>(
fd: PipeFd,
- bufs: &[IoSliceRaw],
+ bufs: &[IoSliceRaw<'_>],
flags: SpliceFlags,
) -> io::Result<usize> {
backend::pipe::syscalls::vmsplice(fd.as_fd(), bufs, flags)
@@ -192,7 +192,7 @@ pub fn tee<FdIn: AsFd, FdOut: AsFd>(
backend::pipe::syscalls::tee(fd_in.as_fd(), fd_out.as_fd(), len, flags)
}
-/// `ioctl(fd, F_GETPIPE_SZ)`—Return the buffer capacity of a pipe.
+/// `fnctl(fd, F_GETPIPE_SZ)`—Return the buffer capacity of a pipe.
///
/// # References
/// - [Linux]
@@ -204,7 +204,7 @@ pub fn fcntl_getpipe_size<Fd: AsFd>(fd: Fd) -> io::Result<usize> {
backend::pipe::syscalls::fcntl_getpipe_sz(fd.as_fd())
}
-/// `ioctl(fd, F_SETPIPE_SZ)`—Set the buffer capacity of a pipe.
+/// `fnctl(fd, F_SETPIPE_SZ)`—Set the buffer capacity of a pipe.
///
/// # References
/// - [Linux]
diff --git a/vendor/rustix/src/prctl.rs b/vendor/rustix/src/prctl.rs
index 49cb062d6..6aedf3018 100644
--- a/vendor/rustix/src/prctl.rs
+++ b/vendor/rustix/src/prctl.rs
@@ -25,6 +25,9 @@ bitflags! {
const DATA_AUTHENTICATION_KEY_B = linux_raw_sys::prctl::PR_PAC_APDBKEY;
/// `PR_PAC_APGAKEY`—Generic authentication `A` key.
const GENERIC_AUTHENTICATION_KEY_A = linux_raw_sys::prctl::PR_PAC_APGAKEY;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/process/chdir.rs b/vendor/rustix/src/process/chdir.rs
index 0da0b5c2e..b110afef8 100644
--- a/vendor/rustix/src/process/chdir.rs
+++ b/vendor/rustix/src/process/chdir.rs
@@ -1,11 +1,13 @@
#[cfg(not(target_os = "fuchsia"))]
use crate::backend::fd::AsFd;
+#[cfg(feature = "fs")]
+use crate::path;
#[cfg(any(feature = "fs", not(target_os = "fuchsia")))]
use crate::{backend, io};
-#[cfg(feature = "fs")]
+#[cfg(all(feature = "alloc", feature = "fs"))]
use {
crate::ffi::{CStr, CString},
- crate::path::{self, SMALL_PATH_BUFFER_SIZE},
+ crate::path::SMALL_PATH_BUFFER_SIZE,
alloc::vec::Vec,
};
@@ -48,7 +50,7 @@ pub fn fchdir<Fd: AsFd>(fd: Fd) -> io::Result<()> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html
/// [Linux]: https://man7.org/linux/man-pages/man3/getcwd.3.html
-#[cfg(feature = "fs")]
+#[cfg(all(feature = "alloc", feature = "fs"))]
#[cfg(not(target_os = "wasi"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
#[inline]
@@ -56,7 +58,7 @@ pub fn getcwd<B: Into<Vec<u8>>>(reuse: B) -> io::Result<CString> {
_getcwd(reuse.into())
}
-#[cfg(feature = "fs")]
+#[cfg(all(feature = "alloc", feature = "fs"))]
#[allow(unsafe_code)]
fn _getcwd(mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.clear();
diff --git a/vendor/rustix/src/process/exit.rs b/vendor/rustix/src/process/exit.rs
index 5533dbabb..95b78c4a1 100644
--- a/vendor/rustix/src/process/exit.rs
+++ b/vendor/rustix/src/process/exit.rs
@@ -10,7 +10,7 @@ use crate::backend;
///
/// [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 = backend::process::types::EXIT_SUCCESS;
+pub const EXIT_SUCCESS: i32 = backend::c::EXIT_SUCCESS;
/// `EXIT_FAILURE` for use with [`exit`].
///
@@ -22,7 +22,7 @@ pub const EXIT_SUCCESS: i32 = backend::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 = backend::process::types::EXIT_FAILURE;
+pub const EXIT_FAILURE: i32 = backend::c::EXIT_FAILURE;
/// The exit status used by a process terminated with a [`Signal::Abort`]
/// signal.
@@ -33,4 +33,4 @@ pub const EXIT_FAILURE: i32 = backend::process::types::EXIT_FAILURE;
/// [Linux]: https://tldp.org/LDP/abs/html/exitcodes.html
/// [`Signal::Abort`]: crate::process::Signal::Abort
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
-pub const EXIT_SIGNALED_SIGABRT: i32 = backend::process::types::EXIT_SIGNALED_SIGABRT;
+pub const EXIT_SIGNALED_SIGABRT: i32 = backend::c::EXIT_SIGNALED_SIGABRT;
diff --git a/vendor/rustix/src/process/id.rs b/vendor/rustix/src/process/id.rs
index 4cacf1ab0..4ed33a6c8 100644
--- a/vendor/rustix/src/process/id.rs
+++ b/vendor/rustix/src/process/id.rs
@@ -8,6 +8,7 @@
#![allow(unsafe_code)]
use crate::{backend, io};
+#[cfg(feature = "alloc")]
use alloc::vec::Vec;
#[cfg(linux_kernel)]
use backend::process::types::RawCpuid;
@@ -208,12 +209,11 @@ pub fn setsid() -> io::Result<Pid> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getgroups.html
/// [Linux]: https://man7.org/linux/man-pages/man2/getgroups.2.html
+#[cfg(feature = "alloc")]
pub fn getgroups() -> io::Result<Vec<Gid>> {
- let mut buffer = Vec::new();
-
// This code would benefit from having a better way to read into
// uninitialized memory, but that requires `unsafe`.
- buffer.reserve(8);
+ let mut buffer = Vec::with_capacity(8);
buffer.resize(buffer.capacity(), Gid::ROOT);
loop {
diff --git a/vendor/rustix/src/process/ioctl.rs b/vendor/rustix/src/process/ioctl.rs
index cde6b5b3c..3c9d90255 100644
--- a/vendor/rustix/src/process/ioctl.rs
+++ b/vendor/rustix/src/process/ioctl.rs
@@ -1,4 +1,13 @@
-use crate::{backend, io};
+//! Process-oriented `ioctl`s.
+//!
+//! # Safety
+//!
+//! This module invokes `ioctl`s.
+
+#![allow(unsafe_code)]
+
+use crate::{backend, io, ioctl};
+use backend::c;
use backend::fd::AsFd;
/// `ioctl(fd, TIOCSCTTY, 0)`—Sets the controlling terminal for the processs.
@@ -17,5 +26,27 @@ use backend::fd::AsFd;
#[inline]
#[doc(alias = "TIOCSCTTY")]
pub fn ioctl_tiocsctty<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- backend::process::syscalls::ioctl_tiocsctty(fd.as_fd())
+ unsafe { ioctl::ioctl(fd, Tiocsctty) }
+}
+
+#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
+struct Tiocsctty;
+
+#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))]
+unsafe impl ioctl::Ioctl for Tiocsctty {
+ type Output = ();
+
+ const IS_MUTATING: bool = false;
+ const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::TIOCSCTTY as ioctl::RawOpcode);
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ (&0u32) as *const u32 as *mut c::c_void
+ }
+
+ unsafe fn output_from_ptr(
+ _: ioctl::IoctlOutput,
+ _: *mut c::c_void,
+ ) -> io::Result<Self::Output> {
+ Ok(())
+ }
}
diff --git a/vendor/rustix/src/process/membarrier.rs b/vendor/rustix/src/process/membarrier.rs
index df9f1a44c..9c42bbd85 100644
--- a/vendor/rustix/src/process/membarrier.rs
+++ b/vendor/rustix/src/process/membarrier.rs
@@ -14,26 +14,29 @@ bitflags::bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
pub struct MembarrierQuery: u32 {
- /// `MEMBARRIER_CMD_GLOBAL` (also known as `MEMBARRIER_CMD_SHARED`)
- #[doc(alias = "SHARED")]
- #[doc(alias = "MEMBARRIER_CMD_SHARED")]
- const GLOBAL = MembarrierCommand::Global as _;
- /// `MEMBARRIER_CMD_GLOBAL_EXPEDITED`
- const GLOBAL_EXPEDITED = MembarrierCommand::GlobalExpedited as _;
- /// `MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED`
- const REGISTER_GLOBAL_EXPEDITED = MembarrierCommand::RegisterGlobalExpedited as _;
- /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED`
- const PRIVATE_EXPEDITED = MembarrierCommand::PrivateExpedited as _;
- /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED`
- const REGISTER_PRIVATE_EXPEDITED = MembarrierCommand::RegisterPrivateExpedited as _;
- /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE`
- const PRIVATE_EXPEDITED_SYNC_CORE = MembarrierCommand::PrivateExpeditedSyncCore as _;
- /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE`
- const REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = MembarrierCommand::RegisterPrivateExpeditedSyncCore as _;
- /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10)
- const PRIVATE_EXPEDITED_RSEQ = MembarrierCommand::PrivateExpeditedRseq as _;
- /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10)
- const REGISTER_PRIVATE_EXPEDITED_RSEQ = MembarrierCommand::RegisterPrivateExpeditedRseq as _;
+ /// `MEMBARRIER_CMD_GLOBAL` (also known as `MEMBARRIER_CMD_SHARED`)
+ #[doc(alias = "SHARED")]
+ #[doc(alias = "MEMBARRIER_CMD_SHARED")]
+ const GLOBAL = MembarrierCommand::Global as _;
+ /// `MEMBARRIER_CMD_GLOBAL_EXPEDITED`
+ const GLOBAL_EXPEDITED = MembarrierCommand::GlobalExpedited as _;
+ /// `MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED`
+ const REGISTER_GLOBAL_EXPEDITED = MembarrierCommand::RegisterGlobalExpedited as _;
+ /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED`
+ const PRIVATE_EXPEDITED = MembarrierCommand::PrivateExpedited as _;
+ /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED`
+ const REGISTER_PRIVATE_EXPEDITED = MembarrierCommand::RegisterPrivateExpedited as _;
+ /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE`
+ const PRIVATE_EXPEDITED_SYNC_CORE = MembarrierCommand::PrivateExpeditedSyncCore as _;
+ /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE`
+ const REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = MembarrierCommand::RegisterPrivateExpeditedSyncCore as _;
+ /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10)
+ const PRIVATE_EXPEDITED_RSEQ = MembarrierCommand::PrivateExpeditedRseq as _;
+ /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10)
+ const REGISTER_PRIVATE_EXPEDITED_RSEQ = MembarrierCommand::RegisterPrivateExpeditedRseq as _;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -51,9 +54,9 @@ impl MembarrierQuery {
/// `membarrier(MEMBARRIER_CMD_QUERY, 0, 0)`—Query the supported `membarrier`
/// commands.
///
-/// This function doesn't return a `Result` because it always succeeds; if
-/// the underlying OS doesn't support the `membarrier` syscall, it returns
-/// an empty `MembarrierQuery` value.
+/// This function doesn't return a `Result` because it always succeeds; if the
+/// underlying OS doesn't support the `membarrier` syscall, it returns an empty
+/// `MembarrierQuery` value.
///
/// # References
/// - [Linux]
diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs
index 9c62f127e..55eed1ac8 100644
--- a/vendor/rustix/src/process/mod.rs
+++ b/vendor/rustix/src/process/mod.rs
@@ -7,7 +7,7 @@ mod chroot;
mod exit;
#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
mod id;
-#[cfg(not(target_os = "espidf"))]
+#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
mod ioctl;
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
mod kill;
@@ -45,7 +45,7 @@ pub use chroot::*;
pub use exit::*;
#[cfg(not(target_os = "wasi"))]
pub use id::*;
-#[cfg(not(target_os = "espidf"))]
+#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
pub use ioctl::*;
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
pub use kill::*;
diff --git a/vendor/rustix/src/process/pidfd.rs b/vendor/rustix/src/process/pidfd.rs
index fb8298117..0548055fc 100644
--- a/vendor/rustix/src/process/pidfd.rs
+++ b/vendor/rustix/src/process/pidfd.rs
@@ -11,11 +11,14 @@ bitflags::bitflags! {
pub struct PidfdFlags: backend::c::c_uint {
/// `PIDFD_NONBLOCK`.
const NONBLOCK = backend::c::PIDFD_NONBLOCK;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
-/// `syscall(SYS_pidfd_open, pid, flags)`—Creates a file descriptor for
-/// a process.
+/// `syscall(SYS_pidfd_open, pid, flags)`—Creates a file descriptor for a
+/// process.
///
/// # References
/// - [Linux]
diff --git a/vendor/rustix/src/process/pidfd_getfd.rs b/vendor/rustix/src/process/pidfd_getfd.rs
index 7234810c2..27d4f1986 100644
--- a/vendor/rustix/src/process/pidfd_getfd.rs
+++ b/vendor/rustix/src/process/pidfd_getfd.rs
@@ -1,3 +1,5 @@
+//! The [`pidfd_getfd`] function and supporting types.
+
#![allow(unsafe_code)]
use crate::fd::OwnedFd;
use crate::{backend, io};
@@ -15,11 +17,14 @@ bitflags::bitflags! {
/// All flags are reserved for future use.
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
- pub struct PidfdGetfdFlags: backend::c::c_uint {}
+ pub struct PidfdGetfdFlags: backend::c::c_uint {
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
+ }
}
/// `syscall(SYS_pidfd_getfd, pidfd, flags)`—Obtain a duplicate of another
-/// process's file descriptor.
+/// process' file descriptor.
///
/// # References
/// - [Linux]
diff --git a/vendor/rustix/src/process/prctl.rs b/vendor/rustix/src/process/prctl.rs
index d79657e98..59be7020f 100644
--- a/vendor/rustix/src/process/prctl.rs
+++ b/vendor/rustix/src/process/prctl.rs
@@ -96,7 +96,7 @@ impl TryFrom<i32> for DumpableBehavior {
}
}
-/// Get the current state of the calling process's `dumpable` attribute.
+/// Get the current state of the calling process' `dumpable` attribute.
///
/// # References
/// - [`prctl(PR_GET_DUMPABLE,...)`]
@@ -148,6 +148,9 @@ bitflags! {
/// Generate a [`Signal::Bus`] signal on unaligned user access.
#[doc(alias = "PR_UNALIGN_SIGBUS")]
const SIGBUS = 2;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -670,7 +673,7 @@ pub unsafe fn set_virtual_memory_map_address(
#[inline]
#[doc(alias = "PR_SET_MM")]
#[doc(alias = "PR_SET_MM_EXE_FILE")]
-pub fn set_executable_file(fd: BorrowedFd) -> io::Result<()> {
+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| ())
}
diff --git a/vendor/rustix/src/process/procctl.rs b/vendor/rustix/src/process/procctl.rs
index 8da53d383..5225f16f7 100644
--- a/vendor/rustix/src/process/procctl.rs
+++ b/vendor/rustix/src/process/procctl.rs
@@ -229,6 +229,9 @@ bitflags! {
const OWNED = 1;
/// The process is the root of the reaper tree (pid 1).
const REALINIT = 2;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs
index 72b37d6d4..b43bd03d6 100644
--- a/vendor/rustix/src/process/wait.rs
+++ b/vendor/rustix/src/process/wait.rs
@@ -22,6 +22,9 @@ bitflags! {
/// Return if a stopped child has been resumed by delivery of
/// [`Signal::Cont`].
const CONTINUED = bitcast!(backend::process::wait::WCONTINUED);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -42,6 +45,9 @@ bitflags! {
const NOWAIT = bitcast!(backend::process::wait::WNOWAIT);
/// Wait for processes that have been stopped.
const STOPPED = bitcast!(backend::process::wait::WSTOPPED);
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -170,7 +176,7 @@ impl WaitidStatus {
/// Returns the number of the signal that stopped the process,
/// if the process was stopped by a signal.
#[inline]
- #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "netbsd")))]
pub fn stopping_signal(&self) -> Option<u32> {
if self.stopped() {
Some(self.si_status() as _)
@@ -182,7 +188,7 @@ impl WaitidStatus {
/// Returns the number of the signal that trapped the process,
/// if the process was trapped by a signal.
#[inline]
- #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "netbsd")))]
pub fn trapping_signal(&self) -> Option<u32> {
if self.trapped() {
Some(self.si_status() as _)
@@ -194,7 +200,7 @@ impl WaitidStatus {
/// Returns the exit status number returned by the process,
/// if it exited normally.
#[inline]
- #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "netbsd")))]
pub fn exit_status(&self) -> Option<u32> {
if self.exited() {
Some(self.si_status() as _)
@@ -206,7 +212,7 @@ impl WaitidStatus {
/// Returns the number of the signal that terminated the process,
/// if the process was terminated by a signal.
#[inline]
- #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "netbsd")))]
pub fn terminating_signal(&self) -> Option<u32> {
if self.killed() || self.dumped() {
Some(self.si_status() as _)
@@ -231,7 +237,7 @@ impl WaitidStatus {
self.0.si_code
}
- #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))]
+ #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "netbsd")))]
#[allow(unsafe_code)]
fn si_status(&self) -> backend::c::c_int {
// SAFETY: POSIX [specifies] that the `siginfo_t` returned by a
diff --git a/vendor/rustix/src/procfs.rs b/vendor/rustix/src/procfs.rs
index 010b93126..14ad631a7 100644
--- a/vendor/rustix/src/procfs.rs
+++ b/vendor/rustix/src/procfs.rs
@@ -20,9 +20,8 @@
use crate::backend::pid::syscalls::getpid;
use crate::fd::{AsFd, BorrowedFd, OwnedFd};
-use crate::ffi::CStr;
use crate::fs::{
- fstat, fstatfs, major, openat, renameat, Dir, FileType, Mode, OFlags, Stat, CWD,
+ fstat, fstatfs, major, openat, renameat, FileType, FsWord, Mode, OFlags, Stat, CWD,
PROC_SUPER_MAGIC,
};
use crate::io;
@@ -31,6 +30,8 @@ use crate::path::DecInt;
use core::lazy::OnceCell;
#[cfg(not(feature = "rustc-dep-of-std"))]
use once_cell::sync::OnceCell;
+#[cfg(feature = "alloc")]
+use {crate::ffi::CStr, crate::fs::Dir};
/// Linux's procfs always uses inode 1 for its root directory.
const PROC_ROOT_INO: u64 = 1;
@@ -41,6 +42,7 @@ enum Kind {
Proc,
Pid,
Fd,
+ #[cfg(feature = "alloc")]
File,
}
@@ -67,6 +69,7 @@ fn check_proc_entry_with_stat(
match kind {
Kind::Proc => check_proc_root(entry, &entry_stat)?,
Kind::Pid | Kind::Fd => check_proc_subdir(entry, &entry_stat, proc_stat)?,
+ #[cfg(feature = "alloc")]
Kind::File => check_proc_file(&entry_stat, proc_stat)?,
}
@@ -94,6 +97,7 @@ fn check_proc_entry_with_stat(
return Err(io::Errno::NOTSUP);
}
}
+ #[cfg(feature = "alloc")]
Kind::File => {
// Check that files in procfs don't have extraneous hard links to
// them (which might indicate hard links to other things).
@@ -149,6 +153,7 @@ fn check_proc_subdir(
Ok(())
}
+#[cfg(feature = "alloc")]
fn check_proc_file(stat: &Stat, proc_stat: Option<&Stat>) -> io::Result<()> {
// Check that we have a regular file.
if FileType::from_raw_mode(stat.st_mode) != FileType::RegularFile {
@@ -178,7 +183,7 @@ fn check_proc_nonroot(stat: &Stat, proc_stat: Option<&Stat>) -> io::Result<()> {
fn check_procfs(file: BorrowedFd<'_>) -> io::Result<()> {
let statfs = fstatfs(file)?;
let f_type = statfs.f_type;
- if f_type != PROC_SUPER_MAGIC.into() {
+ if f_type != FsWord::from(PROC_SUPER_MAGIC) {
return Err(io::Errno::NOTSUP);
}
@@ -309,6 +314,7 @@ fn new_static_fd(fd: OwnedFd, stat: Stat) -> (OwnedFd, Stat) {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
+#[cfg(feature = "alloc")]
fn proc_self_fdinfo() -> io::Result<(BorrowedFd<'static>, &'static Stat)> {
static PROC_SELF_FDINFO: StaticFd = StaticFd::new();
@@ -338,12 +344,14 @@ fn proc_self_fdinfo() -> io::Result<(BorrowedFd<'static>, &'static Stat)> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
+#[cfg(feature = "alloc")]
#[inline]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
pub fn proc_self_fdinfo_fd<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> {
_proc_self_fdinfo(fd.as_fd())
}
+#[cfg(feature = "alloc")]
fn _proc_self_fdinfo(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
let (proc_self_fdinfo, proc_self_fdinfo_stat) = proc_self_fdinfo()?;
let fd_str = DecInt::from_fd(fd);
@@ -361,6 +369,7 @@ fn _proc_self_fdinfo(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
///
/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
/// [Linux pagemap]: https://www.kernel.org/doc/Documentation/vm/pagemap.txt
+#[cfg(feature = "alloc")]
#[inline]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
pub fn proc_self_pagemap() -> io::Result<OwnedFd> {
@@ -376,6 +385,7 @@ pub fn proc_self_pagemap() -> io::Result<OwnedFd> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
+#[cfg(feature = "alloc")]
#[inline]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
pub fn proc_self_maps() -> io::Result<OwnedFd> {
@@ -391,6 +401,7 @@ pub fn proc_self_maps() -> io::Result<OwnedFd> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man5/proc.5.html
+#[cfg(feature = "alloc")]
#[inline]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
pub fn proc_self_status() -> io::Result<OwnedFd> {
@@ -398,13 +409,15 @@ pub fn proc_self_status() -> io::Result<OwnedFd> {
}
/// Open a file under `/proc/self`.
+#[cfg(feature = "alloc")]
fn proc_self_file(name: &CStr) -> io::Result<OwnedFd> {
let (proc_self, proc_self_stat) = proc_self()?;
open_and_check_file(proc_self, proc_self_stat, name)
}
/// Open a procfs file within in `dir` and check it for bind mounts.
-fn open_and_check_file(dir: BorrowedFd, dir_stat: &Stat, name: &CStr) -> io::Result<OwnedFd> {
+#[cfg(feature = "alloc")]
+fn open_and_check_file(dir: BorrowedFd<'_>, dir_stat: &Stat, name: &CStr) -> io::Result<OwnedFd> {
let (_, proc_stat) = proc()?;
// Don't use `NOATIME`, because it [requires us to own the file], and when
@@ -418,10 +431,10 @@ fn open_and_check_file(dir: BorrowedFd, dir_stat: &Stat, name: &CStr) -> io::Res
let file_stat = fstat(&file)?;
// `is_mountpoint` only works on directory mount points, not file mount
- // points. To detect file mount points, scan the parent directory to see
- // if we can find a regular file with an inode and name that matches the
- // file we just opened. If we can't find it, there could be a file bind
- // mount on top of the file we want.
+ // points. To detect file mount points, scan the parent directory to see if
+ // we can find a regular file with an inode and name that matches the file
+ // we just opened. If we can't find it, there could be a file bind mount on
+ // top of the file we want.
//
// As we scan, we also check for ".", to make sure it's the same directory
// as our original directory, to detect mount points, since
diff --git a/vendor/rustix/src/pty.rs b/vendor/rustix/src/pty.rs
index 5040ca2c1..a63fbfeef 100644
--- a/vendor/rustix/src/pty.rs
+++ b/vendor/rustix/src/pty.rs
@@ -5,13 +5,21 @@
//!
//! [rustix-openpty crate]: https://crates.io/crates/rustix-openpty
+#![allow(unsafe_code)]
+
use crate::backend::c;
use crate::fd::{AsFd, OwnedFd};
use crate::fs::OFlags;
use crate::{backend, io};
-#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))]
+#[cfg(all(
+ feature = "alloc",
+ any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia")
+))]
use {crate::ffi::CString, alloc::vec::Vec};
+#[cfg(target_os = "linux")]
+use crate::{fd::FromRawFd, ioctl};
+
bitflags::bitflags! {
/// `O_*` flags for use with [`openpt`] and [`ioctl_tiocgptpeer`].
///
@@ -32,6 +40,9 @@ bitflags::bitflags! {
/// rustix supports it on Linux, and FreeBSD and NetBSD support it.
#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "netbsd"))]
const CLOEXEC = c::O_CLOEXEC as c::c_uint;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -102,9 +113,12 @@ pub fn openpt(flags: OpenptFlags) -> io::Result<OwnedFd> {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/ptsname.html
/// [Linux]: https://man7.org/linux/man-pages/man3/ptsname.3.html
/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Allocation.html#index-ptsname
+#[cfg(all(
+ feature = "alloc",
+ any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia")
+))]
#[inline]
#[doc(alias = "ptsname_r")]
-#[cfg(any(apple, linux_like, target_os = "freebsd", target_os = "fuchsia"))]
pub fn ptsname<Fd: AsFd, B: Into<Vec<u8>>>(fd: Fd, reuse: B) -> io::Result<CString> {
backend::pty::syscalls::ptsname(fd.as_fd(), reuse.into())
}
@@ -166,5 +180,27 @@ pub fn grantpt<Fd: AsFd>(fd: Fd) -> io::Result<()> {
#[cfg(target_os = "linux")]
#[inline]
pub fn ioctl_tiocgptpeer<Fd: AsFd>(fd: Fd, flags: OpenptFlags) -> io::Result<OwnedFd> {
- backend::pty::syscalls::ioctl_tiocgptpeer(fd.as_fd(), flags)
+ unsafe { ioctl::ioctl(fd, Tiocgptpeer(flags)) }
+}
+
+#[cfg(target_os = "linux")]
+struct Tiocgptpeer(OpenptFlags);
+
+#[cfg(target_os = "linux")]
+unsafe impl ioctl::Ioctl for Tiocgptpeer {
+ type Output = OwnedFd;
+
+ const IS_MUTATING: bool = false;
+ const OPCODE: ioctl::Opcode = ioctl::Opcode::old(c::TIOCGPTPEER as ioctl::RawOpcode);
+
+ fn as_ptr(&mut self) -> *mut c::c_void {
+ self.0.bits() as *mut c::c_void
+ }
+
+ unsafe fn output_from_ptr(
+ ret: ioctl::IoctlOutput,
+ _arg: *mut c::c_void,
+ ) -> io::Result<Self::Output> {
+ Ok(OwnedFd::from_raw_fd(ret))
+ }
}
diff --git a/vendor/rustix/src/rand/getrandom.rs b/vendor/rustix/src/rand/getrandom.rs
index c66e50d56..3fed0dd08 100644
--- a/vendor/rustix/src/rand/getrandom.rs
+++ b/vendor/rustix/src/rand/getrandom.rs
@@ -1,6 +1,5 @@
use crate::{backend, io};
-/// `GRND_*` constants for use with [`getrandom`].
pub use backend::rand::types::GetRandomFlags;
/// `getrandom(buf, flags)`—Reads a sequence of random bytes.
diff --git a/vendor/rustix/src/runtime.rs b/vendor/rustix/src/runtime.rs
index 9c850d5e3..2cb0eba54 100644
--- a/vendor/rustix/src/runtime.rs
+++ b/vendor/rustix/src/runtime.rs
@@ -1,9 +1,12 @@
-//! Low-level implementation details for libc-like runtime libraries such as
-//! [origin].
+//! Experimental low-level implementation details for libc-like runtime
+//! libraries such as [Origin].
//!
//! Do not use the functions in this module unless you've read all of their
-//! code, *and* you know all the relevant internal implementation details of
-//! any libc in the process they'll be used.
+//! code. They don't always behave the same way as functions with similar names
+//! in `libc`. Sometimes information about the differences is included in the
+//! Linux documentation under "C library/kernel differences" sections. And, if
+//! there is a libc in the process, these functions may have surprising
+//! interactions with it.
//!
//! These functions are for implementing thread-local storage (TLS), managing
//! threads, loaded libraries, and other process-wide resources. Most of
@@ -14,7 +17,7 @@
//! The API for these functions is not stable, and this module is
//! `doc(hidden)`.
//!
-//! [origin]: https://github.com/sunfishcode/mustang/tree/main/origin
+//! [Origin]: https://github.com/sunfishcode/origin#readme
//!
//! # Safety
//!
@@ -34,13 +37,14 @@ use crate::io;
#[cfg(linux_raw)]
use crate::pid::Pid;
#[cfg(linux_raw)]
-use crate::signal::Signal;
-#[cfg(linux_raw)]
#[cfg(feature = "fs")]
use backend::fd::AsFd;
#[cfg(linux_raw)]
use core::ffi::c_void;
+#[cfg(linux_raw)]
+pub use crate::signal::Signal;
+
/// `sigaction`
#[cfg(linux_raw)]
pub type Sigaction = linux_raw_sys::general::kernel_sigaction;
@@ -142,7 +146,7 @@ pub unsafe fn exit_thread(status: i32) -> ! {
///
/// This is equivalent to `_exit` and `_Exit` in libc.
///
-/// This does not all any `__cxa_atexit`, `atexit`, or any other destructors.
+/// This does not call any `__cxa_atexit`, `atexit`, or any other destructors.
/// Most programs should use [`std::process::exit`] instead of calling this
/// directly.
///
@@ -161,25 +165,70 @@ pub fn exit_group(status: i32) -> ! {
backend::runtime::syscalls::exit_group(status)
}
+/// `EXIT_SUCCESS` for use with [`exit_group`].
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [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 = backend::c::EXIT_SUCCESS;
+
+/// `EXIT_FAILURE` for use with [`exit_group`].
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [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 = backend::c::EXIT_FAILURE;
+
/// Return fields from the main executable segment headers ("phdrs") relevant
/// to initializing TLS provided to the program at startup.
+///
+/// `addr` will always be non-null, even when the TLS data is absent, ao that
+/// the `addr` and `file_size` parameters are suitable for creating a slice
+/// with `slice::from_raw_parts`.
#[inline]
pub fn startup_tls_info() -> StartupTlsInfo {
backend::runtime::tls::startup_tls_info()
}
-/// `(getauxval(AT_PHDR), getauxval(AT_PHNUM))`—Returns the address and
-/// number of ELF segment headers for the main executable.
+/// `(getauxval(AT_PHDR), getauxval(AT_PHENT), getauxval(AT_PHNUM))`—Returns
+/// the address, ELF segment header size, and number of ELF segment headers for
+/// the main executable.
///
/// # References
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man3/getauxval.3.html
#[inline]
-pub fn exe_phdrs() -> (*const c_void, usize) {
+pub fn exe_phdrs() -> (*const c_void, usize, usize) {
backend::param::auxv::exe_phdrs()
}
+/// `getauxval(AT_ENTRY)`—Returns the address of the program entrypoint.
+///
+/// Most code interested in the program entrypoint address should instead use a
+/// symbol reference to `_start`. That will be properly PC-relative or
+/// relocated if needed, and will come with appropriate pointer type and
+/// pointer provenance.
+///
+/// This function is intended only for use in code that implements those
+/// relocations, to compute the ASLR offset. It has type `usize`, so it doesn't
+/// carry any provenance, and it shouldn't be used to dereference memory.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man3/getauxval.3.html
+#[inline]
+pub fn entry() -> usize {
+ backend::param::auxv::entry()
+}
+
#[cfg(linux_raw)]
pub use backend::runtime::tls::StartupTlsInfo;
@@ -224,13 +273,19 @@ pub use backend::runtime::tls::StartupTlsInfo;
/// that could cause undefined behavior. The extent to which this also
/// applies to Rust functions is unclear at this time.
///
+/// - And more.
+///
/// # Safety
///
/// The child must avoid accessing any memory shared with the parent in a
/// way that invokes undefined behavior. It must avoid accessing any threading
/// runtime functions in a way that invokes undefined behavior. And it must
/// avoid invoking any undefined behavior through any function that is not
-/// guaranteed to be async-signal-safe.
+/// guaranteed to be async-signal-safe. But, what does async-signal-safe even
+/// mean in a Rust program? This documentation does not have all the answers.
+///
+/// So you're on your own. And on top of all the troubles with `fork` in
+/// general, this wrapper implementation is highly experimental.
///
/// # References
/// - [POSIX]
diff --git a/vendor/rustix/src/system.rs b/vendor/rustix/src/system.rs
index 9346f5560..1f7f39ce4 100644
--- a/vendor/rustix/src/system.rs
+++ b/vendor/rustix/src/system.rs
@@ -102,25 +102,25 @@ impl fmt::Debug for Uname {
{
write!(
fmt,
- "{} {} {} {} {}",
- self.sysname().to_string_lossy(),
- self.nodename().to_string_lossy(),
- self.release().to_string_lossy(),
- self.version().to_string_lossy(),
- self.machine().to_string_lossy(),
+ "{:?} {:?} {:?} {:?} {:?}",
+ self.sysname(),
+ self.nodename(),
+ self.release(),
+ self.version(),
+ self.machine(),
)
}
#[cfg(linux_kernel)]
{
write!(
fmt,
- "{} {} {} {} {} {}",
- self.sysname().to_string_lossy(),
- self.nodename().to_string_lossy(),
- self.release().to_string_lossy(),
- self.version().to_string_lossy(),
- self.machine().to_string_lossy(),
- self.domainname().to_string_lossy(),
+ "{:?} {:?} {:?} {:?} {:?} {:?}",
+ self.sysname(),
+ self.nodename(),
+ self.release(),
+ self.version(),
+ self.machine(),
+ self.domainname(),
)
}
}
diff --git a/vendor/rustix/src/termios/ioctl.rs b/vendor/rustix/src/termios/ioctl.rs
index 1c60cb9a4..620ae4c71 100644
--- a/vendor/rustix/src/termios/ioctl.rs
+++ b/vendor/rustix/src/termios/ioctl.rs
@@ -1,7 +1,10 @@
//! Terminal-related `ioctl` functions.
+#![allow(unsafe_code)]
+
use crate::fd::AsFd;
-use crate::{backend, io};
+use crate::{backend, io, ioctl};
+use backend::c;
/// `ioctl(fd, TIOCEXCL)`—Enables exclusive mode on a terminal.
///
@@ -19,7 +22,11 @@ use crate::{backend, io};
#[inline]
#[doc(alias = "TIOCEXCL")]
pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- backend::termios::syscalls::ioctl_tiocexcl(fd.as_fd())
+ // SAFETY: TIOCEXCL is a no-argument setter opcode.
+ unsafe {
+ let ctl = ioctl::NoArg::<ioctl::BadOpcode<{ c::TIOCEXCL as _ }>>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
/// `ioctl(fd, TIOCNXCL)`—Disables exclusive mode on a terminal.
@@ -38,5 +45,9 @@ pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
#[inline]
#[doc(alias = "TIOCNXCL")]
pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
- backend::termios::syscalls::ioctl_tiocnxcl(fd.as_fd())
+ // SAFETY: TIOCNXCL is a no-argument setter opcode.
+ unsafe {
+ let ctl = ioctl::NoArg::<ioctl::BadOpcode<{ c::TIOCNXCL as _ }>>::new();
+ ioctl::ioctl(fd, ctl)
+ }
}
diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs
index 00787a568..56aab9fcf 100644
--- a/vendor/rustix/src/termios/tty.rs
+++ b/vendor/rustix/src/termios/tty.rs
@@ -2,7 +2,7 @@
use crate::backend;
use backend::fd::AsFd;
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use {
crate::ffi::CString, crate::io, crate::path::SMALL_PATH_BUFFER_SIZE, alloc::vec::Vec,
@@ -33,7 +33,7 @@ pub fn isatty<Fd: AsFd>(fd: Fd) -> bool {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/ttyname.html
/// [Linux]: https://man7.org/linux/man-pages/man3/ttyname.3.html
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
#[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))]
#[doc(alias = "ttyname_r")]
#[inline]
@@ -42,7 +42,7 @@ pub fn ttyname<Fd: AsFd, B: Into<Vec<u8>>>(dirfd: Fd, reuse: B) -> io::Result<CS
}
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
-#[cfg(feature = "procfs")]
+#[cfg(all(feature = "alloc", feature = "procfs"))]
#[allow(unsafe_code)]
fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.clear();
@@ -54,9 +54,10 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation strategy to grow capacity exponentially
}
Ok(len) => {
- // SAFETY: assume the backend returns the length of the string
+ // SAFETY: assume the backend returns the length of the string excluding the
+ // NUL.
unsafe {
- buffer.set_len(len);
+ buffer.set_len(len + 1);
}
// SAFETY:
diff --git a/vendor/rustix/src/termios/types.rs b/vendor/rustix/src/termios/types.rs
index 8b7d473cf..0c44ed2e8 100644
--- a/vendor/rustix/src/termios/types.rs
+++ b/vendor/rustix/src/termios/types.rs
@@ -292,6 +292,9 @@ bitflags! {
target_os = "redox",
)))]
const IUTF8 = c::IUTF8;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -504,6 +507,9 @@ bitflags! {
target_os = "redox",
)))]
const VT1 = c::VT1;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -564,6 +570,9 @@ bitflags! {
target_os = "redox",
)))]
const CMSPAR = c::CMSPAR;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -627,6 +636,9 @@ bitflags! {
/// `IEXTEN`
const IEXTEN = c::IEXTEN;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/thread/futex.rs b/vendor/rustix/src/thread/futex.rs
index 7c4399f7a..47947c8b5 100644
--- a/vendor/rustix/src/thread/futex.rs
+++ b/vendor/rustix/src/thread/futex.rs
@@ -9,7 +9,7 @@
use crate::thread::Timespec;
use crate::{backend, io};
-pub use backend::thread::{FutexFlags, FutexOperation};
+pub use backend::thread::futex::{FutexFlags, FutexOperation};
/// `futex(uaddr, op, val, utime, uaddr2, val3)`
///
diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs
index fa3bcfb8d..11193c9d1 100644
--- a/vendor/rustix/src/thread/id.rs
+++ b/vendor/rustix/src/thread/id.rs
@@ -1,7 +1,8 @@
-use crate::pid::Pid;
-use crate::ugid::{Gid, Uid};
use crate::{backend, io};
+pub use crate::pid::{Pid, RawPid};
+pub use crate::ugid::{Gid, RawGid, RawUid, Uid};
+
/// `gettid()`—Returns the thread ID.
///
/// This returns the OS thread ID, which is not necessarily the same as the
@@ -69,7 +70,7 @@ pub fn set_thread_res_uid(ruid: Uid, euid: Uid, suid: Uid) -> io::Result<()> {
///
/// # Warning
///
-/// This is not the setxid you are looking for... POSIX requires xids to be
+/// This is not the setxid you are looking for… POSIX requires xids to be
/// process granular, but on Linux they are per-thread. Thus, this call only
/// changes the xid for the current *thread*, not the entire process even
/// though that is in violation of the POSIX standard.
@@ -94,7 +95,7 @@ pub fn set_thread_gid(gid: Gid) -> io::Result<()> {
///
/// # Warning
///
-/// This is not the setresxid you are looking for... POSIX requires xids to be
+/// This is not the setresxid you are looking for… POSIX requires xids to be
/// process granular, but on Linux they are per-thread. Thus, this call only
/// changes the xid for the current *thread*, not the entire process even
/// though that is in violation of the POSIX standard.
diff --git a/vendor/rustix/src/thread/libcap.rs b/vendor/rustix/src/thread/libcap.rs
index 8d2368720..19f81a904 100644
--- a/vendor/rustix/src/thread/libcap.rs
+++ b/vendor/rustix/src/thread/libcap.rs
@@ -102,6 +102,9 @@ bitflags! {
const BPF = 1 << linux_raw_sys::general::CAP_BPF;
/// `CAP_CHECKPOINT_RESTORE`
const CHECKPOINT_RESTORE = 1 << linux_raw_sys::general::CAP_CHECKPOINT_RESTORE;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/thread/mod.rs b/vendor/rustix/src/thread/mod.rs
index fa4897025..6f19635f0 100644
--- a/vendor/rustix/src/thread/mod.rs
+++ b/vendor/rustix/src/thread/mod.rs
@@ -2,7 +2,7 @@
#[cfg(not(target_os = "redox"))]
mod clock;
-#[cfg(linux_raw)]
+#[cfg(linux_kernel)]
mod futex;
#[cfg(linux_kernel)]
mod id;
@@ -15,10 +15,13 @@ mod setns;
#[cfg(not(target_os = "redox"))]
pub use clock::*;
-#[cfg(linux_raw)]
+#[cfg(linux_kernel)]
pub use futex::{futex, FutexFlags, FutexOperation};
#[cfg(linux_kernel)]
-pub use id::{gettid, set_thread_gid, set_thread_res_gid, set_thread_res_uid, set_thread_uid};
+pub use id::{
+ gettid, set_thread_gid, set_thread_res_gid, set_thread_res_uid, set_thread_uid, Gid, Pid,
+ RawGid, RawPid, RawUid, Uid,
+};
#[cfg(linux_kernel)]
pub use libcap::{capabilities, set_capabilities, CapabilityFlags, CapabilitySets};
#[cfg(linux_kernel)]
diff --git a/vendor/rustix/src/thread/prctl.rs b/vendor/rustix/src/thread/prctl.rs
index a9f411640..b2d40d65c 100644
--- a/vendor/rustix/src/thread/prctl.rs
+++ b/vendor/rustix/src/thread/prctl.rs
@@ -19,7 +19,9 @@ use bitflags::bitflags;
use crate::backend::c::{c_int, c_uint, c_void};
use crate::backend::prctl::syscalls;
-use crate::ffi::{CStr, CString};
+use crate::ffi::CStr;
+#[cfg(feature = "alloc")]
+use crate::ffi::CString;
use crate::io;
use crate::pid::Pid;
use crate::prctl::{
@@ -61,6 +63,7 @@ pub fn set_keep_capabilities(enable: bool) -> io::Result<()> {
// PR_GET_NAME/PR_SET_NAME
//
+#[cfg(feature = "alloc")]
const PR_GET_NAME: c_int = 16;
/// Get the name of the calling thread.
@@ -70,6 +73,7 @@ const PR_GET_NAME: c_int = 16;
///
/// [`prctl(PR_GET_NAME,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
+#[cfg(feature = "alloc")]
pub fn name() -> io::Result<CString> {
let mut buffer = [0_u8; 16];
unsafe { prctl_2args(PR_GET_NAME, buffer.as_mut_ptr().cast())? };
@@ -134,8 +138,8 @@ impl TryFrom<i32> for SecureComputingMode {
/// computing mode, then this call will cause a [`Signal::Kill`] 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 [`Signal::Kill`] signal.
+/// [`SecureComputingMode::Filter`]; otherwise, the process is killed with a
+/// [`Signal::Kill`] 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
@@ -414,28 +418,33 @@ bitflags! {
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
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`.
+ /// 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.
+ /// Setting this flag stops the kernel from adjusting the process'
+ /// 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.
+ /// 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.
+ /// 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;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -743,6 +752,9 @@ bitflags! {
const TCF_SYNC = 1_u32 << 1;
/// Asynchronous tag check fault mode.
const TCF_ASYNC = 1_u32 << 2;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
diff --git a/vendor/rustix/src/thread/setns.rs b/vendor/rustix/src/thread/setns.rs
index 2dd522a14..4568912b2 100644
--- a/vendor/rustix/src/thread/setns.rs
+++ b/vendor/rustix/src/thread/setns.rs
@@ -30,6 +30,9 @@ bitflags! {
const PROCESS_ID = CLONE_NEWPID;
/// Network name space.
const NETWORK = CLONE_NEWNET;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -82,6 +85,9 @@ bitflags! {
const NEWUTS = CLONE_NEWUTS;
/// `CLONE_SYSVSEM`.
const SYSVSEM = CLONE_SYSVSEM;
+
+ /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ const _ = !0;
}
}
@@ -96,7 +102,7 @@ bitflags! {
///
/// [Linux]: https://man7.org/linux/man-pages/man2/setns.2.html
pub fn move_into_link_name_space(
- fd: BorrowedFd,
+ fd: BorrowedFd<'_>,
allowed_type: Option<LinkNameSpaceType>,
) -> io::Result<()> {
let allowed_type = allowed_type.map_or(0, |t| t as c_int);
@@ -113,7 +119,7 @@ pub fn move_into_link_name_space(
///
/// [Linux]: https://man7.org/linux/man-pages/man2/setns.2.html
pub fn move_into_thread_name_spaces(
- fd: BorrowedFd,
+ fd: BorrowedFd<'_>,
allowed_types: ThreadNameSpaceType,
) -> io::Result<()> {
syscalls::setns(fd, allowed_types.bits() as c_int).map(|_r| ())
diff --git a/vendor/rustix/src/utils.rs b/vendor/rustix/src/utils.rs
index c5258394d..d21ed88b6 100644
--- a/vendor/rustix/src/utils.rs
+++ b/vendor/rustix/src/utils.rs
@@ -1,4 +1,7 @@
+//! Miscellaneous minor utilities.
+
#![allow(dead_code)]
+#![allow(unused_macros)]
use core::ffi::c_void;
use core::mem::{align_of, size_of};
@@ -46,3 +49,34 @@ pub(crate) fn check_raw_pointer<T>(value: *mut c_void) -> Option<NonNull<T>> {
NonNull::new(value.cast())
}
+
+/// Create an array value containing all default values, inferring the type.
+#[inline]
+pub(crate) fn default_array<T: Default + Copy, const N: usize>() -> [T; N] {
+ [T::default(); N]
+}
+
+/// Create a union value containing a default value in one of its arms.
+///
+/// The field names a union field which must have the same size as the union
+/// itself.
+macro_rules! default_union {
+ ($union:ident, $field:ident) => {{
+ let u = $union {
+ $field: Default::default(),
+ };
+
+ // Assert that the given field initializes the whole union.
+ #[cfg(test)]
+ unsafe {
+ let field_value = u.$field;
+ assert_eq!(
+ core::mem::size_of_val(&u),
+ core::mem::size_of_val(&field_value)
+ );
+ const_assert_eq!(memoffset::offset_of_union!($union, $field), 0);
+ }
+
+ u
+ }};
+}
diff --git a/vendor/rustix/src/weak.rs b/vendor/rustix/src/weak.rs
index b75b1f12a..3cda8e6c9 100644
--- a/vendor/rustix/src/weak.rs
+++ b/vendor/rustix/src/weak.rs
@@ -184,7 +184,7 @@ macro_rules! syscall {
// Pass `BorrowedFd` values as the integer value.
impl AsSyscallArg for $crate::fd::BorrowedFd<'_> {
- type SyscallArgType = ::libc::c_long;
+ type SyscallArgType = ::libc::c_int;
fn into_syscall_arg(self) -> Self::SyscallArgType {
$crate::fd::AsRawFd::as_raw_fd(&self) as _
}
@@ -192,31 +192,31 @@ macro_rules! syscall {
// Coerce integer values into `c_long`.
impl AsSyscallArg for i8 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_int;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self.into() }
}
impl AsSyscallArg for u8 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_int;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self.into() }
}
impl AsSyscallArg for i16 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_int;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self.into() }
}
impl AsSyscallArg for u16 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_int;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self.into() }
}
impl AsSyscallArg for i32 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_int;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self }
}
impl AsSyscallArg for u32 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_uint;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self }
}
impl AsSyscallArg for usize {
- type SyscallArgType = ::libc::c_long;
+ type SyscallArgType = ::libc::c_ulong;
fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
}
@@ -225,12 +225,12 @@ macro_rules! syscall {
#[cfg(target_pointer_width = "64")]
impl AsSyscallArg for i64 {
type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self }
}
#[cfg(target_pointer_width = "64")]
impl AsSyscallArg for u64 {
- type SyscallArgType = ::libc::c_long;
- fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ type SyscallArgType = ::libc::c_ulong;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self }
}
// `concat_idents` is [unstable], so we take an extra `sys_name`