From 023939b627b7dc93b01471f7d41fb8553ddb4ffa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:59:24 +0200 Subject: Merging upstream version 1.73.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/rustix/.cargo-checksum.json | 2 +- vendor/rustix/Cargo.toml | 30 +- vendor/rustix/README.md | 17 +- vendor/rustix/build.rs | 193 +++----- vendor/rustix/src/backend/libc/c.rs | 29 +- vendor/rustix/src/backend/libc/conv.rs | 36 +- vendor/rustix/src/backend/libc/event/poll_fd.rs | 6 +- vendor/rustix/src/backend/libc/event/syscalls.rs | 14 +- vendor/rustix/src/backend/libc/fs/dir.rs | 23 +- vendor/rustix/src/backend/libc/fs/mod.rs | 9 +- vendor/rustix/src/backend/libc/fs/syscalls.rs | 352 +++++++------ vendor/rustix/src/backend/libc/fs/types.rs | 192 +++----- vendor/rustix/src/backend/libc/io/errno.rs | 254 ++++++++-- vendor/rustix/src/backend/libc/io/syscalls.rs | 63 ++- vendor/rustix/src/backend/libc/mm/types.rs | 39 +- vendor/rustix/src/backend/libc/mod.rs | 13 +- vendor/rustix/src/backend/libc/mount/mod.rs | 2 + vendor/rustix/src/backend/libc/mount/syscalls.rs | 272 +++++++++++ vendor/rustix/src/backend/libc/mount/types.rs | 311 ++++++++++++ vendor/rustix/src/backend/libc/net/addr.rs | 16 +- vendor/rustix/src/backend/libc/net/ext.rs | 4 +- vendor/rustix/src/backend/libc/net/mod.rs | 2 +- .../rustix/src/backend/libc/net/read_sockaddr.rs | 6 +- vendor/rustix/src/backend/libc/net/send_recv.rs | 7 +- vendor/rustix/src/backend/libc/net/syscalls.rs | 64 ++- .../rustix/src/backend/libc/net/write_sockaddr.rs | 6 +- vendor/rustix/src/backend/libc/pipe/syscalls.rs | 24 +- vendor/rustix/src/backend/libc/pipe/types.rs | 7 +- vendor/rustix/src/backend/libc/process/mod.rs | 2 +- vendor/rustix/src/backend/libc/process/syscalls.rs | 129 +++-- vendor/rustix/src/backend/libc/process/types.rs | 56 ++- vendor/rustix/src/backend/libc/pty/syscalls.rs | 21 +- vendor/rustix/src/backend/libc/system/syscalls.rs | 24 +- vendor/rustix/src/backend/libc/termios/syscalls.rs | 62 ++- vendor/rustix/src/backend/libc/thread/syscalls.rs | 234 +++++---- vendor/rustix/src/backend/libc/time/syscalls.rs | 401 +++++++-------- vendor/rustix/src/backend/libc/time/types.rs | 46 +- .../src/backend/linux_raw/arch/asm/aarch64.rs | 268 ++++++++++ .../rustix/src/backend/linux_raw/arch/asm/arm.rs | 265 ++++++++++ .../rustix/src/backend/linux_raw/arch/asm/mips.rs | 543 +++++++++++++++++++++ .../src/backend/linux_raw/arch/asm/mips32r6.rs | 543 +++++++++++++++++++++ .../src/backend/linux_raw/arch/asm/mips64.rs | 466 ++++++++++++++++++ .../src/backend/linux_raw/arch/asm/mips64r6.rs | 470 ++++++++++++++++++ .../rustix/src/backend/linux_raw/arch/asm/mod.rs | 24 + .../src/backend/linux_raw/arch/asm/powerpc64.rs | 413 ++++++++++++++++ .../src/backend/linux_raw/arch/asm/riscv64.rs | 265 ++++++++++ .../rustix/src/backend/linux_raw/arch/asm/thumb.rs | 322 ++++++++++++ .../rustix/src/backend/linux_raw/arch/asm/x86.rs | 490 +++++++++++++++++++ .../src/backend/linux_raw/arch/asm/x86_64.rs | 293 +++++++++++ .../src/backend/linux_raw/arch/inline/aarch64.rs | 268 ---------- .../src/backend/linux_raw/arch/inline/arm.rs | 265 ---------- .../src/backend/linux_raw/arch/inline/mips.rs | 543 --------------------- .../src/backend/linux_raw/arch/inline/mips64.rs | 466 ------------------ .../src/backend/linux_raw/arch/inline/mod.rs | 22 - .../src/backend/linux_raw/arch/inline/powerpc64.rs | 413 ---------------- .../src/backend/linux_raw/arch/inline/riscv64.rs | 265 ---------- .../src/backend/linux_raw/arch/inline/thumb.rs | 322 ------------ .../src/backend/linux_raw/arch/inline/x86.rs | 494 ------------------- .../src/backend/linux_raw/arch/inline/x86_64.rs | 293 ----------- vendor/rustix/src/backend/linux_raw/arch/mod.rs | 16 +- .../src/backend/linux_raw/arch/outline/mips.s | 211 -------- .../src/backend/linux_raw/arch/outline/mips64.s | 189 ------- .../src/backend/linux_raw/arch/outline/mod.rs | 28 -- .../src/backend/linux_raw/arch/outline/nr_last.rs | 166 ------- .../src/backend/linux_raw/arch/outline/powerpc64.s | 132 ----- .../src/backend/linux_raw/arch/outline/x86.rs | 285 ----------- .../src/backend/linux_raw/arch/outline/x86.s | 381 --------------- vendor/rustix/src/backend/linux_raw/c.rs | 14 +- vendor/rustix/src/backend/linux_raw/conv.rs | 80 ++- vendor/rustix/src/backend/linux_raw/elf.rs | 7 +- vendor/rustix/src/backend/linux_raw/fs/syscalls.rs | 125 +++-- vendor/rustix/src/backend/linux_raw/fs/types.rs | 124 +---- vendor/rustix/src/backend/linux_raw/io/syscalls.rs | 65 ++- vendor/rustix/src/backend/linux_raw/mm/types.rs | 63 ++- vendor/rustix/src/backend/linux_raw/mod.rs | 4 + vendor/rustix/src/backend/linux_raw/mount/mod.rs | 2 + .../rustix/src/backend/linux_raw/mount/syscalls.rs | 239 +++++++++ vendor/rustix/src/backend/linux_raw/mount/types.rs | 303 ++++++++++++ .../rustix/src/backend/linux_raw/net/syscalls.rs | 4 + vendor/rustix/src/backend/linux_raw/param/auxv.rs | 6 + .../src/backend/linux_raw/param/libc_auxv.rs | 20 +- .../rustix/src/backend/linux_raw/pipe/syscalls.rs | 4 + .../src/backend/linux_raw/process/syscalls.rs | 1 - .../rustix/src/backend/linux_raw/pty/syscalls.rs | 2 - vendor/rustix/src/backend/linux_raw/reg.rs | 13 +- .../src/backend/linux_raw/runtime/syscalls.rs | 12 +- .../src/backend/linux_raw/termios/syscalls.rs | 7 +- .../rustix/src/backend/linux_raw/vdso_wrappers.rs | 56 ++- vendor/rustix/src/check_types.rs | 70 ++- vendor/rustix/src/clockid.rs | 11 +- vendor/rustix/src/cstr.rs | 4 +- vendor/rustix/src/fs/abs.rs | 9 +- vendor/rustix/src/fs/at.rs | 27 +- vendor/rustix/src/fs/constants.rs | 6 +- vendor/rustix/src/fs/cwd.rs | 2 - vendor/rustix/src/fs/fcntl.rs | 4 +- vendor/rustix/src/fs/fcntl_apple.rs | 42 ++ vendor/rustix/src/fs/fd.rs | 14 +- vendor/rustix/src/fs/mod.rs | 34 +- vendor/rustix/src/fs/mount.rs | 209 ++------ vendor/rustix/src/io/dup.rs | 7 +- vendor/rustix/src/io/errno.rs | 6 +- vendor/rustix/src/io/fcntl.rs | 2 +- vendor/rustix/src/io/ioctl.rs | 1 + vendor/rustix/src/io/read_write.rs | 18 +- vendor/rustix/src/lib.rs | 44 +- vendor/rustix/src/mm/mmap.rs | 3 +- vendor/rustix/src/mount/fsopen.rs | 219 +++++++++ vendor/rustix/src/mount/mod.rs | 19 + vendor/rustix/src/mount/mount_unmount.rs | 175 +++++++ vendor/rustix/src/mount/types.rs | 1 + vendor/rustix/src/net/send_recv/mod.rs | 4 +- vendor/rustix/src/net/send_recv/msg.rs | 20 +- vendor/rustix/src/net/sockopt.rs | 3 +- vendor/rustix/src/net/types.rs | 158 ++++-- vendor/rustix/src/pid.rs | 16 +- vendor/rustix/src/pipe.rs | 10 +- vendor/rustix/src/process/exit.rs | 2 +- vendor/rustix/src/process/ioctl.rs | 2 +- vendor/rustix/src/process/mod.rs | 24 +- vendor/rustix/src/process/priority.rs | 7 + vendor/rustix/src/process/wait.rs | 10 +- vendor/rustix/src/procfs.rs | 2 +- vendor/rustix/src/pty.rs | 2 +- vendor/rustix/src/signal.rs | 14 +- vendor/rustix/src/static_assertions.rs | 37 ++ vendor/rustix/src/system.rs | 23 +- vendor/rustix/src/termios/ioctl.rs | 4 +- vendor/rustix/src/termios/mod.rs | 8 +- vendor/rustix/src/termios/tc.rs | 10 +- vendor/rustix/src/termios/types.rs | 297 ++++++++--- vendor/rustix/src/thread/clock.rs | 4 +- vendor/rustix/src/thread/id.rs | 4 +- vendor/rustix/src/thread/setns.rs | 4 +- vendor/rustix/src/timespec.rs | 68 +-- vendor/rustix/src/ugid.rs | 17 +- vendor/rustix/src/utils.rs | 4 +- 137 files changed, 8479 insertions(+), 6442 deletions(-) create mode 100644 vendor/rustix/src/backend/libc/mount/mod.rs create mode 100644 vendor/rustix/src/backend/libc/mount/syscalls.rs create mode 100644 vendor/rustix/src/backend/libc/mount/types.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs create mode 100644 vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/mips.s delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs delete mode 100644 vendor/rustix/src/backend/linux_raw/arch/outline/x86.s create mode 100644 vendor/rustix/src/backend/linux_raw/mount/mod.rs create mode 100644 vendor/rustix/src/backend/linux_raw/mount/syscalls.rs create mode 100644 vendor/rustix/src/backend/linux_raw/mount/types.rs create mode 100644 vendor/rustix/src/mount/fsopen.rs create mode 100644 vendor/rustix/src/mount/mod.rs create mode 100644 vendor/rustix/src/mount/mount_unmount.rs create mode 100644 vendor/rustix/src/mount/types.rs create mode 100644 vendor/rustix/src/static_assertions.rs (limited to 'vendor/rustix') diff --git a/vendor/rustix/.cargo-checksum.json b/vendor/rustix/.cargo-checksum.json index e749cc800..01994bd27 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":"b016dcc4465558f7bceb1eea94ae562acafa51c6d91f4bd6ace99a1a0075974c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"62993d0e83773686d74488effddd72bd7256299e0ce913ae9bbf0704ee9f2120","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"7abf49bced798168a4f57916654305a6c5d048d12e0ad43d30ab14f24b5e527a","build.rs":"5d470d6e1e65a33b6728a9d2135b7784ce725d3bd57a7ecbd552dfc80ddde0ac","src/backend/libc/c.rs":"6c73028cda171abe53917fe80ee1e627ff957bf29e5312b57be2a4d7050d1c92","src/backend/libc/conv.rs":"0b71622d51111c6be5d554e978d9ef6ba278e94241b53afe2fee390663b2425e","src/backend/libc/event/epoll.rs":"598e246866f46834f57d5385439d4c40654f899d3b9f252b6f72eeb18628d661","src/backend/libc/event/mod.rs":"7f8547c599b8263eb791890bbe4a0b22fe2676d007ffdcc3e07b2e48d1c994db","src/backend/libc/event/poll_fd.rs":"9b44a5b399cfa742b505f9f2d1400dac9f3d1afb1f253c23b250f08c0632e51b","src/backend/libc/event/syscalls.rs":"3755384de833dc10b381b8037efef3bd12aceaa41adb440cb7b1d5a81ef12066","src/backend/libc/event/types.rs":"5a520d60f67bf07be9229177ce872dc70bf366760a2b81fecba6d522b2179868","src/backend/libc/event/windows_syscalls.rs":"ebfac665c6676c4b803134ab8806be8aa2e96bdbc7799a19c544cd9069b35787","src/backend/libc/fs/dir.rs":"a00c4faf3a65523dce922ae4cb62dc275479d5e255b4fa5d4108864122378296","src/backend/libc/fs/inotify.rs":"4e0e1f31ed6a53cbc56119bb974a464acd9c7797d2699a29cb399311ce49323d","src/backend/libc/fs/makedev.rs":"797e7e31dd363b8f649f370424e23a210be4536b580a78cb0f4c5d375da0aab0","src/backend/libc/fs/mod.rs":"ba3c79b8918eab2a4c962e353d2b27d3cd96b201f9e527ce0b70b7a558ac596b","src/backend/libc/fs/syscalls.rs":"32d88e3e1955e533b2c110d05e6b22e31663d9a543afc8c0bf9b5901ad1d8fed","src/backend/libc/fs/types.rs":"eaabd8ea89654bcb297379fbae57a0434e3964073ca468f245c55f2f9e3a476a","src/backend/libc/io/errno.rs":"b9b591870ea1db3224cd8dc654735a052d0ee44f513069f5c9ae09183b846f69","src/backend/libc/io/mod.rs":"746647bd864e4ec7717925b6d176cebdb392b7d015070244cc48d92780351dd6","src/backend/libc/io/syscalls.rs":"db3056b3cad7313b9ec22a1b3d389ad91ef474566f091a2c644a8d8769eee055","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":"de5695cef84a6859408fb09291edb93d853ed1498fe31286648778509b99ffbb","src/backend/libc/mod.rs":"eb0a047cf46a67058c68e7f3d481160cf13a35a2bf68e657110332efc2550c61","src/backend/libc/net/addr.rs":"cf0d76b0d7a0b25f7f36f36dcefcaa4e20bcba70122d8951f2696a02e8b60d09","src/backend/libc/net/ext.rs":"ed4bc298ed7dadd0f319e97ef7707ab22841ca04edc9adfe9c8a209c20360072","src/backend/libc/net/mod.rs":"6b0b674552234f08605f92770f55476e528ec39dc0c4b8baf41ceff06191f2f3","src/backend/libc/net/msghdr.rs":"67f7ed2c41e843bf2c00c9fef4280af24cf2e897c3b31e0a916415237c8f88e4","src/backend/libc/net/read_sockaddr.rs":"a44060a2cfd10586c5d52cee4ce92b5f27a2cdaa35c0c82f8db7eda59f4ef470","src/backend/libc/net/send_recv.rs":"ad545056de837597e62905fb49113055819de6952d7802edaa9c98853620ef7b","src/backend/libc/net/syscalls.rs":"025c6a1fb554345e0c16626d43ae226aa44fac813a57020fcc4337f0ea509a46","src/backend/libc/net/write_sockaddr.rs":"f8440b13a051829924959495f69053a7c67d165f8f8d979826c693100a15478a","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":"18a461da1c97a8d4fe3679ce3eafb8c647179e8190528de86500d1e00c28e75c","src/backend/libc/pipe/types.rs":"12a5abf55142a46fe9951d9abe9ded7799b4fc882faa51e6c28fc06704af6451","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":"787018aba4adb2cc1f9176faf154a1a8d7943e4cad36be6e43fc03ce355572d6","src/backend/libc/process/syscalls.rs":"83c34a773946d721c32d1f10e19b60bcec740d4a4a6b19a76ee817e8337dca8b","src/backend/libc/process/types.rs":"46367723120e8c737f7097ad85b43bb9200f2b8159904eb52c341c5ea6075aae","src/backend/libc/process/wait.rs":"0cc556aed976b4bbb3965f74fd76b8216c755fce25043b7b21ce54afa07c9773","src/backend/libc/pty/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/pty/syscalls.rs":"301b19e788c102c86fa408100ab4121347ebacc2340b27e97cc55ddb1794de11","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":"94228b0a8ca775e09312c885eea4a5a6a47463e1377d7d97bb6b49e1c03bf9cd","src/backend/libc/system/types.rs":"6871e16aee14fe2ae03cea798c3e509ffe44778a9c0e5608fd73e2e015876d7e","src/backend/libc/termios/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/termios/syscalls.rs":"42fdb11063237ef21e57fba2590aae223a071281f0417f17a22d7337a39db03d","src/backend/libc/thread/mod.rs":"0de5f67a684b9fd7628d3009d2ea5fd51b8770e8b387eed14f59152157844287","src/backend/libc/thread/syscalls.rs":"df0be657068311fb3e3932509fb2be4c31e9e861d24096ad6071eae2e501260c","src/backend/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/time/syscalls.rs":"4b95ea3e053b7cbeb76f445978743cf2e4b7807590e366d00135c838c5e08359","src/backend/libc/time/types.rs":"c6e70d21888bbb9cc7d6561cc272d797933960bede7d93d54e09dee48e0f31ef","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/inline/aarch64.rs":"67011427b3cecd29ee716113d952e70d63574c96d1d3ea3c75d46250bde9ca44","src/backend/linux_raw/arch/inline/arm.rs":"7760d51aef17a69a797eb96fd61f7fade0d55bc87ec9a3e77fa6bb6aebaecdbb","src/backend/linux_raw/arch/inline/mips.rs":"d00c84cfdb4e37bdee9a2daa0a7b3298afbb4ebe288702203cb43d9c2617012d","src/backend/linux_raw/arch/inline/mips64.rs":"ab5455c9b2511ba6b67a66873cd8b53bf77471249fd2779d6437ebb4934087b5","src/backend/linux_raw/arch/inline/mod.rs":"8408861cf501637b7f0bdad5234d28ebe8d042f6815554b8d2fd3a8ee5c84e20","src/backend/linux_raw/arch/inline/powerpc64.rs":"dcd12314184441f5f7705bea6b829103c7abc9062db366ae5584023a38252a36","src/backend/linux_raw/arch/inline/riscv64.rs":"58a58203e9cac2ed21e4a7b26692c5d56d3c2bcddb3f60a648efd18a02129f3c","src/backend/linux_raw/arch/inline/thumb.rs":"82b88c9a3b6837f28a738cc760fc2403e7014abdb2c35d2bdbc8073235ae2863","src/backend/linux_raw/arch/inline/x86.rs":"de75f5179edf060461d949682002f4242140e5a01aa2361c4eab82da15375068","src/backend/linux_raw/arch/inline/x86_64.rs":"7c893ca306b3b8a5980c525dc5fa23187a0526bc9f7ac637204d88a1d596df5d","src/backend/linux_raw/arch/mod.rs":"1613f74cdf3ee7f99456530327a4d9d5846b95072cff32aff386241f4659ecf6","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips.a":"145be0e9638cb5541860ec97ce5270767c24b61f415f0ee3c2f86cc962ee44af","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips64.a":"6c6d007368beb5e53bb1c402afacc1c139ee65dddb82ba3e2eada0493af94ef6","src/backend/linux_raw/arch/outline/debug/librustix_outline_powerpc64.a":"355db5c83dda1074636c40fa6fee6564c668c492a71e149bcb444ea896e8167e","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86.a":"7ae3635dd3fbc2049e09d4218224e1eaaa4dd2ddd78d3901fb444d481abf2a33","src/backend/linux_raw/arch/outline/mips.s":"3612ba84500f033650cbb3860241768cc0760c5693aadc8af01dd2f61c7d59ff","src/backend/linux_raw/arch/outline/mips64.s":"deaf2218e0d2c5c97d1d5000c2c6678bbbf5a28faeefd0fb04b04e1984c94185","src/backend/linux_raw/arch/outline/mod.rs":"1e6ca71e98b6f3fca91cee16ab473a2cf710f1ea55ad24649a3b1262ed276ec8","src/backend/linux_raw/arch/outline/nr_last.rs":"82d92b9ca8307c19d74ced1ae2c0b31f2a7c5db70fa31fdedb55d38a90601455","src/backend/linux_raw/arch/outline/powerpc64.s":"0847fa3f160846ee02771550667913734ba9773e2221f2279c4f296d6f5b7bd4","src/backend/linux_raw/arch/outline/release/librustix_outline_mips.a":"d9a093ee2b2c94b70aa059e878a0211715fe6fdcc95a9098566c87d61be4e4b3","src/backend/linux_raw/arch/outline/release/librustix_outline_mips64.a":"ad19a967ade7067a12b08f61628cc56f72eaff1393544783647e1c4dde2629a3","src/backend/linux_raw/arch/outline/release/librustix_outline_powerpc64.a":"1f04e44c3d863bac066520c787444c314f2aa2f8d8d3cae38990ecc008b9b6e1","src/backend/linux_raw/arch/outline/release/librustix_outline_x86.a":"691d867358475c701c20b816b99bab2a4c90c3796a302ccaa56d5983be1ba8b2","src/backend/linux_raw/arch/outline/x86.rs":"f7e12a0f3fe8e97acb1ade2c9e61d82542f00ad4d8fe684a8dcd9f30fd9ab5d4","src/backend/linux_raw/arch/outline/x86.s":"4604e3b41161802343e2e4c890fd2042098a901d95893ebe4c436f97fd47cad3","src/backend/linux_raw/c.rs":"c30491601405d42fabd5fdfe50abd539dc7693bf326be9e17a31bb6d6192e356","src/backend/linux_raw/conv.rs":"e6af1903c5b4a0ce8d80909b04e0f47849768218c9969aa6e1dcf85bdd505711","src/backend/linux_raw/elf.rs":"4550edde9ca096ac3ad929ace226fd5ead954da7ad01d22da43fdb976655f771","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":"76f0b4e6d46a5aa7907d783a794211124b6d2e7dd124cfb7170b24657e39d093","src/backend/linux_raw/fs/types.rs":"9410b0cb6e744820663660a8f2bacb8f477ebd5eb3b2c60e3519ba19b1c701d7","src/backend/linux_raw/io/errno.rs":"8d6a8d702ddec05c0ec5b518b9c4d6c9b54d390ea9b362e60f2032284c40b112","src/backend/linux_raw/io/mod.rs":"7ae2324427892cca6f5ab53858d847b165f790a72ec25f3d99fb15f0506c9f27","src/backend/linux_raw/io/syscalls.rs":"d82dfdef885e9b22bfbf605fce8ef2862604ef195dfdcdc0532c29426a188bd8","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":"0d5815b725e51b5e16984e12852c125f14543c29bbd1a47b7e3b0ad95d711526","src/backend/linux_raw/mod.rs":"2abe0633534dc90a050595b8562bbc37a96559fdaf2e1491d1fa2cd52f0d4cb2","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":"bbc7b021604feb515ba5fecb139f79935c94d3145d5115fee60f3055cf68ccb6","src/backend/linux_raw/net/write_sockaddr.rs":"69ee7d6f754126f9399250d51bcdb306ab6a9ae816bc8fe21d0a9cabd49052ef","src/backend/linux_raw/param/auxv.rs":"0a26b11f5ce794d85826a05b57187d333012246059f9d28a9cbbfbd2e93747c7","src/backend/linux_raw/param/libc_auxv.rs":"3b89394eb05d9f15ac23c16823666b12c5ce75ca29a6e4f3d66db2426d5e0d98","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":"c499b47305ae7e25ed6fa3c760ce26cd64d985152615755706117f4d0a03d3d5","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":"0d7b3a3004ac84668296bfa8ad9c255f175e9fb380a59d5c8d248dc0f5b218aa","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":"01c6d76b8ae36e8c936188011a13c31ca2ec61cb825b7da305d6e55356c260dd","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":"02653995cb934050ee2109e8d40e9083a4278abcba27b59d174a311aa8438e45","src/backend/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/backend/linux_raw/runtime/syscalls.rs":"55c38b348e19f049d7e65ef1fa7d9b50f9f0b6e87d32eda6f9bbc016274ef4c2","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":"29deb1181e650885616928cf0b34207b644bb68bea99370e3e40d99cf6cd2f97","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":"d50b761899f1d3cc4897d5cca868a8ad7e84a64d20aa46075cc0ae12f4bccdf3","src/bitcast.rs":"fe6bdc7fc31fa3b360c44a841c9a0f143629172729c6aaeae76841c74c122ff3","src/check_types.rs":"4b35e46c58a8ac299c08250d5ceaaecec52a07be03f2d888bce2bc0581b498bc","src/clockid.rs":"598ebc50bdaf089e43fd1a0ad365c8ae1947c9a6cda0dea5273aafab32b33959","src/cstr.rs":"dc3e38fa056ce76df360c0e63482b02f60fb1d38c357481de38ef82584e80658","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":"b8adbc6c96f7bab9d4776711774b5143bdfc3a3799beaceaab0a18abcb65548e","src/fs/at.rs":"4ea39291c632c0856b3057a606a38de1acbfb91d920662459f287be91ad3e39d","src/fs/constants.rs":"e3a5b8309d79d66f30ac15747912b9c9e376f8e525046625849c1b3b5caa1f6f","src/fs/copy_file_range.rs":"d3b644374390d482b2ff749a2459458872b57d0dcf9670368739b7833509a7c2","src/fs/cwd.rs":"81f899ab1d38cf5a53ad91980482a93f11cec2894050820b4543dfbf05760629","src/fs/dir.rs":"347a52f4ca9ac6321c52e802e97ec90d1b4c62ec955c8996fc17f8f5aed69966","src/fs/fadvise.rs":"beef66ebe1310fb92628240b2cde68f744c78e50f6ff61bb1404bd4868d9cae8","src/fs/fcntl.rs":"58c8f99e7193d11f0301d55e521e7bac16b1143f47eb7cf73cd9663841b4ebbe","src/fs/fcntl_apple.rs":"07f07b2ac75dc28bc9e08200f72eb95550a87ff3d69c1204f49ecb63a0c4fd20","src/fs/fcopyfile.rs":"ec95929cbbe02cf49233a785e5238931bb107b7903cc5bc95e4231de960995f2","src/fs/fd.rs":"a975d59ed0672bd0cf90bc18bc793a99096984ff06c3c78614285823cb3842ef","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":"00249594de42fd81bdd61ead2905395e5d8ccf6d6b7400a6ba1c44b2a8271b74","src/fs/mount.rs":"8ab26dcb422825bbd2df2e1f68e6b4f7cf08ce11387c688442ee1b4683b33d4f","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":"1f52e78a1e620544425b1ae6e00112fc154a8287e2f26bac5ddd15941e228179","src/io/errno.rs":"da7dc2d25cdbbf610ec82c32124789d6572fbc67d8ff265000597ac1f5b39ebd","src/io/fcntl.rs":"08f42dc80832586afa6e0a7825571c84a97add1164926928960f0c4c5db76461","src/io/ioctl.rs":"87772d59d72d34f1c3a1c00f818199b52c960f5860ea9a1f8023c0e2ce5f6d12","src/io/is_read_write.rs":"1bfb9ee5d58e0b29b44af12fe2668c7bccc841358698dcde47f1519ff9bb73b4","src/io/mod.rs":"75f1d0646be1d4c7c08b5887d8119b0103be8c25c43ccd4e0e97015508c0bb8f","src/io/read_write.rs":"57c6ba3ccc9bdeae05e8ed70a2d9cabd2dd38c5f387e20d91bcd0d13d0f1d23e","src/io_uring.rs":"7093958a57bdaadd75f1800f07e359fd97c6f99c3fa01d263b4b1e57d44b2c4f","src/lib.rs":"5c0bb009b5ea0cd36ac4f503f128db61d875945b267b5e04cec5e3abec7e46b7","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":"bb103e6febd375de820985cc4b5aefa520b64ab1bcd903e3a818146abdfc60c7","src/mm/mod.rs":"b3a6cb838986d45825b912355cedead761211a494ca6f89b2367a2d2157e340e","src/mm/msync.rs":"9dcfe5f54235e9314a595edb8d548ac79d222bbcc58bb3263cf7e96d603b23ad","src/mm/userfaultfd.rs":"8073443bd181ff0b3ba4d0b1ae67370b4864035a0c8b4898cd709dc47c518ae7","src/net/mod.rs":"a6bc55f9e086caf46a7c00783498d73a328a66f2a991f1ec65d5f13931377b0f","src/net/send_recv/mod.rs":"5ec5efbe84eeb0a2a3e412b79c742bb80152c1dc9c956d031e9a4ebebd492112","src/net/send_recv/msg.rs":"b8ce63eaa32cb5d7f7b7fc2215b60b60ec9d17bc89fd37f0f940610a5f4c7840","src/net/socket.rs":"6bb087ab208a1e06d535fa11e2aa4a9f96da6e73b697fca93e2a3c89178c4434","src/net/socket_addr_any.rs":"d07f9e9ef8873aa5bfd85f669952299286ef6f2cc5b9fea383856432e61b850f","src/net/socketpair.rs":"56f4885c31d2664cd16e18a9a88792a4912fedd953cec36dba67e8581fd57921","src/net/sockopt.rs":"34e897c7e22c8a45cca4e23fec35ab26b40ef440f083367c350a57adb82b803d","src/net/types.rs":"f5a4016b00ccbc60feaaa15b6cb0cae1a994f8049fbe7ec32c4c88423389ec27","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":"1e54bbf54b8fa7b260087fcae8d7e1bc35c66e9a36a26d69dddcc468e3d593ee","src/pipe.rs":"966521978ee7a57a11412ca5bee1246ca26dd67a07e53318066a38fe0787f2e9","src/prctl.rs":"a1c85a401538d614f5539871f9a03f9a345b24cfbc845e953deb9f8b96986e2a","src/process/chdir.rs":"9d0397bc91bad5bf1c0afec5b3e6dd9cb7de6e54c3d0b760b33a4996a4cb1b25","src/process/chroot.rs":"2b5f6124eb19f26ad2705174f7ad50cdc0a5d15abd59ffcf55421228d82130b4","src/process/exit.rs":"47bc2fc1ec25eb5c7a21ba84a70c6d799df206f9920c34804a17acf27d5cd66d","src/process/id.rs":"402475cba98cc7e724943bfd218862f76c08b8d200a7b38bb5067bba2a837ef1","src/process/ioctl.rs":"6644c3b0948251b448a87cc8409750edf77dc31f08b2060fccf00dab0d516fca","src/process/kill.rs":"7b879e5cff8a064acd0e7488f4e21bd4e4a8506ce380688b72cc48d283ff9c89","src/process/membarrier.rs":"77b1080dc50cf0bf48959bd2388c519f0b73ac231cc329be43f04525217b7e94","src/process/mod.rs":"cf5974f174968ea668f73a2294231784d1ab8304ae4e79a70175372c0bc34fd2","src/process/pidfd.rs":"948b88cd986c17074fc895f277eec49066a52ab461fa341b7119ce648b28fcb6","src/process/pidfd_getfd.rs":"14aab7cc5578ca4753a7a42dcc8b4ea03748564b542675a50bae8e128348b23e","src/process/prctl.rs":"3f949bbc03c00cb68fab7db8c1bda71741f8d9439b9e25a8521d7cbb0693491d","src/process/priority.rs":"711ad9300407b205a549d2f896cdff080740f6cde8e710d3bb654ea720586b4c","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":"d34f9399a2ef6f2dfca929dca72a83d888ff80523c62083b50a2cd10dc875fe6","src/procfs.rs":"ebfbbe22e0ba7a2b914abd474d73065f0c5aa6bddaebc55dd286b3e013349485","src/pty.rs":"408e9144151d7cf5589ed37f1c1864fa5be0d1312fd8be1c74db07782dc09b6c","src/rand/getrandom.rs":"15255b5c5f76cf61ac4fac8b7ac6621049f2b5d2549ec319cdd69ab1ae4d07d2","src/rand/mod.rs":"cab59332aadd9b679f5b22cbb222d48ee028af5eb9fd4a4d43922da659b895d7","src/runtime.rs":"952cea05413e3ba1fa4fdc4755bf1d0fc0c21a5c8878f2cccc6a533119c193f8","src/signal.rs":"fb552490e378420375fa1f2a3eb7de16ac0f5ff72b7d0d3c88275314fdc57d1c","src/stdio.rs":"a5de2d7d9c3c5a901f88b6acf4754687c958a2f3a93c7945c2b8fcb948d468af","src/system.rs":"19e0b60315ddc7d8f2b7aafc4f4c6a30b91a7cd8ec4d128ba38931aa74b00175","src/termios/ioctl.rs":"7c185486116981e8aaa8db5fecb8484220f4d12e1a24de43fc394f17b4cdfdd4","src/termios/mod.rs":"b358538190ccb451a9d3dbc76c2418efb659fe48a54bc7069e7908589dbf07ce","src/termios/tc.rs":"90cf7f3026d46aec296f4e65ead6b8739a6967a74521e47b18f251b588948947","src/termios/tty.rs":"a3ebab3b73db76fb5594be1bb4ec888a28a63637f8cd0211fdb1b3b645cc2ca2","src/termios/types.rs":"97b7bd2d00dfcd5410c99b2b36de3fb1b67a5beebb2938cc94ee908e4bc8183c","src/thread/clock.rs":"780d24ce30bef7e85b2634dc57a9ef2a261d6ac7c255a9e6167f923fae369843","src/thread/futex.rs":"4e78c84589b535ca9ca633633696ef212393a98f2890b181acaa8f908fbc5ae2","src/thread/id.rs":"fd9c8ab917c82a8e0d6e6af22d2f6e5aa0d81d57632a460fd711a52f8ed2f47c","src/thread/libcap.rs":"ee1f320d860a3decbec8052897d9e9484591e4b0b64b3b5b419f4d43d144422e","src/thread/mod.rs":"6fc33eb022c4ab7f950dfb4fae6ab70b1acbcdbeacd909ae1848e7e54076c310","src/thread/prctl.rs":"f6da23203fc2087cd3b36b910901cd6cd86d5ac6f2fcb09feb1270d6c486a1a7","src/thread/setns.rs":"ac946df9eeb67a89436c57c1620855f66a57bded194ba2110a2656a25ba87bbd","src/time/clock.rs":"e59a29f1bed8c31c3d5b6fad60f2d4fa6cab8dd8e86148bb3693a5e3a1ce735f","src/time/mod.rs":"43afee938c80d124d04d4ba190c03f4d21d1e3bfc154fff309211e4f6eabe940","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/timespec.rs":"2fee202dc27f4566d1af81007855e48932af2cc37db3cff30e1a657b37439183","src/ugid.rs":"cef024d081c7bbd60a60b079eb581fdbca036a462f8c232e48e2959e2b854335","src/utils.rs":"41765307b22b7cf8e21e83735308c598da8a83b52b5b7eafa175bf39f1528fbb","src/weak.rs":"22070a3fa6e526d851bac81c551aa5cb4f9e609687075999c6d50973eeec3a98"},"package":"fbc6396159432b5c8490d4e301d8c705f61860b8b6c863bf79942ce5401968f3"} \ No newline at end of file +{"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 diff --git a/vendor/rustix/Cargo.toml b/vendor/rustix/Cargo.toml index dd40b2507..8b9e45319 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.1" +version = "0.38.6" authors = [ "Dan Gohman ", "Jakub Konka ", @@ -99,7 +99,7 @@ default-features = false version = "1.0" [dev-dependencies.libc] -version = "0.2.146" +version = "0.2.147" [dev-dependencies.libc_errno] version = "0.3.1" @@ -112,19 +112,19 @@ version = "0.9.0" [dev-dependencies.serial_test] version = "2.0.0" +[dev-dependencies.static_assertions] +version = "1.1.0" + [dev-dependencies.tempfile] version = "3.5.0" -[build-dependencies.cc] -version = "1.0.68" -optional = true - [features] all-apis = [ "event", "fs", "io_uring", "mm", + "mount", "net", "param", "pipe", @@ -139,6 +139,7 @@ all-apis = [ "thread", "time", ] +cc = [] default = [ "std", "use-libc-auxv", @@ -153,6 +154,7 @@ io_uring = [ linux_4_11 = [] linux_latest = ["linux_4_11"] mm = [] +mount = [] net = [ "linux-raw-sys/net", "linux-raw-sys/netlink", @@ -191,7 +193,7 @@ use-libc = [ ] use-libc-auxv = [] -[target."cfg(all(any(target_os = \"android\", target_os = \"linux\"), 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 = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\", target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))".dependencies.linux-raw-sys] +[target."cfg(all(any(target_os = \"android\", target_os = \"linux\"), 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.linux-raw-sys] version = "0.4.3" features = [ "general", @@ -203,18 +205,18 @@ default-features = false [target."cfg(all(criterion, not(any(target_os = \"emscripten\", target_os = \"wasi\"))))".dev-dependencies.criterion] 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 = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\", target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))".dependencies.libc] -version = "0.2.146" +[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" features = ["extra_traits"] optional = true -[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 = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\", target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))".dependencies.libc_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.libc_errno] version = "0.3.1" optional = true 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 = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\", target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"))))".dependencies.linux-raw-sys] +[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" features = [ "general", @@ -224,11 +226,11 @@ features = [ ] 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 = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\", target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))".dependencies.libc] -version = "0.2.146" +[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" features = ["extra_traits"] -[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 = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\", target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\")))))))".dependencies.libc_errno] +[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" default-features = false package = "errno" diff --git a/vendor/rustix/README.md b/vendor/rustix/README.md index f82019b0a..985a60fde 100644 --- a/vendor/rustix/README.md +++ b/vendor/rustix/README.md @@ -58,10 +58,11 @@ by default. The rest of the API is conditional with cargo feature flags: | Name | Description | ---------- | --------------------- | `event` | [`rustix::event`]—Polling and event operations. -| `fs` | [`rustix::fs`] and [`rustix::path`]—Filesystem operations. +| `fs` | [`rustix::fs`]—Filesystem operations. | `io_uring` | [`rustix::io_uring`]—Linux io_uring. | `mm` | [`rustix::mm`]—Memory map operations. -| `net` | [`rustix::net`] and [`rustix::path`]—Network-related operations. +| `mount` | [`rustix::mount`]—Linux mount API. +| `net` | [`rustix::net`]—Network-related operations. | `param` | [`rustix::param`]—Process parameters. | `pipe` | [`rustix::pipe`]—Pipe operations. | `process` | [`rustix::process`]—Process-associated operations. @@ -80,6 +81,7 @@ by default. The rest of the API is conditional with cargo feature flags: [`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 +[`rustix::mount`]: https://docs.rs/rustix/*/rustix/mount/index.html [`rustix::net`]: https://docs.rs/rustix/*/rustix/net/index.html [`rustix::param`]: https://docs.rs/rustix/*/rustix/param/index.html [`rustix::pipe`]: https://docs.rs/rustix/*/rustix/pipe/index.html @@ -95,7 +97,6 @@ by default. The rest of the API is conditional with cargo feature flags: [`rustix::io`]: https://docs.rs/rustix/*/rustix/io/index.html [`rustix::fd`]: https://docs.rs/rustix/*/rustix/fd/index.html [`rustix::ffi`]: https://docs.rs/rustix/*/rustix/ffi/index.html -[`rustix::path`]: https://docs.rs/rustix/*/rustix/path/index.html ## 64-bit Large File Support (LFS) and Year 2038 (y2038) support @@ -122,12 +123,10 @@ supported on Redox, such as `*at` functions like `openat`, which are important features for `rustix`. `rustix` has its own code for making direct syscalls, similar to the -[`syscall`], [`sc`], and [`scall`] crates, though `rustix` can use either the -Rust `asm!` macro or out-of-line `.s` files so it supports Rust versions from -1.63 through Nightly and architectures where Rust's inline asm is not yet -stable. `rustix` can also use Linux's vDSO mechanism to optimize Linux -`clock_gettime` on all architectures, and all Linux system calls on x86. And -`rustix`'s syscalls report errors using an optimized `Errno` type. +[`syscall`], [`sc`], and [`scall`] crates, using the Rust `asm!` macro. +`rustix` can also use Linux's vDSO mechanism to optimize Linux `clock_gettime` +on all architectures, and all Linux system calls on x86. And `rustix`'s +syscalls report errors using an optimized `Errno` type. `rustix`'s `*at` functions are similar to the [`openat`] crate, but `rustix` provides them as free functions rather than associated functions of a `Dir` diff --git a/vendor/rustix/build.rs b/vendor/rustix/build.rs index 26f306e58..cf7cf6edf 100644 --- a/vendor/rustix/build.rs +++ b/vendor/rustix/build.rs @@ -1,36 +1,20 @@ -#[cfg(feature = "cc")] -use cc::Build; use std::env::var; use std::io::Write; -/// The directory for out-of-line (“outline”) libraries. -const OUTLINE_PATH: &str = "src/backend/linux_raw/arch/outline"; - /// The directory for inline asm. -const INLINE_PATH: &str = "src/backend/linux_raw/arch/inline"; +const ASM_PATH: &str = "src/backend/linux_raw/arch/asm"; fn main() { // Don't rerun this on changes other than build.rs, as we only depend on // the rustc version. println!("cargo:rerun-if-changed=build.rs"); - use_feature_or_nothing("rustc_attrs"); - - // Features only used in no-std configurations. - #[cfg(not(feature = "std"))] - { - use_feature_or_nothing("const_raw_ptr_deref"); - use_feature_or_nothing("core_ffi_c"); - use_feature_or_nothing("core_c_str"); - use_feature_or_nothing("alloc_c_string"); - } - // Gather target information. let arch = var("CARGO_CFG_TARGET_ARCH").unwrap(); - let outline_asm_name = format!("{}/{}.s", OUTLINE_PATH, arch); - let inline_asm_name = format!("{}/{}.rs", INLINE_PATH, arch); + let env = var("CARGO_CFG_TARGET_ENV").unwrap(); + let inline_asm_name = format!("{}/{}.rs", ASM_PATH, arch); let inline_asm_name_present = std::fs::metadata(inline_asm_name).is_ok(); - let target_os = var("CARGO_CFG_TARGET_OS").unwrap(); + let os = var("CARGO_CFG_TARGET_OS").unwrap(); let pointer_width = var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap(); let endian = var("CARGO_CFG_TARGET_ENDIAN").unwrap(); @@ -38,8 +22,8 @@ fn main() { let is_x32 = arch == "x86_64" && pointer_width == "32"; let is_arm64_ilp32 = arch == "aarch64" && pointer_width == "32"; let is_powerpc64be = arch == "powerpc64" && endian == "big"; - let is_mipseb = arch == "mips" && endian == "big"; - let is_mips64eb = arch == "mips64" && endian == "big"; + let is_mipseb = (arch == "mips" || arch == "mips32r6") && endian == "big"; + let is_mips64eb = arch.contains("mips64") && endian == "big"; let is_unsupported_abi = is_x32 || is_arm64_ilp32 || is_powerpc64be || is_mipseb || is_mips64eb; // Check for `--features=use-libc`. This allows crate users to enable the @@ -50,6 +34,13 @@ 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 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 + // `--all-features`. + let rustix_use_experimental_features = + var("CARGO_CFG_RUSTIX_USE_EXPERIMENTAL_FEATURES").is_ok(); + // Check for eg. `RUSTFLAGS=--cfg=rustix_use_experimental_asm`. This is a // rustc flag rather than a cargo feature flag because it's experimental // and not something we want accidentally enabled via `--all-features`. @@ -59,43 +50,49 @@ fn main() { // libc FFI calls, so if we're running under miri, use the libc backend. let miri = var("CARGO_CFG_MIRI").is_ok(); + // If experimental features are enabled, auto-detect and use available + // features. + if rustix_use_experimental_features { + use_feature_or_nothing("rustc_attrs"); + use_feature_or_nothing("core_intrinsics"); + } + + // Features needed only in no-std configurations. + #[cfg(not(feature = "std"))] + { + use_feature_or_nothing("core_c_str"); + use_feature_or_nothing("core_ffi_c"); + use_feature_or_nothing("alloc_c_string"); + use_feature_or_nothing("alloc_ffi"); + } + + // Feature needed for testing. + if use_static_assertions() { + use_feature("static_assertions"); + } + // 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. // // For now Android uses the libc backend; in theory it could use the // linux_raw backend, but to do that we'll need to figure out how to // install the toolchain for it. - if feature_use_libc + let libc = feature_use_libc || cfg_use_libc - || target_os != "linux" + || os != "linux" || !inline_asm_name_present || is_unsupported_abi || miri - { + || ((arch == "powerpc64" || arch == "mips" || arch == "mips64" || arch == "mips64r6") + && !rustix_use_experimental_asm); + if libc { // Use the libc backend. use_feature("libc"); } else { // Use the linux_raw backend. use_feature("linux_raw"); - use_feature_or_nothing("core_intrinsics"); - - // Use inline asm if we have it, or outline asm otherwise. On 32-bit - // x86 our asm support requires naked functions. On PowerPC and MIPS, - // Rust's inline asm is considered experimental, so only use it if - // `--cfg=rustix_use_experimental_asm` is given. - if (arch != "x86" || has_feature("naked_functions")) - && ((arch != "powerpc64" && arch != "mips" && arch != "mips64") - || rustix_use_experimental_asm) - { - use_feature("asm"); - if arch == "x86" { - use_feature("naked_functions"); - } - if rustix_use_experimental_asm { - use_feature("asm_experimental_arch"); - } - } else { - link_in_librustix_outline(&arch, &outline_asm_name); + if rustix_use_experimental_asm { + use_feature("asm_experimental_arch"); } } @@ -106,44 +103,50 @@ fn main() { // Rust's libc crate groups some OS's together which have similar APIs; // create similarly-named features to make `cfg` tests more concise. - if target_os == "freebsd" || target_os == "dragonfly" { + let freebsdlike = os == "freebsd" || os == "dragonfly"; + if freebsdlike { use_feature("freebsdlike"); } - if target_os == "openbsd" || target_os == "netbsd" { + let netbsdlike = os == "openbsd" || os == "netbsd"; + if netbsdlike { use_feature("netbsdlike"); } - if target_os == "macos" || target_os == "ios" || target_os == "tvos" || target_os == "watchos" { + let apple = os == "macos" || os == "ios" || os == "tvos" || os == "watchos"; + if apple { use_feature("apple"); } - if target_os == "linux" - || target_os == "l4re" - || target_os == "android" - || target_os == "emscripten" - { + if os == "linux" || os == "l4re" || os == "android" || os == "emscripten" { use_feature("linux_like"); } - if target_os == "solaris" || target_os == "illumos" { + if os == "solaris" || os == "illumos" { use_feature("solarish"); } - if target_os == "macos" - || target_os == "ios" - || target_os == "tvos" - || target_os == "watchos" - || target_os == "freebsd" - || target_os == "dragonfly" - || target_os == "openbsd" - || target_os == "netbsd" - { + if apple || freebsdlike || netbsdlike { use_feature("bsd"); } // Add some additional common target combinations. - if target_os == "android" || target_os == "linux" { + + // Android and "regular" Linux both use the Linux kernel. + if os == "android" || os == "linux" { use_feature("linux_kernel"); } - if target_os == "wasi" { - use_feature_or_nothing("wasi_ext"); + // These platforms have a 32-bit `time_t`. + if libc + && (arch == "arm" + || arch == "mips" + || arch == "sparc" + || arch == "x86" + || (arch == "wasm32" && os == "emscripten")) + && (apple + || os == "android" + || os == "emscripten" + || os == "haiku" + || env == "gnu" + || (env == "musl" && arch == "x86")) + { + use_feature("fix_y2038"); } println!("cargo:rerun-if-env-changed=CARGO_CFG_RUSTIX_USE_EXPERIMENTAL_ASM"); @@ -156,59 +159,9 @@ fn main() { println!("cargo:rerun-if-env-changed=CARGO_CFG_MIRI"); } -/// Link in the desired version of librustix_outline_{arch}.a, containing the -/// outline assembly code for making syscalls. -fn link_in_librustix_outline(arch: &str, asm_name: &str) { - let name = format!("rustix_outline_{}", arch); - let profile = var("PROFILE").unwrap(); - let to = format!("{}/{}/lib{}.a", OUTLINE_PATH, profile, name); - println!("cargo:rerun-if-changed={}", to); - - // If "cc" is not enabled, use a pre-built library. - #[cfg(not(feature = "cc"))] - { - let _ = asm_name; - println!("cargo:rustc-link-search={}/{}", OUTLINE_PATH, profile); - println!("cargo:rustc-link-lib=static={}", name); - } - - // If "cc" is enabled, build the library from source, update the pre-built - // version, and assert that the pre-built version is checked in. - #[cfg(feature = "cc")] - { - let out_dir = var("OUT_DIR").unwrap(); - // Add `-gdwarf-3` so that we always get the same output, regardless of - // the Rust version we're using. DWARF3 is entirely adequate for our - // simple needs here. - let mut build = Build::new(); - if profile == "debug" { - build.flag("-gdwarf-3"); - } - build.file(&asm_name); - build.compile(&name); - println!("cargo:rerun-if-changed={}", asm_name); - if std::fs::metadata(".git").is_ok() { - let from = format!("{}/lib{}.a", out_dir, name); - let prev_metadata = std::fs::metadata(&to); - std::fs::copy(&from, &to).unwrap(); - assert!( - prev_metadata.is_ok(), - "{} didn't previously exist; please inspect the new file and `git add` it", - to - ); - assert!( - std::process::Command::new("git") - .arg("diff") - .arg("--quiet") - .arg(&to) - .status() - .unwrap() - .success(), - "{} changed; please inspect the change and `git commit` it", - to - ); - } - } +fn use_static_assertions() -> bool { + // `offset_from` was made const in Rust 1.65. + can_compile("const unsafe fn foo(p: *const u8) -> isize { p.offset_from(p) }") } fn use_thumb_mode() -> bool { @@ -242,8 +195,8 @@ fn can_compile>(test: T) -> bool { let rustc = var("RUSTC").unwrap(); let target = var("TARGET").unwrap(); - // Use `RUSTC_WRAPPER` if it's set, unless it's set to an empty string, - // as documented [here]. + // Use `RUSTC_WRAPPER` if it's set, unless it's set to an empty string, as + // documented [here]. // [here]: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-reads let wrapper = var("RUSTC_WRAPPER") .ok() diff --git a/vendor/rustix/src/backend/libc/c.rs b/vendor/rustix/src/backend/libc/c.rs index 90d3c26f3..f9e94416c 100644 --- a/vendor/rustix/src/backend/libc/c.rs +++ b/vendor/rustix/src/backend/libc/c.rs @@ -12,10 +12,6 @@ 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; -// Submitted upstream in . -#[cfg(all(linux_kernel, feature = "net"))] -pub(crate) const IPPROTO_ETHERNET: c_int = linux_raw_sys::net::IPPROTO_ETHERNET as _; - // 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 _; @@ -66,7 +62,9 @@ pub(crate) const ETH_P_MCTP: c_int = linux_raw_sys::if_ether::ETH_P_MCTP as _; linux_kernel, any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ) @@ -97,8 +95,6 @@ pub(crate) use { #[cfg(target_os = "vxworks")] pub(super) use libc::_Vx_ticks64_t as _Vx_ticks_t; -#[cfg(target_os = "aix")] -pub(super) use libc::blksize64_t as blksize_t; #[cfg(linux_kernel)] pub(super) use libc::fallocate64 as fallocate; #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))] @@ -108,7 +104,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}; -#[cfg(any(linux_like, target_os = "aix"))] +#[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, +}; +#[cfg(linux_like)] pub(super) use libc::{ fstat64 as fstat, fstatat64 as fstatat, fstatfs64 as fstatfs, fstatvfs64 as fstatvfs, ftruncate64 as ftruncate, getrlimit64 as getrlimit, ino64_t as ino_t, lseek64 as lseek, @@ -121,12 +125,19 @@ pub(super) use libc::{ host_info64_t as host_info_t, host_statistics64 as host_statistics, vm_statistics64_t as vm_statistics_t, }; -#[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))] +#[cfg(not(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) +)))] #[cfg(any(linux_like, target_os = "aix"))] pub(super) use libc::{lstat64 as lstat, stat64 as stat}; #[cfg(any(linux_kernel, target_os = "aix", target_os = "emscripten"))] pub(super) use libc::{pread64 as pread, pwrite64 as pwrite}; -#[cfg(any(target_os = "aix", target_os = "linux", target_os = "emscripten"))] +#[cfg(any(target_os = "linux", target_os = "emscripten"))] pub(super) use libc::{preadv64 as preadv, pwritev64 as pwritev}; #[cfg(all(target_os = "linux", target_env = "gnu"))] diff --git a/vendor/rustix/src/backend/libc/conv.rs b/vendor/rustix/src/backend/libc/conv.rs index d6bcc16ee..baf2a05ed 100644 --- a/vendor/rustix/src/backend/libc/conv.rs +++ b/vendor/rustix/src/backend/libc/conv.rs @@ -2,10 +2,10 @@ //! `c_uint`, or libc-specific pointer types. This module provides functions //! for converting between rustix's types and libc types. -#![allow(dead_code)] - use super::c; -use super::fd::{AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, LibcFd, OwnedFd, RawFd}; +#[cfg(not(any(windows, target_os = "espidf")))] +use super::fd::IntoRawFd; +use super::fd::{AsRawFd, BorrowedFd, FromRawFd, LibcFd, OwnedFd, RawFd}; #[cfg(not(windows))] use crate::ffi::CStr; use crate::io; @@ -16,7 +16,7 @@ pub(super) fn c_str(c: &CStr) -> *const c::c_char { c.as_ptr() } -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))] #[inline] pub(super) fn no_fd() -> LibcFd { -1 @@ -27,6 +27,7 @@ pub(super) fn borrowed_fd(fd: BorrowedFd<'_>) -> LibcFd { fd.as_raw_fd() as LibcFd } +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox")))] #[inline] pub(super) fn owned_fd(fd: OwnedFd) -> LibcFd { fd.into_raw_fd() as LibcFd @@ -41,6 +42,7 @@ pub(super) fn ret(raw: c::c_int) -> io::Result<()> { } } +#[cfg(apple)] #[inline] pub(super) fn nonnegative_ret(raw: c::c_int) -> io::Result<()> { if raw >= 0 { @@ -50,6 +52,7 @@ pub(super) fn nonnegative_ret(raw: c::c_int) -> io::Result<()> { } } +#[cfg(not(any(windows, target_os = "wasi")))] #[inline] pub(super) unsafe fn ret_infallible(raw: c::c_int) { debug_assert_eq!(raw, 0, "unexpected error: {:?}", io::Errno::last_os_error()); @@ -64,6 +67,7 @@ pub(super) fn ret_c_int(raw: c::c_int) -> io::Result { } } +#[cfg(linux_kernel)] #[inline] pub(super) fn ret_u32(raw: c::c_int) -> io::Result { if raw == -1 { @@ -94,7 +98,7 @@ pub(super) fn ret_off_t(raw: c::off_t) -> io::Result { } } -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "wasi")))] #[inline] pub(super) fn ret_pid_t(raw: c::pid_t) -> io::Result { if raw == -1 { @@ -119,6 +123,7 @@ pub(super) unsafe fn ret_owned_fd(raw: LibcFd) -> io::Result { } } +#[cfg(not(any(windows, target_os = "wasi")))] #[inline] pub(super) fn ret_discarded_fd(raw: LibcFd) -> io::Result<()> { if raw == !0 { @@ -128,6 +133,7 @@ pub(super) fn ret_discarded_fd(raw: LibcFd) -> io::Result<()> { } } +#[cfg(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() { @@ -138,7 +144,7 @@ pub(super) fn ret_discarded_char_ptr(raw: *mut c::c_char) -> io::Result<()> { } /// Convert the buffer-length argument value of a `send` or `recv` call. -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] #[inline] pub(super) fn send_recv_len(len: usize) -> usize { len @@ -155,7 +161,7 @@ pub(super) fn send_recv_len(len: usize) -> i32 { } /// Convert the return value of a `send` or `recv` call. -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] #[inline] pub(super) fn ret_send_recv(len: isize) -> io::Result { ret_usize(len) @@ -170,7 +176,7 @@ pub(super) fn ret_send_recv(len: i32) -> io::Result { /// Convert the value to the `msg_iovlen` field of a `msghdr` struct. #[cfg(all( - not(any(windows, target_os = "wasi")), + not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")), any( target_os = "android", all(target_os = "linux", not(target_env = "musl")) @@ -183,7 +189,7 @@ pub(super) fn msg_iov_len(len: usize) -> c::size_t { /// Convert the value to the `msg_iovlen` field of a `msghdr` struct. #[cfg(all( - not(any(windows, target_os = "wasi")), + not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")), not(any( target_os = "android", all(target_os = "linux", not(target_env = "musl")) @@ -200,8 +206,9 @@ pub(crate) fn msg_iov_len(len: usize) -> c::c_int { solarish, target_env = "musl", target_os = "emscripten", + target_os = "fuchsia", target_os = "haiku", - target_os = "fuchsia" + target_os = "nto", ))] #[inline] pub(crate) fn msg_control_len(len: usize) -> c::socklen_t { @@ -212,12 +219,15 @@ pub(crate) fn msg_control_len(len: usize) -> c::socklen_t { #[cfg(not(any( bsd, solarish, + windows, target_env = "musl", target_os = "emscripten", - target_os = "haiku", + target_os = "espidf", target_os = "fuchsia", - windows, - target_os = "wasi" + target_os = "haiku", + target_os = "nto", + target_os = "redox", + target_os = "wasi", )))] #[inline] pub(crate) fn msg_control_len(len: usize) -> c::size_t { diff --git a/vendor/rustix/src/backend/libc/event/poll_fd.rs b/vendor/rustix/src/backend/libc/event/poll_fd.rs index 49a6d1126..a06812aaa 100644 --- a/vendor/rustix/src/backend/libc/event/poll_fd.rs +++ b/vendor/rustix/src/backend/libc/event/poll_fd.rs @@ -26,18 +26,20 @@ bitflags! { /// `POLLRDNORM` const RDNORM = c::POLLRDNORM; /// `POLLWRNORM` + #[cfg(not(target_os = "l4re"))] const WRNORM = c::POLLWRNORM; /// `POLLRDBAND` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "l4re", target_os = "wasi")))] const RDBAND = c::POLLRDBAND; /// `POLLWRBAND` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "l4re", target_os = "wasi")))] const WRBAND = c::POLLWRBAND; /// `POLLERR` const ERR = c::POLLERR; /// `POLLHUP` const HUP = c::POLLHUP; /// `POLLNVAL` + #[cfg(not(target_os = "espidf"))] const NVAL = c::POLLNVAL; /// `POLLRDHUP` #[cfg(all( diff --git a/vendor/rustix/src/backend/libc/event/syscalls.rs b/vendor/rustix/src/backend/libc/event/syscalls.rs index 11f6af83e..eac88d4bb 100644 --- a/vendor/rustix/src/backend/libc/event/syscalls.rs +++ b/vendor/rustix/src/backend/libc/event/syscalls.rs @@ -33,7 +33,19 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result ret_owned_fd(eventfd2(initval, bitflags_bits!(flags))) } - #[cfg(any(target_os = "freebsd", target_os = "illumos"))] + // `eventfd` was added in FreeBSD 13, so it isn't available on FreeBSD 12. + #[cfg(target_os = "freebsd")] + unsafe { + weakcall! { + fn eventfd( + initval: c::c_uint, + flags: c::c_int + ) -> c::c_int + } + ret_owned_fd(eventfd(initval, bitflags_bits!(flags))) + } + + #[cfg(target_os = "illumos")] unsafe { ret_owned_fd(c::eventfd(initval, bitflags_bits!(flags))) } diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs index c8a4d77c9..6cfeb242b 100644 --- a/vendor/rustix/src/backend/libc/fs/dir.rs +++ b/vendor/rustix/src/backend/libc/fs/dir.rs @@ -1,4 +1,4 @@ -#[cfg(not(any(solarish, target_os = "haiku")))] +#[cfg(not(any(solarish, target_os = "haiku", target_os = "nto")))] use super::types::FileType; use crate::backend::c; use crate::backend::conv::owned_fd; @@ -9,6 +9,7 @@ use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat}; solarish, target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -94,7 +95,12 @@ impl Dir { check_dirent_layout(dirent); let result = DirEntry { - #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] d_type: dirent.d_type, #[cfg(not(any(freebsdlike, netbsdlike)))] @@ -122,6 +128,7 @@ impl Dir { solarish, target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -180,7 +187,7 @@ impl fmt::Debug for Dir { /// `struct dirent` #[derive(Debug)] pub struct DirEntry { - #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku", target_os = "nto")))] d_type: u8, #[cfg(not(any(freebsdlike, netbsdlike)))] @@ -200,7 +207,7 @@ impl DirEntry { } /// Returns the type of this directory entry. - #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku", target_os = "nto")))] #[inline] pub fn file_type(&self) -> FileType { FileType::from_dirent_d_type(self.d_type) @@ -242,11 +249,13 @@ struct libc_dirent { #[cfg(target_os = "openbsd")] fn check_dirent_layout(dirent: &c::dirent) { use crate::utils::as_ptr; - use core::mem::{align_of, size_of}; // Check that the basic layouts match. - assert_eq!(size_of::(), size_of::()); - assert_eq!(align_of::(), align_of::()); + #[cfg(test)] + { + assert_eq_size!(libc_dirent, c::dirent); + assert_eq_size!(libc_dirent, c::dirent); + } // Check that the field offsets match. assert_eq!( diff --git a/vendor/rustix/src/backend/libc/fs/mod.rs b/vendor/rustix/src/backend/libc/fs/mod.rs index 28579c993..17b4da70f 100644 --- a/vendor/rustix/src/backend/libc/fs/mod.rs +++ b/vendor/rustix/src/backend/libc/fs/mod.rs @@ -1,8 +1,13 @@ -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub(crate) mod dir; #[cfg(linux_kernel)] pub mod inotify; -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "redox", + target_os = "wasi" +)))] pub(crate) mod makedev; #[cfg(not(windows))] pub(crate) mod syscalls; diff --git a/vendor/rustix/src/backend/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs index bdba777e9..698bf34ad 100644 --- a/vendor/rustix/src/backend/libc/fs/syscalls.rs +++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs @@ -13,21 +13,24 @@ use crate::ffi::CString; netbsdlike, solarish, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] use crate::fs::Advice; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] use crate::fs::AtFlags; #[cfg(not(any( netbsdlike, solarish, target_os = "aix", target_os = "dragonfly", + target_os = "espidf", + target_os = "nto", target_os = "redox", )))] use crate::fs::FallocateFlags; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] use crate::fs::FlockOperation; #[cfg(any(linux_kernel, target_os = "freebsd"))] use crate::fs::MemfdFlags; @@ -35,30 +38,26 @@ use crate::fs::MemfdFlags; use crate::fs::SealFlags; #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] use crate::fs::StatFs; -use crate::fs::{Access, Mode, OFlags, SeekFrom, Stat, Timestamps}; -#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))] +#[cfg(not(target_os = "espidf"))] +use crate::fs::{Access, Timestamps}; +#[cfg(not(any(apple, target_os = "espidf", target_os = "redox", target_os = "wasi")))] use crate::fs::{Dev, FileType}; +use crate::fs::{Mode, OFlags, SeekFrom, Stat}; #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] use crate::fs::{StatVfs, StatVfsMountFlags}; use crate::io; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] use crate::timespec::LibcTimespec; #[cfg(not(target_os = "wasi"))] use crate::ugid::{Gid, Uid}; -#[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -)))] -use crate::utils::as_ptr; #[cfg(apple)] use alloc::vec; use core::mem::MaybeUninit; @@ -75,15 +74,9 @@ use { core::ptr::null, }; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __utimensat64(c::c_int, *const c::c_char, *const LibcTimespec, c::c_int) -> c::c_int); -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int); /// Use a direct syscall (via libc) for `open`. @@ -91,14 +84,25 @@ weak!(fn __futimens64(c::c_int, *const LibcTimespec) -> c::c_int); /// This is only currently necessary as a workaround for old glibc; see below. #[cfg(all(unix, target_env = "gnu"))] fn open_via_syscall(path: &CStr, oflags: OFlags, mode: Mode) -> io::Result { - // Linux on aarch64 and riscv64 has no `open` syscall so use `openat`. - #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] + // Linux on aarch64, loongarch64 and riscv64 has no `open` syscall so use + // `openat`. + #[cfg(any( + target_arch = "aarch64", + target_arch = "riscv32", + target_arch = "riscv64", + target_arch = "loongarch64" + ))] { openat_via_syscall(CWD, path, oflags, mode) } // Use the `open` syscall. - #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))] + #[cfg(not(any( + target_arch = "aarch64", + target_arch = "riscv32", + target_arch = "riscv64", + target_arch = "loongarch64" + )))] unsafe { syscall! { fn open( @@ -216,8 +220,10 @@ pub(crate) fn openat( #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -243,11 +249,9 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result { #[inline] pub(crate) fn readlink(path: &CStr, buf: &mut [u8]) -> io::Result { unsafe { - ret_usize(c::readlink( - c_str(path), - buf.as_mut_ptr().cast::(), - buf.len(), - )) + ret_usize( + c::readlink(c_str(path), buf.as_mut_ptr().cast::(), buf.len()) as isize, + ) } } @@ -264,7 +268,7 @@ pub(crate) fn readlinkat( c_str(path), buf.as_mut_ptr().cast::(), buf.len(), - )) + ) as isize) } } @@ -308,7 +312,7 @@ pub(crate) fn link(old_path: &CStr, new_path: &CStr) -> io::Result<()> { unsafe { ret(c::link(c_str(old_path), c_str(new_path))) } } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub(crate) fn linkat( old_dirfd: BorrowedFd<'_>, old_path: &CStr, @@ -371,7 +375,7 @@ pub(crate) fn unlink(path: &CStr) -> io::Result<()> { unsafe { ret(c::unlink(c_str(path))) } } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub(crate) fn unlinkat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<()> { // macOS <= 10.9 lacks `unlinkat`. #[cfg(target_os = "macos")] @@ -533,7 +537,14 @@ pub(crate) fn symlinkat( pub(crate) fn stat(path: &CStr) -> io::Result { // See the comments in `fstat` about using `crate::fs::statx` here. - #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))] + #[cfg(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + ))] { match crate::fs::statx( crate::fs::CWD, @@ -549,7 +560,14 @@ pub(crate) fn stat(path: &CStr) -> io::Result { // Main version: libc is y2038 safe. Or, the platform is not y2038 safe and // there's nothing practical we can do. - #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))] + #[cfg(not(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + )))] unsafe { let mut stat = MaybeUninit::::uninit(); ret(c::stat(c_str(path), stat.as_mut_ptr()))?; @@ -559,7 +577,14 @@ pub(crate) fn stat(path: &CStr) -> io::Result { pub(crate) fn lstat(path: &CStr) -> io::Result { // See the comments in `fstat` about using `crate::fs::statx` here. - #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))] + #[cfg(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + ))] { match crate::fs::statx( crate::fs::CWD, @@ -568,14 +593,21 @@ pub(crate) fn lstat(path: &CStr) -> io::Result { StatxFlags::BASIC_STATS, ) { Ok(x) => statx_to_stat(x), - Err(io::Errno::NOSYS) => statat_old(crate::fs::CWD, path, AtFlags::empty()), + Err(io::Errno::NOSYS) => statat_old(crate::fs::CWD, path, AtFlags::SYMLINK_NOFOLLOW), Err(err) => Err(err), } } // Main version: libc is y2038 safe. Or, the platform is not y2038 safe and // there's nothing practical we can do. - #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))] + #[cfg(not(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + )))] unsafe { let mut stat = MaybeUninit::::uninit(); ret(c::lstat(c_str(path), stat.as_mut_ptr()))?; @@ -583,10 +615,17 @@ pub(crate) fn lstat(path: &CStr) -> io::Result { } } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result { // See the comments in `fstat` about using `crate::fs::statx` here. - #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))] + #[cfg(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + ))] { match crate::fs::statx(dirfd, path, flags, StatxFlags::BASIC_STATS) { Ok(x) => statx_to_stat(x), @@ -597,7 +636,14 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io:: // Main version: libc is y2038 safe. Or, the platform is not y2038 safe and // there's nothing practical we can do. - #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))] + #[cfg(not(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + )))] unsafe { let mut stat = MaybeUninit::::uninit(); ret(c::fstatat( @@ -610,7 +656,14 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io:: } } -#[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))] +#[cfg(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) +))] fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result { unsafe { let mut result = MaybeUninit::::uninit(); @@ -624,12 +677,12 @@ fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result< } } -#[cfg(not(target_os = "emscripten"))] +#[cfg(not(any(target_os = "espidf", target_os = "emscripten")))] pub(crate) fn access(path: &CStr, access: Access) -> io::Result<()> { unsafe { ret(c::access(c_str(path), access.bits())) } } -#[cfg(not(any(target_os = "emscripten", target_os = "redox")))] +#[cfg(not(any(target_os = "emscripten", target_os = "espidf", target_os = "redox")))] pub(crate) fn accessat( dirfd: BorrowedFd<'_>, path: &CStr, @@ -695,47 +748,43 @@ pub(crate) fn accessat( Ok(()) } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub(crate) fn utimensat( dirfd: BorrowedFd<'_>, path: &CStr, times: &Timestamps, flags: AtFlags, ) -> io::Result<()> { - // 32-bit gnu version: libc has `utimensat` but it is not y2038 safe by - // default. - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { + // Old 32-bit version: libc has `utimensat` but it is not y2038 safe by + // default. But there may be a `__utimensat16` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_utimensat) = __utimensat64.get() { let libc_times: [LibcTimespec; 2] = [ times.last_access.clone().into(), times.last_modification.clone().into(), ]; - ret(libc_utimensat( - borrowed_fd(dirfd), - c_str(path), - libc_times.as_ptr(), - bitflags_bits!(flags), - )) - } else { - utimensat_old(dirfd, path, times, flags) + unsafe { + return ret(libc_utimensat( + borrowed_fd(dirfd), + c_str(path), + libc_times.as_ptr(), + bitflags_bits!(flags), + )); + } } + + utimensat_old(dirfd, path, times, flags) } // Main version: libc is y2038 safe and has `utimensat`. Or, the platform // is not y2038 safe and there's nothing practical we can do. - #[cfg(not(any( - apple, - all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ) - )))] + #[cfg(not(any(apple, fix_y2038)))] unsafe { + use crate::utils::as_ptr; + // Assert that `Timestamps` has the expected layout. let _ = core::mem::transmute::(times.clone()); @@ -747,9 +796,11 @@ pub(crate) fn utimensat( )) } - // `utimensat` was introduced in macOS 10.13. + // Apple version: `utimensat` was introduced in macOS 10.13. #[cfg(apple)] unsafe { + use crate::utils::as_ptr; + // ABI details weak! { fn utimensat( @@ -863,11 +914,8 @@ pub(crate) fn utimensat( } } -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] -unsafe fn utimensat_old( +#[cfg(fix_y2038)] +fn utimensat_old( dirfd: BorrowedFd<'_>, path: &CStr, times: &Timestamps, @@ -891,12 +939,14 @@ unsafe fn utimensat_old( tv_nsec: times.last_modification.tv_nsec, }, ]; - ret(c::utimensat( - borrowed_fd(dirfd), - c_str(path), - old_times.as_ptr(), - bitflags_bits!(flags), - )) + unsafe { + ret(c::utimensat( + borrowed_fd(dirfd), + c_str(path), + old_times.as_ptr(), + bitflags_bits!(flags), + )) + } } #[cfg(not(target_os = "wasi"))] @@ -904,7 +954,12 @@ pub(crate) fn chmod(path: &CStr, mode: Mode) -> io::Result<()> { unsafe { ret(c::chmod(c_str(path), mode.bits() as c::mode_t)) } } -#[cfg(not(any(linux_kernel, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + linux_kernel, + target_os = "espidf", + target_os = "redox", + target_os = "wasi" +)))] pub(crate) fn chmodat( dirfd: BorrowedFd<'_>, path: &CStr, @@ -982,7 +1037,7 @@ pub(crate) fn fclonefileat( } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn chownat( dirfd: BorrowedFd<'_>, path: &CStr, @@ -1002,7 +1057,7 @@ pub(crate) fn chownat( } } -#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(apple, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn mknodat( dirfd: BorrowedFd<'_>, path: &CStr, @@ -1039,7 +1094,8 @@ pub(crate) fn copy_file_range( ) via SYS_copy_file_range -> c::ssize_t } - assert_eq!(size_of::(), size_of::()); + #[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; @@ -1080,6 +1136,7 @@ pub(crate) fn copy_file_range( netbsdlike, solarish, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] @@ -1135,6 +1192,7 @@ pub(crate) fn fcntl_add_seals(fd: BorrowedFd<'_>, seals: SealFlags) -> io::Resul #[cfg(not(any( target_os = "emscripten", + target_os = "espidf", target_os = "fuchsia", target_os = "redox", target_os = "wasi" @@ -1168,7 +1226,7 @@ pub(crate) fn fcntl_lock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::R } pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result { - let (whence, offset): (c::c_int, c::off_t) = match pos { + let (whence, offset) = match pos { SeekFrom::Start(pos) => { let pos: u64 = pos; // Silently cast; we'll get `EINVAL` if the value is negative. @@ -1181,6 +1239,11 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result { #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))] SeekFrom::Hole(offset) => (c::SEEK_HOLE, offset), }; + + // ESP-IDF doesn't support 64-bit offsets. + #[cfg(target_os = "espidf")] + let offset: i32 = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?; + let offset = unsafe { ret_off_t(c::lseek(borrowed_fd(fd), offset, whence))? }; Ok(offset as u64) } @@ -1237,7 +1300,7 @@ pub(crate) fn fchown(fd: BorrowedFd<'_>, owner: Option, group: Option) } } -#[cfg(not(any(target_os = "solaris", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "solaris", target_os = "wasi")))] pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> { unsafe { ret(c::flock(borrowed_fd(fd), operation as c::c_int)) } } @@ -1259,7 +1322,7 @@ pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> { unsafe { ret(syncfs(borrowed_fd(fd))) } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn sync() { unsafe { c::sync() } } @@ -1271,7 +1334,14 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result { // And, some old platforms don't support `statx`, and some fail with a // confusing error code, so we call `crate::fs::statx` to handle that. If // `statx` isn't available, fall back to the buggy system call. - #[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))] + #[cfg(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + ))] { match crate::fs::statx(fd, cstr!(""), AtFlags::EMPTY_PATH, StatxFlags::BASIC_STATS) { Ok(x) => statx_to_stat(x), @@ -1282,7 +1352,14 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result { // Main version: libc is y2038 safe. Or, the platform is not y2038 safe and // there's nothing practical we can do. - #[cfg(not(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64"))))] + #[cfg(not(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) + )))] unsafe { let mut stat = MaybeUninit::::uninit(); ret(c::fstat(borrowed_fd(fd), stat.as_mut_ptr()))?; @@ -1290,7 +1367,14 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result { } } -#[cfg(all(linux_kernel, any(target_pointer_width = "32", target_arch = "mips64")))] +#[cfg(all( + linux_kernel, + any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ) +))] fn fstat_old(fd: BorrowedFd<'_>) -> io::Result { unsafe { let mut result = MaybeUninit::::uninit(); @@ -1301,8 +1385,10 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result { #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -1340,44 +1426,44 @@ fn libc_statvfs_to_statvfs(from: c::statvfs) -> StatVfs { } } +#[cfg(not(target_os = "espidf"))] pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> { - // 32-bit gnu version: libc has `futimens` but it is not y2038 safe by default. - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { + // Old 32-bit version: libc has `futimens` but it is not y2038 safe by + // default. But there may be a `__futimens64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_futimens) = __futimens64.get() { let libc_times: [LibcTimespec; 2] = [ times.last_access.clone().into(), times.last_modification.clone().into(), ]; - ret(libc_futimens(borrowed_fd(fd), libc_times.as_ptr())) - } else { - futimens_old(fd, times) + unsafe { + return ret(libc_futimens(borrowed_fd(fd), libc_times.as_ptr())); + } } + + futimens_old(fd, times) } // Main version: libc is y2038 safe and has `futimens`. Or, the platform // is not y2038 safe and there's nothing practical we can do. - #[cfg(not(any( - apple, - all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ) - )))] + #[cfg(not(any(apple, fix_y2038)))] unsafe { + use crate::utils::as_ptr; + // Assert that `Timestamps` has the expected layout. let _ = core::mem::transmute::(times.clone()); ret(c::futimens(borrowed_fd(fd), as_ptr(times).cast())) } - // `futimens` was introduced in macOS 10.13. + // Apple version: `futimens` was introduced in macOS 10.13. #[cfg(apple)] unsafe { + use crate::utils::as_ptr; + // ABI details. weak! { fn futimens(c::c_int, *const c::timespec) -> c::c_int @@ -1413,11 +1499,8 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> } } -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] -unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> { +#[cfg(fix_y2038)] +fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> { let old_times = [ c::timespec { tv_sec: times @@ -1437,7 +1520,7 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> }, ]; - ret(c::futimens(borrowed_fd(fd), old_times.as_ptr())) + unsafe { ret(c::futimens(borrowed_fd(fd), old_times.as_ptr())) } } #[cfg(not(any( @@ -1446,6 +1529,8 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()> solarish, target_os = "aix", target_os = "dragonfly", + target_os = "espidf", + target_os = "nto", target_os = "redox", )))] pub(crate) fn fallocate( @@ -1520,6 +1605,7 @@ pub(crate) fn fsync(fd: BorrowedFd<'_>) -> io::Result<()> { #[cfg(not(any( apple, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] @@ -1648,7 +1734,7 @@ fn statx_to_stat(x: crate::fs::Statx) -> io::Result { /// Convert from a Linux `statx` value to rustix's `Stat`. /// /// mips64' `struct stat64` in libc has private fields, and `stx_blocks` -#[cfg(all(linux_kernel, target_arch = "mips64"))] +#[cfg(all(linux_kernel, any(target_arch = "mips64", target_arch = "mips64r6")))] fn statx_to_stat(x: crate::fs::Statx) -> io::Result { let mut result: Stat = unsafe { core::mem::zeroed() }; @@ -1720,7 +1806,7 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result { /// /// mips64' `struct stat64` in libc has private fields, and `st_blocks` has /// type `i64`. -#[cfg(all(linux_kernel, target_arch = "mips64"))] +#[cfg(all(linux_kernel, any(target_arch = "mips64", target_arch = "mips64r6")))] fn stat64_to_stat(s64: c::stat64) -> io::Result { let mut result: Stat = unsafe { core::mem::zeroed() }; @@ -1962,6 +2048,22 @@ pub(crate) fn fcntl_fullfsync(fd: BorrowedFd<'_>) -> io::Result<()> { unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_FULLFSYNC)) } } +#[cfg(apple)] +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<()> { + unsafe { + ret(c::fcntl( + borrowed_fd(fd), + c::F_GLOBAL_NOCACHE, + value as c::c_int, + )) + } +} + /// Convert `times` from a `futimens`/`utimensat` argument into `setattrlist` /// arguments. #[cfg(apple)] @@ -2048,30 +2150,6 @@ struct Attrlist { forkattr: Attrgroup, } -#[cfg(linux_kernel)] -pub(crate) fn mount( - source: Option<&CStr>, - target: &CStr, - file_system_type: Option<&CStr>, - flags: super::types::MountFlagsArg, - data: Option<&CStr>, -) -> io::Result<()> { - unsafe { - ret(c::mount( - source.map_or_else(null, CStr::as_ptr), - target.as_ptr(), - file_system_type.map_or_else(null, CStr::as_ptr), - flags.0, - data.map_or_else(null, CStr::as_ptr).cast(), - )) - } -} - -#[cfg(linux_kernel)] -pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> { - unsafe { ret(c::umount2(target.as_ptr(), bitflags_bits!(flags))) } -} - #[cfg(any(apple, linux_kernel))] pub(crate) fn getxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result { let value_ptr = value.as_mut_ptr(); diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs index b52f0e210..955bdaa29 100644 --- a/vendor/rustix/src/backend/libc/fs/types.rs +++ b/vendor/rustix/src/backend/libc/fs/types.rs @@ -1,6 +1,7 @@ use crate::backend::c; use bitflags::bitflags; +#[cfg(not(target_os = "espidf"))] bitflags! { /// `*_OK` constants for use with [`accessat`]. /// @@ -22,7 +23,7 @@ bitflags! { } } -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] bitflags! { /// `AT_*` constants for use with [`openat`], [`statat`], and other `*at` /// functions. @@ -85,67 +86,68 @@ bitflags! { #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct Mode: RawMode { /// `S_IRWXU` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const RWXU = c::S_IRWXU as RawMode; /// `S_IRUSR` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const RUSR = c::S_IRUSR as RawMode; /// `S_IWUSR` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const WUSR = c::S_IWUSR as RawMode; /// `S_IXUSR` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const XUSR = c::S_IXUSR as RawMode; /// `S_IRWXG` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const RWXG = c::S_IRWXG as RawMode; /// `S_IRGRP` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const RGRP = c::S_IRGRP as RawMode; /// `S_IWGRP` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const WGRP = c::S_IWGRP as RawMode; /// `S_IXGRP` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const XGRP = c::S_IXGRP as RawMode; /// `S_IRWXO` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const RWXO = c::S_IRWXO as RawMode; /// `S_IROTH` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const ROTH = c::S_IROTH as RawMode; /// `S_IWOTH` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const WOTH = c::S_IWOTH as RawMode; /// `S_IXOTH` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const XOTH = c::S_IXOTH as RawMode; /// `S_ISUID` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const SUID = c::S_ISUID as RawMode; /// `S_ISGID` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const SGID = c::S_ISGID as RawMode; /// `S_ISVTX` - #[cfg(not(target_os = "wasi"))] // WASI doesn't have Unix-style mode flags. + #[cfg(not(any(target_os = "espidf", target_os = "wasi")))] // WASI doesn't have Unix-style mode flags. const SVTX = c::S_ISVTX as RawMode; } } +#[cfg(not(target_os = "espidf"))] impl Mode { /// Construct a `Mode` from the mode bits of the `st_mode` field of a /// `Stat`. @@ -161,6 +163,7 @@ impl Mode { } } +#[cfg(not(target_os = "espidf"))] impl From for Mode { /// Support conversions from raw mode values to `Mode`. /// @@ -174,6 +177,7 @@ impl From for Mode { } } +#[cfg(not(target_os = "espidf"))] impl From for RawMode { /// Support conversions from `Mode` to raw mode values. /// @@ -214,10 +218,11 @@ bitflags! { const CREATE = bitcast!(c::O_CREAT); /// `O_DIRECTORY` + #[cfg(not(target_os = "espidf"))] const DIRECTORY = bitcast!(c::O_DIRECTORY); /// `O_DSYNC` - #[cfg(not(any(target_os = "dragonfly", target_os = "redox")))] + #[cfg(not(any(target_os = "dragonfly", target_os = "espidf", target_os = "l4re", target_os = "redox")))] const DSYNC = bitcast!(c::O_DSYNC); /// `O_EXCL` @@ -231,6 +236,7 @@ bitflags! { const FSYNC = bitcast!(c::O_FSYNC); /// `O_NOFOLLOW` + #[cfg(not(target_os = "espidf"))] const NOFOLLOW = bitcast!(c::O_NOFOLLOW); /// `O_NONBLOCK` @@ -246,7 +252,7 @@ bitflags! { const RDWR = bitcast!(c::O_RDWR); /// `O_NOCTTY` - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "espidf", target_os = "l4re", target_os = "redox")))] const NOCTTY = bitcast!(c::O_NOCTTY); /// `O_RSYNC` @@ -259,7 +265,7 @@ bitflags! { const RSYNC = bitcast!(c::O_RSYNC); /// `O_SYNC` - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "l4re", target_os = "redox")))] const SYNC = bitcast!(c::O_SYNC); /// `O_TRUNC` @@ -489,7 +495,13 @@ impl FileType { } /// Construct a `FileType` from the `d_type` field of a `c::dirent`. - #[cfg(not(any(solarish, target_os = "haiku", target_os = "redox")))] + #[cfg(not(any( + solarish, + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "redox" + )))] #[inline] pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self { match d_type { @@ -516,6 +528,7 @@ impl FileType { netbsdlike, solarish, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] @@ -725,7 +738,14 @@ bitflags! { } } -#[cfg(not(any(netbsdlike, solarish, target_os = "aix", target_os = "redox")))] +#[cfg(not(any( + netbsdlike, + solarish, + target_os = "aix", + target_os = "espidf", + target_os = "nto", + target_os = "redox" +)))] bitflags! { /// `FALLOC_FL_*` constants for use with [`fallocate`]. /// @@ -753,10 +773,11 @@ bitflags! { #[cfg(not(any( bsd, target_os = "aix", - target_os = "haiku", - target_os = "linux", target_os = "emscripten", target_os = "fuchsia", + target_os = "haiku", + target_os = "l4re", + target_os = "linux", target_os = "wasi", )))] const NO_HIDE_STALE = bitcast!(c::FALLOC_FL_NO_HIDE_STALE); @@ -831,9 +852,11 @@ bitflags! { const NOEXEC = c::ST_NOEXEC as u64; /// `ST_NOSUID` + #[cfg(not(target_os = "espidf"))] const NOSUID = c::ST_NOSUID as u64; /// `ST_RDONLY` + #[cfg(not(target_os = "espidf"))] const RDONLY = c::ST_RDONLY as u64; /// `ST_RELATIME` @@ -850,7 +873,7 @@ bitflags! { /// /// [`flock`]: crate::fs::flock /// [`fcntl_lock`]: crate::fs::fcntl_lock -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[repr(u32)] pub enum FlockOperation { @@ -923,8 +946,10 @@ pub struct Stat { #[cfg(not(any( linux_like, solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -1062,10 +1087,16 @@ pub type FsWord = u32; pub type FsWord = u64; /// `__fsword_t` -// s390x uses `u32` for `statfs` entries, even though `__fsword_t` is `u64`. -#[cfg(all(target_os = "linux", target_arch = "s390x"))] +// s390x uses `u32` for `statfs` entries on glibc, even though `__fsword_t` is +// `u64`. +#[cfg(all(target_os = "linux", target_arch = "s390x", target_env = "gnu"))] pub type FsWord = u32; +/// `__fsword_t` +// s390x uses `u64` for `statfs` entries on musl. +#[cfg(all(target_os = "linux", target_arch = "s390x", target_env = "musl"))] +pub type FsWord = u64; + /// `copyfile_state_t`—State for use with [`fcopyfile`]. /// /// [`fcopyfile`]: crate::fs::fcopyfile @@ -1074,112 +1105,3 @@ pub type FsWord = u32; #[repr(transparent)] #[derive(Copy, Clone)] pub struct copyfile_state_t(pub(crate) *mut c::c_void); - -#[cfg(linux_kernel)] -bitflags! { - /// `MS_*` constants for use with [`mount`]. - /// - /// [`mount`]: crate::fs::mount - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct MountFlags: c::c_ulong { - /// `MS_BIND` - const BIND = c::MS_BIND; - - /// `MS_DIRSYNC` - const DIRSYNC = c::MS_DIRSYNC; - - /// `MS_LAZYTIME` - const LAZYTIME = c::MS_LAZYTIME; - - /// `MS_MANDLOCK` - #[doc(alias = "MANDLOCK")] - const PERMIT_MANDATORY_FILE_LOCKING = c::MS_MANDLOCK; - - /// `MS_NOATIME` - const NOATIME = c::MS_NOATIME; - - /// `MS_NODEV` - const NODEV = c::MS_NODEV; - - /// `MS_NODIRATIME` - const NODIRATIME = c::MS_NODIRATIME; - - /// `MS_NOEXEC` - const NOEXEC = c::MS_NOEXEC; - - /// `MS_NOSUID` - const NOSUID = c::MS_NOSUID; - - /// `MS_RDONLY` - const RDONLY = c::MS_RDONLY; - - /// `MS_REC` - const REC = c::MS_REC; - - /// `MS_RELATIME` - const RELATIME = c::MS_RELATIME; - - /// `MS_SILENT` - const SILENT = c::MS_SILENT; - - /// `MS_STRICTATIME` - const STRICTATIME = c::MS_STRICTATIME; - - /// `MS_SYNCHRONOUS` - const SYNCHRONOUS = c::MS_SYNCHRONOUS; - } -} - -#[cfg(linux_kernel)] -bitflags! { - /// `MS_*` constants for use with [`change_mount`]. - /// - /// [`change_mount`]: crate::fs::mount::change_mount - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct MountPropagationFlags: c::c_ulong { - /// `MS_SHARED` - const SHARED = c::MS_SHARED; - /// `MS_PRIVATE` - const PRIVATE = c::MS_PRIVATE; - /// `MS_SLAVE` - const SLAVE = c::MS_SLAVE; - /// `MS_UNBINDABLE` - const UNBINDABLE = c::MS_UNBINDABLE; - /// `MS_REC` - const REC = c::MS_REC; - } -} - -#[cfg(linux_kernel)] -bitflags! { - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub(crate) struct InternalMountFlags: c::c_ulong { - const REMOUNT = c::MS_REMOUNT; - const MOVE = c::MS_MOVE; - } -} - -#[cfg(linux_kernel)] -pub(crate) struct MountFlagsArg(pub(crate) c::c_ulong); - -#[cfg(linux_kernel)] -bitflags! { - /// `MNT_*` constants for use with [`unmount`]. - /// - /// [`unmount`]: crate::fs::mount::unmount - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct UnmountFlags: u32 { - /// `MNT_FORCE` - const FORCE = bitcast!(c::MNT_FORCE); - /// `MNT_DETACH` - const DETACH = bitcast!(c::MNT_DETACH); - /// `MNT_EXPIRE` - const EXPIRE = bitcast!(c::MNT_EXPIRE); - /// `UMOUNT_NOFOLLOW` - const NOFOLLOW = bitcast!(c::UMOUNT_NOFOLLOW); - } -} diff --git a/vendor/rustix/src/backend/libc/io/errno.rs b/vendor/rustix/src/backend/libc/io/errno.rs index 71fba49e9..aabd45f8c 100644 --- a/vendor/rustix/src/backend/libc/io/errno.rs +++ b/vendor/rustix/src/backend/libc/io/errno.rs @@ -28,15 +28,19 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const ADV: Self = Self(c::EADV); /// `EAFNOSUPPORT` + #[cfg(not(target_os = "l4re"))] pub const AFNOSUPPORT: Self = Self(c::EAFNOSUPPORT); /// `EAGAIN` pub const AGAIN: Self = Self(c::EAGAIN); /// `EALREADY` + #[cfg(not(target_os = "l4re"))] pub const ALREADY: Self = Self(c::EALREADY); /// `EAUTH` #[cfg(bsd)] @@ -46,7 +50,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const BADE: Self = Self(c::EBADE); @@ -57,19 +63,23 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const BADFD: Self = Self(c::EBADFD); /// `EBADMSG` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const BADMSG: Self = Self(c::EBADMSG); /// `EBADR` #[cfg(not(any( bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const BADR: Self = Self(c::EBADR); @@ -81,7 +91,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const BADRQC: Self = Self(c::EBADRQC); @@ -90,7 +102,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const BADSLT: Self = Self(c::EBADSLT); @@ -99,7 +113,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const BFONT: Self = Self(c::EBFONT); @@ -107,6 +123,7 @@ impl Errno { #[cfg(not(windows))] pub const BUSY: Self = Self(c::EBUSY); /// `ECANCELED` + #[cfg(not(target_os = "l4re"))] pub const CANCELED: Self = Self(c::ECANCELED); /// `ECAPMODE` #[cfg(target_os = "freebsd")] @@ -115,14 +132,23 @@ impl Errno { #[cfg(not(windows))] pub const CHILD: Self = Self(c::ECHILD); /// `ECHRNG` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const CHRNG: Self = Self(c::ECHRNG); /// `ECOMM` #[cfg(not(any( bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const COMM: Self = Self(c::ECOMM); @@ -141,11 +167,13 @@ impl Errno { windows, target_os = "aix", target_os = "android", + target_os = "espidf", target_os = "haiku", target_os = "wasi", )))] pub const DEADLOCK: Self = Self(c::EDEADLOCK); /// `EDESTADDRREQ` + #[cfg(not(target_os = "l4re"))] pub const DESTADDRREQ: Self = Self(c::EDESTADDRREQ); /// `EDISCON` #[cfg(windows)] @@ -162,7 +190,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const DOTDOT: Self = Self(c::EDOTDOT); @@ -180,7 +211,7 @@ impl Errno { #[cfg(any(bsd, target_env = "newlib"))] pub const FTYPE: Self = Self(c::EFTYPE); /// `EHOSTDOWN` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "l4re", target_os = "wasi")))] pub const HOSTDOWN: Self = Self(c::EHOSTDOWN); /// `EHOSTUNREACH` pub const HOSTUNREACH: Self = Self(c::EHOSTUNREACH); @@ -191,18 +222,22 @@ impl Errno { windows, target_os = "aix", target_os = "android", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] pub const HWPOISON: Self = Self(c::EHWPOISON); /// `EIDRM` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const IDRM: Self = Self(c::EIDRM); /// `EILSEQ` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const ILSEQ: Self = Self(c::EILSEQ); /// `EINPROGRESS` + #[cfg(not(target_os = "l4re"))] pub const INPROGRESS: Self = Self(c::EINPROGRESS); /// `EINTR` /// @@ -223,6 +258,7 @@ impl Errno { #[cfg(not(windows))] pub const IO: Self = Self(c::EIO); /// `EISCONN` + #[cfg(not(target_os = "l4re"))] pub const ISCONN: Self = Self(c::EISCONN); /// `EISDIR` #[cfg(not(windows))] @@ -233,7 +269,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const ISNAM: Self = Self(c::EISNAM); @@ -243,7 +282,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const KEYEXPIRED: Self = Self(c::EKEYEXPIRED); @@ -253,7 +295,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const KEYREJECTED: Self = Self(c::EKEYREJECTED); @@ -263,28 +308,61 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const KEYREVOKED: Self = Self(c::EKEYREVOKED); /// `EL2HLT` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const L2HLT: Self = Self(c::EL2HLT); /// `EL2NSYNC` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const L2NSYNC: Self = Self(c::EL2NSYNC); /// `EL3HLT` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const L3HLT: Self = Self(c::EL3HLT); /// `EL3RST` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const L3RST: Self = Self(c::EL3RST); /// `ELIBACC` #[cfg(not(any( bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const LIBACC: Self = Self(c::ELIBACC); @@ -293,7 +371,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const LIBBAD: Self = Self(c::ELIBBAD); @@ -302,7 +382,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const LIBEXEC: Self = Self(c::ELIBEXEC); @@ -311,7 +393,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const LIBMAX: Self = Self(c::ELIBMAX); @@ -320,12 +404,21 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const LIBSCN: Self = Self(c::ELIBSCN); /// `ELNRNG` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const LNRNG: Self = Self(c::ELNRNG); /// `ELOOP` pub const LOOP: Self = Self(c::ELOOP); @@ -335,7 +428,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const MEDIUMTYPE: Self = Self(c::EMEDIUMTYPE); @@ -345,9 +441,10 @@ impl Errno { #[cfg(not(windows))] pub const MLINK: Self = Self(c::EMLINK); /// `EMSGSIZE` + #[cfg(not(target_os = "l4re"))] pub const MSGSIZE: Self = Self(c::EMSGSIZE); /// `EMULTIHOP` - #[cfg(not(any(windows, target_os = "openbsd")))] + #[cfg(not(any(windows, target_os = "l4re", target_os = "openbsd")))] pub const MULTIHOP: Self = Self(c::EMULTIHOP); /// `ENAMETOOLONG` pub const NAMETOOLONG: Self = Self(c::ENAMETOOLONG); @@ -357,7 +454,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const NAVAIL: Self = Self(c::ENAVAIL); @@ -367,6 +467,7 @@ impl Errno { /// `ENETDOWN` pub const NETDOWN: Self = Self(c::ENETDOWN); /// `ENETRESET` + #[cfg(not(target_os = "l4re"))] pub const NETRESET: Self = Self(c::ENETRESET); /// `ENETUNREACH` pub const NETUNREACH: Self = Self(c::ENETUNREACH); @@ -378,7 +479,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const NOANO: Self = Self(c::ENOANO); @@ -386,9 +489,17 @@ impl Errno { #[cfg(any(bsd, target_os = "haiku"))] pub const NOATTR: Self = Self(c::ENOATTR); /// `ENOBUFS` + #[cfg(not(target_os = "l4re"))] pub const NOBUFS: Self = Self(c::ENOBUFS); /// `ENOCSI` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const NOCSI: Self = Self(c::ENOCSI); /// `ENODATA` #[cfg(not(any( @@ -414,15 +525,18 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const NOKEY: Self = Self(c::ENOKEY); /// `ENOLCK` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const NOLCK: Self = Self(c::ENOLCK); /// `ENOLINK` - #[cfg(not(any(windows, target_os = "openbsd")))] + #[cfg(not(any(windows, target_os = "l4re", target_os = "openbsd")))] pub const NOLINK: Self = Self(c::ENOLINK); /// `ENOMEDIUM` #[cfg(not(any( @@ -430,7 +544,10 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const NOMEDIUM: Self = Self(c::ENOMEDIUM); @@ -441,14 +558,16 @@ impl Errno { #[cfg(windows)] pub const NOMORE: Self = Self(c::ENOMORE); /// `ENOMSG` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const NOMSG: Self = Self(c::ENOMSG); /// `ENONET` #[cfg(not(any( bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const NONET: Self = Self(c::ENONET); @@ -457,11 +576,14 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const NOPKG: Self = Self(c::ENOPKG); /// `ENOPROTOOPT` + #[cfg(not(target_os = "l4re"))] pub const NOPROTOOPT: Self = Self(c::ENOPROTOOPT); /// `ENOSPC` #[cfg(not(windows))] @@ -471,6 +593,7 @@ impl Errno { freebsdlike, windows, target_os = "haiku", + target_os = "l4re", target_os = "openbsd", target_os = "wasi", )))] @@ -480,6 +603,7 @@ impl Errno { freebsdlike, windows, target_os = "haiku", + target_os = "l4re", target_os = "openbsd", target_os = "wasi", )))] @@ -488,7 +612,7 @@ impl Errno { #[cfg(not(windows))] pub const NOSYS: Self = Self(c::ENOSYS); /// `ENOTBLK` - #[cfg(not(any(windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any(windows, target_os = "espidf", target_os = "haiku", target_os = "wasi")))] pub const NOTBLK: Self = Self(c::ENOTBLK); /// `ENOTCAPABLE` #[cfg(any(target_os = "freebsd", target_os = "wasi"))] @@ -506,14 +630,24 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const NOTNAM: Self = Self(c::ENOTNAM); /// `ENOTRECOVERABLE` - #[cfg(not(any(freebsdlike, netbsdlike, windows, target_os = "haiku")))] + #[cfg(not(any( + freebsdlike, + netbsdlike, + windows, + target_os = "haiku", + target_os = "l4re" + )))] pub const NOTRECOVERABLE: Self = Self(c::ENOTRECOVERABLE); /// `ENOTSOCK` + #[cfg(not(target_os = "l4re"))] pub const NOTSOCK: Self = Self(c::ENOTSOCK); /// `ENOTSUP` #[cfg(not(any(windows, target_os = "haiku", target_os = "redox")))] @@ -526,7 +660,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const NOTUNIQ: Self = Self(c::ENOTUNIQ); @@ -536,16 +672,22 @@ impl Errno { /// `EOPNOTSUPP` pub const OPNOTSUPP: Self = Self(c::EOPNOTSUPP); /// `EOVERFLOW` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const OVERFLOW: Self = Self(c::EOVERFLOW); /// `EOWNERDEAD` - #[cfg(not(any(freebsdlike, netbsdlike, windows, target_os = "haiku")))] + #[cfg(not(any( + freebsdlike, + netbsdlike, + windows, + target_os = "haiku", + target_os = "l4re" + )))] pub const OWNERDEAD: Self = Self(c::EOWNERDEAD); /// `EPERM` #[cfg(not(windows))] pub const PERM: Self = Self(c::EPERM); /// `EPFNOSUPPORT` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "l4re", target_os = "wasi")))] pub const PFNOSUPPORT: Self = Self(c::EPFNOSUPPORT); /// `EPIPE` #[cfg(not(windows))] @@ -563,11 +705,13 @@ impl Errno { #[cfg(bsd)] pub const PROGUNAVAIL: Self = Self(c::EPROGUNAVAIL); /// `EPROTO` - #[cfg(not(windows))] + #[cfg(not(any(windows, target_os = "l4re")))] pub const PROTO: Self = Self(c::EPROTO); /// `EPROTONOSUPPORT` + #[cfg(not(target_os = "l4re"))] pub const PROTONOSUPPORT: Self = Self(c::EPROTONOSUPPORT); /// `EPROTOTYPE` + #[cfg(not(target_os = "l4re"))] pub const PROTOTYPE: Self = Self(c::EPROTOTYPE); /// `EPROVIDERFAILEDINIT` #[cfg(windows)] @@ -583,12 +727,19 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const REMCHG: Self = Self(c::EREMCHG); /// `EREMOTE` - #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const REMOTE: Self = Self(c::EREMOTE); /// `EREMOTEIO` #[cfg(not(any( @@ -596,12 +747,22 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const REMOTEIO: Self = Self(c::EREMOTEIO); /// `ERESTART` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const RESTART: Self = Self(c::ERESTART); /// `ERFKILL` #[cfg(not(any( @@ -610,7 +771,10 @@ impl Errno { windows, target_os = "aix", target_os = "android", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -622,10 +786,15 @@ impl Errno { #[cfg(bsd)] pub const RPCMISMATCH: Self = Self(c::ERPCMISMATCH); /// `ESHUTDOWN` - #[cfg(not(target_os = "wasi"))] + #[cfg(not(any(target_os = "espidf", target_os = "l4re", target_os = "wasi")))] pub const SHUTDOWN: Self = Self(c::ESHUTDOWN); /// `ESOCKTNOSUPPORT` - #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const SOCKTNOSUPPORT: Self = Self(c::ESOCKTNOSUPPORT); /// `ESPIPE` #[cfg(not(windows))] @@ -638,7 +807,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const SRMNT: Self = Self(c::ESRMNT); @@ -649,12 +820,20 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const STRPIPE: Self = Self(c::ESTRPIPE); /// `ETIME` - #[cfg(not(any(freebsdlike, windows, target_os = "openbsd", target_os = "wasi")))] + #[cfg(not(any( + freebsdlike, + windows, + target_os = "l4re", + target_os = "openbsd", + target_os = "wasi" + )))] pub const TIME: Self = Self(c::ETIME); /// `ETIMEDOUT` pub const TIMEDOUT: Self = Self(c::ETIMEDOUT); @@ -663,7 +842,7 @@ impl Errno { #[doc(alias = "2BIG")] pub const TOOBIG: Self = Self(c::E2BIG); /// `ETOOMANYREFS` - #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any(target_os = "haiku", target_os = "l4re", target_os = "wasi")))] pub const TOOMANYREFS: Self = Self(c::ETOOMANYREFS); /// `ETXTBSY` #[cfg(not(windows))] @@ -674,15 +853,30 @@ impl Errno { solarish, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", + target_os = "nto", target_os = "wasi", )))] pub const UCLEAN: Self = Self(c::EUCLEAN); /// `EUNATCH` - #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + bsd, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const UNATCH: Self = Self(c::EUNATCH); /// `EUSERS` - #[cfg(not(any(target_os = "haiku", target_os = "wasi")))] + #[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "l4re", + target_os = "wasi" + )))] pub const USERS: Self = Self(c::EUSERS); /// `EWOULDBLOCK` pub const WOULDBLOCK: Self = Self(c::EWOULDBLOCK); @@ -694,7 +888,9 @@ impl Errno { bsd, windows, target_os = "aix", + target_os = "espidf", target_os = "haiku", + target_os = "l4re", target_os = "wasi", )))] pub const XFULL: Self = Self(c::EXFULL); diff --git a/vendor/rustix/src/backend/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs index 6ac1fa593..362af11ee 100644 --- a/vendor/rustix/src/backend/libc/io/syscalls.rs +++ b/vendor/rustix/src/backend/libc/io/syscalls.rs @@ -1,19 +1,28 @@ //! libc syscalls supporting `rustix::io`. -use crate::backend::conv::{ - borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_usize, -}; -use crate::backend::{c, MAX_IOV}; +use crate::backend::c; +#[cfg(not(target_os = "wasi"))] +use crate::backend::conv::ret_discarded_fd; +use crate::backend::conv::{borrowed_fd, ret, ret_c_int, ret_owned_fd, ret_usize}; use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd}; -#[cfg(not(any(target_os = "aix", target_os = "wasi")))] +#[cfg(not(any( + target_os = "aix", + target_os = "espidf", + target_os = "nto", + target_os = "wasi" +)))] use crate::io::DupFlags; #[cfg(linux_kernel)] use crate::io::ReadWriteFlags; -use crate::io::{self, FdFlags, IoSlice, IoSliceMut}; +use crate::io::{self, FdFlags}; use core::cmp::min; -use core::mem::MaybeUninit; #[cfg(all(feature = "fs", feature = "net"))] use libc_errno::errno; +#[cfg(not(target_os = "espidf"))] +use { + crate::backend::MAX_IOV, + crate::io::{IoSlice, IoSliceMut}, +}; pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result { unsafe { @@ -41,6 +50,10 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], offset: u64) -> io::Resu // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; + // ESP-IDF doesn't support 64-bit offsets. + #[cfg(target_os = "espidf")] + let offset: i32 = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?; + unsafe { ret_usize(c::pread( borrowed_fd(fd), @@ -57,9 +70,14 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result< // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; + // ESP-IDF doesn't support 64-bit offsets. + #[cfg(target_os = "espidf")] + let offset: i32 = offset.try_into().map_err(|_| io::Errno::OVERFLOW)?; + unsafe { ret_usize(c::pwrite(borrowed_fd(fd), buf.as_ptr().cast(), len, offset)) } } +#[cfg(not(target_os = "espidf"))] pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result { unsafe { ret_usize(c::readv( @@ -70,6 +88,7 @@ pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result, bufs: &[IoSlice]) -> io::Result { unsafe { ret_usize(c::writev( @@ -80,7 +99,13 @@ pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result } } -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "redox", + target_os = "solaris" +)))] pub(crate) fn preadv( fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut], @@ -98,7 +123,13 @@ pub(crate) fn preadv( } } -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "redox", + target_os = "solaris" +)))] pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::Result { // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; @@ -172,7 +203,10 @@ 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 { + use core::mem::MaybeUninit; + let mut nread = MaybeUninit::::uninit(); unsafe { ret(c::ioctl(borrowed_fd(fd), c::FIONREAD, nread.as_mut_ptr()))?; @@ -193,6 +227,8 @@ pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> { #[cfg(not(any(target_os = "redox", target_os = "wasi")))] #[cfg(all(feature = "fs", feature = "net"))] pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> { + use core::mem::MaybeUninit; + let (mut read, mut write) = crate::fs::fd::_is_file_read_write(fd)?; let mut not_socket = false; if read { @@ -251,11 +287,16 @@ pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()> unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_SETFD, flags.bits())) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result { unsafe { ret_owned_fd(c::fcntl(borrowed_fd(fd), c::F_DUPFD_CLOEXEC, min)) } } +#[cfg(target_os = "espidf")] +pub(crate) fn fcntl_dupfd(fd: BorrowedFd<'_>, min: RawFd) -> io::Result { + unsafe { ret_owned_fd(c::fcntl(borrowed_fd(fd), c::F_DUPFD, min)) } +} + #[cfg(not(target_os = "wasi"))] pub(crate) fn dup(fd: BorrowedFd<'_>) -> io::Result { unsafe { ret_owned_fd(c::dup(borrowed_fd(fd))) } @@ -271,7 +312,9 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> { target_os = "aix", target_os = "android", target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] diff --git a/vendor/rustix/src/backend/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs index e4fecfccd..6a41cbe56 100644 --- a/vendor/rustix/src/backend/libc/mm/types.rs +++ b/vendor/rustix/src/backend/libc/mm/types.rs @@ -40,6 +40,21 @@ bitflags! { /// `PROT_GROWSDOWN` #[cfg(linux_kernel)] const GROWSDOWN = bitcast!(c::PROT_GROWSDOWN); + /// `PROT_SEM` + #[cfg(linux_kernel)] + const SEM = linux_raw_sys::general::PROT_SEM; + /// `PROT_BTI` + #[cfg(all(linux_kernel, target_arch = "aarch64"))] + const BTI = linux_raw_sys::general::PROT_BTI; + /// `PROT_MTE` + #[cfg(all(linux_kernel, target_arch = "aarch64"))] + const MTE = linux_raw_sys::general::PROT_MTE; + /// `PROT_SAO` + #[cfg(all(linux_kernel, any(target_arch = "powerpc", target_arch = "powerpc64")))] + const SAO = linux_raw_sys::general::PROT_SAO; + /// `PROT_ADI` + #[cfg(all(linux_kernel, any(target_arch = "sparc", target_arch = "sparc64")))] + const ADI = linux_raw_sys::general::PROT_ADI; } } @@ -63,6 +78,7 @@ bitflags! { target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const SHARED_VALIDATE = bitcast!(c::MAP_SHARED_VALIDATE); @@ -73,6 +89,7 @@ bitflags! { bsd, solarish, target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const DENYWRITE = bitcast!(c::MAP_DENYWRITE); @@ -86,6 +103,7 @@ bitflags! { target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const FIXED_NOREPLACE = bitcast!(c::MAP_FIXED_NOREPLACE); @@ -94,6 +112,7 @@ bitflags! { bsd, solarish, target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const GROWSDOWN = bitcast!(c::MAP_GROWSDOWN); @@ -102,6 +121,7 @@ bitflags! { bsd, solarish, target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const HUGETLB = bitcast!(c::MAP_HUGETLB); @@ -113,6 +133,7 @@ bitflags! { target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const HUGE_2MB = bitcast!(c::MAP_HUGE_2MB); @@ -124,6 +145,7 @@ bitflags! { target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const HUGE_1GB = bitcast!(c::MAP_HUGE_1GB); @@ -132,6 +154,7 @@ bitflags! { bsd, solarish, target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const LOCKED = bitcast!(c::MAP_LOCKED); @@ -139,7 +162,7 @@ bitflags! { #[cfg(freebsdlike)] const NOCORE = bitcast!(c::MAP_NOCORE); /// `MAP_NORESERVE` - #[cfg(not(any(freebsdlike, target_os = "redox")))] + #[cfg(not(any(freebsdlike, target_os = "nto", target_os = "redox")))] const NORESERVE = bitcast!(c::MAP_NORESERVE); /// `MAP_NOSYNC` #[cfg(freebsdlike)] @@ -149,6 +172,7 @@ bitflags! { bsd, solarish, target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const POPULATE = bitcast!(c::MAP_POPULATE); @@ -173,10 +197,11 @@ bitflags! { target_os = "emscripten", target_os = "fuchsia", target_os = "haiku", + target_os = "nto", target_os = "redox", all( linux_kernel, - any(target_arch = "mips", target_arch = "mips64"), + any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6"), ) )))] const SYNC = bitcast!(c::MAP_SYNC); @@ -308,7 +333,15 @@ pub enum Advice { #[cfg(linux_kernel)] LinuxHwPoison = bitcast!(c::MADV_HWPOISON), /// `MADV_SOFT_OFFLINE` - #[cfg(all(linux_kernel, not(any(target_arch = "mips", target_arch = "mips64"))))] + #[cfg(all( + linux_kernel, + not(any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + )) + ))] LinuxSoftOffline = bitcast!(c::MADV_SOFT_OFFLINE), /// `MADV_MERGEABLE` #[cfg(linux_kernel)] diff --git a/vendor/rustix/src/backend/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs index 357f99484..59fc3bea1 100644 --- a/vendor/rustix/src/backend/libc/mod.rs +++ b/vendor/rustix/src/backend/libc/mod.rs @@ -111,13 +111,19 @@ pub(crate) mod io; #[cfg(linux_kernel)] #[cfg(feature = "io_uring")] pub(crate) mod io_uring; -#[cfg(not(any(windows, target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))] #[cfg(feature = "mm")] pub(crate) mod mm; +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) mod mount; +#[cfg(linux_kernel)] +#[cfg(all(feature = "fs", not(feature = "mount")))] +pub(crate) mod mount; // for deprecated mount functions in "fs" #[cfg(not(any(target_os = "redox", target_os = "wasi")))] #[cfg(feature = "net")] pub(crate) mod net; -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "espidf")))] #[cfg(any( feature = "param", feature = "runtime", @@ -148,7 +154,7 @@ pub(crate) mod termios; #[cfg(not(windows))] #[cfg(feature = "thread")] pub(crate) mod thread; -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "espidf")))] #[cfg(feature = "time")] pub(crate) mod time; @@ -193,6 +199,7 @@ const MAX_IOV: usize = c::UIO_MAXIOV as usize; linux_kernel, windows, target_os = "emscripten", + target_os = "espidf", target_os = "nto", target_os = "horizon", )))] diff --git a/vendor/rustix/src/backend/libc/mount/mod.rs b/vendor/rustix/src/backend/libc/mount/mod.rs new file mode 100644 index 000000000..1e0181a99 --- /dev/null +++ b/vendor/rustix/src/backend/libc/mount/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod syscalls; +pub(crate) mod types; diff --git a/vendor/rustix/src/backend/libc/mount/syscalls.rs b/vendor/rustix/src/backend/libc/mount/syscalls.rs new file mode 100644 index 000000000..26cdb52dc --- /dev/null +++ b/vendor/rustix/src/backend/libc/mount/syscalls.rs @@ -0,0 +1,272 @@ +use crate::backend::c; +use crate::backend::conv::ret; +#[cfg(feature = "mount")] +use crate::backend::conv::{borrowed_fd, c_str, ret_owned_fd}; +#[cfg(feature = "mount")] +use crate::fd::{BorrowedFd, OwnedFd}; +use crate::ffi::CStr; +use crate::io; +use core::ptr::null; + +#[cfg(linux_kernel)] +pub(crate) fn mount( + source: Option<&CStr>, + target: &CStr, + file_system_type: Option<&CStr>, + flags: super::types::MountFlagsArg, + data: Option<&CStr>, +) -> io::Result<()> { + unsafe { + ret(c::mount( + source.map_or_else(null, CStr::as_ptr), + target.as_ptr(), + file_system_type.map_or_else(null, CStr::as_ptr), + flags.0, + data.map_or_else(null, CStr::as_ptr).cast(), + )) + } +} + +#[cfg(linux_kernel)] +pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> { + unsafe { ret(c::umount2(target.as_ptr(), bitflags_bits!(flags))) } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsopen(fs_name: &CStr, flags: super::types::FsOpenFlags) -> io::Result { + syscall! { + fn fsopen( + fs_name: *const c::c_char, + flags: c::c_uint + ) via SYS_fsopen -> c::c_int + } + unsafe { ret_owned_fd(fsopen(c_str(fs_name), flags.bits())) } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsmount( + fs_fd: BorrowedFd<'_>, + flags: super::types::FsMountFlags, + attr_flags: super::types::MountAttrFlags, +) -> io::Result<()> { + syscall! { + fn fsmount( + fs_fd: c::c_int, + flags: c::c_uint, + attr_flags: c::c_uint + ) via SYS_fsmount -> c::c_int + } + unsafe { ret(fsmount(borrowed_fd(fs_fd), flags.bits(), attr_flags.bits())) } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn move_mount( + from_dfd: BorrowedFd<'_>, + from_pathname: &CStr, + to_dfd: BorrowedFd<'_>, + to_pathname: &CStr, + flags: super::types::MoveMountFlags, +) -> io::Result<()> { + syscall! { + fn move_mount( + from_dfd: c::c_int, + from_pathname: *const c::c_char, + to_dfd: c::c_int, + to_pathname: *const c::c_char, + flags: c::c_uint + ) via SYS_move_mount -> c::c_int + } + unsafe { + ret(move_mount( + borrowed_fd(from_dfd), + c_str(from_pathname), + borrowed_fd(to_dfd), + c_str(to_pathname), + flags.bits(), + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn open_tree( + dfd: BorrowedFd<'_>, + filename: &CStr, + flags: super::types::OpenTreeFlags, +) -> io::Result { + syscall! { + fn open_tree( + dfd: c::c_int, + filename: *const c::c_char, + flags: c::c_uint + ) via SYS_open_tree -> c::c_int + } + + unsafe { ret_owned_fd(open_tree(borrowed_fd(dfd), c_str(filename), flags.bits())) } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fspick( + dfd: BorrowedFd<'_>, + path: &CStr, + flags: super::types::FsPickFlags, +) -> io::Result { + syscall! { + fn fspick( + dfd: c::c_int, + path: *const c::c_char, + flags: c::c_uint + ) via SYS_fspick -> c::c_int + } + + unsafe { ret_owned_fd(fspick(borrowed_fd(dfd), c_str(path), flags.bits())) } +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +syscall! { + fn fsconfig( + fs_fd: c::c_int, + cmd: c::c_uint, + key: *const c::c_char, + val: *const c::c_char, + aux: c::c_int + ) via SYS_fsconfig -> c::c_int +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_set_flag(fs_fd: BorrowedFd<'_>, key: &CStr) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::SetFlag as _, + c_str(key), + null(), + 0, + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_set_string( + fs_fd: BorrowedFd<'_>, + key: &CStr, + value: &CStr, +) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::SetString as _, + c_str(key), + c_str(value), + 0, + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_set_binary( + fs_fd: BorrowedFd<'_>, + key: &CStr, + value: &[u8], +) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::SetBinary as _, + c_str(key), + value.as_ptr().cast(), + value.len().try_into().map_err(|_| io::Errno::OVERFLOW)?, + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_set_fd( + fs_fd: BorrowedFd<'_>, + key: &CStr, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::SetFd as _, + c_str(key), + null(), + borrowed_fd(fd), + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_set_path( + fs_fd: BorrowedFd<'_>, + key: &CStr, + path: &CStr, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::SetPath as _, + c_str(key), + c_str(path), + borrowed_fd(fd), + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_set_path_empty( + fs_fd: BorrowedFd<'_>, + key: &CStr, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::SetPathEmpty as _, + c_str(key), + c_str(cstr!("")), + borrowed_fd(fd), + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_create(fs_fd: BorrowedFd<'_>) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::Create as _, + null(), + null(), + 0, + )) + } +} + +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +pub(crate) fn fsconfig_reconfigure(fs_fd: BorrowedFd<'_>) -> io::Result<()> { + unsafe { + ret(fsconfig( + borrowed_fd(fs_fd), + super::types::FsConfigCmd::Reconfigure as _, + null(), + null(), + 0, + )) + } +} diff --git a/vendor/rustix/src/backend/libc/mount/types.rs b/vendor/rustix/src/backend/libc/mount/types.rs new file mode 100644 index 000000000..660e6ae37 --- /dev/null +++ b/vendor/rustix/src/backend/libc/mount/types.rs @@ -0,0 +1,311 @@ +use crate::backend::c; +use bitflags::bitflags; + +#[cfg(linux_kernel)] +bitflags! { + /// `MS_*` constants for use with [`mount`]. + /// + /// [`mount`]: crate::mount::mount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MountFlags: c::c_ulong { + /// `MS_BIND` + const BIND = c::MS_BIND; + + /// `MS_DIRSYNC` + const DIRSYNC = c::MS_DIRSYNC; + + /// `MS_LAZYTIME` + const LAZYTIME = c::MS_LAZYTIME; + + /// `MS_MANDLOCK` + #[doc(alias = "MANDLOCK")] + const PERMIT_MANDATORY_FILE_LOCKING = c::MS_MANDLOCK; + + /// `MS_NOATIME` + const NOATIME = c::MS_NOATIME; + + /// `MS_NODEV` + const NODEV = c::MS_NODEV; + + /// `MS_NODIRATIME` + const NODIRATIME = c::MS_NODIRATIME; + + /// `MS_NOEXEC` + const NOEXEC = c::MS_NOEXEC; + + /// `MS_NOSUID` + const NOSUID = c::MS_NOSUID; + + /// `MS_RDONLY` + const RDONLY = c::MS_RDONLY; + + /// `MS_REC` + const REC = c::MS_REC; + + /// `MS_RELATIME` + const RELATIME = c::MS_RELATIME; + + /// `MS_SILENT` + const SILENT = c::MS_SILENT; + + /// `MS_STRICTATIME` + const STRICTATIME = c::MS_STRICTATIME; + + /// `MS_SYNCHRONOUS` + const SYNCHRONOUS = c::MS_SYNCHRONOUS; + } +} + +#[cfg(linux_kernel)] +bitflags! { + /// `MNT_*` constants for use with [`unmount`]. + /// + /// [`unmount`]: crate::mount::unmount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct UnmountFlags: u32 { + /// `MNT_FORCE` + const FORCE = bitcast!(c::MNT_FORCE); + /// `MNT_DETACH` + const DETACH = bitcast!(c::MNT_DETACH); + /// `MNT_EXPIRE` + const EXPIRE = bitcast!(c::MNT_EXPIRE); + /// `UMOUNT_NOFOLLOW` + const NOFOLLOW = bitcast!(c::UMOUNT_NOFOLLOW); + } +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +bitflags! { + /// `FSOPEN_*` constants for use with [`fsopen`]. + /// + /// [`fsopen`]: crate::mount::fsopen + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct FsOpenFlags: c::c_uint { + + /// `FSOPEN_CLOEXEC` + const FSOPEN_CLOEXEC = 0x00000001; + } +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +bitflags! { + /// `FSMOUNT_*` constants for use with [`fsmount`]. + /// + /// [`fsmount`]: crate::mount::fsmount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct FsMountFlags: c::c_uint { + /// `FSMOUNT_CLOEXEC` + const FSMOUNT_CLOEXEC = 0x00000001; + } +} + +/// `FSCONFIG_*` constants for use with the `fsconfig` syscall. +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +#[repr(u32)] +pub(crate) enum FsConfigCmd { + /// `FSCONFIG_SET_FLAG` + SetFlag = 0, + + /// `FSCONFIG_SET_STRING` + SetString = 1, + + /// `FSCONFIG_SET_BINARY` + SetBinary = 2, + + /// `FSCONFIG_SET_PATH` + SetPath = 3, + + /// `FSCONFIG_SET_PATH_EMPTY` + SetPathEmpty = 4, + + /// `FSCONFIG_SET_FD` + SetFd = 5, + + /// `FSCONFIG_CMD_CREATE` + Create = 6, + + /// `FSCONFIG_CMD_RECONFIGURE` + Reconfigure = 7, +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +bitflags! { + /// `MOUNT_ATTR_*` constants for use with [`fsmount`]. + /// + /// [`fsmount`]: crate::mount::fsmount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MountAttrFlags: c::c_uint { + /// `MOUNT_ATTR_RDONLY` + const MOUNT_ATTR_RDONLY = 0x00000001; + + /// `MOUNT_ATTR_NOSUID` + const MOUNT_ATTR_NOSUID = 0x00000002; + + /// `MOUNT_ATTR_NODEV` + const MOUNT_ATTR_NODEV = 0x00000004; + + /// `MOUNT_ATTR_NOEXEC` + const MOUNT_ATTR_NOEXEC = 0x00000008; + + /// `MOUNT_ATTR__ATIME` + const MOUNT_ATTR__ATIME = 0x00000070; + + /// `MOUNT_ATTR_RELATIME` + const MOUNT_ATTR_RELATIME = 0x00000000; + + /// `MOUNT_ATTR_NOATIME` + const MOUNT_ATTR_NOATIME = 0x00000010; + + /// `MOUNT_ATTR_STRICTATIME` + const MOUNT_ATTR_STRICTATIME = 0x00000020; + + /// `MOUNT_ATTR_NODIRATIME` + const MOUNT_ATTR_NODIRATIME = 0x00000080; + + /// `MOUNT_ATTR_NOUSER` + const MOUNT_ATTR_IDMAP = 0x00100000; + + /// `MOUNT_ATTR__ATIME_FLAGS` + const MOUNT_ATTR_NOSYMFOLLOW = 0x00200000; + + /// `MOUNT_ATTR__ATIME_FLAGS` + const MOUNT_ATTR_SIZE_VER0 = 32; + } +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +bitflags! { + /// `MOVE_MOUNT_*` constants for use with [`move_mount`]. + /// + /// [`move_mount`]: crate::mount::move_mount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MoveMountFlags: c::c_uint { + /// `MOVE_MOUNT_F_EMPTY_PATH` + const MOVE_MOUNT_F_SYMLINKS = 0x00000001; + + /// `MOVE_MOUNT_F_AUTOMOUNTS` + const MOVE_MOUNT_F_AUTOMOUNTS = 0x00000002; + + /// `MOVE_MOUNT_F_EMPTY_PATH` + const MOVE_MOUNT_F_EMPTY_PATH = 0x00000004; + + /// `MOVE_MOUNT_T_SYMLINKS` + const MOVE_MOUNT_T_SYMLINKS = 0x00000010; + + /// `MOVE_MOUNT_T_AUTOMOUNTS` + const MOVE_MOUNT_T_AUTOMOUNTS = 0x00000020; + + /// `MOVE_MOUNT_T_EMPTY_PATH` + const MOVE_MOUNT_T_EMPTY_PATH = 0x00000040; + + /// `MOVE_MOUNT__MASK` + const MOVE_MOUNT_SET_GROUP = 0x00000100; + + // TODO: add when linux 6.5 is released + // /// `MOVE_MOUNT_BENEATH` + // const MOVE_MOUNT_BENEATH = 0x00000200; + + /// `MOVE_MOUNT__MASK` + const MOVE_MOUNT__MASK = 0x00000377; + } +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +bitflags! { + /// `OPENTREE_*` constants for use with [`open_tree`]. + /// + /// [`open_tree`]: crate::mount::open_tree + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct OpenTreeFlags: c::c_uint { + /// `OPENTREE_CLONE` + const OPEN_TREE_CLONE = 1; + + /// `OPENTREE_CLOEXEC` + const OPEN_TREE_CLOEXEC = c::O_CLOEXEC as c::c_uint; + + /// `AT_EMPTY_PATH` + const AT_EMPTY_PATH = c::AT_EMPTY_PATH as c::c_uint; + + /// `AT_NO_AUTOMOUNT` + const AT_NO_AUTOMOUNT = c::AT_NO_AUTOMOUNT as c::c_uint; + + /// `AT_RECURSIVE` + const AT_RECURSIVE = c::AT_RECURSIVE as c::c_uint; + + /// `AT_SYMLINK_NOFOLLOW` + const AT_SYMLINK_NOFOLLOW = c::AT_SYMLINK_NOFOLLOW as c::c_uint; + } +} + +#[cfg(feature = "mount")] +#[cfg(linux_kernel)] +bitflags! { + /// `FSPICK_*` constants for use with [`fspick`]. + /// + /// [`fspick`]: crate::mount::fspick + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct FsPickFlags: c::c_uint { + /// `FSPICK_CLOEXEC` + const FSPICK_CLOEXEC = 0x00000001; + + /// `FSPICK_SYMLINK_NOFOLLOW` + const FSPICK_SYMLINK_NOFOLLOW = 0x00000002; + + /// `FSPICK_NO_AUTOMOUNT` + const FSPICK_NO_AUTOMOUNT = 0x00000004; + + /// `FSPICK_EMPTY_PATH` + const FSPICK_EMPTY_PATH = 0x00000008; + } +} + +#[cfg(linux_kernel)] +bitflags! { + /// `MS_*` constants for use with [`change_mount`]. + /// + /// [`change_mount`]: crate::mount::change_mount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MountPropagationFlags: c::c_ulong { + /// `MS_SILENT` + const SILENT = c::MS_SILENT; + /// `MS_SHARED` + const SHARED = c::MS_SHARED; + /// `MS_PRIVATE` + const PRIVATE = c::MS_PRIVATE; + /// `MS_SLAVE` + const SLAVE = c::MS_SLAVE; + /// `MS_UNBINDABLE` + const UNBINDABLE = c::MS_UNBINDABLE; + /// `MS_REC` + const REC = c::MS_REC; + } +} + +#[cfg(linux_kernel)] +bitflags! { + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub(crate) struct InternalMountFlags: c::c_ulong { + const REMOUNT = c::MS_REMOUNT; + const MOVE = c::MS_MOVE; + } +} + +#[cfg(linux_kernel)] +pub(crate) struct MountFlagsArg(pub(crate) c::c_ulong); diff --git a/vendor/rustix/src/backend/libc/net/addr.rs b/vendor/rustix/src/backend/libc/net/addr.rs index bf7d239de..bd2e7dafe 100644 --- a/vendor/rustix/src/backend/libc/net/addr.rs +++ b/vendor/rustix/src/backend/libc/net/addr.rs @@ -76,12 +76,12 @@ impl SocketAddrUnix { fn init() -> c::sockaddr_un { c::sockaddr_un { - #[cfg(any(bsd, target_os = "haiku"))] + #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))] sun_len: 0, sun_family: c::AF_UNIX as _, - #[cfg(bsd)] + #[cfg(any(bsd, target_os = "nto"))] sun_path: [0; 104], - #[cfg(not(any(bsd, target_os = "haiku")))] + #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))] sun_path: [0; 108], #[cfg(target_os = "haiku")] sun_path: [0; 126], @@ -208,15 +208,15 @@ 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"))] + #[cfg(any(bsd, target_os = "haiku", target_os = "nto"))] sun_len: 0_u8, - #[cfg(any(bsd, target_os = "haiku"))] + #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sun_family: 0_u8, - #[cfg(not(any(bsd, target_os = "haiku")))] + #[cfg(not(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto")))] sun_family: 0_u16, - #[cfg(bsd)] + #[cfg(any(bsd, target_os = "nto"))] sun_path: [0; 104], - #[cfg(not(any(bsd, target_os = "haiku")))] + #[cfg(not(any(bsd, target_os = "haiku", target_os = "nto")))] sun_path: [0; 108], #[cfg(target_os = "haiku")] sun_path: [0; 126], diff --git a/vendor/rustix/src/backend/libc/net/ext.rs b/vendor/rustix/src/backend/libc/net/ext.rs index 4b2d10756..50bd89db6 100644 --- a/vendor/rustix/src/backend/libc/net/ext.rs +++ b/vendor/rustix/src/backend/libc/net/ext.rs @@ -78,7 +78,7 @@ 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 = "haiku"))] sin6_len: u8, + #[cfg(any(bsd, 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 +86,7 @@ pub(crate) const fn sockaddr_in6_new( sin6_scope_id: u32, ) -> c::sockaddr_in6 { c::sockaddr_in6 { - #[cfg(any(bsd, target_os = "haiku"))] + #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sin6_len, sin6_family, sin6_port, diff --git a/vendor/rustix/src/backend/libc/net/mod.rs b/vendor/rustix/src/backend/libc/net/mod.rs index 1b68f1b26..65c7d0654 100644 --- a/vendor/rustix/src/backend/libc/net/mod.rs +++ b/vendor/rustix/src/backend/libc/net/mod.rs @@ -1,6 +1,6 @@ pub(crate) mod addr; pub(crate) mod ext; -#[cfg(not(any(target_os = "redox", target_os = "wasi", windows)))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) mod msghdr; pub(crate) mod read_sockaddr; pub(crate) mod send_recv; diff --git a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs index c3b23e8c2..cde851af6 100644 --- a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs +++ b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs @@ -26,11 +26,11 @@ 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 = "haiku"))] + #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sa_len: 0_u8, - #[cfg(any(bsd, target_os = "haiku"))] + #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sa_family: 0_u8, - #[cfg(not(any(bsd, target_os = "haiku")))] + #[cfg(not(any(bsd, 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 e91017e97..26543a1fd 100644 --- a/vendor/rustix/src/backend/libc/net/send_recv.rs +++ b/vendor/rustix/src/backend/libc/net/send_recv.rs @@ -14,6 +14,8 @@ bitflags! { bsd, solarish, windows, + target_os = "espidf", + target_os = "nto", target_os = "haiku", )))] const CONFIRM = bitcast!(c::MSG_CONFIRM); @@ -31,6 +33,7 @@ bitflags! { solarish, windows, target_os = "haiku", + target_os = "nto", )))] const MORE = bitcast!(c::MSG_MORE); #[cfg(not(any(apple, windows)))] @@ -49,7 +52,7 @@ bitflags! { #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct RecvFlags: u32 { - #[cfg(not(any(apple, solarish, windows, target_os = "haiku")))] + #[cfg(not(any(apple, solarish, windows, target_os = "espidf", target_os = "haiku", target_os = "nto")))] /// `MSG_CMSG_CLOEXEC` const CMSG_CLOEXEC = bitcast!(c::MSG_CMSG_CLOEXEC); /// `MSG_DONTWAIT` @@ -60,7 +63,9 @@ bitflags! { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] const ERRQUEUE = bitcast!(c::MSG_ERRQUEUE); /// `MSG_OOB` diff --git a/vendor/rustix/src/backend/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs index 63067ff38..b4550583c 100644 --- a/vendor/rustix/src/backend/libc/net/syscalls.rs +++ b/vendor/rustix/src/backend/libc/net/syscalls.rs @@ -10,7 +10,7 @@ use crate::io; use crate::net::{SocketAddrAny, SocketAddrV4, SocketAddrV6}; use crate::utils::as_ptr; use core::mem::{size_of, MaybeUninit}; -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] use { super::msghdr::{with_noaddr_msghdr, with_recv_msghdr, with_v4_msghdr, with_v6_msghdr}, crate::io::{IoSlice, IoSliceMut}, @@ -256,7 +256,7 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result { } } -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn recvmsg( sockfd: BorrowedFd<'_>, iov: &mut [IoSliceMut<'_>], @@ -288,7 +288,7 @@ pub(crate) fn recvmsg( }) } -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn sendmsg( sockfd: BorrowedFd<'_>, iov: &[IoSlice<'_>], @@ -304,7 +304,7 @@ pub(crate) fn sendmsg( }) } -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn sendmsg_v4( sockfd: BorrowedFd<'_>, addr: &SocketAddrV4, @@ -321,7 +321,7 @@ pub(crate) fn sendmsg_v4( }) } -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub(crate) fn sendmsg_v6( sockfd: BorrowedFd<'_>, addr: &SocketAddrV6, @@ -338,7 +338,7 @@ pub(crate) fn sendmsg_v6( }) } -#[cfg(all(unix, not(target_os = "redox")))] +#[cfg(all(unix, not(any(target_os = "espidf", target_os = "redox"))))] pub(crate) fn sendmsg_unix( sockfd: BorrowedFd<'_>, addr: &SocketAddrUnix, @@ -358,8 +358,10 @@ pub(crate) fn sendmsg_unix( #[cfg(not(any( apple, windows, + target_os = "espidf", target_os = "haiku", target_os = "redox", + target_os = "nto", target_os = "wasi", )))] pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result { @@ -394,7 +396,9 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option< #[cfg(not(any( apple, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -420,14 +424,26 @@ pub(crate) fn acceptfrom_with( /// Darwin lacks `accept4`, but does have `accept`. We define /// `SocketFlags` to have no flags, so we can discard it here. -#[cfg(any(apple, windows, target_os = "haiku"))] +#[cfg(any( + apple, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "nto" +))] pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: SocketFlags) -> io::Result { accept(sockfd) } /// Darwin lacks `accept4`, but does have `accept`. We define /// `SocketFlags` to have no flags, so we can discard it here. -#[cfg(any(apple, windows, target_os = "haiku"))] +#[cfg(any( + apple, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "nto" +))] pub(crate) fn acceptfrom_with( sockfd: BorrowedFd<'_>, _flags: SocketFlags, @@ -893,9 +909,21 @@ pub(crate) mod sockopt { multiaddr: &Ipv6Addr, interface: u32, ) -> io::Result<()> { - #[cfg(not(any(bsd, solarish, target_os = "haiku", target_os = "l4re")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "haiku", + target_os = "l4re", + target_os = "nto" + )))] use c::IPV6_ADD_MEMBERSHIP; - #[cfg(any(bsd, solarish, target_os = "haiku", target_os = "l4re"))] + #[cfg(any( + bsd, + solarish, + target_os = "haiku", + target_os = "l4re", + target_os = "nto" + ))] use c::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP; let mreq = to_ipv6mr(multiaddr, interface); @@ -918,9 +946,21 @@ pub(crate) mod sockopt { multiaddr: &Ipv6Addr, interface: u32, ) -> io::Result<()> { - #[cfg(not(any(bsd, solarish, target_os = "haiku", target_os = "l4re")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "haiku", + target_os = "l4re", + target_os = "nto" + )))] use c::IPV6_DROP_MEMBERSHIP; - #[cfg(any(bsd, solarish, target_os = "haiku", target_os = "l4re"))] + #[cfg(any( + bsd, + solarish, + target_os = "haiku", + target_os = "l4re", + target_os = "nto" + ))] use c::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP; let mreq = to_ipv6mr(multiaddr, interface); diff --git a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs index efb5a4e14..46f0ef40a 100644 --- a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs +++ b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs @@ -23,7 +23,7 @@ pub(crate) unsafe fn write_sockaddr( pub(crate) unsafe fn encode_sockaddr_v4(v4: &SocketAddrV4) -> c::sockaddr_in { c::sockaddr_in { - #[cfg(any(bsd, target_os = "haiku"))] + #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] sin_len: size_of::() as _, sin_family: c::AF_INET as _, sin_port: u16::to_be(v4.port()), @@ -42,7 +42,7 @@ unsafe fn write_sockaddr_v4(v4: &SocketAddrV4, storage: *mut SocketAddrStorage) } pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 { - #[cfg(any(bsd, target_os = "haiku"))] + #[cfg(any(bsd, target_os = "espidf", target_os = "haiku", target_os = "nto"))] { sockaddr_in6_new( size_of::() as _, @@ -53,7 +53,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 { v6.scope_id(), ) } - #[cfg(not(any(bsd, target_os = "haiku")))] + #[cfg(not(any(bsd, 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 c5ded9174..24262cc9a 100644 --- a/vendor/rustix/src/backend/libc/pipe/syscalls.rs +++ b/vendor/rustix/src/backend/libc/pipe/syscalls.rs @@ -2,7 +2,14 @@ use crate::backend::c; use crate::backend::conv::ret; use crate::fd::OwnedFd; use crate::io; -#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))] +#[cfg(not(any( + apple, + target_os = "aix", + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "wasi" +)))] use crate::pipe::PipeFlags; use core::mem::MaybeUninit; #[cfg(linux_kernel)] @@ -11,7 +18,7 @@ use { crate::backend::MAX_IOV, crate::fd::BorrowedFd, crate::pipe::{IoSliceRaw, SpliceFlags}, - crate::utils::optional_as_mut_ptr, + crate::utils::option_as_mut_ptr, core::cmp::min, }; @@ -25,7 +32,14 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { } } -#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))] +#[cfg(not(any( + apple, + target_os = "aix", + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "wasi" +)))] pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { unsafe { let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit(); @@ -48,8 +62,8 @@ pub fn splice( len: usize, flags: SpliceFlags, ) -> io::Result { - let off_in = optional_as_mut_ptr(off_in).cast(); - let off_out = optional_as_mut_ptr(off_out).cast(); + let off_in = option_as_mut_ptr(off_in).cast(); + let off_out = option_as_mut_ptr(off_out).cast(); unsafe { ret_usize(c::splice( diff --git a/vendor/rustix/src/backend/libc/pipe/types.rs b/vendor/rustix/src/backend/libc/pipe/types.rs index f48d8041b..3fa0464e0 100644 --- a/vendor/rustix/src/backend/libc/pipe/types.rs +++ b/vendor/rustix/src/backend/libc/pipe/types.rs @@ -16,7 +16,9 @@ bitflags! { /// `O_DIRECT` #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", + target_os = "nto", target_os = "openbsd", target_os = "redox", )))] @@ -85,9 +87,8 @@ impl<'a> IoSliceRaw<'a> { #[cfg(not(any(apple, target_os = "wasi")))] #[test] fn test_types() { - use core::mem::size_of; - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(PipeFlags, c::c_int); #[cfg(linux_kernel)] - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(SpliceFlags, c::c_int); } diff --git a/vendor/rustix/src/backend/libc/process/mod.rs b/vendor/rustix/src/backend/libc/process/mod.rs index 24f43d443..4d9a9f0a0 100644 --- a/vendor/rustix/src/backend/libc/process/mod.rs +++ b/vendor/rustix/src/backend/libc/process/mod.rs @@ -3,5 +3,5 @@ pub(crate) mod cpu_set; #[cfg(not(windows))] pub(crate) mod syscalls; pub(crate) mod types; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) mod wait; diff --git a/vendor/rustix/src/backend/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs index 0aa29b0b1..a84385cf1 100644 --- a/vendor/rustix/src/backend/libc/process/syscalls.rs +++ b/vendor/rustix/src/backend/libc/process/syscalls.rs @@ -3,14 +3,21 @@ #[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))] use super::types::RawCpuSet; use crate::backend::c; -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(feature = "fs")] +use crate::backend::conv::c_str; +#[cfg(all(feature = "fs", not(target_os = "wasi")))] +use crate::backend::conv::ret_discarded_char_ptr; +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] use crate::backend::conv::ret_infallible; #[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(feature = "fs")] -use crate::backend::conv::{c_str, ret_discarded_char_ptr}; use crate::backend::conv::{ret, ret_c_int}; #[cfg(not(target_os = "wasi"))] use crate::fd::BorrowedFd; @@ -21,15 +28,27 @@ use crate::ffi::CStr; #[cfg(feature = "fs")] use crate::fs::Mode; use crate::io; -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[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, RawPid, Signal, WaitOptions, WaitStatus}; -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", 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( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] use crate::process::{Resource, Rlimit}; -#[cfg(not(any(target_os = "redox", target_os = "openbsd", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "redox", + target_os = "openbsd", + target_os = "wasi" +)))] use crate::process::{WaitId, WaitidOptions, WaitidStatus}; use core::mem::MaybeUninit; #[cfg(target_os = "linux")] @@ -43,7 +62,7 @@ pub(crate) fn chdir(path: &CStr) -> io::Result<()> { unsafe { ret(c::chdir(c_str(path))) } } -#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))] +#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] pub(crate) fn fchdir(dirfd: BorrowedFd<'_>) -> io::Result<()> { unsafe { ret(c::fchdir(borrowed_fd(dirfd))) } } @@ -196,7 +215,7 @@ pub(crate) fn nice(inc: i32) -> io::Result { } } -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))] #[inline] pub(crate) fn getpriority_user(uid: Uid) -> io::Result { libc_errno::set_errno(libc_errno::Errno(0)); @@ -208,7 +227,7 @@ pub(crate) fn getpriority_user(uid: Uid) -> io::Result { } } -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))] #[inline] pub(crate) fn getpriority_pgrp(pgid: Option) -> io::Result { libc_errno::set_errno(libc_errno::Errno(0)); @@ -220,7 +239,7 @@ pub(crate) fn getpriority_pgrp(pgid: Option) -> io::Result { } } -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))] #[inline] pub(crate) fn getpriority_process(pid: Option) -> io::Result { libc_errno::set_errno(libc_errno::Errno(0)); @@ -232,13 +251,13 @@ pub(crate) fn getpriority_process(pid: Option) -> io::Result { } } -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))] #[inline] pub(crate) fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> { unsafe { ret(c::setpriority(c::PRIO_USER, uid.as_raw() as _, priority)) } } -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))] #[inline] pub(crate) fn setpriority_pgrp(pgid: Option, priority: i32) -> io::Result<()> { unsafe { @@ -250,7 +269,7 @@ pub(crate) fn setpriority_pgrp(pgid: Option, priority: i32) -> io::Result<( } } -#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "fuchsia", target_os = "wasi")))] #[inline] pub(crate) fn setpriority_process(pid: Option, priority: i32) -> io::Result<()> { unsafe { @@ -262,7 +281,12 @@ pub(crate) fn setpriority_process(pid: Option, priority: i32) -> io::Result } } -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] #[inline] pub(crate) fn getrlimit(limit: Resource) -> Rlimit { let mut result = MaybeUninit::::uninit(); @@ -272,7 +296,12 @@ pub(crate) fn getrlimit(limit: Resource) -> Rlimit { } } -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] #[inline] pub(crate) fn setrlimit(limit: Resource, new: Rlimit) -> io::Result<()> { let lim = rlimit_to_libc(new)?; @@ -296,7 +325,12 @@ pub(crate) fn prlimit(pid: Option, limit: Resource, new: Rlimit) -> io::Res } /// Convert a Rust [`Rlimit`] to a C `c::rlimit`. -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] fn rlimit_from_libc(lim: c::rlimit) -> Rlimit { let current = if lim.rlim_cur == c::RLIM_INFINITY { None @@ -312,7 +346,12 @@ fn rlimit_from_libc(lim: c::rlimit) -> Rlimit { } /// Convert a C `c::rlimit` to a Rust `Rlimit`. -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] fn rlimit_to_libc(lim: Rlimit) -> io::Result { let Rlimit { current, maximum } = lim; let rlim_cur = match current { @@ -326,13 +365,13 @@ fn rlimit_to_libc(lim: Rlimit) -> io::Result { Ok(c::rlimit { rlim_cur, rlim_max }) } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn wait(waitopts: WaitOptions) -> io::Result> { _waitpid(!0, waitopts) } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn waitpid( pid: Option, @@ -341,7 +380,7 @@ pub(crate) fn waitpid( _waitpid(Pid::as_raw(pid), waitopts) } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn _waitpid( pid: RawPid, @@ -354,7 +393,12 @@ pub(crate) fn _waitpid( } } -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "redox", + target_os = "openbsd", + target_os = "wasi" +)))] #[inline] pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result> { // Get the id to wait on. @@ -368,7 +412,12 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result io::Result> { // `waitid` can return successfully without initializing the struct (no @@ -386,7 +435,12 @@ fn _waitid_all(options: WaitidOptions) -> io::Result> { Ok(unsafe { cvt_waitid_status(status) }) } -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "redox", + target_os = "openbsd", + target_os = "wasi" +)))] #[inline] fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result> { // `waitid` can return successfully without initializing the struct (no @@ -428,7 +482,12 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result) -> Option { let status = status.assume_init(); @@ -464,13 +523,13 @@ pub(crate) fn setsid() -> io::Result { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn kill_process(pid: Pid, sig: Signal) -> io::Result<()> { unsafe { ret(c::kill(pid.as_raw_nonzero().get(), sig as i32)) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> { unsafe { @@ -481,25 +540,24 @@ pub(crate) fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> { unsafe { ret(c::kill(0, sig as i32)) } } -#[cfg(not(target_os = "wasi"))] -#[inline] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn test_kill_process(pid: Pid) -> io::Result<()> { unsafe { ret(c::kill(pid.as_raw_nonzero().get(), 0)) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn test_kill_process_group(pid: Pid) -> io::Result<()> { unsafe { ret(c::kill(pid.as_raw_nonzero().get().wrapping_neg(), 0)) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn test_kill_current_process_group() -> io::Result<()> { unsafe { ret(c::kill(0, 0)) } @@ -561,7 +619,12 @@ pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result { unsafe { ret_usize(c::getgroups(len, buf.as_mut_ptr().cast()) as isize) } } -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[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 980c0effe..9c543acd0 100644 --- a/vendor/rustix/src/backend/libc/process/types.rs +++ b/vendor/rustix/src/backend/libc/process/types.rs @@ -40,9 +40,15 @@ pub enum MembarrierCommand { /// [`getrlimit`]: crate::process::getrlimit /// [`setrlimit`]: crate::process::setrlimit /// [`prlimit`]: crate::process::prlimit -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] #[derive(Copy, Clone, Debug, Eq, PartialEq)] -#[repr(u32)] +#[cfg_attr(not(target_os = "l4re"), repr(u32))] +#[cfg_attr(target_os = "l4re", repr(u64))] pub enum Resource { /// `RLIMIT_CPU` Cpu = bitcast!(c::RLIMIT_CPU), @@ -56,7 +62,8 @@ pub enum Resource { #[cfg(not(target_os = "haiku"))] Core = bitcast!(c::RLIMIT_CORE), /// `RLIMIT_RSS` - #[cfg(not(any(apple, solarish, target_os = "haiku")))] + // "nto" has `RLIMIT_RSS`, but it has the same value as `RLIMIT_AS`. + #[cfg(not(any(apple, solarish, target_os = "nto", target_os = "haiku")))] Rss = bitcast!(c::RLIMIT_RSS), /// `RLIMIT_NPROC` #[cfg(not(any(solarish, target_os = "haiku")))] @@ -70,19 +77,49 @@ pub enum Resource { #[cfg(not(target_os = "openbsd"))] As = bitcast!(c::RLIMIT_AS), /// `RLIMIT_LOCKS` - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] Locks = bitcast!(c::RLIMIT_LOCKS), /// `RLIMIT_SIGPENDING` - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] Sigpending = bitcast!(c::RLIMIT_SIGPENDING), /// `RLIMIT_MSGQUEUE` - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] Msgqueue = bitcast!(c::RLIMIT_MSGQUEUE), /// `RLIMIT_NICE` - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] Nice = bitcast!(c::RLIMIT_NICE), /// `RLIMIT_RTPRIO` - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] Rtprio = bitcast!(c::RLIMIT_RTPRIO), /// `RLIMIT_RTTIME` #[cfg(not(any( @@ -92,6 +129,7 @@ pub enum Resource { target_os = "android", target_os = "emscripten", target_os = "haiku", + target_os = "nto", )))] Rttime = bitcast!(c::RLIMIT_RTTIME), } @@ -105,7 +143,7 @@ impl Resource { pub const EXIT_SUCCESS: c::c_int = c::EXIT_SUCCESS; pub const EXIT_FAILURE: c::c_int = c::EXIT_FAILURE; -#[cfg(not(target_os = "wasi"))] +#[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. diff --git a/vendor/rustix/src/backend/libc/pty/syscalls.rs b/vendor/rustix/src/backend/libc/pty/syscalls.rs index 178201ead..6688ddb26 100644 --- a/vendor/rustix/src/backend/libc/pty/syscalls.rs +++ b/vendor/rustix/src/backend/libc/pty/syscalls.rs @@ -31,9 +31,26 @@ pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec) -> io::Result c::c_int + } + if let Some(func) = ptsname_r.get() { + func(borrowed_fd(fd), buffer.as_mut_ptr().cast(), buffer.len()) + } else { + libc::ENOSYS + } + }; + // MacOS 10.13.4 has `ptsname_r`; use it if we have it, otherwise fall // back to calling the underlying ioctl directly. #[cfg(apple)] @@ -45,7 +62,7 @@ pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec) -> io::Result { let len = CStr::from_ptr(name.as_ptr().cast()).to_bytes().len(); std::ptr::copy_nonoverlapping(name.as_ptr(), buffer.as_mut_ptr(), len + 1); diff --git a/vendor/rustix/src/backend/libc/system/syscalls.rs b/vendor/rustix/src/backend/libc/system/syscalls.rs index a731e9302..27efd2653 100644 --- a/vendor/rustix/src/backend/libc/system/syscalls.rs +++ b/vendor/rustix/src/backend/libc/system/syscalls.rs @@ -7,7 +7,12 @@ use crate::backend::conv::ret_infallible; #[cfg(linux_kernel)] use crate::system::Sysinfo; use core::mem::MaybeUninit; -#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "emscripten", + target_os = "espidf", + target_os = "redox", + target_os = "wasi" +)))] use {crate::backend::conv::ret, crate::io}; #[cfg(not(target_os = "wasi"))] @@ -15,7 +20,15 @@ use {crate::backend::conv::ret, crate::io}; pub(crate) fn uname() -> RawUname { let mut uname = MaybeUninit::::uninit(); unsafe { - ret_infallible(c::uname(uname.as_mut_ptr())); + let r = c::uname(uname.as_mut_ptr()); + + // On POSIX, `uname` is documented to return non-negative on success + // instead of the usual 0, though some specific systems do document + // that they always use zero allowing us to skip this check. + #[cfg(not(any(apple, freebsdlike, linux_like, target_os = "netbsd")))] + let r = core::cmp::min(r, 0); + + ret_infallible(r); uname.assume_init() } } @@ -29,7 +42,12 @@ pub(crate) fn sysinfo() -> Sysinfo { } } -#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "emscripten", + target_os = "espidf", + target_os = "redox", + target_os = "wasi" +)))] pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> { unsafe { ret(c::sethostname( diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs index d4182f4fe..ea284927f 100644 --- a/vendor/rustix/src/backend/libc/termios/syscalls.rs +++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs @@ -5,21 +5,30 @@ //! See the `rustix::backend::syscalls` module documentation for details. use crate::backend::c; -use crate::backend::conv::{borrowed_fd, ret, ret_pid_t}; +#[cfg(not(target_os = "wasi"))] +use crate::backend::conv::ret_pid_t; +use crate::backend::conv::{borrowed_fd, ret}; use crate::fd::BorrowedFd; #[cfg(feature = "procfs")] #[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] use crate::ffi::CStr; +#[cfg(any( + not(target_os = "espidf"), + all( + feature = "procfs", + not(any(target_os = "fuchsia", target_os = "wasi")) + ) +))] use core::mem::MaybeUninit; #[cfg(not(target_os = "wasi"))] +use {crate::io, crate::pid::Pid}; +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] use { - crate::io, - crate::pid::Pid, crate::termios::{Action, OptionalActions, QueueSelector, Termios, Winsize}, crate::utils::as_mut_ptr, }; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result { // If we have `TCGETS2`, use it, so that we fill in the `c_ispeed` and // `c_ospeed` fields. @@ -32,7 +41,7 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result { ret(c::ioctl( borrowed_fd(fd), - c::TCGETS2.into(), + c::TCGETS2 as _, termios2.as_mut_ptr(), ))?; @@ -58,6 +67,8 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result { unsafe { let mut result = MaybeUninit::::uninit(); + // `result` is a `Termios` which starts with the same layout as + // `libc::termios`, so we can cast the pointer. ret(c::tcgetattr(borrowed_fd(fd), result.as_mut_ptr().cast()))?; Ok(result.assume_init()) @@ -77,7 +88,7 @@ pub(crate) fn tcsetpgrp(fd: BorrowedFd<'_>, pid: Pid) -> io::Result<()> { unsafe { ret(c::tcsetpgrp(borrowed_fd(fd), pid.as_raw_nonzero().get())) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcsetattr( fd: BorrowedFd, optional_actions: OptionalActions, @@ -104,7 +115,12 @@ pub(crate) fn tcsetattr( // Translate from `optional_actions` into an ioctl request code. On MIPS, // `optional_actions` already has `TCGETS` added to it. let request = TCSETS2 - + if cfg!(any(target_arch = "mips", target_arch = "mips64")) { + + if cfg!(any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + )) { optional_actions as u32 - TCSETS } else { optional_actions as u32 @@ -151,17 +167,17 @@ pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> { unsafe { ret(c::tcsendbreak(borrowed_fd(fd), 0)) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcdrain(fd: BorrowedFd) -> io::Result<()> { unsafe { ret(c::tcdrain(borrowed_fd(fd))) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcflush(fd: BorrowedFd, queue_selector: QueueSelector) -> io::Result<()> { unsafe { ret(c::tcflush(borrowed_fd(fd), queue_selector as _)) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcflow(fd: BorrowedFd, action: Action) -> io::Result<()> { unsafe { ret(c::tcflow(borrowed_fd(fd), action as _)) } } @@ -174,12 +190,12 @@ pub(crate) fn tcgetsid(fd: BorrowedFd) -> io::Result { } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcsetwinsize(fd: BorrowedFd, winsize: Winsize) -> io::Result<()> { unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCSWINSZ, &winsize)) } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result { unsafe { let mut buf = MaybeUninit::::uninit(); @@ -192,17 +208,27 @@ pub(crate) fn tcgetwinsize(fd: BorrowedFd) -> io::Result { } } -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[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 = "haiku", target_os = "redox", target_os = "wasi")))] +#[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(target_os = "wasi"))] +#[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<()> { #[cfg(bsd)] @@ -244,7 +270,7 @@ pub(crate) fn set_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Resu } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn set_output_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Result<()> { #[cfg(bsd)] @@ -284,7 +310,7 @@ pub(crate) fn set_output_speed(termios: &mut Termios, arbitrary_speed: u32) -> i } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io::Result<()> { #[cfg(bsd)] @@ -324,7 +350,7 @@ pub(crate) fn set_input_speed(termios: &mut Termios, arbitrary_speed: u32) -> io } } -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "nto", target_os = "wasi")))] #[inline] pub(crate) fn cfmakeraw(termios: &mut Termios) { unsafe { c::cfmakeraw(as_mut_ptr(termios).cast()) } diff --git a/vendor/rustix/src/backend/libc/thread/syscalls.rs b/vendor/rustix/src/backend/libc/thread/syscalls.rs index 6066fd0d4..5260c39f4 100644 --- a/vendor/rustix/src/backend/libc/thread/syscalls.rs +++ b/vendor/rustix/src/backend/libc/thread/syscalls.rs @@ -5,10 +5,7 @@ use crate::backend::conv::ret; use crate::io; #[cfg(not(target_os = "redox"))] use crate::thread::{NanosleepRelativeResult, Timespec}; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] use crate::timespec::LibcTimespec; use core::mem::MaybeUninit; #[cfg(linux_kernel)] @@ -22,6 +19,7 @@ use { apple, freebsdlike, target_os = "emscripten", + target_os = "espidf", target_os = "haiku", target_os = "openbsd", target_os = "redox", @@ -29,21 +27,16 @@ use { )))] use {crate::thread::ClockId, core::ptr::null_mut}; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __clock_nanosleep_time64(c::clockid_t, c::c_int, *const LibcTimespec, *mut LibcTimespec) -> c::c_int); -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int); #[cfg(not(any( apple, target_os = "dragonfly", target_os = "emscripten", + target_os = "espidf", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. target_os = "haiku", target_os = "openbsd", @@ -52,41 +45,38 @@ weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int); )))] #[inline] pub(crate) fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRelativeResult { - let flags = 0; - - // 32-bit gnu version: libc has `clock_nanosleep` but it is not y2038 safe - // by default. - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { - let mut remain = MaybeUninit::::uninit(); - + // Old 32-bit version: libc has `clock_nanosleep` but it is not y2038 safe + // by default. But there may be a `__clock_nanosleep_time64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_clock_nanosleep) = __clock_nanosleep_time64.get() { - match libc_clock_nanosleep( - id as c::clockid_t, - flags, - &request.clone().into(), - remain.as_mut_ptr(), - ) { - 0 => NanosleepRelativeResult::Ok, - err if err == io::Errno::INTR.0 => { - NanosleepRelativeResult::Interrupted(remain.assume_init().into()) - } - err => NanosleepRelativeResult::Err(io::Errno(err)), + let flags = 0; + let mut remain = MaybeUninit::::uninit(); + + unsafe { + return match libc_clock_nanosleep( + id as c::clockid_t, + flags, + &request.clone().into(), + remain.as_mut_ptr(), + ) { + 0 => NanosleepRelativeResult::Ok, + err if err == io::Errno::INTR.0 => { + NanosleepRelativeResult::Interrupted(remain.assume_init().into()) + } + err => NanosleepRelativeResult::Err(io::Errno(err)), + }; } - } else { - clock_nanosleep_relative_old(id, request) } + + clock_nanosleep_relative_old(id, request) } // Main version: libc is y2038 safe and has `clock_nanosleep`. - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + #[cfg(not(fix_y2038))] unsafe { + let flags = 0; let mut remain = MaybeUninit::::uninit(); match c::clock_nanosleep(id as c::clockid_t, flags, request, remain.as_mut_ptr()) { @@ -100,10 +90,10 @@ pub(crate) fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> Nanos } #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", + fix_y2038, + not(any(apple, target_os = "emscripten", target_os = "haiku")) ))] -unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> NanosleepRelativeResult { +fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> NanosleepRelativeResult { let tv_sec = match request.tv_sec.try_into() { Ok(tv_sec) => tv_sec, Err(_) => return NanosleepRelativeResult::Err(io::Errno::OVERFLOW), @@ -116,22 +106,24 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos let mut old_remain = MaybeUninit::::uninit(); let flags = 0; - match c::clock_nanosleep( - id as c::clockid_t, - flags, - &old_request, - old_remain.as_mut_ptr(), - ) { - 0 => NanosleepRelativeResult::Ok, - err if err == io::Errno::INTR.0 => { - let old_remain = old_remain.assume_init(); - let remain = Timespec { - tv_sec: old_remain.tv_sec.into(), - tv_nsec: old_remain.tv_nsec.into(), - }; - NanosleepRelativeResult::Interrupted(remain) + unsafe { + match c::clock_nanosleep( + id as c::clockid_t, + flags, + &old_request, + old_remain.as_mut_ptr(), + ) { + 0 => NanosleepRelativeResult::Ok, + err if err == io::Errno::INTR.0 => { + let old_remain = old_remain.assume_init(); + let remain = Timespec { + tv_sec: old_remain.tv_sec.into(), + tv_nsec: old_remain.tv_nsec.into(), + }; + NanosleepRelativeResult::Interrupted(remain) + } + err => NanosleepRelativeResult::Err(io::Errno(err)), } - err => NanosleepRelativeResult::Err(io::Errno(err)), } } @@ -139,6 +131,7 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos apple, target_os = "dragonfly", target_os = "emscripten", + target_os = "espidf", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. target_os = "haiku", target_os = "openbsd", @@ -147,46 +140,46 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos )))] #[inline] pub(crate) fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::Result<()> { - let flags = c::TIMER_ABSTIME; - - // 32-bit gnu version: libc has `clock_nanosleep` but it is not y2038 safe - // by default. - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] + // Old 32-bit version: libc has `clock_nanosleep` but it is not y2038 safe + // by default. But there may be a `__clock_nanosleep_time64` we can use. + #[cfg(fix_y2038)] { + #[cfg(target_env = "gnu")] if let Some(libc_clock_nanosleep) = __clock_nanosleep_time64.get() { - match unsafe { - libc_clock_nanosleep( - id as c::clockid_t, - flags, - &request.clone().into(), - null_mut(), - ) - } { - 0 => Ok(()), - err => Err(io::Errno(err)), + let flags = c::TIMER_ABSTIME; + unsafe { + return match { + libc_clock_nanosleep( + id as c::clockid_t, + flags, + &request.clone().into(), + null_mut(), + ) + } { + 0 => Ok(()), + err => Err(io::Errno(err)), + }; } - } else { - clock_nanosleep_absolute_old(id, request) } + + clock_nanosleep_absolute_old(id, request) } // Main version: libc is y2038 safe and has `clock_nanosleep`. - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] - match unsafe { c::clock_nanosleep(id as c::clockid_t, flags, request, null_mut()) } { - 0 => Ok(()), - err => Err(io::Errno(err)), + #[cfg(not(fix_y2038))] + { + let flags = c::TIMER_ABSTIME; + + match unsafe { c::clock_nanosleep(id as c::clockid_t, flags as _, request, null_mut()) } { + 0 => Ok(()), + err => Err(io::Errno(err)), + } } } #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", + fix_y2038, + not(any(apple, target_os = "emscripten", target_os = "haiku")) ))] fn clock_nanosleep_absolute_old(id: ClockId, request: &Timespec) -> io::Result<()> { let flags = c::TIMER_ABSTIME; @@ -204,33 +197,29 @@ fn clock_nanosleep_absolute_old(id: ClockId, request: &Timespec) -> io::Result<( #[cfg(not(target_os = "redox"))] #[inline] pub(crate) fn nanosleep(request: &Timespec) -> NanosleepRelativeResult { - // 32-bit gnu version: libc has `nanosleep` but it is not y2038 safe by - // default. - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { - let mut remain = MaybeUninit::::uninit(); - + // Old 32-bit version: libc has `nanosleep` but it is not y2038 safe by + // default. But there may be a `__nanosleep64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_nanosleep) = __nanosleep64.get() { - match ret(libc_nanosleep(&request.clone().into(), remain.as_mut_ptr())) { - Ok(()) => NanosleepRelativeResult::Ok, - Err(io::Errno::INTR) => { - NanosleepRelativeResult::Interrupted(remain.assume_init().into()) - } - Err(err) => NanosleepRelativeResult::Err(err), + let mut remain = MaybeUninit::::uninit(); + unsafe { + return match ret(libc_nanosleep(&request.clone().into(), remain.as_mut_ptr())) { + Ok(()) => NanosleepRelativeResult::Ok, + Err(io::Errno::INTR) => { + NanosleepRelativeResult::Interrupted(remain.assume_init().into()) + } + Err(err) => NanosleepRelativeResult::Err(err), + }; } - } else { - nanosleep_old(request) } + + nanosleep_old(request) } // Main version: libc is y2038 safe and has `nanosleep`. - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + #[cfg(not(fix_y2038))] unsafe { let mut remain = MaybeUninit::::uninit(); @@ -242,11 +231,8 @@ pub(crate) fn nanosleep(request: &Timespec) -> NanosleepRelativeResult { } } -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] -unsafe fn nanosleep_old(request: &Timespec) -> NanosleepRelativeResult { +#[cfg(fix_y2038)] +fn nanosleep_old(request: &Timespec) -> NanosleepRelativeResult { let tv_sec = match request.tv_sec.try_into() { Ok(tv_sec) => tv_sec, Err(_) => return NanosleepRelativeResult::Err(io::Errno::OVERFLOW), @@ -258,17 +244,19 @@ unsafe fn nanosleep_old(request: &Timespec) -> NanosleepRelativeResult { let old_request = c::timespec { tv_sec, tv_nsec }; let mut old_remain = MaybeUninit::::uninit(); - match ret(c::nanosleep(&old_request, old_remain.as_mut_ptr())) { - Ok(()) => NanosleepRelativeResult::Ok, - Err(io::Errno::INTR) => { - let old_remain = old_remain.assume_init(); - let remain = Timespec { - tv_sec: old_remain.tv_sec.into(), - tv_nsec: old_remain.tv_nsec.into(), - }; - NanosleepRelativeResult::Interrupted(remain) + unsafe { + match ret(c::nanosleep(&old_request, old_remain.as_mut_ptr())) { + Ok(()) => NanosleepRelativeResult::Ok, + Err(io::Errno::INTR) => { + let old_remain = old_remain.assume_init(); + let remain = Timespec { + tv_sec: old_remain.tv_sec.into(), + tv_nsec: old_remain.tv_nsec.into(), + }; + NanosleepRelativeResult::Interrupted(remain) + } + Err(err) => NanosleepRelativeResult::Err(err), } - Err(err) => NanosleepRelativeResult::Err(err), } } diff --git a/vendor/rustix/src/backend/libc/time/syscalls.rs b/vendor/rustix/src/backend/libc/time/syscalls.rs index 14ca22b2d..603a3b108 100644 --- a/vendor/rustix/src/backend/libc/time/syscalls.rs +++ b/vendor/rustix/src/backend/libc/time/syscalls.rs @@ -2,13 +2,14 @@ use crate::backend::c; use crate::backend::conv::ret; +#[cfg(any(linux_kernel, target_os = "fuchsia"))] +#[cfg(feature = "time")] +#[cfg(any(all(target_env = "gnu", fix_y2038), not(fix_y2038)))] +use crate::backend::time::types::LibcItimerspec; #[cfg(not(target_os = "wasi"))] use crate::clockid::{ClockId, DynamicClockId}; use crate::io; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] use crate::timespec::LibcTimespec; use crate::timespec::Timespec; use core::mem::MaybeUninit; @@ -16,36 +17,22 @@ use core::mem::MaybeUninit; #[cfg(feature = "time")] use { crate::backend::conv::{borrowed_fd, ret_owned_fd}, - crate::backend::time::types::LibcItimerspec, crate::fd::{BorrowedFd, OwnedFd}, crate::time::{Itimerspec, TimerfdClockId, TimerfdFlags, TimerfdTimerFlags}, }; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __clock_gettime64(c::clockid_t, *mut LibcTimespec) -> c::c_int); -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __clock_settime64(c::clockid_t, *const LibcTimespec) -> c::c_int); -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(all(target_env = "gnu", fix_y2038))] weak!(fn __clock_getres64(c::clockid_t, *mut LibcTimespec) -> c::c_int); -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(any(linux_kernel, target_os = "fuchsia"))] +#[cfg(all(target_env = "gnu", fix_y2038))] #[cfg(feature = "time")] weak!(fn __timerfd_gettime64(c::c_int, *mut LibcItimerspec) -> c::c_int); -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(any(linux_kernel, target_os = "fuchsia"))] +#[cfg(all(target_env = "gnu", fix_y2038))] #[cfg(feature = "time")] weak!(fn __timerfd_settime64(c::c_int, c::c_int, *const LibcItimerspec, *mut LibcItimerspec) -> c::c_int); @@ -53,28 +40,24 @@ weak!(fn __timerfd_settime64(c::c_int, c::c_int, *const LibcItimerspec, *mut Lib #[inline] #[must_use] pub(crate) fn clock_getres(id: ClockId) -> Timespec { - // 32-bit gnu version: libc has `clock_getres` but it is not y2038 safe by - // default. - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { - let mut timespec = MaybeUninit::::uninit(); - + // Old 32-bit version: libc has `clock_getres` but it is not y2038 safe by + // default. But there may be a `__clock_getres64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_clock_getres) = __clock_getres64.get() { - ret(libc_clock_getres(id as c::clockid_t, timespec.as_mut_ptr())).unwrap(); - timespec.assume_init().into() - } else { - clock_getres_old(id) + let mut timespec = MaybeUninit::::uninit(); + unsafe { + ret(libc_clock_getres(id as c::clockid_t, timespec.as_mut_ptr())).unwrap(); + return timespec.assume_init().into(); + } } + + clock_getres_old(id) } // Main version: libc is y2038 safe and has `clock_getres`. - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + #[cfg(not(fix_y2038))] unsafe { let mut timespec = MaybeUninit::::uninit(); let _ = c::clock_getres(id as c::clockid_t, timespec.as_mut_ptr()); @@ -82,19 +65,20 @@ pub(crate) fn clock_getres(id: ClockId) -> Timespec { } } -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[must_use] -unsafe fn clock_getres_old(id: ClockId) -> Timespec { +fn clock_getres_old(id: ClockId) -> Timespec { let mut old_timespec = MaybeUninit::::uninit(); - ret(c::clock_getres( - id as c::clockid_t, - old_timespec.as_mut_ptr(), - )) - .unwrap(); - let old_timespec = old_timespec.assume_init(); + + let old_timespec = unsafe { + ret(c::clock_getres( + id as c::clockid_t, + old_timespec.as_mut_ptr(), + )) + .unwrap(); + old_timespec.assume_init() + }; + Timespec { tv_sec: old_timespec.tv_sec.into(), tv_nsec: old_timespec.tv_nsec.into(), @@ -105,33 +89,31 @@ unsafe fn clock_getres_old(id: ClockId) -> Timespec { #[inline] #[must_use] pub(crate) fn clock_gettime(id: ClockId) -> Timespec { - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { - let mut timespec = MaybeUninit::::uninit(); - + // Old 32-bit version: libc has `clock_gettime` but it is not y2038 safe by + // default. But there may be a `__clock_gettime64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_clock_gettime) = __clock_gettime64.get() { - ret(libc_clock_gettime( - id as c::clockid_t, - timespec.as_mut_ptr(), - )) - .unwrap(); - timespec.assume_init().into() - } else { - clock_gettime_old(id) + let mut timespec = MaybeUninit::::uninit(); + unsafe { + ret(libc_clock_gettime( + id as c::clockid_t, + timespec.as_mut_ptr(), + )) + .unwrap(); + return timespec.assume_init().into(); + } } + + clock_gettime_old(id) } // 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. - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + #[cfg(not(fix_y2038))] unsafe { let mut timespec = MaybeUninit::::uninit(); ret(c::clock_gettime(id as c::clockid_t, timespec.as_mut_ptr())).unwrap(); @@ -139,19 +121,20 @@ pub(crate) fn clock_gettime(id: ClockId) -> Timespec { } } -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[must_use] -unsafe fn clock_gettime_old(id: ClockId) -> Timespec { +fn clock_gettime_old(id: ClockId) -> Timespec { let mut old_timespec = MaybeUninit::::uninit(); - ret(c::clock_gettime( - id as c::clockid_t, - old_timespec.as_mut_ptr(), - )) - .unwrap(); - let old_timespec = old_timespec.assume_init(); + + let old_timespec = unsafe { + ret(c::clock_gettime( + id as c::clockid_t, + old_timespec.as_mut_ptr(), + )) + .unwrap(); + old_timespec.assume_init() + }; + Timespec { tv_sec: old_timespec.tv_sec.into(), tv_nsec: old_timespec.tv_nsec.into(), @@ -161,83 +144,85 @@ unsafe fn clock_gettime_old(id: ClockId) -> Timespec { #[cfg(not(target_os = "wasi"))] #[inline] pub(crate) fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result { - unsafe { - let id: c::clockid_t = match id { - DynamicClockId::Known(id) => id as c::clockid_t, - - #[cfg(linux_kernel)] - DynamicClockId::Dynamic(fd) => { - use crate::fd::AsRawFd; - const CLOCKFD: i32 = 3; - (!fd.as_raw_fd() << 3) | CLOCKFD - } + let id: c::clockid_t = match id { + DynamicClockId::Known(id) => id as c::clockid_t, + + #[cfg(linux_kernel)] + DynamicClockId::Dynamic(fd) => { + use crate::fd::AsRawFd; + const CLOCKFD: i32 = 3; + (!fd.as_raw_fd() << 3) | CLOCKFD + } - #[cfg(not(linux_kernel))] - DynamicClockId::Dynamic(_fd) => { - // Dynamic clocks are not supported on this platform. - return Err(io::Errno::INVAL); - } + #[cfg(not(linux_kernel))] + DynamicClockId::Dynamic(_fd) => { + // Dynamic clocks are not supported on this platform. + return Err(io::Errno::INVAL); + } - #[cfg(linux_kernel)] - DynamicClockId::RealtimeAlarm => c::CLOCK_REALTIME_ALARM, + #[cfg(linux_kernel)] + DynamicClockId::RealtimeAlarm => c::CLOCK_REALTIME_ALARM, - #[cfg(linux_kernel)] - DynamicClockId::Tai => c::CLOCK_TAI, + #[cfg(linux_kernel)] + DynamicClockId::Tai => c::CLOCK_TAI, - #[cfg(any(linux_kernel, target_os = "openbsd"))] - DynamicClockId::Boottime => c::CLOCK_BOOTTIME, + #[cfg(any( + freebsdlike, + linux_kernel, + target_os = "fuchsia", + target_os = "openbsd" + ))] + DynamicClockId::Boottime => c::CLOCK_BOOTTIME, - #[cfg(linux_kernel)] - DynamicClockId::BoottimeAlarm => c::CLOCK_BOOTTIME_ALARM, - }; + #[cfg(any(linux_kernel, target_os = "fuchsia"))] + DynamicClockId::BoottimeAlarm => c::CLOCK_BOOTTIME_ALARM, + }; - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - { + // Old 32-bit version: libc has `clock_gettime` but it is not y2038 + // safe by default. But there may be a `__clock_gettime64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] + if let Some(libc_clock_gettime) = __clock_gettime64.get() { let mut timespec = MaybeUninit::::uninit(); - - if let Some(libc_clock_gettime) = __clock_gettime64.get() { + unsafe { ret(libc_clock_gettime( id as c::clockid_t, timespec.as_mut_ptr(), ))?; - Ok(timespec.assume_init().into()) - } else { - clock_gettime_dynamic_old(id) + return Ok(timespec.assume_init().into()); } } - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] - { - let mut timespec = MaybeUninit::::uninit(); + clock_gettime_dynamic_old(id) + } + + // Main version: libc is y2038 safe and has `clock_gettime`. + #[cfg(not(fix_y2038))] + unsafe { + let mut timespec = MaybeUninit::::uninit(); - ret(c::clock_gettime(id as c::clockid_t, timespec.as_mut_ptr()))?; + ret(c::clock_gettime(id as c::clockid_t, timespec.as_mut_ptr()))?; - Ok(timespec.assume_init()) - } + Ok(timespec.assume_init()) } } -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[inline] -unsafe fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result { +fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result { let mut old_timespec = MaybeUninit::::uninit(); - ret(c::clock_gettime( - id as c::clockid_t, - old_timespec.as_mut_ptr(), - ))?; + let old_timespec = unsafe { + ret(c::clock_gettime( + id as c::clockid_t, + old_timespec.as_mut_ptr(), + ))?; + + old_timespec.assume_init() + }; - let old_timespec = old_timespec.assume_init(); Ok(Timespec { tv_sec: old_timespec.tv_sec.into(), tv_nsec: old_timespec.tv_nsec.into(), @@ -251,25 +236,25 @@ unsafe fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result { )))] #[inline] pub(crate) fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> { - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { + // Old 32-bit version: libc has `clock_gettime` but it is not y2038 safe by + // default. But there may be a `__clock_settime64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_clock_settime) = __clock_settime64.get() { - let mut new_timespec = core::mem::zeroed::(); - new_timespec.tv_sec = timespec.tv_sec; - new_timespec.tv_nsec = timespec.tv_nsec as _; - ret(libc_clock_settime(id as c::clockid_t, &new_timespec)) - } else { - clock_settime_old(id, timespec) + unsafe { + let mut new_timespec = core::mem::zeroed::(); + new_timespec.tv_sec = timespec.tv_sec; + new_timespec.tv_nsec = timespec.tv_nsec as _; + return ret(libc_clock_settime(id as c::clockid_t, &new_timespec)); + } } + + clock_settime_old(id, timespec) } - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + // Main version: libc is y2038 safe and has `clock_settime`. + #[cfg(not(fix_y2038))] unsafe { ret(c::clock_settime(id as c::clockid_t, ×pec)) } @@ -280,11 +265,8 @@ pub(crate) fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> { target_os = "wasi", all(apple, not(target_os = "macos")) )))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] -unsafe fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> { +#[cfg(fix_y2038)] +fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> { let old_timespec = c::timespec { tv_sec: timespec .tv_sec @@ -292,7 +274,8 @@ unsafe fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> { .map_err(|_| io::Errno::OVERFLOW)?, tv_nsec: timespec.tv_nsec as _, }; - ret(c::clock_settime(id as c::clockid_t, &old_timespec)) + + unsafe { ret(c::clock_settime(id as c::clockid_t, &old_timespec)) } } #[cfg(any(linux_kernel, target_os = "fuchsia"))] @@ -308,31 +291,30 @@ pub(crate) fn timerfd_settime( flags: TimerfdTimerFlags, new_value: &Itimerspec, ) -> io::Result { - let mut result = MaybeUninit::::uninit(); - - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { + // Old 32-bit version: libc has `timerfd_settime` but it is not y2038 safe + // by default. But there may be a `__timerfd_settime64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_timerfd_settime) = __timerfd_settime64.get() { - ret(libc_timerfd_settime( - borrowed_fd(fd), - bitflags_bits!(flags), - &new_value.clone().into(), - result.as_mut_ptr(), - ))?; - Ok(result.assume_init().into()) - } else { - timerfd_settime_old(fd, flags, new_value) + let mut result = MaybeUninit::::uninit(); + unsafe { + ret(libc_timerfd_settime( + borrowed_fd(fd), + bitflags_bits!(flags), + &new_value.clone().into(), + result.as_mut_ptr(), + ))?; + return Ok(result.assume_init().into()); + } } + + timerfd_settime_old(fd, flags, new_value) } - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + #[cfg(not(fix_y2038))] unsafe { + let mut result = MaybeUninit::::uninit(); ret(c::timerfd_settime( borrowed_fd(fd), bitflags_bits!(flags), @@ -344,12 +326,9 @@ pub(crate) fn timerfd_settime( } #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[cfg(feature = "time")] -unsafe fn timerfd_settime_old( +fn timerfd_settime_old( fd: BorrowedFd<'_>, flags: TimerfdTimerFlags, new_value: &Itimerspec, @@ -384,14 +363,16 @@ unsafe fn timerfd_settime_old( }, }; - ret(c::timerfd_settime( - borrowed_fd(fd), - bitflags_bits!(flags), - &old_new_value, - old_result.as_mut_ptr(), - ))?; + let old_result = unsafe { + ret(c::timerfd_settime( + borrowed_fd(fd), + bitflags_bits!(flags), + &old_new_value, + old_result.as_mut_ptr(), + ))?; + old_result.assume_init() + }; - let old_result = old_result.assume_init(); Ok(Itimerspec { it_interval: Timespec { tv_sec: old_result @@ -415,43 +396,41 @@ unsafe fn timerfd_settime_old( #[cfg(any(linux_kernel, target_os = "fuchsia"))] #[cfg(feature = "time")] pub(crate) fn timerfd_gettime(fd: BorrowedFd<'_>) -> io::Result { - let mut result = MaybeUninit::::uninit(); - - #[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - ))] - unsafe { + // Old 32-bit version: libc has `timerfd_gettime` but it is not y2038 safe + // by default. But there may be a `__timerfd_gettime64` we can use. + #[cfg(fix_y2038)] + { + #[cfg(target_env = "gnu")] if let Some(libc_timerfd_gettime) = __timerfd_gettime64.get() { - ret(libc_timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?; - Ok(result.assume_init().into()) - } else { - timerfd_gettime_old(fd) + let mut result = MaybeUninit::::uninit(); + unsafe { + ret(libc_timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?; + return Ok(result.assume_init().into()); + } } + + timerfd_gettime_old(fd) } - #[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", - )))] + #[cfg(not(fix_y2038))] unsafe { + let mut result = MaybeUninit::::uninit(); ret(c::timerfd_gettime(borrowed_fd(fd), result.as_mut_ptr()))?; Ok(result.assume_init()) } } #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[cfg(feature = "time")] -unsafe fn timerfd_gettime_old(fd: BorrowedFd<'_>) -> io::Result { +fn timerfd_gettime_old(fd: BorrowedFd<'_>) -> io::Result { let mut old_result = MaybeUninit::::uninit(); - ret(c::timerfd_gettime(borrowed_fd(fd), old_result.as_mut_ptr()))?; + let old_result = unsafe { + ret(c::timerfd_gettime(borrowed_fd(fd), old_result.as_mut_ptr()))?; + old_result.assume_init() + }; - let old_result = old_result.assume_init(); Ok(Itimerspec { it_interval: Timespec { tv_sec: old_result diff --git a/vendor/rustix/src/backend/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs index e1d4a8736..75cc61217 100644 --- a/vendor/rustix/src/backend/libc/time/types.rs +++ b/vendor/rustix/src/backend/libc/time/types.rs @@ -1,15 +1,10 @@ #[cfg(any(linux_kernel, target_os = "fuchsia"))] use crate::backend::c; -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(any(linux_kernel, target_os = "fuchsia"))] +#[cfg(fix_y2038)] use crate::timespec::LibcTimespec; #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] use crate::timespec::Timespec; #[cfg(any(linux_kernel, target_os = "fuchsia"))] use bitflags::bitflags; @@ -20,10 +15,7 @@ use bitflags::bitflags; /// [`timerfd_gettime`]: crate::time::timerfd_gettime /// [`timerfd_settime`]: crate::time::timerfd_settime #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -)))] +#[cfg(not(fix_y2038))] pub type Itimerspec = c::itimerspec; /// `struct itimerspec` for use with [`timerfd_gettime`] and @@ -32,10 +24,7 @@ pub type Itimerspec = c::itimerspec; /// [`timerfd_gettime`]: crate::time::timerfd_gettime /// [`timerfd_settime`]: crate::time::timerfd_settime #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[allow(missing_docs)] #[repr(C)] #[derive(Debug, Clone)] @@ -46,19 +35,13 @@ pub struct Itimerspec { /// On most platforms, `LibcItimerspec` is just `Itimerspec`. #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -)))] +#[cfg(not(fix_y2038))] pub(crate) type LibcItimerspec = Itimerspec; /// On 32-bit glibc platforms, `LibcTimespec` differs from `Timespec`, so we /// define our own struct, with bidirectional `From` impls. #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[repr(C)] #[derive(Debug, Clone)] pub(crate) struct LibcItimerspec { @@ -67,10 +50,7 @@ pub(crate) struct LibcItimerspec { } #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] impl From for Itimerspec { #[inline] fn from(t: LibcItimerspec) -> Self { @@ -82,10 +62,7 @@ impl From for Itimerspec { } #[cfg(any(linux_kernel, target_os = "fuchsia"))] -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] impl From for LibcItimerspec { #[inline] fn from(t: Itimerspec) -> Self { @@ -179,7 +156,6 @@ pub enum TimerfdClockId { #[cfg(any(linux_kernel, target_os = "fuchsia"))] #[test] fn test_types() { - use core::mem::size_of; - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(TimerfdFlags, c::c_int); + assert_eq_size!(TimerfdTimerFlags, c::c_int); } diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs new file mode 100644 index 000000000..0f4465d51 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/aarch64.rs @@ -0,0 +1,268 @@ +//! aarch64 Linux system calls. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[cfg(target_pointer_width = "32")] +compile_error!("arm64-ilp32 is not supported yet"); + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + lateout("x0") r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "svc 0", + in("x8") nr.to_asm(), + in("x0") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + in("x3") a3.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + in("x3") a3.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + in("x3") a3.to_asm(), + in("x4") a4.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + in("x3") a3.to_asm(), + in("x4") a4.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + in("x3") a3.to_asm(), + in("x4") a4.to_asm(), + in("x5") a5.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("x8") nr.to_asm(), + inlateout("x0") a0.to_asm() => r0, + in("x1") a1.to_asm(), + in("x2") a2.to_asm(), + in("x3") a3.to_asm(), + in("x4") a4.to_asm(), + in("x5") a5.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs new file mode 100644 index 000000000..9695c6028 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/arm.rs @@ -0,0 +1,265 @@ +//! arm Linux system calls. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + lateout("r0") r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "svc 0", + in("r7") nr.to_asm(), + in("r0") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + in("r5") a5.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "svc 0", + in("r7") nr.to_asm(), + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + in("r5") a5.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs new file mode 100644 index 000000000..b39a16847 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips.rs @@ -0,0 +1,543 @@ +//! mipsel Linux system calls. +//! +//! On mipsel, Linux indicates success or failure using `$a3` rather +//! than by returning a negative error code as most other architectures do. +//! +//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! however we use `__NR_pipe2` instead to avoid having to implement it. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, A6, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "syscall", + in("$2" /*$v0*/) nr.to_asm(), + in("$4" /*$a0*/) a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "sw {}, 20($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + in(reg) a5.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "sw {}, 20($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + in(reg) a5.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall7_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, + a6: ArgReg<'_, A6>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "sw {}, 20($sp)", + "sw {}, 24($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + in(reg) a5.to_asm(), + in(reg) a6.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs new file mode 100644 index 000000000..718e94fa7 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips32r6.rs @@ -0,0 +1,543 @@ +//! mipsisa32r6el Linux system calls. +//! +//! On mipsisa32r6el, Linux indicates success or failure using `$a3` rather +//! than by returning a negative error code as most other architectures do. +//! +//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! however we use `__NR_pipe2` instead to avoid having to implement it. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, A6, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "syscall", + in("$2" /*$v0*/) nr.to_asm(), + in("$4" /*$a0*/) a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "sw {}, 20($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + in(reg) a5.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "sw {}, 20($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + in(reg) a5.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall7_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, + a6: ArgReg<'_, A6>, +) -> RetReg { + let x0; + let err: usize; + asm!( + ".set noat", + "subu $sp, 32", + "sw {}, 16($sp)", + "sw {}, 20($sp)", + "sw {}, 24($sp)", + "syscall", + "addu $sp, 32", + ".set at", + in(reg) a4.to_asm(), + in(reg) a5.to_asm(), + in(reg) a6.to_asm(), + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$t0*/) _, + lateout("$9" /*$t1*/) _, + lateout("$10" /*$t2*/) _, + lateout("$11" /*$t3*/) _, + lateout("$12" /*$t4*/) _, + lateout("$13" /*$t5*/) _, + lateout("$14" /*$t6*/) _, + lateout("$15" /*$t7*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs new file mode 100644 index 000000000..d3c7d341f --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64.rs @@ -0,0 +1,466 @@ +//! mips64el Linux system calls. +//! +//! On mips64el, Linux indicates success or failure using `$a3` (`$7`) rather +//! than by returning a negative error code as most other architectures do. +//! +//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! however we use `__NR_pipe2` instead to avoid having to implement it. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "syscall", + in("$2" /*$v0*/) nr.to_asm(), + in("$4" /*$a0*/) a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + inlateout("$9" /*$a5*/) a5.to_asm() => _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + inlateout("$9" /*$a5*/) a5.to_asm() => _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs new file mode 100644 index 000000000..0a2ebebce --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mips64r6.rs @@ -0,0 +1,470 @@ +//! mipsisa64r6el Linux system calls. +//! +//! On mipsisa64r6el, Linux indicates success or failure using `$a3` (`$7`) +//! rather than by returning a negative error code as most other architectures +//! do. +//! +//! Mips-family platforms have a special calling convention for `__NR_pipe`, +//! however we use `__NR_pipe2` instead to avoid having to implement it. +//! +//! Note that MIPS R6 inline assembly currently doesn't differ from MIPS, +//! because no explicit call of R6-only or R2-only instructions exist here. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "syscall", + in("$2" /*$v0*/) nr.to_asm(), + in("$4" /*$a0*/) a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + lateout("$7" /*$a3*/) err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + lateout("$8" /*$a4*/) _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + lateout("$9" /*$a5*/) _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + inlateout("$9" /*$a5*/) a5.to_asm() => _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let x0; + let err: usize; + asm!( + "syscall", + inlateout("$2" /*$v0*/) nr.to_asm() => x0, + in("$4" /*$a0*/) a0.to_asm(), + in("$5" /*$a1*/) a1.to_asm(), + in("$6" /*$a2*/) a2.to_asm(), + inlateout("$7" /*$a3*/) a3.to_asm() => err, + inlateout("$8" /*$a4*/) a4.to_asm() => _, + inlateout("$9" /*$a5*/) a5.to_asm() => _, + lateout("$10" /*$a6*/) _, + lateout("$11" /*$a7*/) _, + lateout("$12" /*$t0*/) _, + lateout("$13" /*$t1*/) _, + lateout("$14" /*$t2*/) _, + lateout("$15" /*$t3*/) _, + lateout("$24" /*$t8*/) _, + lateout("$25" /*$t9*/) _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(if err != 0 { + (x0 as usize).wrapping_neg() as *mut _ + } else { + x0 + }) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs new file mode 100644 index 000000000..3ea8eb74d --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/mod.rs @@ -0,0 +1,24 @@ +//! 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/powerpc64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs new file mode 100644 index 000000000..8cca7dca7 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/powerpc64.rs @@ -0,0 +1,413 @@ +//! powerpc64le Linux system calls. +//! +//! On powerpc64le, Linux indicates success or failure using `cr0.SO` rather +//! than by returning a negative error code as most other architectures do. In +//! theory we could immediately translate this into a `Result`, and it'd save a +//! few branches. And in theory we could have specialized sequences for use +//! with syscalls that are known to never fail. However, those would require +//! more extensive changes in rustix's platform-independent code. For now, we +//! check the flag and negate the error value to make PowerPC64 look like other +//! architectures. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + lateout("r3") r0, + lateout("r4") _, + lateout("r5") _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + lateout("r4") _, + lateout("r5") _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + lateout("r4") _, + lateout("r5") _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "sc", + in("r0") nr.to_asm(), + in("r3") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + lateout("r5") _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + lateout("r5") _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + lateout("r6") _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + inlateout("r6") a3.to_asm() => _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + inlateout("r6") a3.to_asm() => _, + lateout("r7") _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + inlateout("r6") a3.to_asm() => _, + inlateout("r7") a4.to_asm() => _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + inlateout("r6") a3.to_asm() => _, + inlateout("r7") a4.to_asm() => _, + lateout("r8") _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + inlateout("r6") a3.to_asm() => _, + inlateout("r7") a4.to_asm() => _, + inlateout("r8") a5.to_asm() => _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "sc", + "bns 0f", + "neg 3, 3", + "0:", + inlateout("r0") nr.to_asm() => _, + inlateout("r3") a0.to_asm() => r0, + inlateout("r4") a1.to_asm() => _, + inlateout("r5") a2.to_asm() => _, + inlateout("r6") a3.to_asm() => _, + inlateout("r7") a4.to_asm() => _, + inlateout("r8") a5.to_asm() => _, + lateout("r9") _, + lateout("r10") _, + lateout("r11") _, + lateout("r12") _, + lateout("cr0") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs new file mode 100644 index 000000000..b1e306266 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/riscv64.rs @@ -0,0 +1,265 @@ +//! riscv64 Linux system calls. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + lateout("a0") r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "ecall", + in("a7") nr.to_asm(), + in("a0") a0.to_asm(), + options(noreturn) + ); +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + in("a3") a3.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + in("a3") a3.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + in("a3") a3.to_asm(), + in("a4") a4.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + in("a3") a3.to_asm(), + in("a4") a4.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + in("a3") a3.to_asm(), + in("a4") a4.to_asm(), + in("a5") a5.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "ecall", + in("a7") nr.to_asm(), + inlateout("a0") a0.to_asm() => r0, + in("a1") a1.to_asm(), + in("a2") a2.to_asm(), + in("a3") a3.to_asm(), + in("a4") a4.to_asm(), + in("a5") a5.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs new file mode 100644 index 000000000..398a73dfe --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/thumb.rs @@ -0,0 +1,322 @@ +//! arm Linux system calls, using thumb-mode. +//! +//! In thumb-mode, r7 is the frame pointer and is not permitted to be used in +//! an inline asm operand, so we have to use a different register and copy it +//! into r7 inside the inline asm. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + lateout("r0") r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "mov r7, {nr}", + "svc 0", + nr = in(reg) nr.to_asm(), + in("r0") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + in("r5") a5.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "mov {tmp}, r7", + "mov r7, {nr}", + "svc 0", + "mov r7, {tmp}", + nr = in(reg) nr.to_asm(), + tmp = out(reg) _, + inlateout("r0") a0.to_asm() => r0, + in("r1") a1.to_asm(), + in("r2") a2.to_asm(), + in("r3") a3.to_asm(), + in("r4") a4.to_asm(), + in("r5") a5.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs new file mode 100644 index 000000000..ddef4a854 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/x86.rs @@ -0,0 +1,490 @@ +//! 32-bit x86 Linux system calls. +//! +//! There are two forms; `indirect_*` which take a callee, which allow calling +//! through the vDSO when possible, and plain forms, which use the `int 0x80` +//! instruction. +//! +//! Most `rustix` syscalls use the vsyscall mechanism rather than going using +//! `int 0x80` sequences, as vsyscall is much faster. +//! +//! Syscalls made with `int 0x80` preserve the flags register, while syscalls +//! made using vsyscall do not. + +#![allow(dead_code)] + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use crate::backend::vdso_wrappers::SyscallType; +use core::arch::asm; + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall0( + callee: SyscallType, + nr: SyscallNumber<'_>, +) -> RetReg { + let r0; + asm!( + "call {callee}", + callee = in(reg) callee, + inlateout("eax") nr.to_asm() => r0, + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall1( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "call {callee}", + callee = in(reg) callee, + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall1_noreturn( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> ! { + asm!( + "call {callee}", + callee = in(reg) callee, + in("eax") nr.to_asm(), + in("ebx") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall2( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "call {callee}", + callee = in(reg) callee, + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall3( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "call {callee}", + callee = in(reg) callee, + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall4( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + // a3 should go in esi, but `asm!` won't let us use it as an operand. + // Temporarily swap it into place, and then swap it back afterward. + // + // We hard-code the callee operand to use edi instead of `in(reg)` because + // even though we can't name esi as an operand, the compiler can use esi to + // satisfy `in(reg)`. + asm!( + "xchg esi, {a3}", + "call edi", + "xchg esi, {a3}", + a3 = in(reg) a3.to_asm(), + in("edi") callee, + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall5( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + 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. + asm!( + "push esi", + "push DWORD PTR [eax + 0]", + "mov esi, DWORD PTR [eax + 4]", + "mov eax, DWORD PTR [eax + 8]", + "call DWORD PTR [esp]", + "pop esi", + "pop esi", + inout("eax") &[callee as _, a3.to_asm(), nr.to_asm()] => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + in("edi") a4.to_asm(), + ); + FromAsm::from_asm(r0) +} + +#[allow(clippy::too_many_arguments)] +#[inline] +pub(in crate::backend) unsafe fn indirect_syscall6( + callee: SyscallType, + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + // Oof again. a3 should go in esi, and a5 should go in ebp, and `asm!` + // won't let us use either of those registers as operands. 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. + // + // This is another reason that syscalls should be compiler intrinsics + // rather than inline asm. + asm!( + "push ebp", + "push esi", + "push DWORD PTR [eax + 0]", + "mov esi, DWORD PTR [eax + 4]", + "mov ebp, DWORD PTR [eax + 8]", + "mov eax, DWORD PTR [eax + 12]", + "call DWORD PTR [esp]", + "pop esi", + "pop esi", + "pop ebp", + inout("eax") &[callee as _, a3.to_asm(), a5.to_asm(), nr.to_asm()] => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + in("edi") a4.to_asm(), + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "int $$0x80", + in("eax") nr.to_asm(), + in("ebx") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "int $$0x80", + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + // a3 should go in esi, but `asm!` won't let us use it as an operand. + // Temporarily swap it into place, and then swap it back afterward. + asm!( + "xchg esi, {a3}", + "int $$0x80", + "xchg esi, {a3}", + a3 = in(reg) a3.to_asm(), + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "xchg esi, {a3}", + "int $$0x80", + "xchg esi, {a3}", + a3 = in(reg) a3.to_asm(), + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + // As in `syscall4`, use xchg to handle a3. a4 should go in edi, and we can + // use that register as an operand. Unlike in `indirect_syscall5`, we don't + // have a `callee` operand taking up a register, so we have enough + // registers and don't need to use a slice. + asm!( + "xchg esi, {a3}", + "int $$0x80", + "xchg esi, {a3}", + a3 = in(reg) a3.to_asm(), + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + in("edi") a4.to_asm(), + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + // See the comments in `syscall5`. + asm!( + "xchg esi, {a3}", + "int $$0x80", + "xchg esi, {a3}", + a3 = in(reg) a3.to_asm(), + inlateout("eax") nr.to_asm() => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + in("edi") a4.to_asm(), + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + // See the comments in `indirect_syscall6`. + asm!( + "push ebp", + "push esi", + "mov esi, DWORD PTR [eax + 0]", + "mov ebp, DWORD PTR [eax + 4]", + "mov eax, DWORD PTR [eax + 8]", + "int $$0x80", + "pop esi", + "pop ebp", + inout("eax") &[a3.to_asm(), a5.to_asm(), nr.to_asm()] => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + in("edi") a4.to_asm(), + options(preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + // See the comments in `indirect_syscall6`. + asm!( + "push ebp", + "push esi", + "mov esi, DWORD PTR [eax + 0]", + "mov ebp, DWORD PTR [eax + 4]", + "mov eax, DWORD PTR [eax + 8]", + "int $$0x80", + "pop esi", + "pop ebp", + inout("eax") &[a3.to_asm(), a5.to_asm(), nr.to_asm()] => r0, + in("ebx") a0.to_asm(), + in("ecx") a1.to_asm(), + in("edx") a2.to_asm(), + in("edi") a4.to_asm(), + options(preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs b/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs new file mode 100644 index 000000000..084f5fee4 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/arch/asm/x86_64.rs @@ -0,0 +1,293 @@ +//! x86-64 Linux system calls. + +use crate::backend::reg::{ + ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, +}; +use core::arch::asm; + +#[cfg(target_pointer_width = "32")] +compile_error!("x32 is not yet supported"); + +#[inline] +pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { + asm!( + "syscall", + in("rax") nr.to_asm(), + in("rdi") a0.to_asm(), + options(noreturn) + ) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall2_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall3_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + in("r10") a3.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall4_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + in("r10") a3.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + in("r10") a3.to_asm(), + in("r8") a4.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall5_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + in("r10") a3.to_asm(), + in("r8") a4.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + in("r10") a3.to_asm(), + in("r8") a4.to_asm(), + in("r9") a5.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags) + ); + FromAsm::from_asm(r0) +} + +#[inline] +pub(in crate::backend) unsafe fn syscall6_readonly( + nr: SyscallNumber<'_>, + a0: ArgReg<'_, A0>, + a1: ArgReg<'_, A1>, + a2: ArgReg<'_, A2>, + a3: ArgReg<'_, A3>, + a4: ArgReg<'_, A4>, + a5: ArgReg<'_, A5>, +) -> RetReg { + let r0; + asm!( + "syscall", + inlateout("rax") nr.to_asm() => r0, + in("rdi") a0.to_asm(), + in("rsi") a1.to_asm(), + in("rdx") a2.to_asm(), + in("r10") a3.to_asm(), + in("r8") a4.to_asm(), + in("r9") a5.to_asm(), + lateout("rcx") _, + lateout("r11") _, + options(nostack, preserves_flags, readonly) + ); + FromAsm::from_asm(r0) +} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs deleted file mode 100644 index 0f4465d51..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/aarch64.rs +++ /dev/null @@ -1,268 +0,0 @@ -//! aarch64 Linux system calls. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[cfg(target_pointer_width = "32")] -compile_error!("arm64-ilp32 is not supported yet"); - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - lateout("x0") r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "svc 0", - in("x8") nr.to_asm(), - in("x0") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - in("x3") a3.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - in("x3") a3.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - in("x3") a3.to_asm(), - in("x4") a4.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - in("x3") a3.to_asm(), - in("x4") a4.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - in("x3") a3.to_asm(), - in("x4") a4.to_asm(), - in("x5") a5.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("x8") nr.to_asm(), - inlateout("x0") a0.to_asm() => r0, - in("x1") a1.to_asm(), - in("x2") a2.to_asm(), - in("x3") a3.to_asm(), - in("x4") a4.to_asm(), - in("x5") a5.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs deleted file mode 100644 index 9695c6028..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/arm.rs +++ /dev/null @@ -1,265 +0,0 @@ -//! arm Linux system calls. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - lateout("r0") r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "svc 0", - in("r7") nr.to_asm(), - in("r0") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - in("r5") a5.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "svc 0", - in("r7") nr.to_asm(), - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - in("r5") a5.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs deleted file mode 100644 index b39a16847..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/mips.rs +++ /dev/null @@ -1,543 +0,0 @@ -//! mipsel Linux system calls. -//! -//! On mipsel, Linux indicates success or failure using `$a3` rather -//! than by returning a negative error code as most other architectures do. -//! -//! Mips-family platforms have a special calling convention for `__NR_pipe`, -//! however we use `__NR_pipe2` instead to avoid having to implement it. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, A6, R0, -}; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "syscall", - in("$2" /*$v0*/) nr.to_asm(), - in("$4" /*$a0*/) a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let x0; - let err: usize; - asm!( - ".set noat", - "subu $sp, 32", - "sw {}, 16($sp)", - "syscall", - "addu $sp, 32", - ".set at", - in(reg) a4.to_asm(), - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let x0; - let err: usize; - asm!( - ".set noat", - "subu $sp, 32", - "sw {}, 16($sp)", - "syscall", - "addu $sp, 32", - ".set at", - in(reg) a4.to_asm(), - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let x0; - let err: usize; - asm!( - ".set noat", - "subu $sp, 32", - "sw {}, 16($sp)", - "sw {}, 20($sp)", - "syscall", - "addu $sp, 32", - ".set at", - in(reg) a4.to_asm(), - in(reg) a5.to_asm(), - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let x0; - let err: usize; - asm!( - ".set noat", - "subu $sp, 32", - "sw {}, 16($sp)", - "sw {}, 20($sp)", - "syscall", - "addu $sp, 32", - ".set at", - in(reg) a4.to_asm(), - in(reg) a5.to_asm(), - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall7_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, - a6: ArgReg<'_, A6>, -) -> RetReg { - let x0; - let err: usize; - asm!( - ".set noat", - "subu $sp, 32", - "sw {}, 16($sp)", - "sw {}, 20($sp)", - "sw {}, 24($sp)", - "syscall", - "addu $sp, 32", - ".set at", - in(reg) a4.to_asm(), - in(reg) a5.to_asm(), - in(reg) a6.to_asm(), - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$t0*/) _, - lateout("$9" /*$t1*/) _, - lateout("$10" /*$t2*/) _, - lateout("$11" /*$t3*/) _, - lateout("$12" /*$t4*/) _, - lateout("$13" /*$t5*/) _, - lateout("$14" /*$t6*/) _, - lateout("$15" /*$t7*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs deleted file mode 100644 index d3c7d341f..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/mips64.rs +++ /dev/null @@ -1,466 +0,0 @@ -//! mips64el Linux system calls. -//! -//! On mips64el, Linux indicates success or failure using `$a3` (`$7`) rather -//! than by returning a negative error code as most other architectures do. -//! -//! Mips-family platforms have a special calling convention for `__NR_pipe`, -//! however we use `__NR_pipe2` instead to avoid having to implement it. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "syscall", - in("$2" /*$v0*/) nr.to_asm(), - in("$4" /*$a0*/) a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - lateout("$7" /*$a3*/) err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - lateout("$8" /*$a4*/) _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - inlateout("$8" /*$a4*/) a4.to_asm() => _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - inlateout("$8" /*$a4*/) a4.to_asm() => _, - lateout("$9" /*$a5*/) _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - inlateout("$8" /*$a4*/) a4.to_asm() => _, - inlateout("$9" /*$a5*/) a5.to_asm() => _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let x0; - let err: usize; - asm!( - "syscall", - inlateout("$2" /*$v0*/) nr.to_asm() => x0, - in("$4" /*$a0*/) a0.to_asm(), - in("$5" /*$a1*/) a1.to_asm(), - in("$6" /*$a2*/) a2.to_asm(), - inlateout("$7" /*$a3*/) a3.to_asm() => err, - inlateout("$8" /*$a4*/) a4.to_asm() => _, - inlateout("$9" /*$a5*/) a5.to_asm() => _, - lateout("$10" /*$a6*/) _, - lateout("$11" /*$a7*/) _, - lateout("$12" /*$t0*/) _, - lateout("$13" /*$t1*/) _, - lateout("$14" /*$t2*/) _, - lateout("$15" /*$t3*/) _, - lateout("$24" /*$t8*/) _, - lateout("$25" /*$t9*/) _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(if err != 0 { - (x0 as usize).wrapping_neg() as *mut _ - } else { - x0 - }) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs deleted file mode 100644 index 7c26e23a4..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs +++ /dev/null @@ -1,22 +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 = "mips64", path = "mips64.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/inline/powerpc64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs deleted file mode 100644 index 8cca7dca7..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/powerpc64.rs +++ /dev/null @@ -1,413 +0,0 @@ -//! powerpc64le Linux system calls. -//! -//! On powerpc64le, Linux indicates success or failure using `cr0.SO` rather -//! than by returning a negative error code as most other architectures do. In -//! theory we could immediately translate this into a `Result`, and it'd save a -//! few branches. And in theory we could have specialized sequences for use -//! with syscalls that are known to never fail. However, those would require -//! more extensive changes in rustix's platform-independent code. For now, we -//! check the flag and negate the error value to make PowerPC64 look like other -//! architectures. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - lateout("r3") r0, - lateout("r4") _, - lateout("r5") _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - lateout("r4") _, - lateout("r5") _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - lateout("r4") _, - lateout("r5") _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "sc", - in("r0") nr.to_asm(), - in("r3") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - lateout("r5") _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - lateout("r5") _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - lateout("r6") _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - inlateout("r6") a3.to_asm() => _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - inlateout("r6") a3.to_asm() => _, - lateout("r7") _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - inlateout("r6") a3.to_asm() => _, - inlateout("r7") a4.to_asm() => _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - inlateout("r6") a3.to_asm() => _, - inlateout("r7") a4.to_asm() => _, - lateout("r8") _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - inlateout("r6") a3.to_asm() => _, - inlateout("r7") a4.to_asm() => _, - inlateout("r8") a5.to_asm() => _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "sc", - "bns 0f", - "neg 3, 3", - "0:", - inlateout("r0") nr.to_asm() => _, - inlateout("r3") a0.to_asm() => r0, - inlateout("r4") a1.to_asm() => _, - inlateout("r5") a2.to_asm() => _, - inlateout("r6") a3.to_asm() => _, - inlateout("r7") a4.to_asm() => _, - inlateout("r8") a5.to_asm() => _, - lateout("r9") _, - lateout("r10") _, - lateout("r11") _, - lateout("r12") _, - lateout("cr0") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs deleted file mode 100644 index b1e306266..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/riscv64.rs +++ /dev/null @@ -1,265 +0,0 @@ -//! riscv64 Linux system calls. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - lateout("a0") r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "ecall", - in("a7") nr.to_asm(), - in("a0") a0.to_asm(), - options(noreturn) - ); -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - in("a3") a3.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - in("a3") a3.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - in("a3") a3.to_asm(), - in("a4") a4.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - in("a3") a3.to_asm(), - in("a4") a4.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - in("a3") a3.to_asm(), - in("a4") a4.to_asm(), - in("a5") a5.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "ecall", - in("a7") nr.to_asm(), - inlateout("a0") a0.to_asm() => r0, - in("a1") a1.to_asm(), - in("a2") a2.to_asm(), - in("a3") a3.to_asm(), - in("a4") a4.to_asm(), - in("a5") a5.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs deleted file mode 100644 index 398a73dfe..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/thumb.rs +++ /dev/null @@ -1,322 +0,0 @@ -//! arm Linux system calls, using thumb-mode. -//! -//! In thumb-mode, r7 is the frame pointer and is not permitted to be used in -//! an inline asm operand, so we have to use a different register and copy it -//! into r7 inside the inline asm. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - lateout("r0") r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "mov r7, {nr}", - "svc 0", - nr = in(reg) nr.to_asm(), - in("r0") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - in("r5") a5.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "mov {tmp}, r7", - "mov r7, {nr}", - "svc 0", - "mov r7, {tmp}", - nr = in(reg) nr.to_asm(), - tmp = out(reg) _, - inlateout("r0") a0.to_asm() => r0, - in("r1") a1.to_asm(), - in("r2") a2.to_asm(), - in("r3") a3.to_asm(), - in("r4") a4.to_asm(), - in("r5") a5.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs deleted file mode 100644 index 62947cb04..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/x86.rs +++ /dev/null @@ -1,494 +0,0 @@ -//! 32-bit x86 Linux system calls. -//! -//! There are two forms; `indirect_*` which take a callee, which allow calling -//! through the vDSO when possible, and plain forms, which use the `int 0x80` -//! instruction. -//! -//! Most `rustix` syscalls use the vsyscall mechanism rather than going using -//! `int 0x80` sequences. - -#![allow(dead_code)] - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use crate::backend::vdso_wrappers::SyscallType; -use core::arch::asm; - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall0( - callee: SyscallType, - nr: SyscallNumber<'_>, -) -> RetReg { - let r0; - asm!( - "call {callee}", - callee = in(reg) callee, - inlateout("eax") nr.to_asm() => r0, - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall1( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "call {callee}", - callee = in(reg) callee, - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall1_noreturn( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> ! { - asm!( - "call {callee}", - callee = in(reg) callee, - in("eax") nr.to_asm(), - in("ebx") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall2( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "call {callee}", - callee = in(reg) callee, - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall3( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "call {callee}", - callee = in(reg) callee, - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall4( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - // a3 should go in esi, but `asm!` won't let us use it as an operand. - // Temporarily swap it into place, and then swap it back afterward. - // - // We hard-code the callee operand to use edi instead of `in(reg)` because - // even though we can't name esi as an operand, the compiler can use esi to - // satisfy `in(reg)`. - asm!( - "xchg esi, {a3}", - "call edi", - "xchg esi, {a3}", - a3 = in(reg) a3.to_asm(), - in("edi") callee, - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall5( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - 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. - asm!( - "push esi", - "push DWORD PTR [eax + 0]", - "mov esi, DWORD PTR [eax + 4]", - "mov eax, DWORD PTR [eax + 8]", - "call DWORD PTR [esp]", - "pop esi", - "pop esi", - inout("eax") &[callee as _, a3.to_asm(), nr.to_asm()] => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - in("edi") a4.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[allow(clippy::too_many_arguments)] -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall6( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - // Oof again. a3 should go in esi, and a5 should go in ebp, and `asm!` - // won't let us use either of those registers as operands. 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. - // - // This is another reason that syscalls should be compiler intrinsics - // rather than inline asm. - asm!( - "push ebp", - "push esi", - "push DWORD PTR [eax + 0]", - "mov esi, DWORD PTR [eax + 4]", - "mov ebp, DWORD PTR [eax + 8]", - "mov eax, DWORD PTR [eax + 12]", - "call DWORD PTR [esp]", - "pop esi", - "pop esi", - "pop ebp", - inout("eax") &[callee as _, a3.to_asm(), a5.to_asm(), nr.to_asm()] => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - in("edi") a4.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "int $$0x80", - in("eax") nr.to_asm(), - in("ebx") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "int $$0x80", - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - // a3 should go in esi, but `asm!` won't let us use it as an operand. - // Temporarily swap it into place, and then swap it back afterward. - asm!( - "xchg esi, {a3}", - "int $$0x80", - "xchg esi, {a3}", - a3 = in(reg) a3.to_asm(), - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "xchg esi, {a3}", - "int $$0x80", - "xchg esi, {a3}", - a3 = in(reg) a3.to_asm(), - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - // As in `syscall4`, use xchg to handle a3. a4 should go in edi, and we can - // use that register as an operand. Unlike in `indirect_syscall5`, we don't - // have a `callee` operand taking up a register, so we have enough - // registers and don't need to use a slice. - asm!( - "xchg esi, {a3}", - "int $$0x80", - "xchg esi, {a3}", - a3 = in(reg) a3.to_asm(), - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - in("edi") a4.to_asm(), - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - // See the comments in `syscall5`. - asm!( - "xchg esi, {a3}", - "int $$0x80", - "xchg esi, {a3}", - a3 = in(reg) a3.to_asm(), - inlateout("eax") nr.to_asm() => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - in("edi") a4.to_asm(), - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - // See the comments in `indirect_syscall6`. - asm!( - "push ebp", - "push esi", - "mov esi, DWORD PTR [eax + 0]", - "mov ebp, DWORD PTR [eax + 4]", - "mov eax, DWORD PTR [eax + 8]", - "int $$0x80", - "pop esi", - "pop ebp", - inout("eax") &[a3.to_asm(), a5.to_asm(), nr.to_asm()] => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - in("edi") a4.to_asm(), - options(preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - // See the comments in `indirect_syscall6`. - asm!( - "push ebp", - "push esi", - "mov esi, DWORD PTR [eax + 0]", - "mov ebp, DWORD PTR [eax + 4]", - "mov eax, DWORD PTR [eax + 8]", - "int $$0x80", - "pop esi", - "pop ebp", - inout("eax") &[a3.to_asm(), a5.to_asm(), nr.to_asm()] => r0, - in("ebx") a0.to_asm(), - in("ecx") a1.to_asm(), - in("edx") a2.to_asm(), - in("edi") a4.to_asm(), - options(preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs deleted file mode 100644 index 084f5fee4..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/x86_64.rs +++ /dev/null @@ -1,293 +0,0 @@ -//! x86-64 Linux system calls. - -use crate::backend::reg::{ - ArgReg, FromAsm, RetReg, SyscallNumber, ToAsm, A0, A1, A2, A3, A4, A5, R0, -}; -use core::arch::asm; - -#[cfg(target_pointer_width = "32")] -compile_error!("x32 is not yet supported"); - -#[inline] -pub(in crate::backend) unsafe fn syscall0_readonly(nr: SyscallNumber<'_>) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - asm!( - "syscall", - in("rax") nr.to_asm(), - in("rdi") a0.to_asm(), - options(noreturn) - ) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall2_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall3_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - in("r10") a3.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall4_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - in("r10") a3.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - in("r10") a3.to_asm(), - in("r8") a4.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall5_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - in("r10") a3.to_asm(), - in("r8") a4.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - in("r10") a3.to_asm(), - in("r8") a4.to_asm(), - in("r9") a5.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags) - ); - FromAsm::from_asm(r0) -} - -#[inline] -pub(in crate::backend) unsafe fn syscall6_readonly( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - let r0; - asm!( - "syscall", - inlateout("rax") nr.to_asm() => r0, - in("rdi") a0.to_asm(), - in("rsi") a1.to_asm(), - in("rdx") a2.to_asm(), - in("r10") a3.to_asm(), - in("r8") a4.to_asm(), - in("r9") a5.to_asm(), - lateout("rcx") _, - lateout("r11") _, - options(nostack, preserves_flags, readonly) - ); - FromAsm::from_asm(r0) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/mod.rs index cc93fc2c4..31a8c11f9 100644 --- a/vendor/rustix/src/backend/linux_raw/arch/mod.rs +++ b/vendor/rustix/src/backend/linux_raw/arch/mod.rs @@ -1,28 +1,20 @@ //! Architecture-specific syscall code. //! -//! `rustix` has inline assembly sequences using `asm!`, but that requires -//! Rust 1.59, so it also has out-of-line ("outline") assembly sequences in .s -//! files. And 32-bit x86 is special (see comments below). -//! //! This module also has a `choose` submodule which chooses a scheme and is //! what most of the `rustix` syscalls use. //! //! # Safety //! //! This contains the inline `asm` statements performing the syscall -//! instructions and FFI declarations declaring the out-of-line ("outline") -//! syscall instructions. +//! instructions. #![allow(unsafe_code)] #![cfg_attr(not(feature = "all-apis"), allow(unused_imports))] // We'll use as many arguments as syscalls need. #![allow(clippy::too_many_arguments)] -// When inline asm is available, use it. Otherwise, use out-of-line asm. These -// functions always use the machine's syscall instruction, even when it isn't -// the fastest option available. -#[cfg_attr(asm, path = "inline/mod.rs")] -#[cfg_attr(not(asm), path = "outline/mod.rs")] +// These functions always use the machine's syscall instruction, even when it +// isn't the fastest option available. pub(in crate::backend) mod asm; // On most architectures, the architecture syscall instruction is fast, so use @@ -31,7 +23,9 @@ pub(in crate::backend) mod asm; target_arch = "arm", target_arch = "aarch64", target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "powerpc64", target_arch = "riscv64", target_arch = "x86_64", diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s b/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s deleted file mode 100644 index b016ae124..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/mips.s +++ /dev/null @@ -1,211 +0,0 @@ -# Assembly code for making mips64 syscalls. -# -# mips64 syscall argument register ordering is the same as the mips64 -# userspace argument register ordering except that the syscall number -# (nr) is passed in v0. -# -# outline.rs takes care of reordering the nr argument to the end for us, -# so we only need to move nr into v0. - - .file "mips.s" - .section .mdebug.abi32 - .previous - .abicalls - - .section .text.rustix_syscall0_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall0_nr_last - .hidden rustix_syscall0_nr_last - .type rustix_syscall0_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall0_nr_last -rustix_syscall0_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $4 - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall0_nr_last - .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last - - .section .text.rustix_syscall1_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall1_nr_last - .hidden rustix_syscall1_nr_last - .type rustix_syscall1_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall1_nr_last -rustix_syscall1_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $5 - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall1_nr_last - .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last - - .section .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall1_noreturn_nr_last - .hidden rustix_syscall1_noreturn_nr_last - .type rustix_syscall1_noreturn_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall1_noreturn_nr_last -rustix_syscall1_noreturn_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $5 - syscall - teq $zero, $zero - .end rustix_syscall1_noreturn_nr_last - .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last - - .section .text.rustix_syscall2_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall2_nr_last - .hidden rustix_syscall2_nr_last - .type rustix_syscall2_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall2_nr_last -rustix_syscall2_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $6 - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall2_nr_last - .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last - - .section .text.rustix_syscall3_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall3_nr_last - .hidden rustix_syscall3_nr_last - .type rustix_syscall3_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall3_nr_last -rustix_syscall3_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $7 - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall3_nr_last - .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last - - .section .text.rustix_syscall4_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall4_nr_last - .hidden rustix_syscall4_nr_last - .type rustix_syscall4_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall4_nr_last -rustix_syscall4_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - lw $2, 16($sp) - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall4_nr_last - .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last - - .section .text.rustix_syscall5_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall5_nr_last - .hidden rustix_syscall5_nr_last - .type rustix_syscall5_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall5_nr_last -rustix_syscall5_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - lw $2, 20($sp) - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall5_nr_last - .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last - - .section .text.rustix_syscall6_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall6_nr_last - .hidden rustix_syscall6_nr_last - .type rustix_syscall6_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall6_nr_last -rustix_syscall6_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - lw $2, 24($sp) - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall6_nr_last - .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last - - .section .text.rustix_syscall7_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall7_nr_last - .hidden rustix_syscall7_nr_last - .type rustix_syscall7_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall7_nr_last -rustix_syscall7_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - lw $2, 28($sp) - syscall - negu $8, $2 - jr $31 - movn $2, $8, $7 - .end rustix_syscall7_nr_last - .size rustix_syscall7_nr_last, .-rustix_syscall7_nr_last - - .section .note.GNU-stack,"",@progbits diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s deleted file mode 100644 index a6473990e..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/mips64.s +++ /dev/null @@ -1,189 +0,0 @@ -# Assembly code for making mips64 syscalls. -# -# mips64 syscall argument register ordering is the same as the mips64 -# userspace argument register ordering except that the syscall number -# (nr) is passed in v0. -# -# outline.rs takes care of reordering the nr argument to the end for us, -# so we only need to move nr into v0. - - .file "mips64.s" - .section .mdebug.abi64 - .previous - .abicalls - - .section .text.rustix_syscall0_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall0_nr_last - .hidden rustix_syscall0_nr_last - .type rustix_syscall0_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall0_nr_last -rustix_syscall0_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $4 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall0_nr_last - .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last - - .section .text.rustix_syscall1_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall1_nr_last - .hidden rustix_syscall1_nr_last - .type rustix_syscall1_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall1_nr_last -rustix_syscall1_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $5 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall1_nr_last - .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last - - .section .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall1_noreturn_nr_last - .hidden rustix_syscall1_noreturn_nr_last - .type rustix_syscall1_noreturn_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall1_noreturn_nr_last -rustix_syscall1_noreturn_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $5 - syscall - teq $0, $0 - .end rustix_syscall1_noreturn_nr_last - .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last - - .section .text.rustix_syscall2_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall2_nr_last - .hidden rustix_syscall2_nr_last - .type rustix_syscall2_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall2_nr_last -rustix_syscall2_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $6 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall2_nr_last - .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last - - .section .text.rustix_syscall3_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall3_nr_last - .hidden rustix_syscall3_nr_last - .type rustix_syscall3_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall3_nr_last -rustix_syscall3_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $7 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall3_nr_last - .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last - - .section .text.rustix_syscall4_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall4_nr_last - .hidden rustix_syscall4_nr_last - .type rustix_syscall4_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall4_nr_last -rustix_syscall4_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $8 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall4_nr_last - .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last - - .section .text.rustix_syscall5_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall5_nr_last - .hidden rustix_syscall5_nr_last - .type rustix_syscall5_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall5_nr_last -rustix_syscall5_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $9 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall5_nr_last - .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last - - .section .text.rustix_syscall6_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall6_nr_last - .hidden rustix_syscall6_nr_last - .type rustix_syscall6_nr_last, @function - .set nomips16 - .set nomicromips - .ent rustix_syscall6_nr_last -rustix_syscall6_nr_last: - .frame $sp,0,$31 - .mask 0x00000000,0 - .fmask 0x00000000,0 - .set noreorder - .set nomacro - move $2, $10 - syscall - dnegu $12, $2 - jr $31 - movn $2, $12, $7 - .end rustix_syscall6_nr_last - .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last - - .section .note.GNU-stack,"",@progbits diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs deleted file mode 100644 index 202a2cce9..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -//! Declare functions defined in out-of-line ("outline") asm files. -//! -//! Kernel calling conventions differ from userspace calling conventions, so we -//! also define inline function wrappers which reorder the arguments so that -//! they match with the kernel convention as closely as possible, to minimize -//! the amount of out-of-line code we need. -//! -//! This is needed because as of our MSRV of 1.63, inline asm and naked -//! functions are experimental. - -#[cfg(target_arch = "x86")] -mod x86; -// For these architectures, pass the `nr` argument last. -#[cfg(any( - target_arch = "mips", - target_arch = "mips64", - target_arch = "powerpc64", -))] -mod nr_last; - -#[cfg(any( - target_arch = "mips", - target_arch = "mips64", - target_arch = "powerpc64", -))] -pub(in crate::backend) use nr_last::*; -#[cfg(target_arch = "x86")] -pub(in crate::backend) use x86::*; diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs deleted file mode 100644 index 4af64d6c4..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/nr_last.rs +++ /dev/null @@ -1,166 +0,0 @@ -//! Syscall wrappers for platforms which pass the syscall number specially. -//! -//! Rustix aims to minimize the amount of assembly code it needs. To that end, -//! this code reorders syscall arguments as close as feasible to the actual -//! syscall convention before calling the assembly functions. -//! -//! Many architectures use a convention where the syscall number is passed in a -//! special register, with the regular syscall arguments passed in either the -//! same or similar registers as the platform C convention. This code -//! approximates that order by passing the regular syscall arguments first, and -//! the syscall number last. That way, the outline assembly code typically just -//! needs to move the syscall number to its special register, and leave the -//! other arguments mostly as they are. - -#[cfg(target_arch = "mips")] -use crate::backend::reg::A6; -use crate::backend::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0}; - -// First we declare the actual assembly routines with `*_nr_last` names and -// reordered arguments. If the signatures or calling conventions are ever -// changed, the symbol names should also be updated accordingly, to avoid -// collisions with other versions of this crate. -// -// We don't define `_readonly` versions of these because we have no way to tell -// Rust that calls to our outline assembly are readonly. -extern "C" { - fn rustix_syscall0_nr_last(nr: SyscallNumber<'_>) -> RetReg; - fn rustix_syscall1_nr_last(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> RetReg; - fn rustix_syscall1_noreturn_nr_last(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> !; - fn rustix_syscall2_nr_last( - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall3_nr_last( - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall4_nr_last( - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall5_nr_last( - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall6_nr_last( - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, - nr: SyscallNumber<'_>, - ) -> RetReg; - #[cfg(target_arch = "mips")] - fn rustix_syscall7_nr_last( - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, - a6: ArgReg<'_, A6>, - nr: SyscallNumber<'_>, - ) -> RetReg; -} - -// Then we define inline wrapper functions that do the reordering. - -#[inline] -pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg { - rustix_syscall0_nr_last(nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - rustix_syscall1_nr_last(a0, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - rustix_syscall1_noreturn_nr_last(a0, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - rustix_syscall2_nr_last(a0, a1, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - rustix_syscall3_nr_last(a0, a1, a2, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - rustix_syscall4_nr_last(a0, a1, a2, a3, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - rustix_syscall5_nr_last(a0, a1, a2, a3, a4, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - rustix_syscall6_nr_last(a0, a1, a2, a3, a4, a5, nr) -} -#[cfg(target_arch = "mips")] -#[inline] -pub(in crate::backend) unsafe fn syscall7( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, - a6: ArgReg<'_, A6>, -) -> RetReg { - rustix_syscall7_nr_last(a0, a1, a2, a3, a4, a5, a6, nr) -} - -// Then we define the `_readonly` versions of the wrappers. We don't have -// separate `_readonly` implementations, so these can just be aliases to -// their non-`_readonly` counterparts. -#[cfg(target_arch = "mips")] -pub(in crate::backend) use syscall7 as syscall7_readonly; -pub(in crate::backend) use { - syscall0 as syscall0_readonly, syscall1 as syscall1_readonly, syscall2 as syscall2_readonly, - syscall3 as syscall3_readonly, syscall4 as syscall4_readonly, syscall5 as syscall5_readonly, - syscall6 as syscall6_readonly, -}; diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s b/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s deleted file mode 100644 index 29d4c0a95..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/powerpc64.s +++ /dev/null @@ -1,132 +0,0 @@ -# Assembly code for making powerpc64le syscalls. -# -# powerpc64le syscall argument register ordering is the same as the -# powerpc64le userspace argument register ordering except that the syscall -# number (nr) is passed in r0. -# -# outline.rs takes care of reordering the nr argument to the end for us, -# so we only need to move nr into r0. - - .file "powerpc64le.s" - .machine power8 - .abiversion 2 - - .section .text.rustix_syscall0_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall0_nr_last - .hidden rustix_syscall0_nr_last - .type rustix_syscall0_nr_last, @function -rustix_syscall0_nr_last: - .cfi_startproc - mr 0, 3 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall0_nr_last, .-rustix_syscall0_nr_last - - .section .text.rustix_syscall1_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall1_nr_last - .hidden rustix_syscall1_nr_last - .type rustix_syscall1_nr_last, @function -rustix_syscall1_nr_last: - .cfi_startproc - mr 0, 4 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall1_nr_last, .-rustix_syscall1_nr_last - - .section .text.rustix_syscall1_noreturn_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall1_noreturn_nr_last - .hidden rustix_syscall1_noreturn_nr_last - .type rustix_syscall1_noreturn_nr_last, @function -rustix_syscall1_noreturn_nr_last: - .cfi_startproc - mr 0, 4 - sc - trap - .cfi_endproc - .size rustix_syscall1_noreturn_nr_last, .-rustix_syscall1_noreturn_nr_last - - .section .text.rustix_syscall2_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall2_nr_last - .hidden rustix_syscall2_nr_last - .type rustix_syscall2_nr_last, @function -rustix_syscall2_nr_last: - .cfi_startproc - mr 0, 5 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall2_nr_last, .-rustix_syscall2_nr_last - - .section .text.rustix_syscall3_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall3_nr_last - .hidden rustix_syscall3_nr_last - .type rustix_syscall3_nr_last, @function -rustix_syscall3_nr_last: - .cfi_startproc - mr 0, 6 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall3_nr_last, .-rustix_syscall3_nr_last - - .section .text.rustix_syscall4_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall4_nr_last - .hidden rustix_syscall4_nr_last - .type rustix_syscall4_nr_last, @function -rustix_syscall4_nr_last: - .cfi_startproc - mr 0, 7 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall4_nr_last, .-rustix_syscall4_nr_last - - .section .text.rustix_syscall5_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall5_nr_last - .hidden rustix_syscall5_nr_last - .type rustix_syscall5_nr_last, @function -rustix_syscall5_nr_last: - .cfi_startproc - mr 0, 8 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall5_nr_last, .-rustix_syscall5_nr_last - - .section .text.rustix_syscall6_nr_last,"ax",@progbits - .p2align 2 - .weak rustix_syscall6_nr_last - .hidden rustix_syscall6_nr_last - .type rustix_syscall6_nr_last, @function -rustix_syscall6_nr_last: - .cfi_startproc - mr 0, 9 - sc - bnslr - neg 3, 3 - blr - .cfi_endproc - .size rustix_syscall6_nr_last, .-rustix_syscall6_nr_last - - .section .note.GNU-stack,"",@progbits diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs deleted file mode 100644 index e74b8d2aa..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.rs +++ /dev/null @@ -1,285 +0,0 @@ -//! Syscall wrappers for 32-bit x86. -//! -//! This module is similar to the `nr_last` module, except specialized for -//! 32-bit x86. -//! -//! The syscall convention passes all arguments in registers. The closest we -//! can easily get to that from Rust is to use the fastcall convention which -//! passes the first two arguments in `ecx` and `edx`, which are the second -//! and third Linux syscall arguments. To line them up, this function passes -//! the second and third syscall argument as the first and second argument to -//! the outline assembly, followed by the first syscall argument, and then the -//! rest of the syscall arguments. The assembly code still has to do some work, -//! but at least we can get up to two arguments into the right place for it. - -#![allow(dead_code, unused_imports)] - -use crate::backend::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0}; -use crate::backend::vdso_wrappers::SyscallType; - -// First we declare the actual assembly routines with `*_nr_last_fastcall` -// names and reordered arguments. If the signatures or calling conventions are -// ever changed, the symbol names should also be updated accordingly, to avoid -// collisions with other versions of this crate. -// -// We don't define `_readonly` versions of these because we have no way to tell -// Rust that calls to our outline assembly are readonly. -extern "fastcall" { - fn rustix_syscall0_nr_last_fastcall(nr: SyscallNumber<'_>) -> RetReg; - fn rustix_syscall1_nr_last_fastcall(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> RetReg; - fn rustix_syscall1_noreturn_nr_last_fastcall(a0: ArgReg<'_, A0>, nr: SyscallNumber<'_>) -> !; - fn rustix_syscall2_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a0: ArgReg<'_, A0>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall3_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall4_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - a3: ArgReg<'_, A3>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall5_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - nr: SyscallNumber<'_>, - ) -> RetReg; - fn rustix_syscall6_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, - nr: SyscallNumber<'_>, - ) -> RetReg; -} - -// Then we define inline wrapper functions that do the reordering. - -#[inline] -pub(in crate::backend) unsafe fn syscall0(nr: SyscallNumber<'_>) -> RetReg { - rustix_syscall0_nr_last_fastcall(nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall1(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> RetReg { - rustix_syscall1_nr_last_fastcall(a0, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall1_noreturn(nr: SyscallNumber<'_>, a0: ArgReg<'_, A0>) -> ! { - rustix_syscall1_noreturn_nr_last_fastcall(a0, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall2( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - rustix_syscall2_nr_last_fastcall(a1, a0, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall3( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - rustix_syscall3_nr_last_fastcall(a1, a2, a0, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall4( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - rustix_syscall4_nr_last_fastcall(a1, a2, a0, a3, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall5( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - rustix_syscall5_nr_last_fastcall(a1, a2, a0, a3, a4, nr) -} -#[inline] -pub(in crate::backend) unsafe fn syscall6( - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - rustix_syscall6_nr_last_fastcall(a1, a2, a0, a3, a4, a5, nr) -} - -// Then we define the `_readonly` versions of the wrappers. We don't have -// separate `_readonly` implementations, so these can just be aliases to -// their non-`_readonly` counterparts. -pub(in crate::backend) use { - syscall0 as syscall0_readonly, syscall1 as syscall1_readonly, syscall2 as syscall2_readonly, - syscall3 as syscall3_readonly, syscall4 as syscall4_readonly, syscall5 as syscall5_readonly, - syscall6 as syscall6_readonly, -}; - -// x86 prefers to route all syscalls through the vDSO, though this isn't -// always possible, so it also has a special form for doing the dispatch. -// -// First we declare the actual assembly routines with `*_nr_last_fastcall` -// names and reordered arguments. If the signatures or calling conventions are -// ever changed, the symbol names should also be updated accordingly, to avoid -// collisions with other versions of this crate. -extern "fastcall" { - fn rustix_indirect_syscall0_nr_last_fastcall( - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; - fn rustix_indirect_syscall1_nr_last_fastcall( - a0: ArgReg<'_, A0>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; - fn rustix_indirect_syscall1_noreturn_nr_last_fastcall( - a0: ArgReg<'_, A0>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> !; - fn rustix_indirect_syscall2_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a0: ArgReg<'_, A0>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; - fn rustix_indirect_syscall3_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; - fn rustix_indirect_syscall4_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - a3: ArgReg<'_, A3>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; - fn rustix_indirect_syscall5_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; - fn rustix_indirect_syscall6_nr_last_fastcall( - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a0: ArgReg<'_, A0>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, - nr: SyscallNumber<'_>, - callee: SyscallType, - ) -> RetReg; -} - -// Then we define inline wrapper functions that do the reordering. - -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall0( - callee: SyscallType, - nr: SyscallNumber<'_>, -) -> RetReg { - rustix_indirect_syscall0_nr_last_fastcall(nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall1( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> RetReg { - rustix_indirect_syscall1_nr_last_fastcall(a0, nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall1_noreturn( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, -) -> ! { - rustix_indirect_syscall1_noreturn_nr_last_fastcall(a0, nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall2( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, -) -> RetReg { - rustix_indirect_syscall2_nr_last_fastcall(a1, a0, nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall3( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, -) -> RetReg { - rustix_indirect_syscall3_nr_last_fastcall(a1, a2, a0, nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall4( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, -) -> RetReg { - rustix_indirect_syscall4_nr_last_fastcall(a1, a2, a0, a3, nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall5( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, -) -> RetReg { - rustix_indirect_syscall5_nr_last_fastcall(a1, a2, a0, a3, a4, nr, callee) -} -#[inline] -pub(in crate::backend) unsafe fn indirect_syscall6( - callee: SyscallType, - nr: SyscallNumber<'_>, - a0: ArgReg<'_, A0>, - a1: ArgReg<'_, A1>, - a2: ArgReg<'_, A2>, - a3: ArgReg<'_, A3>, - a4: ArgReg<'_, A4>, - a5: ArgReg<'_, A5>, -) -> RetReg { - rustix_indirect_syscall6_nr_last_fastcall(a1, a2, a0, a3, a4, a5, nr, callee) -} diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s b/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s deleted file mode 100644 index bda234e1a..000000000 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/x86.s +++ /dev/null @@ -1,381 +0,0 @@ -// Assembly code for making x86 syscalls. -// -// On x86 we use the "fastcall" convention which passes the first two -// arguments in ecx and edx. Outline.rs reorders the arguments to put -// a1 and a2 in those registers so they we don't have to move them to -// set up the kernel convention. -// -// "fastcall" expects callee to pop argument stack space, so we use -// `ret imm` instructions to clean up the stack. We don't need callee -// cleanup per se, it just comes along with using "fastcall". - - .file "x86.s" - .intel_syntax noprefix - - .section .text.rustix_indirect_syscall0_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall0_nr_last_fastcall - .hidden rustix_indirect_syscall0_nr_last_fastcall - .type rustix_indirect_syscall0_nr_last_fastcall, @function -rustix_indirect_syscall0_nr_last_fastcall: - .cfi_startproc - mov eax,ecx - call edx - ret - .cfi_endproc - .size rustix_indirect_syscall0_nr_last_fastcall, .-rustix_indirect_syscall0_nr_last_fastcall - - .section .text.rustix_indirect_syscall1_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall1_nr_last_fastcall - .hidden rustix_indirect_syscall1_nr_last_fastcall - .type rustix_indirect_syscall1_nr_last_fastcall, @function -rustix_indirect_syscall1_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - .cfi_offset ebx, -8 - mov ebx,ecx - mov eax,edx - call DWORD PTR [esp+0x8] - pop ebx - .cfi_def_cfa_offset 4 - ret 0x4 - .cfi_endproc - .size rustix_indirect_syscall1_nr_last_fastcall, .-rustix_indirect_syscall1_nr_last_fastcall - - .section .text.rustix_indirect_syscall1_noreturn_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall1_noreturn_nr_last_fastcall - .hidden rustix_indirect_syscall1_noreturn_nr_last_fastcall - .type rustix_indirect_syscall1_noreturn_nr_last_fastcall, @function -rustix_indirect_syscall1_noreturn_nr_last_fastcall: - .cfi_startproc - mov ebx,ecx - mov eax,edx - call DWORD PTR [esp+0x4] - ud2 - .cfi_endproc - .size rustix_indirect_syscall1_noreturn_nr_last_fastcall, .-rustix_indirect_syscall1_noreturn_nr_last_fastcall - - .section .text.rustix_indirect_syscall2_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall2_nr_last_fastcall - .hidden rustix_indirect_syscall2_nr_last_fastcall - .type rustix_indirect_syscall2_nr_last_fastcall, @function -rustix_indirect_syscall2_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - .cfi_offset ebx, -8 - mov ebx,edx - mov eax,DWORD PTR [esp+0x8] - call DWORD PTR [esp+0xc] - pop ebx - .cfi_def_cfa_offset 4 - ret 0x8 - .cfi_endproc - .size rustix_indirect_syscall2_nr_last_fastcall, .-rustix_indirect_syscall2_nr_last_fastcall - - .section .text.rustix_indirect_syscall3_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall3_nr_last_fastcall - .hidden rustix_indirect_syscall3_nr_last_fastcall - .type rustix_indirect_syscall3_nr_last_fastcall, @function -rustix_indirect_syscall3_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0x8] - mov eax,DWORD PTR [esp+0xc] - call DWORD PTR [esp+0x10] - pop ebx - .cfi_def_cfa_offset 4 - ret 0xc - .cfi_endproc - .size rustix_indirect_syscall3_nr_last_fastcall, .-rustix_indirect_syscall3_nr_last_fastcall - - .section .text.rustix_indirect_syscall4_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall4_nr_last_fastcall - .hidden rustix_indirect_syscall4_nr_last_fastcall - .type rustix_indirect_syscall4_nr_last_fastcall, @function -rustix_indirect_syscall4_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - push esi - .cfi_def_cfa_offset 12 - .cfi_offset esi, -12 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0xc] - mov esi,DWORD PTR [esp+0x10] - mov eax,DWORD PTR [esp+0x14] - call DWORD PTR [esp+0x18] - pop esi - .cfi_def_cfa_offset 8 - pop ebx - .cfi_def_cfa_offset 4 - ret 0x10 - .cfi_endproc - .size rustix_indirect_syscall4_nr_last_fastcall, .-rustix_indirect_syscall4_nr_last_fastcall - - .section .text.rustix_indirect_syscall5_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall5_nr_last_fastcall - .hidden rustix_indirect_syscall5_nr_last_fastcall - .type rustix_indirect_syscall5_nr_last_fastcall, @function -rustix_indirect_syscall5_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - push esi - .cfi_def_cfa_offset 12 - push edi - .cfi_def_cfa_offset 16 - .cfi_offset edi, -16 - .cfi_offset esi, -12 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0x10] - mov esi,DWORD PTR [esp+0x14] - mov edi,DWORD PTR [esp+0x18] - mov eax,DWORD PTR [esp+0x1c] - call DWORD PTR [esp+0x20] - pop edi - .cfi_def_cfa_offset 12 - pop esi - .cfi_def_cfa_offset 8 - pop ebx - .cfi_def_cfa_offset 4 - ret 0x14 - .cfi_endproc - .size rustix_indirect_syscall5_nr_last_fastcall, .-rustix_indirect_syscall5_nr_last_fastcall - - .section .text.rustix_indirect_syscall6_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_indirect_syscall6_nr_last_fastcall - .hidden rustix_indirect_syscall6_nr_last_fastcall - .type rustix_indirect_syscall6_nr_last_fastcall, @function -rustix_indirect_syscall6_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - push esi - .cfi_def_cfa_offset 12 - push edi - .cfi_def_cfa_offset 16 - push ebp - .cfi_def_cfa_offset 20 - .cfi_offset ebp, -20 - .cfi_offset edi, -16 - .cfi_offset esi, -12 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0x14] - mov esi,DWORD PTR [esp+0x18] - mov edi,DWORD PTR [esp+0x1c] - mov ebp,DWORD PTR [esp+0x20] - mov eax,DWORD PTR [esp+0x24] - call DWORD PTR [esp+0x28] - pop ebp - .cfi_def_cfa_offset 16 - pop edi - .cfi_def_cfa_offset 12 - pop esi - .cfi_def_cfa_offset 8 - pop ebx - .cfi_def_cfa_offset 4 - ret 0x18 - .cfi_endproc - .size rustix_indirect_syscall6_nr_last_fastcall, .-rustix_indirect_syscall6_nr_last_fastcall - - .section .text.rustix_syscall0_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall0_nr_last_fastcall - .hidden rustix_syscall0_nr_last_fastcall - .type rustix_syscall0_nr_last_fastcall, @function -rustix_syscall0_nr_last_fastcall: - .cfi_startproc - mov eax,ecx - int 0x80 - ret - .cfi_endproc - .size rustix_syscall0_nr_last_fastcall, .-rustix_syscall0_nr_last_fastcall - - .section .text.rustix_syscall1_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall1_nr_last_fastcall - .hidden rustix_syscall1_nr_last_fastcall - .type rustix_syscall1_nr_last_fastcall, @function -rustix_syscall1_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - .cfi_offset ebx, -8 - mov eax,edx - mov ebx,ecx - int 0x80 - pop ebx - .cfi_def_cfa_offset 4 - ret - .cfi_endproc - .size rustix_syscall1_nr_last_fastcall, .-rustix_syscall1_nr_last_fastcall - - .section .text.rustix_syscall1_noreturn_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall1_noreturn_nr_last_fastcall - .hidden rustix_syscall1_noreturn_nr_last_fastcall - .type rustix_syscall1_noreturn_nr_last_fastcall, @function -rustix_syscall1_noreturn_nr_last_fastcall: - .cfi_startproc - mov eax,edx - mov ebx,ecx - int 0x80 - ud2 - .cfi_endproc - .size rustix_syscall1_noreturn_nr_last_fastcall, .-rustix_syscall1_noreturn_nr_last_fastcall - - .section .text.rustix_syscall2_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall2_nr_last_fastcall - .hidden rustix_syscall2_nr_last_fastcall - .type rustix_syscall2_nr_last_fastcall, @function -rustix_syscall2_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - .cfi_offset ebx, -8 - mov ebx,edx - mov eax,DWORD PTR [esp+0x8] - int 0x80 - pop ebx - .cfi_def_cfa_offset 4 - ret 0x4 - .cfi_endproc - .size rustix_syscall2_nr_last_fastcall, .-rustix_syscall2_nr_last_fastcall - - .section .text.rustix_syscall3_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall3_nr_last_fastcall - .hidden rustix_syscall3_nr_last_fastcall - .type rustix_syscall3_nr_last_fastcall, @function -rustix_syscall3_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0x8] - mov eax,DWORD PTR [esp+0xc] - int 0x80 - pop ebx - .cfi_def_cfa_offset 4 - ret 0x8 - .cfi_endproc - .size rustix_syscall3_nr_last_fastcall, .-rustix_syscall3_nr_last_fastcall - - .section .text.rustix_syscall4_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall4_nr_last_fastcall - .hidden rustix_syscall4_nr_last_fastcall - .type rustix_syscall4_nr_last_fastcall, @function -rustix_syscall4_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - push esi - .cfi_def_cfa_offset 12 - .cfi_offset esi, -12 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0xc] - mov esi,DWORD PTR [esp+0x10] - mov eax,DWORD PTR [esp+0x14] - int 0x80 - pop esi - .cfi_def_cfa_offset 8 - pop ebx - .cfi_def_cfa_offset 4 - ret 0xc - .cfi_endproc - .size rustix_syscall4_nr_last_fastcall, .-rustix_syscall4_nr_last_fastcall - - .section .text.rustix_syscall5_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall5_nr_last_fastcall - .hidden rustix_syscall5_nr_last_fastcall - .type rustix_syscall5_nr_last_fastcall, @function -rustix_syscall5_nr_last_fastcall: - .cfi_startproc - push ebx - .cfi_def_cfa_offset 8 - push edi - .cfi_def_cfa_offset 12 - push esi - .cfi_def_cfa_offset 16 - .cfi_offset esi, -16 - .cfi_offset edi, -12 - .cfi_offset ebx, -8 - mov ebx,DWORD PTR [esp+0x10] - mov esi,DWORD PTR [esp+0x14] - mov edi,DWORD PTR [esp+0x18] - mov eax,DWORD PTR [esp+0x1c] - int 0x80 - pop esi - .cfi_def_cfa_offset 12 - pop edi - .cfi_def_cfa_offset 8 - pop ebx - .cfi_def_cfa_offset 4 - ret 0x10 - .cfi_endproc - .size rustix_syscall5_nr_last_fastcall, .-rustix_syscall5_nr_last_fastcall - - .section .text.rustix_syscall6_nr_last_fastcall,"ax",@progbits - .p2align 4 - .weak rustix_syscall6_nr_last_fastcall - .hidden rustix_syscall6_nr_last_fastcall - .type rustix_syscall6_nr_last_fastcall, @function -rustix_syscall6_nr_last_fastcall: - .cfi_startproc - push ebp - .cfi_def_cfa_offset 8 - push ebx - .cfi_def_cfa_offset 12 - push edi - .cfi_def_cfa_offset 16 - push esi - .cfi_def_cfa_offset 20 - .cfi_offset esi, -20 - .cfi_offset edi, -16 - .cfi_offset ebx, -12 - .cfi_offset ebp, -8 - mov ebx,DWORD PTR [esp+0x14] - mov esi,DWORD PTR [esp+0x18] - mov edi,DWORD PTR [esp+0x1c] - mov ebp,DWORD PTR [esp+0x20] - mov eax,DWORD PTR [esp+0x24] - int 0x80 - pop esi - .cfi_def_cfa_offset 16 - pop edi - .cfi_def_cfa_offset 12 - pop ebx - .cfi_def_cfa_offset 8 - pop ebp - .cfi_def_cfa_offset 4 - ret 0x14 - .cfi_endproc - .size rustix_syscall6_nr_last_fastcall, .-rustix_syscall6_nr_last_fastcall - - .section .text.rustix_int_0x80,"ax",@progbits - .p2align 4 - .weak rustix_int_0x80 - .hidden rustix_int_0x80 - .type rustix_int_0x80, @function -rustix_int_0x80: - .cfi_startproc - int 0x80 - ret - .cfi_endproc - .size rustix_int_0x80, .-rustix_int_0x80 - - .section .note.GNU-stack,"",@progbits diff --git a/vendor/rustix/src/backend/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs index 8e77c82d7..f336392bb 100644 --- a/vendor/rustix/src/backend/linux_raw/c.rs +++ b/vendor/rustix/src/backend/linux_raw/c.rs @@ -104,7 +104,15 @@ pub(crate) use linux_raw_sys::{ // On MIPS, `TCSANOW` et al have `TCSETS` added to them, so we need it to // subtract it out. -#[cfg(all(feature = "termios", any(target_arch = "mips", target_arch = "mips64")))] +#[cfg(all( + feature = "termios", + any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + ) +))] pub(crate) use linux_raw_sys::ioctl::TCSETS; // Define our own `uid_t` and `gid_t` if the kernel's versions are not 32-bit. @@ -134,7 +142,9 @@ pub(crate) const SIGALRM: c_int = linux_raw_sys::general::SIGALRM as _; pub(crate) const SIGTERM: c_int = linux_raw_sys::general::SIGTERM as _; #[cfg(not(any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" )))] @@ -156,7 +166,9 @@ pub(crate) const SIGPWR: c_int = linux_raw_sys::general::SIGPWR as _; pub(crate) const SIGSYS: c_int = linux_raw_sys::general::SIGSYS as _; #[cfg(any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ))] diff --git a/vendor/rustix/src/backend/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs index 05d040204..c87136f8f 100644 --- a/vendor/rustix/src/backend/linux_raw/conv.rs +++ b/vendor/rustix/src/backend/linux_raw/conv.rs @@ -436,19 +436,79 @@ pub(crate) mod fs { c_uint(access.bits()) } } +} - impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { - #[inline] - fn from(flags: crate::backend::fs::types::MountFlagsArg) -> Self { - c_uint(flags.0) - } +#[cfg(any(feature = "fs", feature = "mount"))] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::MountFlagsArg) -> Self { + c_uint(flags.0) } +} - impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { - #[inline] - fn from(flags: crate::backend::fs::types::UnmountFlags) -> Self { - c_uint(flags.bits()) - } +// When the deprecated "fs" aliases are removed, we can remove the "fs" +// here too. +#[cfg(any(feature = "fs", feature = "mount"))] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::UnmountFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(cmd: crate::mount::FsConfigCmd) -> Self { + c_uint(cmd as c::c_uint) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::FsOpenFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::FsMountFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::MountAttrFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::OpenTreeFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::FsPickFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[cfg(feature = "mount")] +impl<'a, Num: ArgNumber> From for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::backend::mount::types::MoveMountFlags) -> Self { + c_uint(flags.bits()) } } diff --git a/vendor/rustix/src/backend/linux_raw/elf.rs b/vendor/rustix/src/backend/linux_raw/elf.rs index 7797f4e21..415f79f88 100644 --- a/vendor/rustix/src/backend/linux_raw/elf.rs +++ b/vendor/rustix/src/backend/linux_raw/elf.rs @@ -62,7 +62,12 @@ pub(super) const EM_CURRENT: u16 = 40; // EM_ARM 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 = "mips64"))] +#[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 diff --git a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs index 78a2088b2..b3d4cd66c 100644 --- a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs @@ -18,6 +18,7 @@ use crate::backend::conv::{loff_t, loff_t_from_u64, ret_u64}; target_arch = "aarch64", target_arch = "riscv64", target_arch = "mips64", + target_arch = "mips64r6", target_pointer_width = "32", ))] use crate::fd::AsFd; @@ -32,7 +33,7 @@ use crate::fs::{ }; use crate::io; use core::mem::{transmute, zeroed, MaybeUninit}; -#[cfg(target_arch = "mips64")] +#[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, @@ -206,9 +207,9 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result { } SeekFrom::End(offset) => (SEEK_END, offset), SeekFrom::Current(offset) => (SEEK_CUR, offset), - #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))] + #[cfg(target_os = "linux")] SeekFrom::Data(offset) => (SEEK_DATA, offset), - #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))] + #[cfg(target_os = "linux")] SeekFrom::Hole(offset) => (SEEK_HOLE, offset), }; _seek(fd, offset, whence) @@ -252,7 +253,12 @@ pub(crate) fn ftruncate(fd: BorrowedFd<'_>, length: u64) -> io::Result<()> { // #[cfg(all( target_pointer_width = "32", - any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc"), + any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "powerpc" + ), ))] unsafe { ret(syscall_readonly!( @@ -265,7 +271,12 @@ pub(crate) fn ftruncate(fd: BorrowedFd<'_>, length: u64) -> io::Result<()> { } #[cfg(all( target_pointer_width = "32", - not(any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc")), + not(any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "powerpc" + )), ))] unsafe { ret(syscall_readonly!( @@ -348,7 +359,7 @@ pub(crate) fn fadvise(fd: BorrowedFd<'_>, pos: u64, len: u64, advice: Advice) -> } // On mips, the arguments are not reordered, and padding is inserted // instead to ensure alignment. - #[cfg(target_arch = "mips")] + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] unsafe { ret(syscall_readonly!( __NR_fadvise64, @@ -363,7 +374,12 @@ pub(crate) fn fadvise(fd: BorrowedFd<'_>, pos: u64, len: u64, advice: Advice) -> } #[cfg(all( target_pointer_width = "32", - not(any(target_arch = "arm", target_arch = "mips", target_arch = "powerpc")), + not(any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "powerpc" + )), ))] unsafe { ret(syscall_readonly!( @@ -427,7 +443,11 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result { // And, some old platforms don't support `statx`, and some fail with a // confusing error code, so we call `crate::fs::statx` to handle that. If // `statx` isn't available, fall back to the buggy system call. - #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] + #[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ))] { match crate::fs::statx(fd, cstr!(""), AtFlags::EMPTY_PATH, StatxFlags::BASIC_STATS) { Ok(x) => statx_to_stat(x), @@ -436,7 +456,11 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result { } } - #[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))] + #[cfg(all( + target_pointer_width = "64", + not(target_arch = "mips64"), + not(target_arch = "mips64r6") + ))] unsafe { let mut result = MaybeUninit::::uninit(); ret(syscall!(__NR_fstat, fd, &mut result))?; @@ -444,11 +468,15 @@ pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result { } } -#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] +#[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6", +))] fn fstat_old(fd: BorrowedFd<'_>) -> io::Result { let mut result = MaybeUninit::::uninit(); - #[cfg(target_arch = "mips64")] + #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] unsafe { ret(syscall!(__NR_fstat, fd, &mut result))?; stat_to_stat(result.assume_init()) @@ -464,7 +492,11 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result { #[inline] pub(crate) fn stat(path: &CStr) -> io::Result { // See the comments in `fstat` about using `crate::fs::statx` here. - #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] + #[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ))] { match crate::fs::statx( crate::fs::CWD.as_fd(), @@ -478,7 +510,11 @@ pub(crate) fn stat(path: &CStr) -> io::Result { } } - #[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))] + #[cfg(all( + target_pointer_width = "64", + not(target_arch = "mips64"), + not(target_arch = "mips64r6"), + ))] unsafe { let mut result = MaybeUninit::::uninit(); ret(syscall!( @@ -492,11 +528,15 @@ pub(crate) fn stat(path: &CStr) -> io::Result { } } -#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] +#[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" +))] fn stat_old(path: &CStr) -> io::Result { let mut result = MaybeUninit::::uninit(); - #[cfg(target_arch = "mips64")] + #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] unsafe { ret(syscall!( __NR_newfstatat, @@ -524,7 +564,11 @@ fn stat_old(path: &CStr) -> io::Result { #[inline] pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result { // See the comments in `fstat` about using `crate::fs::statx` here. - #[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] + #[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" + ))] { match crate::fs::statx(dirfd, path, flags, StatxFlags::BASIC_STATS) { Ok(x) => statx_to_stat(x), @@ -533,7 +577,11 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io:: } } - #[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))] + #[cfg(all( + target_pointer_width = "64", + not(target_arch = "mips64"), + not(target_arch = "mips64r6"), + ))] unsafe { let mut result = MaybeUninit::::uninit(); ret(syscall!(__NR_newfstatat, dirfd, path, &mut result, flags))?; @@ -541,11 +589,15 @@ pub(crate) fn statat(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io:: } } -#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] +#[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" +))] fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result { let mut result = MaybeUninit::::uninit(); - #[cfg(target_arch = "mips64")] + #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] unsafe { ret(syscall!(__NR_newfstatat, dirfd, path, &mut result, flags))?; stat_to_stat(result.assume_init()) @@ -593,7 +645,7 @@ pub(crate) fn lstat(path: &CStr) -> io::Result { fn lstat_old(path: &CStr) -> io::Result { let mut result = MaybeUninit::::uninit(); - #[cfg(target_arch = "mips64")] + #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] unsafe { ret(syscall!( __NR_newfstatat, @@ -619,7 +671,11 @@ fn lstat_old(path: &CStr) -> io::Result { } /// Convert from a Linux `statx` value to rustix's `Stat`. -#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] +#[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" +))] fn statx_to_stat(x: crate::fs::Statx) -> io::Result { Ok(Stat { st_dev: crate::fs::makedev(x.stx_dev_major, x.stx_dev_minor), @@ -686,7 +742,7 @@ fn stat_to_stat(s64: linux_raw_sys::general::stat64) -> io::Result { } /// Convert from a Linux `stat` value to rustix's `Stat`. -#[cfg(target_arch = "mips64")] +#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] fn stat_to_stat(s: linux_raw_sys::general::stat) -> io::Result { Ok(Stat { st_dev: s.st_dev.try_into().map_err(|_| io::Errno::OVERFLOW)?, @@ -1416,31 +1472,6 @@ pub(crate) fn sendfile( } } -#[inline] -pub(crate) fn mount( - source: Option<&CStr>, - target: &CStr, - file_system_type: Option<&CStr>, - flags: super::types::MountFlagsArg, - data: Option<&CStr>, -) -> io::Result<()> { - unsafe { - ret(syscall_readonly!( - __NR_mount, - source, - target, - file_system_type, - flags, - data - )) - } -} - -#[inline] -pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> { - unsafe { ret(syscall_readonly!(__NR_umount2, target, flags)) } -} - #[inline] pub(crate) fn inotify_init1(flags: inotify::CreateFlags) -> io::Result { unsafe { ret_owned_fd(syscall_readonly!(__NR_inotify_init1, flags)) } diff --git a/vendor/rustix/src/backend/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs index df61cf721..e18dc0b4d 100644 --- a/vendor/rustix/src/backend/linux_raw/fs/types.rs +++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs @@ -600,7 +600,11 @@ pub enum FlockOperation { // On 32-bit, and mips64, Linux's `struct stat64` has a 32-bit `st_mtime` and // friends, so we use our own struct, populated from `statx` where possible, to // avoid the y2038 bug. -#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))] +#[cfg(any( + target_pointer_width = "32", + target_arch = "mips64", + target_arch = "mips64r6" +))] #[repr(C)] #[derive(Debug, Copy, Clone)] #[allow(missing_docs)] @@ -627,7 +631,11 @@ pub struct Stat { /// /// [`statat`]: crate::fs::statat /// [`fstat`]: crate::fs::fstat -#[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))] +#[cfg(all( + target_pointer_width = "64", + not(target_arch = "mips64"), + not(target_arch = "mips64r6") +))] pub type Stat = linux_raw_sys::general::stat; /// `struct statfs` for use with [`statfs`] and [`fstatfs`]. @@ -688,117 +696,9 @@ pub type RawMode = c::c_uint; pub type Dev = u64; /// `__fsword_t` -#[cfg(not(target_arch = "mips64"))] +#[cfg(not(any(target_arch = "mips64", target_arch = "mips64r6")))] pub type FsWord = linux_raw_sys::general::__fsword_t; /// `__fsword_t` -#[cfg(target_arch = "mips64")] +#[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] pub type FsWord = i64; - -bitflags! { - /// `MS_*` constants for use with [`mount`]. - /// - /// [`mount`]: crate::fs::mount - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct MountFlags: c::c_uint { - /// `MS_BIND` - const BIND = linux_raw_sys::general::MS_BIND; - - /// `MS_DIRSYNC` - const DIRSYNC = linux_raw_sys::general::MS_DIRSYNC; - - /// `MS_LAZYTIME` - const LAZYTIME = linux_raw_sys::general::MS_LAZYTIME; - - /// `MS_MANDLOCK` - #[doc(alias = "MANDLOCK")] - const PERMIT_MANDATORY_FILE_LOCKING = linux_raw_sys::general::MS_MANDLOCK; - - /// `MS_NOATIME` - const NOATIME = linux_raw_sys::general::MS_NOATIME; - - /// `MS_NODEV` - const NODEV = linux_raw_sys::general::MS_NODEV; - - /// `MS_NODIRATIME` - const NODIRATIME = linux_raw_sys::general::MS_NODIRATIME; - - /// `MS_NOEXEC` - const NOEXEC = linux_raw_sys::general::MS_NOEXEC; - - /// `MS_NOSUID` - const NOSUID = linux_raw_sys::general::MS_NOSUID; - - /// `MS_RDONLY` - const RDONLY = linux_raw_sys::general::MS_RDONLY; - - /// `MS_REC` - const REC = linux_raw_sys::general::MS_REC; - - /// `MS_RELATIME` - const RELATIME = linux_raw_sys::general::MS_RELATIME; - - /// `MS_SILENT` - const SILENT = linux_raw_sys::general::MS_SILENT; - - /// `MS_STRICTATIME` - const STRICTATIME = linux_raw_sys::general::MS_STRICTATIME; - - /// `MS_SYNCHRONOUS` - const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS; - - /// `MS_NOSYMFOLLOW` - const NOSYMFOLLOW = linux_raw_sys::general::MS_NOSYMFOLLOW; - } -} - -bitflags! { - /// `MS_*` constants for use with [`change_mount`]. - /// - /// [`change_mount`]: crate::fs::mount::change_mount - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct MountPropagationFlags: c::c_uint { - /// `MS_SHARED` - const SHARED = linux_raw_sys::general::MS_SHARED; - /// `MS_PRIVATE` - const PRIVATE = linux_raw_sys::general::MS_PRIVATE; - /// `MS_SLAVE` - const SLAVE = linux_raw_sys::general::MS_SLAVE; - /// `MS_UNBINDABLE` - const UNBINDABLE = linux_raw_sys::general::MS_UNBINDABLE; - /// `MS_REC` - const REC = linux_raw_sys::general::MS_REC; - } -} - -bitflags! { - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub(crate) struct InternalMountFlags: c::c_uint { - const REMOUNT = linux_raw_sys::general::MS_REMOUNT; - const MOVE = linux_raw_sys::general::MS_MOVE; - } -} - -#[repr(transparent)] -pub(crate) struct MountFlagsArg(pub(crate) c::c_uint); - -bitflags! { - /// `MNT_*` constants for use with [`unmount`]. - /// - /// [`unmount`]: crate::fs::mount::unmount - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct UnmountFlags: c::c_uint { - /// `MNT_FORCE` - const FORCE = linux_raw_sys::general::MNT_FORCE; - /// `MNT_DETACH` - const DETACH = linux_raw_sys::general::MNT_DETACH; - /// `MNT_EXPIRE` - const EXPIRE = linux_raw_sys::general::MNT_EXPIRE; - /// `UMOUNT_NOFOLLOW` - const NOFOLLOW = linux_raw_sys::general::UMOUNT_NOFOLLOW; - } -} diff --git a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs index 45e0dd647..88eed3d72 100644 --- a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs @@ -10,7 +10,12 @@ use crate::backend::conv::loff_t_from_u64; #[cfg(all( target_pointer_width = "32", - any(target_arch = "arm", target_arch = "mips", target_arch = "power"), + any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "power" + ), ))] use crate::backend::conv::zero; use crate::backend::conv::{ @@ -26,8 +31,6 @@ use crate::io::{self, DupFlags, FdFlags, IoSlice, IoSliceMut, ReadWriteFlags}; use crate::net::{RecvFlags, SendFlags}; use core::cmp; use core::mem::MaybeUninit; -#[cfg(target_os = "espidf")] -use linux_raw_sys::general::F_DUPFD; use linux_raw_sys::general::{F_DUPFD_CLOEXEC, F_GETFD, F_SETFD}; use linux_raw_sys::ioctl::{FIONBIO, FIONREAD}; @@ -45,7 +48,12 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], pos: u64) -> io::Result< // #[cfg(all( target_pointer_width = "32", - any(target_arch = "arm", target_arch = "mips", target_arch = "power"), + any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "power" + ), ))] unsafe { ret_usize(syscall!( @@ -60,7 +68,12 @@ 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 = "power")), + not(any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "power" + )), ))] unsafe { ret_usize(syscall!( @@ -170,7 +183,12 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result #[cfg(all( target_pointer_width = "32", - any(target_arch = "arm", target_arch = "mips", target_arch = "power"), + any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "power" + ), ))] unsafe { ret_usize(syscall_readonly!( @@ -185,7 +203,12 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], pos: u64) -> io::Result) -> io::Result<(bool, bool)> { // the write side is shut down. #[allow(unreachable_patterns)] // `EAGAIN` equals `EWOULDBLOCK` match crate::backend::net::syscalls::send(fd, &[], SendFlags::DONTWAIT) { - // TODO or-patterns when we don't need 1.51 - Err(io::Errno::AGAIN) => (), - Err(io::Errno::WOULDBLOCK) => (), - Err(io::Errno::NOTSOCK) => (), + Err(io::Errno::AGAIN | io::Errno::WOULDBLOCK | io::Errno::NOTSOCK) => (), Err(io::Errno::PIPE) => write = false, Err(err) => return Err(err), Ok(_) => (), @@ -403,29 +423,6 @@ pub(crate) fn fcntl_setfd(fd: BorrowedFd<'_>, flags: FdFlags) -> io::Result<()> } } -#[cfg(target_os = "espidf")] -#[inline] -pub(crate) fn fcntl_dupfd(fd: BorrowedFd<'_>, min: RawFd) -> io::Result { - #[cfg(target_pointer_width = "32")] - unsafe { - ret_owned_fd(syscall_readonly!( - __NR_fcntl64, - fd, - c_uint(F_DUPFD), - raw_fd(min) - )) - } - #[cfg(target_pointer_width = "64")] - unsafe { - ret_owned_fd(syscall_readonly!( - __NR_fcntl, - fd, - c_uint(F_DUPFD), - raw_fd(min) - )) - } -} - #[inline] pub(crate) fn fcntl_dupfd_cloexec(fd: BorrowedFd<'_>, min: RawFd) -> io::Result { #[cfg(target_pointer_width = "32")] diff --git a/vendor/rustix/src/backend/linux_raw/mm/types.rs b/vendor/rustix/src/backend/linux_raw/mm/types.rs index 576f08a3d..2d5eebc58 100644 --- a/vendor/rustix/src/backend/linux_raw/mm/types.rs +++ b/vendor/rustix/src/backend/linux_raw/mm/types.rs @@ -38,6 +38,20 @@ bitflags! { const GROWSUP = linux_raw_sys::general::PROT_GROWSUP; /// `PROT_GROWSDOWN` const GROWSDOWN = linux_raw_sys::general::PROT_GROWSDOWN; + /// `PROT_SEM` + const SEM = linux_raw_sys::general::PROT_SEM; + /// `PROT_BTI` + #[cfg(target_arch = "aarch64")] + const BTI = linux_raw_sys::general::PROT_BTI; + /// `PROT_MTE` + #[cfg(target_arch = "aarch64")] + const MTE = linux_raw_sys::general::PROT_MTE; + /// `PROT_SAO` + #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] + const SAO = linux_raw_sys::general::PROT_SAO; + /// `PROT_ADI` + #[cfg(any(target_arch = "sparc", target_arch = "sparc64"))] + const ADI = linux_raw_sys::general::PROT_ADI; } } @@ -80,10 +94,10 @@ bitflags! { /// `MAP_STACK` const STACK = linux_raw_sys::general::MAP_STACK; /// `MAP_SYNC` (since Linux 4.15) - #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6")))] const SYNC = linux_raw_sys::general::MAP_SYNC; /// `MAP_UNINITIALIZED` - #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] + #[cfg(not(any(target_arch = "mips", target_arch = "mips32r6", target_arch = "mips64", target_arch = "mips64r6")))] const UNINITIALIZED = linux_raw_sys::general::MAP_UNINITIALIZED; } } @@ -105,18 +119,6 @@ bitflags! { } } -bitflags! { - /// `MLOCK_*` flags for use with [`mlock_with`]. - /// - /// [`mlock_with`]: crate::io::mlock_with - #[repr(transparent)] - #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct MlockFlags: u32 { - /// `MLOCK_ONFAULT` - const ONFAULT = linux_raw_sys::general::MLOCK_ONFAULT; - } -} - bitflags! { /// `MS_*` flags for use with [`msync`]. /// @@ -137,16 +139,14 @@ bitflags! { } bitflags! { - /// `O_*` flags for use with [`userfaultfd`]. + /// `MLOCK_*` flags for use with [`mlock_with`]. /// - /// [`userfaultfd`]: crate::io::userfaultfd + /// [`mlock_with`]: crate::io::mlock_with #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] - pub struct UserfaultfdFlags: c::c_uint { - /// `O_CLOEXEC` - const CLOEXEC = linux_raw_sys::general::O_CLOEXEC; - /// `O_NONBLOCK` - const NONBLOCK = linux_raw_sys::general::O_NONBLOCK; + pub struct MlockFlags: u32 { + /// `MLOCK_ONFAULT` + const ONFAULT = linux_raw_sys::general::MLOCK_ONFAULT; } } @@ -183,7 +183,12 @@ pub enum Advice { /// `MADV_HWPOISON` LinuxHwPoison = linux_raw_sys::general::MADV_HWPOISON, /// `MADV_SOFT_OFFLINE` - #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] + #[cfg(not(any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + )))] LinuxSoftOffline = linux_raw_sys::general::MADV_SOFT_OFFLINE, /// `MADV_MERGEABLE` LinuxMergeable = linux_raw_sys::general::MADV_MERGEABLE, @@ -222,3 +227,17 @@ impl Advice { /// `LinuxDontNeed` for the Linux behavior. pub const DontNeed: Self = Self::Normal; } + +bitflags! { + /// `O_*` flags for use with [`userfaultfd`]. + /// + /// [`userfaultfd`]: crate::io::userfaultfd + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct UserfaultfdFlags: c::c_uint { + /// `O_CLOEXEC` + const CLOEXEC = linux_raw_sys::general::O_CLOEXEC; + /// `O_NONBLOCK` + const NONBLOCK = linux_raw_sys::general::O_NONBLOCK; + } +} diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs index cd5805f88..c3018930f 100644 --- a/vendor/rustix/src/backend/linux_raw/mod.rs +++ b/vendor/rustix/src/backend/linux_raw/mod.rs @@ -51,6 +51,10 @@ pub(crate) mod io; pub(crate) mod io_uring; #[cfg(feature = "mm")] pub(crate) mod mm; +#[cfg(feature = "mount")] +pub(crate) mod mount; +#[cfg(all(feature = "fs", not(feature = "mount")))] +pub(crate) mod mount; // for deprecated mount functions in "fs" #[cfg(feature = "net")] pub(crate) mod net; #[cfg(any( diff --git a/vendor/rustix/src/backend/linux_raw/mount/mod.rs b/vendor/rustix/src/backend/linux_raw/mount/mod.rs new file mode 100644 index 000000000..1e0181a99 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/mount/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod syscalls; +pub(crate) mod types; diff --git a/vendor/rustix/src/backend/linux_raw/mount/syscalls.rs b/vendor/rustix/src/backend/linux_raw/mount/syscalls.rs new file mode 100644 index 000000000..77c2a181d --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/mount/syscalls.rs @@ -0,0 +1,239 @@ +//! linux_raw syscalls supporting `rustix::mount`. +//! +//! # Safety +//! +//! See the `rustix::backend` module documentation for details. +#![allow(unsafe_code)] +#![allow(clippy::undocumented_unsafe_blocks)] + +use crate::backend::conv::ret; +#[cfg(feature = "mount")] +use crate::backend::conv::{ret_owned_fd, slice, zero}; +#[cfg(feature = "mount")] +use crate::fd::{BorrowedFd, OwnedFd}; +use crate::ffi::CStr; +use crate::io; + +#[inline] +pub(crate) fn mount( + source: Option<&CStr>, + target: &CStr, + file_system_type: Option<&CStr>, + flags: super::types::MountFlagsArg, + data: Option<&CStr>, +) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_mount, + source, + target, + file_system_type, + flags, + data + )) + } +} + +#[inline] +pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> { + unsafe { ret(syscall_readonly!(__NR_umount2, target, flags)) } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsopen(fs_name: &CStr, flags: super::types::FsOpenFlags) -> io::Result { + unsafe { ret_owned_fd(syscall_readonly!(__NR_fsopen, fs_name, flags)) } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsmount( + fs_fd: BorrowedFd<'_>, + flags: super::types::FsMountFlags, + attr_flags: super::types::MountAttrFlags, +) -> io::Result<()> { + unsafe { ret(syscall_readonly!(__NR_fsmount, fs_fd, flags, attr_flags)) } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn move_mount( + from_dfd: BorrowedFd<'_>, + from_pathname: &CStr, + to_dfd: BorrowedFd<'_>, + to_pathname: &CStr, + flags: super::types::MoveMountFlags, +) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_move_mount, + from_dfd, + from_pathname, + to_dfd, + to_pathname, + flags + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn open_tree( + dfd: BorrowedFd<'_>, + filename: &CStr, + flags: super::types::OpenTreeFlags, +) -> io::Result { + unsafe { ret_owned_fd(syscall_readonly!(__NR_open_tree, dfd, filename, flags)) } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fspick( + dfd: BorrowedFd<'_>, + path: &CStr, + flags: super::types::FsPickFlags, +) -> io::Result { + unsafe { ret_owned_fd(syscall_readonly!(__NR_fspick, dfd, path, flags)) } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_set_flag(fs_fd: BorrowedFd<'_>, key: &CStr) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::SetFlag, + key, + zero(), + zero() + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_set_string( + fs_fd: BorrowedFd<'_>, + key: &CStr, + value: &CStr, +) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::SetString, + key, + value, + zero() + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_set_binary( + fs_fd: BorrowedFd<'_>, + key: &CStr, + value: &[u8], +) -> io::Result<()> { + let (value_addr, value_len) = slice(value); + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::SetBinary, + key, + value_addr, + value_len + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_set_fd( + fs_fd: BorrowedFd<'_>, + key: &CStr, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::SetFd, + key, + zero(), + fd + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_set_path( + fs_fd: BorrowedFd<'_>, + key: &CStr, + path: &CStr, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::SetPath, + key, + path, + fd + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_set_path_empty( + fs_fd: BorrowedFd<'_>, + key: &CStr, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::SetPathEmpty, + key, + cstr!(""), + fd + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_create(fs_fd: BorrowedFd<'_>) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::Create, + zero(), + zero(), + zero() + )) + } +} + +#[cfg(feature = "mount")] +#[inline] +pub(crate) fn fsconfig_reconfigure(fs_fd: BorrowedFd<'_>) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_fsconfig, + fs_fd, + super::types::FsConfigCmd::Reconfigure, + zero(), + zero(), + zero() + )) + } +} diff --git a/vendor/rustix/src/backend/linux_raw/mount/types.rs b/vendor/rustix/src/backend/linux_raw/mount/types.rs new file mode 100644 index 000000000..808710c13 --- /dev/null +++ b/vendor/rustix/src/backend/linux_raw/mount/types.rs @@ -0,0 +1,303 @@ +use crate::backend::c; +use bitflags::bitflags; + +bitflags! { + /// `MS_*` constants for use with [`mount`]. + /// + /// [`mount`]: crate::mount::mount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MountFlags: c::c_uint { + /// `MS_BIND` + const BIND = linux_raw_sys::general::MS_BIND; + + /// `MS_DIRSYNC` + const DIRSYNC = linux_raw_sys::general::MS_DIRSYNC; + + /// `MS_LAZYTIME` + const LAZYTIME = linux_raw_sys::general::MS_LAZYTIME; + + /// `MS_MANDLOCK` + #[doc(alias = "MANDLOCK")] + const PERMIT_MANDATORY_FILE_LOCKING = linux_raw_sys::general::MS_MANDLOCK; + + /// `MS_NOATIME` + const NOATIME = linux_raw_sys::general::MS_NOATIME; + + /// `MS_NODEV` + const NODEV = linux_raw_sys::general::MS_NODEV; + + /// `MS_NODIRATIME` + const NODIRATIME = linux_raw_sys::general::MS_NODIRATIME; + + /// `MS_NOEXEC` + const NOEXEC = linux_raw_sys::general::MS_NOEXEC; + + /// `MS_NOSUID` + const NOSUID = linux_raw_sys::general::MS_NOSUID; + + /// `MS_RDONLY` + const RDONLY = linux_raw_sys::general::MS_RDONLY; + + /// `MS_REC` + const REC = linux_raw_sys::general::MS_REC; + + /// `MS_RELATIME` + const RELATIME = linux_raw_sys::general::MS_RELATIME; + + /// `MS_SILENT` + const SILENT = linux_raw_sys::general::MS_SILENT; + + /// `MS_STRICTATIME` + const STRICTATIME = linux_raw_sys::general::MS_STRICTATIME; + + /// `MS_SYNCHRONOUS` + const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS; + + /// `MS_NOSYMFOLLOW` + const NOSYMFOLLOW = linux_raw_sys::general::MS_NOSYMFOLLOW; + } +} + +bitflags! { + /// `MNT_*` constants for use with [`unmount`]. + /// + /// [`unmount`]: crate::mount::unmount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct UnmountFlags: c::c_uint { + /// `MNT_FORCE` + const FORCE = linux_raw_sys::general::MNT_FORCE; + /// `MNT_DETACH` + const DETACH = linux_raw_sys::general::MNT_DETACH; + /// `MNT_EXPIRE` + const EXPIRE = linux_raw_sys::general::MNT_EXPIRE; + /// `UMOUNT_NOFOLLOW` + const NOFOLLOW = linux_raw_sys::general::UMOUNT_NOFOLLOW; + } +} + +#[cfg(feature = "mount")] +bitflags! { + /// `FSOPEN_*` constants for use with [`fsopen`]. + /// + /// [`fsopen`]: crate::mount::fsopen + #[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; + } +} + +#[cfg(feature = "mount")] +bitflags! { + /// `FSMOUNT_*` constants for use with [`fsmount`]. + /// + /// [`fsmount`]: crate::mount::fsmount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct FsMountFlags: c::c_uint { + /// `FSMOUNT_CLOEXEC` + const FSMOUNT_CLOEXEC = linux_raw_sys::general::FSMOUNT_CLOEXEC; + } +} + +/// `FSCONFIG_*` constants for use with the `fsconfig` syscall. +#[cfg(feature = "mount")] +#[derive(Debug, Copy, Clone, Eq, PartialEq)] +#[repr(u32)] +pub(crate) enum FsConfigCmd { + /// `FSCONFIG_SET_FLAG` + SetFlag = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_FLAG as u32, + + /// `FSCONFIG_SET_STRING` + SetString = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_STRING as u32, + + /// `FSCONFIG_SET_BINARY` + SetBinary = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_BINARY as u32, + + /// `FSCONFIG_SET_PATH` + SetPath = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_PATH as u32, + + /// `FSCONFIG_SET_PATH_EMPTY` + SetPathEmpty = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_PATH_EMPTY as u32, + + /// `FSCONFIG_SET_FD` + SetFd = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_FD as u32, + + /// `FSCONFIG_CMD_CREATE` + Create = linux_raw_sys::general::fsconfig_command::FSCONFIG_CMD_CREATE as u32, + + /// `FSCONFIG_CMD_RECONFIGURE` + Reconfigure = linux_raw_sys::general::fsconfig_command::FSCONFIG_CMD_RECONFIGURE as u32, +} + +#[cfg(feature = "mount")] +bitflags! { + /// `MOUNT_ATTR_*` constants for use with [`fsmount`]. + /// + /// [`fsmount`]: crate::mount::fsmount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MountAttrFlags: c::c_uint { + /// `MOUNT_ATTR_RDONLY` + const MOUNT_ATTR_RDONLY = linux_raw_sys::general::MOUNT_ATTR_RDONLY; + + /// `MOUNT_ATTR_NOSUID` + const MOUNT_ATTR_NOSUID = linux_raw_sys::general::MOUNT_ATTR_NOSUID; + + /// `MOUNT_ATTR_NODEV` + const MOUNT_ATTR_NODEV = linux_raw_sys::general::MOUNT_ATTR_NODEV; + + /// `MOUNT_ATTR_NOEXEC` + const MOUNT_ATTR_NOEXEC = linux_raw_sys::general::MOUNT_ATTR_NOEXEC; + + /// `MOUNT_ATTR__ATIME` + const MOUNT_ATTR__ATIME = linux_raw_sys::general::MOUNT_ATTR__ATIME; + + /// `MOUNT_ATTR_RELATIME` + const MOUNT_ATTR_RELATIME = linux_raw_sys::general::MOUNT_ATTR_RELATIME; + + /// `MOUNT_ATTR_NOATIME` + const MOUNT_ATTR_NOATIME = linux_raw_sys::general::MOUNT_ATTR_NOATIME; + + /// `MOUNT_ATTR_STRICTATIME` + const MOUNT_ATTR_STRICTATIME = linux_raw_sys::general::MOUNT_ATTR_STRICTATIME; + + /// `MOUNT_ATTR_NODIRATIME` + const MOUNT_ATTR_NODIRATIME = linux_raw_sys::general::MOUNT_ATTR_NODIRATIME; + + /// `MOUNT_ATTR_NOUSER` + const MOUNT_ATTR_IDMAP = linux_raw_sys::general::MOUNT_ATTR_IDMAP; + + /// `MOUNT_ATTR__ATIME_FLAGS` + const MOUNT_ATTR_NOSYMFOLLOW = linux_raw_sys::general::MOUNT_ATTR_NOSYMFOLLOW; + + /// `MOUNT_ATTR__ATIME_FLAGS` + const MOUNT_ATTR_SIZE_VER0 = linux_raw_sys::general::MOUNT_ATTR_SIZE_VER0; + } +} + +#[cfg(feature = "mount")] +bitflags! { + /// `MOVE_MOUNT_*` constants for use with [`move_mount`]. + /// + /// [`move_mount`]: crate::mount::move_mount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MoveMountFlags: c::c_uint { + /// `MOVE_MOUNT_F_EMPTY_PATH` + const MOVE_MOUNT_F_SYMLINKS = linux_raw_sys::general::MOVE_MOUNT_F_SYMLINKS; + + /// `MOVE_MOUNT_F_AUTOMOUNTS` + const MOVE_MOUNT_F_AUTOMOUNTS = linux_raw_sys::general::MOVE_MOUNT_F_AUTOMOUNTS; + + /// `MOVE_MOUNT_F_EMPTY_PATH` + const MOVE_MOUNT_F_EMPTY_PATH = linux_raw_sys::general::MOVE_MOUNT_F_EMPTY_PATH; + + /// `MOVE_MOUNT_T_SYMLINKS` + const MOVE_MOUNT_T_SYMLINKS = linux_raw_sys::general::MOVE_MOUNT_T_SYMLINKS; + + /// `MOVE_MOUNT_T_AUTOMOUNTS` + const MOVE_MOUNT_T_AUTOMOUNTS = linux_raw_sys::general::MOVE_MOUNT_T_AUTOMOUNTS; + + /// `MOVE_MOUNT_T_EMPTY_PATH` + const MOVE_MOUNT_T_EMPTY_PATH = linux_raw_sys::general::MOVE_MOUNT_T_EMPTY_PATH; + + /// `MOVE_MOUNT__MASK` + const MOVE_MOUNT_SET_GROUP = linux_raw_sys::general::MOVE_MOUNT_SET_GROUP; + + // TODO: add when linux 6.5 is released + // /// `MOVE_MOUNT_BENEATH` + // const MOVE_MOUNT_BENEATH = linux_raw_sys::general::MOVE_MOUNT_BENEATH; + + /// `MOVE_MOUNT__MASK` + const MOVE_MOUNT__MASK = linux_raw_sys::general::MOVE_MOUNT__MASK; + } +} + +#[cfg(feature = "mount")] +bitflags! { + /// `OPENTREE_*` constants for use with [`open_tree`]. + /// + /// [`open_tree`]: crate::mount::open_tree + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct OpenTreeFlags: c::c_uint { + /// `OPENTREE_CLONE` + const OPEN_TREE_CLONE = linux_raw_sys::general::OPEN_TREE_CLONE; + + /// `OPENTREE_CLOEXEC` + const OPEN_TREE_CLOEXEC = linux_raw_sys::general::OPEN_TREE_CLOEXEC; + + /// `AT_EMPTY_PATH` + const AT_EMPTY_PATH = linux_raw_sys::general::AT_EMPTY_PATH; + + /// `AT_NO_AUTOMOUNT` + const AT_NO_AUTOMOUNT = linux_raw_sys::general::AT_NO_AUTOMOUNT; + + /// `AT_RECURSIVE` + const AT_RECURSIVE = linux_raw_sys::general::AT_RECURSIVE; + + /// `AT_SYMLINK_NOFOLLOW` + const AT_SYMLINK_NOFOLLOW = linux_raw_sys::general::AT_SYMLINK_NOFOLLOW; + } +} + +#[cfg(feature = "mount")] +bitflags! { + /// `FSPICK_*` constants for use with [`fspick`]. + /// + /// [`fspick`]: crate::mount::fspick + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct FsPickFlags: c::c_uint { + /// `FSPICK_CLOEXEC` + const FSPICK_CLOEXEC = linux_raw_sys::general::FSPICK_CLOEXEC; + + /// `FSPICK_SYMLINK_NOFOLLOW` + const FSPICK_SYMLINK_NOFOLLOW = linux_raw_sys::general::FSPICK_SYMLINK_NOFOLLOW; + + /// `FSPICK_NO_AUTOMOUNT` + const FSPICK_NO_AUTOMOUNT = linux_raw_sys::general::FSPICK_NO_AUTOMOUNT; + + /// `FSPICK_EMPTY_PATH` + const FSPICK_EMPTY_PATH = linux_raw_sys::general::FSPICK_EMPTY_PATH; + } +} + +bitflags! { + /// `MS_*` constants for use with [`change_mount`]. + /// + /// [`change_mount`]: crate::mount::change_mount + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub struct MountPropagationFlags: c::c_uint { + /// `MS_SILENT` + const SILENT = linux_raw_sys::general::MS_SILENT; + /// `MS_SHARED` + const SHARED = linux_raw_sys::general::MS_SHARED; + /// `MS_PRIVATE` + const PRIVATE = linux_raw_sys::general::MS_PRIVATE; + /// `MS_SLAVE` + const SLAVE = linux_raw_sys::general::MS_SLAVE; + /// `MS_UNBINDABLE` + const UNBINDABLE = linux_raw_sys::general::MS_UNBINDABLE; + /// `MS_REC` + const REC = linux_raw_sys::general::MS_REC; + } +} + +bitflags! { + #[repr(transparent)] + #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] + pub(crate) struct InternalMountFlags: c::c_uint { + const REMOUNT = linux_raw_sys::general::MS_REMOUNT; + const MOVE = linux_raw_sys::general::MS_MOVE; + } +} + +#[repr(transparent)] +pub(crate) struct MountFlagsArg(pub(crate) c::c_uint); diff --git a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs index dca331783..df35e63c8 100644 --- a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs @@ -430,6 +430,7 @@ pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Resu #[cfg(not(any( target_arch = "aarch64", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "riscv64", target_arch = "x86", target_arch = "x86_64", @@ -440,6 +441,7 @@ pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Resu #[cfg(any( target_arch = "aarch64", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "riscv64", target_arch = "x86_64", ))] @@ -585,6 +587,7 @@ pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io:: #[cfg(not(any( target_arch = "aarch64", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "riscv64", target_arch = "x86", target_arch = "x86_64", @@ -595,6 +598,7 @@ pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io:: #[cfg(any( target_arch = "aarch64", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "riscv64", target_arch = "x86_64", ))] diff --git a/vendor/rustix/src/backend/linux_raw/param/auxv.rs b/vendor/rustix/src/backend/linux_raw/param/auxv.rs index bf8935a0d..144ff10cd 100644 --- a/vendor/rustix/src/backend/linux_raw/param/auxv.rs +++ b/vendor/rustix/src/backend/linux_raw/param/auxv.rs @@ -161,6 +161,7 @@ fn pr_get_auxv() -> crate::io::Result> { /// 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`. +#[cold] fn init_auxv() { match pr_get_auxv() { Ok(buffer) => { @@ -185,6 +186,7 @@ fn init_auxv() { } /// Process auxv entries from the open file `auxv`. +#[cold] fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> { let mut buffer = Vec::::with_capacity(512); loop { @@ -220,6 +222,7 @@ 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<()> { let mut pagesz = 0; let mut clktck = 0; @@ -272,6 +275,7 @@ unsafe fn init_from_auxp(mut auxp: *const Elf_auxv_t) -> Option<()> { /// `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(()) @@ -282,6 +286,7 @@ unsafe fn check_interpreter_base(base: *const Elf_Ehdr) -> Option<()> { /// `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> { // 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 @@ -331,6 +336,7 @@ unsafe fn check_vdso_base(base: *const Elf_Ehdr) -> Option> { } /// Check that `base` is a valid pointer to an ELF image. +#[cold] unsafe fn check_elf_base(base: *const Elf_Ehdr) -> Option> { // 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 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 d05a87e53..97739fcb5 100644 --- a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs +++ b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs @@ -41,27 +41,23 @@ extern "C" { #[cfg(target_os = "android")] const _SC_PAGESIZE: c::c_int = 39; -#[cfg(target_os = "emscripten")] -const _SC_PAGESIZE: c::c_int = 30; #[cfg(target_os = "linux")] const _SC_PAGESIZE: c::c_int = 30; #[cfg(target_os = "android")] const _SC_CLK_TCK: c::c_int = 6; -#[cfg(target_os = "emscripten")] -const _SC_CLK_TCK: c::c_int = 2; #[cfg(target_os = "linux")] const _SC_CLK_TCK: c::c_int = 2; #[test] fn test_abi() { - assert_eq!(self::_SC_PAGESIZE, ::libc::_SC_PAGESIZE); - assert_eq!(self::_SC_CLK_TCK, ::libc::_SC_CLK_TCK); - assert_eq!(self::AT_PHDR, ::libc::AT_PHDR); - assert_eq!(self::AT_PHNUM, ::libc::AT_PHNUM); - assert_eq!(self::AT_HWCAP, ::libc::AT_HWCAP); - assert_eq!(self::AT_HWCAP2, ::libc::AT_HWCAP2); - assert_eq!(self::AT_EXECFN, ::libc::AT_EXECFN); - assert_eq!(self::AT_SYSINFO_EHDR, ::libc::AT_SYSINFO_EHDR); + 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 = "param")] diff --git a/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs index ed121089d..e05094237 100644 --- a/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/pipe/syscalls.rs @@ -23,7 +23,9 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { #[cfg(any( target_arch = "aarch64", target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "riscv64", ))] { @@ -32,7 +34,9 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { #[cfg(not(any( target_arch = "aarch64", target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "riscv64", )))] unsafe { diff --git a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs index ac6e28901..5ec2755ff 100644 --- a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs @@ -33,7 +33,6 @@ use linux_raw_sys::general::{ RLIM64_INFINITY, RLIM_INFINITY, }; use linux_raw_sys::ioctl::TIOCSCTTY; -#[cfg(not(target_os = "wasi"))] #[cfg(feature = "fs")] use {crate::backend::conv::ret_c_uint_infallible, crate::fs::Mode}; diff --git a/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs b/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs index c2d1b07c1..529564c34 100644 --- a/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/pty/syscalls.rs @@ -13,12 +13,10 @@ use crate::ffi::CString; use crate::io; use crate::path::DecInt; use crate::pty::OpenptFlags; -#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] use alloc::vec::Vec; use core::mem::MaybeUninit; use linux_raw_sys::ioctl::{TIOCGPTN, TIOCGPTPEER, TIOCSPTLCK}; -#[cfg(any(apple, freebsdlike, linux_like, target_os = "fuchsia"))] #[inline] pub(crate) fn ptsname(fd: BorrowedFd, mut buffer: Vec) -> io::Result { unsafe { diff --git a/vendor/rustix/src/backend/linux_raw/reg.rs b/vendor/rustix/src/backend/linux_raw/reg.rs index 206031dde..c4e495c52 100644 --- a/vendor/rustix/src/backend/linux_raw/reg.rs +++ b/vendor/rustix/src/backend/linux_raw/reg.rs @@ -1,9 +1,8 @@ //! Encapsulation for system call arguments and return values. //! -//! The inline-asm and outline-asm code paths do some amount of reordering -//! of arguments; to ensure that we don't accidentally misroute an argument -//! or return value, we use distinct types for each argument index and -//! return value. +//! The inline-asm code paths do some amount of reordering of arguments; to +//! ensure that we don't accidentally misroute an argument or return value, +//! we use distinct types for each argument index and return value. //! //! # Safety //! @@ -55,7 +54,7 @@ pub(super) struct A2(()); pub(super) struct A3(()); pub(super) struct A4(()); pub(super) struct A5(()); -#[cfg(target_arch = "mips")] +#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] pub(super) struct A6(()); #[cfg(target_arch = "x86")] pub(super) struct SocketArg; @@ -67,7 +66,7 @@ impl ArgNumber for A2 {} impl ArgNumber for A3 {} impl ArgNumber for A4 {} impl ArgNumber for A5 {} -#[cfg(target_arch = "mips")] +#[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] impl ArgNumber for A6 {} #[cfg(target_arch = "x86")] impl ArgNumber for SocketArg {} @@ -251,7 +250,7 @@ mod private { impl Sealed for super::A3 {} impl Sealed for super::A4 {} impl Sealed for super::A5 {} - #[cfg(target_arch = "mips")] + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] impl Sealed for super::A6 {} #[cfg(target_arch = "x86")] impl Sealed for super::SocketArg {} diff --git a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs index b9814e731..f82e2187b 100644 --- a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs @@ -22,7 +22,7 @@ use crate::pid::Pid; use crate::runtime::{How, Sigaction, Siginfo, Sigset, Stack}; use crate::signal::Signal; use crate::timespec::Timespec; -use crate::utils::optional_as_ptr; +use crate::utils::option_as_ptr; use core::mem::MaybeUninit; #[cfg(target_pointer_width = "32")] use linux_raw_sys::general::__kernel_old_timespec; @@ -117,7 +117,7 @@ pub(crate) mod tls { #[inline] pub(crate) unsafe fn sigaction(signal: Signal, new: Option) -> io::Result { let mut old = MaybeUninit::::uninit(); - let new = optional_as_ptr(new.as_ref()); + let new = option_as_ptr(new.as_ref()); ret(syscall!( __NR_rt_sigaction, signal, @@ -131,7 +131,7 @@ pub(crate) unsafe fn sigaction(signal: Signal, new: Option) -> io::Re #[inline] pub(crate) unsafe fn sigaltstack(new: Option) -> io::Result { let mut old = MaybeUninit::::uninit(); - let new = optional_as_ptr(new.as_ref()); + let new = option_as_ptr(new.as_ref()); ret(syscall!(__NR_sigaltstack, new, &mut old))?; Ok(old.assume_init()) } @@ -144,7 +144,7 @@ pub(crate) unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> { #[inline] pub(crate) unsafe fn sigprocmask(how: How, new: Option<&Sigset>) -> io::Result { let mut old = MaybeUninit::::uninit(); - let new = optional_as_ptr(new); + let new = option_as_ptr(new); ret(syscall!( __NR_rt_sigprocmask, how, @@ -189,7 +189,7 @@ pub(crate) fn sigwaitinfo(set: &Sigset) -> io::Result { #[inline] pub(crate) fn sigtimedwait(set: &Sigset, timeout: Option) -> io::Result { let mut info = MaybeUninit::::uninit(); - let timeout_ptr = optional_as_ptr(timeout.as_ref()); + let timeout_ptr = option_as_ptr(timeout.as_ref()); // `rt_sigtimedwait_time64` was introduced in Linux 5.1. The old // `rt_sigtimedwait` syscall is not y2038-compatible on 32-bit @@ -237,7 +237,7 @@ unsafe fn sigtimedwait_old( None => None, }; - let old_timeout_ptr = optional_as_ptr(old_timeout.as_ref()); + let old_timeout_ptr = option_as_ptr(old_timeout.as_ref()); let _signum = ret_c_int(syscall!( __NR_rt_sigtimedwait, diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs index 5e21397bc..8f030e1c3 100644 --- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs @@ -63,7 +63,12 @@ pub(crate) fn tcsetattr( // Translate from `optional_actions` into an ioctl request code. On MIPS, // `optional_actions` already has `TCGETS` added to it. let request = linux_raw_sys::ioctl::TCSETS2 - + if cfg!(any(target_arch = "mips", target_arch = "mips64")) { + + if cfg!(any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + )) { optional_actions as u32 - linux_raw_sys::ioctl::TCSETS } else { optional_actions as u32 diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs index 422793690..316d26a1c 100644 --- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs +++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs @@ -12,8 +12,8 @@ #[cfg(target_arch = "x86")] use super::reg::{ArgReg, RetReg, SyscallNumber, A0, A1, A2, A3, A4, A5, R0}; use super::vdso; -#[cfg(all(asm, target_arch = "x86"))] -use core::arch::asm; +#[cfg(target_arch = "x86")] +use core::arch::global_asm; use core::mem::transmute; use core::ptr::null_mut; use core::sync::atomic::AtomicPtr; @@ -45,6 +45,10 @@ pub(crate) fn clock_gettime(which_clock: ClockId) -> __kernel_timespec { None => init_clock_gettime(), }; let r0 = callee(which_clock as c::c_int, result.as_mut_ptr()); + // The `ClockId` enum only contains clocks which never fail. It may be + // tempting to change this to `debug_assert_eq`, however they can still + // fail on uncommon kernel configs, so we leave this in place to ensure + // that we don't execute undefined behavior if they ever do fail. assert_eq!(r0, 0); result.assume_init() } @@ -227,6 +231,7 @@ pub(super) type SyscallType = unsafe extern "C" fn(); /// Initialize `CLOCK_GETTIME` and return its value. #[cfg(feature = "time")] +#[cold] fn init_clock_gettime() -> ClockGettimeType { init(); // SAFETY: Load the function address from static storage that we @@ -236,6 +241,7 @@ fn init_clock_gettime() -> ClockGettimeType { /// Initialize `SYSCALL` and return its value. #[cfg(target_arch = "x86")] +#[cold] fn init_syscall() -> SyscallType { init(); // SAFETY: Load the function address from static storage that we @@ -310,21 +316,34 @@ unsafe fn _rustix_clock_gettime_via_syscall( ret(syscall!(__NR_clock_gettime, c_int(clockid), res)) } -/// A symbol pointing to an `int 0x80` instruction. This “function” is only -/// called from assembly, and only with the x86 syscall calling convention, -/// so its signature here is not its true signature. -#[cfg(all(asm, target_arch = "x86"))] -#[naked] -unsafe extern "C" fn rustix_int_0x80() { - asm!("int $$0x80", "ret", options(noreturn)) -} - -// The outline version of the `rustix_int_0x80` above. -#[cfg(all(not(asm), target_arch = "x86"))] +#[cfg(target_arch = "x86")] extern "C" { + /// A symbol pointing to an `int 0x80` instruction. This “function” is only + /// called from assembly, and only with the x86 syscall calling convention. + /// so its signature here is not its true signature. + /// + /// This extern block and the `global_asm!` below can be replaced with + /// `#[naked]` if it's stabilized. fn rustix_int_0x80(); } +#[cfg(target_arch = "x86")] +global_asm!( + r#" + .section .text.rustix_int_0x80,"ax",@progbits + .p2align 4 + .weak rustix_int_0x80 + .hidden rustix_int_0x80 + .type rustix_int_0x80, @function +rustix_int_0x80: + .cfi_startproc + int 0x80 + ret + .cfi_endproc + .size rustix_int_0x80, .-rustix_int_0x80 +"# +); + fn minimal_init() { // SAFETY: Store default function addresses in static storage so that if we // end up making any system calls while we read the vDSO, they'll work. @@ -380,9 +399,9 @@ fn init() { let ptr = vdso.sym(cstr!("LINUX_4.15"), cstr!("__vdso_clock_gettime")); #[cfg(target_arch = "powerpc64")] let ptr = vdso.sym(cstr!("LINUX_2.6.15"), cstr!("__kernel_clock_gettime")); - #[cfg(target_arch = "mips")] + #[cfg(any(target_arch = "mips", target_arch = "mips32r6"))] let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_clock_gettime64")); - #[cfg(target_arch = "mips64")] + #[cfg(any(target_arch = "mips64", target_arch = "mips64r6"))] let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_clock_gettime")); // On all 64-bit platforms, the 64-bit `clock_gettime` symbols are @@ -392,7 +411,12 @@ fn init() { // On some 32-bit platforms, the 64-bit `clock_gettime` symbols are not // available on older kernel versions. - #[cfg(any(target_arch = "arm", target_arch = "mips", target_arch = "x86"))] + #[cfg(any( + target_arch = "arm", + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "x86" + ))] let ok = !ptr.is_null(); if ok { diff --git a/vendor/rustix/src/check_types.rs b/vendor/rustix/src/check_types.rs index 2ba1f3f9e..861d7d7b5 100644 --- a/vendor/rustix/src/check_types.rs +++ b/vendor/rustix/src/check_types.rs @@ -3,16 +3,8 @@ /// Check that the size and alignment of a type match the `sys` bindings. macro_rules! check_type { ($struct:ident) => { - assert_eq!( - ( - core::mem::size_of::<$struct>(), - core::mem::align_of::<$struct>() - ), - ( - core::mem::size_of::(), - core::mem::align_of::() - ) - ); + assert_eq_size!($struct, c::$struct); + assert_eq_align!($struct, c::$struct); }; } @@ -20,13 +12,8 @@ macro_rules! check_type { /// renamed to avoid having types like `bindgen_ty_1` in the API. macro_rules! check_renamed_type { ($to:ident, $from:ident) => { - assert_eq!( - (core::mem::size_of::<$to>(), core::mem::align_of::<$to>()), - ( - core::mem::size_of::(), - core::mem::align_of::() - ) - ); + assert_eq_size!($to, c::$from); + assert_eq_align!($to, c::$from); }; } @@ -34,15 +21,16 @@ macro_rules! check_renamed_type { /// corresponding field in the `sys` bindings. macro_rules! check_struct_field { ($struct:ident, $field:ident) => { + const_assert_eq!( + memoffset::offset_of!($struct, $field), + memoffset::offset_of!(c::$struct, $field) + ); + + // This can't use `const_assert_eq` because `span_of` returns a + // `Range`, which can't be compared in const contexts. assert_eq!( - ( - memoffset::offset_of!($struct, $field), - memoffset::span_of!($struct, $field) - ), - ( - memoffset::offset_of!(c::$struct, $field), - memoffset::span_of!(c::$struct, $field) - ) + memoffset::span_of!($struct, $field), + memoffset::span_of!(c::$struct, $field) ); }; } @@ -51,15 +39,15 @@ macro_rules! check_struct_field { /// we've renamed to avoid having types like `bindgen_ty_1` in the API. macro_rules! check_struct_renamed_field { ($struct:ident, $to:ident, $from:ident) => { + const_assert_eq!( + memoffset::offset_of!($struct, $to), + memoffset::offset_of!(c::$struct, $from) + ); + + // As above, this can't use `const_assert_eq`. assert_eq!( - ( - memoffset::offset_of!($struct, $to), - memoffset::span_of!($struct, $to) - ), - ( - memoffset::offset_of!(c::$struct, $from), - memoffset::span_of!(c::$struct, $from) - ) + memoffset::span_of!($struct, $to), + memoffset::span_of!(c::$struct, $from) ); }; } @@ -68,15 +56,15 @@ macro_rules! check_struct_renamed_field { /// and a field are renamed. macro_rules! check_renamed_struct_renamed_field { ($to_struct:ident, $from_struct:ident, $to:ident, $from:ident) => { + const_assert_eq!( + memoffset::offset_of!($to_struct, $to), + memoffset::offset_of!(c::$from_struct, $from) + ); + + // As above, this can't use `const_assert_eq`. assert_eq!( - ( - memoffset::offset_of!($to_struct, $to), - memoffset::span_of!($to_struct, $to) - ), - ( - memoffset::offset_of!(c::$from_struct, $from), - memoffset::span_of!(c::$from_struct, $from) - ) + memoffset::span_of!($to_struct, $to), + memoffset::span_of!(c::$from_struct, $from) ); }; } diff --git a/vendor/rustix/src/clockid.rs b/vendor/rustix/src/clockid.rs index 84ae650a5..abeeb7095 100644 --- a/vendor/rustix/src/clockid.rs +++ b/vendor/rustix/src/clockid.rs @@ -52,6 +52,8 @@ pub enum ClockId { /// has to fail with `INVAL` due to an unsupported clock. See /// [`DynamicClockId`] for a greater set of clocks, with the caveat that not /// all of them are always supported. +/// +/// [`clock_gettime`]: crate::time::clock_gettime #[cfg(apple)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] #[repr(u32)] @@ -96,10 +98,15 @@ pub enum DynamicClockId<'a> { Tai, /// `CLOCK_BOOTTIME`, available on Linux >= 2.6.39 - #[cfg(any(linux_kernel, target_os = "openbsd"))] + #[cfg(any( + freebsdlike, + linux_kernel, + target_os = "fuchsia", + target_os = "openbsd" + ))] Boottime, /// `CLOCK_BOOTTIME_ALARM`, available on Linux >= 2.6.39 - #[cfg(linux_kernel)] + #[cfg(any(linux_kernel, target_os = "fuchsia"))] BoottimeAlarm, } diff --git a/vendor/rustix/src/cstr.rs b/vendor/rustix/src/cstr.rs index 0df1bf7cd..d32436e18 100644 --- a/vendor/rustix/src/cstr.rs +++ b/vendor/rustix/src/cstr.rs @@ -9,13 +9,13 @@ /// /// # Examples /// -/// ```no_run +/// ``` /// # #[cfg(feature = "fs")] /// # fn main() -> rustix::io::Result<()> { /// use rustix::cstr; /// use rustix::fs::{statat, AtFlags, CWD}; /// -/// let metadata = statat(CWD, cstr!("test.txt"), AtFlags::empty())?; +/// let metadata = statat(CWD, cstr!("Cargo.toml"), AtFlags::empty())?; /// # Ok(()) /// # } /// # #[cfg(not(feature = "fs"))] diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs index 83531a4e7..81e991772 100644 --- a/vendor/rustix/src/fs/abs.rs +++ b/vendor/rustix/src/fs/abs.rs @@ -2,17 +2,21 @@ use crate::fd::OwnedFd; use crate::ffi::{CStr, CString}; +#[cfg(not(target_os = "espidf"))] +use crate::fs::Access; #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] use crate::fs::StatFs; #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] use crate::fs::StatVfs; -use crate::fs::{Access, Mode, OFlags, Stat}; +use crate::fs::{Mode, OFlags, Stat}; use crate::path::SMALL_PATH_BUFFER_SIZE; use crate::{backend, io, path}; use alloc::vec::Vec; @@ -215,6 +219,7 @@ pub fn mkdir(path: P, mode: Mode) -> io::Result<()> { /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html /// [Linux]: https://man7.org/linux/man-pages/man2/access.2.html +#[cfg(not(target_os = "espidf"))] #[inline] pub fn access(path: P, access: Access) -> io::Result<()> { path.into_with_c_str(|path| backend::fs::syscalls::access(path, access)) @@ -231,8 +236,10 @@ pub fn access(path: P, access: Access) -> io::Result<()> { /// [Linux]: https://man7.org/linux/man-pages/man2/statfs.2.html #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs index 0c99cc30a..5bd90fab5 100644 --- a/vendor/rustix/src/fs/at.rs +++ b/vendor/rustix/src/fs/at.rs @@ -9,31 +9,35 @@ use crate::fd::OwnedFd; use crate::ffi::{CStr, CString}; #[cfg(apple)] use crate::fs::CloneFlags; -#[cfg(not(any(apple, target_os = "wasi")))] +#[cfg(not(any(apple, target_os = "espidf", target_os = "wasi")))] use crate::fs::FileType; #[cfg(linux_kernel)] use crate::fs::RenameFlags; -use crate::fs::{Access, AtFlags, Mode, OFlags, Stat, Timestamps}; -#[cfg(not(target_os = "wasi"))] +#[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::timespec::Nsecs; use crate::{backend, io, path}; use alloc::vec::Vec; use backend::fd::{AsFd, BorrowedFd}; +#[cfg(not(target_os = "espidf"))] +use { + crate::fs::{Access, AtFlags, Stat, Timestamps}, + crate::timespec::Nsecs, +}; pub use backend::fs::types::{Dev, RawMode}; /// `UTIME_NOW` for use with [`utimensat`]. /// /// [`utimensat`]: crate::fs::utimensat -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub const UTIME_NOW: Nsecs = backend::c::UTIME_NOW as Nsecs; /// `UTIME_OMIT` for use with [`utimensat`]. /// /// [`utimensat`]: crate::fs::utimensat -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub const UTIME_OMIT: Nsecs = backend::c::UTIME_OMIT as Nsecs; /// `openat(dirfd, path, oflags, mode)`—Opens a file. @@ -144,6 +148,7 @@ pub fn mkdirat(dirfd: Fd, path: P, mode: Mode) -> io::Re /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/linkat.html /// [Linux]: https://man7.org/linux/man-pages/man2/linkat.2.html +#[cfg(not(target_os = "espidf"))] #[inline] pub fn linkat( old_dirfd: PFd, @@ -177,6 +182,7 @@ pub fn linkat( /// [`REMOVEDIR`]: AtFlags::REMOVEDIR /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlinkat.html /// [Linux]: https://man7.org/linux/man-pages/man2/unlinkat.2.html +#[cfg(not(target_os = "espidf"))] #[inline] pub fn unlinkat(dirfd: Fd, path: P, flags: AtFlags) -> io::Result<()> { path.into_with_c_str(|path| backend::fs::syscalls::unlinkat(dirfd.as_fd(), path, flags)) @@ -274,6 +280,7 @@ pub fn symlinkat( /// [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"))] #[inline] #[doc(alias = "fstatat")] pub fn statat(dirfd: Fd, path: P, flags: AtFlags) -> io::Result { @@ -296,6 +303,7 @@ pub fn statat(dirfd: Fd, path: P, flags: AtFlags) -> io: /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html /// [Linux]: https://man7.org/linux/man-pages/man2/faccessat.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "faccessat")] pub fn accessat( @@ -315,6 +323,7 @@ pub fn accessat( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/utimensat.html /// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html +#[cfg(not(target_os = "espidf"))] #[inline] pub fn utimensat( dirfd: Fd, @@ -337,7 +346,7 @@ pub fn utimensat( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchmodat.html /// [Linux]: https://man7.org/linux/man-pages/man2/fchmodat.2.html -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] #[doc(alias = "fchmodat")] pub fn chmodat( @@ -376,7 +385,7 @@ pub fn fclonefileat( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknodat.html /// [Linux]: https://man7.org/linux/man-pages/man2/mknodat.2.html -#[cfg(not(any(apple, target_os = "wasi")))] +#[cfg(not(any(apple, target_os = "espidf", target_os = "wasi")))] #[inline] pub fn mknodat( dirfd: Fd, @@ -399,7 +408,7 @@ pub fn mknodat( /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fchownat.html /// [Linux]: https://man7.org/linux/man-pages/man2/fchownat.2.html -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] #[doc(alias = "fchownat")] pub fn chownat( diff --git a/vendor/rustix/src/fs/constants.rs b/vendor/rustix/src/fs/constants.rs index ef677aa49..85889d90e 100644 --- a/vendor/rustix/src/fs/constants.rs +++ b/vendor/rustix/src/fs/constants.rs @@ -3,9 +3,11 @@ use crate::backend; pub use crate::io::FdFlags; -pub use backend::fs::types::{Access, Dev, Mode, OFlags}; +#[cfg(not(target_os = "espidf"))] +pub use backend::fs::types::Access; +pub use backend::fs::types::{Dev, Mode, OFlags}; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub use backend::fs::types::AtFlags; #[cfg(apple)] diff --git a/vendor/rustix/src/fs/cwd.rs b/vendor/rustix/src/fs/cwd.rs index 2745060a1..e66360e43 100644 --- a/vendor/rustix/src/fs/cwd.rs +++ b/vendor/rustix/src/fs/cwd.rs @@ -25,13 +25,11 @@ use backend::fd::{BorrowedFd, RawFd}; // SAFETY: `AT_FDCWD` is a reserved value that is never dynamically // allocated, so it'll remain valid for the duration of `'static`. #[doc(alias = "AT_FDCWD")] -#[cfg(not(target_os = "haiku"))] // Haiku needs pub const CWD: BorrowedFd<'static> = unsafe { BorrowedFd::<'static>::borrow_raw(c::AT_FDCWD as RawFd) }; /// Return the value of [`CWD`]. #[deprecated(note = "Use `CWD` in place of `cwd()`.")] -#[cfg(not(target_os = "haiku"))] // Haiku needs pub const fn cwd() -> BorrowedFd<'static> { let at_fdcwd = c::AT_FDCWD as RawFd; diff --git a/vendor/rustix/src/fs/fcntl.rs b/vendor/rustix/src/fs/fcntl.rs index 91816aaa2..f7f4790cb 100644 --- a/vendor/rustix/src/fs/fcntl.rs +++ b/vendor/rustix/src/fs/fcntl.rs @@ -5,6 +5,7 @@ #[cfg(not(any( target_os = "emscripten", + target_os = "espidf", target_os = "fuchsia", target_os = "redox", target_os = "wasi" @@ -17,7 +18,7 @@ use backend::fs::types::OFlags; // These `fcntl` functions like in the `io` module because they're not specific // to files, directories, or memfd objects. We re-export them here in the `fs` // module because the other the `fcntl` functions are here. -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub use crate::io::fcntl_dupfd_cloexec; pub use crate::io::{fcntl_getfd, fcntl_setfd}; @@ -96,6 +97,7 @@ pub fn fcntl_add_seals(fd: Fd, seals: SealFlags) -> io::Result<()> { /// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html #[cfg(not(any( target_os = "emscripten", + target_os = "espidf", target_os = "fuchsia", target_os = "redox", target_os = "wasi" diff --git a/vendor/rustix/src/fs/fcntl_apple.rs b/vendor/rustix/src/fs/fcntl_apple.rs index 6d624ee47..a32e46d74 100644 --- a/vendor/rustix/src/fs/fcntl_apple.rs +++ b/vendor/rustix/src/fs/fcntl_apple.rs @@ -7,6 +7,7 @@ use backend::fd::AsFd; /// - [Apple] /// /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +#[doc(alias = "F_RDADVISE")] #[inline] pub fn fcntl_rdadvise(fd: Fd, offset: u64, len: u64) -> io::Result<()> { backend::fs::syscalls::fcntl_rdadvise(fd.as_fd(), offset, len) @@ -18,7 +19,48 @@ pub fn fcntl_rdadvise(fd: Fd, offset: u64, len: u64) -> io::Result<()> /// - [Apple] /// /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +#[doc(alias = "F_FULLSYNC")] #[inline] pub fn fcntl_fullfsync(fd: Fd) -> io::Result<()> { backend::fs::syscalls::fcntl_fullfsync(fd.as_fd()) } + +/// `fcntl(fd, F_NOCACHE, value)`—Turn data caching off or on for a file +/// descriptor. +/// +/// See [this mailing list post] for additional information about the meanings +/// of `F_NOCACHE` and `F_GLOBAL_NOCACHE`. +/// +/// [this mailing list post]: https://lists.apple.com/archives/filesystem-dev/2007/Sep/msg00010.html +/// +/// See also [`fcntl_global_nocache`]. +/// +/// # References +/// - [Apple] +/// +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +#[doc(alias = "F_NOCACHE")] +#[inline] +pub fn fcntl_nocache(fd: Fd, value: bool) -> io::Result<()> { + backend::fs::syscalls::fcntl_nocache(fd.as_fd(), value) +} + +/// `fcntl(fd, F_GLOBAL_NOCACHE, value)`—Turn data caching off or on for all +/// file descriptors. +/// +/// See [this mailing list post] for additional information about the meanings +/// of `F_NOCACHE` and `F_GLOBAL_NOCACHE`. +/// +/// [this mailing list post]: https://lists.apple.com/archives/filesystem-dev/2007/Sep/msg00010.html +/// +/// See also [`fcntl_nocache`]. +/// +/// # References +/// - [Apple] +/// +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +#[doc(alias = "F_GLOBAL_NOCACHE")] +#[inline] +pub fn fcntl_global_nocache(fd: Fd, value: bool) -> io::Result<()> { + backend::fs::syscalls::fcntl_global_nocache(fd.as_fd(), value) +} diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs index d0d50073e..43b2e57b1 100644 --- a/vendor/rustix/src/fs/fd.rs +++ b/vendor/rustix/src/fs/fd.rs @@ -8,7 +8,7 @@ use crate::fs::{OFlags, SeekFrom, Timespec}; use crate::{backend, io}; use backend::fd::{AsFd, BorrowedFd}; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub use backend::fs::types::FlockOperation; #[cfg(not(any( @@ -16,6 +16,8 @@ pub use backend::fs::types::FlockOperation; solarish, target_os = "aix", target_os = "dragonfly", + target_os = "espidf", + target_os = "nto", target_os = "redox", )))] pub use backend::fs::types::FallocateFlags; @@ -24,8 +26,10 @@ pub use backend::fs::types::Stat; #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -161,8 +165,10 @@ pub fn fstat(fd: Fd) -> io::Result { /// [Linux]: https://man7.org/linux/man-pages/man2/fstatfs.2.html #[cfg(not(any( solarish, + target_os = "espidf", target_os = "haiku", target_os = "netbsd", + target_os = "nto", target_os = "redox", target_os = "wasi", )))] @@ -199,6 +205,7 @@ pub fn fstatvfs(fd: Fd) -> io::Result { /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html /// [Linux]: https://man7.org/linux/man-pages/man2/utimensat.2.html +#[cfg(not(target_os = "espidf"))] #[inline] pub fn futimens(fd: Fd, times: &Timestamps) -> io::Result<()> { backend::fs::syscalls::futimens(fd.as_fd(), times) @@ -224,6 +231,8 @@ pub fn futimens(fd: Fd, times: &Timestamps) -> io::Result<()> { solarish, target_os = "aix", target_os = "dragonfly", + target_os = "espidf", + target_os = "nto", target_os = "redox", )))] // not implemented in libc for netbsd yet #[inline] @@ -292,6 +301,7 @@ pub fn fsync(fd: Fd) -> io::Result<()> { #[cfg(not(any( apple, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] @@ -319,7 +329,7 @@ pub fn ftruncate(fd: Fd, length: u64) -> io::Result<()> { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/flock.2.html -#[cfg(not(any(target_os = "solaris", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "solaris", target_os = "wasi")))] #[inline] pub fn flock(fd: Fd, operation: FlockOperation) -> io::Result<()> { backend::fs::syscalls::flock(fd.as_fd(), operation) diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs index fc2c3368b..fbfaa12c9 100644 --- a/vendor/rustix/src/fs/mod.rs +++ b/vendor/rustix/src/fs/mod.rs @@ -6,15 +6,17 @@ mod at; mod constants; #[cfg(linux_kernel)] mod copy_file_range; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(target_os = "haiku"))] // Haiku needs mod cwd; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] mod dir; #[cfg(not(any( apple, netbsdlike, solarish, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] @@ -32,11 +34,17 @@ mod getpath; mod id; #[cfg(not(target_os = "wasi"))] mod ioctl; -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "redox", + target_os = "wasi" +)))] mod makedev; #[cfg(any(linux_kernel, target_os = "freebsd"))] mod memfd_create; #[cfg(linux_kernel)] +#[cfg(feature = "fs")] mod mount; #[cfg(linux_kernel)] mod openat2; @@ -47,7 +55,7 @@ mod seek_from; mod sendfile; #[cfg(linux_kernel)] mod statx; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))] mod sync; #[cfg(any(apple, linux_kernel))] mod xattr; @@ -60,22 +68,24 @@ pub use at::*; pub use constants::*; #[cfg(linux_kernel)] pub use copy_file_range::copy_file_range; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] +#[cfg(not(target_os = "haiku"))] // Haiku needs pub use cwd::*; -#[cfg(not(target_os = "redox"))] +#[cfg(not(any(target_os = "espidf", target_os = "redox")))] pub use dir::{Dir, DirEntry}; #[cfg(not(any( apple, netbsdlike, solarish, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "redox", )))] pub use fadvise::{fadvise, Advice}; pub use fcntl::*; #[cfg(apple)] -pub use fcntl_apple::{fcntl_fullfsync, fcntl_rdadvise}; +pub use fcntl_apple::*; #[cfg(apple)] pub use fcopyfile::*; pub use fd::*; @@ -86,11 +96,17 @@ pub use getpath::getpath; pub use id::*; #[cfg(not(target_os = "wasi"))] pub use ioctl::*; -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "redox", + target_os = "wasi" +)))] pub use makedev::*; #[cfg(any(linux_kernel, target_os = "freebsd"))] pub use memfd_create::{memfd_create, MemfdFlags}; #[cfg(linux_kernel)] +#[cfg(feature = "fs")] pub use mount::*; #[cfg(linux_kernel)] pub use openat2::openat2; @@ -101,7 +117,7 @@ pub use seek_from::SeekFrom; pub use sendfile::sendfile; #[cfg(linux_kernel)] pub use statx::{statx, Statx, StatxFlags, StatxTimestamp}; -#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub use sync::sync; #[cfg(any(apple, linux_kernel))] pub use xattr::*; diff --git a/vendor/rustix/src/fs/mount.rs b/vendor/rustix/src/fs/mount.rs index 1439b1f32..d1e6a8238 100644 --- a/vendor/rustix/src/fs/mount.rs +++ b/vendor/rustix/src/fs/mount.rs @@ -1,166 +1,45 @@ //! Linux `mount`. - -use crate::backend::fs::types::{ - InternalMountFlags, MountFlags, MountFlagsArg, MountPropagationFlags, UnmountFlags, -}; -use crate::{backend, io, path}; - -/// `mount(source, target, filesystemtype, mountflags, data)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -pub fn mount( - source: Source, - target: Target, - file_system_type: Fs, - flags: MountFlags, - data: Data, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - file_system_type.into_with_c_str(|file_system_type| { - data.into_with_c_str(|data| { - backend::fs::syscalls::mount( - Some(source), - target, - Some(file_system_type), - MountFlagsArg(flags.bits()), - Some(data), - ) - }) - }) - }) - }) -} - -/// `mount(NULL, target, NULL, MS_REMOUNT | mountflags, data)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn remount( - target: Target, - flags: MountFlags, - data: Data, -) -> io::Result<()> { - target.into_with_c_str(|target| { - data.into_with_c_str(|data| { - backend::fs::syscalls::mount( - None, - target, - None, - MountFlagsArg(InternalMountFlags::REMOUNT.bits() | flags.bits()), - Some(data), - ) - }) - }) -} - -/// `mount(source, target, NULL, MS_BIND, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn bind_mount( - source: Source, - target: Target, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount( - Some(source), - target, - None, - MountFlagsArg(MountFlags::BIND.bits()), - None, - ) - }) - }) -} - -/// `mount(source, target, NULL, MS_BIND | MS_REC, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn recursive_bind_mount( - source: Source, - target: Target, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount( - Some(source), - target, - None, - MountFlagsArg(MountFlags::BIND.bits() | MountPropagationFlags::REC.bits()), - None, - ) - }) - }) -} - -/// `mount(NULL, target, NULL, mountflags, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn change_mount( - target: Target, - flags: MountPropagationFlags, -) -> io::Result<()> { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount(None, target, None, MountFlagsArg(flags.bits()), None) - }) -} - -/// `mount(source, target, NULL, MS_MOVE, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn move_mount( - source: Source, - target: Target, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount( - Some(source), - target, - None, - MountFlagsArg(InternalMountFlags::MOVE.bits()), - None, - ) - }) - }) -} - -/// `umount2(target, flags)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/umount.2.html -#[doc(alias = "umount", alias = "umount2")] -pub fn unmount(target: Target, flags: UnmountFlags) -> io::Result<()> { - target.into_with_c_str(|target| backend::fs::syscalls::unmount(target, flags)) -} +//! +//! These have been moved to a new `rustix::mount` module. + +#[deprecated(note = "rustix::fs::UnmountFlags` moved to `rustix::mount::UnmountFlags`.")] +pub use crate::mount::UnmountFlags; + +#[deprecated(note = "rustix::fs::MountFlags` moved to `rustix::mount::MountFlags`.")] +pub use crate::mount::MountFlags; + +#[deprecated( + note = "rustix::fs::MountPropagationFlags` moved to `rustix::mount::MountPropagationFlags`." +)] +pub use crate::mount::MountPropagationFlags; + +#[deprecated(note = "`rustix::fs::mount` moved to `rustix::mount::mount`.")] +pub use crate::mount::mount; + +#[deprecated(note = "`rustix::fs::unmount` moved to `rustix::mount::unmount`.")] +pub use crate::mount::unmount; + +#[deprecated( + note = "`rustix::fs::remount` is renamed and moved to `rustix::mount::mount_remount`." +)] +pub use crate::mount::mount_remount as remount; + +#[deprecated( + note = "`rustix::fs::bind_mount` is renamed and moved to `rustix::mount::mount_bind`." +)] +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`." +)] +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`." +)] +pub use crate::mount::mount_change as change_mount; + +#[deprecated( + note = "`rustix::fs::move_mount` is renamed and moved to `rustix::mount::mount_move`." +)] +pub use crate::mount::mount_move as move_mount; diff --git a/vendor/rustix/src/io/dup.rs b/vendor/rustix/src/io/dup.rs index 428c69f28..9f5186192 100644 --- a/vendor/rustix/src/io/dup.rs +++ b/vendor/rustix/src/io/dup.rs @@ -111,7 +111,12 @@ pub fn dup2(fd: Fd, new: &mut OwnedFd) -> io::Result<()> { /// [NetBSD]: https://man.netbsd.org/dup3.2 /// [OpenBSD]: https://man.openbsd.org/dup3.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup3§ion=3 -#[cfg(not(any(target_os = "aix", target_os = "wasi")))] +#[cfg(not(any( + target_os = "aix", + target_os = "espidf", + target_os = "nto", + target_os = "wasi" +)))] #[inline] pub fn dup3(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> { backend::io::syscalls::dup3(fd.as_fd(), new, flags) diff --git a/vendor/rustix/src/io/errno.rs b/vendor/rustix/src/io/errno.rs index 7cb50f229..7640d3111 100644 --- a/vendor/rustix/src/io/errno.rs +++ b/vendor/rustix/src/io/errno.rs @@ -1,8 +1,8 @@ //! The `Errno` type, which is a minimal wrapper around an error code. //! -//! We define the error constants as individual `const`s instead of an -//! enum because we may not know about all of the host's error values -//! and we don't want unrecognized values to create UB. +//! We define the error constants as individual `const`s instead of an enum +//! because we may not know about all of the host's error values and we don't +//! want unrecognized values to create undefined behavior. use crate::backend; use core::{fmt, result}; diff --git a/vendor/rustix/src/io/fcntl.rs b/vendor/rustix/src/io/fcntl.rs index 0454821ff..913e9d062 100644 --- a/vendor/rustix/src/io/fcntl.rs +++ b/vendor/rustix/src/io/fcntl.rs @@ -98,7 +98,7 @@ pub fn fcntl_setfd(fd: Fd, flags: FdFlags) -> io::Result<()> { /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl§ion=2 /// [illumos]: https://illumos.org/man/2/fcntl /// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function -#[cfg(not(any(target_os = "wasi", target_os = "espidf")))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] #[inline] #[doc(alias = "F_DUPFD_CLOEXEC")] pub fn fcntl_dupfd_cloexec(fd: Fd, min: RawFd) -> io::Result { diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs index 59cbe1ab5..d9bfa1fb3 100644 --- a/vendor/rustix/src/io/ioctl.rs +++ b/vendor/rustix/src/io/ioctl.rs @@ -62,6 +62,7 @@ pub fn ioctl_fionbio(fd: Fd, value: bool) -> io::Result<()> { /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2#GENERIC%09IOCTLS /// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS /// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "FIONREAD")] pub fn ioctl_fionread(fd: Fd) -> io::Result { diff --git a/vendor/rustix/src/io/read_write.rs b/vendor/rustix/src/io/read_write.rs index 32cbda225..91a28bc39 100644 --- a/vendor/rustix/src/io/read_write.rs +++ b/vendor/rustix/src/io/read_write.rs @@ -138,6 +138,7 @@ pub fn pwrite(fd: Fd, buf: &[u8], offset: u64) -> io::Result { /// [OpenBSD]: https://man.openbsd.org/readv.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=readv§ion=2 /// [illumos]: https://illumos.org/man/2/readv +#[cfg(not(target_os = "espidf"))] #[inline] pub fn readv(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result { backend::io::syscalls::readv(fd.as_fd(), bufs) @@ -163,6 +164,7 @@ pub fn readv(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result /// [OpenBSD]: https://man.openbsd.org/writev.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=writev§ion=2 /// [illumos]: https://illumos.org/man/2/writev +#[cfg(not(target_os = "espidf"))] #[inline] pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { backend::io::syscalls::writev(fd.as_fd(), bufs) @@ -185,7 +187,13 @@ pub fn writev(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result { /// [OpenBSD]: https://man.openbsd.org/preadv.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=preadv§ion=2 /// [illumos]: https://illumos.org/man/2/preadv -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "redox", + target_os = "solaris" +)))] #[inline] pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result { backend::io::syscalls::preadv(fd.as_fd(), bufs, offset) @@ -212,7 +220,13 @@ pub fn preadv(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io: /// [OpenBSD]: https://man.openbsd.org/pwritev.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pwritev§ion=2 /// [illumos]: https://illumos.org/man/2/pwritev -#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + target_os = "redox", + target_os = "solaris" +)))] #[inline] pub fn pwritev(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Result { backend::io::syscalls::pwritev(fd.as_fd(), bufs, offset) diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs index 3fcf92544..988525e5f 100644 --- a/vendor/rustix/src/lib.rs +++ b/vendor/rustix/src/lib.rs @@ -100,14 +100,10 @@ #![cfg_attr(rustc_attrs, feature(rustc_attrs))] #![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))] -#![cfg_attr( - all(linux_raw, naked_functions, target_arch = "x86"), - feature(naked_functions) -)] #![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_ffi))] #![cfg_attr(alloc_c_string, feature(alloc_c_string))] +#![cfg_attr(alloc_ffi, feature(alloc_ffi))] #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(feature = "rustc-dep-of-std", feature(ip))] #![cfg_attr( @@ -127,6 +123,16 @@ #[cfg(not(feature = "rustc-dep-of-std"))] extern crate alloc; +// Use `static_assertions` macros if we have them, or a polyfill otherwise. +#[cfg(all(test, static_assertions))] +#[macro_use] +#[allow(unused_imports)] +extern crate static_assertions; +#[cfg(all(test, not(static_assertions)))] +#[macro_use] +#[allow(unused_imports)] +mod static_assertions; + // Internal utilities. #[cfg(not(windows))] #[macro_use] @@ -149,7 +155,7 @@ pub(crate) mod bitcast; // versions of libc and not others. #[cfg(any( all(linux_raw, feature = "use-libc-auxv"), - all(libc, not(any(windows, target_os = "wasi"))) + all(libc, not(any(windows, target_os = "espidf", target_os = "wasi"))) ))] #[macro_use] mod weak; @@ -204,21 +210,26 @@ pub mod io; #[cfg(feature = "io_uring")] #[cfg_attr(doc_cfg, doc(cfg(feature = "io_uring")))] pub mod io_uring; -#[cfg(not(any(windows, target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))] #[cfg(feature = "mm")] #[cfg_attr(doc_cfg, doc(cfg(feature = "mm")))] pub mod mm; +#[cfg(linux_kernel)] +#[cfg(feature = "mount")] +#[cfg_attr(doc_cfg, doc(cfg(feature = "mount")))] +pub mod mount; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] #[cfg(feature = "net")] #[cfg_attr(doc_cfg, doc(cfg(feature = "net")))] pub mod net; -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "espidf")))] #[cfg(feature = "param")] #[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, @@ -232,7 +243,10 @@ pub mod param; ) ) ))] -#[cfg_attr(doc_cfg, doc(cfg(any(feature = "fs", feature = "net"))))] +#[cfg_attr( + doc_cfg, + doc(cfg(any(feature = "fs", feature = "mount", feature = "net"))) +)] pub mod path; #[cfg(feature = "pipe")] #[cfg_attr(doc_cfg, doc(cfg(feature = "pipe")))] @@ -271,7 +285,7 @@ pub mod termios; #[cfg(feature = "thread")] #[cfg_attr(doc_cfg, doc(cfg(feature = "thread")))] pub mod thread; -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "espidf")))] #[cfg(feature = "time")] #[cfg_attr(doc_cfg, doc(cfg(feature = "time")))] pub mod time; @@ -284,8 +298,14 @@ pub mod time; #[cfg_attr(doc_cfg, doc(cfg(feature = "runtime")))] pub mod runtime; +// Temporarily provide some mount functions for use in the fs module for +// backwards compatibility. +#[cfg(linux_kernel)] +#[cfg(all(feature = "fs", not(feature = "mount")))] +pub(crate) mod mount; + // Private modules used by multiple public modules. -#[cfg(not(windows))] +#[cfg(not(any(windows, target_os = "espidf")))] #[cfg(any(feature = "thread", feature = "time", target_arch = "x86"))] mod clockid; #[cfg(not(any(windows, target_os = "wasi")))] @@ -301,7 +321,7 @@ mod pid; #[cfg(any(feature = "process", feature = "thread"))] #[cfg(linux_kernel)] mod prctl; -#[cfg(not(any(windows, target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))] #[cfg(any(feature = "process", feature = "runtime", all(bsd, feature = "event")))] mod signal; #[cfg(not(windows))] diff --git a/vendor/rustix/src/mm/mmap.rs b/vendor/rustix/src/mm/mmap.rs index bec15f0ad..02badb9fd 100644 --- a/vendor/rustix/src/mm/mmap.rs +++ b/vendor/rustix/src/mm/mmap.rs @@ -222,7 +222,8 @@ pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io /// /// Some implementations implicitly round the memory region out to the nearest /// page boundaries, so this function may lock more memory than explicitly -/// requested if the memory isn't page-aligned. +/// requested if the memory isn't page-aligned. Other implementations fail if +/// the memory isn't page-aligned. /// /// # References /// - [POSIX] diff --git a/vendor/rustix/src/mount/fsopen.rs b/vendor/rustix/src/mount/fsopen.rs new file mode 100644 index 000000000..581f03782 --- /dev/null +++ b/vendor/rustix/src/mount/fsopen.rs @@ -0,0 +1,219 @@ +//! `fsopen` and related functions in Linux's `mount` API. + +use crate::backend::mount::types::{ + FsMountFlags, FsOpenFlags, FsPickFlags, MountAttrFlags, MoveMountFlags, OpenTreeFlags, +}; +use crate::fd::{BorrowedFd, OwnedFd}; +use crate::{backend, io, path}; + +/// `fsopen(fs_name, flags)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsopen.md +#[inline] +pub fn fsopen(fs_name: Fs, flags: FsOpenFlags) -> io::Result { + fs_name.into_with_c_str(|fs_name| backend::mount::syscalls::fsopen(fs_name, flags)) +} + +/// `fsmount(fs_fd, flags, attr_flags)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsmount.md +#[inline] +pub fn fsmount( + fs_fd: BorrowedFd<'_>, + flags: FsMountFlags, + attr_flags: MountAttrFlags, +) -> io::Result<()> { + backend::mount::syscalls::fsmount(fs_fd, flags, attr_flags) +} + +/// `move_mount(from_dfd, from_pathname, to_dfd, to_pathname, flags)` +/// +/// This is not the same as `mount` with the `MS_MOVE` flag. If you want to +/// use that, use [`mount_move`] instead. +/// +/// # References +/// - [Unfinished draft] +/// +/// [`mount_move`]: crate::mount::mount_move +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/move_mount.md +#[inline] +pub fn move_mount( + from_dfd: BorrowedFd<'_>, + from_pathname: From, + to_dfd: BorrowedFd<'_>, + to_pathname: To, + flags: MoveMountFlags, +) -> io::Result<()> { + from_pathname.into_with_c_str(|from_pathname| { + to_pathname.into_with_c_str(|to_pathname| { + backend::mount::syscalls::move_mount( + from_dfd, + from_pathname, + to_dfd, + to_pathname, + flags, + ) + }) + }) +} + +/// `open_tree(dfd, filename, flags)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/open_tree.md +#[inline] +pub fn open_tree( + dfd: BorrowedFd<'_>, + filename: Path, + flags: OpenTreeFlags, +) -> io::Result { + filename.into_with_c_str(|filename| backend::mount::syscalls::open_tree(dfd, filename, flags)) +} + +/// `fspick(dfd, path, flags)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fspick.md +#[inline] +pub fn fspick( + dfd: BorrowedFd<'_>, + path: Path, + flags: FsPickFlags, +) -> io::Result { + path.into_with_c_str(|path| backend::mount::syscalls::fspick(dfd, path, flags)) +} + +/// `fsconfig(fs_fd, FSCONFIG_SET_FLAG, key, NULL, 0)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_set_flag(fs_fd: BorrowedFd<'_>, key: Key) -> io::Result<()> { + key.into_with_c_str(|key| backend::mount::syscalls::fsconfig_set_flag(fs_fd, key)) +} + +/// `fsconfig(fs_fd, FSCONFIG_SET_STRING, key, value, 0)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_set_string( + fs_fd: BorrowedFd<'_>, + key: Key, + value: Value, +) -> io::Result<()> { + key.into_with_c_str(|key| { + value.into_with_c_str(|value| { + backend::mount::syscalls::fsconfig_set_string(fs_fd, key, value) + }) + }) +} + +/// `fsconfig(fs_fd, FSCONFIG_SET_BINARY, key, value, value.len())` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_set_binary( + fs_fd: BorrowedFd<'_>, + key: Key, + value: &[u8], +) -> io::Result<()> { + key.into_with_c_str(|key| backend::mount::syscalls::fsconfig_set_binary(fs_fd, key, value)) +} + +/// `fsconfig(fs_fd, FSCONFIG_SET_PATH, key, path, fd)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_set_path( + fs_fd: BorrowedFd<'_>, + key: Key, + path: Path, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + key.into_with_c_str(|key| { + path.into_with_c_str(|path| { + backend::mount::syscalls::fsconfig_set_path(fs_fd, key, path, fd) + }) + }) +} + +/// `fsconfig(fs_fd, FSCONFIG_SET_PATH_EMPTY, key, "", fd)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_set_path_empty( + fs_fd: BorrowedFd<'_>, + key: Key, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + key.into_with_c_str(|key| backend::mount::syscalls::fsconfig_set_path_empty(fs_fd, key, fd)) +} + +/// `fsconfig(fs_fd, FSCONFIG_SET_FD, key, NULL, fd)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_set_fd( + fs_fd: BorrowedFd<'_>, + key: Key, + fd: BorrowedFd<'_>, +) -> io::Result<()> { + key.into_with_c_str(|key| backend::mount::syscalls::fsconfig_set_fd(fs_fd, key, fd)) +} + +/// `fsconfig(fs_fd, FSCONFIG_CMD_CREATE, key, NULL, 0)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_create(fs_fd: BorrowedFd<'_>) -> io::Result<()> { + backend::mount::syscalls::fsconfig_create(fs_fd) +} + +/// `fsconfig(fs_fd, FSCONFIG_CMD_RECONFIGURE, key, NULL, 0)` +/// +/// # References +/// - [Unfinished draft] +/// +/// [Unfinished draft]: https://github.com/sunfishcode/linux-mount-api-documentation/blob/main/fsconfig.md +#[inline] +#[doc(alias = "fsconfig")] +pub fn fsconfig_reconfigure(fs_fd: BorrowedFd<'_>) -> io::Result<()> { + backend::mount::syscalls::fsconfig_reconfigure(fs_fd) +} diff --git a/vendor/rustix/src/mount/mod.rs b/vendor/rustix/src/mount/mod.rs new file mode 100644 index 000000000..9b4f6da51 --- /dev/null +++ b/vendor/rustix/src/mount/mod.rs @@ -0,0 +1,19 @@ +//! Linux `mount` API. + +// The `mount` module includes the `mount` function and related +// functions which were originally defined in `rustix::fs` but are +// now replaced by deprecated aliases. After the next semver bump, +// we can remove the aliases and all the `#[cfg(feature = "mount")]` +// here and in src/backend/*/mount. +// +// The `fsopen` module includes `fsopen` and related functions. + +#[cfg(feature = "mount")] +mod fsopen; +mod mount_unmount; +mod types; + +#[cfg(feature = "mount")] +pub use fsopen::*; +pub use mount_unmount::*; +pub use types::*; diff --git a/vendor/rustix/src/mount/mount_unmount.rs b/vendor/rustix/src/mount/mount_unmount.rs new file mode 100644 index 000000000..ebb517332 --- /dev/null +++ b/vendor/rustix/src/mount/mount_unmount.rs @@ -0,0 +1,175 @@ +//! Linux `mount`. + +use crate::backend::mount::types::{ + InternalMountFlags, MountFlags, MountFlagsArg, MountPropagationFlags, UnmountFlags, +}; +use crate::{backend, io, path}; + +/// `mount(source, target, filesystemtype, mountflags, data)` +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html +#[inline] +pub fn mount( + source: Source, + target: Target, + file_system_type: Fs, + flags: MountFlags, + data: Data, +) -> io::Result<()> { + source.into_with_c_str(|source| { + target.into_with_c_str(|target| { + file_system_type.into_with_c_str(|file_system_type| { + data.into_with_c_str(|data| { + backend::mount::syscalls::mount( + Some(source), + target, + Some(file_system_type), + MountFlagsArg(flags.bits()), + Some(data), + ) + }) + }) + }) + }) +} + +/// `mount(NULL, target, NULL, MS_REMOUNT | mountflags, data)` +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html +#[inline] +#[doc(alias = "mount")] +#[doc(alias = "MS_REMOUNT")] +pub fn mount_remount( + target: Target, + flags: MountFlags, + data: Data, +) -> io::Result<()> { + target.into_with_c_str(|target| { + data.into_with_c_str(|data| { + backend::mount::syscalls::mount( + None, + target, + None, + MountFlagsArg(InternalMountFlags::REMOUNT.bits() | flags.bits()), + Some(data), + ) + }) + }) +} + +/// `mount(source, target, NULL, MS_BIND, NULL)` +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html +#[inline] +#[doc(alias = "mount")] +#[doc(alias = "MS_BIND")] +pub fn mount_bind( + source: Source, + target: Target, +) -> io::Result<()> { + source.into_with_c_str(|source| { + target.into_with_c_str(|target| { + backend::mount::syscalls::mount( + Some(source), + target, + None, + MountFlagsArg(MountFlags::BIND.bits()), + None, + ) + }) + }) +} + +/// `mount(source, target, NULL, MS_BIND | MS_REC, NULL)` +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html +#[inline] +#[doc(alias = "mount")] +#[doc(alias = "MS_REC")] +pub fn mount_recursive_bind( + source: Source, + target: Target, +) -> io::Result<()> { + source.into_with_c_str(|source| { + target.into_with_c_str(|target| { + backend::mount::syscalls::mount( + Some(source), + target, + None, + MountFlagsArg(MountFlags::BIND.bits() | MountPropagationFlags::REC.bits()), + None, + ) + }) + }) +} + +/// `mount(NULL, target, NULL, mountflags, NULL)` +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html +#[inline] +#[doc(alias = "mount")] +pub fn mount_change( + target: Target, + flags: MountPropagationFlags, +) -> io::Result<()> { + target.into_with_c_str(|target| { + backend::mount::syscalls::mount(None, target, None, MountFlagsArg(flags.bits()), None) + }) +} + +/// `mount(source, target, NULL, MS_MOVE, NULL)` +/// +/// This is not the same as the `move_mount` syscall. If you want to use that, +/// use [`move_mount`] instead. +/// +/// # References +/// - [Linux] +/// +/// [`move_mount`]: crate::mount::move_mount +/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html +#[inline] +#[doc(alias = "mount")] +#[doc(alias = "MS_MOVE")] +pub fn mount_move( + source: Source, + target: Target, +) -> io::Result<()> { + source.into_with_c_str(|source| { + target.into_with_c_str(|target| { + backend::mount::syscalls::mount( + Some(source), + target, + None, + MountFlagsArg(InternalMountFlags::MOVE.bits()), + None, + ) + }) + }) +} + +/// `umount2(target, flags)` +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/umount.2.html +#[inline] +#[doc(alias = "umount", alias = "umount2")] +pub fn unmount(target: Target, flags: UnmountFlags) -> io::Result<()> { + target.into_with_c_str(|target| backend::mount::syscalls::unmount(target, flags)) +} diff --git a/vendor/rustix/src/mount/types.rs b/vendor/rustix/src/mount/types.rs new file mode 100644 index 000000000..6096e76d2 --- /dev/null +++ b/vendor/rustix/src/mount/types.rs @@ -0,0 +1 @@ +pub use crate::backend::mount::types::*; diff --git a/vendor/rustix/src/net/send_recv/mod.rs b/vendor/rustix/src/net/send_recv/mod.rs index 2d55c7f94..1dedd99cb 100644 --- a/vendor/rustix/src/net/send_recv/mod.rs +++ b/vendor/rustix/src/net/send_recv/mod.rs @@ -8,10 +8,10 @@ use backend::fd::{AsFd, BorrowedFd}; pub use backend::net::send_recv::{RecvFlags, SendFlags}; -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] mod msg; -#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "redox", target_os = "wasi")))] pub use msg::*; /// `recv(fd, buf, flags)`—Reads data from a socket. diff --git a/vendor/rustix/src/net/send_recv/msg.rs b/vendor/rustix/src/net/send_recv/msg.rs index 916f2a3db..5fefb2e24 100644 --- a/vendor/rustix/src/net/send_recv/msg.rs +++ b/vendor/rustix/src/net/send_recv/msg.rs @@ -107,11 +107,15 @@ 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 { - if self.length > 0 { - self.buffer.as_mut_ptr() - } else { - ptr::null_mut() + // 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 { + return core::ptr::null_mut(); } + + self.buffer.as_mut_ptr() } /// Returns the length of the message data. @@ -223,6 +227,14 @@ 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 + // causes `sendmsg` to fail with `EFAULT` or `EINVAL` + #[cfg(not(linux_kernel))] + if self.buffer.is_empty() { + return core::ptr::null_mut(); + } + self.buffer.as_mut_ptr() } diff --git a/vendor/rustix/src/net/sockopt.rs b/vendor/rustix/src/net/sockopt.rs index 53e73e64b..b21d4a35c 100644 --- a/vendor/rustix/src/net/sockopt.rs +++ b/vendor/rustix/src/net/sockopt.rs @@ -1632,9 +1632,8 @@ pub fn get_tcp_nodelay(fd: Fd) -> io::Result { #[test] fn test_sizes() { use c::c_int; - use core::mem::size_of; // Backend code needs to cast these to `c_int` so make sure that cast // isn't lossy. - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(Timeout, c_int); } diff --git a/vendor/rustix/src/net/types.rs b/vendor/rustix/src/net/types.rs index 95fa931a1..a2c019b42 100644 --- a/vendor/rustix/src/net/types.rs +++ b/vendor/rustix/src/net/types.rs @@ -23,13 +23,15 @@ impl SocketType { pub const DGRAM: Self = Self(c::SOCK_DGRAM as _); /// `SOCK_SEQPACKET` + #[cfg(not(target_os = "espidf"))] pub const SEQPACKET: Self = Self(c::SOCK_SEQPACKET as _); /// `SOCK_RAW` + #[cfg(not(target_os = "espidf"))] pub const RAW: Self = Self(c::SOCK_RAW as _); /// `SOCK_RDM` - #[cfg(not(target_os = "haiku"))] + #[cfg(not(any(target_os = "espidf", target_os = "haiku")))] pub const RDM: Self = Self(c::SOCK_RDM as _); /// Constructs a `SocketType` from a raw integer. @@ -83,7 +85,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const NETLINK: Self = Self(c::AF_NETLINK as _); /// `AF_UNIX`, aka `AF_LOCAL` @@ -94,19 +98,25 @@ impl AddressFamily { bsd, solarish, windows, + 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"))] pub const IPX: Self = Self(c::AF_IPX as _); /// `AF_APPLETALK` + #[cfg(not(target_os = "espidf"))] pub const APPLETALK: Self = Self(c::AF_APPLETALK as _); /// `AF_NETROM` #[cfg(not(any( bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const NETROM: Self = Self(c::AF_NETROM as _); /// `AF_BRIDGE` @@ -114,7 +124,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const BRIDGE: Self = Self(c::AF_BRIDGE as _); /// `AF_ATMPVC` @@ -122,14 +134,18 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const ATMPVC: Self = Self(c::AF_ATMPVC as _); /// `AF_X25` #[cfg(not(any( bsd, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const X25: Self = Self(c::AF_X25 as _); /// `AF_ROSE` @@ -137,18 +153,22 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const ROSE: Self = Self(c::AF_ROSE as _); /// `AF_DECnet` - #[cfg(not(target_os = "haiku"))] + #[cfg(not(any(target_os = "espidf", target_os = "haiku")))] pub const DECnet: Self = Self(c::AF_DECnet as _); /// `AF_NETBEUI` #[cfg(not(any( bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const NETBEUI: Self = Self(c::AF_NETBEUI as _); /// `AF_SECURITY` @@ -156,14 +176,18 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const SECURITY: Self = Self(c::AF_SECURITY as _); /// `AF_KEY` #[cfg(not(any( bsd, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const KEY: Self = Self(c::AF_KEY as _); /// `AF_PACKET` @@ -175,7 +199,9 @@ impl AddressFamily { #[cfg(not(any( bsd, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const PACKET: Self = Self(c::AF_PACKET as _); /// `AF_ASH` @@ -183,7 +209,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const ASH: Self = Self(c::AF_ASH as _); /// `AF_ECONET` @@ -191,7 +219,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const ECONET: Self = Self(c::AF_ECONET as _); /// `AF_ATMSVC` @@ -199,7 +229,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const ATMSVC: Self = Self(c::AF_ATMSVC as _); /// `AF_RDS` @@ -207,17 +239,21 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const RDS: Self = Self(c::AF_RDS as _); /// `AF_SNA` - #[cfg(not(target_os = "haiku"))] + #[cfg(not(any(target_os = "espidf", target_os = "haiku")))] pub const SNA: Self = Self(c::AF_SNA as _); /// `AF_IRDA` #[cfg(not(any( bsd, solarish, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const IRDA: Self = Self(c::AF_IRDA as _); /// `AF_PPPOX` @@ -225,7 +261,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const PPPOX: Self = Self(c::AF_PPPOX as _); /// `AF_WANPIPE` @@ -233,7 +271,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const WANPIPE: Self = Self(c::AF_WANPIPE as _); /// `AF_LLC` @@ -241,7 +281,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const LLC: Self = Self(c::AF_LLC as _); /// `AF_CAN` @@ -249,7 +291,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const CAN: Self = Self(c::AF_CAN as _); /// `AF_TIPC` @@ -257,18 +301,22 @@ impl AddressFamily { bsd, solarish, windows, + 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)))] + #[cfg(not(any(apple, solarish, windows, target_os = "espidf")))] pub const BLUETOOTH: Self = Self(c::AF_BLUETOOTH as _); /// `AF_IUCV` #[cfg(not(any( bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const IUCV: Self = Self(c::AF_IUCV as _); /// `AF_RXRPC` @@ -276,18 +324,22 @@ impl AddressFamily { bsd, solarish, windows, + 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 = "haiku")))] + #[cfg(not(any(solarish, windows, 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 = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const PHONET: Self = Self(c::AF_PHONET as _); /// `AF_IEEE802154` @@ -295,7 +347,9 @@ impl AddressFamily { bsd, solarish, windows, + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const IEEE802154: Self = Self(c::AF_IEEE802154 as _); /// `AF_802` @@ -508,28 +562,28 @@ pub mod ipproto { pub const ICMP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ICMP as _) }); /// `IPPROTO_IGMP` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const IGMP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IGMP as _) }); /// `IPPROTO_IPIP` - #[cfg(not(any(solarish, windows, target_os = "haiku")))] + #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] pub const IPIP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IPIP as _) }); /// `IPPROTO_TCP` pub const TCP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_TCP as _) }); /// `IPPROTO_EGP` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const EGP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_EGP as _) }); /// `IPPROTO_PUP` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const PUP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_PUP as _) }); /// `IPPROTO_UDP` pub const UDP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_UDP as _) }); /// `IPPROTO_IDP` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const IDP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IDP as _) }); /// `IPPROTO_TP` - #[cfg(not(any(solarish, windows, target_os = "haiku")))] + #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] pub const TP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_TP as _) }); /// `IPPROTO_DCCP` #[cfg(not(any( @@ -537,7 +591,9 @@ pub mod ipproto { solarish, windows, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", + target_os = "nto", target_os = "openbsd", )))] pub const DCCP: Protocol = @@ -546,40 +602,62 @@ pub mod ipproto { pub const IPV6: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_IPV6 as _) }); /// `IPPROTO_RSVP` - #[cfg(not(any(solarish, windows, target_os = "haiku")))] + #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] pub const RSVP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_RSVP as _) }); /// `IPPROTO_GRE` - #[cfg(not(any(solarish, windows, target_os = "haiku")))] + #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] pub const GRE: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_GRE as _) }); /// `IPPROTO_ESP` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const ESP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ESP as _) }); /// `IPPROTO_AH` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const AH: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_AH as _) }); /// `IPPROTO_MTP` - #[cfg(not(any(solarish, netbsdlike, windows, target_os = "haiku")))] + #[cfg(not(any( + solarish, + netbsdlike, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "nto", + )))] pub const MTP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_MTP as _) }); /// `IPPROTO_BEETPH` - #[cfg(not(any(bsd, solarish, windows, target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "nto" + )))] pub const BEETPH: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_BEETPH as _) }); /// `IPPROTO_ENCAP` - #[cfg(not(any(solarish, windows, target_os = "haiku")))] + #[cfg(not(any(solarish, windows, target_os = "espidf", target_os = "haiku")))] pub const ENCAP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ENCAP as _) }); /// `IPPROTO_PIM` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const PIM: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_PIM as _) }); /// `IPPROTO_COMP` - #[cfg(not(any(bsd, solarish, windows, target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + windows, + target_os = "espidf", + target_os = "haiku", + target_os = "nto" + )))] pub const COMP: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_COMP as _) }); /// `IPPROTO_SCTP` #[cfg(not(any( solarish, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", target_os = "openbsd" )))] @@ -592,7 +670,9 @@ pub mod ipproto { solarish, windows, 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 _) }); @@ -602,8 +682,10 @@ pub mod ipproto { solarish, windows, 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 _) }); @@ -612,6 +694,7 @@ pub mod ipproto { pub const ETHERNET: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ETHERNET as _) }); /// `IPPROTO_RAW` + #[cfg(not(target_os = "espidf"))] pub const RAW: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_RAW as _) }); /// `IPPROTO_MPTCP` #[cfg(not(any( @@ -619,13 +702,15 @@ pub mod ipproto { solarish, windows, 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 _) }); /// `IPPROTO_FRAGMENT` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const FRAGMENT: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_FRAGMENT as _) }); /// `IPPROTO_ICMPV6` @@ -638,11 +723,13 @@ pub mod ipproto { solarish, windows, target_os = "dragonfly", + target_os = "espidf", target_os = "haiku", + target_os = "nto", )))] pub const MH: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_MH as _) }); /// `IPPROTO_ROUTING` - #[cfg(not(any(solarish, target_os = "haiku")))] + #[cfg(not(any(solarish, target_os = "espidf", target_os = "haiku")))] pub const ROUTING: Protocol = Protocol(unsafe { RawProtocol::new_unchecked(c::IPPROTO_ROUTING as _) }); } @@ -1274,7 +1361,7 @@ bitflags! { #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct SocketFlags: c::c_uint { /// `SOCK_NONBLOCK` - #[cfg(not(any(apple, windows, target_os = "haiku")))] + #[cfg(not(any(apple, windows, target_os = "espidf", target_os = "haiku", target_os = "nto")))] const NONBLOCK = bitcast!(c::SOCK_NONBLOCK); /// `SOCK_CLOEXEC` @@ -1286,14 +1373,25 @@ bitflags! { #[test] fn test_sizes() { use c::c_int; - use core::mem::size_of; + use core::mem::transmute; // Backend code needs to cast these to `c_int` so make sure that cast // isn't lossy. - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::>(), size_of::()); - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(RawProtocol, c_int); + assert_eq_size!(Protocol, c_int); + assert_eq_size!(Option, c_int); + assert_eq_size!(Option, c_int); + assert_eq_size!(RawSocketType, c_int); + assert_eq_size!(SocketType, c_int); + assert_eq_size!(SocketFlags, c_int); + + // Rustix doesn't depend on `Option` matching the ABI of + // a raw integer for correctness, but it should work nonetheless. + unsafe { + let t: Option = None; + assert_eq!(0_u32, transmute(t)); + + let t: Option = Some(Protocol::from_raw(RawProtocol::new(4567).unwrap())); + assert_eq!(4567_u32, transmute(t)); + } } diff --git a/vendor/rustix/src/pid.rs b/vendor/rustix/src/pid.rs index bebc1f00c..1b1da6521 100644 --- a/vendor/rustix/src/pid.rs +++ b/vendor/rustix/src/pid.rs @@ -86,8 +86,18 @@ impl Pid { #[test] fn test_sizes() { - use core::mem::size_of; + use core::mem::transmute; - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(RawPid, NonZeroI32); + assert_eq_size!(RawPid, Pid); + assert_eq_size!(RawPid, Option); + + // Rustix doesn't depend on `Option` matching the ABI of a raw integer + // for correctness, but it should work nonetheless. + const_assert_eq!(0 as RawPid, unsafe { + transmute::, RawPid>(None) + }); + const_assert_eq!(4567 as RawPid, unsafe { + transmute::, RawPid>(Some(Pid::from_raw_unchecked(4567))) + }); } diff --git a/vendor/rustix/src/pipe.rs b/vendor/rustix/src/pipe.rs index a4c300abd..1817401c2 100644 --- a/vendor/rustix/src/pipe.rs +++ b/vendor/rustix/src/pipe.rs @@ -11,6 +11,7 @@ use crate::{backend, io}; #[cfg(not(any( solarish, windows, + target_os = "espidf", target_os = "haiku", target_os = "redox", target_os = "wasi", @@ -36,6 +37,7 @@ pub use backend::pipe::types::{IoSliceRaw, SpliceFlags}; #[cfg(not(any( solarish, windows, + target_os = "espidf", target_os = "haiku", target_os = "redox", target_os = "wasi", @@ -91,7 +93,13 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { /// [OpenBSD]: https://man.openbsd.org/pipe2.2 /// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pipe2§ion=2 /// [illumos]: https://illumos.org/man/2/pipe2 -#[cfg(not(any(apple, target_os = "aix", target_os = "haiku")))] +#[cfg(not(any( + apple, + target_os = "aix", + target_os = "espidf", + target_os = "haiku", + target_os = "nto" +)))] #[inline] #[doc(alias = "pipe2")] pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> { diff --git a/vendor/rustix/src/process/exit.rs b/vendor/rustix/src/process/exit.rs index 2bbbcf538..5533dbabb 100644 --- a/vendor/rustix/src/process/exit.rs +++ b/vendor/rustix/src/process/exit.rs @@ -32,5 +32,5 @@ 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(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub const EXIT_SIGNALED_SIGABRT: i32 = backend::process::types::EXIT_SIGNALED_SIGABRT; diff --git a/vendor/rustix/src/process/ioctl.rs b/vendor/rustix/src/process/ioctl.rs index 46dbbc59b..cde6b5b3c 100644 --- a/vendor/rustix/src/process/ioctl.rs +++ b/vendor/rustix/src/process/ioctl.rs @@ -13,7 +13,7 @@ use backend::fd::AsFd; /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4 /// [NetBSD]: https://man.netbsd.org/tty.4 /// [OpenBSD]: https://man.openbsd.org/tty.4 -#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "aix", target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCSCTTY")] pub fn ioctl_tiocsctty(fd: Fd) -> io::Result<()> { diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs index 7a189b013..9c62f127e 100644 --- a/vendor/rustix/src/process/mod.rs +++ b/vendor/rustix/src/process/mod.rs @@ -7,8 +7,9 @@ mod chroot; mod exit; #[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id. mod id; +#[cfg(not(target_os = "espidf"))] mod ioctl; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] mod kill; #[cfg(linux_kernel)] mod membarrier; @@ -22,14 +23,19 @@ mod prctl; mod priority; #[cfg(freebsdlike)] mod procctl; -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] mod rlimit; #[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))] mod sched; mod sched_yield; #[cfg(not(target_os = "wasi"))] // WASI doesn't have umask. mod umask; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] mod wait; #[cfg(not(target_os = "wasi"))] @@ -39,8 +45,9 @@ pub use chroot::*; pub use exit::*; #[cfg(not(target_os = "wasi"))] pub use id::*; +#[cfg(not(target_os = "espidf"))] pub use ioctl::*; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub use kill::*; #[cfg(linux_kernel)] pub use membarrier::*; @@ -54,12 +61,17 @@ pub use prctl::*; pub use priority::*; #[cfg(freebsdlike)] pub use procctl::*; -#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "espidf", + target_os = "fuchsia", + target_os = "redox", + target_os = "wasi" +)))] pub use rlimit::*; #[cfg(any(linux_kernel, target_os = "dragonfly", target_os = "fuchsia"))] pub use sched::*; pub use sched_yield::sched_yield; #[cfg(not(target_os = "wasi"))] pub use umask::*; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub use wait::*; diff --git a/vendor/rustix/src/process/priority.rs b/vendor/rustix/src/process/priority.rs index 604614ef0..7c2928408 100644 --- a/vendor/rustix/src/process/priority.rs +++ b/vendor/rustix/src/process/priority.rs @@ -1,3 +1,4 @@ +#[cfg(not(target_os = "espidf"))] use crate::process::{Pid, Uid}; use crate::{backend, io}; @@ -25,6 +26,7 @@ pub fn nice(inc: i32) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html /// [Linux]: https://man7.org/linux/man-pages/man2/getpriority.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "getpriority")] pub fn getpriority_user(uid: Uid) -> io::Result { @@ -44,6 +46,7 @@ pub fn getpriority_user(uid: Uid) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html /// [Linux]: https://man7.org/linux/man-pages/man2/getpriority.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "getpriority")] pub fn getpriority_pgrp(pgid: Option) -> io::Result { @@ -63,6 +66,7 @@ pub fn getpriority_pgrp(pgid: Option) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpriority.html /// [Linux]: https://man7.org/linux/man-pages/man2/getpriority.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "getpriority")] pub fn getpriority_process(pid: Option) -> io::Result { @@ -80,6 +84,7 @@ pub fn getpriority_process(pid: Option) -> io::Result { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html /// [Linux]: https://man7.org/linux/man-pages/man2/setpriority.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "setpriority")] pub fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> { @@ -99,6 +104,7 @@ pub fn setpriority_user(uid: Uid, priority: i32) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html /// [Linux]: https://man7.org/linux/man-pages/man2/setpriority.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "setpriority")] pub fn setpriority_pgrp(pgid: Option, priority: i32) -> io::Result<()> { @@ -118,6 +124,7 @@ pub fn setpriority_pgrp(pgid: Option, priority: i32) -> io::Result<()> { /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html /// [Linux]: https://man7.org/linux/man-pages/man2/setpriority.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setpriority.2.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "setpriority")] pub fn setpriority_process(pid: Option, priority: i32) -> io::Result<()> { diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs index d46c96005..72b37d6d4 100644 --- a/vendor/rustix/src/process/wait.rs +++ b/vendor/rustix/src/process/wait.rs @@ -25,7 +25,7 @@ bitflags! { } } -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any(target_os = "openbsd", target_os = "redox", target_os = "wasi")))] bitflags! { /// Options for modifying the behavior of waitid #[repr(transparent)] @@ -124,10 +124,10 @@ impl WaitStatus { /// The status of a process after calling [`waitid`]. #[derive(Clone, Copy)] #[repr(transparent)] -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any(target_os = "openbsd", target_os = "redox", target_os = "wasi")))] pub struct WaitidStatus(pub(crate) backend::c::siginfo_t); -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any(target_os = "openbsd", target_os = "redox", target_os = "wasi")))] impl WaitidStatus { /// Returns whether the process is currently stopped. #[inline] @@ -243,7 +243,7 @@ impl WaitidStatus { } /// The identifier to wait on in a call to [`waitid`]. -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any(target_os = "openbsd", target_os = "redox", target_os = "wasi")))] #[derive(Debug, Clone)] #[non_exhaustive] pub enum WaitId<'a> { @@ -317,7 +317,7 @@ pub fn wait(waitopts: WaitOptions) -> io::Result> { /// `waitid(_, _, _, opts)`—Wait for the specified child process to change /// state. -#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +#[cfg(not(any(target_os = "openbsd", target_os = "redox", target_os = "wasi")))] #[inline] pub fn waitid<'a>( id: impl Into>, diff --git a/vendor/rustix/src/procfs.rs b/vendor/rustix/src/procfs.rs index e04793977..010b93126 100644 --- a/vendor/rustix/src/procfs.rs +++ b/vendor/rustix/src/procfs.rs @@ -178,7 +178,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 { + if f_type != PROC_SUPER_MAGIC.into() { return Err(io::Errno::NOTSUP); } diff --git a/vendor/rustix/src/pty.rs b/vendor/rustix/src/pty.rs index d7d250250..5040ca2c1 100644 --- a/vendor/rustix/src/pty.rs +++ b/vendor/rustix/src/pty.rs @@ -23,7 +23,7 @@ bitflags::bitflags! { const RDWR = c::O_RDWR as c::c_uint; /// `O_NOCTTY` - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "espidf", target_os = "l4re", target_os = "redox")))] const NOCTTY = c::O_NOCTTY as c::c_uint; /// `O_CLOEXEC` diff --git a/vendor/rustix/src/signal.rs b/vendor/rustix/src/signal.rs index e1723c990..43236f335 100644 --- a/vendor/rustix/src/signal.rs +++ b/vendor/rustix/src/signal.rs @@ -48,11 +48,14 @@ pub enum Signal { solarish, target_os = "aix", target_os = "haiku", + target_os = "nto", all( linux_kernel, any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ), @@ -106,7 +109,9 @@ pub enum Signal { linux_kernel, any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ) @@ -149,11 +154,14 @@ impl Signal { solarish, target_os = "aix", target_os = "haiku", + target_os = "nto", all( linux_kernel, any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ), @@ -186,7 +194,9 @@ impl Signal { linux_kernel, any( target_arch = "mips", + target_arch = "mips32r6", target_arch = "mips64", + target_arch = "mips64r6", target_arch = "sparc", target_arch = "sparc64" ) @@ -206,7 +216,5 @@ impl Signal { #[test] fn test_sizes() { - use core::mem::size_of; - - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(Signal, c::c_int); } diff --git a/vendor/rustix/src/static_assertions.rs b/vendor/rustix/src/static_assertions.rs new file mode 100644 index 000000000..81824cb1c --- /dev/null +++ b/vendor/rustix/src/static_assertions.rs @@ -0,0 +1,37 @@ +//! Workarounds for Rust 1.63 where some things in the `static_assertions` +//! crate do things that don't work in const contexts. We want to call them +//! in const contexts in Rust versions where that's supported so that +//! problems are caught at compile time, and fall back to dynamic asserts +//! in Rust 1.63. + +#![allow(unused_macros)] + +macro_rules! assert_eq_size { + ($x:ty, $y:ty) => { + assert_eq!(core::mem::size_of::<$x>(), core::mem::size_of::<$y>()); + }; +} + +macro_rules! assert_eq_align { + ($x:ty, $y:ty) => { + assert_eq!(core::mem::align_of::<$x>(), core::mem::align_of::<$y>()); + }; +} + +macro_rules! const_assert_eq { + ($x:expr, $y:expr) => { + assert_eq!($x, $y); + }; +} + +macro_rules! const_assert_ne { + ($x:expr, $y:expr) => { + assert_ne!($x, $y); + }; +} + +macro_rules! const_assert { + ($x:expr) => { + assert!($x); + }; +} diff --git a/vendor/rustix/src/system.rs b/vendor/rustix/src/system.rs index 1f04c6b20..9346f5560 100644 --- a/vendor/rustix/src/system.rs +++ b/vendor/rustix/src/system.rs @@ -8,7 +8,7 @@ use crate::backend; use crate::ffi::CStr; -#[cfg(not(target_os = "emscripten"))] +#[cfg(not(any(target_os = "espidf", target_os = "emscripten")))] use crate::io; use core::fmt; @@ -21,9 +21,23 @@ pub use backend::system::types::Sysinfo; /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [NetBSD] +/// - [FreeBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html /// [Linux]: https://man7.org/linux/man-pages/man2/uname.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/uname.3.html +/// [NetBSD]: https://man.netbsd.org/uname.3 +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=uname&sektion=3 +/// [OpenBSD]: https://man.openbsd.org/uname.3 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=uname§ion=3 +/// [illumos]: https://illumos.org/man/2/uname +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Platform-Type.html #[inline] pub fn uname() -> Uname { Uname(backend::system::syscalls::uname()) @@ -130,7 +144,12 @@ pub fn sysinfo() -> Sysinfo { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man2/sethostname.2.html -#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any( + target_os = "emscripten", + target_os = "espidf", + target_os = "redox", + target_os = "wasi" +)))] #[inline] pub fn sethostname(name: &[u8]) -> io::Result<()> { backend::system::syscalls::sethostname(name) diff --git a/vendor/rustix/src/termios/ioctl.rs b/vendor/rustix/src/termios/ioctl.rs index 2e8a28ed6..1c60cb9a4 100644 --- a/vendor/rustix/src/termios/ioctl.rs +++ b/vendor/rustix/src/termios/ioctl.rs @@ -15,7 +15,7 @@ use crate::{backend, io}; /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4 /// [NetBSD]: https://man.netbsd.org/tty.4 /// [OpenBSD]: https://man.openbsd.org/tty.4 -#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCEXCL")] pub fn ioctl_tiocexcl(fd: Fd) -> io::Result<()> { @@ -34,7 +34,7 @@ pub fn ioctl_tiocexcl(fd: Fd) -> io::Result<()> { /// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4 /// [NetBSD]: https://man.netbsd.org/tty.4 /// [OpenBSD]: https://man.openbsd.org/tty.4 -#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCNXCL")] pub fn ioctl_tiocnxcl(fd: Fd) -> io::Result<()> { diff --git a/vendor/rustix/src/termios/mod.rs b/vendor/rustix/src/termios/mod.rs index 28abc0488..c61d3f12a 100644 --- a/vendor/rustix/src/termios/mod.rs +++ b/vendor/rustix/src/termios/mod.rs @@ -8,20 +8,20 @@ //! [`Termios::set_input_speed`], and it will simply fail if the speed is not //! supported by the platform. -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "wasi")))] mod ioctl; #[cfg(not(target_os = "wasi"))] mod tc; #[cfg(not(windows))] mod tty; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] mod types; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "haiku", target_os = "wasi")))] pub use ioctl::*; #[cfg(not(target_os = "wasi"))] pub use tc::*; #[cfg(not(windows))] pub use tty::*; -#[cfg(not(target_os = "wasi"))] +#[cfg(not(any(target_os = "espidf", target_os = "wasi")))] pub use types::*; diff --git a/vendor/rustix/src/termios/tc.rs b/vendor/rustix/src/termios/tc.rs index 9deb7798c..cd5902c1a 100644 --- a/vendor/rustix/src/termios/tc.rs +++ b/vendor/rustix/src/termios/tc.rs @@ -1,5 +1,6 @@ use crate::fd::AsFd; use crate::pid::Pid; +#[cfg(not(target_os = "espidf"))] use crate::termios::{Action, OptionalActions, QueueSelector, Termios, Winsize}; use crate::{backend, io}; @@ -15,7 +16,7 @@ use crate::{backend, io}; /// [POSIX `tcgetattr`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcgetattr.html /// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html /// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html -#[cfg(not(any(windows, target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))] #[inline] #[doc(alias = "TCGETS")] #[doc(alias = "TCGETS2")] @@ -32,7 +33,7 @@ pub fn tcgetattr(fd: Fd) -> io::Result { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html -#[cfg(not(any(windows, target_os = "wasi")))] +#[cfg(not(any(windows, target_os = "espidf", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCGWINSZ")] pub fn tcgetwinsize(fd: Fd) -> io::Result { @@ -85,6 +86,7 @@ pub fn tcsetpgrp(fd: Fd, pid: Pid) -> io::Result<()> { /// [POSIX `tcsetattr`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcsetattr.html /// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html /// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "TCSETS")] #[doc(alias = "TCSETS2")] @@ -129,6 +131,7 @@ pub fn tcsendbreak(fd: Fd) -> io::Result<()> { /// [POSIX `tcsetattr`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcdrain.html /// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html /// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html +#[cfg(not(target_os = "espidf"))] #[inline] pub fn tcdrain(fd: Fd) -> io::Result<()> { backend::termios::syscalls::tcdrain(fd.as_fd()) @@ -145,6 +148,7 @@ pub fn tcdrain(fd: Fd) -> io::Result<()> { /// [POSIX `tcflush`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcflush.html /// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html /// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "TCFLSH")] pub fn tcflush(fd: Fd, queue_selector: QueueSelector) -> io::Result<()> { @@ -161,6 +165,7 @@ pub fn tcflush(fd: Fd, queue_selector: QueueSelector) -> io::Result<() /// [POSIX `tcflow`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/tcflow.html /// [Linux `ioctl_tty`]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html /// [Linux `termios`]: https://man7.org/linux/man-pages/man3/termios.3.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "TCXONC")] pub fn tcflow(fd: Fd, action: Action) -> io::Result<()> { @@ -190,6 +195,7 @@ pub fn tcgetsid(fd: Fd) -> io::Result { /// - [Linux] /// /// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html +#[cfg(not(target_os = "espidf"))] #[inline] #[doc(alias = "TIOCSWINSZ")] pub fn tcsetwinsize(fd: Fd, winsize: Winsize) -> io::Result<()> { diff --git a/vendor/rustix/src/termios/types.rs b/vendor/rustix/src/termios/types.rs index d978bfcca..8b7d473cf 100644 --- a/vendor/rustix/src/termios/types.rs +++ b/vendor/rustix/src/termios/types.rs @@ -31,16 +31,20 @@ pub struct Termios { #[cfg(any( linux_like, target_env = "newlib", - target_os = "haiku", target_os = "fuchsia", + target_os = "haiku", target_os = "redox" ))] pub line_discipline: c::cc_t, /// How are various special control codes handled? #[doc(alias = "c_cc")] + #[cfg(not(target_os = "haiku"))] pub special_codes: SpecialCodes, + #[cfg(target_os = "nto")] + pub(crate) __reserved: [c::c_uint; 3], + /// Line discipline. // On PowerPC, this field comes after `c_cc`. #[doc(alias = "c_line")] @@ -51,20 +55,28 @@ pub struct Termios { /// /// On Linux and BSDs, this is the arbitrary integer speed value. On all /// other platforms, this is the encoded speed value. + #[cfg(not(any(solarish, all(libc, target_env = "newlib"), target_os = "aix")))] pub(crate) input_speed: c::speed_t, /// See the `output_speed` and `set_output_seed` functions. /// /// On Linux and BSDs, this is the integer speed value. On all other /// platforms, this is the encoded speed value. + #[cfg(not(any(solarish, all(libc, target_env = "newlib"), target_os = "aix")))] pub(crate) output_speed: c::speed_t, + + /// How are various special control codes handled? + #[doc(alias = "c_cc")] + #[cfg(target_os = "haiku")] + pub special_codes: SpecialCodes, } impl Termios { - /// `cfmakeraw(self)`—Set a `Termios` value to the settings for "raw" mode. + /// `cfmakeraw(self)`—Set a `Termios` value to the settings for “raw” mode. /// /// In raw mode, input is available a byte at a time, echoing is disabled, /// and special terminal input and output codes are disabled. + #[cfg(not(target_os = "nto"))] #[doc(alias = "cfmakeraw")] #[inline] pub fn make_raw(&mut self) { @@ -88,8 +100,20 @@ impl Termios { self.input_speed as u32 } + // On illumos, `input_speed` is not present. + #[cfg(any(solarish, all(libc, target_env = "newlib"), target_os = "aix"))] + unsafe { + speed::decode(c::cfgetispeed(crate::utils::as_ptr(self).cast())).unwrap() + } + // On other platforms, it's the encoded speed. - #[cfg(not(any(linux_kernel, bsd)))] + #[cfg(not(any( + linux_kernel, + bsd, + solarish, + all(libc, target_env = "newlib"), + target_os = "aix" + )))] { speed::decode(self.input_speed).unwrap() } @@ -109,8 +133,20 @@ impl Termios { self.output_speed as u32 } + // On illumos, `output_speed` is not present. + #[cfg(any(solarish, all(libc, target_env = "newlib"), target_os = "aix"))] + unsafe { + speed::decode(c::cfgetospeed(crate::utils::as_ptr(self).cast())).unwrap() + } + // On other platforms, it's the encoded speed. - #[cfg(not(any(linux_kernel, bsd)))] + #[cfg(not(any( + linux_kernel, + bsd, + solarish, + all(libc, target_env = "newlib"), + target_os = "aix" + )))] { speed::decode(self.output_speed).unwrap() } @@ -123,6 +159,7 @@ impl Termios { /// encoded constant value. Not all implementations support all integer /// values; use the constants in the [`speed`] module for likely-supported /// speeds. + #[cfg(not(target_os = "nto"))] #[doc(alias = "cfsetspeed")] #[doc(alias = "CBAUD")] #[doc(alias = "CBAUDEX")] @@ -180,8 +217,8 @@ impl core::fmt::Debug for Termios { #[cfg(any( linux_like, target_env = "newlib", - target_os = "haiku", target_os = "fuchsia", + target_os = "haiku", target_os = "redox" ))] { @@ -227,7 +264,7 @@ bitflags! { const ICRNL = c::ICRNL; /// `IUCLC` - #[cfg(any(linux_kernel, solarish, target_os = "haiku"))] + #[cfg(any(linux_kernel, solarish, target_os = "aix", target_os = "haiku", target_os = "nto"))] const IUCLC = c::IUCLC; /// `IXON` @@ -246,14 +283,12 @@ bitflags! { /// `IUTF8` #[cfg(not(any( + freebsdlike, + netbsdlike, solarish, target_os = "aix", - target_os = "dragonfly", target_os = "emscripten", - target_os = "freebsd", target_os = "haiku", - target_os = "netbsd", - target_os = "openbsd", target_os = "redox", )))] const IUTF8 = c::IUTF8; @@ -271,9 +306,8 @@ bitflags! { /// `OLCUC` #[cfg(not(any( apple, + freebsdlike, target_os = "aix", - target_os = "dragonfly", - target_os = "freebsd", target_os = "netbsd", target_os = "redox", )))] @@ -516,7 +550,7 @@ bitflags! { const CLOCAL = c::CLOCAL; /// `CRTSCTS` - #[cfg(not(any(target_os = "aix", target_os = "redox")))] + #[cfg(not(any(target_os = "aix", target_os = "nto", target_os = "redox")))] const CRTSCTS = c::CRTSCTS; /// `CMSPAR` @@ -526,6 +560,7 @@ bitflags! { target_os = "aix", target_os = "emscripten", target_os = "haiku", + target_os = "nto", target_os = "redox", )))] const CMSPAR = c::CMSPAR; @@ -533,7 +568,7 @@ bitflags! { } bitflags! { - /// Flags controlling "local" terminal modes. + /// Flags controlling “local” terminal modes. #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct LocalModes: c::tcflag_t { @@ -546,7 +581,7 @@ bitflags! { const ECHOCTL = c::ECHOCTL; /// `ECHOPRT` - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "nto", target_os = "redox")))] const ECHOPRT = c::ECHOPRT; /// `ECHOKE` @@ -554,15 +589,15 @@ bitflags! { const ECHOKE = c::ECHOKE; /// `FLUSHO` - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "nto", target_os = "redox")))] const FLUSHO = c::FLUSHO; /// `PENDIN` - #[cfg(not(target_os = "redox"))] + #[cfg(not(any(target_os = "nto", target_os = "redox")))] const PENDIN = c::PENDIN; /// `EXTPROC` - #[cfg(not(any(target_os = "aix", target_os = "haiku", target_os = "redox")))] + #[cfg(not(any(target_os = "aix", target_os = "haiku", target_os = "nto", target_os = "redox")))] const EXTPROC = c::EXTPROC; /// `ISIG` @@ -760,7 +795,7 @@ pub mod speed { /// Translate from a `c::speed_t` code to an arbitrary integer speed value /// `u32`. #[cfg(not(any(linux_kernel, bsd)))] - pub(crate) fn decode(encoded_speed: c::speed_t) -> Option { + pub(crate) const fn decode(encoded_speed: c::speed_t) -> Option { match encoded_speed { c::B0 => Some(0), c::B50 => Some(50), @@ -782,35 +817,73 @@ pub mod speed { c::B57600 => Some(57600), #[cfg(not(target_os = "aix"))] c::B115200 => Some(115_200), - #[cfg(not(target_os = "aix"))] + #[cfg(not(any(target_os = "aix", target_os = "nto")))] c::B230400 => Some(230_400), #[cfg(not(any( apple, target_os = "aix", target_os = "dragonfly", target_os = "haiku", + target_os = "nto", target_os = "openbsd" )))] c::B460800 => Some(460_800), - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] c::B500000 => Some(500_000), - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] c::B576000 => Some(576_000), #[cfg(not(any( apple, target_os = "aix", target_os = "dragonfly", target_os = "haiku", + target_os = "nto", target_os = "openbsd" )))] c::B921600 => Some(921_600), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] c::B1000000 => Some(1_000_000), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] c::B1152000 => Some(1_152_000), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] c::B1500000 => Some(1_500_000), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] c::B2000000 => Some(2_000_000), #[cfg(not(any( target_arch = "sparc", @@ -818,6 +891,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] c::B2500000 => Some(2_500_000), @@ -827,6 +901,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] c::B3000000 => Some(3_000_000), @@ -836,6 +911,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] c::B3500000 => Some(3_500_000), @@ -845,6 +921,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] c::B4000000 => Some(4_000_000), @@ -855,7 +932,7 @@ pub mod speed { /// Translate from an arbitrary `u32` arbitrary integer speed value to a /// `c::speed_t` code. #[cfg(not(bsd))] - pub(crate) fn encode(speed: u32) -> Option { + pub(crate) const fn encode(speed: u32) -> Option { match speed { 0 => Some(c::B0), 50 => Some(c::B50), @@ -877,35 +954,73 @@ pub mod speed { 57600 => Some(c::B57600), #[cfg(not(target_os = "aix"))] 115_200 => Some(c::B115200), - #[cfg(not(target_os = "aix"))] + #[cfg(not(any(target_os = "aix", target_os = "nto")))] 230_400 => Some(c::B230400), #[cfg(not(any( apple, target_os = "aix", target_os = "dragonfly", target_os = "haiku", - target_os = "openbsd" + target_os = "nto", + target_os = "openbsd", )))] 460_800 => Some(c::B460800), - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] 500_000 => Some(c::B500000), - #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))] + #[cfg(not(any( + bsd, + solarish, + target_os = "aix", + target_os = "haiku", + target_os = "nto" + )))] 576_000 => Some(c::B576000), #[cfg(not(any( apple, target_os = "aix", target_os = "dragonfly", target_os = "haiku", + target_os = "nto", target_os = "openbsd" )))] 921_600 => Some(c::B921600), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] 1_000_000 => Some(c::B1000000), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] 1_152_000 => Some(c::B1152000), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] 1_500_000 => Some(c::B1500000), - #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))] + #[cfg(not(any( + bsd, + target_os = "aix", + target_os = "haiku", + target_os = "nto", + target_os = "solaris" + )))] 2_000_000 => Some(c::B2000000), #[cfg(not(any( target_arch = "sparc", @@ -913,6 +1028,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] 2_500_000 => Some(c::B2500000), @@ -922,6 +1038,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] 3_000_000 => Some(c::B3000000), @@ -931,6 +1048,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] 3_500_000 => Some(c::B3500000), @@ -940,6 +1058,7 @@ pub mod speed { bsd, target_os = "aix", target_os = "haiku", + target_os = "nto", target_os = "solaris", )))] 4_000_000 => Some(c::B4000000), @@ -996,14 +1115,11 @@ impl SpecialCodeIndex { /// `VSWTC` #[cfg(not(any( - apple, + bsd, solarish, target_os = "aix", - target_os = "dragonfly", - target_os = "freebsd", target_os = "haiku", - target_os = "netbsd", - target_os = "openbsd", + target_os = "nto", )))] pub const VSWTC: Self = Self(c::VSWTC as usize); @@ -1138,31 +1254,51 @@ fn termios_layouts() { // On everything except PowerPC, `termios` matches `termios2` except for // the addition of `c_ispeed` and `c_ospeed`. #[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))] - assert_eq!( + const_assert_eq!( memoffset::offset_of!(Termios, input_speed), core::mem::size_of::() ); // On PowerPC, `termios2` is `termios`. #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] - assert_eq!( - core::mem::size_of::(), - core::mem::size_of::() - ); + assert_eq_size!(c::termios2, c::termios); } #[cfg(not(linux_raw))] { + // On Mips, Sparc, and Android, the libc lacks the ospeed and ispeed + // fields. + #[cfg(all( + not(all( + target_env = "gnu", + any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6", + target_arch = "sparc", + target_arch = "sparc64" + ) + )), + not(all(libc, target_os = "android")) + ))] + check_renamed_type!(Termios, termios); #[cfg(not(all( - target_env = "gnu", - any( - target_arch = "sparc", - target_arch = "sparc64", - target_arch = "mips", - target_arch = "mips64" - ) + not(all( + target_env = "gnu", + any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6", + target_arch = "sparc", + target_arch = "sparc64" + ) + )), + not(all(libc, target_os = "android")) )))] - check_renamed_type!(Termios, termios); + const_assert!(core::mem::size_of::() >= core::mem::size_of::()); + check_renamed_struct_renamed_field!(Termios, termios, input_modes, c_iflag); check_renamed_struct_renamed_field!(Termios, termios, output_modes, c_oflag); check_renamed_struct_renamed_field!(Termios, termios, control_modes, c_cflag); @@ -1170,8 +1306,8 @@ fn termios_layouts() { #[cfg(any( linux_like, target_env = "newlib", - target_os = "haiku", target_os = "fuchsia", + target_os = "haiku", target_os = "redox" ))] check_renamed_struct_renamed_field!(Termios, termios, line_discipline, c_line); @@ -1199,11 +1335,16 @@ fn termios_layouts() { } #[test] -#[cfg(not(any(solarish, target_os = "emscripten")))] +#[cfg(not(any( + solarish, + target_os = "emscripten", + target_os = "haiku", + target_os = "redox" +)))] fn termios_legacy() { // Check that our doc aliases above are correct. - assert_eq!(c::EXTA, c::B19200); - assert_eq!(c::EXTB, c::B38400); + const_assert_eq!(c::EXTA, c::B19200); + const_assert_eq!(c::EXTB, c::B38400); } #[cfg(bsd)] @@ -1211,10 +1352,10 @@ fn termios_legacy() { fn termios_bsd() { // On BSD platforms we can assume that the `B*` constants have their // arbitrary integer speed value. Confirm this. - assert_eq!(c::B0, 0); - assert_eq!(c::B50, 50); - assert_eq!(c::B19200, 19200); - assert_eq!(c::B38400, 38400); + const_assert_eq!(c::B0, 0); + const_assert_eq!(c::B50, 50); + const_assert_eq!(c::B19200, 19200); + const_assert_eq!(c::B38400, 38400); } #[test] @@ -1242,26 +1383,36 @@ fn termios_ioctl_contiguity() { // When using `termios2`, we assume that we can add the optional actions // value to the ioctl request code. Test this assumption. - assert_eq!(c::TCSETS2, c::TCSETS2 + 0); - assert_eq!(c::TCSETSW2, c::TCSETS2 + 1); - assert_eq!(c::TCSETSF2, c::TCSETS2 + 2); + const_assert_eq!(c::TCSETS2, c::TCSETS2 + 0); + const_assert_eq!(c::TCSETSW2, c::TCSETS2 + 1); + const_assert_eq!(c::TCSETSF2, c::TCSETS2 + 2); - assert_eq!(c::TCSANOW - c::TCSANOW, 0); - assert_eq!(c::TCSADRAIN - c::TCSANOW, 1); - assert_eq!(c::TCSAFLUSH - c::TCSANOW, 2); + const_assert_eq!(c::TCSANOW - c::TCSANOW, 0); + const_assert_eq!(c::TCSADRAIN - c::TCSANOW, 1); + const_assert_eq!(c::TCSAFLUSH - c::TCSANOW, 2); // MIPS is different here. - #[cfg(any(target_arch = "mips", target_arch = "mips64"))] + #[cfg(any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + ))] { assert_eq!(i128::from(c::TCSANOW) - i128::from(c::TCSETS), 0); assert_eq!(i128::from(c::TCSADRAIN) - i128::from(c::TCSETS), 1); assert_eq!(i128::from(c::TCSAFLUSH) - i128::from(c::TCSETS), 2); } - #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] + #[cfg(not(any( + target_arch = "mips", + target_arch = "mips32r6", + target_arch = "mips64", + target_arch = "mips64r6" + )))] { - assert_eq!(c::TCSANOW, 0); - assert_eq!(c::TCSADRAIN, 1); - assert_eq!(c::TCSAFLUSH, 2); + const_assert_eq!(c::TCSANOW, 0); + const_assert_eq!(c::TCSADRAIN, 1); + const_assert_eq!(c::TCSAFLUSH, 2); } } @@ -1269,5 +1420,5 @@ fn termios_ioctl_contiguity() { #[test] fn termios_cibaud() { // Test an assumption. - assert_eq!(c::CIBAUD, c::CBAUD << c::IBSHIFT); + const_assert_eq!(c::CIBAUD, c::CBAUD << c::IBSHIFT); } diff --git a/vendor/rustix/src/thread/clock.rs b/vendor/rustix/src/thread/clock.rs index 7a8c11968..8060c0238 100644 --- a/vendor/rustix/src/thread/clock.rs +++ b/vendor/rustix/src/thread/clock.rs @@ -5,7 +5,7 @@ pub use crate::timespec::Timespec; #[cfg(not(any( apple, target_os = "dragonfly", - target_os = "emscripten", + target_os = "espidf", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. target_os = "openbsd", target_os = "redox", @@ -29,6 +29,7 @@ pub use crate::clockid::ClockId; apple, target_os = "dragonfly", target_os = "emscripten", + target_os = "espidf", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. target_os = "haiku", target_os = "openbsd", @@ -56,6 +57,7 @@ pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRel apple, target_os = "dragonfly", target_os = "emscripten", + target_os = "espidf", target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11. target_os = "haiku", target_os = "openbsd", diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs index 6e193c366..fa3bcfb8d 100644 --- a/vendor/rustix/src/thread/id.rs +++ b/vendor/rustix/src/thread/id.rs @@ -21,7 +21,7 @@ pub fn gettid() -> Pid { /// /// # 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. @@ -46,7 +46,7 @@ pub fn set_thread_uid(uid: Uid) -> 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/setns.rs b/vendor/rustix/src/thread/setns.rs index 2669cc7a7..2dd522a14 100644 --- a/vendor/rustix/src/thread/setns.rs +++ b/vendor/rustix/src/thread/setns.rs @@ -65,7 +65,7 @@ bitflags! { /// `CLONE_FS`. const FS = CLONE_FS; /// `CLONE_NEWCGROUP`. - const NWCGROUP = CLONE_NEWCGROUP; + const NEWCGROUP = CLONE_NEWCGROUP; /// `CLONE_NEWIPC`. const NEWIPC = CLONE_NEWIPC; /// `CLONE_NEWNET`. @@ -78,6 +78,8 @@ bitflags! { const NEWTIME = CLONE_NEWTIME; /// `CLONE_NEWUSER`. const NEWUSER = CLONE_NEWUSER; + /// `CLONE_NEWUTS` + const NEWUTS = CLONE_NEWUTS; /// `CLONE_SYSVSEM`. const SYSVSEM = CLONE_SYSVSEM; } diff --git a/vendor/rustix/src/timespec.rs b/vendor/rustix/src/timespec.rs index 55c4c061b..51c2d2443 100644 --- a/vendor/rustix/src/timespec.rs +++ b/vendor/rustix/src/timespec.rs @@ -4,19 +4,11 @@ use crate::backend::c; /// `struct timespec` -#[cfg(not(all( - libc, - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -)))] +#[cfg(not(fix_y2038))] pub type Timespec = c::timespec; /// `struct timespec` -#[cfg(all( - libc, - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[derive(Debug, Clone, Copy)] #[repr(C)] pub struct Timespec { @@ -28,18 +20,12 @@ pub struct Timespec { } /// A type for the `tv_sec` field of [`Timespec`]. -#[cfg(not(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -)))] +#[cfg(not(fix_y2038))] #[allow(deprecated)] pub type Secs = c::time_t; /// A type for the `tv_sec` field of [`Timespec`]. -#[cfg(all( - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] pub type Secs = i64; /// A type for the `tv_nsec` field of [`Timespec`]. @@ -57,11 +43,7 @@ pub type Nsecs = i64; /// On 32-bit glibc platforms, `timespec` has anonymous padding fields, which /// Rust doesn't support yet (see `unnamed_fields`), so we define our own /// struct with explicit padding, with bidirectional `From` impls. -#[cfg(all( - libc, - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] #[repr(C)] #[derive(Debug, Clone)] pub(crate) struct LibcTimespec { @@ -76,11 +58,7 @@ pub(crate) struct LibcTimespec { padding: core::mem::MaybeUninit, } -#[cfg(all( - libc, - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] impl From for Timespec { #[inline] fn from(t: LibcTimespec) -> Self { @@ -91,11 +69,7 @@ impl From for Timespec { } } -#[cfg(all( - libc, - any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), - target_env = "gnu", -))] +#[cfg(fix_y2038)] impl From for LibcTimespec { #[inline] fn from(t: Timespec) -> Self { @@ -106,3 +80,31 @@ impl From for LibcTimespec { } } } + +#[test] +fn test_sizes() { + assert_eq_size!(Secs, u64); + const_assert!(core::mem::size_of::() >= core::mem::size_of::<(u64, u32)>()); + const_assert!(core::mem::size_of::() >= 4); + + let mut t = Timespec { + tv_sec: 0, + tv_nsec: 0, + }; + + // `tv_nsec` needs to be able to hold nanoseconds up to a second. + t.tv_nsec = 999_999_999_u32 as _; + assert_eq!(t.tv_nsec as u64, 999_999_999_u64); + + // `tv_sec` needs to be able to hold more than 32-bits of seconds. + t.tv_sec = 0x1_0000_0000_u64 as _; + assert_eq!(t.tv_sec as u64, 0x1_0000_0000_u64); +} + +// Test that our workarounds are needed. +#[cfg(fix_y2038)] +#[test] +#[allow(deprecated)] +fn test_fix_y2038() { + assert_eq_size!(libc::time_t, u32); +} diff --git a/vendor/rustix/src/ugid.rs b/vendor/rustix/src/ugid.rs index fc1082adb..57cc666dd 100644 --- a/vendor/rustix/src/ugid.rs +++ b/vendor/rustix/src/ugid.rs @@ -75,18 +75,17 @@ impl Gid { } } -// Return the raw value of the IDs. In case of `None` it returns `u32::MAX` -// since it has the same bit pattern as `-1` indicating no change to the -// owner/group ID. -pub(crate) fn translate_fchown_args(owner: Option, group: Option) -> (u32, u32) { +// Return the raw value of the IDs. In case of `None` it returns `!0` since it +// has the same bit pattern as `-1` indicating no change to the owner/group ID. +pub(crate) fn translate_fchown_args(owner: Option, group: Option) -> (RawUid, RawGid) { let ow = match owner { Some(o) => o.as_raw(), - None => u32::MAX, + None => !0, }; let gr = match group { Some(g) => g.as_raw(), - None => u32::MAX, + None => !0, }; (ow, gr) @@ -94,8 +93,6 @@ pub(crate) fn translate_fchown_args(owner: Option, group: Option) -> ( #[test] fn test_sizes() { - use core::mem::size_of; - - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); + assert_eq_size!(RawUid, u32); + assert_eq_size!(RawGid, u32); } diff --git a/vendor/rustix/src/utils.rs b/vendor/rustix/src/utils.rs index df2ac315b..c5258394d 100644 --- a/vendor/rustix/src/utils.rs +++ b/vendor/rustix/src/utils.rs @@ -18,7 +18,7 @@ pub(crate) fn as_mut_ptr(t: &mut T) -> *mut T { /// Convert an `Option<&T>` into a possibly-null `*const T`. #[inline] -pub(crate) const fn optional_as_ptr(t: Option<&T>) -> *const T { +pub(crate) const fn option_as_ptr(t: Option<&T>) -> *const T { match t { Some(t) => t, None => null(), @@ -27,7 +27,7 @@ pub(crate) const fn optional_as_ptr(t: Option<&T>) -> *const T { /// Convert an `Option<&mut T>` into a possibly-null `*mut T`. #[inline] -pub(crate) fn optional_as_mut_ptr(t: Option<&mut T>) -> *mut T { +pub(crate) fn option_as_mut_ptr(t: Option<&mut T>) -> *mut T { match t { Some(t) => t, None => null_mut(), -- cgit v1.2.3