summaryrefslogtreecommitdiffstats
path: root/vendor/rustix
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /vendor/rustix
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix')
-rw-r--r--vendor/rustix/.cargo-checksum.json2
-rw-r--r--vendor/rustix/Cargo.toml35
-rw-r--r--vendor/rustix/README.md65
-rw-r--r--vendor/rustix/benches/mod.rs14
-rw-r--r--vendor/rustix/build.rs95
-rw-r--r--vendor/rustix/src/backend/libc/c.rs9
-rw-r--r--vendor/rustix/src/backend/libc/fs/dir.rs136
-rw-r--r--vendor/rustix/src/backend/libc/fs/inotify.rs121
-rw-r--r--vendor/rustix/src/backend/libc/fs/makedev.rs38
-rw-r--r--vendor/rustix/src/backend/libc/fs/mod.rs16
-rw-r--r--vendor/rustix/src/backend/libc/fs/syscalls.rs342
-rw-r--r--vendor/rustix/src/backend/libc/fs/types.rs326
-rw-r--r--vendor/rustix/src/backend/libc/io/epoll.rs531
-rw-r--r--vendor/rustix/src/backend/libc/io/errno.rs527
-rw-r--r--vendor/rustix/src/backend/libc/io/poll_fd.rs4
-rw-r--r--vendor/rustix/src/backend/libc/io/syscalls.rs226
-rw-r--r--vendor/rustix/src/backend/libc/io/types.rs39
-rw-r--r--vendor/rustix/src/backend/libc/io_lifetimes.rs19
-rw-r--r--vendor/rustix/src/backend/libc/io_uring/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/libc/mm/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/libc/mm/types.rs114
-rw-r--r--vendor/rustix/src/backend/libc/mod.rs5
-rw-r--r--vendor/rustix/src/backend/libc/net/addr.rs136
-rw-r--r--vendor/rustix/src/backend/libc/net/ext.rs23
-rw-r--r--vendor/rustix/src/backend/libc/net/read_sockaddr.rs57
-rw-r--r--vendor/rustix/src/backend/libc/net/send_recv.rs34
-rw-r--r--vendor/rustix/src/backend/libc/net/syscalls.rs95
-rw-r--r--vendor/rustix/src/backend/libc/net/types.rs349
-rw-r--r--vendor/rustix/src/backend/libc/net/write_sockaddr.rs30
-rw-r--r--vendor/rustix/src/backend/libc/offset.rs262
-rw-r--r--vendor/rustix/src/backend/libc/process/cpu_set.rs2
-rw-r--r--vendor/rustix/src/backend/libc/process/syscalls.rs125
-rw-r--r--vendor/rustix/src/backend/libc/process/types.rs155
-rw-r--r--vendor/rustix/src/backend/libc/process/wait.rs3
-rw-r--r--vendor/rustix/src/backend/libc/rand/syscalls.rs4
-rw-r--r--vendor/rustix/src/backend/libc/rand/types.rs6
-rw-r--r--vendor/rustix/src/backend/libc/termios/syscalls.rs48
-rw-r--r--vendor/rustix/src/backend/libc/termios/types.rs606
-rw-r--r--vendor/rustix/src/backend/libc/thread/syscalls.rs82
-rw-r--r--vendor/rustix/src/backend/libc/time/syscalls.rs58
-rw-r--r--vendor/rustix/src/backend/libc/time/types.rs32
-rw-r--r--vendor/rustix/src/backend/libc/weak.rs2
-rw-r--r--vendor/rustix/src/backend/libc/winsock_c.rs1
-rw-r--r--vendor/rustix/src/backend/linux_raw/c.rs32
-rw-r--r--vendor/rustix/src/backend/linux_raw/conv.rs73
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/inotify.rs108
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/mod.rs1
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/syscalls.rs170
-rw-r--r--vendor/rustix/src/backend/linux_raw/fs/types.rs138
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/epoll.rs519
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/errno.rs19
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/syscalls.rs7
-rw-r--r--vendor/rustix/src/backend/linux_raw/io/types.rs11
-rw-r--r--vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/mod.rs5
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/addr.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/net/syscalls.rs10
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/auxv.rs6
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs39
-rw-r--r--vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs14
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/cpu_set.rs2
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/syscalls.rs111
-rw-r--r--vendor/rustix/src/backend/linux_raw/process/wait.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/runtime/tls.rs8
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/syscalls.rs50
-rw-r--r--vendor/rustix/src/backend/linux_raw/termios/types.rs37
-rw-r--r--vendor/rustix/src/backend/linux_raw/thread/syscalls.rs62
-rw-r--r--vendor/rustix/src/backend/linux_raw/time/syscalls.rs41
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso.rs4
-rw-r--r--vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs14
-rw-r--r--vendor/rustix/src/backend/linux_raw/weak.rs228
-rw-r--r--vendor/rustix/src/cstr.rs4
-rw-r--r--vendor/rustix/src/fs/abs.rs22
-rw-r--r--vendor/rustix/src/fs/at.rs51
-rw-r--r--vendor/rustix/src/fs/constants.rs4
-rw-r--r--vendor/rustix/src/fs/copy_file_range.rs4
-rw-r--r--vendor/rustix/src/fs/cwd.rs2
-rw-r--r--vendor/rustix/src/fs/dir.rs2
-rw-r--r--vendor/rustix/src/fs/fcntl.rs36
-rw-r--r--vendor/rustix/src/fs/fcntl_apple.rs (renamed from vendor/rustix/src/fs/fcntl_darwin.rs)0
-rw-r--r--vendor/rustix/src/fs/fd.rs57
-rw-r--r--vendor/rustix/src/fs/makedev.rs2
-rw-r--r--vendor/rustix/src/fs/mod.rs187
-rw-r--r--vendor/rustix/src/fs/mount.rs166
-rw-r--r--vendor/rustix/src/fs/raw_dir.rs224
-rw-r--r--vendor/rustix/src/fs/statx.rs122
-rw-r--r--vendor/rustix/src/fs/sync.rs14
-rw-r--r--vendor/rustix/src/io/dup.rs3
-rw-r--r--vendor/rustix/src/io/fd/owned.rs6
-rw-r--r--vendor/rustix/src/io/ioctl.rs15
-rw-r--r--vendor/rustix/src/io/kqueue.rs421
-rw-r--r--vendor/rustix/src/io/mod.rs67
-rw-r--r--vendor/rustix/src/io/pipe.rs30
-rw-r--r--vendor/rustix/src/io/port.rs151
-rw-r--r--vendor/rustix/src/io/read_write.rs9
-rw-r--r--vendor/rustix/src/io/seek_from.rs18
-rw-r--r--vendor/rustix/src/io/stdio.rs209
-rw-r--r--vendor/rustix/src/io_uring.rs511
-rw-r--r--vendor/rustix/src/lib.rs17
-rw-r--r--vendor/rustix/src/mm/mmap.rs6
-rw-r--r--vendor/rustix/src/mm/mod.rs8
-rw-r--r--vendor/rustix/src/net/addr.rs4
-rw-r--r--vendor/rustix/src/net/ip.rs12
-rw-r--r--vendor/rustix/src/net/mod.rs14
-rw-r--r--vendor/rustix/src/net/socket.rs10
-rw-r--r--vendor/rustix/src/net/socket_addr_any.rs22
-rw-r--r--vendor/rustix/src/net/sockopt.rs68
-rw-r--r--vendor/rustix/src/param/mod.rs17
-rw-r--r--vendor/rustix/src/path/arg.rs8
-rw-r--r--vendor/rustix/src/path/dec_int.rs6
-rw-r--r--vendor/rustix/src/process/id.rs4
-rw-r--r--vendor/rustix/src/process/membarrier.rs2
-rw-r--r--vendor/rustix/src/process/mod.rs46
-rw-r--r--vendor/rustix/src/process/pidfd.rs25
-rw-r--r--vendor/rustix/src/process/prctl.rs135
-rw-r--r--vendor/rustix/src/process/priority.rs2
-rw-r--r--vendor/rustix/src/process/procctl.rs380
-rw-r--r--vendor/rustix/src/process/rlimit.rs4
-rw-r--r--vendor/rustix/src/process/umask.rs21
-rw-r--r--vendor/rustix/src/process/uname.rs2
-rw-r--r--vendor/rustix/src/process/wait.rs58
-rw-r--r--vendor/rustix/src/rand/mod.rs4
-rw-r--r--vendor/rustix/src/runtime.rs2
-rw-r--r--vendor/rustix/src/termios/constants.rs799
-rw-r--r--vendor/rustix/src/termios/mod.rs781
-rw-r--r--vendor/rustix/src/termios/tc.rs80
-rw-r--r--vendor/rustix/src/thread/clock.rs9
-rw-r--r--vendor/rustix/src/thread/id.rs98
-rw-r--r--vendor/rustix/src/thread/libcap.rs187
-rw-r--r--vendor/rustix/src/thread/mod.rs20
-rw-r--r--vendor/rustix/src/thread/prctl.rs459
-rw-r--r--vendor/rustix/src/thread/setns.rs25
-rw-r--r--vendor/rustix/src/time/clock.rs24
-rw-r--r--vendor/rustix/src/time/mod.rs11
134 files changed, 6463 insertions, 5753 deletions
diff --git a/vendor/rustix/.cargo-checksum.json b/vendor/rustix/.cargo-checksum.json
index bd3fda65e..4145db8aa 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":"c1762218833116749122c87bfc933ed904a0d2595f31c55138e5615b7f7f71e2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"7f4a59fcebb44a860dfe5c32e85ada9a83e8dcd6214ba46258e13b566b59b8ed","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"26bd29a8a5429a5d8adee69f4747256d30643401f66068c4af07024f3ccba871","build.rs":"1fe75202f65ca5724a5e4a2615efb166304e014e29bc7e11261177be522e7d73","src/backend/libc/conv.rs":"a94f5937ad41d7c13e4554481ea1d8ac10c2954b22e55ca0ccd93dedaeb6f1d6","src/backend/libc/fs/dir.rs":"bc41076be16b10ab0a94ab7dc507157bdfb06328d7cad3dac4a749cd8ee1c572","src/backend/libc/fs/makedev.rs":"b8c7f845c3286b9efd7c6d32e58026b36999c583769e52716544191f765873c8","src/backend/libc/fs/mod.rs":"e749e9ebae31c41a7b22a046fdb6c4462ed9e341e0b441f0b755774e17c01428","src/backend/libc/fs/syscalls.rs":"85545b4786ba417b11ae7c9a4ed5711495d40f22c701d983ceb01c91e83ae041","src/backend/libc/fs/types.rs":"f4bfcf89faf517eae82637202a87b04f75d1b1be21a32e27d65ce143d02d4342","src/backend/libc/io/epoll.rs":"25e89e9dd758b7f33f84c3a8062efe63fdb7c9f9b4ab345d7140dbae590d8a26","src/backend/libc/io/errno.rs":"3a09d3393b7df84b73f7179dbae0ecdacdaafaf8d3d8f79fdaaa21fb766fbcf5","src/backend/libc/io/io_slice.rs":"34da1bcc17993318fa93b7e71ff36116044ac12a031963710af84c3ed1bc443a","src/backend/libc/io/mod.rs":"a76e0071a887a6bdb1a3edc4887f91889d4beab1426e73417958257467f3c602","src/backend/libc/io/poll_fd.rs":"71c83405affcac8a4a7d4339cf71add4f3ccc2f3ef72cda835eec96f5a115cd6","src/backend/libc/io/syscalls.rs":"4ad98f71e052b3213bffb9769cf8d79e9de02df596c253d575b08f593f1d297c","src/backend/libc/io/types.rs":"62bbef9f8b1223214b88d1ae54401e550d2e96e853602cde0bfcf553809e9e0e","src/backend/libc/io/windows_syscalls.rs":"741f524b384d59e703b278739563ab04273dbb48c062349353dd9b7cf9ed2332","src/backend/libc/io_lifetimes.rs":"8d5c5a789321d0874a53b5bb6cbc0df866634c7c1ad2a20a7b073e0ad2c85169","src/backend/libc/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/io_uring/syscalls.rs":"01f8a4cda26bf4e0e6ba92d9d6aa27b70387e1f3fa5566130edba03bce9bc842","src/backend/libc/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mm/syscalls.rs":"2f6600bc0d13b8a425e3c082df04c296091ea3c435c7a47a235f302a53034bef","src/backend/libc/mm/types.rs":"af20d737e5994ce40831658cc3a5e20d707a92f76d1597e950ab62a1cc97b95d","src/backend/libc/mod.rs":"2dd0e84017053aef5302065827ca54123ace035e3e9770fe5026f9f0bbc53df3","src/backend/libc/net/addr.rs":"ce6468d789cfd944cc72d3cd27c29f23c257d8b95a534ea5bf40a26ef1f72ca5","src/backend/libc/net/ext.rs":"201977ad8a8eff409c7e7f5b3d060ffc37a8396b196bbf397a650fdefaff636f","src/backend/libc/net/mod.rs":"772c788c60141e41044b59c4812c4208f52838da1effe1d476ab1d99304d9f9d","src/backend/libc/net/read_sockaddr.rs":"ac28ddcccd8dba65d979709fabac34bb5f459e95fea1877cad2e6b14073414cf","src/backend/libc/net/send_recv.rs":"b22a1f64a8628769e94fa4082ed100b1845f9a01a158c5777836947e7e71d7f9","src/backend/libc/net/syscalls.rs":"64450f0a90bcf5e80f9ac814fb197f3063570f16c6daf215bad3fb292f57a656","src/backend/libc/net/types.rs":"7851d7c258b580ab8c64463dba951668afcb928ed687be6480af455ee5603c63","src/backend/libc/net/write_sockaddr.rs":"140ea379b63e93ae27ca6764a6103204ba31431796484eb91d1829c754e8166b","src/backend/libc/offset.rs":"4b909d64a926e40b433aeab9974d89b7e6e4e1531bd1bc467ed5726ba298d1a4","src/backend/libc/param/auxv.rs":"7d71f224f7d9c547b6b5e1425cad03466328b7b8ad2a62f49d9e29e075061e43","src/backend/libc/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/backend/libc/process/cpu_set.rs":"9c0734ac8f07431e0ad704ca5bd749c9fba25d295c8ee59dd92437c0d6fa05b2","src/backend/libc/process/mod.rs":"45a9979d6bc7c669ffe212c55ffbf6ea8f4bdb9a711c894b9e93b52a05e611d7","src/backend/libc/process/syscalls.rs":"496875ec58336293966db86d8af01e9a2f070598c39895012e75cf3826c3be5e","src/backend/libc/process/types.rs":"48d6a96ef735f7e4842edec75ea37650919e97f62bcd1cefabc0bdf58a93fb40","src/backend/libc/process/wait.rs":"47862cd801bb2e0b4f98a48d6755fb263014675896fd888eb500866ba35b2ba4","src/backend/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/rand/syscalls.rs":"dd675f045e4f18ae57db9a67f95c67a3f0d14d3b8df22907c4e80ca4b611dd43","src/backend/libc/rand/types.rs":"8a840167af1454d1399c1defb254e9a626ab46d00981e9c7360828be6ac45b08","src/backend/libc/termios/mod.rs":"63a1e559981848581bbacad2adb567e5eb62d17caa2d8f826e977dc053ce26bb","src/backend/libc/termios/syscalls.rs":"8c7845fdcecdde5b264966989728765ef253cef60a1660da9be43daa444989cd","src/backend/libc/termios/types.rs":"314fbb3dbd5a6e05e4ac700ad30c4f4a129fad73493dcf372c9295fd7b5740b6","src/backend/libc/thread/mod.rs":"0de5f67a684b9fd7628d3009d2ea5fd51b8770e8b387eed14f59152157844287","src/backend/libc/thread/syscalls.rs":"680160cc71b424af099665ee4725032268421ebf47cd9ad7806710ded5400770","src/backend/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/time/syscalls.rs":"6d78a726329e8dc45c4cf965aa38989398ea119729587f4729aa363d8dc7d72e","src/backend/libc/time/types.rs":"f48f6baa4b5dc5cfd5b937911d234ed7d94d3c19f6305334d21d72dfcf246c68","src/backend/libc/weak.rs":"89b985e993ecc4e932631814e1b67933ae0127e278042f67926ad2fcfa55f90a","src/backend/libc/winsock_c.rs":"1739787b6a6e878c5d0213ec7a2151c3495589962829711c04e3e8a7782fd846","src/backend/linux_raw/arch/inline/aarch64.rs":"67011427b3cecd29ee716113d952e70d63574c96d1d3ea3c75d46250bde9ca44","src/backend/linux_raw/arch/inline/arm.rs":"7760d51aef17a69a797eb96fd61f7fade0d55bc87ec9a3e77fa6bb6aebaecdbb","src/backend/linux_raw/arch/inline/mips.rs":"d00c84cfdb4e37bdee9a2daa0a7b3298afbb4ebe288702203cb43d9c2617012d","src/backend/linux_raw/arch/inline/mips64.rs":"ab5455c9b2511ba6b67a66873cd8b53bf77471249fd2779d6437ebb4934087b5","src/backend/linux_raw/arch/inline/mod.rs":"48e60ed847f1fe7bcf561d3dd04217589698b576649d17094da98bbfcb826e8a","src/backend/linux_raw/arch/inline/powerpc64.rs":"dcd12314184441f5f7705bea6b829103c7abc9062db366ae5584023a38252a36","src/backend/linux_raw/arch/inline/riscv64.rs":"58a58203e9cac2ed21e4a7b26692c5d56d3c2bcddb3f60a648efd18a02129f3c","src/backend/linux_raw/arch/inline/thumb.rs":"82b88c9a3b6837f28a738cc760fc2403e7014abdb2c35d2bdbc8073235ae2863","src/backend/linux_raw/arch/inline/x86.rs":"459cca47f3300418de9945858ba42009e66e4be3c8da268481f30ae4e815b3db","src/backend/linux_raw/arch/inline/x86_64.rs":"7c893ca306b3b8a5980c525dc5fa23187a0526bc9f7ac637204d88a1d596df5d","src/backend/linux_raw/arch/mod.rs":"2f2e26f5742c302bb44f367ad265de573d89494eae0789fa44b5a39248e354e3","src/backend/linux_raw/arch/outline/aarch64.s":"84f066b6fe3cf25ed61c7aa420408c6d5a0b33a7c91b748ed81e47737567975f","src/backend/linux_raw/arch/outline/arm.s":"fa266bf9f4533da1e96c27c4ae5418c86f44074ac0c6afcff0404738e11365da","src/backend/linux_raw/arch/outline/debug/librustix_outline_aarch64.a":"168fda5b82263fee87661cb146d8de281aa18f6748b372d4e24cfd73a5f3d9c1","src/backend/linux_raw/arch/outline/debug/librustix_outline_arm.a":"2f07acdd80130f32835b64a6e1afa37f62510674c45d5c4c53c39185e1091cb6","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips.a":"82b042b867680439a9a8123439cc81fd597bc2a579d63448c860260bc3061cf7","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips64.a":"1fd5e6e5e6c92dc8990dc3526f4c9340c246b6000c70097b058e5463a16f7c2c","src/backend/linux_raw/arch/outline/debug/librustix_outline_powerpc64.a":"08a7322545cd3ee790f7ee51e459dd289f7dc44ba4f71a94c951c6e7b655e685","src/backend/linux_raw/arch/outline/debug/librustix_outline_riscv64.a":"74ea44d51255593cd95d3298020df872536ec7b967f0d779018482a49966ecdd","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86.a":"aeb926e156f39fb87dc438dcd441cce9f04dec3a083a96344a373ea8900d55f5","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86_64.a":"c77044773834308d327927ac87a1a36a8fc4be333a876c2e356743deb455a24c","src/backend/linux_raw/arch/outline/mips.s":"e265e8fa0b9785a9f2779d6ba70ce982b954b802862b0026dc70fd79b12968bb","src/backend/linux_raw/arch/outline/mips64.s":"c79de202f0eb00e2d9cf1fce2b9a2cabfe4ff2f5cc1476bcfd6c3d139570d447","src/backend/linux_raw/arch/outline/mod.rs":"d97b3657e828a40553677469887b1efab0544812ca592ef359a2d4230a0dd621","src/backend/linux_raw/arch/outline/nr_last.rs":"82d92b9ca8307c19d74ced1ae2c0b31f2a7c5db70fa31fdedb55d38a90601455","src/backend/linux_raw/arch/outline/powerpc64.s":"0847fa3f160846ee02771550667913734ba9773e2221f2279c4f296d6f5b7bd4","src/backend/linux_raw/arch/outline/release/librustix_outline_aarch64.a":"fa8d31702cafb24d9799c162d3319c522892e91c58fbbff2b09950a0fa81b46f","src/backend/linux_raw/arch/outline/release/librustix_outline_arm.a":"0f7c8c5c02d5329d884f800da70aaf6b5b67c14000b12afb708f3e4758aa1f7a","src/backend/linux_raw/arch/outline/release/librustix_outline_mips.a":"c9254760fa993e88662c5e1e8911d994f29e203b37a0fc9b550be193125f5031","src/backend/linux_raw/arch/outline/release/librustix_outline_mips64.a":"224f9ac5196833491bee67fd287a53b7e88111731e2eaaa3ebefba31faea373b","src/backend/linux_raw/arch/outline/release/librustix_outline_powerpc64.a":"1f04e44c3d863bac066520c787444c314f2aa2f8d8d3cae38990ecc008b9b6e1","src/backend/linux_raw/arch/outline/release/librustix_outline_riscv64.a":"465b6631b33632f4a6aca32b04134cd07993cd1bb55405a080157829d7396373","src/backend/linux_raw/arch/outline/release/librustix_outline_x86.a":"380aa7c802be2795471407d438e3da768df9bdc7340cc448d3a91b2d123dbf19","src/backend/linux_raw/arch/outline/release/librustix_outline_x86_64.a":"36f837703d7f0e246b7f596441010fdc1be27e42417af925b6040504c5aa32a4","src/backend/linux_raw/arch/outline/riscv64.s":"ca5303c0c8af6de1f246d658003e270d4e29d6c68dd90c6eee372d045bdf7305","src/backend/linux_raw/arch/outline/x86.rs":"f7e12a0f3fe8e97acb1ade2c9e61d82542f00ad4d8fe684a8dcd9f30fd9ab5d4","src/backend/linux_raw/arch/outline/x86.s":"4604e3b41161802343e2e4c890fd2042098a901d95893ebe4c436f97fd47cad3","src/backend/linux_raw/arch/outline/x86_64.s":"a530084cd42ad8d4b2d36526f4e04f45a6e29ea49882e2c561ac2eeac16272bf","src/backend/linux_raw/c.rs":"f112bda3f89c5859f9130ef1a9de1000054af7992073c20ac230230610a29a6e","src/backend/linux_raw/conv.rs":"ad343251bb09c263ef4c7a280fadceb2f515830873426cadb6f3cd908f0ca8be","src/backend/linux_raw/elf.rs":"a257fbc3f22e4970605cf72a3b301dc2eaee2f5f1b3b0ea434fa192db3c3164e","src/backend/linux_raw/fs/dir.rs":"d54842a373968da54bdae73e10ccab7a8bc19c1bc75b6dca2bb70818c5b275ea","src/backend/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/backend/linux_raw/fs/mod.rs":"021f88307e54b391367066ac38c8316064cf1c526350ed1ee1da89475a2c1566","src/backend/linux_raw/fs/syscalls.rs":"e2c9a41b4a63ed3afb022803bff4d991a375d3d9f75ccce311a8ea48c54f52b9","src/backend/linux_raw/fs/types.rs":"de709c7da97a8b15fff7e99f086398056885e3eb397c0de658dd7e68bc78a7b6","src/backend/linux_raw/io/epoll.rs":"71026126ddf47c07ef568a1ee5057c57da41026e80c4787b1b168a54b01a51a6","src/backend/linux_raw/io/errno.rs":"db192a59aa27f3ae34f7c9b246c158c4db173e6ffb03860ce1c5541c0dac31bb","src/backend/linux_raw/io/io_slice.rs":"5ba992f3fe701184841006588b35f2452156b73e3bef9e07460e4b1f61ac889f","src/backend/linux_raw/io/mod.rs":"6ea805b91d571217c9649364121d0824bbdf4635b36c9150e5968fbeb75c0892","src/backend/linux_raw/io/poll_fd.rs":"9f5a15c80094cc3334acd171c0621d033b44d5d9a987a57acbdcd62cb17d871b","src/backend/linux_raw/io/syscalls.rs":"0a161b4f05c05c812fa1e511f3c4a8239c58941519a8d17f2f45a875166f2461","src/backend/linux_raw/io/types.rs":"babdfe55f4f2704559dc38e56bac55569d69c0911a906381c19cde3e1a2b420d","src/backend/linux_raw/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/io_uring/syscalls.rs":"c5bb6b93718a8b6db743209701b7f5713dae6514e822875d34609b881f3058af","src/backend/linux_raw/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mm/syscalls.rs":"647c1846793c386f6babae898686604a4808344ec3e2d1e71071bbfd04079357","src/backend/linux_raw/mm/types.rs":"a5d0ea04a85df5e196d68a8524c4325963c7b2ded3d7d48713c8e855273b60d4","src/backend/linux_raw/mod.rs":"d0871f7dd2ef5f02e669e1acceda99921f04128cfb8adab8def49acb1bc5851f","src/backend/linux_raw/net/addr.rs":"b439d61da1356708987bf7de3dcb44ba45d58dbf8b2db1234b0fdcd88365078c","src/backend/linux_raw/net/mod.rs":"4ffd3f6f9cad722e4c29b9bad4912a69f521d737b9e637599a1c60436651d4ae","src/backend/linux_raw/net/read_sockaddr.rs":"0357ae643c384b08578aa0b148ac9b236953da9b36b2e387a40d5b87ae9eccef","src/backend/linux_raw/net/send_recv.rs":"42834cf8148abd02021115a61d57b23bb323dd8ad0d1b9a91d17fb8f7defab01","src/backend/linux_raw/net/syscalls.rs":"b989424fa6e181998c1c0c738069d7b98841acee4691454c2bb24588c2921994","src/backend/linux_raw/net/types.rs":"c61b689d7f4b9b68d065935d70926d47b5ac7246b2fbe4f20d144a0c2f417fc2","src/backend/linux_raw/net/write_sockaddr.rs":"ec0bf20a354cb86e2b5646bfc79297a378f11fcdf5641c16e4dd13e305011dc6","src/backend/linux_raw/param/auxv.rs":"245348ebfbff2631a039e48cb5d56381d7796818e3c314de0e59512a6eb099ce","src/backend/linux_raw/param/libc_auxv.rs":"00a44c8593e55326386980c78e38029f43891dc47c7930243853ca6ceab1d46b","src/backend/linux_raw/param/mod.rs":"db21fc1b0ea5568b8649890fa38a878bfcdcf7398f6cf1640176b37bcc6ce990","src/backend/linux_raw/param/mustang_auxv.rs":"9ca4753766736ed6e9b2ec4464c4e9cb64e5f85a4f75fa928725814d1be02a79","src/backend/linux_raw/process/cpu_set.rs":"2c996e58b556d7528885bc5a8477846a60d0086f812364643db0d2ee6e99d9e4","src/backend/linux_raw/process/mod.rs":"fb393c70a9c63ef9a6bf1fb5a2dc94f07d6b0b6987cc5231c15c607015dafd68","src/backend/linux_raw/process/syscalls.rs":"542cea257842929ac2a668a44c045ed1d9893eaa2c4722a5a5a10659a8e40cae","src/backend/linux_raw/process/types.rs":"fba10dc8ca9eaf4d481cb82bd1540cf5c05620533c44f917c09a22ea55ef408c","src/backend/linux_raw/process/wait.rs":"81e20506feb1e6f90a1fe0cc01768d380e11e7f8afe5212e353030835dba2408","src/backend/linux_raw/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/rand/syscalls.rs":"b1d8b2fea0c792bd1e7c24ee59429d178dc0ad442ac817b12c7abcb38d71497b","src/backend/linux_raw/rand/types.rs":"271416d5241d70932b8a17f3b67eefd1b9c360f217f807de3d73192e9b620552","src/backend/linux_raw/reg.rs":"f9ab26b045150894b98c741f9e80ac2734bf7598f5cf166ab080938febe7af20","src/backend/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/backend/linux_raw/runtime/syscalls.rs":"6488160051a991e6d385abbf8a08ccd6498acf525906d512b3f89bf3a33fca6a","src/backend/linux_raw/runtime/tls.rs":"c8e6c9a4277a4f50539ab8a666a59b78760ba3426c8cdd3046d8d5ac41a3d1cf","src/backend/linux_raw/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/termios/syscalls.rs":"e8a1855b5c171dcef67e98afc3d88092f723a1503d68b8ae9934359c9e2da264","src/backend/linux_raw/termios/types.rs":"ae5ae8561f3e68aec011652134537fed6dc328f1605f366600e1e40346551cdc","src/backend/linux_raw/thread/futex.rs":"e4ca5be060c52538b97df3781d84e2eb4d8241a7f647b2874412bc0fe6061efa","src/backend/linux_raw/thread/mod.rs":"f7132a68c9db1b4a796781b9e8d0ac268a1ddb713e510bfd43425564ec9b39c4","src/backend/linux_raw/thread/syscalls.rs":"9600876bc4670d0f57dfdd664fbf7d1a16932d9a4cf65eb0b46ec8f0b5b95f1f","src/backend/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/backend/linux_raw/time/syscalls.rs":"184c1208a744e9859e98a7f3e1425db12b00594d2aed42f64a5964e184ef0f31","src/backend/linux_raw/time/types.rs":"865d968a6d2903344982f94c69868031cd1fea582318659ca4c69a11d8a53e33","src/backend/linux_raw/vdso.rs":"400af287fc77ab464489ce4db21c842a52a72977bbec285675f3eca98c4ab6d9","src/backend/linux_raw/vdso_wrappers.rs":"514189ebe9dbc32f16873fe46c78f025ee43b1c81de7c2a461162b53764bd3f7","src/const_assert.rs":"ff08ab91f11f2ad29883096f4468bd9a65060d5a9e6681e9282bb081f8bdac27","src/cstr.rs":"e5db2aae8fcbad410218696e3e3b3a0da3cc17fc7f64360fc1127bc4e4deff76","src/ffi/mod.rs":"1990dae8190991142bef24220f02b99c96c5bfa7dda2a7974d9dcac265d58945","src/fs/abs.rs":"f30ccd2cea4a850250db931e416762f1d9727ab2839969f3f55825c13eabfea0","src/fs/at.rs":"d7058ca1a7af18f20d9c3055237d985ffc6834dd5b8658e475b68c55f0188769","src/fs/constants.rs":"4692df5cdcaab06158be44c017b0baf4ec8a98d3636574468cd3bf086ff2ab5e","src/fs/copy_file_range.rs":"a48f5688a4697e0bcd3079f7dc75908e8d044bf479fecd97055c2efb56014671","src/fs/cwd.rs":"c7b98a4f1a49102c22ff587fd5aa9cd9b9bd3ba107d0337c58fa996b5521671e","src/fs/dir.rs":"c88832b426a731b26b8d307fb5bbcb41fa64346e31d700503af8539e492278be","src/fs/fadvise.rs":"beef66ebe1310fb92628240b2cde68f744c78e50f6ff61bb1404bd4868d9cae8","src/fs/fcntl.rs":"30ca419db650dcb266110f421bd89d9ce4a81365a7fc153aa00b2fa003a1d052","src/fs/fcntl_darwin.rs":"07f07b2ac75dc28bc9e08200f72eb95550a87ff3d69c1204f49ecb63a0c4fd20","src/fs/fcopyfile.rs":"ec95929cbbe02cf49233a785e5238931bb107b7903cc5bc95e4231de960995f2","src/fs/fd.rs":"a5f75172d7a304595aa85a8a04ce996272c15d232d60cce991bd4b23a2b491d9","src/fs/file_type.rs":"fefd865f91011f66126213b0994773d99e373b468c31e866002228c98c64ad85","src/fs/getpath.rs":"28f6970fc1bbc37bb35c84724b59eac436ea7407a4522e18c2bdacb1fdd2edd9","src/fs/makedev.rs":"85520b484cb7c15ab71ea1c368578ea3b7e484d82f8510db92b6ce9f7ca341ae","src/fs/memfd_create.rs":"3f1d809e81fe479a82a454a04ea1219a11969d75d0c8b9ddacb09c630a9af896","src/fs/mod.rs":"31527cb94628ae9695409d45efb2eacfd68c2d64baef4f54e0d1b8c90301ebba","src/fs/openat2.rs":"4a95c15dab533a41201b5fa25c8a212956b7571d58cad696bdaf45af8aef96db","src/fs/sendfile.rs":"ac053f03608656bb675228ba61079b774498c0233d17e5816ac72538bb12b70e","src/fs/statx.rs":"88d4c497a185201921884502c78ca5dcec51b0f4768f930dd3681f1d03de46e8","src/io/close.rs":"c59bf90183625da1b1e87975739469440dcddc7b5b2b6ff3a6fd12b2d399a783","src/io/dup.rs":"5dc927cc11bc74bc9d03944261379422ce684945209c16332bd6a9ea64e6c381","src/io/errno.rs":"733f8e9246a319db137740e8dca29d7b3c7474a715e066568b1dc82f0944f692","src/io/eventfd.rs":"163aebe29b5a0e21dd9d121d39c71e82bc6569a4bb658026cfef8ee61809066b","src/io/fcntl.rs":"fe73d5593c011b6ac851e608e1776c4483924e19a9f82f5fc8759c498a4e483a","src/io/fd/mod.rs":"a1eab9ce9a2c4454053afdfd3f3705e4cb971e94cc453e4f13690f2f0d83dc2c","src/io/fd/owned.rs":"b339000df323764414c71cbe60a7ce0d5e4222cb4c125c7ce40269defaec18af","src/io/fd/raw.rs":"9bcd00be7df3d9f4e6c49ca2d18ef25aee3d6f0ed5ee6b73df5a9beacefb6031","src/io/ioctl.rs":"705add2c90270980523ab31fd224dac4f0fa210d7475b1b3a2f31e1c0e2a818e","src/io/is_read_write.rs":"072b5ea6ddb2339fc6c7e90dfc5a0a5354d926d0f2ac4df06cadafe823425c47","src/io/mod.rs":"6b3d50275cbd5f67f87f17d3130dd1391366762cd27d2bd3f060d5040c366ff4","src/io/pipe.rs":"fabf1cfd5bb3bba5866f530503da9b10afbaa5f0ba33900e1b8cf05e57c3a361","src/io/poll.rs":"41dab55365df215739dcf71815bfc4c2344828d8056ab200564f75210dbc56bd","src/io/procfs.rs":"d7b21900416ca54b9bbe683257dd4da1857f56edc25dd78a954dbafed4914ab9","src/io/read_write.rs":"313aef278466ae546a0989ceaebc41a673f04ba59a21171175bc7ed415c2ffc2","src/io/seek_from.rs":"16072918edbb97e7ac92a0b38bcf0781ff9e968f77661df7778fa0154d2a105e","src/io/stdio.rs":"e9c970290d5a83666966b123755b92454670d4cc6eb03036344ce8ca2844aadb","src/io_uring.rs":"0c6e1531a03e5739de2423b6d49b5bece77b2bc179adf668193abf10f78fd004","src/lib.rs":"8503c82f621798fdbb2f5b84e96f7abe75ad3d8fb8af96ee0765d214f029311a","src/mm/madvise.rs":"cdc61b39d8abeea184575ca21e14483c335ce373a86007439fad6e72f58e4e24","src/mm/mmap.rs":"988dc5e7ab116218e14c2c387f8eb90ab3031c2d65560a6fd0ff021666919db7","src/mm/mod.rs":"92d2cb7e8e27b8e6bf2e18e29137aa249935f9ae97ee48aa30fcbb1acd0f4b6e","src/mm/msync.rs":"a7f61abe4cb5e96f95ae8229c62b9ecc08382080ed99d76278be7001cfcf82f2","src/mm/userfaultfd.rs":"8073443bd181ff0b3ba4d0b1ae67370b4864035a0c8b4898cd709dc47c518ae7","src/net/addr.rs":"1d84310a4bb7e45f94a10b2cd2000f208db9e28e21bf051ad493261d4e46ae35","src/net/ip.rs":"92fa33205b9d955bf956b152ad283757f3526ec3d7cb9cd958ae460b3949619d","src/net/mod.rs":"cc99751c260f63d1d98bfd26c08ed71cb7fb1f9535c98af75965be25c81a1cf5","src/net/send_recv.rs":"f1fb0b9be750b1949b54054b3195904123cfb96f2ee0ebcedef86fc7175c63e9","src/net/socket.rs":"15840dcdabc1c5fe553f67aa29670f75fae3339b33d019613f2e1d9d573e7b8d","src/net/socket_addr_any.rs":"076d682aa000b2f4421c41f88824533dcee56c2fed874740b3c3cd7b2140564b","src/net/socketpair.rs":"b005b019f8ae0f022fd0e730dafb258606f1f537e4448078175fc192d002dc81","src/net/sockopt.rs":"5276668a1357b704681d33e999a65a91ed684e55024e54b33d55d64843f7b0ed","src/net/wsa.rs":"6e546b42f50a851fc833c57cda76cfb347203ed4b0dea574a3d325bf5a2ebf80","src/param/auxv.rs":"988872f9bec2e12f35765ae8963cbb9535d4acaedd4c9a4d07ced6feb70e0aaa","src/param/init.rs":"671d8974f0d9b82e79076d1f4deabe0273a874a329f74b8aad26e07b86791ba3","src/param/mod.rs":"57ba7d1c16cfc419409cfe73acc253723df79dd0caaf46864939f9aa0a7cfa50","src/path/arg.rs":"e137550750e3bef341579ceb2448c0e50a666ab614a49ad00bb9fdb1e3ead9dd","src/path/dec_int.rs":"6442d2b8fbb648cd4c50eca40daefac9422c306bebeb34de053a8c57989f1dab","src/path/mod.rs":"513fea21b1ba0226c3c5da769ded06a7cd7abe9f49cec9d165bc62a15da126a8","src/process/chdir.rs":"4c63c351e207b1bbefdd7c001e85fed383d5ac2147894d5a09fbd8b302d7c728","src/process/exit.rs":"79f6c0dd45dca0a2bea919ac920c4a56cea23608a345961e4d027aee6624783c","src/process/id.rs":"aab5ef5818e2b16cc4950a92a9c71e72be51a92cbc5778384399ea8ee2a872fa","src/process/kill.rs":"e4b4dcc7e5b2a1e3e68ce03ce9a5dde43108dae4ddbc443488c464194738d06f","src/process/membarrier.rs":"f35aeeb9ab4e1918f9606bf11e8c84db3d20362f01513103ce988d86b5481a7b","src/process/mod.rs":"727cf13a29f1af83949bff00df47d2ae0a92f922d147d5671aa8d0136d3dbb55","src/process/prctl.rs":"884d29ecc07513f02d6aa06a3a011319289829f2977f156ae262dd6ed68f8c6e","src/process/priority.rs":"653a1f525c18ef1de685a3c3307d5214b0d20e61dfd1d4f5065d9c08ebcb4185","src/process/procctl.rs":"5da78c978ae5e9c723efd338b4388ada25b4308ad16c78fdfa34c1ffd86f2132","src/process/rlimit.rs":"b030f3cf585f2eae210703eb01983b937797bdcb9b25a84d42c26711ce7e2221","src/process/sched.rs":"ea8b20942ef09dbcd7a54d8218435129dfece427e4960055bcdf81c997e80f5f","src/process/sched_yield.rs":"6565faa3928b66ddc74a65e893e15edfa4b9be4f7e5f5f68527501a7f6bc3350","src/process/uname.rs":"850f16288261ea8fa92714402a72e89ba2b7880ffea5a9ab9b4c1613b1642ad3","src/process/wait.rs":"6019bd90fd1f58f328099d484e54be49c4327b73bf21e35d071a0e3d1c22dd0c","src/rand/getrandom.rs":"7ad1be6a5b0dc25030bb2434bdc00f3a0c410b7ebc24c136b9839410bf6c5a97","src/rand/mod.rs":"9bde22996f417e84b54720a584b440b895f19ea4717a7638af98ff4c1485ca98","src/runtime.rs":"c6412d171458922f50a85a84900dd3ab7d8ba603b4c058eb9f9d70de52cac628","src/termios/cf.rs":"cb13ee88cba541cbd683c7a5da034a126fd9e09dc6b5f25c9f32382f8318ffc0","src/termios/constants.rs":"16747dc753fa85206953f297067d2eae3184b4e3681a9818f3fee67d206f7e89","src/termios/mod.rs":"23dac84c5ad37f789b692e894aab32645e7bd4c94eb458d76d80194d73f8d65f","src/termios/tc.rs":"b1d4615a75dbf4d8bd34e705b86ef61a6c1078a099e0f70efaf7fcd86f96b1b2","src/termios/tty.rs":"409ddcc795ed1e644d302cdcfdffff8713657bf8777548e628f0b1149acb18af","src/thread/clock.rs":"36b99ea79cfd39b3ec98ddef4625e7d0ba95df9db6d1475a53bc05b40791e00a","src/thread/futex.rs":"4e78c84589b535ca9ca633633696ef212393a98f2890b181acaa8f908fbc5ae2","src/thread/id.rs":"3a50734df74925222632e4b1217944ed3d7dd3075f997f4728b8309e64f49dfc","src/thread/mod.rs":"e7f67653b99329903a0e14d6fcd209acf492a8539071b2174204d401d679d590","src/thread/prctl.rs":"4c44e84060895213d8a2c7889fe3ad6dc214fa904c5e4ec203a78c0ab1e539a5","src/thread/setns.rs":"2888142d9ef6a5c50dad3e3c86a799334c70a883505762b726240ecf79a395f0","src/time/clock.rs":"1477a07f66a69f50537994d501836f2b2ccf542a07a73d361043372357a93944","src/time/mod.rs":"9fc60d342eb166729729531cf88a3ec3e8baa71b6788f40aeef1351ee8b6c94d","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/utils.rs":"6ed86e62ac05d6279b664a97fd62878a4c1811ab66a1a2920b169eb74c0c1fcd"},"package":"a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588"} \ No newline at end of file
+{"files":{"CODE_OF_CONDUCT.md":"f210602311e3f74b32f46237fd55f4ce36d798e85e3db1432ec667f63a7ffc44","CONTRIBUTING.md":"fb570c76cf924cd75b77bed52b0dbe1e87ce224dc3428c48d98301710dcc331e","COPYRIGHT":"377c2e7c53250cc5905c0b0532d35973392af16ffb9596a41d99d202cf3617c9","Cargo.toml":"fa9a45195a5d4c17b332061c4d236dc6ab2799e19467612efb062ed21e94907e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-Apache-2.0_WITH_LLVM-exception":"268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","ORG_CODE_OF_CONDUCT.md":"a62b69bf86e605ee1bcbb2f0a12ba79e4cebb6983a7b6491949750aecc4f2178","README.md":"158b3959b00e6c1536a767014c0e916a6a063a5b36d693e9e3c93aac901ccd55","SECURITY.md":"4d75afb09dd28eb5982e3a1f768ee398d90204669ceef3240a16b31dcf04148a","benches/mod.rs":"55b71073e5681b309bc4f439435ac05d1e052bba2ea6accf05bca9bf496d4bd0","build.rs":"9ea13f3871d03ae28f6abc9b1aa73667a3fd56063793a79545221cb2cbf1ad30","src/backend/libc/c.rs":"e91631918772a752429b53fb7674f288e27af0d133a583bd9d50af7af7802328","src/backend/libc/conv.rs":"a94f5937ad41d7c13e4554481ea1d8ac10c2954b22e55ca0ccd93dedaeb6f1d6","src/backend/libc/fs/dir.rs":"96482bacfeef73d7da7d370750e821ce2ed85d61ff47f8d98ac27dc8e54c0e0d","src/backend/libc/fs/inotify.rs":"4a1a3c0504982d2743a9c83e4cea3ec81ba0777d574ddf8ce76af67f29d0b9a4","src/backend/libc/fs/makedev.rs":"06513503ffdd35276eb7c3aed437c2362c32dd224d8c06df589bce28ad2e68b4","src/backend/libc/fs/mod.rs":"d8765bfbbd3c0f02c278a7bfef547607c7085ae14704824cc2fe7eaa64430e8c","src/backend/libc/fs/syscalls.rs":"0d1ad473a6607eca1d92e3a35d10c9c672becb052857aa9fec5a8d3371e97a31","src/backend/libc/fs/types.rs":"8a79b8532009b23aaca78446a48322be092d1bf17e3868e8328853bad6ba2fb6","src/backend/libc/io/epoll.rs":"0e95f0c887938ca2014492f26d282f756c9f2d4111e58b516830cb98bd8d3b1b","src/backend/libc/io/errno.rs":"8c6491590339a21c732b325904ece24ac39b1cd1a2b04728a9ff90ec904c01aa","src/backend/libc/io/io_slice.rs":"34da1bcc17993318fa93b7e71ff36116044ac12a031963710af84c3ed1bc443a","src/backend/libc/io/mod.rs":"a76e0071a887a6bdb1a3edc4887f91889d4beab1426e73417958257467f3c602","src/backend/libc/io/poll_fd.rs":"5ce78059ec307ec6ffbe02f2beb15f889bf652f0258f4531931062d507a3389e","src/backend/libc/io/syscalls.rs":"c85270ed0f7a6cb4258ff85611f86497c3e14ba1de1849b1203f8bcaa48202c7","src/backend/libc/io/types.rs":"fa3d65018b9feba2eef280f1ae739d85753742cdb602643d5920ff4c0f18bff7","src/backend/libc/io/windows_syscalls.rs":"741f524b384d59e703b278739563ab04273dbb48c062349353dd9b7cf9ed2332","src/backend/libc/io_lifetimes.rs":"eebc6adc10593933e9ab14c59d29793f4ec6e4403a00bbcaaf3ee81373ae924d","src/backend/libc/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/libc/io_uring/syscalls.rs":"0f7ffc079f511b200d536e348d6c6945eeb4908db721e5ca0db6cc5fe96eccc4","src/backend/libc/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/mm/syscalls.rs":"5141375b2b678c66a165de74a54e01bdb5efae8a81a38891f00da7206e686927","src/backend/libc/mm/types.rs":"bdadba2113f2a88a2b856497d411aa18eb0c7086361f72c2853ea8b09b006841","src/backend/libc/mod.rs":"8aad42f4cc53bfe9952101a314cd89d8c8600c523d699a43de8f64f48f3e4caf","src/backend/libc/net/addr.rs":"93b3f86d737c1c643663acf9f335e822cad5574067f63bda3c58af918dd1e57b","src/backend/libc/net/ext.rs":"99e1b5023b152ab278b281e26006e4ed6916d303f5d9a24d94f02a2195a25243","src/backend/libc/net/mod.rs":"772c788c60141e41044b59c4812c4208f52838da1effe1d476ab1d99304d9f9d","src/backend/libc/net/read_sockaddr.rs":"d7a98c80d2e7b47663db596a7f65980b21983c514eff54b1a8323e14164fe40d","src/backend/libc/net/send_recv.rs":"55f0ce6df7aa93f359aec2131fb3f6946d1b086e7172c096501611d0662da907","src/backend/libc/net/syscalls.rs":"f40e55d8ef9acae7834ba1bc54ff02b08d3f57fe0694bb69b5124b24cbaf1a78","src/backend/libc/net/types.rs":"b7097d3c998eb0bcb31205f69ba1f73d4c2537e706eda6bd8548d564377070af","src/backend/libc/net/write_sockaddr.rs":"33c3d7304713cb63f8fa398f5f7c084fc1d9fbb6907dd19902a90e8ec64ad41f","src/backend/libc/offset.rs":"37056027c114fab9f4054803b95d2efbe3d1c663936def3498df0e671664697a","src/backend/libc/param/auxv.rs":"7d71f224f7d9c547b6b5e1425cad03466328b7b8ad2a62f49d9e29e075061e43","src/backend/libc/param/mod.rs":"5234b8f1bcb886cca6ea003d411d75eaeebe58deedd80e3441354bf46ed85d4d","src/backend/libc/process/cpu_set.rs":"88ba2fc71dea5b8ae3b1bb3d8e64f7b7aa08882d198695e5f95d5478b6e73e75","src/backend/libc/process/mod.rs":"45a9979d6bc7c669ffe212c55ffbf6ea8f4bdb9a711c894b9e93b52a05e611d7","src/backend/libc/process/syscalls.rs":"8d0a63f224cbbd5e8fe816350a6bc50553073b6b59e86a84f89a52112d5f8c70","src/backend/libc/process/types.rs":"58f8eb2d4cda05924e97145006ac16793307182f3c1ffb5484fd4546513e863a","src/backend/libc/process/wait.rs":"36e84c05ae3a27b96da9521678b72ab004fe37a8b0d092a0b6f810015806c4d2","src/backend/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/rand/syscalls.rs":"21aa7aab15de5ff8e9c50c2c2a4d49cc309be3e97feeb17f875a0a9dc6b5cf44","src/backend/libc/rand/types.rs":"85f72babe82857d4e47067ddc11525ab290208050fb8f5e5190975c0fdda9b7c","src/backend/libc/termios/mod.rs":"63a1e559981848581bbacad2adb567e5eb62d17caa2d8f826e977dc053ce26bb","src/backend/libc/termios/syscalls.rs":"026559db31e470a4409f45a0f2bab5a0941c39b458968c5f6fdf224b653e59a0","src/backend/libc/termios/types.rs":"57e87b2d5ec31203b87137a787daee9bf8f133898d8eb5bb0716c81380d9ac7a","src/backend/libc/thread/mod.rs":"0de5f67a684b9fd7628d3009d2ea5fd51b8770e8b387eed14f59152157844287","src/backend/libc/thread/syscalls.rs":"b016611a1e2fb6af073c485b0a9efa992067b4d2dd6d213d77a731d5108d574f","src/backend/libc/time/mod.rs":"38563ea68829ca5a4b1b0695ac8a5c05718e85bdc88a36dc805efdfce45d3909","src/backend/libc/time/syscalls.rs":"a6668a9005da2e15671d4c917973bc68ef611998c0a584a53343fd5aeadade63","src/backend/libc/time/types.rs":"1ed8de272c573cd9bf10d413be8b47029e3461fe39ee33168f4442cfbf2ae128","src/backend/libc/weak.rs":"cb7dfb5c2ad37d7a5be6a2aa99a28969559493ca5b649753484e0b1fd978e410","src/backend/libc/winsock_c.rs":"addce03c242c70d10411fb9728c743bdc3b635107bd58aabbb360f2379127064","src/backend/linux_raw/arch/inline/aarch64.rs":"67011427b3cecd29ee716113d952e70d63574c96d1d3ea3c75d46250bde9ca44","src/backend/linux_raw/arch/inline/arm.rs":"7760d51aef17a69a797eb96fd61f7fade0d55bc87ec9a3e77fa6bb6aebaecdbb","src/backend/linux_raw/arch/inline/mips.rs":"d00c84cfdb4e37bdee9a2daa0a7b3298afbb4ebe288702203cb43d9c2617012d","src/backend/linux_raw/arch/inline/mips64.rs":"ab5455c9b2511ba6b67a66873cd8b53bf77471249fd2779d6437ebb4934087b5","src/backend/linux_raw/arch/inline/mod.rs":"48e60ed847f1fe7bcf561d3dd04217589698b576649d17094da98bbfcb826e8a","src/backend/linux_raw/arch/inline/powerpc64.rs":"dcd12314184441f5f7705bea6b829103c7abc9062db366ae5584023a38252a36","src/backend/linux_raw/arch/inline/riscv64.rs":"58a58203e9cac2ed21e4a7b26692c5d56d3c2bcddb3f60a648efd18a02129f3c","src/backend/linux_raw/arch/inline/thumb.rs":"82b88c9a3b6837f28a738cc760fc2403e7014abdb2c35d2bdbc8073235ae2863","src/backend/linux_raw/arch/inline/x86.rs":"459cca47f3300418de9945858ba42009e66e4be3c8da268481f30ae4e815b3db","src/backend/linux_raw/arch/inline/x86_64.rs":"7c893ca306b3b8a5980c525dc5fa23187a0526bc9f7ac637204d88a1d596df5d","src/backend/linux_raw/arch/mod.rs":"2f2e26f5742c302bb44f367ad265de573d89494eae0789fa44b5a39248e354e3","src/backend/linux_raw/arch/outline/aarch64.s":"84f066b6fe3cf25ed61c7aa420408c6d5a0b33a7c91b748ed81e47737567975f","src/backend/linux_raw/arch/outline/arm.s":"fa266bf9f4533da1e96c27c4ae5418c86f44074ac0c6afcff0404738e11365da","src/backend/linux_raw/arch/outline/debug/librustix_outline_aarch64.a":"aa3a37d9ad312881968d40c48bd3c960fb3ac0eba232a5f1979cb809d081c340","src/backend/linux_raw/arch/outline/debug/librustix_outline_arm.a":"9991ea0ccd16a175ef4b82916b6cd4b45cf67f4388eb58567b0a6e520bda3740","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips.a":"b14f87994e526c3f5976487223183b284ffa70e3b4322cece3917033635573a2","src/backend/linux_raw/arch/outline/debug/librustix_outline_mips64.a":"a9200542c6de647e31ba2cf3649490a50904ae66716c1b6c50ac123fac83f68e","src/backend/linux_raw/arch/outline/debug/librustix_outline_powerpc64.a":"355db5c83dda1074636c40fa6fee6564c668c492a71e149bcb444ea896e8167e","src/backend/linux_raw/arch/outline/debug/librustix_outline_riscv64.a":"c4fd54d0fcab2e28b1b18df77a7814b145a4c2d13fc04b937a55bf0abf420227","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86.a":"7ae3635dd3fbc2049e09d4218224e1eaaa4dd2ddd78d3901fb444d481abf2a33","src/backend/linux_raw/arch/outline/debug/librustix_outline_x86_64.a":"039c928213bd0b67c899412084a30eb9a51526e64a01e1901cd4905ef8d7cf6d","src/backend/linux_raw/arch/outline/mips.s":"e265e8fa0b9785a9f2779d6ba70ce982b954b802862b0026dc70fd79b12968bb","src/backend/linux_raw/arch/outline/mips64.s":"c79de202f0eb00e2d9cf1fce2b9a2cabfe4ff2f5cc1476bcfd6c3d139570d447","src/backend/linux_raw/arch/outline/mod.rs":"d97b3657e828a40553677469887b1efab0544812ca592ef359a2d4230a0dd621","src/backend/linux_raw/arch/outline/nr_last.rs":"82d92b9ca8307c19d74ced1ae2c0b31f2a7c5db70fa31fdedb55d38a90601455","src/backend/linux_raw/arch/outline/powerpc64.s":"0847fa3f160846ee02771550667913734ba9773e2221f2279c4f296d6f5b7bd4","src/backend/linux_raw/arch/outline/release/librustix_outline_aarch64.a":"fa8d31702cafb24d9799c162d3319c522892e91c58fbbff2b09950a0fa81b46f","src/backend/linux_raw/arch/outline/release/librustix_outline_arm.a":"0f7c8c5c02d5329d884f800da70aaf6b5b67c14000b12afb708f3e4758aa1f7a","src/backend/linux_raw/arch/outline/release/librustix_outline_mips.a":"c9254760fa993e88662c5e1e8911d994f29e203b37a0fc9b550be193125f5031","src/backend/linux_raw/arch/outline/release/librustix_outline_mips64.a":"224f9ac5196833491bee67fd287a53b7e88111731e2eaaa3ebefba31faea373b","src/backend/linux_raw/arch/outline/release/librustix_outline_powerpc64.a":"1f04e44c3d863bac066520c787444c314f2aa2f8d8d3cae38990ecc008b9b6e1","src/backend/linux_raw/arch/outline/release/librustix_outline_riscv64.a":"beb0eb046d36545a04ad7f264ed1173062f9f85ba7f4215bef64a98f30a74dce","src/backend/linux_raw/arch/outline/release/librustix_outline_x86.a":"691d867358475c701c20b816b99bab2a4c90c3796a302ccaa56d5983be1ba8b2","src/backend/linux_raw/arch/outline/release/librustix_outline_x86_64.a":"434a79197510876c5a49f594e7886c95cf4c15e876c3404ed136846c95d6ee30","src/backend/linux_raw/arch/outline/riscv64.s":"ca5303c0c8af6de1f246d658003e270d4e29d6c68dd90c6eee372d045bdf7305","src/backend/linux_raw/arch/outline/x86.rs":"f7e12a0f3fe8e97acb1ade2c9e61d82542f00ad4d8fe684a8dcd9f30fd9ab5d4","src/backend/linux_raw/arch/outline/x86.s":"4604e3b41161802343e2e4c890fd2042098a901d95893ebe4c436f97fd47cad3","src/backend/linux_raw/arch/outline/x86_64.s":"a530084cd42ad8d4b2d36526f4e04f45a6e29ea49882e2c561ac2eeac16272bf","src/backend/linux_raw/c.rs":"cb66dbed604eefdafd8a8efd277ddad51bb5280c4e26ca0608176abcd6309a52","src/backend/linux_raw/conv.rs":"6731a2d06683575d7ce89eb83ef8a1993ce39125c30703ed8a4a69afc1e7559f","src/backend/linux_raw/elf.rs":"a257fbc3f22e4970605cf72a3b301dc2eaee2f5f1b3b0ea434fa192db3c3164e","src/backend/linux_raw/fs/dir.rs":"d54842a373968da54bdae73e10ccab7a8bc19c1bc75b6dca2bb70818c5b275ea","src/backend/linux_raw/fs/inotify.rs":"11c058269bc96972ad7bdeaa3a938a8b51b4264d9f80d7dcf0518ac9314a261d","src/backend/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/backend/linux_raw/fs/mod.rs":"e22bf30f312f6a05f1e79f7834c33a3c9821514da05fa4786fc31867203a4c74","src/backend/linux_raw/fs/syscalls.rs":"6900d438f535e586ae8e396aeb52426e1040e4397c942546edada6ff0c121b54","src/backend/linux_raw/fs/types.rs":"a244c59670d65442143b875cccc219bacd0739d35b7f2c1731b15d2c4bf2e900","src/backend/linux_raw/io/epoll.rs":"75de5fe04ed8f85a345ae5b54dc6106268bc05817a4e4abe9cf0bca08e2b1fb3","src/backend/linux_raw/io/errno.rs":"ac32725b1686d42b02d18363c4c44a42ea8c6a20b2422c1fea8f8c39f633f7c4","src/backend/linux_raw/io/io_slice.rs":"5ba992f3fe701184841006588b35f2452156b73e3bef9e07460e4b1f61ac889f","src/backend/linux_raw/io/mod.rs":"6ea805b91d571217c9649364121d0824bbdf4635b36c9150e5968fbeb75c0892","src/backend/linux_raw/io/poll_fd.rs":"9f5a15c80094cc3334acd171c0621d033b44d5d9a987a57acbdcd62cb17d871b","src/backend/linux_raw/io/syscalls.rs":"31bc1a2d74d574923b50aaed3d0d10c2892e7bf6ebf0ccc9bebb42be96b460a0","src/backend/linux_raw/io/types.rs":"11a677499b6b0491f4088f9f87574fe40134bce8042eac0f207b7df905a1f47e","src/backend/linux_raw/io_uring/mod.rs":"2c6478857a0751625edabd61acb841819bfba1093b1faeded15693c805d84952","src/backend/linux_raw/io_uring/syscalls.rs":"2522327e229d85ce207546b802f63fcad49a0ce41b7b881e13a1c2637fdb6095","src/backend/linux_raw/mm/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/mm/syscalls.rs":"647c1846793c386f6babae898686604a4808344ec3e2d1e71071bbfd04079357","src/backend/linux_raw/mm/types.rs":"a5d0ea04a85df5e196d68a8524c4325963c7b2ded3d7d48713c8e855273b60d4","src/backend/linux_raw/mod.rs":"87423ad0e8280081a548e8182139d9e5960258d469951516ca4e8029953daeee","src/backend/linux_raw/net/addr.rs":"9c2b4bc0836618f4b7d997892e5b3980e454bba72fe4d82205d7553ba74ec228","src/backend/linux_raw/net/mod.rs":"4ffd3f6f9cad722e4c29b9bad4912a69f521d737b9e637599a1c60436651d4ae","src/backend/linux_raw/net/read_sockaddr.rs":"0357ae643c384b08578aa0b148ac9b236953da9b36b2e387a40d5b87ae9eccef","src/backend/linux_raw/net/send_recv.rs":"42834cf8148abd02021115a61d57b23bb323dd8ad0d1b9a91d17fb8f7defab01","src/backend/linux_raw/net/syscalls.rs":"aedc536ac96d32bf6e15a9f02f3fe7a1bf48195e9af3afd0a0124636ece8f8b9","src/backend/linux_raw/net/types.rs":"c61b689d7f4b9b68d065935d70926d47b5ac7246b2fbe4f20d144a0c2f417fc2","src/backend/linux_raw/net/write_sockaddr.rs":"ec0bf20a354cb86e2b5646bfc79297a378f11fcdf5641c16e4dd13e305011dc6","src/backend/linux_raw/param/auxv.rs":"9ed73ebd83dd9001dfdecd19b813c6845dad142f79de286993eb520acc7016bc","src/backend/linux_raw/param/libc_auxv.rs":"79fd1b7452f87382fb3a9c8fa892c5adbcc24d3b505bd9ea73e17d37494e749a","src/backend/linux_raw/param/mod.rs":"db21fc1b0ea5568b8649890fa38a878bfcdcf7398f6cf1640176b37bcc6ce990","src/backend/linux_raw/param/mustang_auxv.rs":"016a691236064a9cc28688d4ff5dbd0e37dccfc07b25b943b47762ba1da33b83","src/backend/linux_raw/process/cpu_set.rs":"a333938a4356d117199bf4078688f0a9b876dc65da1bbff7649482f4f0180813","src/backend/linux_raw/process/mod.rs":"fb393c70a9c63ef9a6bf1fb5a2dc94f07d6b0b6987cc5231c15c607015dafd68","src/backend/linux_raw/process/syscalls.rs":"a9c115ae09def33321f266ab3f85cf19fa72fc3b9f425aaa8c517b6da0bce04b","src/backend/linux_raw/process/types.rs":"fba10dc8ca9eaf4d481cb82bd1540cf5c05620533c44f917c09a22ea55ef408c","src/backend/linux_raw/process/wait.rs":"d6c37b9ebca16b447b0bc0d1be4b56486619618e8fc613d10ff9c0ccff13c7ac","src/backend/linux_raw/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/rand/syscalls.rs":"b1d8b2fea0c792bd1e7c24ee59429d178dc0ad442ac817b12c7abcb38d71497b","src/backend/linux_raw/rand/types.rs":"271416d5241d70932b8a17f3b67eefd1b9c360f217f807de3d73192e9b620552","src/backend/linux_raw/reg.rs":"f9ab26b045150894b98c741f9e80ac2734bf7598f5cf166ab080938febe7af20","src/backend/linux_raw/runtime/mod.rs":"b2cae8cce3822c3c92942f06ea0b68464040dcac33c6f0f7ee392c6269993347","src/backend/linux_raw/runtime/syscalls.rs":"6488160051a991e6d385abbf8a08ccd6498acf525906d512b3f89bf3a33fca6a","src/backend/linux_raw/runtime/tls.rs":"2913858a8fe4696f9c3f9a4921f776258a6d1c54b471f813471d57db23fd22ee","src/backend/linux_raw/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/termios/syscalls.rs":"e4476718035ff7520f9014aa0e99954ec741c0dd114ec50ff4900591ee067132","src/backend/linux_raw/termios/types.rs":"5cee3735957db2fdaab341a0c58e438305d6402dc7d23622f4999934d4511b5f","src/backend/linux_raw/thread/futex.rs":"e4ca5be060c52538b97df3781d84e2eb4d8241a7f647b2874412bc0fe6061efa","src/backend/linux_raw/thread/mod.rs":"f7132a68c9db1b4a796781b9e8d0ac268a1ddb713e510bfd43425564ec9b39c4","src/backend/linux_raw/thread/syscalls.rs":"936e0a02027b8f252538781eea7fb9f35bfd23bdd50a1f099172dac2da7d3fde","src/backend/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/backend/linux_raw/time/syscalls.rs":"777d22d6e3ab7c5fe1d5921a91644543173bb4f783fd308b5886fca68500f98c","src/backend/linux_raw/time/types.rs":"865d968a6d2903344982f94c69868031cd1fea582318659ca4c69a11d8a53e33","src/backend/linux_raw/vdso.rs":"3305a5f3c2846440161fa69dde3aafb9f36b361ae2ddae1d12cd54503b0657cf","src/backend/linux_raw/vdso_wrappers.rs":"b7e6b75bf25b0143ec471a7e0af3fd4f4125dcbc6d2c9c0957ec29c428d9d9c5","src/backend/linux_raw/weak.rs":"72ddca9849461a725e5ccd6e2190c12fb9e296c8b8a47533acb9c8cd4f9a2b07","src/const_assert.rs":"ff08ab91f11f2ad29883096f4468bd9a65060d5a9e6681e9282bb081f8bdac27","src/cstr.rs":"976027b6c5cf2c82e369ab7ad9e97fa79d7823ded929c1816f37f97134e51fec","src/ffi/mod.rs":"1990dae8190991142bef24220f02b99c96c5bfa7dda2a7974d9dcac265d58945","src/fs/abs.rs":"16798a8a24be20500bb56a01e05ca4eeccd6f3adb0b3a4bbf1a0369a8e546104","src/fs/at.rs":"035238b63a31aa32cfc7e9ff6bb577e7075dfbeb97d22e67430b7a2bf5432e22","src/fs/constants.rs":"f0153ba1107267e58ee605fdbbeb80e5df56715d8e79c9d6536efe53608b729b","src/fs/copy_file_range.rs":"d3b644374390d482b2ff749a2459458872b57d0dcf9670368739b7833509a7c2","src/fs/cwd.rs":"b2d7fbb27e23704e3367ede9916cc233f76d912be21c2aee8a635eeca627977f","src/fs/dir.rs":"347a52f4ca9ac6321c52e802e97ec90d1b4c62ec955c8996fc17f8f5aed69966","src/fs/fadvise.rs":"beef66ebe1310fb92628240b2cde68f744c78e50f6ff61bb1404bd4868d9cae8","src/fs/fcntl.rs":"43e191732d72a9513f4fbecfee8cbe45b0b1ed0d0097398681a03a8fe2596495","src/fs/fcntl_apple.rs":"07f07b2ac75dc28bc9e08200f72eb95550a87ff3d69c1204f49ecb63a0c4fd20","src/fs/fcopyfile.rs":"ec95929cbbe02cf49233a785e5238931bb107b7903cc5bc95e4231de960995f2","src/fs/fd.rs":"25296739f1063c0e2b4701ff9ce078949a58f62029f57a93cc415d2ded296100","src/fs/file_type.rs":"fefd865f91011f66126213b0994773d99e373b468c31e866002228c98c64ad85","src/fs/getpath.rs":"28f6970fc1bbc37bb35c84724b59eac436ea7407a4522e18c2bdacb1fdd2edd9","src/fs/makedev.rs":"a56b9fa872e5fbf0f358ca14625b050077f45e8e265ba0c8eaeea22c421e0f92","src/fs/memfd_create.rs":"3f1d809e81fe479a82a454a04ea1219a11969d75d0c8b9ddacb09c630a9af896","src/fs/mod.rs":"d396b665d23553f32d148331184df18dd84496979b9e257637881b31e2523a5d","src/fs/mount.rs":"8ab26dcb422825bbd2df2e1f68e6b4f7cf08ce11387c688442ee1b4683b33d4f","src/fs/openat2.rs":"4a95c15dab533a41201b5fa25c8a212956b7571d58cad696bdaf45af8aef96db","src/fs/raw_dir.rs":"d32627abded4cdafa083c579d6f4d9c42e41d2a82749a34e70225e55ff76d246","src/fs/sendfile.rs":"ac053f03608656bb675228ba61079b774498c0233d17e5816ac72538bb12b70e","src/fs/statx.rs":"c7b56787aa0579cfcde230952d87b42256e8b6e85c2da68f78cf31f17ddf5514","src/fs/sync.rs":"a3b23543834281f347b0f873bd38154d31d404871188ac08f2b20b9196234cfd","src/io/close.rs":"c59bf90183625da1b1e87975739469440dcddc7b5b2b6ff3a6fd12b2d399a783","src/io/dup.rs":"92e2121d7fcef657a2bce546dafc9635f97c628c53bb971e8ee08255b77eea80","src/io/errno.rs":"733f8e9246a319db137740e8dca29d7b3c7474a715e066568b1dc82f0944f692","src/io/eventfd.rs":"163aebe29b5a0e21dd9d121d39c71e82bc6569a4bb658026cfef8ee61809066b","src/io/fcntl.rs":"fe73d5593c011b6ac851e608e1776c4483924e19a9f82f5fc8759c498a4e483a","src/io/fd/mod.rs":"a1eab9ce9a2c4454053afdfd3f3705e4cb971e94cc453e4f13690f2f0d83dc2c","src/io/fd/owned.rs":"b3d1ac775461b9206f36df62495604a48820c0284276200101fd1847b0e9e756","src/io/fd/raw.rs":"9bcd00be7df3d9f4e6c49ca2d18ef25aee3d6f0ed5ee6b73df5a9beacefb6031","src/io/ioctl.rs":"98f77d30ca4eebc16454c5307ca4afab2dfdb91b8e90e54d9300f79a2f1ac814","src/io/is_read_write.rs":"072b5ea6ddb2339fc6c7e90dfc5a0a5354d926d0f2ac4df06cadafe823425c47","src/io/kqueue.rs":"b92106e4b1cd2582f8fc37a1ec0dd0aa00b320c8f5b1b91cb487e3620485cbc3","src/io/mod.rs":"646b358718353d7380718a09e87312abfce4d1d48accf6b42c941617f60ca5eb","src/io/pipe.rs":"8f8e3c3557edf13a1e4f05a8a9c2aa5e9ee97e393e02eacc8e8bf60e73e32047","src/io/poll.rs":"41dab55365df215739dcf71815bfc4c2344828d8056ab200564f75210dbc56bd","src/io/port.rs":"8be17096cdfd2425bb2f800d129913e2ed2032c02049d45b7dcda8d4189b1af2","src/io/procfs.rs":"d7b21900416ca54b9bbe683257dd4da1857f56edc25dd78a954dbafed4914ab9","src/io/read_write.rs":"263818a606de191320524972f7c9c22b6f79ddc59c5b0a443b4b726853b00b9f","src/io/seek_from.rs":"d7616a45e8a449df28b075ddded4d7c95d6c4575d6fe0cf0ca7b6625e9dc7eeb","src/io/stdio.rs":"6462b94d1ccd8cff38c6fb6b04199fa9decca91aca63287b0136539d73107bd5","src/io_uring.rs":"26048678d3862cee58bb75e43ad2dc8cae0b9bc79adcd8913cda1fa42af77efd","src/lib.rs":"a221853e71fca50cb6b0b066e3ee8f626cac1fce61fc297458e15bbc8fa1d835","src/mm/madvise.rs":"cdc61b39d8abeea184575ca21e14483c335ce373a86007439fad6e72f58e4e24","src/mm/mmap.rs":"ac25cf39d215c93b539f20a60b107ea15dc8a0faa8d25e0de05d1415e698c742","src/mm/mod.rs":"1a46082151c2ef319667078923df74b01d4a94d25d3777083775179bda8bf3bf","src/mm/msync.rs":"a7f61abe4cb5e96f95ae8229c62b9ecc08382080ed99d76278be7001cfcf82f2","src/mm/userfaultfd.rs":"8073443bd181ff0b3ba4d0b1ae67370b4864035a0c8b4898cd709dc47c518ae7","src/net/addr.rs":"6fce66cd0ccac3bcc2339f32faf2ed1bac94a6d8824acb55bffdfaa43090675a","src/net/ip.rs":"080dd17c44b395b46b0d9e70da76f376540f92ece65f79e3d242c0a272d3b451","src/net/mod.rs":"03e600b3890f94e06f10120ca8dc9251920eec4aabe7d983d24e800faa079aa7","src/net/send_recv.rs":"f1fb0b9be750b1949b54054b3195904123cfb96f2ee0ebcedef86fc7175c63e9","src/net/socket.rs":"c510a2b619b8c91c9ee15b1a9b29d6fe89a97e83143a38bea017af7522b7e8b9","src/net/socket_addr_any.rs":"d95c7002972fa98d4133e10ad6c404399494374d568816217edcb9f4fd93aad8","src/net/socketpair.rs":"b005b019f8ae0f022fd0e730dafb258606f1f537e4448078175fc192d002dc81","src/net/sockopt.rs":"dde47b9d5d6de9749bdddb1498920f2f592582b11b508389bf78d0d5f0c4af00","src/net/wsa.rs":"6e546b42f50a851fc833c57cda76cfb347203ed4b0dea574a3d325bf5a2ebf80","src/param/auxv.rs":"988872f9bec2e12f35765ae8963cbb9535d4acaedd4c9a4d07ced6feb70e0aaa","src/param/init.rs":"671d8974f0d9b82e79076d1f4deabe0273a874a329f74b8aad26e07b86791ba3","src/param/mod.rs":"959d6bd6c7abb85e042f86047fb902891c5deb74c550ce21dac96fb9a9f16d36","src/path/arg.rs":"eb45cea7b5b21af36fef130cc02cbbf7fcceb965815b66c95c46979e0cbe2875","src/path/dec_int.rs":"a512618714fc3309253f65de605121c2aa056a780f9ab1de55f5a86469895295","src/path/mod.rs":"513fea21b1ba0226c3c5da769ded06a7cd7abe9f49cec9d165bc62a15da126a8","src/process/chdir.rs":"4c63c351e207b1bbefdd7c001e85fed383d5ac2147894d5a09fbd8b302d7c728","src/process/exit.rs":"79f6c0dd45dca0a2bea919ac920c4a56cea23608a345961e4d027aee6624783c","src/process/id.rs":"f04877bfd49fb8eda89e12ca44f271dfe92c1661f97b304c2dd234671cfbaabc","src/process/kill.rs":"e4b4dcc7e5b2a1e3e68ce03ce9a5dde43108dae4ddbc443488c464194738d06f","src/process/membarrier.rs":"19f42cb66f211e8b23f4586bf29fdfa29c29e4e9169a06f3cc7b54aad4ef94e6","src/process/mod.rs":"17abc24217e8b48d623d02b1a2955e6b62aab496362ba312122caf90500576a1","src/process/pidfd.rs":"88517949097414b77540b1c0801bdd034c28667b9386c0676cdaa1b637129ffa","src/process/prctl.rs":"7f4f2870eddcb19829b29ba139492d0f8b5006a42047f4e733e105b82afaef8b","src/process/priority.rs":"ddfdeda52acbca8566dd3517f167f7e29e3daa7e71c3ebae4183f8cf4f309b0a","src/process/procctl.rs":"4d48638f4d39a20aa073798778f431bbb944ed184777960ef1f80bebbc7fc72b","src/process/rlimit.rs":"97c1e41533c74b5b71e471d1ed0a83a847b804da9e53be76c50f0187ac5d3eec","src/process/sched.rs":"ea8b20942ef09dbcd7a54d8218435129dfece427e4960055bcdf81c997e80f5f","src/process/sched_yield.rs":"6565faa3928b66ddc74a65e893e15edfa4b9be4f7e5f5f68527501a7f6bc3350","src/process/umask.rs":"f664e46dc6990a550d5ead5e394bfd90767bcb875c53722a5fb92823e15d8882","src/process/uname.rs":"3bcc278449d6b83aa8747bfde85d696293c50a3fa60d88c4a5570b38ef8af25b","src/process/wait.rs":"2f8716a58594df9c8cfd5a712d68f7dc9b3131fefdf80e868a4360336954e2e5","src/rand/getrandom.rs":"7ad1be6a5b0dc25030bb2434bdc00f3a0c410b7ebc24c136b9839410bf6c5a97","src/rand/mod.rs":"bd6839924ebfb7092f27f2ad42323768f39f76df157e7b8aa42f5bc17f700c9c","src/runtime.rs":"7c60353f240f1bda8b0fbfb7c570b7577cc5076a0d2f74083d8d878a2d69bf2d","src/termios/cf.rs":"cb13ee88cba541cbd683c7a5da034a126fd9e09dc6b5f25c9f32382f8318ffc0","src/termios/constants.rs":"7855cebd1e2169a2a760c6752138b3de1be00fd3b907b049d32ad5d6bdb0426e","src/termios/mod.rs":"b4d28ebeeae6782b4060d3e6f0156ed63bafa155d1bbdae9e28d06e574d69cb7","src/termios/tc.rs":"ae5d8799123747950c7f20ca3abaa3ec1918462ed95d1e78d07bcb491aedcccf","src/termios/tty.rs":"409ddcc795ed1e644d302cdcfdffff8713657bf8777548e628f0b1149acb18af","src/thread/clock.rs":"4e3f54aa5b50443bf502a81ee4814b3522e928e3b06241d24f924a6f69953662","src/thread/futex.rs":"4e78c84589b535ca9ca633633696ef212393a98f2890b181acaa8f908fbc5ae2","src/thread/id.rs":"708ee7701a0811586717de147365ed2f496e1aad3fd6208fe08edacc63a40c78","src/thread/libcap.rs":"43a05e127ae57ecd8b93752571d1cac3359bebe265c964f1825eefe1cee25a42","src/thread/mod.rs":"a3839e32f920fa4be0812f6d40b677968cb3d9e99aa0af65c87ceb8ce015fdc9","src/thread/prctl.rs":"32d9b6c8854547ba5d509af39e3f690588d761f254875a8054827aa815750b3c","src/thread/setns.rs":"5e08f98300e2ca8fc99272cf5408f0b27cb4c8ece54d76b92ede656982f11e69","src/time/clock.rs":"fcaa5a68d31d1cb1cee20c9ffc2c223f16036810b45234da97716d7f0e34f773","src/time/mod.rs":"b8b7c5d2bdba60a69e8a557ce7017e4251a41f5633aec928da059c49bc080cfa","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/utils.rs":"6ed86e62ac05d6279b664a97fd62878a4c1811ab66a1a2920b169eb74c0c1fcd"},"package":"d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849"} \ No newline at end of file
diff --git a/vendor/rustix/Cargo.toml b/vendor/rustix/Cargo.toml
index ed3e5b623..b560499a8 100644
--- a/vendor/rustix/Cargo.toml
+++ b/vendor/rustix/Cargo.toml
@@ -13,7 +13,7 @@
edition = "2018"
rust-version = "1.48"
name = "rustix"
-version = "0.36.5"
+version = "0.37.6"
authors = [
"Dan Gohman <dev@sunfishcode.online>",
"Jakub Konka <kubkon@jakubkonka.com>",
@@ -57,6 +57,15 @@ targets = [
"i686-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
+ "x86_64-unknown-freebsd",
+ "x86_64-unknown-openbsd",
+ "x86_64-unknown-netbsd",
+ "x86_64-unknown-dragonfly",
+ "x86_64-unknown-illumos",
+ "x86_64-unknown-redox",
+ "x86_64-unknown-haiku",
+ "wasm32-unknown-emscripten",
+ "wasm32-wasi",
]
[[bench]]
@@ -100,21 +109,21 @@ features = ["close"]
default-features = false
[dev-dependencies.libc]
-version = "0.2.133"
+version = "0.2.140"
[dev-dependencies.libc_errno]
-version = "0.2.8"
+version = "0.3.0"
default-features = false
package = "errno"
[dev-dependencies.memoffset]
-version = "0.7.1"
+version = "0.8.0"
[dev-dependencies.serial_test]
version = "0.6"
[dev-dependencies.tempfile]
-version = "3.2.0"
+version = "3.4.0"
[build-dependencies.cc]
version = "1.0.68"
@@ -149,6 +158,8 @@ io_uring = [
"fs",
"net",
]
+linux_4_11 = []
+linux_latest = ["linux_4_11"]
mm = []
net = []
os_pipe = ["io-lifetimes/os_pipe"]
@@ -179,7 +190,7 @@ use-libc = [
use-libc-auxv = ["libc"]
[target."cfg(all(any(target_os = \"android\", target_os = \"linux\"), any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\"))))))))".dependencies.linux-raw-sys]
-version = "0.1.2"
+version = "0.3.0"
features = [
"general",
"no_std",
@@ -190,18 +201,18 @@ default-features = false
version = "0.4"
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))".dependencies.libc]
-version = "0.2.133"
+version = "0.2.140"
features = ["extra_traits"]
optional = true
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))".dependencies.libc_errno]
-version = "0.2.8"
+version = "0.3.0"
optional = true
default-features = false
package = "errno"
[target."cfg(all(not(rustix_use_libc), not(miri), target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))".dependencies.linux-raw-sys]
-version = "0.1.2"
+version = "0.3.0"
features = [
"general",
"errno",
@@ -211,11 +222,11 @@ features = [
default-features = false
[target."cfg(any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))))".dependencies.libc]
-version = "0.2.133"
+version = "0.2.140"
features = ["extra_traits"]
[target."cfg(any(rustix_use_libc, miri, not(all(target_os = \"linux\", any(target_arch = \"x86\", all(target_arch = \"x86_64\", target_pointer_width = \"64\"), all(target_endian = \"little\", any(target_arch = \"arm\", all(target_arch = \"aarch64\", target_pointer_width = \"64\"), target_arch = \"powerpc64\", target_arch = \"riscv64\", target_arch = \"mips\", target_arch = \"mips64\")))))))".dependencies.libc_errno]
-version = "0.2.8"
+version = "0.3.0"
default-features = false
package = "errno"
@@ -224,7 +235,7 @@ version = "1.5.2"
optional = true
[target."cfg(windows)".dependencies.windows-sys]
-version = "0.42.0"
+version = "0.45.0"
features = [
"Win32_Foundation",
"Win32_Networking_WinSock",
diff --git a/vendor/rustix/README.md b/vendor/rustix/README.md
index 8ef865387..792dd1197 100644
--- a/vendor/rustix/README.md
+++ b/vendor/rustix/README.md
@@ -26,8 +26,8 @@ conveniences.
`rustix` is low-level and, and while the `net` API supports Winsock2 on
Windows, the rest of the APIs do not support Windows; for higher-level and more
-portable APIs built on this functionality, see the [`system-interface`],
-[`cap-std`], and [`fs-set-times`] crates, for example.
+portable APIs built on this functionality, see the [`cap-std`], [`memfd`],
+[`timerfd`], and [`io-streams`] crates, for example.
`rustix` currently has two backends available:
@@ -70,20 +70,27 @@ by default. The rest of the API is conditional with cargo feature flags:
| |
| `use-libc` | Enable the libc backend.
-[`rustix::fs`]: https://docs.rs/rustix/latest/rustix/fs/index.html
-[`rustix::io_uring`]: https://docs.rs/rustix/latest/rustix/io_uring/index.html
-[`rustix::mm`]: https://docs.rs/rustix/latest/rustix/mm/index.html
-[`rustix::net`]: https://docs.rs/rustix/latest/rustix/net/index.html
-[`rustix::param`]: https://docs.rs/rustix/latest/rustix/param/index.html
-[`rustix::process`]: https://docs.rs/rustix/latest/rustix/process/index.html
-[`rustix::rand`]: https://docs.rs/rustix/latest/rustix/rand/index.html
-[`rustix::termios`]: https://docs.rs/rustix/latest/rustix/termios/index.html
-[`rustix::thread`]: https://docs.rs/rustix/latest/rustix/thread/index.html
-[`rustix::time`]: https://docs.rs/rustix/latest/rustix/time/index.html
-[`rustix::io`]: https://docs.rs/rustix/latest/rustix/io/index.html
-[`rustix::fd`]: https://docs.rs/rustix/latest/rustix/fd/index.html
-[`rustix::ffi`]: https://docs.rs/rustix/latest/rustix/ffi/index.html
-[`rustix::path`]: https://docs.rs/rustix/latest/rustix/path/index.html
+[`rustix::fs`]: https://docs.rs/rustix/*/rustix/fs/index.html
+[`rustix::io_uring`]: https://docs.rs/rustix/*/rustix/io_uring/index.html
+[`rustix::mm`]: https://docs.rs/rustix/*/rustix/mm/index.html
+[`rustix::net`]: https://docs.rs/rustix/*/rustix/net/index.html
+[`rustix::param`]: https://docs.rs/rustix/*/rustix/param/index.html
+[`rustix::process`]: https://docs.rs/rustix/*/rustix/process/index.html
+[`rustix::rand`]: https://docs.rs/rustix/*/rustix/rand/index.html
+[`rustix::termios`]: https://docs.rs/rustix/*/rustix/termios/index.html
+[`rustix::thread`]: https://docs.rs/rustix/*/rustix/thread/index.html
+[`rustix::time`]: https://docs.rs/rustix/*/rustix/time/index.html
+[`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
+
+`rustix` automatically uses 64-bit APIs when available, and avoids exposing
+32-bit APIs that would have the year-2038 problem or fail to support large
+files. For instance, `rustix::fstatvfs` calls `fstatvfs64`, and returns a
+struct that's 64-bit even on 32-bit platforms.
## Similar crates
@@ -104,7 +111,7 @@ features for `rustix`.
`rustix` has its own code for making direct syscalls, similar to the [`sc`] and
[`scall`] crates, though `rustix` can use either the Rust `asm!` macro or
-out-of-line `.s` files so it supports Rust versions from 1.48 though Nightly.
+out-of-line `.s` files so it supports Rust versions from 1.48 through Nightly.
`rustix` can also use Linux's vDSO mechanism to optimize Linux `clock_gettime`
on all architectures, and all Linux system calls on x86. And `rustix`'s
syscalls report errors using an optimized `Errno` type.
@@ -114,14 +121,14 @@ provides them as free functions rather than associated functions of a `Dir`
type. `rustix`'s `cwd()` function exposes the special `AT_FDCWD` value in a safe
way, so users don't need to open `.` to get a current-directory handle.
-`rustix`'s `openat2` function is similar to the [`openat2`] crate, but uses
-I/O safety types rather than `RawFd`. `rustix` does not provide dynamic feature
+`rustix`'s `openat2` function is similar to the [`openat2`] crate, but uses I/O
+safety types rather than `RawFd`. `rustix` does not provide dynamic feature
detection, so users must handle the [`NOSYS`] error themselves.
-`rustix`'s `termios` module is similar to the [`termios`] crate, but uses
-I/O safety types rather than `RawFd`, and the flags parameters to functions
-such as `tcsetattr` are `enum`s rather than bare integers. And, rustix calls
-its `tcgetattr` function `tcgetattr`, rather than `Termios::from_fd`.
+`rustix`'s `termios` module is similar to the [`termios`] crate, but uses I/O
+safety types rather than `RawFd`, and the flags parameters to functions such as
+`tcsetattr` are `enum`s rather than bare integers. And, rustix calls its
+`tcgetattr` function `tcgetattr`, rather than `Termios::from_fd`.
## Minimum Supported Rust Version (MSRV)
@@ -140,7 +147,6 @@ version of this crate.
[`syscall`]: https://crates.io/crates/syscall
[`sc`]: https://crates.io/crates/sc
[`scall`]: https://crates.io/crates/scall
-[`system-interface`]: https://crates.io/crates/system-interface
[`openat`]: https://crates.io/crates/openat
[`openat2`]: https://crates.io/crates/openat2
[`fs-set-times`]: https://crates.io/crates/fs-set-times
@@ -149,11 +155,14 @@ version of this crate.
[`libc`]: https://crates.io/crates/libc
[`windows-sys`]: https://crates.io/crates/windows-sys
[`cap-std`]: https://crates.io/crates/cap-std
+[`memfd`]: https://crates.io/crates/memfd
+[`timerfd`]: https://crates.io/crates/timerfd
+[`io-streams`]: https://crates.io/crates/io-streams
[`bitflags`]: https://crates.io/crates/bitflags
-[`Arg`]: https://docs.rs/rustix/latest/rustix/path/trait.Arg.html
+[`Arg`]: https://docs.rs/rustix/*/rustix/path/trait.Arg.html
[I/O-safe]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
[I/O safety]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
[provenance]: https://github.com/rust-lang/rust/issues/95228
-[`OwnedFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/struct.OwnedFd.html
-[`AsFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/trait.AsFd.html
-[`NOSYS`]: https://docs.rs/rustix/latest/rustix/io/struct.Errno.html#associatedconstant.NOSYS
+[`OwnedFd`]: https://docs.rs/io-lifetimes/*/io_lifetimes/struct.OwnedFd.html
+[`AsFd`]: https://docs.rs/io-lifetimes/*/io_lifetimes/trait.AsFd.html
+[`NOSYS`]: https://docs.rs/rustix/*/rustix/io/struct.Errno.html#associatedconstant.NOSYS
diff --git a/vendor/rustix/benches/mod.rs b/vendor/rustix/benches/mod.rs
index 06831362f..ee7358cc2 100644
--- a/vendor/rustix/benches/mod.rs
+++ b/vendor/rustix/benches/mod.rs
@@ -1,7 +1,11 @@
-/// Benchmarks for rustix.
-///
-/// To enable these benchmarks, add `--cfg=criterion` to RUSTFLAGS and enable
-/// the "fs", "time", and "process" cargo features.
+//! Benchmarks for rustix.
+//!
+//! To enable these benchmarks, add `--cfg=criterion` to RUSTFLAGS and enable
+//! the "fs", "time", and "process" cargo features.
+//!
+//! ```sh
+//! RUSTFLAGS=--cfg=criterion cargo bench --features=fs,time,process
+//! ```
#[cfg(any(
not(criterion),
@@ -14,7 +18,7 @@
target_os = "wasi",
))]
fn main() {
- unimplemented!()
+ unimplemented!("Add --cfg=criterion to RUSTFLAGS and enable the \"fs\", \"time\", and \"process\" cargo features.")
}
#[cfg(not(any(
diff --git a/vendor/rustix/build.rs b/vendor/rustix/build.rs
index 56c6b1557..d8d1c8bd6 100644
--- a/vendor/rustix/build.rs
+++ b/vendor/rustix/build.rs
@@ -26,7 +26,7 @@ fn main() {
let arch = var("CARGO_CFG_TARGET_ARCH").unwrap();
let asm_name = format!("{}/{}.s", OUTLINE_PATH, arch);
let asm_name_present = std::fs::metadata(&asm_name).is_ok();
- let os_name = var("CARGO_CFG_TARGET_OS").unwrap();
+ let target_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();
@@ -69,7 +69,7 @@ fn main() {
// install the toolchain for it.
if feature_use_libc
|| cfg_use_libc
- || os_name != "linux"
+ || target_os != "linux"
|| !asm_name_present
|| is_unsupported_abi
|| miri
@@ -106,7 +106,47 @@ fn main() {
use_feature("thumb_mode");
}
+ // 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" {
+ use_feature("freebsdlike");
+ }
+ if target_os == "openbsd" || target_os == "netbsd" {
+ use_feature("netbsdlike");
+ }
+ if target_os == "macos" || target_os == "ios" || target_os == "tvos" || target_os == "watchos" {
+ use_feature("apple");
+ }
+ if target_os == "linux"
+ || target_os == "l4re"
+ || target_os == "android"
+ || target_os == "emscripten"
+ {
+ use_feature("linux_like");
+ }
+ if target_os == "solaris" || target_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"
+ {
+ use_feature("bsd");
+ }
+
println!("cargo:rerun-if-env-changed=CARGO_CFG_RUSTIX_USE_EXPERIMENTAL_ASM");
+ println!("cargo:rerun-if-env-changed=CARGO_CFG_RUSTIX_USE_LIBC");
+
+ // Rerun this script if any of our features or configuration flags change,
+ // or if the toolchain we used for feature detection changes.
+ println!("cargo:rerun-if-env-changed=CARGO_FEATURE_USE_LIBC");
+ println!("cargo:rerun-if-env-changed=CARGO_FEATURE_RUSTC_DEP_OF_STD");
+ println!("cargo:rerun-if-env-changed=CARGO_CFG_MIRI");
}
/// Link in the desired version of librustix_outline_{arch}.a, containing the
@@ -130,7 +170,15 @@ fn link_in_librustix_outline(arch: &str, asm_name: &str) {
#[cfg(feature = "cc")]
{
let out_dir = var("OUT_DIR").unwrap();
- Build::new().file(&asm_name).compile(&name);
+ // Add `-gdwarf-3` so that we always get the same output, regardless of
+ // the Rust version we're using. DWARF3 is the version used in
+ // Rust 1.48 and 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);
@@ -173,33 +221,60 @@ fn use_feature(feature: &str) {
/// Test whether the rustc at `var("RUSTC")` supports the given feature.
fn has_feature(feature: &str) -> bool {
- can_compile(&format!(
+ can_compile(format!(
"#![allow(stable_features)]\n#![feature({})]",
feature
))
}
/// Test whether the rustc at `var("RUSTC")` can compile the given code.
-fn can_compile(code: &str) -> bool {
+fn can_compile<T: AsRef<str>>(test: T) -> bool {
use std::process::Stdio;
+
let out_dir = var("OUT_DIR").unwrap();
let rustc = var("RUSTC").unwrap();
let target = var("TARGET").unwrap();
- let mut child = std::process::Command::new(rustc)
- .arg("--crate-type=rlib") // Don't require `main`.
+ // 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()
+ .and_then(|w| if w.is_empty() { None } else { Some(w) });
+
+ let mut cmd = if let Some(wrapper) = wrapper {
+ let mut cmd = std::process::Command::new(wrapper);
+ // The wrapper's first argument is supposed to be the path to rustc.
+ cmd.arg(rustc);
+ cmd
+ } else {
+ std::process::Command::new(rustc)
+ };
+
+ cmd.arg("--crate-type=rlib") // Don't require `main`.
.arg("--emit=metadata") // Do as little as possible but still parse.
.arg("--target")
.arg(target)
.arg("--out-dir")
- .arg(out_dir) // Put the output somewhere inconsequential.
+ .arg(out_dir); // Put the output somewhere inconsequential.
+
+ // If Cargo wants to set RUSTFLAGS, use that.
+ if let Ok(rustflags) = var("CARGO_ENCODED_RUSTFLAGS") {
+ if !rustflags.is_empty() {
+ for arg in rustflags.split('\x1f') {
+ cmd.arg(arg);
+ }
+ }
+ }
+
+ let mut child = cmd
.arg("-") // Read from stdin.
.stdin(Stdio::piped()) // Stdin is a pipe.
- .stderr(Stdio::null())
+ .stderr(Stdio::null()) // Errors from feature detection aren't interesting and can be confusing.
.spawn()
.unwrap();
- writeln!(child.stdin.take().unwrap(), "{}", code).unwrap();
+ writeln!(child.stdin.take().unwrap(), "{}", test.as_ref()).unwrap();
child.wait().unwrap().success()
}
diff --git a/vendor/rustix/src/backend/libc/c.rs b/vendor/rustix/src/backend/libc/c.rs
new file mode 100644
index 000000000..35d24d893
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/c.rs
@@ -0,0 +1,9 @@
+pub(crate) use libc::*;
+
+/// `PROC_SUPER_MAGIC`—The magic number for the procfs filesystem.
+#[cfg(all(any(target_os = "android", target_os = "linux"), target_env = "musl"))]
+pub(crate) const PROC_SUPER_MAGIC: u32 = 0x0000_9fa0;
+
+/// `NFS_SUPER_MAGIC`—The magic number for the NFS filesystem.
+#[cfg(all(any(target_os = "android", target_os = "linux"), target_env = "musl"))]
+pub(crate) const NFS_SUPER_MAGIC: u32 = 0x0000_6969;
diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs
index 6b69c3600..d1c901323 100644
--- a/vendor/rustix/src/backend/libc/fs/dir.rs
+++ b/vendor/rustix/src/backend/libc/fs/dir.rs
@@ -1,6 +1,6 @@
use super::super::c;
use super::super::conv::owned_fd;
-#[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+#[cfg(not(any(solarish, target_os = "haiku")))]
use super::types::FileType;
use crate::fd::{AsFd, BorrowedFd};
use crate::ffi::CStr;
@@ -8,48 +8,25 @@ use crate::ffi::CStr;
use crate::ffi::CString;
use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat};
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
use crate::fs::{fstatfs, StatFs};
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use crate::fs::{fstatvfs, StatVfs};
use crate::io;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
use crate::process::fchdir;
#[cfg(target_os = "wasi")]
use alloc::borrow::ToOwned;
-#[cfg(not(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
- target_os = "openbsd",
-)))]
+#[cfg(not(any(linux_like, target_os = "openbsd")))]
use c::dirent as libc_dirent;
-#[cfg(not(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
-)))]
+#[cfg(not(linux_like))]
use c::readdir as libc_readdir;
-#[cfg(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
-))]
+#[cfg(linux_like)]
use c::{dirent64 as libc_dirent, readdir64 as libc_readdir};
use core::fmt;
use core::mem::zeroed;
@@ -139,11 +116,10 @@ impl Dir {
/// `fstatfs(self)`
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[inline]
@@ -152,13 +128,7 @@ impl Dir {
}
/// `fstatvfs(self)`
- #[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub fn statvfs(&self) -> io::Result<StatVfs> {
fstatvfs(unsafe { BorrowedFd::borrow_raw(c::dirfd(self.0.as_ptr())) })
@@ -176,21 +146,14 @@ impl Dir {
// struct, as the name is NUL-terminated and memory may not be allocated for
// the full extent of the struct. Copy the fields one at a time.
unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
- #[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "solaris"
- )))]
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
let d_type = input.d_type;
#[cfg(not(any(
+ apple,
+ freebsdlike,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
target_os = "wasi",
)))]
@@ -199,36 +162,19 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
#[cfg(target_os = "aix")]
let d_offset = input.d_offset;
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(freebsdlike, netbsdlike)))]
let d_ino = input.d_ino;
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "netbsd",
- target_os = "openbsd"
- ))]
+ #[cfg(any(freebsdlike, netbsdlike))]
let d_fileno = input.d_fileno;
#[cfg(not(any(target_os = "dragonfly", target_os = "wasi")))]
let d_reclen = input.d_reclen;
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "ios",
- target_os = "macos",
- ))]
+ #[cfg(any(bsd, target_os = "aix"))]
let d_namlen = input.d_namlen;
- #[cfg(any(target_os = "ios", target_os = "macos"))]
+ #[cfg(apple)]
let d_seekoff = input.d_seekoff;
#[cfg(target_os = "haiku")]
@@ -242,43 +188,30 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
// with a field that we missed here. And we can avoid blindly copying the
// whole `d_name` field, which may not be entirely allocated.
#[cfg_attr(target_os = "wasi", allow(unused_mut))]
- #[cfg(not(any(target_os = "freebsd", target_os = "dragonfly")))]
+ #[cfg(not(freebsdlike))]
let mut dirent = libc_dirent {
- #[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "solaris"
- )))]
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
d_type,
#[cfg(not(any(
+ apple,
target_os = "aix",
target_os = "freebsd", // Until FreeBSD 12
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
target_os = "wasi",
)))]
d_off,
#[cfg(target_os = "aix")]
d_offset,
- #[cfg(not(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
+ #[cfg(not(any(netbsdlike, target_os = "freebsd")))]
d_ino,
- #[cfg(any(target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))]
+ #[cfg(any(netbsdlike, target_os = "freebsd"))]
d_fileno,
#[cfg(not(target_os = "wasi"))]
d_reclen,
- #[cfg(any(
- target_os = "aix",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(apple, netbsdlike, target_os = "aix", target_os = "freebsd"))]
d_namlen,
- #[cfg(any(target_os = "ios", target_os = "macos"))]
+ #[cfg(apple)]
d_seekoff,
// The `d_name` field is NUL-terminated, and we need to be careful not
// to read bytes past the NUL, even though they're within the nominal
@@ -304,11 +237,11 @@ unsafe fn read_dirent(input: &libc_dirent) -> libc_dirent {
pub d_pino: i64,
pub d_reclen: ::c_ushort,
pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX
- // */
+ */
// On dragonfly and FreeBSD 12, `dirent` has some non-public padding fields
// so we can't directly initialize it.
- #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+ #[cfg(freebsdlike)]
let mut dirent = {
let mut dirent: libc_dirent = zeroed();
dirent.d_fileno = d_fileno;
@@ -386,36 +319,21 @@ impl DirEntry {
}
/// Returns the type of this directory entry.
- #[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "solaris"
- )))]
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
#[inline]
pub fn file_type(&self) -> FileType {
FileType::from_dirent_d_type(self.dirent.d_type)
}
/// Return the inode number of this directory entry.
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(freebsdlike, netbsdlike)))]
#[inline]
pub fn ino(&self) -> u64 {
self.dirent.d_ino as u64
}
/// Return the inode number of this directory entry.
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(freebsdlike, netbsdlike))]
#[inline]
pub fn ino(&self) -> u64 {
#[allow(clippy::useless_conversion)]
diff --git a/vendor/rustix/src/backend/libc/fs/inotify.rs b/vendor/rustix/src/backend/libc/fs/inotify.rs
new file mode 100644
index 000000000..8a42e0583
--- /dev/null
+++ b/vendor/rustix/src/backend/libc/fs/inotify.rs
@@ -0,0 +1,121 @@
+//! inotify support for working with inotifies
+
+use super::super::c;
+use super::super::conv::{borrowed_fd, c_str, ret, ret_c_int, ret_owned_fd};
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::io;
+use bitflags::bitflags;
+
+bitflags! {
+ /// `IN_*` for use with [`inotify_init`].
+ ///
+ /// [`inotify_init`]: crate::fs::inotify::inotify_init
+ pub struct CreateFlags: c::c_int {
+ /// `IN_CLOEXEC`
+ const CLOEXEC = c::IN_CLOEXEC;
+ /// `IN_NONBLOCK`
+ const NONBLOCK = c::IN_NONBLOCK;
+ }
+}
+
+bitflags! {
+ /// `IN*` for use with [`inotify_add_watch`].
+ ///
+ /// [`inotify_add_watch`]: crate::fs::inotify::inotify_add_watch
+ #[derive(Default)]
+ pub struct WatchFlags: u32 {
+ /// `IN_ACCESS`
+ const ACCESS = c::IN_ACCESS;
+ /// `IN_ATTRIB`
+ const ATTRIB = c::IN_ATTRIB;
+ /// `IN_CLOSE_NOWRITE`
+ const CLOSE_NOWRITE = c::IN_CLOSE_NOWRITE;
+ /// `IN_CLOSE_WRITE`
+ const CLOSE_WRITE = c::IN_CLOSE_WRITE;
+ /// `IN_CREATE `
+ const CREATE = c::IN_CREATE;
+ /// `IN_DELETE`
+ const DELETE = c::IN_DELETE;
+ /// `IN_DELETE_SELF`
+ const DELETE_SELF = c::IN_DELETE_SELF;
+ /// `IN_MODIFY`
+ const MODIFY = c::IN_MODIFY;
+ /// `IN_MOVE_SELF`
+ const MOVE_SELF = c::IN_MOVE_SELF;
+ /// `IN_MOVED_FROM`
+ const MOVED_FROM = c::IN_MOVED_FROM;
+ /// `IN_MOVED_TO`
+ const MOVED_TO = c::IN_MOVED_TO;
+ /// `IN_OPEN`
+ const OPEN = c::IN_OPEN;
+
+ /// `IN_CLOSE`
+ const CLOSE = c::IN_CLOSE;
+ /// `IN_MOVE`
+ const MOVE = c::IN_MOVE;
+ /// `IN_ALL_EVENTS`
+ const ALL_EVENTS = c::IN_ALL_EVENTS;
+
+ /// `IN_DONT_FOLLOW`
+ const DONT_FOLLOW = c::IN_DONT_FOLLOW;
+ /// `IN_EXCL_UNLINK`
+ const EXCL_UNLINK = 1;
+ /// `IN_MASK_ADD`
+ const MASK_ADD = 1;
+ /// `IN_MASK_CREATE`
+ const MASK_CREATE = 1;
+ /// `IN_ONESHOT`
+ const ONESHOT = c::IN_ONESHOT;
+ /// `IN_ONLYDIR`
+ const ONLYDIR = c::IN_ONLYDIR;
+ }
+}
+
+/// `inotify_init1(flags)`—Creates a new inotify object.
+///
+/// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
+/// descriptor from being implicitly passed across `exec` boundaries.
+#[doc(alias = "inotify_init1")]
+pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
+ // SAFETY: `inotify_init1` has no safety preconditions.
+ unsafe { ret_owned_fd(c::inotify_init1(flags.bits())) }
+}
+
+/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify
+///
+/// This registers or updates a watch for the filesystem path `path`
+/// and returns a watch descriptor corresponding to this watch.
+///
+/// Note: Due to the existence of hardlinks, providing two
+/// different paths to this method may result in it returning
+/// the same watch descriptor. An application should keep track of this
+/// externally to avoid logic errors.
+pub fn inotify_add_watch<P: crate::path::Arg>(
+ inot: BorrowedFd<'_>,
+ path: P,
+ flags: WatchFlags,
+) -> io::Result<i32> {
+ let path = path.as_cow_c_str().unwrap();
+ // SAFETY: The fd and path we are passing is guaranteed valid by the type
+ // system.
+ unsafe {
+ ret_c_int(c::inotify_add_watch(
+ borrowed_fd(inot),
+ c_str(&path),
+ flags.bits(),
+ ))
+ }
+}
+
+/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify
+///
+/// The watch descriptor provided should have previously been returned
+/// by [`inotify_add_watch`] and not previously have been removed.
+#[doc(alias = "inotify_rm_watch")]
+pub fn inotify_remove_watch(inot: BorrowedFd<'_>, wd: i32) -> io::Result<()> {
+ // Android's `inotify_rm_watch` takes u32 despite `inotify_add_watch` is i32.
+ #[cfg(target_os = "android")]
+ let wd = wd as u32;
+ // SAFETY: The fd is valid and closing an arbitrary wd is valid.
+ unsafe { ret(c::inotify_rm_watch(borrowed_fd(inot), wd)) }
+}
diff --git a/vendor/rustix/src/backend/libc/fs/makedev.rs b/vendor/rustix/src/backend/libc/fs/makedev.rs
index 08ecd872e..afe942a59 100644
--- a/vendor/rustix/src/backend/libc/fs/makedev.rs
+++ b/vendor/rustix/src/backend/libc/fs/makedev.rs
@@ -2,7 +2,12 @@
use super::super::c;
use crate::fs::Dev;
-#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
+#[cfg(not(any(
+ apple,
+ target_os = "aix",
+ target_os = "android",
+ target_os = "emscripten",
+)))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
c::makedev(maj, min)
@@ -11,7 +16,6 @@ pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
#[cfg(all(target_os = "android", not(target_pointer_width = "32")))]
#[inline]
pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
- // Android's `makedev` oddly has signed argument types.
c::makedev(maj, min)
}
@@ -33,7 +37,27 @@ pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
Dev::from(c::makedev(maj, min))
}
-#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
+#[cfg(apple)]
+#[inline]
+pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
+ // Apple's `makedev` oddly has signed argument types and is `unsafe`.
+ unsafe { c::makedev(maj as i32, min as i32) }
+}
+
+#[cfg(target_os = "aix")]
+#[inline]
+pub(crate) fn makedev(maj: u32, min: u32) -> Dev {
+ // AIX's `makedev` oddly is `unsafe`.
+ unsafe { c::makedev(maj, min) }
+}
+
+#[cfg(not(any(
+ apple,
+ freebsdlike,
+ netbsdlike,
+ target_os = "android",
+ target_os = "emscripten",
+)))]
#[inline]
pub(crate) fn major(dev: Dev) -> u32 {
unsafe { c::major(dev) }
@@ -61,7 +85,13 @@ pub(crate) fn major(dev: Dev) -> u32 {
unsafe { c::major(dev as u32) }
}
-#[cfg(not(any(target_os = "android", target_os = "emscripten")))]
+#[cfg(not(any(
+ apple,
+ freebsdlike,
+ netbsdlike,
+ target_os = "android",
+ target_os = "emscripten",
+)))]
#[inline]
pub(crate) fn minor(dev: Dev) -> u32 {
unsafe { c::minor(dev) }
diff --git a/vendor/rustix/src/backend/libc/fs/mod.rs b/vendor/rustix/src/backend/libc/fs/mod.rs
index d0fc08765..54a48103c 100644
--- a/vendor/rustix/src/backend/libc/fs/mod.rs
+++ b/vendor/rustix/src/backend/libc/fs/mod.rs
@@ -1,18 +1,8 @@
#[cfg(not(target_os = "redox"))]
pub(crate) mod dir;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub mod inotify;
+#[cfg(not(any(solarish, 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 1d1891f0f..77b49ee3e 100644
--- a/vendor/rustix/src/backend/libc/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs
@@ -9,49 +9,36 @@ use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_ssize_t}
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
use super::super::offset::libc_fallocate;
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
use super::super::offset::libc_posix_fadvise;
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
target_os = "linux",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
use super::super::offset::libc_posix_fallocate;
use super::super::offset::{libc_fstat, libc_fstatat, libc_ftruncate, libc_lseek, libc_off_t};
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
use super::super::offset::{libc_fstatfs, libc_statfs};
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use super::super::offset::{libc_fstatvfs, libc_statvfs};
#[cfg(all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
@@ -60,33 +47,28 @@ use super::super::offset::{libc_fstatvfs, libc_statvfs};
use super::super::time::types::LibcTimespec;
use crate::fd::{BorrowedFd, OwnedFd};
use crate::ffi::CStr;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
use crate::ffi::CString;
-#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
+#[cfg(not(solarish))]
use crate::fs::Access;
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
use crate::fs::Advice;
#[cfg(not(any(
+ netbsdlike,
+ solarish,
target_os = "aix",
target_os = "dragonfly",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
use crate::fs::FallocateFlags;
-#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
+#[cfg(not(target_os = "wasi"))]
use crate::fs::FlockOperation;
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
use crate::fs::MemfdFlags;
@@ -98,31 +80,19 @@ use crate::fs::MemfdFlags;
))]
use crate::fs::SealFlags;
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
use crate::fs::StatFs;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fs::{cwd, RenameFlags, ResolveFlags, Statx, StatxFlags};
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
+#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))]
use crate::fs::{Dev, FileType};
use crate::fs::{Mode, OFlags, Stat, Timestamps};
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use crate::fs::{StatVfs, StatVfsMountFlags};
use crate::io::{self, SeekFrom};
#[cfg(not(target_os = "wasi"))]
@@ -133,24 +103,14 @@ use crate::process::{Gid, Uid};
)))]
use crate::utils::as_ptr;
use core::convert::TryInto;
-#[cfg(any(
- target_os = "android",
- target_os = "ios",
- target_os = "linux",
- target_os = "macos",
-))]
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
use core::mem::size_of;
use core::mem::MaybeUninit;
#[cfg(any(target_os = "android", target_os = "linux"))]
use core::ptr::null;
-#[cfg(any(
- target_os = "android",
- target_os = "ios",
- target_os = "linux",
- target_os = "macos",
-))]
+#[cfg(any(apple, target_os = "android", target_os = "linux"))]
use core::ptr::null_mut;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
use {
super::super::conv::nonnegative_ret,
crate::fs::{copyfile_state_t, CloneFlags, CopyfileFlags},
@@ -202,7 +162,7 @@ pub(crate) fn openat(
mode: Mode,
) -> io::Result<OwnedFd> {
// Work around <https://sourceware.org/bugzilla/show_bug.cgi?id=17523>.
- // Basically old glibc versions don't handle O_TMPFILE correctly.
+ // GLIBC versions before 2.25 don't handle `O_TMPFILE` correctly.
#[cfg(all(unix, target_env = "gnu"))]
if oflags.contains(OFlags::TMPFILE) && crate::backend::if_glibc_is_less_than_2_25() {
return openat_via_syscall(dirfd, path, oflags, mode);
@@ -221,11 +181,10 @@ pub(crate) fn openat(
}
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[inline]
@@ -237,13 +196,7 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> {
}
}
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> {
unsafe {
@@ -278,6 +231,22 @@ pub(crate) fn mkdirat(dirfd: BorrowedFd<'_>, path: &CStr, mode: Mode) -> io::Res
}
}
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub(crate) fn getdents_uninit(
+ fd: BorrowedFd<'_>,
+ buf: &mut [MaybeUninit<u8>],
+) -> io::Result<usize> {
+ unsafe {
+ syscall_ret_ssize_t(c::syscall(
+ c::SYS_getdents64,
+ fd,
+ buf.as_mut_ptr().cast::<c::c_char>(),
+ buf.len(),
+ ))
+ }
+ .map(|nread| nread as usize)
+}
+
#[cfg(not(target_os = "redox"))]
pub(crate) fn linkat(
old_dirfd: BorrowedFd<'_>,
@@ -433,12 +402,7 @@ fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result<
}
}
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(solarish, target_os = "emscripten", target_os = "redox")))]
pub(crate) fn accessat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -499,8 +463,7 @@ pub(crate) fn utimensat(
// 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(
- target_os = "ios",
- target_os = "macos",
+ apple,
all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
target_env = "gnu",
@@ -519,7 +482,7 @@ pub(crate) fn utimensat(
}
// `utimensat` was introduced in macOS 10.13.
- #[cfg(any(target_os = "ios", target_os = "macos"))]
+ #[cfg(apple)]
unsafe {
// ABI details
weak! {
@@ -675,13 +638,41 @@ unsafe fn utimensat_old(
target_os = "redox",
target_os = "wasi",
)))]
-pub(crate) fn chmodat(dirfd: BorrowedFd<'_>, path: &CStr, mode: Mode) -> io::Result<()> {
- unsafe { ret(c::fchmodat(borrowed_fd(dirfd), c_str(path), mode.bits(), 0)) }
+pub(crate) fn chmodat(
+ dirfd: BorrowedFd<'_>,
+ path: &CStr,
+ mode: Mode,
+ flags: AtFlags,
+) -> io::Result<()> {
+ unsafe {
+ ret(c::fchmodat(
+ borrowed_fd(dirfd),
+ c_str(path),
+ mode.bits() as c::mode_t,
+ flags.bits(),
+ ))
+ }
}
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub(crate) fn chmodat(dirfd: BorrowedFd<'_>, path: &CStr, mode: Mode) -> io::Result<()> {
+pub(crate) fn chmodat(
+ dirfd: BorrowedFd<'_>,
+ path: &CStr,
+ mode: Mode,
+ flags: AtFlags,
+) -> io::Result<()> {
// Linux's `fchmodat` does not have a flags argument.
+ //
+ // Use `c::syscall` rather than `c::fchmodat` because some libc
+ // implementations, such as musl, add extra logic to `fchmod` to emulate
+ // support for `AT_SYMLINK_NOFOLLOW`, which uses `/proc` outside our
+ // control.
+ if flags == AtFlags::SYMLINK_NOFOLLOW {
+ return Err(io::Errno::OPNOTSUPP);
+ }
+ if !flags.is_empty() {
+ return Err(io::Errno::INVAL);
+ }
unsafe {
// Pass `mode` as a `c_uint` even if `mode_t` is narrower, since
// `libc_openat` is declared as a variadic function and narrower
@@ -695,7 +686,7 @@ pub(crate) fn chmodat(dirfd: BorrowedFd<'_>, path: &CStr, mode: Mode) -> io::Res
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn fclonefileat(
srcfd: BorrowedFd<'_>,
dst_dirfd: BorrowedFd<'_>,
@@ -734,12 +725,7 @@ pub(crate) fn chownat(
}
}
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
+#[cfg(not(any(apple, target_os = "redox", target_os = "wasi")))]
pub(crate) fn mknodat(
dirfd: BorrowedFd<'_>,
path: &CStr,
@@ -763,8 +749,8 @@ pub(crate) fn copy_file_range(
off_in: Option<&mut u64>,
fd_out: BorrowedFd<'_>,
off_out: Option<&mut u64>,
- len: u64,
-) -> io::Result<u64> {
+ len: usize,
+) -> io::Result<usize> {
assert_eq!(size_of::<c::loff_t>(), size_of::<u64>());
let mut off_in_val: c::loff_t = 0;
@@ -782,7 +768,6 @@ pub(crate) fn copy_file_range(
} else {
null_mut()
};
- let len: usize = len.try_into().unwrap_or(usize::MAX);
let copied = unsafe {
syscall_ret_ssize_t(c::syscall(
c::SYS_copy_file_range,
@@ -800,19 +785,16 @@ pub(crate) fn copy_file_range(
if let Some(off_out) = off_out {
*off_out = off_out_val as u64;
}
- Ok(copied as u64)
+ Ok(copied as usize)
}
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub(crate) fn fadvise(fd: BorrowedFd<'_>, offset: u64, len: u64, advice: Advice) -> io::Result<()> {
let offset = offset as i64;
@@ -875,6 +857,40 @@ pub(crate) fn fcntl_add_seals(fd: BorrowedFd<'_>, seals: SealFlags) -> io::Resul
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_ADD_SEALS, seals.bits())) }
}
+#[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
+#[inline]
+pub(crate) fn fcntl_lock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> {
+ use c::{flock, F_RDLCK, F_SETLK, F_SETLKW, F_UNLCK, F_WRLCK, SEEK_SET};
+
+ let (cmd, l_type) = match operation {
+ FlockOperation::LockShared => (F_SETLKW, F_RDLCK),
+ FlockOperation::LockExclusive => (F_SETLKW, F_WRLCK),
+ FlockOperation::Unlock => (F_SETLKW, F_UNLCK),
+ FlockOperation::NonBlockingLockShared => (F_SETLK, F_RDLCK),
+ FlockOperation::NonBlockingLockExclusive => (F_SETLK, F_WRLCK),
+ FlockOperation::NonBlockingUnlock => (F_SETLK, F_UNLCK),
+ };
+
+ unsafe {
+ let mut lock: flock = core::mem::zeroed();
+ lock.l_type = l_type as _;
+
+ // When `l_len` is zero, this locks all the bytes from
+ // `l_whence`/`l_start` to the end of the file, even as the
+ // file grows dynamically.
+ lock.l_whence = SEEK_SET as _;
+ lock.l_start = 0;
+ lock.l_len = 0;
+
+ ret(c::fcntl(borrowed_fd(fd), cmd, &lock))
+ }
+}
+
pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
let (whence, offset): (c::c_int, libc_off_t) = match pos {
SeekFrom::Start(pos) => {
@@ -884,6 +900,10 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
}
SeekFrom::End(offset) => (c::SEEK_END, offset),
SeekFrom::Current(offset) => (c::SEEK_CUR, offset),
+ #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ SeekFrom::Data(offset) => (c::SEEK_DATA, offset),
+ #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ SeekFrom::Hole(offset) => (c::SEEK_HOLE, offset),
};
let offset = unsafe { ret_off_t(libc_lseek(borrowed_fd(fd), offset, whence))? };
Ok(offset as u64)
@@ -939,6 +959,25 @@ pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result
unsafe { ret(c::flock(borrowed_fd(fd), operation as c::c_int)) }
}
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe { ret(c::syncfs(borrowed_fd(fd))) }
+}
+
+#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))]
+pub(crate) fn sync() {
+ // TODO: Remove this when upstream libc adds `sync`.
+ #[cfg(target_os = "android")]
+ unsafe {
+ syscall_ret(c::syscall(c::SYS_sync)).ok();
+ }
+
+ #[cfg(not(target_os = "android"))]
+ unsafe {
+ c::sync()
+ }
+}
+
pub(crate) fn fstat(fd: BorrowedFd<'_>) -> io::Result<Stat> {
// 32-bit and mips64 Linux: `struct stat64` is not y2038 compatible; use
// `statx`.
@@ -980,11 +1019,10 @@ fn fstat_old(fd: BorrowedFd<'_>) -> io::Result<Stat> {
}
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
@@ -995,13 +1033,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> {
}
}
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
let mut statvfs = MaybeUninit::<libc_statvfs>::uninit();
unsafe {
@@ -1010,13 +1042,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> {
}
}
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi"
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
fn libc_statvfs_to_statvfs(from: libc_statvfs) -> StatVfs {
StatVfs {
f_bsize: from.f_bsize as u64,
@@ -1055,8 +1081,7 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
// 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(
- target_os = "ios",
- target_os = "macos",
+ apple,
all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
target_env = "gnu",
@@ -1070,7 +1095,7 @@ pub(crate) fn futimens(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
}
// `futimens` was introduced in macOS 10.13.
- #[cfg(any(target_os = "ios", target_os = "macos"))]
+ #[cfg(apple)]
unsafe {
// ABI details.
weak! {
@@ -1135,15 +1160,12 @@ unsafe fn futimens_old(fd: BorrowedFd<'_>, times: &Timestamps) -> io::Result<()>
}
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "aix",
target_os = "dragonfly",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub(crate) fn fallocate(
fd: BorrowedFd<'_>,
@@ -1174,7 +1196,7 @@ pub(crate) fn fallocate(
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn fallocate(
fd: BorrowedFd<'_>,
mode: FallocateFlags,
@@ -1196,6 +1218,8 @@ pub(crate) fn fallocate(
};
unsafe {
if c::fcntl(borrowed_fd(fd), c::F_PREALLOCATE, &store) == -1 {
+ // Unable to allocate contiguous disk space; attempt to allocate
+ // non-contiguously.
store.fst_flags = c::F_ALLOCATEALL;
let _ = ret_c_int(c::fcntl(borrowed_fd(fd), c::F_PREALLOCATE, &store))?;
}
@@ -1208,10 +1232,9 @@ pub(crate) fn fsync(fd: BorrowedFd<'_>) -> io::Result<()> {
}
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
)))]
pub(crate) fn fdatasync(fd: BorrowedFd<'_>) -> io::Result<()> {
@@ -1469,18 +1492,9 @@ fn stat64_to_stat(s64: c::stat64) -> io::Result<Stat> {
mod sys {
use super::{c, BorrowedFd, Statx};
- #[cfg(all(target_os = "android", target_arch = "arm"))]
- const SYS_statx: c::c_long = 397;
- #[cfg(all(target_os = "android", target_arch = "x86"))]
- const SYS_statx: c::c_long = 383;
- #[cfg(all(target_os = "android", target_arch = "aarch64"))]
- const SYS_statx: c::c_long = 291;
- #[cfg(all(target_os = "android", target_arch = "x86_64"))]
- const SYS_statx: c::c_long = 332;
-
weak_or_syscall! {
pub(super) fn statx(
- pirfd: BorrowedFd<'_>,
+ dirfd_: BorrowedFd<'_>,
path: *const c::c_char,
flags: c::c_int,
mask: c::c_uint,
@@ -1545,7 +1559,7 @@ pub(crate) fn is_statx_available() -> bool {
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) unsafe fn fcopyfile(
from: BorrowedFd<'_>,
to: BorrowedFd<'_>,
@@ -1569,7 +1583,7 @@ pub(crate) unsafe fn fcopyfile(
))
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn copyfile_state_alloc() -> io::Result<copyfile_state_t> {
extern "C" {
fn copyfile_state_alloc() -> copyfile_state_t;
@@ -1583,7 +1597,7 @@ pub(crate) fn copyfile_state_alloc() -> io::Result<copyfile_state_t> {
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) unsafe fn copyfile_state_free(state: copyfile_state_t) -> io::Result<()> {
extern "C" {
fn copyfile_state_free(state: copyfile_state_t) -> c::c_int;
@@ -1592,17 +1606,17 @@ pub(crate) unsafe fn copyfile_state_free(state: copyfile_state_t) -> io::Result<
nonnegative_ret(copyfile_state_free(state))
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
const COPYFILE_STATE_COPIED: u32 = 8;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) unsafe fn copyfile_state_get_copied(state: copyfile_state_t) -> io::Result<u64> {
let mut copied = MaybeUninit::<u64>::uninit();
copyfile_state_get(state, COPYFILE_STATE_COPIED, copied.as_mut_ptr().cast())?;
Ok(copied.assume_init())
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) unsafe fn copyfile_state_get(
state: copyfile_state_t,
flag: u32,
@@ -1615,9 +1629,9 @@ pub(crate) unsafe fn copyfile_state_get(
nonnegative_ret(copyfile_state_get(state, flag, dst))
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> {
- // The use of PATH_MAX is generally not encouraged, but it
+ // The use of `PATH_MAX` is generally not encouraged, but it
// is inevitable in this case because macOS defines `fcntl` with
// `F_GETPATH` in terms of `MAXPATHLEN`, and there are no
// alternatives. If a better method is invented, it should be used
@@ -1643,7 +1657,7 @@ pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> {
Ok(CString::new(buf).unwrap())
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn fcntl_rdadvise(fd: BorrowedFd<'_>, offset: u64, len: u64) -> io::Result<()> {
// From the [macOS `fcntl` man page]:
// `F_RDADVISE` - Issue an advisory read async with no copy to user.
@@ -1680,14 +1694,14 @@ pub(crate) fn fcntl_rdadvise(fd: BorrowedFd<'_>, offset: u64, len: u64) -> io::R
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn fcntl_fullfsync(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_FULLFSYNC)) }
}
/// Convert `times` from a `futimens`/`utimensat` argument into `setattrlist`
/// arguments.
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
fn times_to_attrlist(times: &Timestamps) -> (c::size_t, [c::timespec; 2], Attrlist) {
// ABI details.
const ATTR_CMN_MODTIME: u32 = 0x0000_0400;
@@ -1755,11 +1769,11 @@ fn times_to_attrlist(times: &Timestamps) -> (c::size_t, [c::timespec; 2], Attrli
}
/// Support type for `Attrlist`.
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
type Attrgroup = u32;
/// Attribute list for use with `setattrlist`.
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
#[repr(C)]
struct Attrlist {
bitmapcount: u16,
@@ -1770,3 +1784,27 @@ struct Attrlist {
fileattr: Attrgroup,
forkattr: Attrgroup,
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+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(any(target_os = "android", target_os = "linux"))]
+pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> {
+ unsafe { ret(c::umount2(target.as_ptr(), flags.bits())) }
+}
diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs
index 8d8ec08bf..f635f2cca 100644
--- a/vendor/rustix/src/backend/libc/fs/types.rs
+++ b/vendor/rustix/src/backend/libc/fs/types.rs
@@ -40,11 +40,16 @@ bitflags! {
/// `AT_EMPTY_PATH`
#[cfg(any(
target_os = "android",
+ target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
))]
const EMPTY_PATH = c::AT_EMPTY_PATH;
+ /// `AT_RESOLVE_BENEATH`
+ #[cfg(target_os = "freebsd")]
+ const RESOLVE_BENEATH = c::AT_RESOLVE_BENEATH;
+
/// `AT_EACCESS`
#[cfg(not(any(target_os = "emscripten", target_os = "android")))]
const EACCESS = c::AT_EACCESS;
@@ -147,6 +152,32 @@ impl Mode {
}
}
+impl From<RawMode> for Mode {
+ /// Support conversions from raw mode values to `Mode`.
+ ///
+ /// ```
+ /// use rustix::fs::{Mode, RawMode};
+ /// assert_eq!(Mode::from(0o700), Mode::RWXU);
+ /// ```
+ #[inline]
+ fn from(st_mode: RawMode) -> Self {
+ Self::from_raw_mode(st_mode)
+ }
+}
+
+impl From<Mode> for RawMode {
+ /// Support conversions from `Mode to raw mode values.
+ ///
+ /// ```
+ /// use rustix::fs::{Mode, RawMode};
+ /// assert_eq!(RawMode::from(Mode::RWXU), 0o700);
+ /// ```
+ #[inline]
+ fn from(mode: Mode) -> Self {
+ mode.as_raw_mode()
+ }
+}
+
bitflags! {
/// `O_*` constants for use with [`openat`].
///
@@ -175,7 +206,7 @@ bitflags! {
const DIRECTORY = c::O_DIRECTORY;
/// `O_DSYNC`
- #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "redox")))]
+ #[cfg(not(any(target_os = "dragonfly", target_os = "redox")))]
const DSYNC = c::O_DSYNC;
/// `O_EXCL`
@@ -183,13 +214,8 @@ bitflags! {
/// `O_FSYNC`
#[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
+ bsd,
all(target_os = "linux", not(target_env = "musl")),
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
))]
const FSYNC = c::O_FSYNC;
@@ -214,11 +240,10 @@ bitflags! {
/// `O_RSYNC`
#[cfg(any(
+ netbsdlike,
target_os = "android",
target_os = "emscripten",
target_os = "linux",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
))]
const RSYNC = c::O_RSYNC;
@@ -234,6 +259,7 @@ bitflags! {
#[cfg(any(
target_os = "android",
target_os = "emscripten",
+ target_os = "freebsd",
target_os = "fuchsia",
target_os = "linux",
target_os = "redox",
@@ -259,10 +285,29 @@ bitflags! {
target_os = "linux",
))]
const NOATIME = c::O_NOATIME;
+
+ /// `O_DIRECT`
+ #[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
+ target_os = "freebsd",
+ target_os = "fuchsia",
+ target_os = "linux",
+ target_os = "netbsd",
+ ))]
+ const DIRECT = c::O_DIRECT;
+
+ /// `O_RESOLVE_BENEATH`
+ #[cfg(target_os = "freebsd")]
+ const RESOLVE_BENEATH = c::O_RESOLVE_BENEATH;
+
+ /// `O_EMPTY_PATH`
+ #[cfg(target_os = "freebsd")]
+ const EMPTY_PATH = c::O_EMPTY_PATH;
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
bitflags! {
/// `CLONE_*` constants for use with [`fclonefileat`].
///
@@ -276,7 +321,7 @@ bitflags! {
}
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
mod copyfile {
pub(super) const ACL: u32 = 1 << 0;
pub(super) const STAT: u32 = 1 << 1;
@@ -287,7 +332,7 @@ mod copyfile {
pub(super) const ALL: u32 = METADATA | DATA;
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
bitflags! {
/// `COPYFILE_*` constants.
pub struct CopyfileFlags: c::c_uint {
@@ -427,12 +472,7 @@ impl FileType {
}
/// Construct a `FileType` from the `d_type` field of a `c::dirent`.
- #[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris"
- )))]
+ #[cfg(not(any(solarish, target_os = "haiku", target_os = "redox")))]
pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self {
match d_type {
c::DT_REG => Self::RegularFile,
@@ -454,15 +494,12 @@ impl FileType {
///
/// [`fadvise`]: crate::fs::fadvise
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[repr(u32)]
@@ -502,40 +539,28 @@ bitflags! {
const HUGETLB = c::MFD_HUGETLB;
/// `MFD_HUGE_64KB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_64KB = c::MFD_HUGE_64KB;
/// `MFD_HUGE_512JB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_512KB = c::MFD_HUGE_512KB;
/// `MFD_HUGE_1MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_1MB = c::MFD_HUGE_1MB;
/// `MFD_HUGE_2MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_2MB = c::MFD_HUGE_2MB;
/// `MFD_HUGE_8MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_8MB = c::MFD_HUGE_8MB;
/// `MFD_HUGE_16MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_16MB = c::MFD_HUGE_16MB;
/// `MFD_HUGE_32MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_32MB = c::MFD_HUGE_32MB;
/// `MFD_HUGE_256MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_256MB = c::MFD_HUGE_256MB;
/// `MFD_HUGE_512MB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_512MB = c::MFD_HUGE_512MB;
/// `MFD_HUGE_1GB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_1GB = c::MFD_HUGE_1GB;
/// `MFD_HUGE_2GB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_2GB = c::MFD_HUGE_2GB;
/// `MFD_HUGE_16GB`
- #[cfg(any(target_os = "android", target_os = "linux"))]
const HUGE_16GB = c::MFD_HUGE_16GB;
}
}
@@ -676,14 +701,7 @@ bitflags! {
}
}
-#[cfg(not(any(
- target_os = "aix",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(netbsdlike, solarish, target_os = "aix", target_os = "redox")))]
bitflags! {
/// `FALLOC_FL_*` constants for use with [`fallocate`].
///
@@ -691,41 +709,26 @@ bitflags! {
pub struct FallocateFlags: i32 {
/// `FALLOC_FL_KEEP_SIZE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
const KEEP_SIZE = c::FALLOC_FL_KEEP_SIZE;
/// `FALLOC_FL_PUNCH_HOLE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
const PUNCH_HOLE = c::FALLOC_FL_PUNCH_HOLE;
/// `FALLOC_FL_NO_HIDE_STALE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
target_os = "linux",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "emscripten",
target_os = "fuchsia",
target_os = "wasi",
@@ -733,56 +736,36 @@ bitflags! {
const NO_HIDE_STALE = c::FALLOC_FL_NO_HIDE_STALE;
/// `FALLOC_FL_COLLAPSE_RANGE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "emscripten",
target_os = "wasi",
)))]
const COLLAPSE_RANGE = c::FALLOC_FL_COLLAPSE_RANGE;
/// `FALLOC_FL_ZERO_RANGE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "emscripten",
target_os = "wasi",
)))]
const ZERO_RANGE = c::FALLOC_FL_ZERO_RANGE;
/// `FALLOC_FL_INSERT_RANGE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "emscripten",
target_os = "wasi",
)))]
const INSERT_RANGE = c::FALLOC_FL_INSERT_RANGE;
/// `FALLOC_FL_UNSHARE_RANGE`
#[cfg(not(any(
+ bsd,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "emscripten",
target_os = "wasi",
)))]
@@ -790,13 +773,7 @@ bitflags! {
}
}
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
bitflags! {
/// `ST_*` constants for use with [`StatVfs`].
pub struct StatVfsMountFlags: u64 {
@@ -836,10 +813,11 @@ bitflags! {
}
}
-/// `LOCK_*` constants for use with [`flock`]
+/// `LOCK_*` constants for use with [`flock`] and [`fcntl_lock`].
///
/// [`flock`]: crate::fs::flock
-#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
+/// [`fcntl_lock`]: crate::fs::fcntl_lock
+#[cfg(not(target_os = "wasi"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(i32)]
pub enum FlockOperation {
@@ -861,12 +839,7 @@ pub enum FlockOperation {
///
/// [`statat`]: crate::fs::statat
/// [`fstat`]: crate::fs::fstat
-#[cfg(not(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-)))]
+#[cfg(not(linux_like))]
pub type Stat = c::stat;
/// `struct stat` for use with [`statat`] and [`fstat`].
@@ -921,15 +894,11 @@ pub struct Stat {
/// [`statfs`]: crate::fs::statfs
/// [`fstatfs`]: crate::fs::fstatfs
#[cfg(not(any(
- target_os = "android",
- target_os = "emscripten",
+ linux_like,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "linux",
- target_os = "l4re",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[allow(clippy::module_name_repetitions)]
@@ -939,25 +908,14 @@ pub type StatFs = c::statfs;
///
/// [`statfs`]: crate::fs::statfs
/// [`fstatfs`]: crate::fs::fstatfs
-#[cfg(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
pub type StatFs = c::statfs64;
/// `struct statvfs` for use with [`statvfs`] and [`fstatvfs`].
///
/// [`statvfs`]: crate::fs::statvfs
/// [`fstatvfs`]: crate::fs::fstatvfs
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[allow(missing_docs)]
pub struct StatVfs {
pub f_bsize: u64,
@@ -1081,36 +1039,112 @@ pub type FsWord = u64;
#[cfg(all(target_os = "linux", target_arch = "s390x"))]
pub type FsWord = u32;
-#[cfg(not(target_os = "redox"))]
-pub use c::{UTIME_NOW, UTIME_OMIT};
-
-/// `PROC_SUPER_MAGIC`—The magic number for the procfs filesystem.
-#[cfg(all(
- any(target_os = "android", target_os = "linux"),
- not(target_env = "musl"),
-))]
-pub const PROC_SUPER_MAGIC: FsWord = c::PROC_SUPER_MAGIC as FsWord;
-
-/// `NFS_SUPER_MAGIC`—The magic number for the NFS filesystem.
-#[cfg(all(
- any(target_os = "android", target_os = "linux"),
- not(target_env = "musl"),
-))]
-pub const NFS_SUPER_MAGIC: FsWord = c::NFS_SUPER_MAGIC as FsWord;
-
-/// `PROC_SUPER_MAGIC`—The magic number for the procfs filesystem.
-#[cfg(all(any(target_os = "android", target_os = "linux"), target_env = "musl"))]
-pub const PROC_SUPER_MAGIC: FsWord = 0x0000_9fa0;
-
-/// `NFS_SUPER_MAGIC`—The magic number for the NFS filesystem.
-#[cfg(all(any(target_os = "android", target_os = "linux"), target_env = "musl"))]
-pub const NFS_SUPER_MAGIC: FsWord = 0x0000_6969;
-
/// `copyfile_state_t`—State for use with [`fcopyfile`].
///
/// [`fcopyfile`]: crate::fs::fcopyfile
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
#[allow(non_camel_case_types)]
#[repr(transparent)]
#[derive(Copy, Clone)]
pub struct copyfile_state_t(pub(crate) *mut c::c_void);
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `MS_*` constants for use with [`mount`].
+ ///
+ /// [`mount`]: crate::fs::mount
+ 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(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `MS_*` constants for use with [`change_mount`].
+ ///
+ /// [`change_mount`]: crate::fs::mount::change_mount.
+ 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(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ pub(crate) struct InternalMountFlags: c::c_ulong {
+ const REMOUNT = c::MS_REMOUNT;
+ const MOVE = c::MS_MOVE;
+ }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub(crate) struct MountFlagsArg(pub(crate) c::c_ulong);
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `MNT_*` constants for use with [`unmount`].
+ ///
+ /// [`unmount`]: crate::fs::mount::unmount
+ pub struct UnmountFlags: c::c_int {
+ /// `MNT_FORCE`
+ const FORCE = c::MNT_FORCE;
+ /// `MNT_DETACH`
+ const DETACH = c::MNT_DETACH;
+ /// `MNT_EXPIRE`
+ const EXPIRE = c::MNT_EXPIRE;
+ /// `UMOUNT_NOFOLLOW`
+ const NOFOLLOW = c::UMOUNT_NOFOLLOW;
+ }
+}
diff --git a/vendor/rustix/src/backend/libc/io/epoll.rs b/vendor/rustix/src/backend/libc/io/epoll.rs
index 3205a613f..62a3c742b 100644
--- a/vendor/rustix/src/backend/libc/io/epoll.rs
+++ b/vendor/rustix/src/backend/libc/io/epoll.rs
@@ -6,17 +6,17 @@
//!
//! # Examples
//!
-//! ```rust,no_run
+//! ```no_run
//! # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
//! # #[cfg(feature = "net")]
//! # fn main() -> std::io::Result<()> {
//! use io_lifetimes::AsFd;
-//! use rustix::io::epoll::{self, Epoll};
-//! use rustix::io::{ioctl_fionbio, read, write};
+//! use rustix::io::{epoll, ioctl_fionbio, read, write};
//! use rustix::net::{
//! accept, bind_v4, listen, socket, AddressFamily, Ipv4Addr, Protocol, SocketAddrV4,
//! SocketType,
//! };
+//! use std::collections::HashMap;
//! use std::os::unix::io::AsRawFd;
//!
//! // Create a socket and listen on it.
@@ -26,29 +26,40 @@
//!
//! // Create an epoll object. Using `Owning` here means the epoll object will
//! // take ownership of the file descriptors registered with it.
-//! let epoll = Epoll::new(epoll::CreateFlags::CLOEXEC, epoll::Owning::new())?;
-//!
-//! // Remember the socket raw fd, which we use for comparisons only.
-//! let raw_listen_sock = listen_sock.as_fd().as_raw_fd();
+//! let epoll = epoll::epoll_create(epoll::CreateFlags::CLOEXEC)?;
//!
//! // Register the socket with the epoll object.
-//! epoll.add(listen_sock, epoll::EventFlags::IN)?;
+//! epoll::epoll_add(&epoll, &listen_sock, 1, epoll::EventFlags::IN)?;
+//!
+//! // Keep track of the sockets we've opened.
+//! let mut next_id = 2;
+//! let mut sockets = HashMap::new();
//!
//! // Process events.
//! let mut event_list = epoll::EventVec::with_capacity(4);
//! loop {
-//! epoll.wait(&mut event_list, -1)?;
+//! epoll::epoll_wait(&epoll, &mut event_list, -1)?;
//! for (_event_flags, target) in &event_list {
-//! if target.as_raw_fd() == raw_listen_sock {
+//! if target == 1 {
//! // Accept a new connection, set it to non-blocking, and
//! // register to be notified when it's ready to write to.
-//! let conn_sock = accept(&*target)?;
+//! let conn_sock = accept(&listen_sock)?;
//! ioctl_fionbio(&conn_sock, true)?;
-//! epoll.add(conn_sock, epoll::EventFlags::OUT | epoll::EventFlags::ET)?;
+//! epoll::epoll_add(
+//! &epoll,
+//! &conn_sock,
+//! next_id,
+//! epoll::EventFlags::OUT | epoll::EventFlags::ET,
+//! )?;
+//!
+//! // Keep track of the socket.
+//! sockets.insert(next_id, conn_sock);
+//! next_id += 1;
//! } else {
//! // Write a message to the stream and then unregister it.
-//! write(&*target, b"hello\n")?;
-//! let _ = epoll.del(target)?;
+//! let target = sockets.remove(&target).unwrap();
+//! write(&target, b"hello\n")?;
+//! let _ = epoll::epoll_del(&epoll, &target)?;
//! }
//! }
//! }
@@ -59,17 +70,12 @@
use super::super::c;
use super::super::conv::{ret, ret_owned_fd, ret_u32};
-use crate::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd};
-#[cfg(not(feature = "rustc-dep-of-std"))]
-use crate::fd::{FromRawFd, IntoRawFd};
+use crate::fd::{AsFd, AsRawFd, OwnedFd};
use crate::io;
use alloc::vec::Vec;
use bitflags::bitflags;
use core::convert::TryInto;
-use core::fmt;
-use core::marker::PhantomData;
-use core::ops::Deref;
-use core::ptr::{null, null_mut};
+use core::ptr::null_mut;
bitflags! {
/// `EPOLL_*` for use with [`Epoll::new`].
@@ -98,6 +104,24 @@ bitflags! {
/// `EPOLLHUP`
const HUP = c::EPOLLHUP as u32;
+ /// `EPOLLRDNORM`
+ const RDNORM = c::EPOLLRDNORM as u32;
+
+ /// `EPOLLRDBAND`
+ const RDBAND = c::EPOLLRDBAND as u32;
+
+ /// `EPOLLWRNORM`
+ const WRNORM = c::EPOLLWRNORM as u32;
+
+ /// `EPOLLWRBAND`
+ const WRBAND = c::EPOLLWRBAND as u32;
+
+ /// `EPOLLMSG`
+ const MSG = c::EPOLLMSG as u32;
+
+ /// `EPOLLRDHUP`
+ const RDHUP = c::EPOLLRDHUP as u32;
+
/// `EPOLLET`
const ET = c::EPOLLET as u32;
@@ -113,360 +137,136 @@ bitflags! {
}
}
-/// A reference to a `T`.
-pub struct Ref<'a, T> {
- t: T,
- _phantom: PhantomData<&'a T>,
-}
-
-impl<'a, T> Ref<'a, T> {
- #[inline]
- fn new(t: T) -> Self {
- Self {
- t,
- _phantom: PhantomData,
- }
- }
-
- #[inline]
- fn consume(self) -> T {
- self.t
- }
-}
-
-impl<'a, T> Deref for Ref<'a, T> {
- type Target = T;
-
- #[inline]
- fn deref(&self) -> &T {
- &self.t
- }
-}
-
-impl<'a, T: fmt::Debug> fmt::Debug for Ref<'a, T> {
- fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.t.fmt(fmt)
- }
-}
-
-/// A trait for data stored within an [`Epoll`] instance.
-pub trait Context {
- /// The type of an element owned by this context.
- type Data;
-
- /// The type of a value used to refer to an element owned by this context.
- type Target: AsFd;
-
- /// Assume ownership of `data`, and returning a `Target`.
- fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target>;
-
- /// Encode `target` as a `u64`. The only requirement on this value is that
- /// it be decodable by `decode`.
- fn encode(&self, target: Ref<'_, Self::Target>) -> u64;
-
- /// Decode `raw`, which is a value encoded by `encode`, into a `Target`.
- ///
- /// # Safety
- ///
- /// `raw` must be a `u64` value returned from `encode`, from the same
- /// context, and within the context's lifetime.
- unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target>;
-
- /// Release ownership of the value referred to by `target` and return it.
- fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data;
-}
-
-/// A type implementing [`Context`] where the `Data` type is `BorrowedFd<'a>`.
-pub struct Borrowing<'a> {
- _phantom: PhantomData<BorrowedFd<'a>>,
-}
-
-impl<'a> Context for Borrowing<'a> {
- type Data = BorrowedFd<'a>;
- type Target = BorrowedFd<'a>;
-
- #[inline]
- fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target> {
- Ref::new(data)
- }
-
- #[inline]
- fn encode(&self, target: Ref<'_, Self::Target>) -> u64 {
- target.as_raw_fd() as u64
- }
-
- #[inline]
- unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target> {
- Ref::new(BorrowedFd::<'a>::borrow_raw(raw as RawFd))
- }
-
- #[inline]
- fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data {
- target.consume()
- }
-}
-
-/// A type implementing [`Context`] where the `Data` type is `T`, a type
-/// implementing `From<OwnedFd>` and `From<T> for OwnedFd`.
+/// `epoll_create1(flags)`—Creates a new `Epoll`.
///
-/// This may be used with [`OwnedFd`], or higher-level types like
-/// [`std::fs::File`] or [`std::net::TcpStream`].
-#[cfg(not(feature = "rustc-dep-of-std"))]
-pub struct Owning<'context, T: Into<OwnedFd> + From<OwnedFd>> {
- _phantom: PhantomData<&'context T>,
+/// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
+/// descriptor from being implicitly passed across `exec` boundaries.
+#[inline]
+#[doc(alias = "epoll_create1")]
+pub fn epoll_create(flags: CreateFlags) -> io::Result<OwnedFd> {
+ // SAFETY: We're calling `epoll_create1` via FFI and we know how it
+ // behaves.
+ unsafe { ret_owned_fd(c::epoll_create1(flags.bits())) }
}
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: Into<OwnedFd> + From<OwnedFd>> Owning<'context, T> {
- /// Creates a new empty `Owning`.
- #[allow(clippy::new_without_default)] // This is a specialized type that doesn't need to be generically constructible.
- #[inline]
- pub fn new() -> Self {
- Self {
- _phantom: PhantomData,
- }
- }
-}
-
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> Context for Owning<'context, T> {
- type Data = T;
- type Target = BorrowedFd<'context>;
-
- #[inline]
- fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target> {
- let fd: OwnedFd = data.into();
- let raw_fd = fd.into_raw_fd();
- // Safety: `epoll` will assign ownership of the file descriptor to the
- // kernel epoll object. We use `Into<OwnedFd>`+`IntoRawFd` to consume
- // the `Data` and extract the raw file descriptor and then "borrow" it
- // with `borrow_raw` knowing that the borrow won't outlive the
- // kernel epoll object.
- unsafe { Ref::new(BorrowedFd::<'context>::borrow_raw(raw_fd)) }
- }
-
- #[inline]
- fn encode(&self, target: Ref<'_, Self::Target>) -> u64 {
- target.as_fd().as_raw_fd() as u64
- }
-
- #[inline]
- unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target> {
- Ref::new(BorrowedFd::<'context>::borrow_raw(raw as RawFd))
- }
-
- #[inline]
- fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data {
- // The file descriptor was held by the kernel epoll object and is now
- // being released, so we can create a new `OwnedFd` that assumes
- // ownership.
- let raw_fd = target.consume().as_raw_fd();
- unsafe { T::from(OwnedFd::from_raw_fd(raw_fd).into()) }
- }
-}
-
-/// An "epoll", an interface to an OS object allowing one to repeatedly wait
-/// for events from a set of file descriptors efficiently.
-pub struct Epoll<Context: self::Context> {
- epoll_fd: OwnedFd,
- context: Context,
-}
-
-impl<Context: self::Context> Epoll<Context> {
- /// `epoll_create1(flags)`—Creates a new `Epoll`.
- ///
- /// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
- /// descriptor from being implicitly passed across `exec` boundaries.
- #[inline]
- #[doc(alias = "epoll_create1")]
- pub fn new(flags: CreateFlags, context: Context) -> io::Result<Self> {
- // Safety: We're calling `epoll_create1` via FFI and we know how it
- // behaves.
- unsafe {
- Ok(Self {
- epoll_fd: ret_owned_fd(c::epoll_create1(flags.bits()))?,
- context,
- })
- }
- }
-
- /// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
- /// `Epoll`.
- ///
- /// This registers interest in any of the events set in `events` occurring
- /// on the file descriptor associated with `data`.
- #[doc(alias = "epoll_ctl")]
- pub fn add(
- &self,
- data: Context::Data,
- event_flags: EventFlags,
- ) -> io::Result<Ref<'_, Context::Target>> {
- // Safety: We're calling `epoll_ctl` via FFI and we know how it
- // behaves.
- unsafe {
- let target = self.context.acquire(data);
- let raw_fd = target.as_fd().as_raw_fd();
- let encoded = self.context.encode(target);
- ret(c::epoll_ctl(
- self.epoll_fd.as_fd().as_raw_fd(),
- c::EPOLL_CTL_ADD,
- raw_fd,
- &mut c::epoll_event {
- events: event_flags.bits(),
- r#u64: encoded,
- },
- ))?;
- Ok(self.context.decode(encoded))
- }
- }
-
- /// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
- /// this `Epoll`.
- ///
- /// This sets the events of interest with `target` to `events`.
- #[doc(alias = "epoll_ctl")]
- pub fn mod_(
- &self,
- target: Ref<'_, Context::Target>,
- event_flags: EventFlags,
- ) -> io::Result<()> {
- let raw_fd = target.as_fd().as_raw_fd();
- let encoded = self.context.encode(target);
- // Safety: We're calling `epoll_ctl` via FFI and we know how it
- // behaves.
- unsafe {
- ret(c::epoll_ctl(
- self.epoll_fd.as_fd().as_raw_fd(),
- c::EPOLL_CTL_MOD,
- raw_fd,
- &mut c::epoll_event {
- events: event_flags.bits(),
- r#u64: encoded,
- },
- ))
- }
- }
-
- /// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
- /// this `Epoll`.
- ///
- /// This also returns the owning `Data`.
- #[doc(alias = "epoll_ctl")]
- pub fn del(&self, target: Ref<'_, Context::Target>) -> io::Result<Context::Data> {
- // Safety: We're calling `epoll_ctl` via FFI and we know how it
- // behaves.
- unsafe {
- let raw_fd = target.as_fd().as_raw_fd();
- ret(c::epoll_ctl(
- self.epoll_fd.as_fd().as_raw_fd(),
- c::EPOLL_CTL_DEL,
- raw_fd,
- null_mut(),
- ))?;
- }
- Ok(self.context.release(target))
- }
-
- /// `epoll_wait(self, events, timeout)`—Waits for registered events of
- /// interest.
- ///
- /// For each event of interest, an element is written to `events`. On
- /// success, this returns the number of written elements.
- #[doc(alias = "epoll_wait")]
- pub fn wait<'context>(
- &'context self,
- event_list: &mut EventVec<'context, Context>,
- timeout: c::c_int,
- ) -> io::Result<()> {
- // Safety: We're calling `epoll_wait` via FFI and we know how it
- // behaves.
- unsafe {
- event_list.events.set_len(0);
- let nfds = ret_u32(c::epoll_wait(
- self.epoll_fd.as_fd().as_raw_fd(),
- event_list.events.as_mut_ptr().cast::<c::epoll_event>(),
- event_list.events.capacity().try_into().unwrap_or(i32::MAX),
- timeout,
- ))?;
- event_list.events.set_len(nfds as usize);
- event_list.context = &self.context;
- }
-
- Ok(())
- }
-}
-
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsRawFd for Epoll<Owning<'context, T>> {
- fn as_raw_fd(&self) -> RawFd {
- self.epoll_fd.as_raw_fd()
- }
-}
-
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> IntoRawFd for Epoll<Owning<'context, T>> {
- fn into_raw_fd(self) -> RawFd {
- self.epoll_fd.into_raw_fd()
- }
-}
-
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> FromRawFd for Epoll<Owning<'context, T>> {
- unsafe fn from_raw_fd(fd: RawFd) -> Self {
- Self {
- epoll_fd: OwnedFd::from_raw_fd(fd),
- context: Owning::new(),
- }
+/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
+/// `Epoll`.
+///
+/// Note that if `epoll_del` is not called on the I/O source passed into
+/// this function before the I/O source is `close`d, then the `epoll` will
+/// act as if the I/O source is still registered with it. This can lead to
+/// spurious events being returned from `epoll_wait`. If a file descriptor
+/// is an `Arc<dyn SystemResource>`, then `epoll` can be thought to maintain
+/// a `Weak<dyn SystemResource>` to the file descriptor.
+#[doc(alias = "epoll_ctl")]
+pub fn epoll_add(
+ epoll: impl AsFd,
+ source: impl AsFd,
+ data: u64,
+ event_flags: EventFlags,
+) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_ctl` via FFI and we know how it
+ // behaves.
+ unsafe {
+ let raw_fd = source.as_fd().as_raw_fd();
+ ret(c::epoll_ctl(
+ epoll.as_fd().as_raw_fd(),
+ c::EPOLL_CTL_ADD,
+ raw_fd,
+ &mut c::epoll_event {
+ events: event_flags.bits(),
+ r#u64: data,
+ },
+ ))
}
}
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsFd for Epoll<Owning<'context, T>> {
- fn as_fd(&self) -> BorrowedFd<'_> {
- self.epoll_fd.as_fd()
+/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
+/// this `Epoll`.
+///
+/// This sets the events of interest with `target` to `events`.
+#[doc(alias = "epoll_ctl")]
+pub fn epoll_mod(
+ epoll: impl AsFd,
+ source: impl AsFd,
+ data: u64,
+ event_flags: EventFlags,
+) -> io::Result<()> {
+ let raw_fd = source.as_fd().as_raw_fd();
+
+ // SAFETY: We're calling `epoll_ctl` via FFI and we know how it
+ // behaves.
+ unsafe {
+ ret(c::epoll_ctl(
+ epoll.as_fd().as_raw_fd(),
+ c::EPOLL_CTL_MOD,
+ raw_fd,
+ &mut c::epoll_event {
+ events: event_flags.bits(),
+ r#u64: data,
+ },
+ ))
}
}
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<Epoll<Owning<'context, T>>>
- for OwnedFd
-{
- fn from(epoll: Epoll<Owning<'context, T>>) -> Self {
- epoll.epoll_fd
+/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
+/// this `Epoll`.
+#[doc(alias = "epoll_ctl")]
+pub fn epoll_del(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_ctl` via FFI and we know how it
+ // behaves.
+ unsafe {
+ let raw_fd = source.as_fd().as_raw_fd();
+ ret(c::epoll_ctl(
+ epoll.as_fd().as_raw_fd(),
+ c::EPOLL_CTL_DEL,
+ raw_fd,
+ null_mut(),
+ ))
}
}
-#[cfg(not(feature = "rustc-dep-of-std"))]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<OwnedFd>
- for Epoll<Owning<'context, T>>
-{
- fn from(fd: OwnedFd) -> Self {
- Self {
- epoll_fd: fd,
- context: Owning::new(),
- }
- }
+/// `epoll_wait(self, events, timeout)`—Waits for registered events of
+/// interest.
+///
+/// For each event of interest, an element is written to `events`. On
+/// success, this returns the number of written elements.
+pub fn epoll_wait(
+ epoll: impl AsFd,
+ event_list: &mut EventVec,
+ timeout: c::c_int,
+) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_wait` via FFI and we know how it
+ // behaves.
+ unsafe {
+ event_list.events.set_len(0);
+ let nfds = ret_u32(c::epoll_wait(
+ epoll.as_fd().as_raw_fd(),
+ event_list.events.as_mut_ptr().cast::<c::epoll_event>(),
+ event_list.events.capacity().try_into().unwrap_or(i32::MAX),
+ timeout,
+ ))?;
+ event_list.events.set_len(nfds as usize);
+ }
+
+ Ok(())
}
/// An iterator over the `Event`s in an `EventVec`.
-pub struct Iter<'context, Context: self::Context> {
- iter: core::slice::Iter<'context, Event>,
- context: *const Context,
- _phantom: PhantomData<&'context Context>,
+pub struct Iter<'a> {
+ iter: core::slice::Iter<'a, Event>,
}
-impl<'context, Context: self::Context> Iterator for Iter<'context, Context> {
- type Item = (EventFlags, Ref<'context, Context::Target>);
+impl<'a> Iterator for Iter<'a> {
+ type Item = (EventFlags, u64);
fn next(&mut self) -> Option<Self::Item> {
- // Safety: `self.context` is guaranteed to be valid because we hold
+ // SAFETY: `self.context` is guaranteed to be valid because we hold
// `'context` for it. And we know this event is associated with this
// context because `wait` sets both.
- self.iter.next().map(|event| {
- (event.event_flags, unsafe {
- (*self.context).decode(event.encoded)
- })
- })
+ self.iter
+ .next()
+ .map(|event| (event.event_flags, event.data))
}
}
@@ -485,27 +285,22 @@ impl<'context, Context: self::Context> Iterator for Iter<'context, Context> {
)]
struct Event {
// Match the layout of `c::epoll_event`. We just use a `u64` instead of
- // the full union; `Context` implementations will simply need to deal with
- // casting the value into and out of the `u64` themselves.
+ // the full union.
event_flags: EventFlags,
- encoded: u64,
+ data: u64,
}
/// A vector of `Event`s, plus context for interpreting them.
-pub struct EventVec<'context, Context: self::Context> {
+pub struct EventVec {
events: Vec<Event>,
- context: *const Context,
- _phantom: PhantomData<&'context Context>,
}
-impl<'context, Context: self::Context> EventVec<'context, Context> {
+impl EventVec {
/// Constructs an `EventVec` with memory for `capacity` `Event`s.
#[inline]
pub fn with_capacity(capacity: usize) -> Self {
Self {
events: Vec::with_capacity(capacity),
- context: null(),
- _phantom: PhantomData,
}
}
@@ -541,11 +336,9 @@ impl<'context, Context: self::Context> EventVec<'context, Context> {
/// Returns an iterator over the `Event`s in this `EventVec`.
#[inline]
- pub fn iter(&self) -> Iter<'_, Context> {
+ pub fn iter(&self) -> Iter<'_> {
Iter {
iter: self.events.iter(),
- context: self.context,
- _phantom: PhantomData,
}
}
@@ -562,9 +355,9 @@ impl<'context, Context: self::Context> EventVec<'context, Context> {
}
}
-impl<'context, Context: self::Context> IntoIterator for &'context EventVec<'context, Context> {
- type IntoIter = Iter<'context, Context>;
- type Item = (EventFlags, Ref<'context, Context::Target>);
+impl<'a> IntoIterator for &'a EventVec {
+ type IntoIter = Iter<'a>;
+ type Item = (EventFlags, u64);
#[inline]
fn into_iter(self) -> Self::IntoIter {
diff --git a/vendor/rustix/src/backend/libc/io/errno.rs b/vendor/rustix/src/backend/libc/io/errno.rs
index 25323771c..9e808c0b4 100644
--- a/vendor/rustix/src/backend/libc/io/errno.rs
+++ b/vendor/rustix/src/backend/libc/io/errno.rs
@@ -25,15 +25,10 @@ impl Errno {
pub const ADDRNOTAVAIL: Self = Self(c::EADDRNOTAVAIL);
/// `EADV`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const ADV: Self = Self(c::EADV);
@@ -44,26 +39,14 @@ impl Errno {
/// `EALREADY`
pub const ALREADY: Self = Self(c::EALREADY);
/// `EAUTH`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const AUTH: Self = Self(c::EAUTH);
/// `EBADE`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const BADE: Self = Self(c::EBADE);
@@ -71,15 +54,10 @@ impl Errno {
pub const BADF: Self = Self(c::EBADF);
/// `EBADFD`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const BADFD: Self = Self(c::EBADFD);
@@ -88,67 +66,40 @@ impl Errno {
pub const BADMSG: Self = Self(c::EBADMSG);
/// `EBADR`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const BADR: Self = Self(c::EBADR);
/// `EBADRPC`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const BADRPC: Self = Self(c::EBADRPC);
/// `EBADRQC`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const BADRQC: Self = Self(c::EBADRQC);
/// `EBADSLT`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const BADSLT: Self = Self(c::EBADSLT);
/// `EBFONT`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const BFONT: Self = Self(c::EBFONT);
@@ -164,29 +115,14 @@ impl Errno {
#[cfg(not(windows))]
pub const CHILD: Self = Self(c::ECHILD);
/// `ECHRNG`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const CHRNG: Self = Self(c::ECHRNG);
/// `ECOMM`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const COMM: Self = Self(c::ECOMM);
@@ -201,16 +137,11 @@ impl Errno {
pub const DEADLK: Self = Self(c::EDEADLK);
/// `EDEADLOCK`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
target_os = "android",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const DEADLOCK: Self = Self(c::EDEADLOCK);
@@ -223,21 +154,15 @@ impl Errno {
#[cfg(not(windows))]
pub const DOM: Self = Self(c::EDOM);
/// `EDOOFUS`
- #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
+ #[cfg(freebsdlike)]
pub const DOOFUS: Self = Self(c::EDOOFUS);
/// `EDOTDOT`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const DOTDOT: Self = Self(c::EDOTDOT);
@@ -252,15 +177,7 @@ impl Errno {
#[cfg(not(windows))]
pub const FBIG: Self = Self(c::EFBIG);
/// `EFTYPE`
- #[cfg(any(
- target_env = "newlib",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_env = "newlib"))]
pub const FTYPE: Self = Self(c::EFTYPE);
/// `EHOSTDOWN`
#[cfg(not(target_os = "wasi"))]
@@ -269,19 +186,13 @@ impl Errno {
pub const HOSTUNREACH: Self = Self(c::EHOSTUNREACH);
/// `EHWPOISON`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
target_os = "android",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const HWPOISON: Self = Self(c::EHWPOISON);
@@ -318,218 +229,113 @@ impl Errno {
pub const ISDIR: Self = Self(c::EISDIR);
/// `EISNAM`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const ISNAM: Self = Self(c::EISNAM);
/// `EKEYEXPIRED`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const KEYEXPIRED: Self = Self(c::EKEYEXPIRED);
/// `EKEYREJECTED`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const KEYREJECTED: Self = Self(c::EKEYREJECTED);
/// `EKEYREVOKED`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const KEYREVOKED: Self = Self(c::EKEYREVOKED);
/// `EL2HLT`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const L2HLT: Self = Self(c::EL2HLT);
/// `EL2NSYNC`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const L2NSYNC: Self = Self(c::EL2NSYNC);
/// `EL3HLT`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const L3HLT: Self = Self(c::EL3HLT);
/// `EL3RST`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const L3RST: Self = Self(c::EL3RST);
/// `ELIBACC`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const LIBACC: Self = Self(c::ELIBACC);
/// `ELIBBAD`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const LIBBAD: Self = Self(c::ELIBBAD);
/// `ELIBEXEC`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const LIBEXEC: Self = Self(c::ELIBEXEC);
/// `ELIBMAX`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const LIBMAX: Self = Self(c::ELIBMAX);
/// `ELIBSCN`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const LIBSCN: Self = Self(c::ELIBSCN);
/// `ELNRNG`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const LNRNG: Self = Self(c::ELNRNG);
/// `ELOOP`
pub const LOOP: Self = Self(c::ELOOP);
/// `EMEDIUMTYPE`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const MEDIUMTYPE: Self = Self(c::EMEDIUMTYPE);
@@ -547,29 +353,16 @@ impl Errno {
pub const NAMETOOLONG: Self = Self(c::ENAMETOOLONG);
/// `ENAVAIL`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const NAVAIL: Self = Self(c::ENAVAIL);
/// `ENEEDAUTH`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const NEEDAUTH: Self = Self(c::ENEEDAUTH);
/// `ENETDOWN`
pub const NETDOWN: Self = Self(c::ENETDOWN);
@@ -582,49 +375,25 @@ impl Errno {
pub const NFILE: Self = Self(c::ENFILE);
/// `ENOANO`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const NOANO: Self = Self(c::ENOANO);
/// `ENOATTR`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
pub const NOATTR: Self = Self(c::ENOATTR);
/// `ENOBUFS`
pub const NOBUFS: Self = Self(c::ENOBUFS);
/// `ENOCSI`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const NOCSI: Self = Self(c::ENOCSI);
/// `ENODATA`
#[cfg(not(any(
+ freebsdlike,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
target_os = "openbsd",
target_os = "wasi",
@@ -641,17 +410,11 @@ impl Errno {
pub const NOEXEC: Self = Self(c::ENOEXEC);
/// `ENOKEY`
#[cfg(not(any(
+ solarish,
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const NOKEY: Self = Self(c::ENOKEY);
@@ -663,17 +426,11 @@ impl Errno {
pub const NOLINK: Self = Self(c::ENOLINK);
/// `ENOMEDIUM`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const NOMEDIUM: Self = Self(c::ENOMEDIUM);
@@ -688,29 +445,19 @@ impl Errno {
pub const NOMSG: Self = Self(c::ENOMSG);
/// `ENONET`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const NONET: Self = Self(c::ENONET);
/// `ENOPKG`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const NOPKG: Self = Self(c::ENOPKG);
@@ -721,9 +468,8 @@ impl Errno {
pub const NOSPC: Self = Self(c::ENOSPC);
/// `ENOSR`
#[cfg(not(any(
+ freebsdlike,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
target_os = "openbsd",
target_os = "wasi",
@@ -731,9 +477,8 @@ impl Errno {
pub const NOSR: Self = Self(c::ENOSR);
/// `ENOSTR`
#[cfg(not(any(
+ freebsdlike,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
target_os = "openbsd",
target_os = "wasi",
@@ -757,27 +502,16 @@ impl Errno {
pub const NOTEMPTY: Self = Self(c::ENOTEMPTY);
/// `ENOTNAM`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const NOTNAM: Self = Self(c::ENOTNAM);
/// `ENOTRECOVERABLE`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "netbsd"
- )))]
+ #[cfg(not(any(freebsdlike, netbsdlike, windows, target_os = "haiku")))]
pub const NOTRECOVERABLE: Self = Self(c::ENOTRECOVERABLE);
/// `ENOTSOCK`
pub const NOTSOCK: Self = Self(c::ENOTSOCK);
@@ -789,15 +523,10 @@ impl Errno {
pub const NOTTY: Self = Self(c::ENOTTY);
/// `ENOTUNIQ`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const NOTUNIQ: Self = Self(c::ENOTUNIQ);
@@ -810,12 +539,7 @@ impl Errno {
#[cfg(not(windows))]
pub const OVERFLOW: Self = Self(c::EOVERFLOW);
/// `EOWNERDEAD`
- #[cfg(not(any(
- windows,
- target_os = "haiku",
- target_os = "dragonfly",
- target_os = "netbsd"
- )))]
+ #[cfg(not(any(freebsdlike, netbsdlike, windows, target_os = "haiku")))]
pub const OWNERDEAD: Self = Self(c::EOWNERDEAD);
/// `EPERM`
#[cfg(not(windows))]
@@ -827,44 +551,16 @@ impl Errno {
#[cfg(not(windows))]
pub const PIPE: Self = Self(c::EPIPE);
/// `EPROCLIM`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const PROCLIM: Self = Self(c::EPROCLIM);
/// `EPROCUNAVAIL`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const PROCUNAVAIL: Self = Self(c::EPROCUNAVAIL);
/// `EPROGMISMATCH`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const PROGMISMATCH: Self = Self(c::EPROGMISMATCH);
/// `EPROGUNAVAIL`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const PROGUNAVAIL: Self = Self(c::EPROGUNAVAIL);
/// `EPROTO`
#[cfg(not(windows))]
@@ -884,15 +580,10 @@ impl Errno {
pub const REFUSED: Self = Self(c::EREFUSED);
/// `EREMCHG`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const REMCHG: Self = Self(c::EREMCHG);
@@ -901,48 +592,26 @@ impl Errno {
pub const REMOTE: Self = Self(c::EREMOTE);
/// `EREMOTEIO`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const REMOTEIO: Self = Self(c::EREMOTEIO);
/// `ERESTART`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const RESTART: Self = Self(c::ERESTART);
/// `ERFKILL`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
target_os = "android",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const RFKILL: Self = Self(c::ERFKILL);
@@ -950,14 +619,7 @@ impl Errno {
#[cfg(not(windows))]
pub const ROFS: Self = Self(c::EROFS);
/// `ERPCMISMATCH`
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
pub const RPCMISMATCH: Self = Self(c::ERPCMISMATCH);
/// `ESHUTDOWN`
#[cfg(not(target_os = "wasi"))]
@@ -973,15 +635,10 @@ impl Errno {
pub const SRCH: Self = Self(c::ESRCH);
/// `ESRMNT`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const SRMNT: Self = Self(c::ESRMNT);
@@ -989,26 +646,15 @@ impl Errno {
pub const STALE: Self = Self(c::ESTALE);
/// `ESTRPIPE`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const STRPIPE: Self = Self(c::ESTRPIPE);
/// `ETIME`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(freebsdlike, windows, target_os = "openbsd", target_os = "wasi")))]
pub const TIME: Self = Self(c::ETIME);
/// `ETIMEDOUT`
pub const TIMEDOUT: Self = Self(c::ETIMEDOUT);
@@ -1024,32 +670,16 @@ impl Errno {
pub const TXTBSY: Self = Self(c::ETXTBSY);
/// `EUCLEAN`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const UCLEAN: Self = Self(c::EUCLEAN);
/// `EUNATCH`
- #[cfg(not(any(
- windows,
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
- )))]
+ #[cfg(not(any(bsd, windows, target_os = "haiku", target_os = "wasi")))]
pub const UNATCH: Self = Self(c::EUNATCH);
/// `EUSERS`
#[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
@@ -1061,15 +691,10 @@ impl Errno {
pub const XDEV: Self = Self(c::EXDEV);
/// `EXFULL`
#[cfg(not(any(
+ bsd,
windows,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "wasi",
)))]
pub const XFULL: Self = Self(c::EXFULL);
diff --git a/vendor/rustix/src/backend/libc/io/poll_fd.rs b/vendor/rustix/src/backend/libc/io/poll_fd.rs
index c516a9309..a0568c60a 100644
--- a/vendor/rustix/src/backend/libc/io/poll_fd.rs
+++ b/vendor/rustix/src/backend/libc/io/poll_fd.rs
@@ -119,7 +119,7 @@ impl<'fd> PollFd<'fd> {
impl<'fd> AsFd for PollFd<'fd> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
- // Safety: Our constructors and `set_fd` require `pollfd.fd` to be
+ // SAFETY: Our constructors and `set_fd` require `pollfd.fd` to be
// valid for the `fd lifetime.
unsafe { BorrowedFd::borrow_raw(self.pollfd.fd) }
}
@@ -129,7 +129,7 @@ impl<'fd> AsFd for PollFd<'fd> {
impl<'fd> io_lifetimes::AsSocket for PollFd<'fd> {
#[inline]
fn as_socket(&self) -> BorrowedFd<'_> {
- // Safety: Our constructors and `set_fd` require `pollfd.fd` to be
+ // SAFETY: Our constructors and `set_fd` require `pollfd.fd` to be
// valid for the `fd lifetime.
unsafe { BorrowedFd::borrow_raw(self.pollfd.fd as RawFd) }
}
diff --git a/vendor/rustix/src/backend/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs
index 3774e700a..03f9294d9 100644
--- a/vendor/rustix/src/backend/libc/io/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io/syscalls.rs
@@ -12,15 +12,13 @@ use super::super::offset::{libc_preadv, libc_pwritev};
#[cfg(all(target_os = "linux", target_env = "gnu"))]
use super::super::offset::{libc_preadv2, libc_pwritev2};
use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
+#[cfg(bsd)]
+use crate::io::kqueue::Event;
+#[cfg(solarish)]
+use crate::io::port::Event;
#[cfg(not(any(target_os = "aix", target_os = "wasi")))]
use crate::io::DupFlags;
-#[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "wasi"
-)))]
+#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))]
use crate::io::PipeFlags;
use crate::io::{self, FdFlags, IoSlice, IoSliceMut, PollFd};
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -167,7 +165,7 @@ pub(crate) fn preadv2(
}
/// At present, `libc` only has `preadv2` defined for glibc. On other
-/// ABIs, `ReadWriteFlags` has no flags defined, and we use plain `preadv`.
+/// ABIs, use `libc::syscall`.
#[cfg(any(
target_os = "android",
all(target_os = "linux", not(target_env = "gnu")),
@@ -179,8 +177,19 @@ pub(crate) fn preadv2(
offset: u64,
flags: ReadWriteFlags,
) -> io::Result<usize> {
- assert!(flags.is_empty());
- preadv(fd, bufs, offset)
+ // Silently cast; we'll get `EINVAL` if the value is negative.
+ let offset = offset as i64;
+ let nread = unsafe {
+ ret_ssize_t(libc::syscall(
+ libc::SYS_preadv2,
+ borrowed_fd(fd),
+ bufs.as_ptr().cast::<c::iovec>(),
+ min(bufs.len(), max_iov()) as c::c_int,
+ offset,
+ flags.bits(),
+ ) as c::ssize_t)?
+ };
+ Ok(nread as usize)
}
#[cfg(all(target_os = "linux", target_env = "gnu"))]
@@ -205,7 +214,7 @@ pub(crate) fn pwritev2(
}
/// At present, `libc` only has `pwritev2` defined for glibc. On other
-/// ABIs, `ReadWriteFlags` has no flags defined, and we use plain `pwritev`.
+/// ABIs, use `libc::syscall`.
#[cfg(any(
target_os = "android",
all(target_os = "linux", not(target_env = "gnu")),
@@ -217,12 +226,23 @@ pub(crate) fn pwritev2(
offset: u64,
flags: ReadWriteFlags,
) -> io::Result<usize> {
- assert!(flags.is_empty());
- pwritev(fd, bufs, offset)
+ // Silently cast; we'll get `EINVAL` if the value is negative.
+ let offset = offset as i64;
+ let nwritten = unsafe {
+ ret_ssize_t(libc::syscall(
+ libc::SYS_pwritev2,
+ borrowed_fd(fd),
+ bufs.as_ptr().cast::<c::iovec>(),
+ min(bufs.len(), max_iov()) as c::c_int,
+ offset,
+ flags.bits(),
+ ) as c::ssize_t)?
+ };
+ Ok(nwritten as usize)
}
// These functions are derived from Rust's library/std/src/sys/unix/fd.rs at
-// revision a77da2d454e6caa227a85b16410b95f93495e7e0.
+// revision 326ef470a8b379a180d6dc4bbef08990698a737a.
// The maximum read limit on most POSIX-like systems is `SSIZE_MAX`, with the
// man page quoting that if the count of bytes to read is greater than
@@ -237,33 +257,28 @@ const READ_LIMIT: usize = c::c_int::MAX as usize - 1;
#[cfg(not(target_os = "macos"))]
const READ_LIMIT: usize = c::ssize_t::MAX as usize;
-#[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
-))]
+#[cfg(bsd)]
const fn max_iov() -> usize {
c::IOV_MAX as usize
}
-#[cfg(any(target_os = "android", target_os = "emscripten", target_os = "linux"))]
+#[cfg(any(
+ target_os = "android",
+ target_os = "emscripten",
+ target_os = "linux",
+ target_os = "nto"
+))]
const fn max_iov() -> usize {
c::UIO_MAXIOV as usize
}
#[cfg(not(any(
+ bsd,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
- target_os = "ios",
target_os = "linux",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
+ target_os = "nto",
+ target_os = "horizon",
)))]
const fn max_iov() -> usize {
16 // The minimum value required by POSIX.
@@ -321,6 +336,33 @@ pub(crate) fn ioctl_fionbio(fd: BorrowedFd<'_>, value: bool) -> io::Result<()> {
}
}
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::Result<()> {
+ // TODO: Enable `ioctl_ficlone` for android when upstream is updated.
+ // TODO: Enable `ioctl_ficlone` for more architectures when upstream is
+ // updated.
+ #[cfg(all(
+ target_os = "linux",
+ any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
+ ))]
+ unsafe {
+ ret(c::ioctl(
+ borrowed_fd(fd),
+ c::FICLONE as _,
+ borrowed_fd(src_fd),
+ ))
+ }
+ #[cfg(not(all(
+ target_os = "linux",
+ any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64")
+ )))]
+ {
+ let _ = fd;
+ let _ = src_fd;
+ Err(io::Errno::NOSYS)
+ }
+}
+
#[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)> {
@@ -398,12 +440,11 @@ pub(crate) fn dup2(fd: BorrowedFd<'_>, new: &mut OwnedFd) -> io::Result<()> {
}
#[cfg(not(any(
+ apple,
target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
target_os = "wasi",
)))]
@@ -418,11 +459,10 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, flags: DupFlags) -> io
}
#[cfg(any(
+ apple,
target_os = "android",
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
))]
pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, _flags: DupFlags) -> io::Result<()> {
@@ -433,7 +473,7 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, _flags: DupFlags) -> i
dup2(fd, new)
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(crate) fn ioctl_fioclex(fd: BorrowedFd<'_>) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::FIOCLEX)) }
}
@@ -448,6 +488,34 @@ pub(crate) fn ioctl_tiocnxcl(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::ioctl(borrowed_fd(fd), c::TIOCNXCL as _)) }
}
+#[cfg(bsd)]
+pub(crate) fn kqueue() -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(c::kqueue()) }
+}
+
+#[cfg(bsd)]
+pub(crate) unsafe fn kevent(
+ kq: BorrowedFd<'_>,
+ changelist: &[Event],
+ eventlist: &mut [MaybeUninit<Event>],
+ timeout: Option<&c::timespec>,
+) -> io::Result<c::c_int> {
+ ret_c_int(c::kevent(
+ borrowed_fd(kq),
+ changelist.as_ptr() as *const _,
+ changelist
+ .len()
+ .try_into()
+ .map_err(|_| io::Errno::OVERFLOW)?,
+ eventlist.as_mut_ptr() as *mut _,
+ eventlist
+ .len()
+ .try_into()
+ .map_err(|_| io::Errno::OVERFLOW)?,
+ timeout.map_or(core::ptr::null(), |t| t as *const _),
+ ))
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
unsafe {
@@ -458,13 +526,7 @@ pub(crate) fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
}
}
-#[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "wasi"
-)))]
+#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "wasi")))]
pub(crate) fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
unsafe {
let mut result = MaybeUninit::<[OwnedFd; 2]>::uninit();
@@ -531,3 +593,85 @@ pub unsafe fn vmsplice(
))
.map(|spliced| spliced as usize)
}
+
+#[cfg(solarish)]
+pub(crate) fn port_create() -> io::Result<OwnedFd> {
+ unsafe { ret_owned_fd(c::port_create()) }
+}
+
+#[cfg(solarish)]
+pub(crate) unsafe fn port_associate(
+ port: BorrowedFd<'_>,
+ source: c::c_int,
+ object: c::uintptr_t,
+ events: c::c_int,
+ user: *mut c::c_void,
+) -> io::Result<()> {
+ ret(c::port_associate(
+ borrowed_fd(port),
+ source,
+ object,
+ events,
+ user,
+ ))
+}
+
+#[cfg(solarish)]
+pub(crate) unsafe fn port_dissociate(
+ port: BorrowedFd<'_>,
+ source: c::c_int,
+ object: c::uintptr_t,
+) -> io::Result<()> {
+ ret(c::port_dissociate(borrowed_fd(port), source, object))
+}
+
+#[cfg(solarish)]
+pub(crate) fn port_get(
+ port: BorrowedFd<'_>,
+ timeout: Option<&mut c::timespec>,
+) -> io::Result<Event> {
+ let mut event = MaybeUninit::<c::port_event>::uninit();
+ let timeout = timeout.map_or(core::ptr::null_mut(), |t| t as *mut _);
+
+ unsafe {
+ ret(c::port_get(borrowed_fd(port), event.as_mut_ptr(), timeout))?;
+ }
+
+ // If we're done, initialize the event and return it.
+ Ok(Event(unsafe { event.assume_init() }))
+}
+
+#[cfg(solarish)]
+pub(crate) fn port_getn(
+ port: BorrowedFd<'_>,
+ timeout: Option<&mut c::timespec>,
+ events: &mut Vec<Event>,
+ mut nget: u32,
+) -> io::Result<()> {
+ let timeout = timeout.map_or(core::ptr::null_mut(), |t| t as *mut _);
+ unsafe {
+ ret(c::port_getn(
+ borrowed_fd(port),
+ events.as_mut_ptr().cast(),
+ events.len().try_into().unwrap(),
+ &mut nget,
+ timeout,
+ ))?;
+ }
+
+ // Update the vector length.
+ unsafe {
+ events.set_len(nget.try_into().unwrap());
+ }
+
+ Ok(())
+}
+
+#[cfg(solarish)]
+pub(crate) fn port_send(
+ port: BorrowedFd<'_>,
+ events: c::c_int,
+ userdata: *mut c::c_void,
+) -> io::Result<()> {
+ unsafe { ret(c::port_send(borrowed_fd(port), events, userdata)) }
+}
diff --git a/vendor/rustix/src/backend/libc/io/types.rs b/vendor/rustix/src/backend/libc/io/types.rs
index 46d5f6332..cbdd734b9 100644
--- a/vendor/rustix/src/backend/libc/io/types.rs
+++ b/vendor/rustix/src/backend/libc/io/types.rs
@@ -22,20 +22,15 @@ bitflags! {
/// [`pwritev2`]: crate::io::pwritev
pub struct ReadWriteFlags: c::c_int {
/// `RWF_DSYNC` (since Linux 4.7)
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
- const DSYNC = c::RWF_DSYNC;
+ const DSYNC = linux_raw_sys::general::RWF_DSYNC as c::c_int;
/// `RWF_HIPRI` (since Linux 4.6)
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
- const HIPRI = c::RWF_HIPRI;
+ const HIPRI = linux_raw_sys::general::RWF_HIPRI as c::c_int;
/// `RWF_SYNC` (since Linux 4.7)
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
- const SYNC = c::RWF_SYNC;
+ const SYNC = linux_raw_sys::general::RWF_SYNC as c::c_int;
/// `RWF_NOWAIT` (since Linux 4.14)
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
- const NOWAIT = c::RWF_NOWAIT;
+ const NOWAIT = linux_raw_sys::general::RWF_NOWAIT as c::c_int;
/// `RWF_APPEND` (since Linux 4.16)
- #[cfg(all(target_os = "linux", target_env = "gnu"))]
- const APPEND = c::RWF_APPEND;
+ const APPEND = linux_raw_sys::general::RWF_APPEND as c::c_int;
}
}
@@ -62,16 +57,16 @@ bitflags! {
pub struct DupFlags: c::c_int {
/// `O_CLOEXEC`
#[cfg(not(any(
+ apple,
+ target_os = "aix",
target_os = "android",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
)))] // Android 5.0 has dup3, but libc doesn't have bindings
const CLOEXEC = c::O_CLOEXEC;
}
}
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(apple, target_os = "wasi")))]
bitflags! {
/// `O_*` constants for use with [`pipe_with`].
///
@@ -81,11 +76,10 @@ bitflags! {
const CLOEXEC = c::O_CLOEXEC;
/// `O_DIRECT`
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const DIRECT = c::O_DIRECT;
/// `O_NONBLOCK`
@@ -109,13 +103,7 @@ bitflags! {
}
/// `PIPE_BUF`—The maximum size of a write to a pipe guaranteed to be atomic.
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub const PIPE_BUF: usize = c::PIPE_BUF;
#[cfg(not(any(windows, target_os = "redox")))]
@@ -128,9 +116,10 @@ pub(crate) const STDOUT_FILENO: c::c_int = c::STDOUT_FILENO;
pub(crate) const STDERR_FILENO: c::c_int = c::STDERR_FILENO;
/// A buffer type used with `vmsplice`.
-/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms and WSABUF on Windows.
-/// Unlike `IoSlice` and `IoSliceMut` it is semantically like a raw pointer,
-/// and therefore can be shared or mutated as needed.
+/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms
+/// and `WSABUF` on Windows. Unlike `IoSlice` and `IoSliceMut` it is
+/// semantically like a raw pointer, and therefore can be shared or mutated as
+/// needed.
#[cfg(any(target_os = "android", target_os = "linux"))]
#[repr(transparent)]
pub struct IoSliceRaw<'a> {
diff --git a/vendor/rustix/src/backend/libc/io_lifetimes.rs b/vendor/rustix/src/backend/libc/io_lifetimes.rs
index 2dcd772e8..993365c0c 100644
--- a/vendor/rustix/src/backend/libc/io_lifetimes.rs
+++ b/vendor/rustix/src/backend/libc/io_lifetimes.rs
@@ -13,11 +13,11 @@ pub use io_lifetimes::AsSocket;
/// A version of [`AsRawFd`] for use with Winsock2 API.
///
-/// [`AsRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsRawFd.html
+/// [`AsRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsRawFd.html
pub trait AsRawFd {
/// A version of [`as_raw_fd`] for use with Winsock2 API.
///
- /// [`as_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.as_raw_fd
+ /// [`as_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.as_raw_fd
fn as_raw_fd(&self) -> RawFd;
}
#[cfg(feature = "std")]
@@ -30,11 +30,11 @@ impl<T: std::os::windows::io::AsRawSocket> AsRawFd for T {
/// A version of [`IntoRawFd`] for use with Winsock2 API.
///
-/// [`IntoRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.IntoRawFd.html
+/// [`IntoRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.IntoRawFd.html
pub trait IntoRawFd {
/// A version of [`into_raw_fd`] for use with Winsock2 API.
///
- /// [`into_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.into_raw_fd
+ /// [`into_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.into_raw_fd
fn into_raw_fd(self) -> RawFd;
}
#[cfg(feature = "std")]
@@ -47,11 +47,16 @@ impl<T: std::os::windows::io::IntoRawSocket> IntoRawFd for T {
/// A version of [`FromRawFd`] for use with Winsock2 API.
///
-/// [`FromRawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html
+/// [`FromRawFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html
pub trait FromRawFd {
/// A version of [`from_raw_fd`] for use with Winsock2 API.
///
- /// [`from_raw_fd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.FromRawFd.html#tymethod.from_raw_fd
+ /// # Safety
+ ///
+ /// See the [safety requirements] for [`from_raw_fd`].
+ ///
+ /// [`from_raw_fd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#tymethod.from_raw_fd
+ /// [safety requirements]: https://doc.rust-lang.org/stable/std/os/fd/trait.FromRawFd.html#safety
unsafe fn from_raw_fd(raw_fd: RawFd) -> Self;
}
#[cfg(feature = "std")]
@@ -64,7 +69,7 @@ impl<T: std::os::windows::io::FromRawSocket> FromRawFd for T {
/// A version of [`AsFd`] for use with Winsock2 API.
///
-/// [`AsFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsFd.html
+/// [`AsFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsFd.html
pub trait AsFd {
/// An `as_fd` function for Winsock2, where a `Fd` is a `Socket`.
fn as_fd(&self) -> BorrowedFd;
diff --git a/vendor/rustix/src/backend/libc/io_uring/syscalls.rs b/vendor/rustix/src/backend/libc/io_uring/syscalls.rs
index 31fcec3db..17d3eb10c 100644
--- a/vendor/rustix/src/backend/libc/io_uring/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/io_uring/syscalls.rs
@@ -1,7 +1,7 @@
//! libc syscalls supporting `rustix::io_uring`.
use super::super::c;
-use super::super::conv::{borrowed_fd, syscall_ret, syscall_ret_owned_fd, syscall_ret_u32};
+use super::super::conv::{borrowed_fd, syscall_ret_owned_fd, syscall_ret_u32};
use crate::fd::{BorrowedFd, OwnedFd};
use crate::io;
use crate::io_uring::{io_uring_params, IoringEnterFlags, IoringRegisterOp};
@@ -24,8 +24,8 @@ pub(crate) unsafe fn io_uring_register(
opcode: IoringRegisterOp,
arg: *const c::c_void,
nr_args: u32,
-) -> io::Result<()> {
- syscall_ret(c::syscall(
+) -> io::Result<u32> {
+ syscall_ret_u32(c::syscall(
__NR_io_uring_register as _,
borrowed_fd(fd),
opcode as u32 as usize,
diff --git a/vendor/rustix/src/backend/libc/mm/syscalls.rs b/vendor/rustix/src/backend/libc/mm/syscalls.rs
index a1d2df1af..16636f1b9 100644
--- a/vendor/rustix/src/backend/libc/mm/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/mm/syscalls.rs
@@ -7,7 +7,7 @@ use super::super::conv::{borrowed_fd, no_fd, ret};
use super::super::offset::libc_mmap;
#[cfg(not(target_os = "redox"))]
use super::types::Advice;
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
use super::types::MremapFlags;
use super::types::{MapFlags, MprotectFlags, MsyncFlags, ProtFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -130,7 +130,7 @@ pub(crate) unsafe fn munmap(ptr: *mut c::c_void, len: usize) -> io::Result<()> {
///
/// `mremap` is primarily unsafe due to the `old_address` parameter, as
/// anything working with memory pointed to by raw pointers is unsafe.
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
pub(crate) unsafe fn mremap(
old_address: *mut c::c_void,
old_size: usize,
@@ -150,7 +150,7 @@ pub(crate) unsafe fn mremap(
/// `mremap_fixed` is primarily unsafe due to the `old_address` and
/// `new_address` parameters, as anything working with memory pointed to by raw
/// pointers is unsafe.
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
pub(crate) unsafe fn mremap_fixed(
old_address: *mut c::c_void,
old_size: usize,
diff --git a/vendor/rustix/src/backend/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs
index 11ab708cf..cd6e521d2 100644
--- a/vendor/rustix/src/backend/libc/mm/types.rs
+++ b/vendor/rustix/src/backend/libc/mm/types.rs
@@ -51,165 +51,109 @@ bitflags! {
const SHARED = c::MAP_SHARED;
/// `MAP_SHARED_VALIDATE`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const SHARED_VALIDATE = c::MAP_SHARED_VALIDATE;
/// `MAP_PRIVATE`
const PRIVATE = c::MAP_PRIVATE;
/// `MAP_DENYWRITE`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const DENYWRITE = c::MAP_DENYWRITE;
/// `MAP_FIXED`
const FIXED = c::MAP_FIXED;
/// `MAP_FIXED_NOREPLACE`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const FIXED_NOREPLACE = c::MAP_FIXED_NOREPLACE;
/// `MAP_GROWSDOWN`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const GROWSDOWN = c::MAP_GROWSDOWN;
/// `MAP_HUGETLB`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const HUGETLB = c::MAP_HUGETLB;
/// `MAP_HUGE_2MB`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const HUGE_2MB = c::MAP_HUGE_2MB;
/// `MAP_HUGE_1GB`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const HUGE_1GB = c::MAP_HUGE_1GB;
/// `MAP_LOCKED`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const LOCKED = c::MAP_LOCKED;
/// `MAP_NOCORE`
- #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
+ #[cfg(freebsdlike)]
const NOCORE = c::MAP_NOCORE;
/// `MAP_NORESERVE`
- #[cfg(not(any(target_os = "dragonfly", target_os = "freebsd", target_os = "redox")))]
+ #[cfg(not(any(freebsdlike, target_os = "redox")))]
const NORESERVE = c::MAP_NORESERVE;
/// `MAP_NOSYNC`
- #[cfg(any(target_os = "dragonfly", target_os = "freebsd"))]
+ #[cfg(freebsdlike)]
const NOSYNC = c::MAP_NOSYNC;
/// `MAP_POPULATE`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const POPULATE = c::MAP_POPULATE;
/// `MAP_STACK`
#[cfg(not(any(
+ apple,
+ solarish,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
)))]
const STACK = c::MAP_STACK;
/// `MAP_PREFAULT_READ`
@@ -217,19 +161,13 @@ bitflags! {
const PREFAULT_READ = c::MAP_PREFAULT_READ;
/// `MAP_SYNC`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
any(target_arch = "mips", target_arch = "mips64"),
@@ -242,7 +180,7 @@ bitflags! {
}
}
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
bitflags! {
/// `MREMAP_*` flags for use with [`mremap`].
///
diff --git a/vendor/rustix/src/backend/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs
index 70029282f..1961d1291 100644
--- a/vendor/rustix/src/backend/libc/mod.rs
+++ b/vendor/rustix/src/backend/libc/mod.rs
@@ -49,11 +49,8 @@ pub(crate) mod fd {
// On Windows we emulate selected libc-compatible interfaces. On non-Windows,
// we just use libc here, since this is the libc backend.
-#[cfg(windows)]
-#[path = "winsock_c.rs"]
+#[cfg_attr(windows, path = "winsock_c.rs")]
pub(crate) mod c;
-#[cfg(not(windows))]
-pub(crate) use libc as c;
#[cfg(not(windows))]
#[cfg(feature = "fs")]
diff --git a/vendor/rustix/src/backend/libc/net/addr.rs b/vendor/rustix/src/backend/libc/net/addr.rs
index ba64ed279..d00a48626 100644
--- a/vendor/rustix/src/backend/libc/net/addr.rs
+++ b/vendor/rustix/src/backend/libc/net/addr.rs
@@ -20,14 +20,7 @@ use core::slice;
#[doc(alias = "sockaddr_un")]
pub struct SocketAddrUnix {
pub(crate) unix: c::sockaddr_un,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
len: c::socklen_t,
}
@@ -50,28 +43,14 @@ impl SocketAddrUnix {
unix.sun_path[i] = *b as c::c_char;
}
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
{
unix.sun_len = (offsetof_sun_path() + bytes.len()).try_into().unwrap();
}
Ok(Self {
unix,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
len: (offsetof_sun_path() + bytes.len()).try_into().unwrap(),
})
}
@@ -92,49 +71,19 @@ impl SocketAddrUnix {
let len = len.try_into().unwrap();
Ok(Self {
unix,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
len,
})
}
fn init() -> c::sockaddr_un {
c::sockaddr_un {
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sun_len: 0,
sun_family: c::AF_UNIX as _,
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
sun_path: [0; 104],
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
sun_path: [0; 108],
#[cfg(target_os = "haiku")]
sun_path: [0; 126],
@@ -148,7 +97,7 @@ impl SocketAddrUnix {
if len != 0 && self.unix.sun_path[0] != b'\0' as c::c_char {
let end = len as usize - offsetof_sun_path();
let bytes = &self.unix.sun_path[..end];
- // Safety: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`. And
+ // SAFETY: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`. And
// `from_bytes_with_nul_unchecked` since the string is NUL-terminated.
unsafe {
Some(CStr::from_bytes_with_nul_unchecked(slice::from_raw_parts(
@@ -169,7 +118,7 @@ impl SocketAddrUnix {
if len != 0 && self.unix.sun_path[0] == b'\0' as c::c_char {
let end = len as usize - offsetof_sun_path();
let bytes = &self.unix.sun_path[1..end];
- // Safety: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`.
+ // SAFETY: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`.
unsafe { Some(slice::from_raw_parts(bytes.as_ptr().cast(), bytes.len())) }
} else {
None
@@ -178,25 +127,11 @@ impl SocketAddrUnix {
#[inline]
pub(crate) fn addr_len(&self) -> c::socklen_t {
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
{
self.len
}
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
{
c::socklen_t::from(self.unix.sun_len)
}
@@ -274,54 +209,15 @@ pub type SocketAddrStorage = c::sockaddr_storage;
#[inline]
pub(crate) fn offsetof_sun_path() -> usize {
let z = c::sockaddr_un {
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sun_len: 0_u8,
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sun_family: 0_u8,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
sun_family: 0_u16,
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(bsd)]
sun_path: [0; 104],
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
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 1c8f9f65c..f4ad316dd 100644
--- a/vendor/rustix/src/backend/libc/net/ext.rs
+++ b/vendor/rustix/src/backend/libc/net/ext.rs
@@ -130,16 +130,7 @@ pub(crate) fn sockaddr_in6_sin6_scope_id(addr: c::sockaddr_in6) -> u32 {
#[cfg(not(windows))]
#[inline]
pub(crate) const fn sockaddr_in6_new(
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
- sin6_len: u8,
+ #[cfg(any(bsd, target_os = "haiku"))] sin6_len: u8,
sin6_family: c::sa_family_t,
sin6_port: u16,
sin6_flowinfo: u32,
@@ -147,22 +138,14 @@ pub(crate) const fn sockaddr_in6_new(
sin6_scope_id: u32,
) -> c::sockaddr_in6 {
c::sockaddr_in6 {
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sin6_len,
sin6_family,
sin6_port,
sin6_flowinfo,
sin6_addr,
sin6_scope_id,
- #[cfg(any(target_os = "illumos", target_os = "solaris"))]
+ #[cfg(solarish)]
__sin6_src_id: 0,
}
}
diff --git a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
index 5a946fbeb..575102c27 100644
--- a/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/read_sockaddr.rs
@@ -13,32 +13,11 @@ use core::mem::size_of;
// This must match the header of `sockaddr`.
#[repr(C)]
struct sockaddr_header {
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sa_len: u8,
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
ss_family: u8,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
ss_family: u16,
}
@@ -46,35 +25,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(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sa_len: 0_u8,
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sa_family: 0_u8,
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
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 8d1cc8ab7..114807808 100644
--- a/vendor/rustix/src/backend/libc/net/send_recv.rs
+++ b/vendor/rustix/src/backend/libc/net/send_recv.rs
@@ -6,16 +6,10 @@ bitflags! {
pub struct SendFlags: i32 {
/// `MSG_CONFIRM`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
const CONFIRM = c::MSG_CONFIRM;
/// `MSG_DONTROUTE`
@@ -28,19 +22,13 @@ bitflags! {
const EOT = c::MSG_EOR;
/// `MSG_MORE`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
const MORE = c::MSG_MORE;
- #[cfg(not(any(windows, target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(apple, windows)))]
/// `MSG_NOSIGNAL`
const NOSIGNAL = c::MSG_NOSIGNAL;
/// `MSG_OOB`
@@ -51,7 +39,7 @@ bitflags! {
bitflags! {
/// `MSG_*`
pub struct RecvFlags: i32 {
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "solaris")))]
+ #[cfg(not(any(apple, solarish, windows, target_os = "haiku")))]
/// `MSG_CMSG_CLOEXEC`
const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC;
/// `MSG_DONTWAIT`
@@ -59,16 +47,10 @@ bitflags! {
const DONTWAIT = c::MSG_DONTWAIT;
/// `MSG_ERRQUEUE`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
const ERRQUEUE = c::MSG_ERRQUEUE;
/// `MSG_OOB`
diff --git a/vendor/rustix/src/backend/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs
index 3d8a849c7..ed4494394 100644
--- a/vendor/rustix/src/backend/libc/net/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/net/syscalls.rs
@@ -251,10 +251,9 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result<OwnedFd> {
}
#[cfg(not(any(
+ apple,
windows,
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
target_os = "wasi",
)))]
@@ -288,10 +287,9 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<
}
#[cfg(not(any(
+ apple,
windows,
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
target_os = "wasi",
)))]
@@ -317,14 +315,14 @@ pub(crate) fn acceptfrom_with(
/// Darwin lacks `accept4`, but does have `accept`. We define
/// `AcceptFlags` to have no flags, so we can discard it here.
-#[cfg(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos"))]
+#[cfg(any(apple, windows, target_os = "haiku"))]
pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: AcceptFlags) -> io::Result<OwnedFd> {
accept(sockfd)
}
/// Darwin lacks `accept4`, but does have `accept`. We define
/// `AcceptFlags` to have no flags, so we can discard it here.
-#[cfg(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos"))]
+#[cfg(any(apple, windows, target_os = "haiku"))]
pub(crate) fn acceptfrom_with(
sockfd: BorrowedFd<'_>,
_flags: AcceptFlags,
@@ -555,11 +553,12 @@ pub(crate) mod sockopt {
return Err(io::Errno::INVAL);
}
- let tv_sec = timeout.as_secs().try_into();
- #[cfg(not(all(target_arch = "x86_64", target_pointer_width = "32")))]
- let tv_sec = tv_sec.unwrap_or(c::c_long::MAX);
- #[cfg(all(target_arch = "x86_64", target_pointer_width = "32"))]
- let tv_sec = tv_sec.unwrap_or(i64::MAX);
+ // Rust's musl libc bindings deprecated `time_t` while they
+ // transition to 64-bit `time_t`. What we want here is just
+ // "whatever type `timeval`'s `tv_sec` is", so we're ok using
+ // the deprecated type.
+ #[allow(deprecated)]
+ let tv_sec = timeout.as_secs().try_into().unwrap_or(c::time_t::MAX);
// `subsec_micros` rounds down, so we use `subsec_nanos` and
// manually round up.
@@ -635,6 +634,28 @@ pub(crate) mod sockopt {
}
}
+ #[cfg(any(apple, target_os = "freebsd"))]
+ #[inline]
+ pub(crate) fn getsockopt_nosigpipe(fd: BorrowedFd<'_>) -> io::Result<bool> {
+ getsockopt(fd, c::SOL_SOCKET, c::SO_NOSIGPIPE).map(to_bool)
+ }
+
+ #[cfg(any(apple, target_os = "freebsd"))]
+ #[inline]
+ pub(crate) fn setsockopt_nosigpipe(fd: BorrowedFd<'_>, val: bool) -> io::Result<()> {
+ setsockopt(fd, c::SOL_SOCKET, c::SO_NOSIGPIPE, from_bool(val))
+ }
+
+ #[inline]
+ pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), crate::io::Errno>> {
+ let err: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_ERROR)?;
+ Ok(if err == 0 {
+ Ok(())
+ } else {
+ Err(crate::io::Errno::from_raw_os_error(err))
+ })
+ }
+
#[inline]
pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl)
@@ -735,31 +756,9 @@ pub(crate) mod sockopt {
multiaddr: &Ipv6Addr,
interface: u32,
) -> io::Result<()> {
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "l4re",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "haiku", target_os = "l4re")))]
use c::IPV6_ADD_MEMBERSHIP;
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "l4re",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- ))]
+ #[cfg(any(bsd, solarish, target_os = "haiku", target_os = "l4re"))]
use c::IPV6_JOIN_GROUP as IPV6_ADD_MEMBERSHIP;
let mreq = to_ipv6mr(multiaddr, interface);
@@ -782,31 +781,9 @@ pub(crate) mod sockopt {
multiaddr: &Ipv6Addr,
interface: u32,
) -> io::Result<()> {
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "l4re",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "haiku", target_os = "l4re")))]
use c::IPV6_DROP_MEMBERSHIP;
- #[cfg(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "l4re",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- ))]
+ #[cfg(any(bsd, solarish, target_os = "haiku", target_os = "l4re"))]
use c::IPV6_LEAVE_GROUP as IPV6_DROP_MEMBERSHIP;
let mreq = to_ipv6mr(multiaddr, interface);
diff --git a/vendor/rustix/src/backend/libc/net/types.rs b/vendor/rustix/src/backend/libc/net/types.rs
index 19d97e7c7..54f60ca50 100644
--- a/vendor/rustix/src/backend/libc/net/types.rs
+++ b/vendor/rustix/src/backend/libc/net/types.rs
@@ -62,16 +62,10 @@ impl AddressFamily {
pub const INET6: Self = Self(c::AF_INET6 as _);
/// `AF_NETLINK`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const NETLINK: Self = Self(c::AF_NETLINK as _);
/// `AF_UNIX`, aka `AF_LOCAL`
@@ -79,16 +73,10 @@ impl AddressFamily {
pub const UNIX: Self = Self(c::AF_UNIX as _);
/// `AF_AX25`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const AX25: Self = Self(c::AF_AX25 as _);
/// `AF_IPX`
@@ -97,70 +85,41 @@ impl AddressFamily {
pub const APPLETALK: Self = Self(c::AF_APPLETALK as _);
/// `AF_NETROM`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const NETROM: Self = Self(c::AF_NETROM as _);
/// `AF_BRIDGE`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const BRIDGE: Self = Self(c::AF_BRIDGE as _);
/// `AF_ATMPVC`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const ATMPVC: Self = Self(c::AF_ATMPVC as _);
/// `AF_X25`
#[cfg(not(any(
+ bsd,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
)))]
pub const X25: Self = Self(c::AF_X25 as _);
/// `AF_ROSE`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const ROSE: Self = Self(c::AF_ROSE as _);
/// `AF_DECnet`
@@ -169,110 +128,64 @@ impl AddressFamily {
pub const DECnet: Self = Self(c::AF_DECnet as _);
/// `AF_NETBEUI`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const NETBEUI: Self = Self(c::AF_NETBEUI as _);
/// `AF_SECURITY`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const SECURITY: Self = Self(c::AF_SECURITY as _);
/// `AF_KEY`
#[cfg(not(any(
+ bsd,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
)))]
pub const KEY: Self = Self(c::AF_KEY as _);
/// `AF_PACKET`
#[cfg(not(any(
+ bsd,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
)))]
pub const PACKET: Self = Self(c::AF_PACKET as _);
/// `AF_ASH`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const ASH: Self = Self(c::AF_ASH as _);
/// `AF_ECONET`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const ECONET: Self = Self(c::AF_ECONET as _);
/// `AF_ATMSVC`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const ATMSVC: Self = Self(c::AF_ATMSVC as _);
/// `AF_RDS`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const RDS: Self = Self(c::AF_RDS as _);
/// `AF_SNA`
@@ -280,147 +193,87 @@ impl AddressFamily {
pub const SNA: Self = Self(c::AF_SNA as _);
/// `AF_IRDA`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const IRDA: Self = Self(c::AF_IRDA as _);
/// `AF_PPPOX`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const PPPOX: Self = Self(c::AF_PPPOX as _);
/// `AF_WANPIPE`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const WANPIPE: Self = Self(c::AF_WANPIPE as _);
/// `AF_LLC`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const LLC: Self = Self(c::AF_LLC as _);
/// `AF_CAN`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const CAN: Self = Self(c::AF_CAN as _);
/// `AF_TIPC`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const TIPC: Self = Self(c::AF_TIPC as _);
/// `AF_BLUETOOTH`
- #[cfg(not(any(windows, target_os = "illumos", target_os = "ios", target_os = "macos", target_os = "solaris")))]
+ #[cfg(not(any(apple, solarish, windows)))]
pub const BLUETOOTH: Self = Self(c::AF_BLUETOOTH as _);
/// `AF_IUCV`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const IUCV: Self = Self(c::AF_IUCV as _);
/// `AF_RXRPC`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const RXRPC: Self = Self(c::AF_RXRPC as _);
/// `AF_ISDN`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, windows, target_os = "haiku")))]
pub const ISDN: Self = Self(c::AF_ISDN as _);
/// `AF_PHONET`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const PHONET: Self = Self(c::AF_PHONET as _);
/// `AF_IEEE802154`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const IEEE802154: Self = Self(c::AF_IEEE802154 as _);
@@ -453,164 +306,134 @@ impl Protocol {
/// `IPPROTO_ICMP`
pub const ICMP: Self = Self(c::IPPROTO_ICMP as _);
/// `IPPROTO_IGMP`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const IGMP: Self = Self(c::IPPROTO_IGMP as _);
/// `IPPROTO_IPIP`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, windows, target_os = "haiku")))]
pub const IPIP: Self = Self(c::IPPROTO_IPIP as _);
/// `IPPROTO_TCP`
pub const TCP: Self = Self(c::IPPROTO_TCP as _);
/// `IPPROTO_EGP`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const EGP: Self = Self(c::IPPROTO_EGP as _);
/// `IPPROTO_PUP`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const PUP: Self = Self(c::IPPROTO_PUP as _);
/// `IPPROTO_UDP`
pub const UDP: Self = Self(c::IPPROTO_UDP as _);
/// `IPPROTO_IDP`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const IDP: Self = Self(c::IPPROTO_IDP as _);
/// `IPPROTO_TP`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, windows, target_os = "haiku")))]
pub const TP: Self = Self(c::IPPROTO_TP as _);
/// `IPPROTO_DCCP`
#[cfg(not(any(
+ apple,
+ solarish,
windows,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
- target_os = "solaris",
)))]
pub const DCCP: Self = Self(c::IPPROTO_DCCP as _);
/// `IPPROTO_IPV6`
pub const IPV6: Self = Self(c::IPPROTO_IPV6 as _);
/// `IPPROTO_RSVP`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, windows, target_os = "haiku")))]
pub const RSVP: Self = Self(c::IPPROTO_RSVP as _);
/// `IPPROTO_GRE`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, windows, target_os = "haiku")))]
pub const GRE: Self = Self(c::IPPROTO_GRE as _);
/// `IPPROTO_ESP`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const ESP: Self = Self(c::IPPROTO_ESP as _);
/// `IPPROTO_AH`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const AH: Self = Self(c::IPPROTO_AH as _);
/// `IPPROTO_MTP`
#[cfg(not(any(
+ solarish,
+ netbsdlike,
windows,
target_os = "haiku",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const MTP: Self = Self(c::IPPROTO_MTP as _);
/// `IPPROTO_BEETPH`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const BEETPH: Self = Self(c::IPPROTO_BEETPH as _);
/// `IPPROTO_ENCAP`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, windows, target_os = "haiku")))]
pub const ENCAP: Self = Self(c::IPPROTO_ENCAP as _);
/// `IPPROTO_PIM`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const PIM: Self = Self(c::IPPROTO_PIM as _);
/// `IPPROTO_COMP`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const COMP: Self = Self(c::IPPROTO_COMP as _);
/// `IPPROTO_SCTP`
- #[cfg(not(any(target_os = "dragonfly", target_os = "haiku", target_os = "illumos", target_os = "openbsd", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "dragonfly", target_os = "haiku", target_os = "openbsd")))]
pub const SCTP: Self = Self(c::IPPROTO_SCTP as _);
/// `IPPROTO_UDPLITE`
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
windows,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const UDPLITE: Self = Self(c::IPPROTO_UDPLITE as _);
/// `IPPROTO_MPLS`
#[cfg(not(any(
+ apple,
+ solarish,
windows,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
- target_os = "solaris",
)))]
pub const MPLS: Self = Self(c::IPPROTO_MPLS as _);
/// `IPPROTO_RAW`
pub const RAW: Self = Self(c::IPPROTO_RAW as _);
/// `IPPROTO_MPTCP`
#[cfg(not(any(
+ bsd,
+ solarish,
windows,
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const MPTCP: Self = Self(c::IPPROTO_MPTCP as _);
/// `IPPROTO_FRAGMENT`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const FRAGMENT: Self = Self(c::IPPROTO_FRAGMENT as _);
/// `IPPROTO_ICMPV6`
pub const ICMPV6: Self = Self(c::IPPROTO_ICMPV6 as _);
/// `IPPROTO_MH`
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
windows,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
pub const MH: Self = Self(c::IPPROTO_MH as _);
/// `IPPROTO_ROUTING`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
pub const ROUTING: Self = Self(c::IPPROTO_ROUTING as _);
/// Constructs a `Protocol` from a raw integer.
@@ -647,11 +470,11 @@ bitflags! {
/// [`acceptfrom_with`]: crate::net::acceptfrom_with
pub struct AcceptFlags: c::c_int {
/// `SOCK_NONBLOCK`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(apple, windows, target_os = "haiku")))]
const NONBLOCK = c::SOCK_NONBLOCK;
/// `SOCK_CLOEXEC`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(apple, windows, target_os = "haiku")))]
const CLOEXEC = c::SOCK_CLOEXEC;
}
}
@@ -662,11 +485,11 @@ bitflags! {
/// [`socket`]: crate::net::socket
pub struct SocketFlags: c::c_int {
/// `SOCK_NONBLOCK`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(apple, windows, target_os = "haiku")))]
const NONBLOCK = c::SOCK_NONBLOCK;
/// `SOCK_CLOEXEC`
- #[cfg(not(any(windows, target_os = "haiku", target_os = "ios", target_os = "macos")))]
+ #[cfg(not(any(apple, windows, target_os = "haiku")))]
const CLOEXEC = c::SOCK_CLOEXEC;
}
}
diff --git a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
index f44284a0b..f8ab62966 100644
--- a/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
+++ b/vendor/rustix/src/backend/libc/net/write_sockaddr.rs
@@ -23,15 +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(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
sin_len: size_of::<c::sockaddr_in>() as _,
sin_family: c::AF_INET as _,
sin_port: u16::to_be(v4.port()),
@@ -50,15 +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(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- ))]
+ #[cfg(any(bsd, target_os = "haiku"))]
{
sockaddr_in6_new(
size_of::<c::sockaddr_in6>() as _,
@@ -69,15 +53,7 @@ pub(crate) unsafe fn encode_sockaddr_v6(v6: &SocketAddrV6) -> c::sockaddr_in6 {
v6.scope_id(),
)
}
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
{
sockaddr_in6_new(
c::AF_INET6 as _,
diff --git a/vendor/rustix/src/backend/libc/offset.rs b/vendor/rustix/src/backend/libc/offset.rs
index 8aae9d073..9747eb954 100644
--- a/vendor/rustix/src/backend/libc/offset.rs
+++ b/vendor/rustix/src/backend/libc/offset.rs
@@ -3,96 +3,47 @@
#[cfg(not(windows))]
use super::c;
-#[cfg(not(any(
- windows,
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
-)))]
+#[cfg(not(any(linux_like, windows)))]
#[cfg(feature = "fs")]
pub(super) use c::{
fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, lseek as libc_lseek,
off_t as libc_off_t,
};
-#[cfg(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
-))]
+#[cfg(linux_like)]
#[cfg(feature = "fs")]
pub(super) use c::{
fstat64 as libc_fstat, fstatat64 as libc_fstatat, ftruncate64 as libc_ftruncate,
lseek64 as libc_lseek, off64_t as libc_off_t,
};
-#[cfg(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
-))]
+#[cfg(linux_like)]
pub(super) use c::rlimit64 as libc_rlimit;
-#[cfg(not(any(
- windows,
- target_os = "android",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
- target_os = "wasi",
-)))]
+#[cfg(not(any(linux_like, windows, target_os = "wasi")))]
#[cfg(feature = "mm")]
pub(super) use c::mmap as libc_mmap;
#[cfg(not(any(
+ linux_like,
windows,
- target_os = "android",
- target_os = "emscripten",
target_os = "fuchsia",
- target_os = "l4re",
- target_os = "linux",
target_os = "redox",
target_os = "wasi",
)))]
pub(super) use c::{rlimit as libc_rlimit, RLIM_INFINITY as LIBC_RLIM_INFINITY};
-#[cfg(not(any(
- windows,
- target_os = "android",
- target_os = "fuchsia",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "linux",
- target_os = "wasi",
-)))]
+#[cfg(not(any(linux_like, windows, target_os = "fuchsia", target_os = "wasi")))]
pub(super) use c::{getrlimit as libc_getrlimit, setrlimit as libc_setrlimit};
// TODO: Add `RLIM64_INFINITY` to upstream libc.
-#[cfg(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
pub(super) const LIBC_RLIM_INFINITY: u64 = !0_u64;
-#[cfg(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
pub(super) use c::{getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit};
-#[cfg(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
#[cfg(feature = "mm")]
pub(super) use c::mmap64 as libc_mmap;
@@ -152,22 +103,10 @@ pub(super) unsafe fn libc_prlimit(
prlimit64(pid, resource, new_limit, old_limit)
}
-#[cfg(not(any(
- windows,
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
- target_os = "redox",
-)))]
+#[cfg(not(any(linux_like, windows, target_os = "redox")))]
#[cfg(feature = "fs")]
pub(super) use c::openat as libc_openat;
-#[cfg(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
#[cfg(feature = "fs")]
pub(super) use c::openat64 as libc_openat;
@@ -178,29 +117,18 @@ pub(super) use c::fallocate as libc_fallocate;
#[cfg(feature = "fs")]
pub(super) use c::fallocate64 as libc_fallocate;
#[cfg(not(any(
+ apple,
+ linux_like,
+ netbsdlike,
+ solarish,
windows,
- target_os = "android",
target_os = "dragonfly",
- target_os = "emscripten",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "linux",
- target_os = "l4re",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
#[cfg(feature = "fs")]
pub(super) use c::posix_fadvise as libc_posix_fadvise;
-#[cfg(any(
- target_os = "android",
- target_os = "emscripten",
- target_os = "linux",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
#[cfg(feature = "fs")]
pub(super) use c::posix_fadvise64 as libc_posix_fadvise;
@@ -213,8 +141,20 @@ pub(super) use c::posix_fadvise64 as libc_posix_fadvise;
pub(super) use c::{pread as libc_pread, pwrite as libc_pwrite};
#[cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten"))]
pub(super) use c::{pread64 as libc_pread, pwrite64 as libc_pwrite};
+#[cfg(not(any(
+ apple,
+ windows,
+ target_os = "android",
+ target_os = "emscripten",
+ target_os = "haiku",
+ target_os = "linux",
+ target_os = "redox",
+ target_os = "solaris",
+)))]
+pub(super) use c::{preadv as libc_preadv, pwritev as libc_pwritev};
#[cfg(any(target_os = "linux", target_os = "emscripten"))]
pub(super) use c::{preadv64 as libc_preadv, pwritev64 as libc_pwritev};
+
#[cfg(target_os = "android")]
mod readwrite_pv64 {
use super::c;
@@ -302,22 +242,11 @@ mod readwrite_pv64 {
}
}
}
-#[cfg(not(any(
- windows,
- target_os = "android",
- target_os = "emscripten",
- target_os = "haiku",
- target_os = "ios",
- target_os = "linux",
- target_os = "macos",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub(super) use c::{preadv as libc_preadv, pwritev as libc_pwritev};
#[cfg(target_os = "android")]
pub(super) use readwrite_pv64::{preadv64 as libc_preadv, pwritev64 as libc_pwritev};
+
// macOS added preadv and pwritev in version 11.0
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
mod readwrite_pv {
use super::c;
@@ -337,26 +266,116 @@ mod readwrite_pv {
) -> c::ssize_t
}
}
-#[cfg(all(target_os = "linux", target_env = "gnu"))]
-pub(super) use c::{preadv64v2 as libc_preadv2, pwritev64v2 as libc_pwritev2};
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev};
+// GLIBC added `preadv64v2` and `pwritev64v2` in version 2.26.
+#[cfg(all(target_os = "linux", target_env = "gnu"))]
+mod readwrite_pv64v2 {
+ use super::c;
+
+ // 64-bit offsets on 32-bit platforms are passed in endianness-specific
+ // lo/hi pairs. See src/backend/linux_raw/conv.rs for details.
+ #[cfg(all(target_endian = "little", target_pointer_width = "32"))]
+ fn lo(x: u64) -> usize {
+ (x >> 32) as usize
+ }
+ #[cfg(all(target_endian = "little", target_pointer_width = "32"))]
+ fn hi(x: u64) -> usize {
+ (x & 0xffff_ffff) as usize
+ }
+ #[cfg(all(target_endian = "big", target_pointer_width = "32"))]
+ fn lo(x: u64) -> usize {
+ (x & 0xffff_ffff) as usize
+ }
+ #[cfg(all(target_endian = "big", target_pointer_width = "32"))]
+ fn hi(x: u64) -> usize {
+ (x >> 32) as usize
+ }
+
+ pub(in super::super) unsafe fn preadv64v2(
+ fd: c::c_int,
+ iov: *const c::iovec,
+ iovcnt: c::c_int,
+ offset: c::off64_t,
+ flags: c::c_int,
+ ) -> c::ssize_t {
+ // Older GLIBC lacks `preadv64v2`, so use the `weak!` mechanism to
+ // test for it, and call back to `c::syscall`. We don't use
+ // `weak_or_syscall` here because we need to pass the 64-bit offset
+ // specially.
+ weak! {
+ fn preadv64v2(c::c_int, *const c::iovec, c::c_int, c::off64_t, c::c_int) -> c::ssize_t
+ }
+ if let Some(fun) = preadv64v2.get() {
+ fun(fd, iov, iovcnt, offset, flags)
+ } else {
+ #[cfg(target_pointer_width = "32")]
+ {
+ c::syscall(
+ c::SYS_preadv,
+ fd,
+ iov,
+ iovcnt,
+ hi(offset as u64),
+ lo(offset as u64),
+ flags,
+ ) as c::ssize_t
+ }
+ #[cfg(target_pointer_width = "64")]
+ {
+ c::syscall(c::SYS_preadv2, fd, iov, iovcnt, offset, flags) as c::ssize_t
+ }
+ }
+ }
+ pub(in super::super) unsafe fn pwritev64v2(
+ fd: c::c_int,
+ iov: *const c::iovec,
+ iovcnt: c::c_int,
+ offset: c::off64_t,
+ flags: c::c_int,
+ ) -> c::ssize_t {
+ // See the comments in `preadv64v2`.
+ weak! {
+ fn pwritev64v2(c::c_int, *const c::iovec, c::c_int, c::off64_t, c::c_int) -> c::ssize_t
+ }
+ if let Some(fun) = pwritev64v2.get() {
+ fun(fd, iov, iovcnt, offset, flags)
+ } else {
+ #[cfg(target_pointer_width = "32")]
+ {
+ c::syscall(
+ c::SYS_pwritev,
+ fd,
+ iov,
+ iovcnt,
+ hi(offset as u64),
+ lo(offset as u64),
+ flags,
+ ) as c::ssize_t
+ }
+ #[cfg(target_pointer_width = "64")]
+ {
+ c::syscall(c::SYS_pwritev2, fd, iov, iovcnt, offset, flags) as c::ssize_t
+ }
+ }
+ }
+}
+#[cfg(all(target_os = "linux", target_env = "gnu"))]
+pub(super) use readwrite_pv64v2::{preadv64v2 as libc_preadv2, pwritev64v2 as libc_pwritev2};
+
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
windows,
target_os = "aix",
target_os = "android",
target_os = "dragonfly",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
target_os = "linux",
target_os = "l4re",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
#[cfg(feature = "fs")]
pub(super) use c::posix_fallocate as libc_posix_fallocate;
@@ -364,41 +383,28 @@ pub(super) use c::posix_fallocate as libc_posix_fallocate;
#[cfg(feature = "fs")]
pub(super) use c::posix_fallocate64 as libc_posix_fallocate;
#[cfg(not(any(
+ linux_like,
+ solarish,
windows,
- target_os = "android",
- target_os = "emscripten",
target_os = "haiku",
- target_os = "illumos",
- target_os = "linux",
- target_os = "l4re",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[cfg(feature = "fs")]
pub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs};
#[cfg(not(any(
+ linux_like,
+ solarish,
windows,
- target_os = "android",
- target_os = "emscripten",
target_os = "haiku",
- target_os = "illumos",
- target_os = "linux",
- target_os = "l4re",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[cfg(feature = "fs")]
pub(super) use {c::fstatvfs as libc_fstatvfs, c::statvfs as libc_statvfs};
-#[cfg(any(
- target_os = "android",
- target_os = "linux",
- target_os = "emscripten",
- target_os = "l4re",
-))]
+#[cfg(linux_like)]
#[cfg(feature = "fs")]
pub(super) use {
c::fstatfs64 as libc_fstatfs, c::fstatvfs64 as libc_fstatvfs, c::statfs64 as libc_statfs,
diff --git a/vendor/rustix/src/backend/libc/process/cpu_set.rs b/vendor/rustix/src/backend/libc/process/cpu_set.rs
index 14ad8d208..a9d6d89c2 100644
--- a/vendor/rustix/src/backend/libc/process/cpu_set.rs
+++ b/vendor/rustix/src/backend/libc/process/cpu_set.rs
@@ -1,3 +1,5 @@
+//! Rust implementation of the `CPU_*` macro API.
+
#![allow(non_snake_case)]
use super::super::c;
diff --git a/vendor/rustix/src/backend/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs
index 6f4e85916..d208bda7a 100644
--- a/vendor/rustix/src/backend/libc/process/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/process/syscalls.rs
@@ -3,9 +3,9 @@
use super::super::c;
#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
use super::super::conv::borrowed_fd;
-#[cfg(not(target_os = "wasi"))]
-use super::super::conv::ret_pid_t;
use super::super::conv::{c_str, ret, ret_c_int, ret_discarded_char_ptr};
+#[cfg(not(target_os = "wasi"))]
+use super::super::conv::{ret_infallible, ret_pid_t};
#[cfg(any(target_os = "android", target_os = "linux"))]
use super::super::conv::{syscall_ret, syscall_ret_u32};
#[cfg(any(
@@ -17,21 +17,28 @@ use super::super::conv::{syscall_ret, syscall_ret_u32};
use super::types::RawCpuSet;
#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
use crate::fd::BorrowedFd;
+#[cfg(target_os = "linux")]
+use crate::fd::{AsRawFd, OwnedFd};
use crate::ffi::CStr;
+#[cfg(feature = "fs")]
+use crate::fs::Mode;
use crate::io;
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+use crate::process::{WaitId, WaitidOptions, WaitidStatus};
use core::mem::MaybeUninit;
+#[cfg(target_os = "linux")]
+use {super::super::conv::syscall_ret_owned_fd, crate::process::PidfdFlags};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+use {
+ super::super::offset::libc_prlimit,
+ crate::process::{Cpuid, MembarrierCommand, MembarrierQuery},
+};
#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
use {
- super::super::conv::ret_infallible,
super::super::offset::{libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY},
crate::process::{Resource, Rlimit},
core::convert::TryInto,
};
-#[cfg(any(target_os = "android", target_os = "linux"))]
-use {
- super::super::offset::libc_prlimit,
- crate::process::{Cpuid, MembarrierCommand, MembarrierQuery},
-};
#[cfg(not(target_os = "wasi"))]
use {
super::types::RawUname,
@@ -214,11 +221,19 @@ pub(crate) fn sched_yield() {
pub(crate) fn uname() -> RawUname {
let mut uname = MaybeUninit::<RawUname>::uninit();
unsafe {
- ret(c::uname(uname.as_mut_ptr())).unwrap();
+ ret_infallible(c::uname(uname.as_mut_ptr()));
uname.assume_init()
}
}
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "fs")]
+#[inline]
+pub(crate) fn umask(mask: Mode) -> Mode {
+ // TODO: Use `from_bits_retain` when we switch to bitflags 2.0.
+ unsafe { Mode::from_bits_truncate(c::umask(mask.bits() as _) as _) }
+}
+
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
#[inline]
pub(crate) fn nice(inc: i32) -> io::Result<i32> {
@@ -394,6 +409,85 @@ pub(crate) fn _waitpid(
}
}
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[inline]
+pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ // Get the id to wait on.
+ match id {
+ WaitId::All => _waitid_all(options),
+ WaitId::Pid(pid) => _waitid_pid(pid, options),
+ #[cfg(target_os = "linux")]
+ WaitId::PidFd(fd) => _waitid_pidfd(fd, options),
+ #[cfg(not(target_os = "linux"))]
+ WaitId::__EatLifetime(_) => unreachable!(),
+ }
+}
+
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[inline]
+fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ unsafe {
+ ret(c::waitid(
+ c::P_ALL,
+ 0,
+ status.as_mut_ptr(),
+ options.bits() as _,
+ ))?
+ };
+
+ Ok(unsafe { cvt_waitid_status(status) })
+}
+
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[inline]
+fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ unsafe {
+ ret(c::waitid(
+ c::P_PID,
+ Pid::as_raw(Some(pid)) as _,
+ status.as_mut_ptr(),
+ options.bits() as _,
+ ))?
+ };
+
+ Ok(unsafe { cvt_waitid_status(status) })
+}
+
+#[cfg(target_os = "linux")]
+#[inline]
+fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ unsafe {
+ ret(c::waitid(
+ c::P_PIDFD,
+ fd.as_raw_fd() as _,
+ status.as_mut_ptr(),
+ options.bits() as _,
+ ))?
+ };
+
+ Ok(unsafe { cvt_waitid_status(status) })
+}
+
+/// Convert a `siginfo_t` to a `WaitidStatus`.
+///
+/// # Safety
+///
+/// The caller must ensure that `status` is initialized and that `waitid`
+/// returned successfully.
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[inline]
+unsafe fn cvt_waitid_status(status: MaybeUninit<c::siginfo_t>) -> Option<WaitidStatus> {
+ let status = status.assume_init();
+ if status.si_signo == 0 {
+ None
+ } else {
+ Some(WaitidStatus(status))
+ }
+}
+
#[inline]
pub(crate) fn exit_group(code: c::c_int) -> ! {
// `_exit` and `_Exit` are the same; it's just a matter of which ones
@@ -453,7 +547,7 @@ pub(crate) unsafe fn prctl(
ret_c_int(c::prctl(option, arg2, arg3, arg4, arg5))
}
-#[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
+#[cfg(freebsdlike)]
#[inline]
pub(crate) unsafe fn procctl(
idtype: c::idtype_t,
@@ -463,3 +557,14 @@ pub(crate) unsafe fn procctl(
) -> io::Result<()> {
ret(c::procctl(idtype, id, option, data))
}
+
+#[cfg(target_os = "linux")]
+pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> {
+ unsafe {
+ syscall_ret_owned_fd(libc::syscall(
+ c::SYS_pidfd_open,
+ pid.as_raw_nonzero().get(),
+ flags.bits(),
+ ))
+ }
+}
diff --git a/vendor/rustix/src/backend/libc/process/types.rs b/vendor/rustix/src/backend/libc/process/types.rs
index f8e3b8bf4..203186b20 100644
--- a/vendor/rustix/src/backend/libc/process/types.rs
+++ b/vendor/rustix/src/backend/libc/process/types.rs
@@ -57,119 +57,47 @@ pub enum Resource {
#[cfg(not(target_os = "haiku"))]
Core = c::RLIMIT_CORE as c::c_int,
/// `RLIMIT_RSS`
- #[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(apple, solarish, target_os = "haiku")))]
Rss = c::RLIMIT_RSS as c::c_int,
/// `RLIMIT_NPROC`
- #[cfg(not(any(target_os = "haiku", target_os = "illumos", target_os = "solaris")))]
+ #[cfg(not(any(solarish, target_os = "haiku")))]
Nproc = c::RLIMIT_NPROC as c::c_int,
/// `RLIMIT_NOFILE`
Nofile = c::RLIMIT_NOFILE as c::c_int,
/// `RLIMIT_MEMLOCK`
- #[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "solaris"
- )))]
+ #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))]
Memlock = c::RLIMIT_MEMLOCK as c::c_int,
/// `RLIMIT_AS`
#[cfg(not(target_os = "openbsd"))]
As = c::RLIMIT_AS as c::c_int,
/// `RLIMIT_LOCKS`
- #[cfg(not(any(
- target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
Locks = c::RLIMIT_LOCKS as c::c_int,
/// `RLIMIT_SIGPENDING`
- #[cfg(not(any(
- target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
Sigpending = c::RLIMIT_SIGPENDING as c::c_int,
/// `RLIMIT_MSGQUEUE`
- #[cfg(not(any(
- target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
Msgqueue = c::RLIMIT_MSGQUEUE as c::c_int,
/// `RLIMIT_NICE`
- #[cfg(not(any(
- target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
Nice = c::RLIMIT_NICE as c::c_int,
/// `RLIMIT_RTPRIO`
- #[cfg(not(any(
- target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
Rtprio = c::RLIMIT_RTPRIO as c::c_int,
/// `RLIMIT_RTTIME`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "aix",
target_os = "android",
- target_os = "dragonfly",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
)))]
Rttime = c::RLIMIT_RTTIME as c::c_int,
}
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
impl Resource {
/// `RLIMIT_RSS`
#[allow(non_upper_case_globals)]
@@ -221,16 +149,10 @@ pub enum Signal {
Term = c::SIGTERM,
/// `SIGSTKFLT`
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
any(
@@ -273,20 +195,25 @@ pub enum Signal {
#[cfg(not(target_os = "haiku"))]
Io = c::SIGIO,
/// `SIGPWR`
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
#[doc(alias = "Pwr")]
Power = c::SIGPWR,
/// `SIGSYS`, aka `SIGUNUSED`
#[doc(alias = "Unused")]
Sys = c::SIGSYS,
+ /// `SIGEMT`
+ #[cfg(bsd)]
+ Emt = c::SIGEMT,
+ /// `SIGINFO`
+ #[cfg(bsd)]
+ Info = c::SIGINFO,
+ /// `SIGTHR`
+ #[cfg(target_os = "freebsd")]
+ #[doc(alias = "Lwp")]
+ Thr = c::SIGTHR,
+ /// `SIGLIBRT`
+ #[cfg(target_os = "freebsd")]
+ Librt = c::SIGLIBRT,
}
#[cfg(not(target_os = "wasi"))]
@@ -310,16 +237,10 @@ impl Signal {
c::SIGALRM => Some(Self::Alarm),
c::SIGTERM => Some(Self::Term),
#[cfg(not(any(
+ bsd,
+ solarish,
target_os = "aix",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
all(
any(target_os = "android", target_os = "linux"),
any(
@@ -345,17 +266,17 @@ impl Signal {
c::SIGWINCH => Some(Self::Winch),
#[cfg(not(target_os = "haiku"))]
c::SIGIO => Some(Self::Io),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- )))]
+ #[cfg(not(any(bsd, target_os = "haiku")))]
c::SIGPWR => Some(Self::Power),
c::SIGSYS => Some(Self::Sys),
+ #[cfg(bsd)]
+ c::SIGEMT => Some(Self::Emt),
+ #[cfg(bsd)]
+ c::SIGINFO => Some(Self::Info),
+ #[cfg(target_os = "freebsd")]
+ c::SIGTHR => Some(Self::Thr),
+ #[cfg(target_os = "freebsd")]
+ c::SIGLIBRT => Some(Self::Librt),
_ => None,
}
}
diff --git a/vendor/rustix/src/backend/libc/process/wait.rs b/vendor/rustix/src/backend/libc/process/wait.rs
index 6de79955d..c09ee1002 100644
--- a/vendor/rustix/src/backend/libc/process/wait.rs
+++ b/vendor/rustix/src/backend/libc/process/wait.rs
@@ -4,3 +4,6 @@ pub(crate) use c::{
WCONTINUED, WEXITSTATUS, WIFCONTINUED, WIFEXITED, WIFSIGNALED, WIFSTOPPED, WNOHANG, WSTOPSIG,
WTERMSIG, WUNTRACED,
};
+
+#[cfg(not(any(target_os = "openbsd", target_os = "redox", target_os = "wasi")))]
+pub(crate) use c::{WEXITED, WNOWAIT, WSTOPPED};
diff --git a/vendor/rustix/src/backend/libc/rand/syscalls.rs b/vendor/rustix/src/backend/libc/rand/syscalls.rs
index 1c4286235..ce1746055 100644
--- a/vendor/rustix/src/backend/libc/rand/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/rand/syscalls.rs
@@ -1,9 +1,9 @@
//! libc syscalls supporting `rustix::rand`.
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
use {super::super::c, super::super::conv::ret_ssize_t, crate::io, crate::rand::GetRandomFlags};
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> {
// `getrandom` wasn't supported in glibc until 2.25.
weak_or_syscall! {
diff --git a/vendor/rustix/src/backend/libc/rand/types.rs b/vendor/rustix/src/backend/libc/rand/types.rs
index 2ba3f1119..e12bd9cbd 100644
--- a/vendor/rustix/src/backend/libc/rand/types.rs
+++ b/vendor/rustix/src/backend/libc/rand/types.rs
@@ -1,9 +1,9 @@
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
use super::super::c;
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
use bitflags::bitflags;
-#[cfg(target_os = "linux")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
bitflags! {
/// `GRND_*` flags for use with [`getrandom`].
///
diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs
index f54e9a6f3..097d368ed 100644
--- a/vendor/rustix/src/backend/libc/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs
@@ -27,6 +27,27 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
}
}
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub(crate) fn tcgetattr2(fd: BorrowedFd<'_>) -> io::Result<crate::termios::Termios2> {
+ let mut result = MaybeUninit::<crate::termios::Termios2>::uninit();
+ unsafe {
+ ret(c::ioctl(borrowed_fd(fd), c::TCGETS2, result.as_mut_ptr()))?;
+ Ok(result.assume_init())
+ }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
@@ -56,6 +77,33 @@ pub(crate) fn tcsetattr(
}
}
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub(crate) fn tcsetattr2(
+ fd: BorrowedFd,
+ optional_actions: OptionalActions,
+ termios: &crate::termios::Termios2,
+) -> io::Result<()> {
+ unsafe {
+ ret(c::ioctl(
+ borrowed_fd(fd),
+ (c::TCSETS2 as u32 + optional_actions as u32) as _,
+ termios,
+ ))
+ }
+}
+
#[cfg(not(target_os = "wasi"))]
pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(c::tcsendbreak(borrowed_fd(fd), 0)) }
diff --git a/vendor/rustix/src/backend/libc/termios/types.rs b/vendor/rustix/src/backend/libc/termios/types.rs
index 6dda70064..bbacdbea0 100644
--- a/vendor/rustix/src/backend/libc/termios/types.rs
+++ b/vendor/rustix/src/backend/libc/termios/types.rs
@@ -7,13 +7,16 @@ use super::super::c;
#[repr(i32)]
pub enum OptionalActions {
/// `TCSANOW`—Make the change immediately.
+ #[doc(alias = "TCSANOW")]
Now = c::TCSANOW,
/// `TCSADRAIN`—Make the change after all output has been transmitted.
+ #[doc(alias = "TCSADRAIN")]
Drain = c::TCSADRAIN,
/// `TCSAFLUSH`—Discard any pending input and then make the change
/// after all output has been transmitted.
+ #[doc(alias = "TCSAFLUSH")]
Flush = c::TCSAFLUSH,
}
@@ -24,12 +27,15 @@ pub enum OptionalActions {
#[repr(i32)]
pub enum QueueSelector {
/// `TCIFLUSH`—Flush data received but not read.
+ #[doc(alias = "TCIFLUSH")]
IFlush = c::TCIFLUSH,
/// `TCOFLUSH`—Flush data written but not transmitted.
+ #[doc(alias = "TCOFLUSH")]
OFlush = c::TCOFLUSH,
/// `TCIOFLUSH`—`IFlush` and `OFlush` combined.
+ #[doc(alias = "TCIOFLUSH")]
IOFlush = c::TCIOFLUSH,
}
@@ -40,34 +46,63 @@ pub enum QueueSelector {
#[repr(i32)]
pub enum Action {
/// `TCOOFF`—Suspend output.
+ #[doc(alias = "TCOOFF")]
OOff = c::TCOOFF,
/// `TCOON`—Restart suspended output.
+ #[doc(alias = "TCOON")]
OOn = c::TCOON,
/// `TCIOFF`—Transmits a STOP byte.
+ #[doc(alias = "TCIOFF")]
IOff = c::TCIOFF,
/// `TCION`—Transmits a START byte.
+ #[doc(alias = "TCION")]
IOn = c::TCION,
}
-/// `struct termios` for use with [`tcgetattr`].
+/// `struct termios` for use with [`tcgetattr`] and [`tcsetattr`].
///
/// [`tcgetattr`]: crate::termios::tcgetattr
+/// [`tcsetattr`]: crate::termios::tcsetattr
+#[doc(alias = "termios")]
pub type Termios = c::termios;
+/// `struct termios2` for use with [`tcgetattr2`] and [`tcsetattr2`].
+///
+/// [`tcgetattr2`]: crate::termios::tcgetattr2
+/// [`tcsetattr2`]: crate::termios::tcsetattr2
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+#[doc(alias = "termios2")]
+pub type Termios2 = c::termios2;
+
/// `struct winsize` for use with [`tcgetwinsize`].
///
/// [`tcgetwinsize`]: crate::termios::tcgetwinsize
+#[doc(alias = "winsize")]
pub type Winsize = c::winsize;
/// `tcflag_t`—A type for the flags fields of [`Termios`].
+#[doc(alias = "tcflag_t")]
pub type Tcflag = c::tcflag_t;
/// `speed_t`—A return type for [`cfsetspeed`] and similar.
///
/// [`cfsetspeed`]: crate::termios::cfsetspeed
+#[doc(alias = "speed_t")]
pub type Speed = c::speed_t;
/// `VINTR`
@@ -93,15 +128,14 @@ pub const VMIN: usize = c::VMIN as usize;
/// `VSWTC`
#[cfg(not(any(
+ apple,
+ solarish,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
- target_os = "solaris",
)))]
pub const VSWTC: usize = c::VSWTC as usize;
@@ -122,11 +156,11 @@ pub const VEOL: usize = c::VEOL as usize;
pub const VREPRINT: usize = c::VREPRINT as usize;
/// `VDISCARD`
-#[cfg(not(target_os = "haiku"))]
+#[cfg(not(any(target_os = "aix", target_os = "haiku")))]
pub const VDISCARD: usize = c::VDISCARD as usize;
/// `VWERASE`
-#[cfg(not(target_os = "haiku"))]
+#[cfg(not(any(target_os = "aix", target_os = "haiku")))]
pub const VWERASE: usize = c::VWERASE as usize;
/// `VLNEXT`
@@ -137,473 +171,276 @@ pub const VLNEXT: usize = c::VLNEXT as usize;
pub const VEOL2: usize = c::VEOL2 as usize;
/// `IGNBRK`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const IGNBRK: c::c_uint = c::IGNBRK;
/// `BRKINT`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const BRKINT: c::c_uint = c::BRKINT;
/// `IGNPAR`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const IGNPAR: c::c_uint = c::IGNPAR;
/// `PARMRK`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const PARMRK: c::c_uint = c::PARMRK;
/// `INPCK`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const INPCK: c::c_uint = c::INPCK;
/// `ISTRIP`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ISTRIP: c::c_uint = c::ISTRIP;
/// `INLCR`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const INLCR: c::c_uint = c::INLCR;
/// `IGNCR`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const IGNCR: c::c_uint = c::IGNCR;
/// `ICRNL`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ICRNL: c::c_uint = c::ICRNL;
/// `IUCLC`
-#[cfg(any(target_os = "haiku", target_os = "illumos", target_os = "solaris"))]
+#[cfg(any(solarish, target_os = "haiku"))]
pub const IUCLC: c::c_uint = c::IUCLC;
/// `IXON`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const IXON: c::c_uint = c::IXON;
/// `IXANY`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "redox")))]
pub const IXANY: c::c_uint = c::IXANY;
/// `IXOFF`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const IXOFF: c::c_uint = c::IXOFF;
/// `IMAXBEL`
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox"
-)))]
+#[cfg(not(any(apple, target_os = "haiku", target_os = "redox")))]
pub const IMAXBEL: c::c_uint = c::IMAXBEL;
/// `IUTF8`
#[cfg(not(any(
+ apple,
+ solarish,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const IUTF8: c::c_uint = c::IUTF8;
/// `OPOST`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const OPOST: c::c_uint = c::OPOST;
/// `OLCUC`
#[cfg(not(any(
+ apple,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
target_os = "netbsd",
target_os = "redox",
)))]
pub const OLCUC: c::c_uint = c::OLCUC;
/// `ONLCR`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ONLCR: c::c_uint = c::ONLCR;
/// `OCRNL`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const OCRNL: c::c_uint = c::OCRNL;
/// `ONOCR`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ONOCR: c::c_uint = c::ONOCR;
/// `ONLRET`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ONLRET: c::c_uint = c::ONLRET;
/// `OFILL`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
-)))]
+#[cfg(not(bsd))]
pub const OFILL: c::c_uint = c::OFILL;
/// `OFDEL`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
-)))]
+#[cfg(not(bsd))]
pub const OFDEL: c::c_uint = c::OFDEL;
/// `NLDLY`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "redox")))]
pub const NLDLY: c::c_uint = c::NLDLY;
/// `NL0`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
pub const NL0: c::c_uint = c::NL0;
/// `NL1`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
pub const NL1: c::c_uint = c::NL1;
/// `CRDLY`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "redox")))]
pub const CRDLY: c::c_uint = c::CRDLY;
/// `CR0`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
pub const CR0: c::c_uint = c::CR0;
/// `CR1`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const CR1: c::c_uint = c::CR1;
/// `CR2`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const CR2: c::c_uint = c::CR2;
/// `CR3`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const CR3: c::c_uint = c::CR3;
/// `TABDLY`
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "illumos",
target_os = "redox",
- target_os = "solaris",
)))]
pub const TABDLY: c::c_uint = c::TABDLY;
/// `TAB0`
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const TAB0: c::c_uint = c::TAB0;
/// `TAB1`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const TAB1: c::c_uint = c::TAB1;
/// `TAB2`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const TAB2: c::c_uint = c::TAB2;
/// `TAB3`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const TAB3: c::c_uint = c::TAB3;
/// `BSDLY`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "redox")))]
pub const BSDLY: c::c_uint = c::BSDLY;
/// `BS0`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
pub const BS0: c::c_uint = c::BS0;
/// `BS1`
#[cfg(not(any(
target_env = "musl",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "dragonfly",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const BS1: c::c_uint = c::BS1;
/// `FFDLY`
-#[cfg(not(any(
- target_env = "musl",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(target_env = "musl", bsd, solarish, target_os = "redox")))]
pub const FFDLY: c::c_uint = c::FFDLY;
/// `FF0`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
pub const FF0: c::c_uint = c::FF0;
/// `FF1`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const FF1: c::c_uint = c::FF1;
/// `VTDLY`
-#[cfg(not(any(
- target_env = "musl",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(target_env = "musl", bsd, solarish, target_os = "redox")))]
pub const VTDLY: c::c_uint = c::VTDLY;
/// `VT0`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))]
pub const VT0: c::c_uint = c::VT0;
/// `VT1`
#[cfg(not(any(
target_env = "musl",
- target_os = "dragonfly",
+ bsd,
+ solarish,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const VT1: c::c_uint = c::VT1;
@@ -656,125 +493,68 @@ pub const B19200: Speed = c::B19200;
pub const B38400: Speed = c::B38400;
/// `B57600`
+#[cfg(not(target_os = "aix"))]
pub const B57600: Speed = c::B57600;
/// `B115200`
+#[cfg(not(target_os = "aix"))]
pub const B115200: Speed = c::B115200;
/// `B230400`
+#[cfg(not(target_os = "aix"))]
pub const B230400: Speed = c::B230400;
/// `B460800`
#[cfg(not(any(
+ apple,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd"
)))]
pub const B460800: Speed = c::B460800;
/// `B500000`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
pub const B500000: Speed = c::B500000;
/// `B576000`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
pub const B576000: Speed = c::B576000;
/// `B921600`
#[cfg(not(any(
+ apple,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd"
)))]
pub const B921600: Speed = c::B921600;
/// `B1000000`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
pub const B1000000: Speed = c::B1000000;
/// `B1152000`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
pub const B1152000: Speed = c::B1152000;
/// `B1500000`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
pub const B1500000: Speed = c::B1500000;
/// `B2000000`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
+#[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
pub const B2000000: Speed = c::B2000000;
/// `B2500000`
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
pub const B2500000: Speed = c::B2500000;
@@ -783,13 +563,9 @@ pub const B2500000: Speed = c::B2500000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
pub const B3000000: Speed = c::B3000000;
@@ -798,13 +574,9 @@ pub const B3000000: Speed = c::B3000000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
pub const B3500000: Speed = c::B3500000;
@@ -813,63 +585,63 @@ pub const B3500000: Speed = c::B3500000;
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
pub const B4000000: Speed = c::B4000000;
+/// `BOTHER`
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub const BOTHER: c::c_uint = c::BOTHER;
+
/// `CSIZE`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CSIZE: c::c_uint = c::CSIZE;
/// `CS5`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CS5: c::c_uint = c::CS5;
/// `CS6`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CS6: c::c_uint = c::CS6;
/// `CS7`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CS7: c::c_uint = c::CS7;
/// `CS8`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CS8: c::c_uint = c::CS8;
/// `CSTOPB`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CSTOPB: c::c_uint = c::CSTOPB;
/// `CREAD`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CREAD: c::c_uint = c::CREAD;
/// `PARENB`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const PARENB: c::c_uint = c::PARENB;
/// `PARODD`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const PARODD: c::c_uint = c::PARODD;
/// `HUPCL`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const HUPCL: c::c_uint = c::HUPCL;
/// `CLOCAL`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const CLOCAL: c::c_uint = c::CLOCAL;
/// `ISIG`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ISIG: c::c_uint = c::ISIG;
/// `ICANON`—A flag for the `c_lflag` field of [`Termios`] indicating
@@ -877,98 +649,75 @@ pub const ISIG: c::c_uint = c::ISIG;
pub const ICANON: Tcflag = c::ICANON;
/// `ECHO`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ECHO: c::c_uint = c::ECHO;
/// `ECHOE`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ECHOE: c::c_uint = c::ECHOE;
/// `ECHOK`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ECHOK: c::c_uint = c::ECHOK;
/// `ECHONL`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const ECHONL: c::c_uint = c::ECHONL;
/// `NOFLSH`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const NOFLSH: c::c_uint = c::NOFLSH;
/// `TOSTOP`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const TOSTOP: c::c_uint = c::TOSTOP;
/// `IEXTEN`
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub const IEXTEN: c::c_uint = c::IEXTEN;
/// `EXTA`
#[cfg(not(any(
+ apple,
+ solarish,
target_os = "emscripten",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
- target_os = "solaris",
)))]
pub const EXTA: c::c_uint = c::EXTA;
/// `EXTB`
#[cfg(not(any(
+ apple,
+ solarish,
target_os = "emscripten",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
- target_os = "solaris",
)))]
pub const EXTB: c::c_uint = c::EXTB;
/// `CBAUD`
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
-)))]
+#[cfg(not(any(bsd, target_os = "haiku", target_os = "redox")))]
pub const CBAUD: c::c_uint = c::CBAUD;
/// `CBAUDEX`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
+ target_os = "aix",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const CBAUDEX: c::c_uint = c::CBAUDEX;
/// `CIBAUD`
#[cfg(not(any(
- target_os = "dragonfly",
+ target_arch = "powerpc",
+ target_arch = "powerpc64",
+ bsd,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_arch = "powerpc",
- target_arch = "powerpc64",
)))]
pub const CIBAUD: c::tcflag_t = c::CIBAUD;
@@ -979,22 +728,17 @@ pub const CIBAUD: c::tcflag_t = 0o77600000;
/// `CMSPAR`
#[cfg(not(any(
- target_os = "dragonfly",
+ bsd,
+ solarish,
+ target_os = "aix",
target_os = "emscripten",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const CMSPAR: c::c_uint = c::CMSPAR;
/// `CRTSCTS`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "aix", target_os = "redox")))]
pub const CRTSCTS: c::c_uint = c::CRTSCTS;
/// `XCASE`
@@ -1002,45 +746,35 @@ pub const CRTSCTS: c::c_uint = c::CRTSCTS;
pub const XCASE: c::c_uint = c::XCASE;
/// `ECHOCTL`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "redox")))]
pub const ECHOCTL: c::c_uint = c::ECHOCTL;
/// `ECHOPRT`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "redox")))]
pub const ECHOPRT: c::c_uint = c::ECHOPRT;
/// `ECHOKE`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "redox")))]
pub const ECHOKE: c::c_uint = c::ECHOKE;
/// `FLUSHO`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "redox")))]
pub const FLUSHO: c::c_uint = c::FLUSHO;
/// `PENDIN`
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
+#[cfg(not(any(apple, target_os = "redox")))]
pub const PENDIN: c::c_uint = c::PENDIN;
/// `EXTPROC`
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox"
-)))]
+#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "redox")))]
pub const EXTPROC: c::c_uint = c::EXTPROC;
/// `XTABS`
#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ solarish,
+ target_os = "aix",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub const XTABS: c::c_uint = c::XTABS;
diff --git a/vendor/rustix/src/backend/libc/thread/syscalls.rs b/vendor/rustix/src/backend/libc/thread/syscalls.rs
index 4f69b8f63..adf4bb700 100644
--- a/vendor/rustix/src/backend/libc/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/thread/syscalls.rs
@@ -3,7 +3,7 @@
use super::super::c;
use super::super::conv::ret;
#[cfg(any(target_os = "android", target_os = "linux"))]
-use super::super::conv::{borrowed_fd, ret_c_int};
+use super::super::conv::{borrowed_fd, ret_c_int, syscall_ret};
use super::super::time::types::LibcTimespec;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fd::BorrowedFd;
@@ -14,12 +14,10 @@ use crate::process::{Pid, RawNonZeroPid};
use crate::thread::{NanosleepRelativeResult, Timespec};
use core::mem::MaybeUninit;
#[cfg(not(any(
- target_os = "dragonfly",
+ apple,
+ freebsdlike,
target_os = "emscripten",
- target_os = "freebsd",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
@@ -38,12 +36,11 @@ weak!(fn __clock_nanosleep_time64(c::clockid_t, c::c_int, *const LibcTimespec, *
weak!(fn __nanosleep64(*const LibcTimespec, *mut LibcTimespec) -> c::c_int);
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
@@ -132,12 +129,11 @@ unsafe fn clock_nanosleep_relative_old(id: ClockId, request: &Timespec) -> Nanos
}
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
@@ -291,7 +287,13 @@ pub(crate) fn gettid() -> Pid {
#[cfg(any(target_os = "android", target_os = "linux"))]
#[inline]
pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
- unsafe { ret_c_int(c::setns(borrowed_fd(fd), nstype)) }
+ // `setns` wasn't supported in glibc until 2.14, and musl until 0.9.5,
+ // so use `syscall`.
+ weak_or_syscall! {
+ fn setns(fd: c::c_int, nstype: c::c_int) via SYS_setns -> c::c_int
+ }
+
+ unsafe { ret_c_int(setns(borrowed_fd(fd), nstype)) }
}
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -299,3 +301,63 @@ pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
pub(crate) fn unshare(flags: crate::thread::UnshareFlags) -> io::Result<()> {
unsafe { ret(c::unshare(flags.bits() as i32)) }
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn capget(
+ header: &mut linux_raw_sys::general::__user_cap_header_struct,
+ data: &mut [MaybeUninit<linux_raw_sys::general::__user_cap_data_struct>],
+) -> io::Result<()> {
+ let header: *mut _ = header;
+ unsafe { syscall_ret(c::syscall(c::SYS_capget, header, data.as_mut_ptr())) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn capset(
+ header: &mut linux_raw_sys::general::__user_cap_header_struct,
+ data: &[linux_raw_sys::general::__user_cap_data_struct],
+) -> io::Result<()> {
+ let header: *mut _ = header;
+ unsafe { syscall_ret(c::syscall(c::SYS_capset, header, data.as_ptr())) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn setuid_thread(uid: crate::process::Uid) -> io::Result<()> {
+ unsafe { syscall_ret(c::syscall(c::SYS_setuid, uid.as_raw())) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn setresuid_thread(
+ ruid: crate::process::Uid,
+ euid: crate::process::Uid,
+ suid: crate::process::Uid,
+) -> io::Result<()> {
+ #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc"))]
+ const SYS: c::c_long = c::SYS_setresuid32 as c::c_long;
+ #[cfg(not(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc")))]
+ const SYS: c::c_long = c::SYS_setresuid as c::c_long;
+ unsafe { syscall_ret(c::syscall(SYS, ruid.as_raw(), euid.as_raw(), suid.as_raw())) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn setgid_thread(gid: crate::process::Gid) -> io::Result<()> {
+ unsafe { syscall_ret(c::syscall(c::SYS_setgid, gid.as_raw())) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn setresgid_thread(
+ rgid: crate::process::Gid,
+ egid: crate::process::Gid,
+ sgid: crate::process::Gid,
+) -> io::Result<()> {
+ #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc"))]
+ const SYS: c::c_long = c::SYS_setresgid32 as c::c_long;
+ #[cfg(not(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc")))]
+ const SYS: c::c_long = c::SYS_setresgid as c::c_long;
+ unsafe { syscall_ret(c::syscall(SYS, rgid.as_raw(), egid.as_raw(), sgid.as_raw())) }
+}
diff --git a/vendor/rustix/src/backend/libc/time/syscalls.rs b/vendor/rustix/src/backend/libc/time/syscalls.rs
index c9e075e53..9d341d886 100644
--- a/vendor/rustix/src/backend/libc/time/syscalls.rs
+++ b/vendor/rustix/src/backend/libc/time/syscalls.rs
@@ -28,6 +28,11 @@ weak!(fn __clock_gettime64(c::clockid_t, *mut LibcTimespec) -> c::c_int);
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
target_env = "gnu",
))]
+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",
+))]
weak!(fn __clock_getres64(c::clockid_t, *mut LibcTimespec) -> c::c_int);
#[cfg(all(
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
@@ -232,6 +237,59 @@ unsafe fn clock_gettime_dynamic_old(id: c::clockid_t) -> io::Result<Timespec> {
})
}
+#[cfg(not(any(
+ target_os = "redox",
+ target_os = "wasi",
+ all(apple, not(target_os = "macos"))
+)))]
+#[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 {
+ if let Some(libc_clock_settime) = __clock_settime64.get() {
+ let mut new_timespec = core::mem::zeroed::<LibcTimespec>();
+ 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)
+ }
+ }
+
+ #[cfg(not(all(
+ any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
+ target_env = "gnu",
+ )))]
+ unsafe {
+ ret(c::clock_settime(id as c::clockid_t, &timespec))
+ }
+}
+
+#[cfg(not(any(
+ target_os = "redox",
+ target_os = "wasi",
+ all(apple, not(target_os = "macos"))
+)))]
+#[cfg(all(
+ any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
+ target_env = "gnu",
+))]
+#[must_use]
+unsafe fn clock_settime_old(id: ClockId, timespec: Timespec) -> io::Result<()> {
+ use core::convert::TryInto;
+ let old_timespec = c::timespec {
+ tv_sec: timespec
+ .tv_sec
+ .try_into()
+ .map_err(|_| io::Errno::OVERFLOW)?,
+ tv_nsec: timespec.tv_nsec as _,
+ };
+ ret(c::clock_settime(id as c::clockid_t, &old_timespec))
+}
+
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
#[cfg(feature = "time")]
pub(crate) fn timerfd_create(id: TimerfdClockId, flags: TimerfdFlags) -> io::Result<OwnedFd> {
diff --git a/vendor/rustix/src/backend/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs
index 080f64431..47cd85701 100644
--- a/vendor/rustix/src/backend/libc/time/types.rs
+++ b/vendor/rustix/src/backend/libc/time/types.rs
@@ -16,7 +16,7 @@ pub type Timespec = c::timespec;
any(target_arch = "arm", target_arch = "mips", target_arch = "x86"),
target_env = "gnu",
))]
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, Copy)]
#[repr(C)]
pub struct Timespec {
/// Seconds.
@@ -114,7 +114,7 @@ impl From<Timespec> for LibcTimespec {
/// all of them are always supported.
///
/// [`clock_gettime`]: crate::time::clock_gettime
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(apple, target_os = "wasi")))]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
#[cfg_attr(not(target_os = "dragonfly"), repr(i32))]
#[cfg_attr(target_os = "dragonfly", repr(u64))]
@@ -126,32 +126,24 @@ pub enum ClockId {
/// `CLOCK_MONOTONIC`
Monotonic = c::CLOCK_MONOTONIC,
+ /// `CLOCK_UPTIME`
+ #[cfg(any(freebsdlike))]
+ Uptime = c::CLOCK_UPTIME,
+
/// `CLOCK_PROCESS_CPUTIME_ID`
- #[cfg(not(any(
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(netbsdlike, solarish, target_os = "redox")))]
ProcessCPUTime = c::CLOCK_PROCESS_CPUTIME_ID,
/// `CLOCK_THREAD_CPUTIME_ID`
- #[cfg(not(any(
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(netbsdlike, solarish, target_os = "redox")))]
ThreadCPUTime = c::CLOCK_THREAD_CPUTIME_ID,
/// `CLOCK_REALTIME_COARSE`
- #[cfg(any(target_os = "android", target_os = "linux"))]
+ #[cfg(any(target_os = "android", target_os = "linux", target_os = "freebsd"))]
RealtimeCoarse = c::CLOCK_REALTIME_COARSE,
/// `CLOCK_MONOTONIC_COARSE`
- #[cfg(any(target_os = "android", target_os = "linux"))]
+ #[cfg(any(target_os = "android", target_os = "linux", target_os = "freebsd"))]
MonotonicCoarse = c::CLOCK_MONOTONIC_COARSE,
/// `CLOCK_MONOTONIC_RAW`
@@ -165,7 +157,7 @@ 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.
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
#[repr(u32)]
#[non_exhaustive]
@@ -312,7 +304,7 @@ bitflags! {
/// `TFD_TIMER_CANCEL_ON_SET`
#[cfg(any(target_os = "android", target_os = "linux"))]
- const CANCEL_ON_SET = 2; // TODO: upstream TFD_TIMER_CANCEL_ON_SET
+ const CANCEL_ON_SET = c::TFD_TIMER_CANCEL_ON_SET;
}
}
diff --git a/vendor/rustix/src/backend/libc/weak.rs b/vendor/rustix/src/backend/libc/weak.rs
index d578038cd..b7f185da3 100644
--- a/vendor/rustix/src/backend/libc/weak.rs
+++ b/vendor/rustix/src/backend/libc/weak.rs
@@ -111,7 +111,7 @@ unsafe fn fetch(name: &str) -> *mut c_void {
Ok(c_str) => c_str,
Err(..) => return null_mut(),
};
- libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr().cast())
+ libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr())
}
#[cfg(not(any(target_os = "android", target_os = "linux")))]
diff --git a/vendor/rustix/src/backend/libc/winsock_c.rs b/vendor/rustix/src/backend/libc/winsock_c.rs
index 7d78aef65..521a7bbb1 100644
--- a/vendor/rustix/src/backend/libc/winsock_c.rs
+++ b/vendor/rustix/src/backend/libc/winsock_c.rs
@@ -24,6 +24,7 @@ pub(crate) const SO_LINGER: i32 = WinSock::SO_LINGER as _;
pub(crate) const SOL_SOCKET: i32 = WinSock::SOL_SOCKET as _;
pub(crate) const SO_RCVTIMEO: i32 = WinSock::SO_RCVTIMEO as _;
pub(crate) const SO_SNDTIMEO: i32 = WinSock::SO_SNDTIMEO as _;
+pub(crate) const SO_ERROR: i32 = WinSock::SO_ERROR as _;
pub(crate) const IP_TTL: i32 = WinSock::IP_TTL as _;
pub(crate) const TCP_NODELAY: i32 = WinSock::TCP_NODELAY as _;
pub(crate) const IP_ADD_MEMBERSHIP: i32 = WinSock::IP_ADD_MEMBERSHIP as _;
diff --git a/vendor/rustix/src/backend/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs
index a6f0b8ff6..e7263305a 100644
--- a/vendor/rustix/src/backend/linux_raw/c.rs
+++ b/vendor/rustix/src/backend/linux_raw/c.rs
@@ -9,21 +9,23 @@ pub(crate) use linux_raw_sys::ctypes::*;
pub(crate) use linux_raw_sys::errno::EINVAL;
pub(crate) use linux_raw_sys::general::{
AF_DECnet, __kernel_sa_family_t as sa_family_t, __kernel_sockaddr_storage as sockaddr_storage,
- in6_addr, in_addr, iovec, ip_mreq, ipv6_mreq, linger, sockaddr, sockaddr_in, sockaddr_in6,
- sockaddr_un, socklen_t, AF_APPLETALK, AF_ASH, AF_ATMPVC, AF_ATMSVC, AF_AX25, AF_BLUETOOTH,
- AF_BRIDGE, AF_CAN, AF_ECONET, AF_IEEE802154, AF_INET, AF_INET6, AF_IPX, AF_IRDA, AF_ISDN,
- AF_IUCV, AF_KEY, AF_LLC, AF_NETBEUI, AF_NETLINK, AF_NETROM, AF_PACKET, AF_PHONET, AF_PPPOX,
- AF_RDS, AF_ROSE, AF_RXRPC, AF_SECURITY, AF_SNA, AF_TIPC, AF_UNIX, AF_UNSPEC, AF_WANPIPE,
- AF_X25, IPPROTO_AH, IPPROTO_BEETPH, IPPROTO_COMP, IPPROTO_DCCP, IPPROTO_EGP, IPPROTO_ENCAP,
- IPPROTO_ESP, IPPROTO_ETHERNET, IPPROTO_FRAGMENT, IPPROTO_GRE, IPPROTO_ICMP, IPPROTO_ICMPV6,
- IPPROTO_IDP, IPPROTO_IGMP, IPPROTO_IP, IPPROTO_IPIP, IPPROTO_IPV6, IPPROTO_MH, IPPROTO_MPLS,
- IPPROTO_MPTCP, IPPROTO_MTP, IPPROTO_PIM, IPPROTO_PUP, IPPROTO_RAW, IPPROTO_ROUTING,
- IPPROTO_RSVP, IPPROTO_SCTP, IPPROTO_TCP, IPPROTO_TP, IPPROTO_UDP, IPPROTO_UDPLITE,
- IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP, IPV6_V6ONLY, IP_ADD_MEMBERSHIP,
- IP_DROP_MEMBERSHIP, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_TTL, MSG_CMSG_CLOEXEC, MSG_CONFIRM,
- MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR, MSG_ERRQUEUE, MSG_MORE, MSG_NOSIGNAL, MSG_OOB, MSG_PEEK,
- MSG_TRUNC, MSG_WAITALL, O_CLOEXEC, O_NONBLOCK, SHUT_RD, SHUT_RDWR, SHUT_WR, SOCK_DGRAM,
- SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_LINGER,
+ in6_addr, in_addr, iovec, ip_mreq, ipv6_mreq, linger, siginfo_t, sockaddr, sockaddr_in,
+ sockaddr_in6, sockaddr_un, socklen_t, AF_APPLETALK, AF_ASH, AF_ATMPVC, AF_ATMSVC, AF_AX25,
+ AF_BLUETOOTH, AF_BRIDGE, AF_CAN, AF_ECONET, AF_IEEE802154, AF_INET, AF_INET6, AF_IPX, AF_IRDA,
+ AF_ISDN, AF_IUCV, AF_KEY, AF_LLC, AF_NETBEUI, AF_NETLINK, AF_NETROM, AF_PACKET, AF_PHONET,
+ AF_PPPOX, AF_RDS, AF_ROSE, AF_RXRPC, AF_SECURITY, AF_SNA, AF_TIPC, AF_UNIX, AF_UNSPEC,
+ AF_WANPIPE, AF_X25, IPPROTO_AH, IPPROTO_BEETPH, IPPROTO_COMP, IPPROTO_DCCP, IPPROTO_EGP,
+ IPPROTO_ENCAP, IPPROTO_ESP, IPPROTO_ETHERNET, IPPROTO_FRAGMENT, IPPROTO_GRE, IPPROTO_ICMP,
+ IPPROTO_ICMPV6, IPPROTO_IDP, IPPROTO_IGMP, IPPROTO_IP, IPPROTO_IPIP, IPPROTO_IPV6, IPPROTO_MH,
+ IPPROTO_MPLS, IPPROTO_MPTCP, IPPROTO_MTP, IPPROTO_PIM, IPPROTO_PUP, IPPROTO_RAW,
+ IPPROTO_ROUTING, IPPROTO_RSVP, IPPROTO_SCTP, IPPROTO_TCP, IPPROTO_TP, IPPROTO_UDP,
+ IPPROTO_UDPLITE, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP, IPV6_V6ONLY,
+ IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MULTICAST_LOOP, IP_MULTICAST_TTL, IP_TTL,
+ MSG_CMSG_CLOEXEC, MSG_CONFIRM, MSG_DONTROUTE, MSG_DONTWAIT, MSG_EOR, MSG_ERRQUEUE, MSG_MORE,
+ MSG_NOSIGNAL, MSG_OOB, MSG_PEEK, MSG_TRUNC, MSG_WAITALL, O_CLOEXEC, O_NONBLOCK,
+ O_NONBLOCK as PIDFD_NONBLOCK, P_ALL, P_PID, P_PIDFD, SHUT_RD, SHUT_RDWR, SHUT_WR, SOCK_DGRAM,
+ SOCK_RAW, SOCK_RDM, SOCK_SEQPACKET, SOCK_STREAM, SOL_SOCKET, SO_BROADCAST, SO_ERROR, SO_LINGER,
SO_PASSCRED, SO_RCVTIMEO_NEW, SO_RCVTIMEO_OLD, SO_REUSEADDR, SO_SNDTIMEO_NEW, SO_SNDTIMEO_OLD,
SO_TYPE, TCP_NODELAY,
};
+pub(crate) use linux_raw_sys::general::{NFS_SUPER_MAGIC, PROC_SUPER_MAGIC, UTIME_NOW, UTIME_OMIT};
diff --git a/vendor/rustix/src/backend/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs
index 7e09cdf80..b9fe725bb 100644
--- a/vendor/rustix/src/backend/linux_raw/conv.rs
+++ b/vendor/rustix/src/backend/linux_raw/conv.rs
@@ -15,12 +15,12 @@
use super::c;
use super::fd::{AsRawFd, BorrowedFd, FromRawFd, RawFd};
-#[cfg(not(debug_assertions))]
-use super::io::errno::decode_usize_infallible;
#[cfg(feature = "runtime")]
use super::io::errno::try_decode_error;
#[cfg(target_pointer_width = "64")]
use super::io::errno::try_decode_u64;
+#[cfg(not(debug_assertions))]
+use super::io::errno::{decode_c_uint_infallible, decode_usize_infallible};
use super::io::errno::{
try_decode_c_int, try_decode_c_uint, try_decode_raw_fd, try_decode_usize, try_decode_void,
try_decode_void_star,
@@ -143,7 +143,7 @@ impl<'a, Num: ArgNumber> From<Option<&'a CStr>> for ArgReg<'a, Num> {
impl<'a, Num: ArgNumber> From<BorrowedFd<'a>> for ArgReg<'a, Num> {
#[inline]
fn from(fd: BorrowedFd<'a>) -> Self {
- // Safety: `BorrowedFd` ensures that the file descriptor is valid, and the
+ // SAFETY: `BorrowedFd` ensures that the file descriptor is valid, and the
// lifetime parameter on the resulting `ArgReg` ensures that the result is
// bounded by the `BorrowedFd`'s lifetime.
unsafe { raw_fd(fd.as_raw_fd()) }
@@ -314,6 +314,22 @@ impl<'a, Num: ArgNumber> From<crate::fs::AtFlags> for ArgReg<'a, Num> {
}
#[cfg(feature = "fs")]
+impl<'a, Num: ArgNumber> From<crate::fs::inotify::CreateFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::fs::inotify::CreateFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "fs")]
+impl<'a, Num: ArgNumber> From<crate::fs::inotify::WatchFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::fs::inotify::WatchFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+#[cfg(feature = "fs")]
impl<'a, Num: ArgNumber> From<crate::fs::MemfdFlags> for ArgReg<'a, Num> {
#[inline]
fn from(flags: crate::fs::MemfdFlags) -> Self {
@@ -665,6 +681,38 @@ impl<'a, Num: ArgNumber, T> From<&'a mut MaybeUninit<T>> for ArgReg<'a, Num> {
}
}
+#[cfg(feature = "fs")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
+impl<'a, Num: ArgNumber> From<crate::backend::fs::types::MountFlagsArg> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::fs::types::MountFlagsArg) -> Self {
+ c_uint(flags.0)
+ }
+}
+
+#[cfg(feature = "fs")]
+#[cfg(any(target_os = "android", target_os = "linux"))]
+impl<'a, Num: ArgNumber> From<crate::backend::fs::types::UnmountFlags> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(flags: crate::backend::fs::types::UnmountFlags) -> Self {
+ c_uint(flags.bits())
+ }
+}
+
+impl<'a, Num: ArgNumber> From<crate::process::Uid> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(t: crate::process::Uid) -> Self {
+ c_uint(t.as_raw())
+ }
+}
+
+impl<'a, Num: ArgNumber> From<crate::process::Gid> for ArgReg<'a, Num> {
+ #[inline]
+ fn from(t: crate::process::Gid) -> Self {
+ c_uint(t.as_raw())
+ }
+}
+
/// Convert a `usize` returned from a syscall that effectively returns `()` on
/// success.
///
@@ -754,6 +802,25 @@ pub(super) unsafe fn ret_usize_infallible(raw: RetReg<R0>) -> usize {
}
}
+/// Convert a `c_uint` returned from a syscall that effectively always
+/// returns a `c_uint`.
+///
+/// # Safety
+///
+/// This function must only be used with return values from infallible
+/// syscalls.
+#[inline]
+pub(super) unsafe fn ret_c_uint_infallible(raw: RetReg<R0>) -> c::c_uint {
+ #[cfg(debug_assertions)]
+ {
+ try_decode_c_uint(raw).unwrap()
+ }
+ #[cfg(not(debug_assertions))]
+ {
+ decode_c_uint_infallible(raw)
+ }
+}
+
/// Convert a `usize` returned from a syscall that effectively returns an
/// `OwnedFd` on success.
///
diff --git a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
new file mode 100644
index 000000000..4221565a6
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs
@@ -0,0 +1,108 @@
+//! inotify support for working with inotifies
+
+use super::super::c;
+use crate::backend::fs::syscalls;
+use crate::fd::{BorrowedFd, OwnedFd};
+use crate::io;
+use bitflags::bitflags;
+
+bitflags! {
+ /// `IN_*` for use with [`inotify_init`].
+ ///
+ /// [`inotify_init`]: crate::fs::inotify::inotify_init
+ pub struct CreateFlags: c::c_uint {
+ /// `IN_CLOEXEC`
+ const CLOEXEC = linux_raw_sys::general::IN_CLOEXEC;
+ /// `IN_NONBLOCK`
+ const NONBLOCK = linux_raw_sys::general::IN_NONBLOCK;
+ }
+}
+
+bitflags! {
+ /// `IN*` for use with [`inotify_add_watch`].
+ ///
+ /// [`inotify_add_watch`]: crate::fs::inotify::inotify_add_watch
+ #[derive(Default)]
+ pub struct WatchFlags: c::c_uint {
+ /// `IN_ACCESS`
+ const ACCESS = linux_raw_sys::general::IN_ACCESS;
+ /// `IN_ATTRIB`
+ const ATTRIB = linux_raw_sys::general::IN_ATTRIB;
+ /// `IN_CLOSE_NOWRITE`
+ const CLOSE_NOWRITE = linux_raw_sys::general::IN_CLOSE_NOWRITE;
+ /// `IN_CLOSE_WRITE`
+ const CLOSE_WRITE = linux_raw_sys::general::IN_CLOSE_WRITE;
+ /// `IN_CREATE `
+ const CREATE = linux_raw_sys::general::IN_CREATE;
+ /// `IN_DELETE`
+ const DELETE = linux_raw_sys::general::IN_DELETE;
+ /// `IN_DELETE_SELF`
+ const DELETE_SELF = linux_raw_sys::general::IN_DELETE_SELF;
+ /// `IN_MODIFY`
+ const MODIFY = linux_raw_sys::general::IN_MODIFY;
+ /// `IN_MOVE_SELF`
+ const MOVE_SELF = linux_raw_sys::general::IN_MOVE_SELF;
+ /// `IN_MOVED_FROM`
+ const MOVED_FROM = linux_raw_sys::general::IN_MOVED_FROM;
+ /// `IN_MOVED_TO`
+ const MOVED_TO = linux_raw_sys::general::IN_MOVED_TO;
+ /// `IN_OPEN`
+ const OPEN = linux_raw_sys::general::IN_OPEN;
+
+ /// `IN_CLOSE`
+ const CLOSE = linux_raw_sys::general::IN_CLOSE;
+ /// `IN_MOVE`
+ const MOVE = linux_raw_sys::general::IN_MOVE;
+ /// `IN_ALL_EVENTS`
+ const ALL_EVENTS = linux_raw_sys::general::IN_ALL_EVENTS;
+
+ /// `IN_DONT_FOLLOW`
+ const DONT_FOLLOW = linux_raw_sys::general::IN_DONT_FOLLOW;
+ /// `IN_EXCL_UNLINK`
+ const EXCL_UNLINK = linux_raw_sys::general::IN_EXCL_UNLINK;
+ /// `IN_MASK_ADD`
+ const MASK_ADD = linux_raw_sys::general::IN_MASK_ADD;
+ /// `IN_MASK_CREATE`
+ const MASK_CREATE = linux_raw_sys::general::IN_MASK_CREATE;
+ /// `IN_ONESHOT`
+ const ONESHOT = linux_raw_sys::general::IN_ONESHOT;
+ /// `IN_ONLYDIR`
+ const ONLYDIR = linux_raw_sys::general::IN_ONLYDIR;
+ }
+}
+
+/// `inotify_init1(flags)`—Creates a new inotify object.
+///
+/// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
+/// descriptor from being implicitly passed across `exec` boundaries.
+#[doc(alias = "inotify_init1")]
+pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> {
+ syscalls::inotify_init1(flags)
+}
+
+/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify
+///
+/// This registers or updates a watch for the filesystem path `path`
+/// and returns a watch descriptor corresponding to this watch.
+///
+/// Note: Due to the existence of hardlinks, providing two
+/// different paths to this method may result in it returning
+/// the same watch descriptor. An application should keep track of this
+/// externally to avoid logic errors.
+pub fn inotify_add_watch<P: crate::path::Arg>(
+ inot: BorrowedFd<'_>,
+ path: P,
+ flags: WatchFlags,
+) -> io::Result<i32> {
+ let path = path.as_cow_c_str().unwrap();
+ syscalls::inotify_add_watch(inot, &path, flags)
+}
+
+/// `inotify_rm_watch(self, wd)`—Removes a watch from this inotify
+///
+/// The watch descriptor provided should have previously been returned
+/// by [`inotify_add_watch`] and not previously have been removed.
+#[doc(alias = "inotify_rm_watch")]
+pub fn inotify_remove_watch(inot: BorrowedFd<'_>, wd: i32) -> io::Result<()> {
+ syscalls::inotify_rm_watch(inot, wd)
+}
diff --git a/vendor/rustix/src/backend/linux_raw/fs/mod.rs b/vendor/rustix/src/backend/linux_raw/fs/mod.rs
index 015c6baec..acf43ce4f 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/mod.rs
@@ -1,4 +1,5 @@
pub(crate) mod dir;
+pub mod inotify;
pub(crate) mod makedev;
pub(crate) mod syscalls;
pub(crate) mod types;
diff --git a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
index ff58f0a7b..8bd9ccc27 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs
@@ -10,7 +10,7 @@
use super::super::c;
use super::super::conv::{
by_ref, c_int, c_uint, dev_t, oflags_for_open_how, opt_mut, pass_usize, raw_fd, ret, ret_c_int,
- ret_c_uint, ret_owned_fd, ret_usize, size_of, slice_mut, zero,
+ ret_c_uint, ret_infallible, ret_owned_fd, ret_usize, size_of, slice_mut, zero,
};
#[cfg(target_pointer_width = "64")]
use super::super::conv::{loff_t, loff_t_from_u64, ret_u64};
@@ -24,12 +24,13 @@ use crate::fd::AsFd;
use crate::fd::{BorrowedFd, OwnedFd};
use crate::ffi::CStr;
use crate::fs::{
- Access, Advice, AtFlags, FallocateFlags, FileType, FlockOperation, MemfdFlags, Mode, OFlags,
- RenameFlags, ResolveFlags, SealFlags, Stat, StatFs, StatVfs, StatVfsMountFlags, StatxFlags,
- Timestamps,
+ inotify, Access, Advice, AtFlags, FallocateFlags, FileType, FlockOperation, MemfdFlags, Mode,
+ OFlags, RenameFlags, ResolveFlags, SealFlags, Stat, StatFs, StatVfs, StatVfsMountFlags,
+ StatxFlags, Timestamps,
};
use crate::io::{self, SeekFrom};
use crate::process::{Gid, Uid};
+#[cfg(any(target_pointer_width = "32", target_arch = "mips64"))]
use core::convert::TryInto;
use core::mem::MaybeUninit;
#[cfg(target_arch = "mips64")]
@@ -37,7 +38,8 @@ use linux_raw_sys::general::stat as linux_stat64;
use linux_raw_sys::general::{
__kernel_fsid_t, __kernel_timespec, open_how, statx, AT_EACCESS, AT_FDCWD, AT_REMOVEDIR,
AT_SYMLINK_NOFOLLOW, F_ADD_SEALS, F_GETFL, F_GETLEASE, F_GETOWN, F_GETPIPE_SZ, F_GETSIG,
- F_GET_SEALS, F_SETFL, F_SETPIPE_SZ, SEEK_CUR, SEEK_END, SEEK_SET, STATX__RESERVED,
+ F_GET_SEALS, F_SETFL, F_SETPIPE_SZ, SEEK_CUR, SEEK_DATA, SEEK_END, SEEK_HOLE, SEEK_SET,
+ STATX__RESERVED,
};
#[cfg(target_pointer_width = "32")]
use {
@@ -136,7 +138,18 @@ pub(crate) fn chmod(filename: &CStr, mode: Mode) -> io::Result<()> {
}
#[inline]
-pub(crate) fn chmodat(dirfd: BorrowedFd<'_>, filename: &CStr, mode: Mode) -> io::Result<()> {
+pub(crate) fn chmodat(
+ dirfd: BorrowedFd<'_>,
+ filename: &CStr,
+ mode: Mode,
+ flags: AtFlags,
+) -> io::Result<()> {
+ if flags == AtFlags::SYMLINK_NOFOLLOW {
+ return Err(io::Errno::OPNOTSUPP);
+ }
+ if !flags.is_empty() {
+ return Err(io::Errno::INVAL);
+ }
unsafe { ret(syscall_readonly!(__NR_fchmodat, dirfd, filename, mode)) }
}
@@ -214,6 +227,10 @@ pub(crate) fn seek(fd: BorrowedFd<'_>, pos: SeekFrom) -> io::Result<u64> {
}
SeekFrom::End(offset) => (SEEK_END, offset),
SeekFrom::Current(offset) => (SEEK_CUR, offset),
+ #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ SeekFrom::Data(offset) => (SEEK_DATA, offset),
+ #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ SeekFrom::Hole(offset) => (SEEK_HOLE, offset),
};
_seek(fd, offset, whence)
}
@@ -404,7 +421,23 @@ pub(crate) fn fdatasync(fd: BorrowedFd<'_>) -> io::Result<()> {
#[inline]
pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> {
- unsafe { ret(syscall!(__NR_flock, fd, c_uint(operation as c::c_uint))) }
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_flock,
+ fd,
+ c_uint(operation as c::c_uint)
+ ))
+ }
+}
+
+#[inline]
+pub(crate) fn syncfs(fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_syncfs, fd)) }
+}
+
+#[inline]
+pub(crate) fn sync() {
+ unsafe { ret_infallible(syscall_readonly!(__NR_sync)) }
}
#[inline]
@@ -1017,6 +1050,58 @@ pub(crate) fn fcntl_add_seals(fd: BorrowedFd<'_>, seals: SealFlags) -> io::Resul
}
#[inline]
+pub(crate) fn fcntl_lock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result<()> {
+ #[cfg(target_pointer_width = "64")]
+ use linux_raw_sys::general::{flock, F_SETLK, F_SETLKW};
+ #[cfg(target_pointer_width = "32")]
+ use linux_raw_sys::general::{flock64 as flock, F_SETLK64 as F_SETLK, F_SETLKW64 as F_SETLKW};
+ use linux_raw_sys::general::{F_RDLCK, F_UNLCK, F_WRLCK};
+
+ let (cmd, l_type) = match operation {
+ FlockOperation::LockShared => (F_SETLKW, F_RDLCK),
+ FlockOperation::LockExclusive => (F_SETLKW, F_WRLCK),
+ FlockOperation::Unlock => (F_SETLKW, F_UNLCK),
+ FlockOperation::NonBlockingLockShared => (F_SETLK, F_RDLCK),
+ FlockOperation::NonBlockingLockExclusive => (F_SETLK, F_WRLCK),
+ FlockOperation::NonBlockingUnlock => (F_SETLK, F_UNLCK),
+ };
+
+ unsafe {
+ let lock = flock {
+ l_type: l_type as _,
+
+ // When `l_len` is zero, this locks all the bytes from
+ // `l_whence`/`l_start` to the end of the file, even as the
+ // file grows dynamically.
+ l_whence: SEEK_SET as _,
+ l_start: 0,
+ l_len: 0,
+
+ ..core::mem::zeroed()
+ };
+
+ #[cfg(target_pointer_width = "32")]
+ {
+ ret(syscall_readonly!(
+ __NR_fcntl64,
+ fd,
+ c_uint(cmd),
+ by_ref(&lock)
+ ))
+ }
+ #[cfg(target_pointer_width = "64")]
+ {
+ ret(syscall_readonly!(
+ __NR_fcntl,
+ fd,
+ c_uint(cmd),
+ by_ref(&lock)
+ ))
+ }
+ }
+}
+
+#[inline]
pub(crate) fn rename(oldname: &CStr, newname: &CStr) -> io::Result<()> {
#[cfg(target_arch = "riscv64")]
unsafe {
@@ -1196,6 +1281,16 @@ pub(crate) fn getdents(fd: BorrowedFd<'_>, dirent: &mut [u8]) -> io::Result<usiz
}
#[inline]
+pub(crate) fn getdents_uninit(
+ fd: BorrowedFd<'_>,
+ dirent: &mut [MaybeUninit<u8>],
+) -> io::Result<usize> {
+ let (dirent_addr_mut, dirent_len) = slice_mut(dirent);
+
+ unsafe { ret_usize(syscall!(__NR_getdents64, fd, dirent_addr_mut, dirent_len)) }
+}
+
+#[inline]
pub(crate) fn utimensat(
dirfd: BorrowedFd<'_>,
pathname: &CStr,
@@ -1321,20 +1416,7 @@ pub(crate) fn copy_file_range(
off_in: Option<&mut u64>,
fd_out: BorrowedFd<'_>,
off_out: Option<&mut u64>,
- len: u64,
-) -> io::Result<u64> {
- let len: usize = len.try_into().unwrap_or(usize::MAX);
- _copy_file_range(fd_in, off_in, fd_out, off_out, len, 0).map(|result| result as u64)
-}
-
-#[inline]
-fn _copy_file_range(
- fd_in: BorrowedFd<'_>,
- off_in: Option<&mut u64>,
- fd_out: BorrowedFd<'_>,
- off_out: Option<&mut u64>,
len: usize,
- flags: c::c_uint,
) -> io::Result<usize> {
unsafe {
ret_usize(syscall!(
@@ -1344,7 +1426,7 @@ fn _copy_file_range(
fd_out,
opt_mut(off_out),
pass_usize(len),
- c_uint(flags)
+ c_uint(0)
))
}
}
@@ -1382,3 +1464,49 @@ pub(crate) fn sendfile(
))
}
}
+
+#[inline]
+#[cfg(any(target_os = "android", target_os = "linux"))]
+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]
+#[cfg(any(target_os = "android", target_os = "linux"))]
+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<OwnedFd> {
+ unsafe { ret_owned_fd(syscall_readonly!(__NR_inotify_init1, flags)) }
+}
+
+#[inline]
+pub(crate) fn inotify_add_watch(
+ infd: BorrowedFd<'_>,
+ path: &CStr,
+ flags: inotify::WatchFlags,
+) -> io::Result<i32> {
+ unsafe { ret_c_int(syscall_readonly!(__NR_inotify_add_watch, infd, path, flags)) }
+}
+
+#[inline]
+pub(crate) fn inotify_rm_watch(infd: BorrowedFd<'_>, wfd: i32) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_inotify_rm_watch, infd, c_int(wfd))) }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs
index a8d225ede..9bafb8ac0 100644
--- a/vendor/rustix/src/backend/linux_raw/fs/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs
@@ -122,6 +122,32 @@ impl Mode {
}
}
+impl From<RawMode> for Mode {
+ /// Support conversions from raw mode values to `Mode`.
+ ///
+ /// ```
+ /// use rustix::fs::{Mode, RawMode};
+ /// assert_eq!(Mode::from(0o700), Mode::RWXU);
+ /// ```
+ #[inline]
+ fn from(st_mode: RawMode) -> Self {
+ Self::from_raw_mode(st_mode)
+ }
+}
+
+impl From<Mode> for RawMode {
+ /// Support conversions from `Mode to raw mode values.
+ ///
+ /// ```
+ /// use rustix::fs::{Mode, RawMode};
+ /// assert_eq!(RawMode::from(Mode::RWXU), 0o700);
+ /// ```
+ #[inline]
+ fn from(mode: Mode) -> Self {
+ mode.as_raw_mode()
+ }
+}
+
bitflags! {
/// `O_*` constants for use with [`openat`].
///
@@ -198,6 +224,9 @@ bitflags! {
/// `O_NOATIME`
const NOATIME = linux_raw_sys::general::O_NOATIME;
+
+ /// `O_DIRECT`
+ const DIRECT = linux_raw_sys::general::O_DIRECT;
}
}
@@ -515,9 +544,10 @@ bitflags! {
}
}
-/// `LOCK_*` constants for use with [`flock`]
+/// `LOCK_*` constants for use with [`flock`] and [`fcntl_lock`].
///
/// [`flock`]: crate::fs::flock
+/// [`fcntl_lock`]: crate::fs::fcntl_lock
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum FlockOperation {
@@ -637,10 +667,106 @@ pub type FsWord = linux_raw_sys::general::__fsword_t;
#[cfg(target_arch = "mips64")]
pub type FsWord = i64;
-pub use linux_raw_sys::general::{UTIME_NOW, UTIME_OMIT};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `MS_*` constants for use with [`mount`].
+ ///
+ /// [`mount`]: crate::fs::mount
+ 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;
-/// `PROC_SUPER_MAGIC`—The magic number for the procfs filesystem.
-pub const PROC_SUPER_MAGIC: FsWord = linux_raw_sys::general::PROC_SUPER_MAGIC as FsWord;
+ /// `MS_REC`
+ const REC = linux_raw_sys::general::MS_REC;
-/// `NFS_SUPER_MAGIC`—The magic number for the NFS filesystem.
-pub const NFS_SUPER_MAGIC: FsWord = linux_raw_sys::general::NFS_SUPER_MAGIC as FsWord;
+ /// `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;
+ }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `MS_*` constants for use with [`change_mount`].
+ ///
+ /// [`change_mount`]: crate::fs::mount::change_mount
+ 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;
+ }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ pub(crate) struct InternalMountFlags: c::c_uint {
+ const REMOUNT = linux_raw_sys::general::MS_REMOUNT;
+ const MOVE = linux_raw_sys::general::MS_MOVE;
+ }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub(crate) struct MountFlagsArg(pub(crate) c::c_uint);
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+bitflags! {
+ /// `MNT_*` constants for use with [`unmount`].
+ ///
+ /// [`unmount`]: crate::fs::mount::unmount
+ 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/epoll.rs b/vendor/rustix/src/backend/linux_raw/io/epoll.rs
index d55ad75b1..3fc6462a2 100644
--- a/vendor/rustix/src/backend/linux_raw/io/epoll.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/epoll.rs
@@ -6,17 +6,17 @@
//!
//! # Examples
//!
-//! ```rust,no_run
+//! ```no_run
//! # #![cfg_attr(io_lifetimes_use_std, feature(io_safety))]
//! # #[cfg(feature = "net")]
//! # fn main() -> std::io::Result<()> {
//! use io_lifetimes::AsFd;
-//! use rustix::io::epoll::{self, Epoll};
-//! use rustix::io::{ioctl_fionbio, read, write};
+//! use rustix::io::{epoll, ioctl_fionbio, read, write};
//! use rustix::net::{
//! accept, bind_v4, listen, socket, AddressFamily, Ipv4Addr, Protocol, SocketAddrV4,
//! SocketType,
//! };
+//! use std::collections::HashMap;
//! use std::os::unix::io::AsRawFd;
//!
//! // Create a socket and listen on it.
@@ -26,29 +26,40 @@
//!
//! // Create an epoll object. Using `Owning` here means the epoll object will
//! // take ownership of the file descriptors registered with it.
-//! let epoll = Epoll::new(epoll::CreateFlags::CLOEXEC, epoll::Owning::new())?;
-//!
-//! // Remember the socket raw fd, which we use for comparisons only.
-//! let raw_listen_sock = listen_sock.as_fd().as_raw_fd();
+//! let epoll = epoll::epoll_create(epoll::CreateFlags::CLOEXEC)?;
//!
//! // Register the socket with the epoll object.
-//! epoll.add(listen_sock, epoll::EventFlags::IN)?;
+//! epoll::epoll_add(&epoll, &listen_sock, 1, epoll::EventFlags::IN)?;
+//!
+//! // Keep track of the sockets we've opened.
+//! let mut next_id = 2;
+//! let mut sockets = HashMap::new();
//!
//! // Process events.
//! let mut event_list = epoll::EventVec::with_capacity(4);
//! loop {
-//! epoll.wait(&mut event_list, -1)?;
+//! epoll::epoll_wait(&epoll, &mut event_list, -1)?;
//! for (_event_flags, target) in &event_list {
-//! if target.as_raw_fd() == raw_listen_sock {
+//! if target == 1 {
//! // Accept a new connection, set it to non-blocking, and
//! // register to be notified when it's ready to write to.
-//! let conn_sock = accept(&*target)?;
+//! let conn_sock = accept(&listen_sock)?;
//! ioctl_fionbio(&conn_sock, true)?;
-//! epoll.add(conn_sock, epoll::EventFlags::OUT | epoll::EventFlags::ET)?;
+//! epoll::epoll_add(
+//! &epoll,
+//! &conn_sock,
+//! next_id,
+//! epoll::EventFlags::OUT | epoll::EventFlags::ET,
+//! )?;
+//!
+//! // Keep track of the socket.
+//! sockets.insert(next_id, conn_sock);
+//! next_id += 1;
//! } else {
//! // Write a message to the stream and then unregister it.
-//! write(&*target, b"hello\n")?;
-//! let _ = epoll.del(target)?;
+//! let target = sockets.remove(&target).unwrap();
+//! write(&target, b"hello\n")?;
+//! let _ = epoll::epoll_del(&epoll, &target)?;
//! }
//! }
//! }
@@ -60,17 +71,11 @@
#![allow(unsafe_code)]
use super::super::c;
-use crate::backend::io::syscalls::{epoll_add, epoll_create, epoll_del, epoll_mod, epoll_wait};
-use crate::fd::{AsFd, AsRawFd, BorrowedFd, OwnedFd, RawFd};
-#[cfg(feature = "std")]
-use crate::fd::{FromRawFd, IntoRawFd};
+use crate::backend::io::syscalls;
+use crate::fd::{AsFd, AsRawFd, OwnedFd};
use crate::io;
use alloc::vec::Vec;
use bitflags::bitflags;
-use core::fmt;
-use core::marker::PhantomData;
-use core::ops::Deref;
-use core::ptr::null;
bitflags! {
/// `EPOLL_*` for use with [`Epoll::new`].
@@ -99,6 +104,24 @@ bitflags! {
/// `EPOLLHUP`
const HUP = linux_raw_sys::general::EPOLLHUP as u32;
+ /// `EPOLLRDNORM`
+ const RDNORM = linux_raw_sys::general::EPOLLRDNORM as u32;
+
+ /// `EPOLLRDBAND`
+ const RDBAND = linux_raw_sys::general::EPOLLRDBAND as u32;
+
+ /// `EPOLLWRNORM`
+ const WRNORM = linux_raw_sys::general::EPOLLWRNORM as u32;
+
+ /// `EPOLLWRBAND`
+ const WRBAND = linux_raw_sys::general::EPOLLWRBAND as u32;
+
+ /// `EPOLLMSG`
+ const MSG = linux_raw_sys::general::EPOLLMSG as u32;
+
+ /// `EPOLLRDHUP`
+ const RDHUP = linux_raw_sys::general::EPOLLRDHUP as u32;
+
/// `EPOLLET`
const ET = linux_raw_sys::general::EPOLLET as u32;
@@ -113,351 +136,127 @@ bitflags! {
}
}
-/// A reference to a `T`.
-pub struct Ref<'a, T> {
- t: T,
- _phantom: PhantomData<&'a T>,
-}
-
-impl<'a, T> Ref<'a, T> {
- #[inline]
- fn new(t: T) -> Self {
- Self {
- t,
- _phantom: PhantomData,
- }
- }
-
- #[inline]
- fn consume(self) -> T {
- self.t
- }
-}
-
-impl<'a, T> Deref for Ref<'a, T> {
- type Target = T;
-
- #[inline]
- fn deref(&self) -> &T {
- &self.t
- }
-}
-
-impl<'a, T: fmt::Debug> fmt::Debug for Ref<'a, T> {
- fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
- self.t.fmt(fmt)
- }
-}
-
-/// A trait for data stored within an [`Epoll`] instance.
-pub trait Context {
- /// The type of an element owned by this context.
- type Data;
-
- /// The type of a value used to refer to an element owned by this context.
- type Target: AsFd;
-
- /// Assume ownership of `data`, and returning a `Target`.
- fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target>;
-
- /// Encode `target` as a `u64`. The only requirement on this value is that
- /// it be decodable by `decode`.
- fn encode(&self, target: Ref<'_, Self::Target>) -> u64;
-
- /// Decode `raw`, which is a value encoded by `encode`, into a `Target`.
- ///
- /// # Safety
- ///
- /// `raw` must be a `u64` value returned from `encode`, from the same
- /// context, and within the context's lifetime.
- unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target>;
-
- /// Release ownership of the value referred to by `target` and return it.
- fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data;
-}
-
-/// A type implementing [`Context`] where the `Data` type is `BorrowedFd<'a>`.
-pub struct Borrowing<'a> {
- _phantom: PhantomData<BorrowedFd<'a>>,
-}
-
-impl<'a> Context for Borrowing<'a> {
- type Data = BorrowedFd<'a>;
- type Target = BorrowedFd<'a>;
-
- #[inline]
- fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target> {
- Ref::new(data)
- }
-
- #[inline]
- fn encode(&self, target: Ref<'_, Self::Target>) -> u64 {
- target.as_raw_fd() as u64
- }
-
- #[inline]
- unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target> {
- Ref::new(BorrowedFd::<'a>::borrow_raw(raw as RawFd))
- }
-
- #[inline]
- fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data {
- target.consume()
- }
-}
-
-/// A type implementing [`Context`] where the `Data` type is `T`, a type
-/// implementing `From<OwnedFd>` and `From<T> of OwnedFd`.
+/// `epoll_create1(flags)`—Creates a new `Epoll`.
///
-/// This may be used with [`OwnedFd`], or higher-level types like
-/// [`std::fs::File`] or [`std::net::TcpStream`].
-#[cfg(feature = "std")]
-pub struct Owning<'context, T: Into<OwnedFd> + From<OwnedFd>> {
- _phantom: PhantomData<&'context T>,
+/// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
+/// descriptor from being implicitly passed across `exec` boundaries.
+#[inline]
+#[doc(alias = "epoll_create1")]
+pub fn epoll_create(flags: CreateFlags) -> io::Result<OwnedFd> {
+ syscalls::epoll_create(flags)
}
-#[cfg(feature = "std")]
-impl<'context, T: Into<OwnedFd> + From<OwnedFd>> Owning<'context, T> {
- /// Creates a new empty `Owning`.
- #[allow(clippy::new_without_default)] // This is a specialized type that doesn't need to be generically constructible.
- #[inline]
- pub fn new() -> Self {
- Self {
- _phantom: PhantomData,
- }
- }
-}
-
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> Context for Owning<'context, T> {
- type Data = T;
- type Target = BorrowedFd<'context>;
-
- #[inline]
- fn acquire<'call>(&self, data: Self::Data) -> Ref<'call, Self::Target> {
- let raw_fd = data.into().into_raw_fd();
- // Safety: `epoll` will assign ownership of the file descriptor to the
- // kernel epoll object. We use `Into<OwnedFd>`+`IntoRawFd` to consume
- // the `Data` and extract the raw file descriptor and then "borrow" it
- // with `borrow_raw` knowing that the borrow won't outlive the
- // kernel epoll object.
- unsafe { Ref::new(BorrowedFd::<'context>::borrow_raw(raw_fd)) }
- }
-
- #[inline]
- fn encode(&self, target: Ref<'_, Self::Target>) -> u64 {
- target.as_fd().as_raw_fd() as u64
- }
-
- #[inline]
- unsafe fn decode<'call>(&self, raw: u64) -> Ref<'call, Self::Target> {
- Ref::new(BorrowedFd::<'context>::borrow_raw(raw as RawFd))
- }
-
- #[inline]
- fn release(&self, target: Ref<'_, Self::Target>) -> Self::Data {
- let raw_fd = target.consume().as_raw_fd();
-
- // Safety: The file descriptor was held by the kernel epoll object and
- // is now being released, so we can create a new `OwnedFd` that assumes
- // ownership.
- unsafe { T::from(io_lifetimes::OwnedFd::from_raw_fd(raw_fd)) }
- }
-}
-
-/// An "epoll", an interface to an OS object allowing one to repeatedly wait
-/// for events from a set of file descriptors efficiently.
-pub struct Epoll<Context: self::Context> {
- epoll_fd: OwnedFd,
- context: Context,
-}
-
-impl<Context: self::Context> Epoll<Context> {
- /// `epoll_create1(flags)`—Creates a new `Epoll`.
- ///
- /// Use the [`CreateFlags::CLOEXEC`] flag to prevent the resulting file
- /// descriptor from being implicitly passed across `exec` boundaries.
- #[inline]
- #[doc(alias = "epoll_create1")]
- pub fn new(flags: CreateFlags, context: Context) -> io::Result<Self> {
- // Safety: We're calling `epoll_create1` via FFI and we know how it
- // behaves.
- Ok(Self {
- epoll_fd: epoll_create(flags)?,
- context,
- })
- }
-
- /// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
- /// `Epoll`.
- ///
- /// This registers interest in any of the events set in `events` occurring
- /// on the file descriptor associated with `data`.
- #[doc(alias = "epoll_ctl")]
- pub fn add(
- &self,
- data: Context::Data,
- event_flags: EventFlags,
- ) -> io::Result<Ref<'_, Context::Target>> {
- // Safety: We're calling `epoll_ctl` via FFI and we know how it
- // behaves.
- unsafe {
- let target = self.context.acquire(data);
- let raw_fd = target.as_fd().as_raw_fd();
- let encoded = self.context.encode(target);
- epoll_add(
- self.epoll_fd.as_fd(),
- raw_fd,
- &linux_raw_sys::general::epoll_event {
- events: event_flags.bits(),
- data: encoded,
- },
- )?;
- Ok(self.context.decode(encoded))
- }
- }
-
- /// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
- /// this `Epoll`.
- ///
- /// This sets the events of interest with `target` to `events`.
- #[doc(alias = "epoll_ctl")]
- pub fn mod_(
- &self,
- target: Ref<'_, Context::Target>,
- event_flags: EventFlags,
- ) -> io::Result<()> {
- let raw_fd = target.as_fd().as_raw_fd();
- let encoded = self.context.encode(target);
- // Safety: We're calling `epoll_ctl` via FFI and we know how it
- // behaves.
- unsafe {
- epoll_mod(
- self.epoll_fd.as_fd(),
- raw_fd,
- &linux_raw_sys::general::epoll_event {
- events: event_flags.bits(),
- data: encoded,
- },
- )
- }
- }
-
- /// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
- /// this `Epoll`.
- ///
- /// This also returns the owning `Data`.
- #[doc(alias = "epoll_ctl")]
- pub fn del(&self, target: Ref<'_, Context::Target>) -> io::Result<Context::Data> {
- // Safety: We're calling `epoll_ctl` via FFI and we know how it
- // behaves.
- unsafe {
- let raw_fd = target.as_fd().as_raw_fd();
- epoll_del(self.epoll_fd.as_fd(), raw_fd)?;
- }
- Ok(self.context.release(target))
- }
-
- /// `epoll_wait(self, events, timeout)`—Waits for registered events of
- /// interest.
- ///
- /// For each event of interest, an element is written to `events`. On
- /// success, this returns the number of written elements.
- #[doc(alias = "epoll_wait")]
- pub fn wait<'context>(
- &'context self,
- event_list: &mut EventVec<'context, Context>,
- timeout: c::c_int,
- ) -> io::Result<()> {
- // Safety: We're calling `epoll_wait` via FFI and we know how it
- // behaves.
- unsafe {
- event_list.events.set_len(0);
- let nfds = epoll_wait(
- self.epoll_fd.as_fd(),
- event_list.events[..].as_mut_ptr().cast(),
- event_list.events.capacity(),
- timeout,
- )?;
- event_list.events.set_len(nfds);
- event_list.context = &self.context;
- }
-
- Ok(())
- }
-}
-
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsRawFd for Epoll<Owning<'context, T>> {
- fn as_raw_fd(&self) -> RawFd {
- self.epoll_fd.as_raw_fd()
- }
-}
-
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> IntoRawFd for Epoll<Owning<'context, T>> {
- fn into_raw_fd(self) -> RawFd {
- self.epoll_fd.into_raw_fd()
- }
-}
-
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> FromRawFd for Epoll<Owning<'context, T>> {
- unsafe fn from_raw_fd(fd: RawFd) -> Self {
- Self {
- epoll_fd: OwnedFd::from_raw_fd(fd),
- context: Owning::new(),
- }
+/// `epoll_ctl(self, EPOLL_CTL_ADD, data, event)`—Adds an element to an
+/// `Epoll`.
+///
+/// This registers interest in any of the events set in `events` occurring
+/// on the file descriptor associated with `data`.
+///
+/// Note that if `epoll_del` is not called on the I/O source passed into
+/// this function before the I/O source is `close`d, then the `epoll` will
+/// act as if the I/O source is still registered with it. This can lead to
+/// spurious events being returned from `epoll_wait`. If a file descriptor
+/// is an `Arc<dyn SystemResource>`, then `epoll` can be thought to maintain
+/// a `Weak<dyn SystemResource>` to the file descriptor.
+#[doc(alias = "epoll_ctl")]
+pub fn epoll_add(
+ epoll: impl AsFd,
+ source: impl AsFd,
+ data: u64,
+ event_flags: EventFlags,
+) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_ctl` via FFI and we know how it
+ // behaves.
+ unsafe {
+ syscalls::epoll_add(
+ epoll.as_fd(),
+ source.as_fd().as_raw_fd(),
+ &linux_raw_sys::general::epoll_event {
+ events: event_flags.bits(),
+ data,
+ },
+ )
}
}
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> AsFd for Epoll<Owning<'context, T>> {
- fn as_fd(&self) -> BorrowedFd<'_> {
- self.epoll_fd.as_fd()
+/// `epoll_ctl(self, EPOLL_CTL_MOD, target, event)`—Modifies an element in
+/// this `Epoll`.
+///
+/// This sets the events of interest with `target` to `events`.
+#[doc(alias = "epoll_ctl")]
+pub fn epoll_mod(
+ epoll: impl AsFd,
+ source: impl AsFd,
+ data: u64,
+ event_flags: EventFlags,
+) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_ctl` via FFI and we know how it
+ // behaves.
+ unsafe {
+ let raw_fd = source.as_fd().as_raw_fd();
+ syscalls::epoll_mod(
+ epoll.as_fd(),
+ raw_fd,
+ &linux_raw_sys::general::epoll_event {
+ events: event_flags.bits(),
+ data,
+ },
+ )
}
}
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<Epoll<Owning<'context, T>>>
- for OwnedFd
-{
- fn from(epoll: Epoll<Owning<'context, T>>) -> Self {
- epoll.epoll_fd
+/// `epoll_ctl(self, EPOLL_CTL_DEL, target, NULL)`—Removes an element in
+/// this `Epoll`.
+///
+/// This also returns the owning `Data`.
+#[doc(alias = "epoll_ctl")]
+pub fn epoll_del(epoll: impl AsFd, source: impl AsFd) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_ctl` via FFI and we know how it
+ // behaves.
+ unsafe {
+ let raw_fd = source.as_fd().as_raw_fd();
+ syscalls::epoll_del(epoll.as_fd(), raw_fd)
}
}
-#[cfg(feature = "std")]
-impl<'context, T: AsFd + Into<OwnedFd> + From<OwnedFd>> From<OwnedFd>
- for Epoll<Owning<'context, T>>
-{
- fn from(fd: OwnedFd) -> Self {
- Self {
- epoll_fd: fd,
- context: Owning::new(),
- }
- }
+/// `epoll_wait(self, events, timeout)`—Waits for registered events of
+/// interest.
+///
+/// For each event of interest, an element is written to `events`. On
+/// success, this returns the number of written elements.
+pub fn epoll_wait(
+ epoll: impl AsFd,
+ event_list: &mut EventVec,
+ timeout: c::c_int,
+) -> io::Result<()> {
+ // SAFETY: We're calling `epoll_wait` via FFI and we know how it
+ // behaves.
+ unsafe {
+ event_list.events.set_len(0);
+ let nfds = syscalls::epoll_wait(
+ epoll.as_fd(),
+ event_list.events[..].as_mut_ptr().cast(),
+ event_list.events.capacity(),
+ timeout,
+ )?;
+ event_list.events.set_len(nfds);
+ }
+
+ Ok(())
}
/// An iterator over the `Event`s in an `EventVec`.
-pub struct Iter<'context, Context: self::Context> {
- iter: core::slice::Iter<'context, Event>,
- context: *const Context,
- _phantom: PhantomData<&'context Context>,
+pub struct Iter<'a> {
+ iter: core::slice::Iter<'a, Event>,
}
-impl<'context, Context: self::Context> Iterator for Iter<'context, Context> {
- type Item = (EventFlags, Ref<'context, Context::Target>);
+impl<'a> Iterator for Iter<'a> {
+ type Item = (EventFlags, u64);
fn next(&mut self) -> Option<Self::Item> {
- self.iter.next().map(|event| {
- // Safety: `self.context` is guaranteed to be valid because we hold
- // `'context` for it. And we know this event is associated with this
- // context because `wait` sets both.
- let decoded = unsafe { (*self.context).decode(event.encoded) };
-
- (event.event_flags, decoded)
- })
+ self.iter
+ .next()
+ .map(|event| (event.event_flags, event.data))
}
}
@@ -466,28 +265,22 @@ impl<'context, Context: self::Context> Iterator for Iter<'context, Context> {
#[cfg_attr(target_arch = "x86_64", repr(packed))]
struct Event {
// Match the layout of `linux_raw_sys::general::epoll_event`. We just use a
- // `u64` instead of the full union; `Context` implementations will simply
- // need to deal with casting the value into and out of the `u64`
- // themselves.
+ // `u64` instead of the full union.
event_flags: EventFlags,
- encoded: u64,
+ data: u64,
}
/// A vector of `Event`s, plus context for interpreting them.
-pub struct EventVec<'context, Context: self::Context> {
+pub struct EventVec {
events: Vec<Event>,
- context: *const Context,
- _phantom: PhantomData<&'context Context>,
}
-impl<'context, Context: self::Context> EventVec<'context, Context> {
+impl EventVec {
/// Constructs an `EventVec` with memory for `capacity` `Event`s.
#[inline]
pub fn with_capacity(capacity: usize) -> Self {
Self {
events: Vec::with_capacity(capacity),
- context: null(),
- _phantom: PhantomData,
}
}
@@ -523,11 +316,9 @@ impl<'context, Context: self::Context> EventVec<'context, Context> {
/// Returns an iterator over the `Event`s in this `EventVec`.
#[inline]
- pub fn iter(&self) -> Iter<'_, Context> {
+ pub fn iter(&self) -> Iter<'_> {
Iter {
iter: self.events.iter(),
- context: self.context,
- _phantom: PhantomData,
}
}
@@ -544,9 +335,9 @@ impl<'context, Context: self::Context> EventVec<'context, Context> {
}
}
-impl<'context, Context: self::Context> IntoIterator for &'context EventVec<'context, Context> {
- type IntoIter = Iter<'context, Context>;
- type Item = (EventFlags, Ref<'context, Context::Target>);
+impl<'a> IntoIterator for &'a EventVec {
+ type IntoIter = Iter<'a>;
+ type Item = (EventFlags, u64);
#[inline]
fn into_iter(self) -> Self::IntoIter {
diff --git a/vendor/rustix/src/backend/linux_raw/io/errno.rs b/vendor/rustix/src/backend/linux_raw/io/errno.rs
index 5c7b2fcd5..b01910138 100644
--- a/vendor/rustix/src/backend/linux_raw/io/errno.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/errno.rs
@@ -69,7 +69,7 @@ impl Errno {
// TODO: Use Range::contains, once that's `const`.
const_assert!(encoded >= 0xf001);
- // Safety: Linux syscalls return negated error values in the range
+ // SAFETY: Linux syscalls return negated error values in the range
// `-4095..0`, which we just asserted.
unsafe { Self(encoded) }
}
@@ -82,7 +82,7 @@ pub(in crate::backend) fn try_decode_c_int<Num: RetNumber>(
raw: RetReg<Num>,
) -> io::Result<c::c_int> {
if raw.is_in_range(-4095..0) {
- // Safety: `raw` must be in `-4095..0`, and we just checked that raw is
+ // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
return Err(unsafe { Errno(raw.decode_error_code()) });
}
@@ -97,7 +97,7 @@ pub(in crate::backend) fn try_decode_c_uint<Num: RetNumber>(
raw: RetReg<Num>,
) -> io::Result<c::c_uint> {
if raw.is_in_range(-4095..0) {
- // Safety: `raw` must be in `-4095..0`, and we just checked that raw is
+ // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
return Err(unsafe { Errno(raw.decode_error_code()) });
}
@@ -110,7 +110,7 @@ pub(in crate::backend) fn try_decode_c_uint<Num: RetNumber>(
#[inline]
pub(in crate::backend) fn try_decode_usize<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<usize> {
if raw.is_in_range(-4095..0) {
- // Safety: `raw` must be in `-4095..0`, and we just checked that raw is
+ // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
return Err(unsafe { Errno(raw.decode_error_code()) });
}
@@ -125,7 +125,7 @@ pub(in crate::backend) fn try_decode_void_star<Num: RetNumber>(
raw: RetReg<Num>,
) -> io::Result<*mut c::c_void> {
if raw.is_in_range(-4095..0) {
- // Safety: `raw` must be in `-4095..0`, and we just checked that raw is
+ // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
return Err(unsafe { Errno(raw.decode_error_code()) });
}
@@ -139,7 +139,7 @@ pub(in crate::backend) fn try_decode_void_star<Num: RetNumber>(
#[inline]
pub(in crate::backend) fn try_decode_u64<Num: RetNumber>(raw: RetReg<Num>) -> io::Result<u64> {
if raw.is_in_range(-4095..0) {
- // Safety: `raw` must be in `-4095..0`, and we just checked that raw is
+ // SAFETY: `raw` must be in `-4095..0`, and we just checked that raw is
// in that range.
return Err(unsafe { Errno(raw.decode_error_code()) });
}
@@ -236,6 +236,13 @@ pub(in crate::backend) fn decode_usize_infallible<Num: RetNumber>(raw: RetReg<Nu
raw.decode_usize()
}
+/// Return the contained `c_int` value.
+#[cfg(not(debug_assertions))]
+#[inline]
+pub(in crate::backend) fn decode_c_uint_infallible<Num: RetNumber>(raw: RetReg<Num>) -> c::c_uint {
+ raw.decode_c_uint()
+}
+
impl Errno {
/// `EACCES`
#[doc(alias = "ACCES")]
diff --git a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
index 2cc7898af..3acf9ffdb 100644
--- a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs
@@ -32,7 +32,7 @@ use linux_raw_sys::general::{
epoll_event, EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD, F_DUPFD_CLOEXEC, F_GETFD, F_SETFD,
UIO_MAXIOV,
};
-use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FIONBIO, FIONREAD, TIOCEXCL, TIOCNXCL};
+use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FICLONE, FIONBIO, FIONREAD, TIOCEXCL, TIOCNXCL};
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
use {
super::super::conv::{opt_ref, size_of},
@@ -352,6 +352,11 @@ pub(crate) fn ioctl_blkpbszget(fd: BorrowedFd) -> io::Result<u32> {
}
}
+#[inline]
+pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(FICLONE), src_fd)) }
+}
+
#[cfg(all(feature = "fs", feature = "net"))]
pub(crate) fn is_read_write(fd: BorrowedFd<'_>) -> io::Result<(bool, bool)> {
let (mut read, mut write) = crate::fs::fd::_is_file_read_write(fd)?;
diff --git a/vendor/rustix/src/backend/linux_raw/io/types.rs b/vendor/rustix/src/backend/linux_raw/io/types.rs
index 51ab61d94..cb6c6acef 100644
--- a/vendor/rustix/src/backend/linux_raw/io/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/io/types.rs
@@ -94,9 +94,10 @@ pub(crate) const STDOUT_FILENO: c::c_uint = linux_raw_sys::general::STDOUT_FILEN
pub(crate) const STDERR_FILENO: c::c_uint = linux_raw_sys::general::STDERR_FILENO;
/// A buffer type used with `vmsplice`.
-/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms and WSABUF on Windows.
-/// Unlike `IoSlice` and `IoSliceMut` it is semantically like a raw pointer,
-/// and therefore can be shared or mutated as needed.
+/// It is guaranteed to be ABI compatible with the iovec type on Unix platforms
+/// and `WSABUF` on Windows. Unlike `IoSlice` and `IoSliceMut` it is
+/// semantically like a raw pointer, and therefore can be shared or mutated as
+/// needed.
#[repr(transparent)]
pub struct IoSliceRaw<'a> {
_buf: c::iovec,
@@ -104,7 +105,7 @@ pub struct IoSliceRaw<'a> {
}
impl<'a> IoSliceRaw<'a> {
- /// Creates a new IoSlice wrapping a byte slice.
+ /// Creates a new `IoSlice` wrapping a byte slice.
pub fn from_slice(buf: &'a [u8]) -> Self {
IoSliceRaw {
_buf: c::iovec {
@@ -115,7 +116,7 @@ impl<'a> IoSliceRaw<'a> {
}
}
- /// Creates a new IoSlice wrapping a mutable byte slice.
+ /// Creates a new `IoSlice` wrapping a mutable byte slice.
pub fn from_slice_mut(buf: &'a mut [u8]) -> Self {
IoSliceRaw {
_buf: c::iovec {
diff --git a/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
index 196676985..16655fe77 100644
--- a/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/io_uring/syscalls.rs
@@ -6,7 +6,7 @@
#![allow(unsafe_code)]
#![allow(clippy::undocumented_unsafe_blocks)]
-use super::super::conv::{by_mut, c_uint, pass_usize, ret, ret_c_uint, ret_owned_fd};
+use super::super::conv::{by_mut, c_uint, pass_usize, ret_c_uint, ret_owned_fd};
use crate::fd::{BorrowedFd, OwnedFd};
use crate::io;
use crate::io_uring::{io_uring_params, IoringEnterFlags, IoringRegisterOp};
@@ -29,8 +29,8 @@ pub(crate) unsafe fn io_uring_register(
opcode: IoringRegisterOp,
arg: *const c_void,
nr_args: u32,
-) -> io::Result<()> {
- ret(syscall_readonly!(
+) -> io::Result<u32> {
+ ret_c_uint(syscall_readonly!(
__NR_io_uring_register,
fd,
c_uint(opcode as u32),
diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs
index e7e073e32..1b91fc3ab 100644
--- a/vendor/rustix/src/backend/linux_raw/mod.rs
+++ b/vendor/rustix/src/backend/linux_raw/mod.rs
@@ -14,6 +14,11 @@
//! such as which pointers are array slices, out parameters, or in-out
//! parameters, which integers are owned or borrowed file descriptors, etc.
+// Weak symbols used by the use-libc-auxv feature for glibc 2.15 support.
+#[cfg(feature = "use-libc-auxv")]
+#[macro_use]
+mod weak;
+
#[macro_use]
mod arch;
mod conv;
diff --git a/vendor/rustix/src/backend/linux_raw/net/addr.rs b/vendor/rustix/src/backend/linux_raw/net/addr.rs
index d5683f34e..b69c6deca 100644
--- a/vendor/rustix/src/backend/linux_raw/net/addr.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/addr.rs
@@ -71,7 +71,7 @@ impl SocketAddrUnix {
if len != 0 && self.unix.sun_path[0] != b'\0' as c::c_char {
let end = len as usize - offsetof_sun_path();
let bytes = &self.unix.sun_path[..end];
- // Safety: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`. And
+ // SAFETY: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`. And
// `from_bytes_with_nul_unchecked` since the string is NUL-terminated.
unsafe {
Some(CStr::from_bytes_with_nul_unchecked(slice::from_raw_parts(
@@ -91,7 +91,7 @@ impl SocketAddrUnix {
if len != 0 && self.unix.sun_path[0] == b'\0' as c::c_char {
let end = len as usize - offsetof_sun_path();
let bytes = &self.unix.sun_path[1..end];
- // Safety: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`.
+ // SAFETY: `from_raw_parts` to convert from `&[c_char]` to `&[u8]`.
unsafe { Some(slice::from_raw_parts(bytes.as_ptr().cast(), bytes.len())) }
} else {
None
diff --git a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
index 7b9947a03..6093cd3a5 100644
--- a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs
@@ -1066,6 +1066,16 @@ pub(crate) mod sockopt {
}
#[inline]
+ pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), crate::io::Errno>> {
+ let err: c::c_int = getsockopt(fd, c::SOL_SOCKET as _, c::SO_ERROR)?;
+ Ok(if err == 0 {
+ Ok(())
+ } else {
+ Err(crate::io::Errno::from_raw_os_error(err))
+ })
+ }
+
+ #[inline]
pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> {
setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl)
}
diff --git a/vendor/rustix/src/backend/linux_raw/param/auxv.rs b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
index acdd9d0e7..741a0564f 100644
--- a/vendor/rustix/src/backend/linux_raw/param/auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/auxv.rs
@@ -77,7 +77,7 @@ pub(crate) fn linux_execfn() -> &'static CStr {
execfn = EXECFN.load(Relaxed);
}
- // Safety: We assume the `AT_EXECFN` value provided by the kernel is a
+ // SAFETY: We assume the `AT_EXECFN` value provided by the kernel is a
// valid pointer to a valid NUL-terminated array of bytes.
unsafe { CStr::from_ptr(execfn.cast()) }
}
@@ -102,7 +102,7 @@ pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
let (phdr, phnum) = exe_phdrs();
- // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
+ // SAFETY: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
// kernel form a valid slice.
unsafe { slice::from_raw_parts(phdr.cast(), phnum) }
}
@@ -177,7 +177,7 @@ fn init_from_auxv_file(auxv: OwnedFd) -> Option<()> {
buffer.resize(cur + n, 0_u8);
}
- // Safety: We loaded from an auxv file into the buffer.
+ // SAFETY: We loaded from an auxv file into the buffer.
unsafe { init_from_auxp(buffer.as_ptr().cast()) }
}
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 1597fd727..a8e291ff6 100644
--- a/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/libc_auxv.rs
@@ -5,14 +5,15 @@
//! This uses raw pointers to locate and read the kernel-provided auxv array.
#![allow(unsafe_code)]
-#[cfg(any(feature = "param", feature = "runtime"))]
-use super::super::c;
use super::super::elf::*;
#[cfg(feature = "param")]
use crate::ffi::CStr;
#[cfg(feature = "runtime")]
use core::slice;
+// `getauxval` wasn't supported in glibc until 2.16.
+weak!(fn getauxval(libc::c_ulong) -> *mut libc::c_void);
+
#[cfg(feature = "param")]
#[inline]
pub(crate) fn page_size() -> usize {
@@ -22,35 +23,39 @@ pub(crate) fn page_size() -> usize {
#[cfg(feature = "param")]
#[inline]
pub(crate) fn clock_ticks_per_second() -> u64 {
- unsafe { libc::getauxval(libc::AT_CLKTCK) as u64 }
+ unsafe { libc::sysconf(libc::_SC_CLK_TCK) as u64 }
}
#[cfg(feature = "param")]
#[inline]
pub(crate) fn linux_hwcap() -> (usize, usize) {
- unsafe {
- (
- libc::getauxval(libc::AT_HWCAP) as usize,
- libc::getauxval(libc::AT_HWCAP2) as usize,
- )
+ if let Some(libc_getauxval) = getauxval.get() {
+ unsafe {
+ let hwcap = libc_getauxval(libc::AT_HWCAP) as usize;
+ let hwcap2 = libc_getauxval(libc::AT_HWCAP2) as usize;
+ (hwcap, hwcap2)
+ }
+ } else {
+ (0, 0)
}
}
#[cfg(feature = "param")]
#[inline]
pub(crate) fn linux_execfn() -> &'static CStr {
- unsafe {
- let execfn = libc::getauxval(libc::AT_EXECFN) as *const c::c_char;
- CStr::from_ptr(execfn.cast())
+ if let Some(libc_getauxval) = getauxval.get() {
+ unsafe { CStr::from_ptr(libc_getauxval(libc::AT_EXECFN).cast()) }
+ } else {
+ cstr!("")
}
}
#[cfg(feature = "runtime")]
#[inline]
-pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
+pub(crate) fn exe_phdrs() -> (*const libc::c_void, usize) {
unsafe {
(
- libc::getauxval(libc::AT_PHDR) as *const c::c_void,
+ libc::getauxval(libc::AT_PHDR) as *const libc::c_void,
libc::getauxval(libc::AT_PHNUM) as usize,
)
}
@@ -61,7 +66,7 @@ pub(crate) fn exe_phdrs() -> (*const c::c_void, usize) {
pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
let (phdr, phnum) = exe_phdrs();
- // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
+ // SAFETY: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
// kernel form a valid slice.
unsafe { slice::from_raw_parts(phdr.cast(), phnum) }
}
@@ -70,5 +75,9 @@ pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
/// so if we don't see it, this function returns a null pointer.
#[inline]
pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
- unsafe { libc::getauxval(linux_raw_sys::general::AT_SYSINFO_EHDR.into()) as *const Elf_Ehdr }
+ if let Some(libc_getauxval) = getauxval.get() {
+ unsafe { libc_getauxval(linux_raw_sys::general::AT_SYSINFO_EHDR.into()) as *const Elf_Ehdr }
+ } else {
+ core::ptr::null()
+ }
}
diff --git a/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs b/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs
index e9b89b500..49cb1457c 100644
--- a/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs
+++ b/vendor/rustix/src/backend/linux_raw/param/mustang_auxv.rs
@@ -22,28 +22,28 @@ use linux_raw_sys::general::{
#[cfg(feature = "param")]
#[inline]
pub(crate) fn page_size() -> usize {
- // Safety: This is initialized during program startup.
+ // SAFETY: This is initialized during program startup.
unsafe { PAGE_SIZE }
}
#[cfg(feature = "param")]
#[inline]
pub(crate) fn clock_ticks_per_second() -> u64 {
- // Safety: This is initialized during program startup.
+ // SAFETY: This is initialized during program startup.
unsafe { CLOCK_TICKS_PER_SECOND as u64 }
}
#[cfg(feature = "param")]
#[inline]
pub(crate) fn linux_hwcap() -> (usize, usize) {
- // Safety: This is initialized during program startup.
+ // SAFETY: This is initialized during program startup.
unsafe { (HWCAP, HWCAP2) }
}
#[cfg(feature = "param")]
#[inline]
pub(crate) fn linux_execfn() -> &'static CStr {
- // Safety: This is initialized during program startup. And we
+ // SAFETY: This is initialized during program startup. And we
// assume it's a valid pointer to a NUL-terminated string.
unsafe { CStr::from_ptr(EXECFN.0.cast()) }
}
@@ -51,7 +51,7 @@ pub(crate) fn linux_execfn() -> &'static CStr {
#[cfg(feature = "runtime")]
#[inline]
pub(crate) fn exe_phdrs() -> (*const c_void, usize) {
- // Safety: This is initialized during program startup.
+ // SAFETY: This is initialized during program startup.
unsafe { (PHDR.0.cast(), PHNUM) }
}
@@ -60,7 +60,7 @@ pub(crate) fn exe_phdrs() -> (*const c_void, usize) {
pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
let (phdr, phnum) = exe_phdrs();
- // Safety: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
+ // SAFETY: We assume the `AT_PHDR` and `AT_PHNUM` values provided by the
// kernel form a valid slice.
unsafe { slice::from_raw_parts(phdr.cast(), phnum) }
}
@@ -69,7 +69,7 @@ pub(in super::super) fn exe_phdrs_slice() -> &'static [Elf_Phdr] {
/// so if we don't see it, this function returns a null pointer.
#[inline]
pub(in super::super) fn sysinfo_ehdr() -> *const Elf_Ehdr {
- // Safety: This is initialized during program startup.
+ // SAFETY: This is initialized during program startup.
unsafe { SYSINFO_EHDR.0 }
}
diff --git a/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs b/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs
index 10c5f478e..fc81859d8 100644
--- a/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/cpu_set.rs
@@ -1,3 +1,5 @@
+//! Rust implementation of the `CPU_*` macro API.
+
#![allow(non_snake_case)]
use super::types::RawCpuSet;
diff --git a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
index ac62e6944..f86f8e5b9 100644
--- a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs
@@ -12,12 +12,13 @@ use super::super::conv::{
ret_infallible, ret_usize, ret_usize_infallible, size_of, slice_just_addr, slice_mut, zero,
};
use super::types::{RawCpuSet, RawUname};
-use crate::fd::BorrowedFd;
+use crate::backend::conv::ret_owned_fd;
+use crate::fd::{AsRawFd, BorrowedFd, OwnedFd};
use crate::ffi::CStr;
use crate::io;
use crate::process::{
- Cpuid, Gid, MembarrierCommand, MembarrierQuery, Pid, RawNonZeroPid, RawPid, Resource, Rlimit,
- Signal, Uid, WaitOptions, WaitStatus,
+ Cpuid, Gid, MembarrierCommand, MembarrierQuery, Pid, PidfdFlags, RawNonZeroPid, RawPid,
+ Resource, Rlimit, Signal, Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions, WaitidStatus,
};
use core::convert::TryInto;
use core::mem::MaybeUninit;
@@ -27,6 +28,9 @@ use linux_raw_sys::general::{
__kernel_gid_t, __kernel_pid_t, __kernel_uid_t, membarrier_cmd, membarrier_cmd_flag, rlimit,
rlimit64, PRIO_PGRP, PRIO_PROCESS, PRIO_USER, RLIM64_INFINITY, RLIM_INFINITY,
};
+#[cfg(not(target_os = "wasi"))]
+#[cfg(feature = "fs")]
+use {super::super::conv::ret_c_uint_infallible, crate::fs::Mode};
#[inline]
pub(crate) fn chdir(filename: &CStr) -> io::Result<()> {
@@ -53,7 +57,7 @@ pub(crate) fn membarrier_query() -> MembarrierQuery {
c_uint(0)
)) {
Ok(query) => {
- // Safety: The safety of `from_bits_unchecked` is discussed
+ // SAFETY: The safety of `from_bits_unchecked` is discussed
// [here]. Our "source of truth" is Linux, and here, the
// `query` value is coming from Linux, so we know it only
// contains "source of truth" valid bits.
@@ -235,11 +239,20 @@ pub(crate) fn sched_yield() {
pub(crate) fn uname() -> RawUname {
let mut uname = MaybeUninit::<RawUname>::uninit();
unsafe {
- ret(syscall!(__NR_uname, &mut uname)).unwrap();
+ ret_infallible(syscall!(__NR_uname, &mut uname));
uname.assume_init()
}
}
+#[cfg(feature = "fs")]
+#[inline]
+pub(crate) fn umask(mode: Mode) -> Mode {
+ unsafe {
+ // TODO: Use `from_bits_retain` when we switch to bitflags 2.0.
+ Mode::from_bits_truncate(ret_c_uint_infallible(syscall_readonly!(__NR_umask, mode)))
+ }
+}
+
#[inline]
pub(crate) fn nice(inc: i32) -> io::Result<i32> {
let priority = if inc > -40 && inc < 40 {
@@ -516,6 +529,83 @@ pub(crate) fn _waitpid(
}
}
+#[inline]
+pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ // Get the id to wait on.
+ match id {
+ WaitId::All => _waitid_all(options),
+ WaitId::Pid(pid) => _waitid_pid(pid, options),
+ WaitId::PidFd(fd) => _waitid_pidfd(fd, options),
+ }
+}
+
+#[inline]
+fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ unsafe {
+ ret(syscall!(
+ __NR_waitid,
+ c_uint(c::P_ALL),
+ c_uint(0),
+ by_mut(&mut status),
+ c_int(options.bits() as _),
+ zero()
+ ))?
+ };
+
+ Ok(unsafe { cvt_waitid_status(status) })
+}
+
+#[inline]
+fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ unsafe {
+ ret(syscall!(
+ __NR_waitid,
+ c_uint(c::P_PID),
+ c_uint(Pid::as_raw(Some(pid))),
+ by_mut(&mut status),
+ c_int(options.bits() as _),
+ zero()
+ ))?
+ };
+
+ Ok(unsafe { cvt_waitid_status(status) })
+}
+
+#[inline]
+fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> {
+ let mut status = MaybeUninit::<c::siginfo_t>::uninit();
+ unsafe {
+ ret(syscall!(
+ __NR_waitid,
+ c_uint(c::P_PIDFD),
+ c_uint(fd.as_raw_fd() as _),
+ by_mut(&mut status),
+ c_int(options.bits() as _),
+ zero()
+ ))?
+ };
+
+ Ok(unsafe { cvt_waitid_status(status) })
+}
+
+/// Convert a `siginfo_t` to a `WaitidStatus`.
+///
+/// # Safety
+///
+/// The caller must ensure that `status` is initialized and that `waitid`
+/// returned successfully.
+#[inline]
+unsafe fn cvt_waitid_status(status: MaybeUninit<c::siginfo_t>) -> Option<WaitidStatus> {
+ let status = status.assume_init();
+ if status.__bindgen_anon_1.__bindgen_anon_1.si_signo == 0 {
+ None
+ } else {
+ Some(WaitidStatus(status))
+ }
+}
+
#[cfg(feature = "runtime")]
#[inline]
pub(crate) fn exit_group(code: c::c_int) -> ! {
@@ -558,3 +648,14 @@ pub(crate) unsafe fn prctl(
) -> io::Result<c::c_int> {
ret_c_int(syscall!(__NR_prctl, c_int(option), arg2, arg3, arg4, arg5))
}
+
+#[inline]
+pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> {
+ unsafe {
+ ret_owned_fd(syscall_readonly!(
+ __NR_pidfd_open,
+ pid,
+ c_int(flags.bits() as _)
+ ))
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/process/wait.rs b/vendor/rustix/src/backend/linux_raw/process/wait.rs
index 701b4ac0c..edc564a9f 100644
--- a/vendor/rustix/src/backend/linux_raw/process/wait.rs
+++ b/vendor/rustix/src/backend/linux_raw/process/wait.rs
@@ -1,7 +1,9 @@
// The functions replacing the C macros use the same names as in libc.
#![allow(non_snake_case)]
-pub(crate) use linux_raw_sys::general::{WCONTINUED, WNOHANG, WUNTRACED};
+pub(crate) use linux_raw_sys::general::{
+ WCONTINUED, WEXITED, WNOHANG, WNOWAIT, WSTOPPED, WUNTRACED,
+};
#[inline]
pub(crate) fn WIFSTOPPED(status: u32) -> bool {
diff --git a/vendor/rustix/src/backend/linux_raw/runtime/tls.rs b/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
index 43ed25d7d..8cc156a71 100644
--- a/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
+++ b/vendor/rustix/src/backend/linux_raw/runtime/tls.rs
@@ -1,3 +1,9 @@
+//! TLS utilities.
+//!
+//! # Safety
+//!
+//! This file contains code that reads the raw phdr array pointed to by the
+//! kernel-provided AUXV values.
#![allow(unsafe_code)]
use super::super::c;
@@ -18,7 +24,7 @@ pub(crate) fn startup_tls_info() -> StartupTlsInfo {
let phdrs = exe_phdrs_slice();
- // Safety: We assume the phdr array pointer and length the kernel provided
+ // SAFETY: We assume the phdr array pointer and length the kernel provided
// to the process describe a valid phdr array.
unsafe {
for phdr in phdrs {
diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
index a8dda5f81..f5643f3c3 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs
@@ -42,6 +42,30 @@ pub(crate) fn tcgetattr(fd: BorrowedFd<'_>) -> io::Result<Termios> {
}
#[inline]
+#[cfg(any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+))]
+pub(crate) fn tcgetattr2(fd: BorrowedFd<'_>) -> io::Result<crate::termios::Termios2> {
+ unsafe {
+ let mut result = MaybeUninit::<crate::termios::Termios2>::uninit();
+ ret(syscall!(
+ __NR_ioctl,
+ fd,
+ c_uint(linux_raw_sys::ioctl::TCGETS2),
+ &mut result
+ ))?;
+ Ok(result.assume_init())
+ }
+}
+
+#[inline]
pub(crate) fn tcgetpgrp(fd: BorrowedFd<'_>) -> io::Result<Pid> {
unsafe {
let mut result = MaybeUninit::<__kernel_pid_t>::uninit();
@@ -78,6 +102,32 @@ pub(crate) fn tcsetattr(
}
#[inline]
+#[cfg(any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+))]
+pub(crate) fn tcsetattr2(
+ fd: BorrowedFd,
+ optional_actions: OptionalActions,
+ termios: &crate::termios::Termios2,
+) -> io::Result<()> {
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_ioctl,
+ fd,
+ c_uint(linux_raw_sys::ioctl::TCSETS2 + optional_actions as u32),
+ by_ref(termios)
+ ))
+ }
+}
+
+#[inline]
pub(crate) fn tcsendbreak(fd: BorrowedFd) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_ioctl, fd, c_uint(TCSBRK), c_uint(0))) }
}
diff --git a/vendor/rustix/src/backend/linux_raw/termios/types.rs b/vendor/rustix/src/backend/linux_raw/termios/types.rs
index a44f1eda5..3fe45af98 100644
--- a/vendor/rustix/src/backend/linux_raw/termios/types.rs
+++ b/vendor/rustix/src/backend/linux_raw/termios/types.rs
@@ -7,13 +7,16 @@ use super::super::c;
#[repr(u32)]
pub enum OptionalActions {
/// `TCSANOW`—Make the change immediately.
+ #[doc(alias = "TCSANOW")]
Now = linux_raw_sys::general::TCSANOW,
/// `TCSADRAIN`—Make the change after all output has been transmitted.
+ #[doc(alias = "TCSADRAIN")]
Drain = linux_raw_sys::general::TCSADRAIN,
/// `TCSAFLUSH`—Discard any pending input and then make the change
/// after all output has been transmitted.
+ #[doc(alias = "TCSAFLUSH")]
Flush = linux_raw_sys::general::TCSAFLUSH,
}
@@ -24,12 +27,15 @@ pub enum OptionalActions {
#[repr(u32)]
pub enum QueueSelector {
/// `TCIFLUSH`—Flush data received but not read.
+ #[doc(alias = "TCIFLUSH")]
IFlush = linux_raw_sys::general::TCIFLUSH,
/// `TCOFLUSH`—Flush data written but not transmitted.
+ #[doc(alias = "TCOFLUSH")]
OFlush = linux_raw_sys::general::TCOFLUSH,
/// `TCIOFLUSH`—`IFlush` and `OFlush` combined.
+ #[doc(alias = "TCIOFLUSH")]
IOFlush = linux_raw_sys::general::TCIOFLUSH,
}
@@ -40,34 +46,60 @@ pub enum QueueSelector {
#[repr(u32)]
pub enum Action {
/// `TCOOFF`—Suspend output.
+ #[doc(alias = "TCOOFF")]
OOff = linux_raw_sys::general::TCOOFF,
/// `TCOON`—Restart suspended output.
+ #[doc(alias = "TCOON")]
OOn = linux_raw_sys::general::TCOON,
/// `TCIOFF`—Transmits a STOP byte.
+ #[doc(alias = "TCIOFF")]
IOff = linux_raw_sys::general::TCIOFF,
/// `TCION`—Transmits a START byte.
+ #[doc(alias = "TCION")]
IOn = linux_raw_sys::general::TCION,
}
-/// `struct termios` for use with [`tcgetattr`].
+/// `struct termios` for use with [`tcgetattr`] and [`tcsetattr`].
///
/// [`tcgetattr`]: crate::termios::tcgetattr
+/// [`tcsetattr`]: crate::termios::tcsetattr
+#[doc(alias = "termios")]
pub type Termios = linux_raw_sys::general::termios;
+/// `struct termios2` for use with [`tcgetattr2`] and [`tcsetattr2`].
+///
+/// [`tcgetattr2`]: crate::termios::tcgetattr2
+/// [`tcsetattr2`]: crate::termios::tcsetattr2
+#[cfg(any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+))]
+#[doc(alias = "termios2")]
+pub type Termios2 = linux_raw_sys::general::termios2;
+
/// `struct winsize` for use with [`tcgetwinsize`].
///
/// [`tcgetwinsize`]: crate::termios::tcgetwinsize
+#[doc(alias = "winsize")]
pub type Winsize = linux_raw_sys::general::winsize;
/// `tcflag_t`—A type for the flags fields of [`Termios`].
+#[doc(alias = "tcflag_t")]
pub type Tcflag = linux_raw_sys::general::tcflag_t;
/// `speed_t`—A return type for [`cfsetspeed`] and similar.
///
/// [`cfsetspeed`]: crate::termios::cfsetspeed
+#[doc(alias = "speed_t")]
pub type Speed = linux_raw_sys::general::speed_t;
/// `VINTR`
@@ -353,6 +385,9 @@ pub const B3500000: Speed = linux_raw_sys::general::B3500000;
#[cfg(not(any(target_arch = "sparc", target_arch = "sparc64")))]
pub const B4000000: Speed = linux_raw_sys::general::B4000000;
+/// `BOTHER`
+pub const BOTHER: c::c_uint = linux_raw_sys::general::BOTHER;
+
/// `CSIZE`
pub const CSIZE: c::c_uint = linux_raw_sys::general::CSIZE;
diff --git a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
index 2ec3e43e8..af2c9ee8a 100644
--- a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs
@@ -294,3 +294,65 @@ pub(crate) fn setns(fd: BorrowedFd, nstype: c::c_int) -> io::Result<c::c_int> {
pub(crate) fn unshare(flags: crate::thread::UnshareFlags) -> io::Result<()> {
unsafe { ret(syscall_readonly!(__NR_unshare, c_uint(flags.bits()))) }
}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn capget(
+ header: &mut linux_raw_sys::general::__user_cap_header_struct,
+ data: &mut [MaybeUninit<linux_raw_sys::general::__user_cap_data_struct>],
+) -> io::Result<()> {
+ let header: *mut _ = header;
+ unsafe { ret(syscall!(__NR_capget, header, data.as_mut_ptr())) }
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub(crate) fn capset(
+ header: &mut linux_raw_sys::general::__user_cap_header_struct,
+ data: &[linux_raw_sys::general::__user_cap_data_struct],
+) -> io::Result<()> {
+ let header: *mut _ = header;
+ unsafe { ret(syscall!(__NR_capset, header, data.as_ptr())) }
+}
+
+#[inline]
+pub(crate) fn setuid_thread(uid: crate::process::Uid) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_setuid, uid)) }
+}
+
+#[inline]
+pub(crate) fn setresuid_thread(
+ ruid: crate::process::Uid,
+ euid: crate::process::Uid,
+ suid: crate::process::Uid,
+) -> io::Result<()> {
+ #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc"))]
+ unsafe {
+ ret(syscall_readonly!(__NR_setresuid32, ruid, euid, suid))
+ }
+ #[cfg(not(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc")))]
+ unsafe {
+ ret(syscall_readonly!(__NR_setresuid, ruid, euid, suid))
+ }
+}
+
+#[inline]
+pub(crate) fn setgid_thread(gid: crate::process::Gid) -> io::Result<()> {
+ unsafe { ret(syscall_readonly!(__NR_setgid, gid)) }
+}
+
+#[inline]
+pub(crate) fn setresgid_thread(
+ rgid: crate::process::Gid,
+ egid: crate::process::Gid,
+ sgid: crate::process::Gid,
+) -> io::Result<()> {
+ #[cfg(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc"))]
+ unsafe {
+ ret(syscall_readonly!(__NR_setresgid32, rgid, egid, sgid))
+ }
+ #[cfg(not(any(target_arch = "x86", target_arch = "arm", target_arch = "sparc")))]
+ unsafe {
+ ret(syscall_readonly!(__NR_setresgid, rgid, egid, sgid))
+ }
+}
diff --git a/vendor/rustix/src/backend/linux_raw/time/syscalls.rs b/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
index 6e73a921b..c039393ef 100644
--- a/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
+++ b/vendor/rustix/src/backend/linux_raw/time/syscalls.rs
@@ -67,6 +67,47 @@ unsafe fn clock_getres_old(which_clock: ClockId, result: &mut MaybeUninit<__kern
#[cfg(feature = "time")]
#[inline]
+pub(crate) fn clock_settime(which_clock: ClockId, timespec: __kernel_timespec) -> io::Result<()> {
+ #[cfg(target_pointer_width = "32")]
+ unsafe {
+ match ret(syscall_readonly!(
+ __NR_clock_settime64,
+ which_clock,
+ by_ref(&timespec)
+ )) {
+ Err(io::Errno::NOSYS) => clock_settime_old(which_clock, timespec),
+ otherwise => otherwise,
+ }
+ }
+ #[cfg(target_pointer_width = "64")]
+ unsafe {
+ ret(syscall_readonly!(
+ __NR_clock_settime,
+ which_clock,
+ by_ref(&timespec)
+ ))
+ }
+}
+
+#[cfg(feature = "time")]
+#[cfg(target_pointer_width = "32")]
+unsafe fn clock_settime_old(which_clock: ClockId, timespec: __kernel_timespec) -> io::Result<()> {
+ let old_timespec = __kernel_old_timespec {
+ tv_sec: timespec
+ .tv_sec
+ .try_into()
+ .map_err(|_| io::Errno::OVERFLOW)?,
+ tv_nsec: timespec.tv_nsec as _,
+ };
+ ret(syscall_readonly!(
+ __NR_clock_settime,
+ which_clock,
+ by_ref(&old_timespec)
+ ))
+}
+
+#[cfg(feature = "time")]
+#[inline]
pub(crate) fn timerfd_create(clockid: TimerfdClockId, flags: TimerfdFlags) -> io::Result<OwnedFd> {
unsafe { ret_owned_fd(syscall!(__NR_timerfd_create, clockid, flags)) }
}
diff --git a/vendor/rustix/src/backend/linux_raw/vdso.rs b/vendor/rustix/src/backend/linux_raw/vdso.rs
index da7910b88..480378b50 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso.rs
@@ -55,7 +55,7 @@ fn elf_hash(name: &CStr) -> u32 {
/// Create a `Vdso` value by parsing the vDSO at the `sysinfo_ehdr` address.
fn init_from_sysinfo_ehdr() -> Option<Vdso> {
- // Safety: the auxv initialization code does extensive checks to ensure
+ // SAFETY: the auxv initialization code does extensive checks to ensure
// that the value we get really is an `AT_SYSINFO_EHDR` value from the
// kernel.
unsafe {
@@ -255,7 +255,7 @@ impl Vdso {
let ver_hash = elf_hash(version);
let name_hash = elf_hash(name);
- // Safety: The pointers in `self` must be valid.
+ // SAFETY: The pointers in `self` must be valid.
unsafe {
let mut chain = *self.bucket.add((name_hash % self.nbucket) as usize);
diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
index aaa000622..5b2e084ea 100644
--- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
+++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs
@@ -27,7 +27,7 @@ use linux_raw_sys::general::{__kernel_clockid_t, __kernel_timespec};
#[inline]
pub(crate) fn clock_gettime(which_clock: ClockId) -> __kernel_timespec {
- // Safety: `CLOCK_GETTIME` contains either null or the address of a
+ // SAFETY: `CLOCK_GETTIME` contains either null or the address of a
// function with an ABI like libc `clock_gettime`, and calling it has
// the side effect of writing to the result buffer, and no others.
unsafe {
@@ -64,7 +64,7 @@ pub(crate) fn clock_gettime_dynamic(which_clock: DynamicClockId<'_>) -> io::Resu
}
};
- // Safety: `CLOCK_GETTIME` contains either null or the address of a
+ // SAFETY: `CLOCK_GETTIME` contains either null or the address of a
// function with an ABI like libc `clock_gettime`, and calling it has
// the side effect of writing to the result buffer, and no others.
unsafe {
@@ -217,7 +217,7 @@ pub(super) type SyscallType = unsafe extern "C" fn();
/// Initialize `CLOCK_GETTIME` and return its value.
fn init_clock_gettime() -> ClockGettimeType {
init();
- // Safety: Load the function address from static storage that we
+ // SAFETY: Load the function address from static storage that we
// just initialized.
unsafe { transmute(CLOCK_GETTIME.load(Relaxed)) }
}
@@ -226,7 +226,7 @@ fn init_clock_gettime() -> ClockGettimeType {
#[cfg(target_arch = "x86")]
fn init_syscall() -> SyscallType {
init();
- // Safety: Load the function address from static storage that we
+ // SAFETY: Load the function address from static storage that we
// just initialized.
unsafe { transmute(SYSCALL.load(Relaxed)) }
}
@@ -309,7 +309,7 @@ extern "C" {
}
fn minimal_init() {
- // Safety: Store default function addresses in static storage so that if we
+ // 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.
// If the memory happens to already be initialized, this is redundant, but
// not harmful.
@@ -375,7 +375,7 @@ fn init() {
if ok {
assert!(!ptr.is_null());
- // Safety: Store the computed function addresses in static storage
+ // SAFETY: Store the computed function addresses in static storage
// so that we don't need to compute it again (but if we do, it doesn't
// hurt anything).
unsafe {
@@ -389,7 +389,7 @@ fn init() {
let ptr = vdso.sym(cstr!("LINUX_2.5"), cstr!("__kernel_vsyscall"));
assert!(!ptr.is_null());
- // Safety: As above, store the computed function addresses in
+ // SAFETY: As above, store the computed function addresses in
// static storage.
unsafe {
SYSCALL.store(ptr.cast(), Relaxed);
diff --git a/vendor/rustix/src/backend/linux_raw/weak.rs b/vendor/rustix/src/backend/linux_raw/weak.rs
new file mode 100644
index 000000000..ae7d6832e
--- /dev/null
+++ b/vendor/rustix/src/backend/linux_raw/weak.rs
@@ -0,0 +1,228 @@
+// Implementation derived from `weak` in Rust's
+// library/std/src/sys/unix/weak.rs at revision
+// fd0cb0cdc21dd9c06025277d772108f8d42cb25f.
+
+#![allow(unsafe_code)]
+
+//! Support for "weak linkage" to symbols on Unix
+//!
+//! Some I/O operations we do in libstd require newer versions of OSes but we
+//! need to maintain binary compatibility with older releases for now. In order
+//! to use the new functionality when available we use this module for
+//! detection.
+//!
+//! One option to use here is weak linkage, but that is unfortunately only
+//! really workable on Linux. Hence, use dlsym to get the symbol value at
+//! runtime. This is also done for compatibility with older versions of glibc,
+//! and to avoid creating dependencies on `GLIBC_PRIVATE` symbols. It assumes
+//! that we've been dynamically linked to the library the symbol comes from,
+//! but that is currently always the case for things like libpthread/libc.
+//!
+//! A long time ago this used weak linkage for the `__pthread_get_minstack`
+//! symbol, but that caused Debian to detect an unnecessarily strict versioned
+//! dependency on libc6 (#23628).
+
+// There are a variety of `#[cfg]`s controlling which targets are involved in
+// each instance of `weak!` and `syscall!`. Rather than trying to unify all of
+// that, we'll just allow that some unix targets don't use this module at all.
+#![allow(dead_code, unused_macros)]
+#![allow(clippy::doc_markdown)]
+
+use crate::ffi::CStr;
+use core::ffi::c_void;
+use core::ptr::null_mut;
+use core::sync::atomic::{self, AtomicPtr, Ordering};
+use core::{marker, mem};
+
+const NULL: *mut c_void = null_mut();
+const INVALID: *mut c_void = 1 as *mut c_void;
+
+macro_rules! weak {
+ ($vis:vis fn $name:ident($($t:ty),*) -> $ret:ty) => (
+ #[allow(non_upper_case_globals)]
+ $vis static $name: $crate::backend::weak::Weak<unsafe extern fn($($t),*) -> $ret> =
+ $crate::backend::weak::Weak::new(concat!(stringify!($name), '\0'));
+ )
+}
+
+pub(crate) struct Weak<F> {
+ name: &'static str,
+ addr: AtomicPtr<c_void>,
+ _marker: marker::PhantomData<F>,
+}
+
+impl<F> Weak<F> {
+ pub(crate) const fn new(name: &'static str) -> Self {
+ Self {
+ name,
+ addr: AtomicPtr::new(INVALID),
+ _marker: marker::PhantomData,
+ }
+ }
+
+ pub(crate) fn get(&self) -> Option<F> {
+ assert_eq!(mem::size_of::<F>(), mem::size_of::<usize>());
+ unsafe {
+ // Relaxed is fine here because we fence before reading through the
+ // pointer (see the comment below).
+ match self.addr.load(Ordering::Relaxed) {
+ INVALID => self.initialize(),
+ NULL => None,
+ addr => {
+ let func = mem::transmute_copy::<*mut c_void, F>(&addr);
+ // The caller is presumably going to read through this value
+ // (by calling the function we've dlsymed). This means we'd
+ // need to have loaded it with at least C11's consume
+ // ordering in order to be guaranteed that the data we read
+ // from the pointer isn't from before the pointer was
+ // stored. Rust has no equivalent to memory_order_consume,
+ // so we use an acquire fence (sorry, ARM).
+ //
+ // Now, in practice this likely isn't needed even on CPUs
+ // where relaxed and consume mean different things. The
+ // symbols we're loading are probably present (or not) at
+ // init, and even if they aren't the runtime dynamic loader
+ // is extremely likely have sufficient barriers internally
+ // (possibly implicitly, for example the ones provided by
+ // invoking `mprotect`).
+ //
+ // That said, none of that's *guaranteed*, and so we fence.
+ atomic::fence(Ordering::Acquire);
+ Some(func)
+ }
+ }
+ }
+ }
+
+ // Cold because it should only happen during first-time initialization.
+ #[cold]
+ unsafe fn initialize(&self) -> Option<F> {
+ let val = fetch(self.name);
+ // This synchronizes with the acquire fence in `get`.
+ self.addr.store(val, Ordering::Release);
+
+ match val {
+ NULL => None,
+ addr => Some(mem::transmute_copy::<*mut c_void, F>(&addr)),
+ }
+ }
+}
+
+unsafe fn fetch(name: &str) -> *mut c_void {
+ let name = match CStr::from_bytes_with_nul(name.as_bytes()) {
+ Ok(c_str) => c_str,
+ Err(..) => return null_mut(),
+ };
+ libc::dlsym(libc::RTLD_DEFAULT, name.as_ptr())
+}
+
+#[cfg(not(any(target_os = "android", target_os = "linux")))]
+macro_rules! syscall {
+ (fn $name:ident($($arg_name:ident: $t:ty),*) via $_sys_name:ident -> $ret:ty) => (
+ unsafe fn $name($($arg_name: $t),*) -> $ret {
+ weak! { fn $name($($t),*) -> $ret }
+
+ if let Some(fun) = $name.get() {
+ fun($($arg_name),*)
+ } else {
+ libc_errno::set_errno(libc_errno::Errno(libc::ENOSYS));
+ -1
+ }
+ }
+ )
+}
+
+#[cfg(any(target_os = "android", target_os = "linux"))]
+macro_rules! syscall {
+ (fn $name:ident($($arg_name:ident: $t:ty),*) via $sys_name:ident -> $ret:ty) => (
+ unsafe fn $name($($arg_name:$t),*) -> $ret {
+ // This looks like a hack, but concat_idents only accepts idents
+ // (not paths).
+ use libc::*;
+
+ trait AsSyscallArg {
+ type SyscallArgType;
+ fn into_syscall_arg(self) -> Self::SyscallArgType;
+ }
+
+ // Pass pointer types as pointers, to preserve provenance.
+ impl<T> AsSyscallArg for *mut T {
+ type SyscallArgType = *mut T;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self }
+ }
+ impl<T> AsSyscallArg for *const T {
+ type SyscallArgType = *const T;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self }
+ }
+
+ // Pass `BorrowedFd` values as the integer value.
+ impl AsSyscallArg for $crate::fd::BorrowedFd<'_> {
+ type SyscallArgType = c::c_long;
+ fn into_syscall_arg(self) -> Self::SyscallArgType {
+ $crate::fd::AsRawFd::as_raw_fd(&self) as _
+ }
+ }
+
+ // Coerce integer values into `c_long`.
+ impl AsSyscallArg for i32 {
+ type SyscallArgType = c::c_long;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ }
+ impl AsSyscallArg for u32 {
+ type SyscallArgType = c::c_long;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ }
+ impl AsSyscallArg for usize {
+ type SyscallArgType = c::c_long;
+ fn into_syscall_arg(self) -> Self::SyscallArgType { self as _ }
+ }
+
+ // `concat_idents is unstable, so we take an extra `sys_name`
+ // parameter and have our users do the concat for us for now.
+ /*
+ syscall(
+ concat_idents!(SYS_, $name),
+ $($arg_name.into_syscall_arg()),*
+ ) as $ret
+ */
+
+ syscall($sys_name, $($arg_name.into_syscall_arg()),*) as $ret
+ }
+ )
+}
+
+macro_rules! weakcall {
+ ($vis:vis fn $name:ident($($arg_name:ident: $t:ty),*) -> $ret:ty) => (
+ $vis unsafe fn $name($($arg_name: $t),*) -> $ret {
+ weak! { fn $name($($t),*) -> $ret }
+
+ // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
+ // interposition, but if it's not found just fail.
+ if let Some(fun) = $name.get() {
+ fun($($arg_name),*)
+ } else {
+ libc_errno::set_errno(libc_errno::Errno(libc::ENOSYS));
+ -1
+ }
+ }
+ )
+}
+
+/// A combination of `weakcall` and `syscall`. Use the libc function if it's
+/// available, and fall back to `libc::syscall` otherwise.
+macro_rules! weak_or_syscall {
+ ($vis:vis fn $name:ident($($arg_name:ident: $t:ty),*) via $sys_name:ident -> $ret:ty) => (
+ $vis unsafe fn $name($($arg_name: $t),*) -> $ret {
+ weak! { fn $name($($t),*) -> $ret }
+
+ // Use a weak symbol from libc when possible, allowing `LD_PRELOAD`
+ // interposition, but if it's not found just fail.
+ if let Some(fun) = $name.get() {
+ fun($($arg_name),*)
+ } else {
+ syscall! { fn $name($($arg_name: $t),*) via $sys_name -> $ret }
+ $name($($arg_name),*)
+ }
+ }
+ )
+}
diff --git a/vendor/rustix/src/cstr.rs b/vendor/rustix/src/cstr.rs
index 5e3364380..01dbe7e2f 100644
--- a/vendor/rustix/src/cstr.rs
+++ b/vendor/rustix/src/cstr.rs
@@ -9,7 +9,7 @@
///
/// # Examples
///
-/// ```rust,no_run
+/// ```no_run
/// # #[cfg(feature = "fs")]
/// # fn main() -> rustix::io::Result<()> {
/// use rustix::cstr;
@@ -44,7 +44,7 @@ macro_rules! cstr {
// `from_bytes_with_nul_unchecked`, which as of this writing is defined
// as `#[inline]` and completely optimizes away.
//
- // Safety: We have manually checked that the string does not contain
+ // SAFETY: We have manually checked that the string does not contain
// embedded NULs above, and we append or own NUL terminator here.
unsafe {
$crate::ffi::CStr::from_bytes_with_nul_unchecked(concat!($str, "\0").as_bytes())
diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs
index a0d6cdecb..cffcf709b 100644
--- a/vendor/rustix/src/fs/abs.rs
+++ b/vendor/rustix/src/fs/abs.rs
@@ -1,21 +1,14 @@
//! POSIX-style filesystem functions which operate on bare paths.
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
use crate::fs::StatFs;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
use {
crate::fs::StatVfs,
crate::{backend, io, path},
@@ -31,11 +24,10 @@ use {
///
/// [Linux]: https://man7.org/linux/man-pages/man2/statfs.2.html
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[inline]
@@ -56,13 +48,7 @@ pub fn statfs<P: path::Arg>(path: P) -> io::Result<StatFs> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/statvfs.html
/// [Linux]: https://man7.org/linux/man-pages/man2/statvfs.2.html
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub fn statvfs<P: path::Arg>(path: P) -> io::Result<StatVfs> {
path.into_with_c_str(backend::fs::syscalls::statvfs)
diff --git a/vendor/rustix/src/fs/at.rs b/vendor/rustix/src/fs/at.rs
index 925a0aa01..42bc5f807 100644
--- a/vendor/rustix/src/fs/at.rs
+++ b/vendor/rustix/src/fs/at.rs
@@ -7,11 +7,11 @@
use crate::fd::OwnedFd;
use crate::ffi::{CStr, CString};
-#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
+#[cfg(not(solarish))]
use crate::fs::Access;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
use crate::fs::CloneFlags;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(apple, target_os = "wasi")))]
use crate::fs::FileType;
#[cfg(any(target_os = "android", target_os = "linux"))]
use crate::fs::RenameFlags;
@@ -30,13 +30,13 @@ pub use backend::fs::types::{Dev, RawMode};
///
/// [`utimensat`]: crate::fs::utimensat
#[cfg(not(target_os = "redox"))]
-pub const UTIME_NOW: Nsecs = backend::fs::types::UTIME_NOW as Nsecs;
+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"))]
-pub const UTIME_OMIT: Nsecs = backend::fs::types::UTIME_OMIT as Nsecs;
+pub const UTIME_OMIT: Nsecs = backend::c::UTIME_OMIT as Nsecs;
/// `openat(dirfd, path, oflags, mode)`—Opens a file.
///
@@ -222,7 +222,7 @@ pub fn renameat_with<P: path::Arg, Q: path::Arg, PFd: AsFd, QFd: AsFd>(
})
}
-/// `symlinkat(old_dirfd, old_path, new_dirfd, new_path)`—Creates a symlink.
+/// `symlinkat(old_path, new_dirfd, new_path)`—Creates a symlink.
///
/// # References
/// - [POSIX]
@@ -271,7 +271,7 @@ pub fn statat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, flags: AtFlags) -> io:
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/faccessat.2.html
-#[cfg(not(any(target_os = "illumos", target_os = "solaris")))]
+#[cfg(not(solarish))]
#[inline]
#[doc(alias = "faccessat")]
pub fn accessat<P: path::Arg, Fd: AsFd>(
@@ -303,11 +303,7 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>(
/// `fchmodat(dirfd, path, mode, 0)`—Sets file or directory permissions.
///
-/// The flags argument is fixed to 0, so `AT_SYMLINK_NOFOLLOW` is not
-/// supported. <details>Platform support for this flag varies widely.</details>
-///
-/// This implementation does not support `O_PATH` file descriptors, even on
-/// platforms where the host libc emulates it.
+/// See `fchmodat_with` for a version that does take flags.
///
/// # References
/// - [POSIX]
@@ -319,7 +315,31 @@ pub fn utimensat<P: path::Arg, Fd: AsFd>(
#[inline]
#[doc(alias = "fchmodat")]
pub fn chmodat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Result<()> {
- path.into_with_c_str(|path| backend::fs::syscalls::chmodat(dirfd.as_fd(), path, mode))
+ chmodat_with(dirfd, path, mode, AtFlags::empty())
+}
+
+/// `fchmodat(dirfd, path, mode, flags)`—Sets file or directory permissions.
+///
+/// Platform support for flags varies widely, for example on Linux
+/// [`AtFlags::SYMLINK_NOFOLLOW`] is not implemented and therefore
+/// [`io::Errno::OPNOTSUPP`] will be returned.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [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"))]
+#[inline]
+#[doc(alias = "fchmodat_with")]
+pub fn chmodat_with<P: path::Arg, Fd: AsFd>(
+ dirfd: Fd,
+ path: P,
+ mode: Mode,
+ flags: AtFlags,
+) -> io::Result<()> {
+ path.into_with_c_str(|path| backend::fs::syscalls::chmodat(dirfd.as_fd(), path, mode, flags))
}
/// `fclonefileat(src, dst_dir, dst, flags)`—Efficiently copies between files.
@@ -328,7 +348,7 @@ pub fn chmodat<P: path::Arg, Fd: AsFd>(dirfd: Fd, path: P, mode: Mode) -> io::Re
/// - [Apple]
///
/// [Apple]: https://opensource.apple.com/source/xnu/xnu-3789.21.4/bsd/man/man2/clonefile.2.auto.html
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
#[inline]
pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>(
src: Fd,
@@ -349,7 +369,7 @@ pub fn fclonefileat<Fd: AsFd, DstFd: AsFd, P: path::Arg>(
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknodat.html
/// [Linux]: https://man7.org/linux/man-pages/man2/mknodat.2.html
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
+#[cfg(not(any(apple, target_os = "wasi")))]
#[inline]
pub fn mknodat<P: path::Arg, Fd: AsFd>(
dirfd: Fd,
@@ -374,6 +394,7 @@ pub fn mknodat<P: path::Arg, Fd: AsFd>(
/// [Linux]: https://man7.org/linux/man-pages/man2/fchownat.2.html
#[cfg(not(target_os = "wasi"))]
#[inline]
+#[doc(alias = "fchownat")]
pub fn chownat<P: path::Arg, Fd: AsFd>(
dirfd: Fd,
path: P,
diff --git a/vendor/rustix/src/fs/constants.rs b/vendor/rustix/src/fs/constants.rs
index 11b53fd2a..c8e261e66 100644
--- a/vendor/rustix/src/fs/constants.rs
+++ b/vendor/rustix/src/fs/constants.rs
@@ -8,11 +8,11 @@ pub use backend::fs::types::{Access, Mode, OFlags};
#[cfg(not(target_os = "redox"))]
pub use backend::fs::types::AtFlags;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub use backend::fs::types::{CloneFlags, CopyfileFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use backend::fs::types::{RenameFlags, ResolveFlags};
+pub use backend::fs::types::*;
#[cfg(not(target_os = "redox"))]
pub use backend::fs::types::Dev;
diff --git a/vendor/rustix/src/fs/copy_file_range.rs b/vendor/rustix/src/fs/copy_file_range.rs
index 4b118b30e..b927d572b 100644
--- a/vendor/rustix/src/fs/copy_file_range.rs
+++ b/vendor/rustix/src/fs/copy_file_range.rs
@@ -14,7 +14,7 @@ pub fn copy_file_range<InFd: AsFd, OutFd: AsFd>(
off_in: Option<&mut u64>,
fd_out: OutFd,
off_out: Option<&mut u64>,
- len: u64,
-) -> io::Result<u64> {
+ len: usize,
+) -> io::Result<usize> {
backend::fs::syscalls::copy_file_range(fd_in.as_fd(), off_in, fd_out.as_fd(), off_out, len)
}
diff --git a/vendor/rustix/src/fs/cwd.rs b/vendor/rustix/src/fs/cwd.rs
index d0455cd6c..0abd75df6 100644
--- a/vendor/rustix/src/fs/cwd.rs
+++ b/vendor/rustix/src/fs/cwd.rs
@@ -26,7 +26,7 @@ use backend::fd::{BorrowedFd, RawFd};
pub const fn cwd() -> BorrowedFd<'static> {
let at_fdcwd = backend::io::types::AT_FDCWD as RawFd;
- // Safety: `AT_FDCWD` is a reserved value that is never dynamically
+ // SAFETY: `AT_FDCWD` is a reserved value that is never dynamically
// allocated, so it'll remain valid for the duration of `'static`.
unsafe { BorrowedFd::<'static>::borrow_raw(at_fdcwd) }
}
diff --git a/vendor/rustix/src/fs/dir.rs b/vendor/rustix/src/fs/dir.rs
index 94bc0a3ee..b3e1e3b99 100644
--- a/vendor/rustix/src/fs/dir.rs
+++ b/vendor/rustix/src/fs/dir.rs
@@ -1,4 +1,4 @@
-//! `Dir` and `Entry`.
+//! `Dir` and `DirEntry`.
use crate::backend;
diff --git a/vendor/rustix/src/fs/fcntl.rs b/vendor/rustix/src/fs/fcntl.rs
index 80ac858c0..0f557ef7f 100644
--- a/vendor/rustix/src/fs/fcntl.rs
+++ b/vendor/rustix/src/fs/fcntl.rs
@@ -3,6 +3,13 @@
//! a type-safe API, rustix makes them all separate functions so that they
//! can have dedicated static type signatures.
+#[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
+use crate::fs::FlockOperation;
use crate::{backend, io};
use backend::fd::AsFd;
use backend::fs::types::OFlags;
@@ -85,3 +92,32 @@ pub use backend::fs::types::SealFlags;
pub fn fcntl_add_seals<Fd: AsFd>(fd: Fd, seals: SealFlags) -> io::Result<()> {
backend::fs::syscalls::fcntl_add_seals(fd.as_fd(), seals)
}
+
+/// `fcntl(fd, F_SETLK)`—Acquire or release an `fcntl`-style lock.
+///
+/// This function doesn't currently have an offset or len; it currently always
+/// sets the `l_len` field to 0, which is a special case that means the entire
+/// file should be locked.
+///
+/// Unlike `flock`-style locks, `fcntl`-style locks are process-associated,
+/// meaning that they don't guard against being acquired by two threads in
+/// the same process.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html
+#[cfg(not(any(
+ target_os = "emscripten",
+ target_os = "fuchsia",
+ target_os = "redox",
+ target_os = "wasi"
+)))]
+#[inline]
+#[doc(alias = "F_SETLK")]
+#[doc(alias = "F_SETLKW")]
+pub fn fcntl_lock<Fd: AsFd>(fd: Fd, operation: FlockOperation) -> io::Result<()> {
+ backend::fs::syscalls::fcntl_lock(fd.as_fd(), operation)
+}
diff --git a/vendor/rustix/src/fs/fcntl_darwin.rs b/vendor/rustix/src/fs/fcntl_apple.rs
index 6d624ee47..6d624ee47 100644
--- a/vendor/rustix/src/fs/fcntl_darwin.rs
+++ b/vendor/rustix/src/fs/fcntl_apple.rs
diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs
index 6bea89547..6ce8410b2 100644
--- a/vendor/rustix/src/fs/fd.rs
+++ b/vendor/rustix/src/fs/fd.rs
@@ -8,39 +8,30 @@ use crate::process::{Gid, Uid};
use crate::{backend, io};
use backend::fd::{AsFd, BorrowedFd};
-#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
+#[cfg(not(target_os = "wasi"))]
pub use backend::fs::types::FlockOperation;
#[cfg(not(any(
+ netbsdlike,
+ solarish,
target_os = "aix",
target_os = "dragonfly",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub use backend::fs::types::FallocateFlags;
pub use backend::fs::types::Stat;
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
pub use backend::fs::types::StatFs;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
pub use backend::fs::types::{StatVfs, StatVfsMountFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -68,7 +59,7 @@ pub struct Timestamps {
///
/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub const PROC_SUPER_MAGIC: FsWord = backend::fs::types::PROC_SUPER_MAGIC;
+pub const PROC_SUPER_MAGIC: FsWord = backend::c::PROC_SUPER_MAGIC as FsWord;
/// The filesystem magic number for NFS.
///
@@ -76,7 +67,7 @@ pub const PROC_SUPER_MAGIC: FsWord = backend::fs::types::PROC_SUPER_MAGIC;
///
/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub const NFS_SUPER_MAGIC: FsWord = backend::fs::types::NFS_SUPER_MAGIC;
+pub const NFS_SUPER_MAGIC: FsWord = backend::c::NFS_SUPER_MAGIC as FsWord;
/// `lseek(fd, offset, whence)`—Repositions a file descriptor within a file.
///
@@ -87,6 +78,7 @@ pub const NFS_SUPER_MAGIC: FsWord = backend::fs::types::NFS_SUPER_MAGIC;
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html
/// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html
#[inline]
+#[doc(alias = "lseek")]
pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> {
backend::fs::syscalls::seek(fd.as_fd(), pos)
}
@@ -104,6 +96,7 @@ pub fn seek<Fd: AsFd>(fd: Fd, pos: SeekFrom) -> io::Result<u64> {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html
/// [Linux]: https://man7.org/linux/man-pages/man2/lseek.2.html
#[inline]
+#[doc(alias = "lseek")]
pub fn tell<Fd: AsFd>(fd: Fd) -> io::Result<u64> {
backend::fs::syscalls::tell(fd.as_fd())
}
@@ -167,11 +160,10 @@ pub fn fstat<Fd: AsFd>(fd: Fd) -> io::Result<Stat> {
///
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatfs.2.html
#[cfg(not(any(
+ solarish,
target_os = "haiku",
- target_os = "illumos",
target_os = "netbsd",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
#[inline]
@@ -193,13 +185,7 @@ pub fn fstatfs<Fd: AsFd>(fd: Fd) -> io::Result<StatFs> {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatvfs.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fstatvfs.2.html
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
#[inline]
pub fn fstatvfs<Fd: AsFd>(fd: Fd) -> io::Result<StatVfs> {
backend::fs::syscalls::fstatvfs(fd.as_fd())
@@ -234,13 +220,11 @@ pub fn futimens<Fd: AsFd>(fd: Fd, times: &Timestamps) -> io::Result<()> {
/// [Linux `fallocate`]: https://man7.org/linux/man-pages/man2/fallocate.2.html
/// [Linux `posix_fallocate`]: https://man7.org/linux/man-pages/man3/posix_fallocate.3.html
#[cfg(not(any(
+ netbsdlike,
+ solarish,
target_os = "aix",
target_os = "dragonfly",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))] // not implemented in libc for netbsd yet
#[inline]
#[doc(alias = "posix_fallocate")]
@@ -311,10 +295,9 @@ pub fn fsync<Fd: AsFd>(fd: Fd) -> io::Result<()> {
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fdatasync.html
/// [Linux]: https://man7.org/linux/man-pages/man2/fdatasync.2.html
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "redox",
)))]
#[inline]
@@ -346,3 +329,15 @@ pub fn ftruncate<Fd: AsFd>(fd: Fd, length: u64) -> io::Result<()> {
pub fn flock<Fd: AsFd>(fd: Fd, operation: FlockOperation) -> io::Result<()> {
backend::fs::syscalls::flock(fd.as_fd(), operation)
}
+
+/// `syncfs(fd)`—Flush cached filesystem data.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/syncfs.2.html
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+pub fn syncfs<Fd: AsFd>(fd: Fd) -> io::Result<()> {
+ backend::fs::syscalls::syncfs(fd.as_fd())
+}
diff --git a/vendor/rustix/src/fs/makedev.rs b/vendor/rustix/src/fs/makedev.rs
index 5793058ff..36aef6d66 100644
--- a/vendor/rustix/src/fs/makedev.rs
+++ b/vendor/rustix/src/fs/makedev.rs
@@ -18,6 +18,7 @@ pub fn makedev(maj: u32, min: u32) -> Dev {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man3/minor.3.html
+#[cfg(not(bsd))]
#[inline]
pub fn minor(dev: Dev) -> u32 {
backend::fs::makedev::minor(dev)
@@ -29,6 +30,7 @@ pub fn minor(dev: Dev) -> u32 {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man3/major.3.html
+#[cfg(not(bsd))]
#[inline]
pub fn major(dev: Dev) -> u32 {
backend::fs::makedev::major(dev)
diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs
index fa7f93aec..9588cebe0 100644
--- a/vendor/rustix/src/fs/mod.rs
+++ b/vendor/rustix/src/fs/mod.rs
@@ -11,98 +11,47 @@ mod cwd;
#[cfg(not(target_os = "redox"))]
mod dir;
#[cfg(not(any(
+ apple,
+ netbsdlike,
+ solarish,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
mod fadvise;
pub(crate) mod fcntl;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-mod fcntl_darwin;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
+mod fcntl_apple;
+#[cfg(apple)]
mod fcopyfile;
pub(crate) mod fd;
mod file_type;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
mod getpath;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
mod makedev;
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
mod memfd_create;
#[cfg(any(target_os = "android", target_os = "linux"))]
+mod mount;
+#[cfg(any(target_os = "android", target_os = "linux"))]
mod openat2;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+mod raw_dir;
#[cfg(target_os = "linux")]
mod sendfile;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod statx;
+// TODO: Enable `sync` for solarish when upstream is updated.
+#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))]
+mod sync;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use abs::statfs;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use abs::statvfs;
-#[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "solaris")))]
-pub use at::accessat;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use at::fclonefileat;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use at::mknodat;
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use at::renameat_with;
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-pub use at::{chmodat, chownat};
+pub use crate::backend::fs::inotify;
+pub use abs::*;
#[cfg(not(target_os = "redox"))]
-pub use at::{
- linkat, mkdirat, openat, readlinkat, renameat, statat, symlinkat, unlinkat, utimensat, RawMode,
- UTIME_NOW, UTIME_OMIT,
-};
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use constants::CloneFlags;
-/// `copyfile_flags_t`
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use constants::CopyfileFlags;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use constants::RenameFlags;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use constants::ResolveFlags;
-pub use constants::{Access, FdFlags, Mode, Nsecs, OFlags, Secs, Timespec};
-#[cfg(not(target_os = "redox"))]
-pub use constants::{AtFlags, Dev};
+pub use at::*;
+pub use constants::*;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use copy_file_range::copy_file_range;
#[cfg(not(target_os = "redox"))]
@@ -110,101 +59,39 @@ pub use cwd::cwd;
#[cfg(not(target_os = "redox"))]
pub use dir::{Dir, DirEntry};
#[cfg(not(any(
+ apple,
+ solarish,
+ netbsdlike,
target_os = "dragonfly",
target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "redox",
- target_os = "solaris",
)))]
pub use fadvise::{fadvise, Advice};
-#[cfg(not(target_os = "wasi"))]
-pub use fcntl::fcntl_dupfd_cloexec;
-#[cfg(any(
- target_os = "android",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "linux",
-))]
-pub use fcntl::{fcntl_add_seals, fcntl_get_seals, SealFlags};
-pub use fcntl::{fcntl_getfd, fcntl_getfl, fcntl_setfd, fcntl_setfl};
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use fcntl_darwin::{fcntl_fullfsync, fcntl_rdadvise};
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use fcopyfile::{
- copyfile_state_alloc, copyfile_state_free, copyfile_state_get, copyfile_state_get_copied,
- copyfile_state_t, fcopyfile,
-};
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
-)))]
-pub use fd::fdatasync;
-#[cfg(not(any(
- target_os = "aix",
- target_os = "dragonfly",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use fd::{fallocate, FallocateFlags};
-#[cfg(not(target_os = "wasi"))]
-pub use fd::{fchmod, fchown};
-#[cfg(not(any(target_os = "solaris", target_os = "wasi")))]
-pub use fd::{flock, FlockOperation};
-pub use fd::{fstat, fsync, ftruncate, futimens, is_file_read_write, seek, tell, Stat, Timestamps};
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "netbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use fd::{fstatfs, StatFs};
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use fd::{fstatvfs, StatVfs, StatVfsMountFlags};
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use fd::{FsWord, NFS_SUPER_MAGIC, PROC_SUPER_MAGIC};
+pub use fcntl::*;
+#[cfg(apple)]
+pub use fcntl_apple::{fcntl_fullfsync, fcntl_rdadvise};
+#[cfg(apple)]
+pub use fcopyfile::*;
+pub use fd::*;
pub use file_type::FileType;
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
pub use getpath::getpath;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use makedev::{major, makedev, minor};
+#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
+pub use makedev::*;
#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))]
pub use memfd_create::{memfd_create, MemfdFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use mount::*;
+#[cfg(any(target_os = "android", target_os = "linux"))]
pub use openat2::openat2;
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use raw_dir::{RawDir, RawDirEntry};
#[cfg(target_os = "linux")]
pub use sendfile::sendfile;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use statx::{statx, Statx, StatxFlags, StatxTimestamp};
+#[cfg(not(any(solarish, target_os = "redox", target_os = "wasi")))]
+pub use sync::sync;
/// Re-export types common to POSIX-ish platforms.
#[cfg(feature = "std")]
diff --git a/vendor/rustix/src/fs/mount.rs b/vendor/rustix/src/fs/mount.rs
new file mode 100644
index 000000000..1439b1f32
--- /dev/null
+++ b/vendor/rustix/src/fs/mount.rs
@@ -0,0 +1,166 @@
+//! 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: path::Arg, Target: path::Arg, Fs: path::Arg, Data: path::Arg>(
+ 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: path::Arg, Data: path::Arg>(
+ 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: path::Arg, Target: path::Arg>(
+ 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: path::Arg, Target: path::Arg>(
+ 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: path::Arg>(
+ 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: path::Arg, Target: path::Arg>(
+ 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: path::Arg>(target: Target, flags: UnmountFlags) -> io::Result<()> {
+ target.into_with_c_str(|target| backend::fs::syscalls::unmount(target, flags))
+}
diff --git a/vendor/rustix/src/fs/raw_dir.rs b/vendor/rustix/src/fs/raw_dir.rs
new file mode 100644
index 000000000..780ff0e89
--- /dev/null
+++ b/vendor/rustix/src/fs/raw_dir.rs
@@ -0,0 +1,224 @@
+//! `RawDir` and `RawDirEntry`.
+
+use core::fmt;
+use core::mem::{align_of, MaybeUninit};
+use linux_raw_sys::general::linux_dirent64;
+
+use crate::backend::fs::syscalls::getdents_uninit;
+use crate::fd::AsFd;
+use crate::ffi::CStr;
+use crate::fs::FileType;
+use crate::io;
+
+/// A directory iterator implemented with getdents.
+///
+/// Note: This implementation does not handle growing the buffer. If this
+/// functionality is necessary, you'll need to drop the current iterator,
+/// resize the buffer, and then re-create the iterator. The iterator is
+/// guaranteed to continue where it left off provided the file descriptor isn't
+/// changed. See the example in [`RawDir::new`].
+pub struct RawDir<'buf, Fd: AsFd> {
+ fd: Fd,
+ buf: &'buf mut [MaybeUninit<u8>],
+ initialized: usize,
+ offset: usize,
+}
+
+impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
+ /// Create a new iterator from the given file descriptor and buffer.
+ ///
+ /// Note: the buffer size may be trimmed to accommodate alignment
+ /// requirements.
+ ///
+ /// # Examples
+ ///
+ /// ## Simple but non-portable
+ ///
+ /// These examples are non-portable, because file systems may not have a
+ /// maximum file name length. If you can make assumptions that bound
+ /// this length, then these examples may suffice.
+ ///
+ /// Using the heap:
+ ///
+ /// ```notrust
+ /// # // The `notrust` above can be removed when we can depend on Rust 1.60.
+ /// # use std::mem::MaybeUninit;
+ /// # use rustix::fs::{cwd, Mode, OFlags, openat, RawDir};
+ ///
+ /// let fd = openat(cwd(), ".", OFlags::RDONLY | OFlags::DIRECTORY, Mode::empty()).unwrap();
+ ///
+ /// let mut buf = Vec::with_capacity(8192);
+ /// let mut iter = RawDir::new(fd, buf.spare_capacity_mut());
+ /// while let Some(entry) = iter.next() {
+ /// let entry = entry.unwrap();
+ /// dbg!(&entry);
+ /// }
+ /// ```
+ ///
+ /// Using the stack:
+ ///
+ /// ```
+ /// # use std::mem::MaybeUninit;
+ /// # use rustix::fs::{cwd, Mode, OFlags, openat, RawDir};
+ ///
+ /// let fd = openat(
+ /// cwd(),
+ /// ".",
+ /// OFlags::RDONLY | OFlags::DIRECTORY,
+ /// Mode::empty(),
+ /// )
+ /// .unwrap();
+ ///
+ /// let mut buf = [MaybeUninit::uninit(); 2048];
+ /// let mut iter = RawDir::new(fd, &mut buf);
+ /// while let Some(entry) = iter.next() {
+ /// let entry = entry.unwrap();
+ /// dbg!(&entry);
+ /// }
+ /// ```
+ ///
+ /// ## Portable
+ ///
+ /// Heap allocated growing buffer for supporting directory entries with
+ /// arbitrarily large file names:
+ ///
+ /// ```notrust
+ /// # // The `notrust` above can be removed when we can depend on Rust 1.60.
+ /// # use std::mem::MaybeUninit;
+ /// # use rustix::fs::{cwd, Mode, OFlags, openat, RawDir};
+ /// # use rustix::io::Errno;
+ ///
+ /// let fd = openat(cwd(), ".", OFlags::RDONLY | OFlags::DIRECTORY, Mode::empty()).unwrap();
+ ///
+ /// let mut buf = Vec::with_capacity(8192);
+ /// 'read: loop {
+ /// 'resize: {
+ /// let mut iter = RawDir::new(&fd, buf.spare_capacity_mut());
+ /// while let Some(entry) = iter.next() {
+ /// let entry = match entry {
+ /// Err(Errno::INVAL) => break 'resize,
+ /// r => r.unwrap(),
+ /// };
+ /// dbg!(&entry);
+ /// }
+ /// break 'read;
+ /// }
+ ///
+ /// let new_capacity = buf.capacity() * 2;
+ /// buf.reserve(new_capacity);
+ /// }
+ /// ```
+ pub fn new(fd: Fd, buf: &'buf mut [MaybeUninit<u8>]) -> Self {
+ Self {
+ fd,
+ buf: {
+ let offset = buf.as_ptr().align_offset(align_of::<linux_dirent64>());
+ if offset < buf.len() {
+ &mut buf[offset..]
+ } else {
+ &mut []
+ }
+ },
+ initialized: 0,
+ offset: 0,
+ }
+ }
+}
+
+/// A raw directory entry, similar to `std::fs::DirEntry`.
+///
+/// Note that unlike the std version, this may represent the `.` or `..`
+/// entries.
+pub struct RawDirEntry<'a> {
+ file_name: &'a CStr,
+ file_type: u8,
+ inode_number: u64,
+ next_entry_cookie: i64,
+}
+
+impl<'a> fmt::Debug for RawDirEntry<'a> {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let mut f = f.debug_struct("RawDirEntry");
+ f.field("file_name", &self.file_name());
+ f.field("file_type", &self.file_type());
+ f.field("ino", &self.ino());
+ f.field("next_entry_cookie", &self.next_entry_cookie());
+ f.finish()
+ }
+}
+
+impl<'a> RawDirEntry<'a> {
+ /// Returns the file name of this directory entry.
+ #[inline]
+ pub fn file_name(&self) -> &CStr {
+ self.file_name
+ }
+
+ /// Returns the type of this directory entry.
+ #[inline]
+ pub fn file_type(&self) -> FileType {
+ FileType::from_dirent_d_type(self.file_type)
+ }
+
+ /// Returns the inode number of this directory entry.
+ #[inline]
+ #[doc(alias = "inode_number")]
+ pub fn ino(&self) -> u64 {
+ self.inode_number
+ }
+
+ /// Returns the seek cookie to the next directory entry.
+ #[inline]
+ #[doc(alias = "off")]
+ pub fn next_entry_cookie(&self) -> u64 {
+ self.next_entry_cookie as u64
+ }
+}
+
+impl<'buf, Fd: AsFd> RawDir<'buf, Fd> {
+ /// Identical to [Iterator::next] except that [Iterator::Item] borrows from
+ /// self.
+ ///
+ /// Note: this interface will be broken to implement a stdlib iterator API
+ /// with GAT support once one becomes available.
+ #[allow(unsafe_code)]
+ #[allow(clippy::should_implement_trait)]
+ pub fn next(&mut self) -> Option<io::Result<RawDirEntry>> {
+ if self.is_buffer_empty() {
+ match getdents_uninit(self.fd.as_fd(), self.buf) {
+ Ok(bytes_read) if bytes_read == 0 => return None,
+ Ok(bytes_read) => {
+ self.initialized = bytes_read;
+ self.offset = 0;
+ }
+ Err(e) => return Some(Err(e)),
+ }
+ }
+
+ let dirent_ptr = self.buf[self.offset..].as_ptr();
+ // SAFETY:
+ // - This data is initialized by the check above.
+ // - Assumption: the kernel will not give us partial structs.
+ // - Assumption: the kernel uses proper alignment between structs.
+ // - The starting pointer is aligned (performed in RawDir::new)
+ let dirent = unsafe { &*dirent_ptr.cast::<linux_dirent64>() };
+
+ self.offset += usize::from(dirent.d_reclen);
+
+ Some(Ok(RawDirEntry {
+ file_type: dirent.d_type,
+ inode_number: dirent.d_ino.into(),
+ next_entry_cookie: dirent.d_off.into(),
+ // SAFETY: the kernel guarantees a NUL terminated string.
+ file_name: unsafe { CStr::from_ptr(dirent.d_name.as_ptr().cast()) },
+ }))
+ }
+
+ /// Returns true if the internal buffer is empty and will be refilled when
+ /// calling [`next`].
+ ///
+ /// [`next`]: Self::next
+ pub fn is_buffer_empty(&self) -> bool {
+ self.offset >= self.initialized
+ }
+}
diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs
index 383f109ce..716c66212 100644
--- a/vendor/rustix/src/fs/statx.rs
+++ b/vendor/rustix/src/fs/statx.rs
@@ -1,13 +1,16 @@
//! Linux `statx`.
-use crate::fd::{AsFd, BorrowedFd};
-use crate::ffi::CStr;
+use crate::fd::AsFd;
use crate::fs::AtFlags;
use crate::{backend, io, path};
-use core::sync::atomic::{AtomicU8, Ordering};
pub use backend::fs::types::{Statx, StatxFlags, StatxTimestamp};
+#[cfg(feature = "linux_4_11")]
+use backend::fs::syscalls::statx as _statx;
+#[cfg(not(feature = "linux_4_11"))]
+use compat::statx as _statx;
+
/// `statx(dirfd, path, flags, mask, statxbuf)`
///
/// This function returns [`io::Errno::NOSYS`] if `statx` is not available on
@@ -29,63 +32,74 @@ pub fn statx<P: path::Arg, Fd: AsFd>(
path.into_with_c_str(|path| _statx(dirfd.as_fd(), path, flags, mask))
}
-// Linux kernel prior to 4.11 old versions of Docker don't support `statx`. We
-// store the availability in a global to avoid unnecessary syscalls.
-//
-// 0: Unknown
-// 1: Not available
-// 2: Available
-static STATX_STATE: AtomicU8 = AtomicU8::new(0);
+#[cfg(not(feature = "linux_4_11"))]
+mod compat {
+ use crate::fd::BorrowedFd;
+ use crate::ffi::CStr;
+ use crate::fs::AtFlags;
+ use crate::{backend, io};
+ use core::sync::atomic::{AtomicU8, Ordering};
-#[inline]
-fn _statx(
- dirfd: BorrowedFd<'_>,
- path: &CStr,
- flags: AtFlags,
- mask: StatxFlags,
-) -> io::Result<Statx> {
- match STATX_STATE.load(Ordering::Relaxed) {
- 0 => statx_init(dirfd, path, flags, mask),
- 1 => Err(io::Errno::NOSYS),
- _ => backend::fs::syscalls::statx(dirfd, path, flags, mask),
+ use backend::fs::types::{Statx, StatxFlags};
+
+ // Linux kernel prior to 4.11 old versions of Docker don't support `statx`. We
+ // store the availability in a global to avoid unnecessary syscalls.
+ //
+ // 0: Unknown
+ // 1: Not available
+ // 2: Available
+ static STATX_STATE: AtomicU8 = AtomicU8::new(0);
+
+ #[inline]
+ pub fn statx(
+ dirfd: BorrowedFd<'_>,
+ path: &CStr,
+ flags: AtFlags,
+ mask: StatxFlags,
+ ) -> io::Result<Statx> {
+ match STATX_STATE.load(Ordering::Relaxed) {
+ 0 => statx_init(dirfd, path, flags, mask),
+ 1 => Err(io::Errno::NOSYS),
+ _ => backend::fs::syscalls::statx(dirfd, path, flags, mask),
+ }
}
-}
-/// The first `statx` call. We don't know if `statx` is available yet.
-fn statx_init(
- dirfd: BorrowedFd<'_>,
- path: &CStr,
- flags: AtFlags,
- mask: StatxFlags,
-) -> io::Result<Statx> {
- match backend::fs::syscalls::statx(dirfd, path, flags, mask) {
- Err(io::Errno::NOSYS) => statx_error_nosys(),
- Err(io::Errno::PERM) => statx_error_perm(),
- result => {
- STATX_STATE.store(2, Ordering::Relaxed);
- result
+ /// The first `statx` call. We don't know if `statx` is available yet.
+ fn statx_init(
+ dirfd: BorrowedFd<'_>,
+ path: &CStr,
+ flags: AtFlags,
+ mask: StatxFlags,
+ ) -> io::Result<Statx> {
+ match backend::fs::syscalls::statx(dirfd, path, flags, mask) {
+ Err(io::Errno::NOSYS) => statx_error_nosys(),
+ Err(io::Errno::PERM) => statx_error_perm(),
+ result => {
+ STATX_STATE.store(2, Ordering::Relaxed);
+ result
+ }
}
}
-}
-/// The first `statx` call failed with `NOSYS` (or something we're treating
-/// like `NOSYS`).
-#[cold]
-fn statx_error_nosys() -> io::Result<Statx> {
- STATX_STATE.store(1, Ordering::Relaxed);
- Err(io::Errno::NOSYS)
-}
+ /// The first `statx` call failed with `NOSYS` (or something we're treating
+ /// like `NOSYS`).
+ #[cold]
+ fn statx_error_nosys() -> io::Result<Statx> {
+ STATX_STATE.store(1, Ordering::Relaxed);
+ Err(io::Errno::NOSYS)
+ }
-/// The first `statx` call failed with `PERM`.
-#[cold]
-fn statx_error_perm() -> io::Result<Statx> {
- // Some old versions of Docker have `statx` fail with `PERM` when it isn't
- // recognized. Check whether `statx` really is available, and if so, fail
- // with `PERM`, and if not, treat it like `NOSYS`.
- if backend::fs::syscalls::is_statx_available() {
- STATX_STATE.store(2, Ordering::Relaxed);
- Err(io::Errno::PERM)
- } else {
- statx_error_nosys()
+ /// The first `statx` call failed with `PERM`.
+ #[cold]
+ fn statx_error_perm() -> io::Result<Statx> {
+ // Some old versions of Docker have `statx` fail with `PERM` when it isn't
+ // recognized. Check whether `statx` really is available, and if so, fail
+ // with `PERM`, and if not, treat it like `NOSYS`.
+ if backend::fs::syscalls::is_statx_available() {
+ STATX_STATE.store(2, Ordering::Relaxed);
+ Err(io::Errno::PERM)
+ } else {
+ statx_error_nosys()
+ }
}
}
diff --git a/vendor/rustix/src/fs/sync.rs b/vendor/rustix/src/fs/sync.rs
new file mode 100644
index 000000000..3d2d08920
--- /dev/null
+++ b/vendor/rustix/src/fs/sync.rs
@@ -0,0 +1,14 @@
+use crate::backend;
+
+/// `sync`—Flush cached filesystem data for all filesystems.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sync.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/sync.2.html
+#[inline]
+pub fn sync() {
+ backend::fs::syscalls::sync();
+}
diff --git a/vendor/rustix/src/io/dup.rs b/vendor/rustix/src/io/dup.rs
index 8da6aa091..97a11f35c 100644
--- a/vendor/rustix/src/io/dup.rs
+++ b/vendor/rustix/src/io/dup.rs
@@ -44,6 +44,9 @@ pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> {
/// set `O_CLOEXEC`, use [`dup3`] with [`DupFlags::CLOEXEC`] on platforms which
/// support it, or [`fcntl_dupfd_cloexec`]
///
+/// For `dup2` to stdin, stdout, and stderr, see [`io::dup2_stdin`],
+/// [`io::dup2_stdout`], and [`io::dup2_stderr`].
+///
/// # References
/// - [POSIX]
/// - [Linux]
diff --git a/vendor/rustix/src/io/fd/owned.rs b/vendor/rustix/src/io/fd/owned.rs
index c2972b073..2b9238ca7 100644
--- a/vendor/rustix/src/io/fd/owned.rs
+++ b/vendor/rustix/src/io/fd/owned.rs
@@ -168,7 +168,7 @@ impl Drop for OwnedFd {
// the file descriptor was closed or not, and if we retried (for
// something like EINTR), we might close another valid file
// descriptor opened after we closed ours.
- let _ = close(self.fd as _);
+ close(self.fd as _);
}
}
}
@@ -198,7 +198,7 @@ pub trait AsFd {
///
/// # Example
///
- /// ```rust,no_run
+ /// ```no_run
/// # #![feature(io_safety)]
/// use std::fs::File;
/// # use std::io;
@@ -244,7 +244,7 @@ impl AsFd for BorrowedFd<'_> {
impl AsFd for OwnedFd {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
- // Safety: `OwnedFd` and `BorrowedFd` have the same validity
+ // SAFETY: `OwnedFd` and `BorrowedFd` have the same validity
// invariants, and the `BorrowedFd` is bounded by the lifetime
// of `&self`.
unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) }
diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs
index 01ded2e12..429b4f8db 100644
--- a/vendor/rustix/src/io/ioctl.rs
+++ b/vendor/rustix/src/io/ioctl.rs
@@ -42,7 +42,7 @@ pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> {
///
/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl.2.html
/// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-ioctlsocket
-#[cfg(any(target_os = "ios", target_os = "macos"))]
+#[cfg(apple)]
#[inline]
#[doc(alias = "FIOCLEX")]
#[doc(alias = "FD_CLOEXEC")]
@@ -97,3 +97,16 @@ pub fn ioctl_blksszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
pub fn ioctl_blkpbszget<Fd: AsFd>(fd: Fd) -> io::Result<u32> {
backend::io::syscalls::ioctl_blkpbszget(fd.as_fd())
}
+
+/// `ioctl(fd, FICLONE, src_fd)`—Share data between open files.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl_ficlone.2.html
+#[cfg(any(target_os = "android", target_os = "linux"))]
+#[inline]
+#[doc(alias = "FICLONE")]
+pub fn ioctl_ficlone<Fd: AsFd, SrcFd: AsFd>(fd: Fd, src_fd: SrcFd) -> io::Result<()> {
+ backend::io::syscalls::ioctl_ficlone(fd.as_fd(), src_fd.as_fd())
+}
diff --git a/vendor/rustix/src/io/kqueue.rs b/vendor/rustix/src/io/kqueue.rs
new file mode 100644
index 000000000..09fa0a4e2
--- /dev/null
+++ b/vendor/rustix/src/io/kqueue.rs
@@ -0,0 +1,421 @@
+//! An API for interfacing with `kqueue`.
+
+use crate::fd::{AsFd, AsRawFd, OwnedFd, RawFd};
+use crate::{backend, io};
+
+use backend::c::{self, kevent as kevent_t, uintptr_t};
+use backend::io::syscalls;
+
+#[cfg(any(apple, freebsdlike))]
+use backend::c::intptr_t;
+
+use alloc::vec::Vec;
+use core::ptr::slice_from_raw_parts_mut;
+use core::time::Duration;
+
+/// A `kqueue` event.
+#[repr(transparent)]
+#[derive(Copy, Clone)]
+pub struct Event {
+ // The layout varies between BSDs and macOS.
+ inner: kevent_t,
+}
+
+impl Event {
+ /// Create a new `Event`.
+ #[allow(clippy::needless_update)]
+ pub fn new(filter: EventFilter, flags: EventFlags, udata: isize) -> Event {
+ let (ident, filter, fflags) = match filter {
+ EventFilter::Read(fd) => (fd.as_raw_fd() as uintptr_t, c::EVFILT_READ, 0),
+ EventFilter::Write(fd) => (fd.as_raw_fd() as _, c::EVFILT_WRITE, 0),
+ #[cfg(target_os = "freebsd")]
+ EventFilter::Empty(fd) => (fd.as_raw_fd() as _, c::EVFILT_EMPTY, 0),
+ EventFilter::Vnode { vnode, flags } => {
+ (vnode.as_raw_fd() as _, c::EVFILT_VNODE, flags.bits())
+ }
+ #[cfg(feature = "process")]
+ EventFilter::Proc { pid, flags } => (
+ crate::process::Pid::as_raw(Some(pid)) as _,
+ c::EVFILT_PROC,
+ flags.bits(),
+ ),
+ #[cfg(feature = "process")]
+ EventFilter::Signal { signal, times: _ } => (signal as _, c::EVFILT_SIGNAL, 0),
+ EventFilter::Timer(timer) => {
+ #[cfg(any(apple, target_os = "freebsd", target_os = "netbsd"))]
+ let (data, fflags) = match timer {
+ Some(timer) => {
+ if timer.subsec_millis() == 0 {
+ (timer.as_secs() as _, c::NOTE_SECONDS)
+ } else if timer.subsec_nanos() == 0 {
+ (timer.as_micros() as _, c::NOTE_USECONDS)
+ } else {
+ (timer.as_nanos() as _, c::NOTE_NSECONDS)
+ }
+ }
+ None => (uintptr_t::MAX, c::NOTE_SECONDS),
+ };
+ #[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
+ let (data, fflags) = match timer {
+ Some(timer) => (timer.as_millis() as _, 0),
+ None => (uintptr_t::MAX, 0),
+ };
+
+ (data, c::EVFILT_TIMER, fflags)
+ }
+ #[cfg(any(apple, freebsdlike))]
+ EventFilter::User {
+ ident,
+ flags,
+ user_flags,
+ } => (ident as _, c::EVFILT_USER, flags.bits() | user_flags.0),
+ EventFilter::Unknown => panic!("unknown filter"),
+ };
+
+ Event {
+ inner: kevent_t {
+ ident,
+ filter: filter as _,
+ flags: flags.bits() as _,
+ fflags,
+ data: 0,
+ udata: {
+ // On netbsd, udata is an isize and not a pointer.
+ // TODO: Strict provenance, prevent int-to-ptr cast.
+ udata as _
+ },
+ ..unsafe { core::mem::zeroed() }
+ },
+ }
+ }
+
+ /// Get the event flags for this event.
+ pub fn flags(&self) -> EventFlags {
+ EventFlags::from_bits_truncate(self.inner.flags as _)
+ }
+
+ /// Get the user data for this event.
+ pub fn udata(&self) -> isize {
+ // On netbsd, udata is an isize and not a pointer.
+ // TODO: Strict provenance, prevent ptr-to-int cast.
+
+ self.inner.udata as _
+ }
+
+ /// Get the filter of this event.
+ pub fn filter(&self) -> EventFilter {
+ match self.inner.filter as _ {
+ c::EVFILT_READ => EventFilter::Read(self.inner.ident as _),
+ c::EVFILT_WRITE => EventFilter::Write(self.inner.ident as _),
+ #[cfg(target_os = "freebsd")]
+ c::EVFILT_EMPTY => EventFilter::Empty(self.inner.ident as _),
+ c::EVFILT_VNODE => EventFilter::Vnode {
+ vnode: self.inner.ident as _,
+ flags: VnodeEvents::from_bits_truncate(self.inner.fflags),
+ },
+ #[cfg(feature = "process")]
+ c::EVFILT_PROC => EventFilter::Proc {
+ pid: unsafe { crate::process::Pid::from_raw(self.inner.ident as _) }.unwrap(),
+ flags: ProcessEvents::from_bits_truncate(self.inner.fflags),
+ },
+ #[cfg(feature = "process")]
+ c::EVFILT_SIGNAL => EventFilter::Signal {
+ signal: crate::process::Signal::from_raw(self.inner.ident as _).unwrap(),
+ times: self.inner.data as _,
+ },
+ c::EVFILT_TIMER => EventFilter::Timer({
+ let (data, fflags) = (self.inner.data, self.inner.fflags);
+ #[cfg(any(apple, target_os = "freebsd", target_os = "netbsd"))]
+ match fflags as _ {
+ c::NOTE_SECONDS => Some(Duration::from_secs(data as _)),
+ c::NOTE_USECONDS => Some(Duration::from_micros(data as _)),
+ c::NOTE_NSECONDS => Some(Duration::from_nanos(data as _)),
+ _ => {
+ // Unknown timer flags.
+ None
+ }
+ }
+ #[cfg(any(target_os = "dragonfly", target_os = "openbsd"))]
+ Some(Duration::from_millis(data as _))
+ }),
+ #[cfg(any(apple, freebsdlike))]
+ c::EVFILT_USER => EventFilter::User {
+ ident: self.inner.ident as _,
+ flags: UserFlags::from_bits_truncate(self.inner.fflags),
+ user_flags: UserDefinedFlags(self.inner.fflags & EVFILT_USER_FLAGS),
+ },
+ _ => EventFilter::Unknown,
+ }
+ }
+}
+
+/// Bottom 24 bits of a u32.
+#[cfg(any(apple, freebsdlike))]
+const EVFILT_USER_FLAGS: u32 = 0x00ff_ffff;
+
+/// The possible filters for a `kqueue`.
+#[repr(i16)]
+#[non_exhaustive]
+pub enum EventFilter {
+ /// A read filter.
+ Read(RawFd),
+
+ /// A write filter.
+ Write(RawFd),
+
+ /// An empty filter.
+ #[cfg(target_os = "freebsd")]
+ Empty(RawFd),
+
+ /// A VNode filter.
+ Vnode {
+ /// The file descriptor we looked for events in.
+ vnode: RawFd,
+
+ /// The flags for this event.
+ flags: VnodeEvents,
+ },
+
+ /// A process filter.
+ #[cfg(feature = "process")]
+ Proc {
+ /// The process ID we waited on.
+ pid: crate::process::Pid,
+
+ /// The flags for this event.
+ flags: ProcessEvents,
+ },
+
+ /// A signal filter.
+ #[cfg(feature = "process")]
+ Signal {
+ /// The signal number we waited on.
+ signal: crate::process::Signal,
+
+ /// The number of times the signal has been
+ /// received since the last call to kevent.
+ times: usize,
+ },
+
+ /// A timer filter.
+ Timer(Option<Duration>),
+
+ /// A user filter.
+ #[cfg(any(apple, freebsdlike))]
+ User {
+ /// The identifier for this event.
+ ident: intptr_t,
+
+ /// The flags for this event.
+ flags: UserFlags,
+
+ /// The user-defined flags for this event.
+ user_flags: UserDefinedFlags,
+ },
+
+ /// This filter is unknown.
+ ///
+ /// # Panics
+ ///
+ /// Passing this into `Event::new()` will result in a panic.
+ Unknown,
+}
+
+bitflags::bitflags! {
+ /// The flags for a `kqueue` event.
+ pub struct EventFlags: u16 {
+ /// Add the event to the `kqueue`.
+ const ADD = c::EV_ADD as _;
+
+ /// Enable the event.
+ const ENABLE = c::EV_ENABLE as _;
+
+ /// Disable the event.
+ const DISABLE = c::EV_DISABLE as _;
+
+ /// Delete the event from the `kqueue`.
+ const DELETE = c::EV_DELETE as _;
+
+ /// TODO
+ const RECEIPT = c::EV_RECEIPT as _;
+
+ /// Clear the event after it is triggered.
+ const ONESHOT = c::EV_ONESHOT as _;
+
+ /// TODO
+ const CLEAR = c::EV_CLEAR as _;
+
+ /// TODO
+ const EOF = c::EV_EOF as _;
+
+ /// TODO
+ const ERROR = c::EV_ERROR as _;
+ }
+}
+
+bitflags::bitflags! {
+ /// The flags for a virtual node event.
+ pub struct VnodeEvents: u32 {
+ /// The file was deleted.
+ const DELETE = c::NOTE_DELETE;
+
+ /// The file was written to.
+ const WRITE = c::NOTE_WRITE;
+
+ /// The file was extended.
+ const EXTEND = c::NOTE_EXTEND;
+
+ /// The file had its attributes changed.
+ const ATTRIBUTES = c::NOTE_ATTRIB;
+
+ /// The file was renamed.
+ const RENAME = c::NOTE_RENAME;
+
+ /// Access to the file was revoked.
+ const REVOKE = c::NOTE_REVOKE;
+
+ /// The link count of the file has changed.
+ const LINK = c::NOTE_LINK;
+ }
+}
+
+#[cfg(feature = "process")]
+bitflags::bitflags! {
+ /// The flags for a process event.
+ pub struct ProcessEvents: u32 {
+ /// The process exited.
+ const EXIT = c::NOTE_EXIT;
+
+ /// The process forked itself.
+ const FORK = c::NOTE_FORK;
+
+ /// The process executed a new process.
+ const EXEC = c::NOTE_EXEC;
+
+ /// Follow the process through fork() calls (write only).
+ const TRACK = c::NOTE_TRACK;
+
+ /// An error has occurred with following the process.
+ const TRACKERR = c::NOTE_TRACKERR;
+ }
+}
+
+#[cfg(any(apple, freebsdlike))]
+bitflags::bitflags! {
+ /// The flags for a user event.
+ pub struct UserFlags: u32 {
+ /// Ignore the user input flags.
+ const NOINPUT = c::NOTE_FFNOP;
+
+ /// Bitwise AND fflags.
+ const AND = c::NOTE_FFAND;
+
+ /// Bitwise OR fflags.
+ const OR = c::NOTE_FFOR;
+
+ /// Copy fflags.
+ const COPY = c::NOTE_FFCOPY;
+
+ /// Control mask for operations.
+ const CTRLMASK = c::NOTE_FFCTRLMASK;
+
+ /// User defined flags for masks.
+ const UDFMASK = c::NOTE_FFLAGSMASK;
+
+ /// Trigger the event.
+ const TRIGGER = c::NOTE_TRIGGER;
+ }
+}
+
+/// User-defined flags.
+///
+/// Only the lower 24 bits are used in this struct.
+#[repr(transparent)]
+#[cfg(any(apple, freebsdlike))]
+#[derive(Clone, Copy, Debug, Eq, PartialEq)]
+pub struct UserDefinedFlags(u32);
+
+#[cfg(any(apple, freebsdlike))]
+impl UserDefinedFlags {
+ /// Create a new `UserDefinedFlags` from a `u32`.
+ pub fn new(flags: u32) -> Self {
+ Self(flags & EVFILT_USER_FLAGS)
+ }
+
+ /// Get the underlying `u32`.
+ pub fn get(self) -> u32 {
+ self.0
+ }
+}
+
+/// `kqueue()`—Create a new `kqueue` file descriptor.
+///
+/// # References
+/// - [Apple]
+/// - [FreeBSD]
+/// - [OpenBSD]
+/// - [NetBSD]
+/// - [DragonflyBSD]
+///
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kqueue.2.html
+/// [FreeBSD]: https://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2
+/// [OpenBSD]: https://man.openbsd.org/kqueue.2
+/// [NetBSD]: https://man.netbsd.org/kqueue.2
+/// [DragonflyBSD]: https://www.dragonflybsd.org/cgi/web-man/?command=kqueue
+pub fn kqueue() -> io::Result<OwnedFd> {
+ syscalls::kqueue()
+}
+
+/// `kevent(kqueue, changelist, eventlist, timeout)`—Wait for events on a
+/// `kqueue`.
+///
+/// Note: in order to receive events, make sure to allocate capacity in the
+/// eventlist! Otherwise, the function will return immediately.
+///
+/// # Safety
+///
+/// The file descriptors referred to by the `Event` structs must be valid for
+/// the lifetime of the `kqueue` file descriptor.
+///
+/// # References
+/// - [Apple]
+/// - [FreeBSD]
+/// - [OpenBSD]
+/// - [NetBSD]
+/// - [DragonflyBSD]
+///
+/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/kevent.2.html
+/// [FreeBSD]: https://www.freebsd.org/cgi/man.cgi?query=kevent&sektion=2
+/// [OpenBSD]: https://man.openbsd.org/kevent.2
+/// [NetBSD]: https://man.netbsd.org/kevent.2
+/// [DragonflyBSD]: https://www.dragonflybsd.org/cgi/web-man/?command=kevent
+pub unsafe fn kevent(
+ kqueue: impl AsFd,
+ changelist: &[Event],
+ eventlist: &mut Vec<Event>,
+ timeout: Option<Duration>,
+) -> io::Result<usize> {
+ let timeout = timeout.map(|timeout| crate::backend::c::timespec {
+ tv_sec: timeout.as_secs() as _,
+ tv_nsec: timeout.subsec_nanos() as _,
+ });
+
+ // Populate the event list with events.
+ eventlist.set_len(0);
+ let out_slice =
+ slice_from_raw_parts_mut(eventlist.as_mut_ptr() as *mut _, eventlist.capacity());
+ let res = syscalls::kevent(
+ kqueue.as_fd(),
+ changelist,
+ &mut *out_slice,
+ timeout.as_ref(),
+ )
+ .map(|res| res as _);
+
+ // Update the event list.
+ if let Ok(len) = res {
+ eventlist.set_len(len);
+ }
+
+ res
+}
diff --git a/vendor/rustix/src/io/mod.rs b/vendor/rustix/src/io/mod.rs
index 03f06c4ac..4e9b3e23a 100644
--- a/vendor/rustix/src/io/mod.rs
+++ b/vendor/rustix/src/io/mod.rs
@@ -13,14 +13,17 @@ pub(crate) mod fd;
mod ioctl;
#[cfg(not(any(windows, target_os = "redox")))]
mod is_read_write;
+#[cfg(bsd)]
+pub mod kqueue;
#[cfg(not(any(windows, target_os = "wasi")))]
mod pipe;
mod poll;
+#[cfg(solarish)]
+pub mod port;
#[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))]
mod procfs;
#[cfg(not(windows))]
mod read_write;
-#[cfg(not(feature = "std"))]
mod seek_from;
#[cfg(not(windows))]
mod stdio;
@@ -28,70 +31,24 @@ mod stdio;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use crate::backend::io::epoll;
pub use close::close;
-#[cfg(not(any(windows, target_os = "aix", target_os = "wasi")))]
-pub use dup::{dup, dup2, dup3, DupFlags};
+#[cfg(not(windows))]
+pub use dup::*;
pub use errno::{retry_on_intr, Errno, Result};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use eventfd::{eventfd, EventfdFlags};
-#[cfg(not(any(windows, target_os = "wasi")))]
-pub use fcntl::fcntl_dupfd_cloexec;
#[cfg(not(windows))]
-pub use fcntl::{fcntl_getfd, fcntl_setfd, FdFlags};
-#[cfg(any(target_os = "ios", target_os = "macos"))]
-pub use ioctl::ioctl_fioclex;
-pub use ioctl::ioctl_fionbio;
-#[cfg(not(target_os = "redox"))]
-pub use ioctl::ioctl_fionread;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use ioctl::{ioctl_blkpbszget, ioctl_blksszget};
-#[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))]
-pub use ioctl::{ioctl_tiocexcl, ioctl_tiocnxcl};
+pub use fcntl::*;
+pub use ioctl::*;
#[cfg(not(any(windows, target_os = "redox")))]
#[cfg(all(feature = "fs", feature = "net"))]
pub use is_read_write::is_read_write;
#[cfg(not(any(windows, target_os = "wasi")))]
-pub use pipe::pipe;
-#[cfg(not(any(
- windows,
- target_os = "haiku",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use pipe::PIPE_BUF;
-#[cfg(not(any(
- windows,
- target_os = "aix",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "wasi"
-)))]
-pub use pipe::{pipe_with, PipeFlags};
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use pipe::{splice, vmsplice, IoSliceRaw, SpliceFlags};
+pub use pipe::*;
pub use poll::{poll, PollFd, PollFlags};
#[cfg(all(feature = "procfs", any(target_os = "android", target_os = "linux")))]
-pub use procfs::{
- proc_self_fd, proc_self_fdinfo_fd, proc_self_maps, proc_self_pagemap, proc_self_status,
-};
+pub use procfs::*;
#[cfg(not(windows))]
-pub use read_write::{pread, pwrite, read, readv, write, writev, IoSlice, IoSliceMut};
-#[cfg(not(any(
- windows,
- target_os = "haiku",
- target_os = "redox",
- target_os = "solaris"
-)))]
-pub use read_write::{preadv, pwritev};
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use read_write::{preadv2, pwritev2, ReadWriteFlags};
-#[cfg(not(feature = "std"))]
+pub use read_write::*;
pub use seek_from::SeekFrom;
-#[cfg(feature = "std")]
-pub use std::io::SeekFrom;
#[cfg(not(windows))]
-pub use stdio::{
- raw_stderr, raw_stdin, raw_stdout, stderr, stdin, stdout, take_stderr, take_stdin, take_stdout,
-};
+pub use stdio::*;
diff --git a/vendor/rustix/src/io/pipe.rs b/vendor/rustix/src/io/pipe.rs
index 2b8af6a84..9d4b081c5 100644
--- a/vendor/rustix/src/io/pipe.rs
+++ b/vendor/rustix/src/io/pipe.rs
@@ -1,3 +1,9 @@
+//! `pipe` and related APIs.
+//!
+//! # Safety
+//!
+//! `vmsplice` is an unsafe function.
+
#![allow(unsafe_code)]
use crate::fd::OwnedFd;
@@ -5,7 +11,7 @@ use crate::{backend, io};
#[cfg(any(target_os = "android", target_os = "linux"))]
use backend::fd::AsFd;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
+#[cfg(not(apple))]
pub use backend::io::types::PipeFlags;
#[cfg(any(target_os = "android", target_os = "linux"))]
@@ -20,11 +26,10 @@ pub use backend::io::types::{IoSliceRaw, SpliceFlags};
/// [Linux]: https://man7.org/linux/man-pages/man7/pipe.7.html
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html
#[cfg(not(any(
+ solarish,
windows,
target_os = "haiku",
- target_os = "illumos",
target_os = "redox",
- target_os = "solaris",
target_os = "wasi",
)))]
pub const PIPE_BUF: usize = backend::io::types::PIPE_BUF;
@@ -54,22 +59,18 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/pipe2.2.html
-#[cfg(not(any(
- target_os = "aix",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos"
-)))]
+#[cfg(not(any(apple, target_os = "aix", target_os = "haiku")))]
#[inline]
#[doc(alias = "pipe2")]
pub fn pipe_with(flags: PipeFlags) -> io::Result<(OwnedFd, OwnedFd)> {
backend::io::syscalls::pipe_with(flags)
}
-/// `splice(fd_in, off_in, fd_out, off_out, len, flags)`—Transfer data between a file and a pipe.
+/// `splice(fd_in, off_in, fd_out, off_out, len, flags)`—Transfer data between
+/// a file and a pipe.
///
-/// This function transfers up to `len` bytes of data from the file descriptor `fd_in`
-/// to the file descriptor `fd_out`, where one of the file descriptors
+/// This function transfers up to `len` bytes of data from the file descriptor
+/// `fd_in` to the file descriptor `fd_out`, where one of the file descriptors
/// must refer to a pipe.
///
/// `off_*` must be `None` if the corresponding fd refers to a pipe.
@@ -107,8 +108,9 @@ pub fn splice<FdIn: AsFd, FdOut: AsFd>(
///
/// # Safety
///
-/// If the memory must not be mutated (such as when `bufs` were originally immutable slices),
-/// it is up to the caller to ensure that the write end of the pipe is placed in `fd`.
+/// If the memory must not be mutated (such as when `bufs` were originally
+/// immutable slices), it is up to the caller to ensure that the write end of
+/// the pipe is placed in `fd`.
///
/// Additionally if `SpliceFlags::GIFT` is set, the caller must also ensure
/// that the contents of `bufs` in never modified following the call,
diff --git a/vendor/rustix/src/io/port.rs b/vendor/rustix/src/io/port.rs
new file mode 100644
index 000000000..4eb0bcd9e
--- /dev/null
+++ b/vendor/rustix/src/io/port.rs
@@ -0,0 +1,151 @@
+//! Solaris/illumos event ports.
+
+use crate::backend::c;
+use crate::backend::io::syscalls;
+use crate::fd::{AsFd, AsRawFd, OwnedFd};
+use crate::io;
+
+use super::PollFlags;
+
+use core::convert::TryInto;
+use core::time::Duration;
+
+/// The structure representing a port event.
+#[repr(transparent)]
+pub struct Event(pub(crate) c::port_event);
+
+impl Event {
+ /// Get the events associated with this event.
+ pub fn events(&self) -> i32 {
+ self.0.portev_events
+ }
+
+ /// Get the event source associated with this event.
+ pub fn object(&self) -> usize {
+ self.0.portev_object
+ }
+
+ /// Get the userdata associated with this event.
+ pub fn userdata(&self) -> *mut c::c_void {
+ self.0.portev_user
+ }
+}
+
+/// `port_create()`—Creates a new port.
+///
+/// # References
+/// - [OpenSolaris]
+/// - [illumos]
+///
+/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_create/
+/// [illumos]: https://illumos.org/man/3C/port_create
+pub fn port_create() -> io::Result<OwnedFd> {
+ syscalls::port_create()
+}
+
+/// `port_associate(_, PORT_SOURCE_FD, _, _, _)`—Associates a file descriptor
+/// with a port.
+///
+/// # Safety
+///
+/// Any `object`s passed into the `port` must be valid for the lifetime of the
+/// `port`. Logically, `port` keeps a borrowed reference to the `object` until
+/// it is removed via `port_dissociate_fd`.
+///
+/// # References
+/// - [OpenSolaris]
+/// - [illumos]
+///
+/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_associate/
+/// [illumos]: https://illumos.org/man/3C/port_associate
+pub unsafe fn port_associate_fd(
+ port: impl AsFd,
+ object: impl AsRawFd,
+ events: PollFlags,
+ userdata: *mut c::c_void,
+) -> io::Result<()> {
+ syscalls::port_associate(
+ port.as_fd(),
+ c::PORT_SOURCE_FD,
+ object.as_raw_fd() as _,
+ events.bits() as _,
+ userdata.cast(),
+ )
+}
+
+/// `port_dissociate(_, PORT_SOURCE_FD, _)`—Dissociates a file descriptor from
+/// a port.
+///
+/// # Safety
+///
+/// The file descriptor passed into this function must have been previously
+/// associated with the port via [`port_associate_fd`].
+///
+/// # References
+/// - [OpenSolaris]
+/// - [illumos]
+///
+/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_dissociate
+/// [illumos]: https://illumos.org/man/3C/port_dissociate
+pub unsafe fn port_dissociate_fd(port: impl AsFd, object: impl AsRawFd) -> io::Result<()> {
+ syscalls::port_dissociate(port.as_fd(), c::PORT_SOURCE_FD, object.as_raw_fd() as _)
+}
+
+/// `port_get(port, timeout)`—Gets an event from a port.
+///
+/// # References
+/// - [OpenSolaris]
+/// - [illumos]
+///
+/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_get/
+/// [illumos]: https://illumos.org/man/3C/port_get
+pub fn port_get(port: impl AsFd, timeout: Option<Duration>) -> io::Result<Event> {
+ let mut timeout = timeout.map(|timeout| c::timespec {
+ tv_sec: timeout.as_secs().try_into().unwrap(),
+ tv_nsec: timeout.subsec_nanos() as _,
+ });
+
+ syscalls::port_get(port.as_fd(), timeout.as_mut())
+}
+
+/// `port_getn(port, events, min_events, timeout)`—Gets multiple events from a
+/// port.
+///
+/// # References
+/// - [OpenSolaris]
+/// - [illumos]
+///
+/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_getn/
+/// [illumos]: https://illumos.org/man/3C/port_getn
+pub fn port_getn(
+ port: impl AsFd,
+ events: &mut Vec<Event>,
+ min_events: usize,
+ timeout: Option<Duration>,
+) -> io::Result<()> {
+ events.clear();
+
+ let mut timeout = timeout.map(|timeout| c::timespec {
+ tv_sec: timeout.as_secs().try_into().unwrap(),
+ tv_nsec: timeout.subsec_nanos() as _,
+ });
+
+ syscalls::port_getn(
+ port.as_fd(),
+ timeout.as_mut(),
+ events,
+ min_events.try_into().unwrap(),
+ )
+}
+
+/// `port_send(port, events, userdata)`—Sends an event to a port.
+///
+/// # References
+/// - [OpenSolaris]
+/// - [illumos]
+///
+/// [OpenSolaris]: https://www.unix.com/man-page/opensolaris/3C/port_send/
+/// [illumos]: https://illumos.org/man/3C/port_send
+pub fn port_send(port: impl AsFd, events: i32, userdata: *mut c::c_void) -> io::Result<()> {
+ syscalls::port_send(port.as_fd(), events, userdata.cast())
+}
diff --git a/vendor/rustix/src/io/read_write.rs b/vendor/rustix/src/io/read_write.rs
index 1a4d37b65..d89ce7c7d 100644
--- a/vendor/rustix/src/io/read_write.rs
+++ b/vendor/rustix/src/io/read_write.rs
@@ -11,7 +11,6 @@ pub use backend::io::io_slice::{IoSlice, IoSliceMut};
#[cfg(feature = "std")]
pub use std::io::{IoSlice, IoSliceMut};
-/// `RWF_*` constants for use with [`preadv2`] and [`pwritev2`].
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use backend::io::types::ReadWriteFlags;
@@ -62,6 +61,10 @@ pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize>
/// `pwrite(fd, bufs)`—Writes to a file at a given position.
///
+/// Contrary to POSIX, on many popular platforms including Linux and FreeBSD,
+/// if the file is opened in append mode, this ignores the offset appends the
+/// data to the end of the file.
+///
/// # References
/// - [POSIX]
/// - [Linux]
@@ -121,6 +124,10 @@ pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io:
/// `pwritev(fd, bufs, offset)`—Writes to a file at a given position from
/// multiple buffers.
///
+/// Contrary to POSIX, on many popular platforms including Linux and FreeBSD,
+/// if the file is opened in append mode, this ignores the offset appends the
+/// data to the end of the file.
+///
/// # References
/// - [Linux]
///
diff --git a/vendor/rustix/src/io/seek_from.rs b/vendor/rustix/src/io/seek_from.rs
index 265369b6b..cca23ed62 100644
--- a/vendor/rustix/src/io/seek_from.rs
+++ b/vendor/rustix/src/io/seek_from.rs
@@ -5,6 +5,8 @@
/// Enumeration of possible methods to seek within an I/O object.
///
/// It is used by the [`Seek`] trait.
+///
+/// [`Seek`]: std::io::Seek
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub enum SeekFrom {
@@ -27,4 +29,20 @@ pub enum SeekFrom {
/// to seek before byte 0.
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
Current(#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))] i64),
+
+ /// Sets the offset to the current position plus the specified number of bytes,
+ /// plus the distance to the next byte which is not in a hole.
+ ///
+ /// If the offset is in a hole at the end of the file, the seek will produce
+ /// an `NXIO` error.
+ #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ Data(i64),
+
+ /// Sets the offset to the current position plus the specified number of bytes,
+ /// plus the distance to the next byte which is in a hole.
+ ///
+ /// If there is no hole past the offset, it will be set to the end of the file
+ /// i.e. there is an implicit hole at the end of any file.
+ #[cfg(any(freebsdlike, target_os = "linux", target_os = "solaris"))]
+ Hole(i64),
}
diff --git a/vendor/rustix/src/io/stdio.rs b/vendor/rustix/src/io/stdio.rs
index caa8183c2..15af6b005 100644
--- a/vendor/rustix/src/io/stdio.rs
+++ b/vendor/rustix/src/io/stdio.rs
@@ -12,23 +12,56 @@ use crate::backend;
use crate::fd::OwnedFd;
use backend::fd::{BorrowedFd, FromRawFd, RawFd};
+#[cfg(not(any(windows, target_os = "wasi")))]
+use crate::io;
+#[cfg(not(any(windows, target_os = "wasi")))]
+use backend::fd::AsFd;
+
/// `STDIN_FILENO`—Standard input, borrowed.
///
-/// # Safety
+/// In `std`-using configurations, this is a safe function, because the
+/// standard library already assumes that the stdin file descriptor is always
+/// valid. In `no_std` configurations, it is `unsafe`.
///
-/// This function must be called from code which knows how the process'
-/// standard input is being used. Often, this will be the `main` function or
-/// code that knows its relationship with the `main` function.
+/// # Warning
///
-/// The stdin file descriptor can be closed, potentially on other threads, in
-/// which case the file descriptor index value could be dynamically reused for
-/// other purposes, potentially on different threads.
+/// This function allows reading directly from stdin without coordinating
+/// with the buffering performed by [`std::io::Stdin`], so it could cause
+/// corrupted input.
///
-/// # Other hazards
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+#[cfg(feature = "std")]
+#[doc(alias = "STDIN_FILENO")]
+#[inline]
+pub const fn stdin() -> BorrowedFd<'static> {
+ // SAFETY: When "std" is enabled, the standard library assumes that the stdio
+ // file descriptors are all valid.
+ unsafe { BorrowedFd::borrow_raw(backend::io::types::STDIN_FILENO as RawFd) }
+}
+
+/// `STDIN_FILENO`—Standard input, borrowed.
+///
+/// In `std`-using configurations, this is a safe function, because the
+/// standard library already assumes that the stdin file descriptor is always
+/// valid. In `no_std` configurations, it is `unsafe`.
+///
+/// # Safety
+///
+/// In `no_std` configurations, the stdin file descriptor can be closed,
+/// potentially on other threads, in which case the file descriptor index
+/// value could be dynamically reused for other purposes, potentially on
+/// different threads.
///
-/// Stdin could be redirected from arbitrary input sources, and unless one
-/// knows how the process' standard input is being used, one could consume
-/// bytes that are expected to be consumed by other parts of the process.
+/// # Warning
+///
+/// This function allows reading directly from stdin without coordinating
+/// with the buffering performed by [`std::io::Stdin`], so it could cause
+/// corrupted input.
///
/// # References
/// - [POSIX]
@@ -36,6 +69,7 @@ use backend::fd::{BorrowedFd, FromRawFd, RawFd};
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html
+#[cfg(not(feature = "std"))]
#[doc(alias = "STDIN_FILENO")]
#[inline]
pub const unsafe fn stdin() -> BorrowedFd<'static> {
@@ -49,17 +83,14 @@ pub const unsafe fn stdin() -> BorrowedFd<'static> {
///
/// # Safety
///
-/// This is unsafe for the same reasons as [`stdin`].
+/// Safe `std`-using Rust code is permitted to assume that the stdin file
+/// descriptor is always valid. This function returns an `OwnedFd` which will
+/// close the stdin file descriptor when dropped.
///
-/// # Other hazards
+/// # Warning
///
/// This has the same hazards as [`stdin`].
///
-/// And, when the `OwnedFd` is dropped, subsequent newly created file
-/// descriptors may unknowingly reuse the stdin file descriptor number, which
-/// may break common assumptions, so it should typically only be dropped at the
-/// end of a program when no more file descriptors will be created.
-///
/// # References
/// - [POSIX]
/// - [Linux]
@@ -74,22 +105,49 @@ pub unsafe fn take_stdin() -> OwnedFd {
/// `STDOUT_FILENO`—Standard output, borrowed.
///
-/// # Safety
+/// In `std`-using configurations, this is a safe function, because the
+/// standard library already assumes that the stdout file descriptor is always
+/// valid. In `no_std` configurations, it is `unsafe`.
///
-/// This function must be called from code which knows how the process'
-/// standard output is being used. Often, this will be the `main` function or
-/// code that knows its relationship with the `main` function.
+/// # Warning
///
-/// The stdout file descriptor can be closed, potentially on other threads, in
-/// which case the file descriptor index value could be dynamically reused for
-/// other purposes, potentially on different threads.
+/// This function allows reading directly from stdout without coordinating
+/// with the buffering performed by [`std::io::Stdout`], so it could cause
+/// corrupted input.
///
-/// # Other hazards
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+#[cfg(feature = "std")]
+#[doc(alias = "STDOUT_FILENO")]
+#[inline]
+pub const fn stdout() -> BorrowedFd<'static> {
+ // SAFETY: When "std" is enabled, the standard library assumes that the stdio
+ // file descriptors are all valid.
+ unsafe { BorrowedFd::borrow_raw(backend::io::types::STDOUT_FILENO as RawFd) }
+}
+
+/// `STDOUT_FILENO`—Standard output, borrowed.
+///
+/// In `std`-using configurations, this is a safe function, because the
+/// standard library already assumes that the stdin file descriptor is always
+/// valid. In `no_std` configurations, it is `unsafe`.
+///
+/// # Safety
///
-/// Stdout could be redirected to arbitrary output sinks, and unless one
-/// knows how the process' standard output is being used, one could
-/// unexpectedly inject bytes into a stream being written by another part of
-/// the process.
+/// In `no_std` configurations, the stdout file descriptor can be closed,
+/// potentially on other threads, in which case the file descriptor index
+/// value could be dynamically reused for other purposes, potentially on
+/// different threads.
+///
+/// # Warning
+///
+/// This function allows reading directly from stdout without coordinating
+/// with the buffering performed by [`std::io::Stdout`], so it could cause
+/// corrupted input.
///
/// # References
/// - [POSIX]
@@ -97,6 +155,7 @@ pub unsafe fn take_stdin() -> OwnedFd {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html
+#[cfg(not(feature = "std"))]
#[doc(alias = "STDOUT_FILENO")]
#[inline]
pub const unsafe fn stdout() -> BorrowedFd<'static> {
@@ -110,17 +169,14 @@ pub const unsafe fn stdout() -> BorrowedFd<'static> {
///
/// # Safety
///
-/// This is unsafe for the same reasons as [`stdout`].
+/// Safe `std`-using Rust code is permitted to assume that the stdout file
+/// descriptor is always valid. This function returns an `OwnedFd` which will
+/// close the stdout file descriptor when dropped.
///
-/// # Other hazards
+/// # Warning
///
/// This has the same hazards as [`stdout`].
///
-/// And, when the `OwnedFd` is dropped, subsequent newly created file
-/// descriptors may unknowingly reuse the stdout file descriptor number, which
-/// may break common assumptions, so it should typically only be dropped at the
-/// end of a program when no more file descriptors will be created.
-///
/// # References
/// - [POSIX]
/// - [Linux]
@@ -135,21 +191,37 @@ pub unsafe fn take_stdout() -> OwnedFd {
/// `STDERR_FILENO`—Standard error, borrowed.
///
-/// # Safety
+/// In `std`-using configurations, this is a safe function, because the
+/// standard library already assumes that the stderr file descriptor is always
+/// valid. In `no_std` configurations, it is `unsafe`.
///
-/// This function must be called from code which knows how the process'
-/// standard error is being used. Often, this will be the `main` function or
-/// code that knows its relationship with the `main` function.
+/// # References
+/// - [POSIX]
+/// - [Linux]
///
-/// The stderr file descriptor can be closed, potentially on other threads, in
-/// which case the file descriptor index value could be dynamically reused for
-/// other purposes, potentially on different threads.
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
+/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+#[cfg(feature = "std")]
+#[doc(alias = "STDERR_FILENO")]
+#[inline]
+pub const fn stderr() -> BorrowedFd<'static> {
+ // SAFETY: When "std" is enabled, the standard library assumes that the stdio
+ // file descriptors are all valid.
+ unsafe { BorrowedFd::borrow_raw(backend::io::types::STDERR_FILENO as RawFd) }
+}
+
+/// `STDERR_FILENO`—Standard error, borrowed.
///
-/// # Other hazards
+/// In `std`-using configurations, this is a safe function, because the
+/// standard library already assumes that the stderr file descriptor is always
+/// valid. In `no_std` configurations, it is `unsafe`.
+///
+/// # Safety
///
-/// Stderr could be redirected to arbitrary output sinks, and unless one
-/// knows how the process' standard error is being used, one could unexpectedly
-/// inject bytes into a stream being written by another part of the process.
+/// In `no_std` configurations, the stderr file descriptor can be closed,
+/// potentially on other threads, in which case the file descriptor index
+/// value could be dynamically reused for other purposes, potentially on
+/// different threads.
///
/// # References
/// - [POSIX]
@@ -157,6 +229,7 @@ pub unsafe fn take_stdout() -> OwnedFd {
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html
/// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html
+#[cfg(not(feature = "std"))]
#[doc(alias = "STDERR_FILENO")]
#[inline]
pub const unsafe fn stderr() -> BorrowedFd<'static> {
@@ -170,7 +243,9 @@ pub const unsafe fn stderr() -> BorrowedFd<'static> {
///
/// # Safety
///
-/// This is unsafe for the same reasons as [`stderr`].
+/// Safe std-using Rust code is permitted to assume that the stderr file
+/// descriptor is always valid. This function returns an `OwnedFd` which will
+/// close the stderr file descriptor when dropped.
///
/// # Other hazards
///
@@ -252,3 +327,39 @@ pub const fn raw_stdout() -> RawFd {
pub const fn raw_stderr() -> RawFd {
backend::io::types::STDERR_FILENO as RawFd
}
+
+/// Utility function to safely `dup2` over stdin (fd 0).
+#[cfg(not(any(windows, target_os = "wasi")))]
+#[inline]
+pub fn dup2_stdin<Fd: AsFd>(fd: Fd) -> io::Result<()> {
+ // SAFETY: We pass the returned `OwnedFd` to `forget` so that it isn't
+ // dropped.
+ let mut target = unsafe { io::take_stdin() };
+ backend::io::syscalls::dup2(fd.as_fd(), &mut target)?;
+ core::mem::forget(target);
+ Ok(())
+}
+
+/// Utility function to safely `dup2` over stdout (fd 1).
+#[cfg(not(any(windows, target_os = "wasi")))]
+#[inline]
+pub fn dup2_stdout<Fd: AsFd>(fd: Fd) -> io::Result<()> {
+ // SAFETY: We pass the returned `OwnedFd` to `forget` so that it isn't
+ // dropped.
+ let mut target = unsafe { io::take_stdout() };
+ backend::io::syscalls::dup2(fd.as_fd(), &mut target)?;
+ core::mem::forget(target);
+ Ok(())
+}
+
+/// Utility function to safely `dup2` over stderr (fd 2).
+#[cfg(not(any(windows, target_os = "wasi")))]
+#[inline]
+pub fn dup2_stderr<Fd: AsFd>(fd: Fd) -> io::Result<()> {
+ // SAFETY: We pass the returned `OwnedFd` to `forget` so that it isn't
+ // dropped.
+ let mut target = unsafe { io::take_stderr() };
+ backend::io::syscalls::dup2(fd.as_fd(), &mut target)?;
+ core::mem::forget(target);
+ Ok(())
+}
diff --git a/vendor/rustix/src/io_uring.rs b/vendor/rustix/src/io_uring.rs
index 2f67107ba..0a7dc0872 100644
--- a/vendor/rustix/src/io_uring.rs
+++ b/vendor/rustix/src/io_uring.rs
@@ -14,9 +14,11 @@
//!
//! # References
//! - [Linux]
+//! - [io_uring header]
//!
//! [Linux]: https://man.archlinux.org/man/io_uring.7.en
//! [io_uring]: https://en.wikipedia.org/wiki/Io_uring
+//! [io_uring header]: https://github.com/torvalds/linux/blob/master/include/uapi/linux/io_uring.h
#![allow(unsafe_code)]
use crate::fd::{AsFd, BorrowedFd, OwnedFd, RawFd};
@@ -56,7 +58,7 @@ pub unsafe fn io_uring_register<Fd: AsFd>(
opcode: IoringRegisterOp,
arg: *const c_void,
nr_args: u32,
-) -> io::Result<()> {
+) -> io::Result<u32> {
backend::io_uring::syscalls::io_uring_register(fd.as_fd(), opcode, arg, nr_args)
}
@@ -178,6 +180,24 @@ pub enum IoringRegisterOp {
/// `IORING_REGISTER_IOWQ_MAX_WORKERS`
RegisterIowqMaxWorkers = sys::IORING_REGISTER_IOWQ_MAX_WORKERS as _,
+
+ /// `IORING_REGISTER_RING_FDS`
+ RegisterRingFds = sys::IORING_REGISTER_RING_FDS as _,
+
+ /// `IORING_UNREGISTER_RING_FDS`
+ UnregisterRingFds = sys::IORING_UNREGISTER_RING_FDS as _,
+
+ /// `IORING_REGISTER_PBUF_RING`
+ RegisterPbufRing = sys::IORING_REGISTER_PBUF_RING as _,
+
+ /// `IORING_UNREGISTER_PBUF_RING`
+ UnregisterPbufRing = sys::IORING_UNREGISTER_PBUF_RING as _,
+
+ /// `IORING_REGISTER_SYNC_CANCEL`
+ RegisterSyncCancel = sys::IORING_REGISTER_SYNC_CANCEL as _,
+
+ /// `IORING_REGISTER_FILE_ALLOC_RANGE`
+ RegisterFileAllocRange = sys::IORING_REGISTER_FILE_ALLOC_RANGE as _,
}
/// `IORING_OP_*` constants for use with [`io_uring_sqe`].
@@ -186,124 +206,151 @@ pub enum IoringRegisterOp {
#[non_exhaustive]
pub enum IoringOp {
/// `IORING_OP_NOP`
- Nop = sys::IORING_OP_NOP as _,
+ Nop = sys::io_uring_op::IORING_OP_NOP as _,
/// `IORING_OP_ACCEPT`
- Accept = sys::IORING_OP_ACCEPT as _,
+ Accept = sys::io_uring_op::IORING_OP_ACCEPT as _,
/// `IORING_OP_ASYNC_CANCEL`
- AsyncCancel = sys::IORING_OP_ASYNC_CANCEL as _,
+ AsyncCancel = sys::io_uring_op::IORING_OP_ASYNC_CANCEL as _,
/// `IORING_OP_CLOSE`
- Close = sys::IORING_OP_CLOSE as _,
+ Close = sys::io_uring_op::IORING_OP_CLOSE as _,
/// `IORING_OP_CONNECT`
- Connect = sys::IORING_OP_CONNECT as _,
+ Connect = sys::io_uring_op::IORING_OP_CONNECT as _,
/// `IORING_OP_EPOLL_CTL`
- EpollCtl = sys::IORING_OP_EPOLL_CTL as _,
+ EpollCtl = sys::io_uring_op::IORING_OP_EPOLL_CTL as _,
/// `IORING_OP_FADVISE`
- Fadvise = sys::IORING_OP_FADVISE as _,
+ Fadvise = sys::io_uring_op::IORING_OP_FADVISE as _,
/// `IORING_OP_FALLOCATE`
- Fallocate = sys::IORING_OP_FALLOCATE as _,
+ Fallocate = sys::io_uring_op::IORING_OP_FALLOCATE as _,
/// `IORING_OP_FILES_UPDATE`
- FilesUpdate = sys::IORING_OP_FILES_UPDATE as _,
+ FilesUpdate = sys::io_uring_op::IORING_OP_FILES_UPDATE as _,
/// `IORING_OP_FSYNC`
- Fsync = sys::IORING_OP_FSYNC as _,
+ Fsync = sys::io_uring_op::IORING_OP_FSYNC as _,
/// `IORING_OP_LINKAT`
- Linkat = sys::IORING_OP_LINKAT as _,
+ Linkat = sys::io_uring_op::IORING_OP_LINKAT as _,
/// `IORING_OP_LINK_TIMEOUT`
- LinkTimeout = sys::IORING_OP_LINK_TIMEOUT as _,
+ LinkTimeout = sys::io_uring_op::IORING_OP_LINK_TIMEOUT as _,
/// `IORING_OP_MADVISE`
- Madvise = sys::IORING_OP_MADVISE as _,
+ Madvise = sys::io_uring_op::IORING_OP_MADVISE as _,
/// `IORING_OP_MKDIRAT`
- Mkdirat = sys::IORING_OP_MKDIRAT as _,
+ Mkdirat = sys::io_uring_op::IORING_OP_MKDIRAT as _,
/// `IORING_OP_OPENAT`
- Openat = sys::IORING_OP_OPENAT as _,
+ Openat = sys::io_uring_op::IORING_OP_OPENAT as _,
/// `IORING_OP_OPENAT2`
- Openat2 = sys::IORING_OP_OPENAT2 as _,
+ Openat2 = sys::io_uring_op::IORING_OP_OPENAT2 as _,
/// `IORING_OP_POLL_ADD`
- PollAdd = sys::IORING_OP_POLL_ADD as _,
+ PollAdd = sys::io_uring_op::IORING_OP_POLL_ADD as _,
/// `IORING_OP_POLL_REMOVE`
- PollRemove = sys::IORING_OP_POLL_REMOVE as _,
+ PollRemove = sys::io_uring_op::IORING_OP_POLL_REMOVE as _,
/// `IORING_OP_PROVIDE_BUFFERS`
- ProvideBuffers = sys::IORING_OP_PROVIDE_BUFFERS as _,
+ ProvideBuffers = sys::io_uring_op::IORING_OP_PROVIDE_BUFFERS as _,
/// `IORING_OP_READ`
- Read = sys::IORING_OP_READ as _,
+ Read = sys::io_uring_op::IORING_OP_READ as _,
/// `IORING_OP_READV`
- Readv = sys::IORING_OP_READV as _,
+ Readv = sys::io_uring_op::IORING_OP_READV as _,
/// `IORING_OP_READ_FIXED`
- ReadFixed = sys::IORING_OP_READ_FIXED as _,
+ ReadFixed = sys::io_uring_op::IORING_OP_READ_FIXED as _,
/// `IORING_OP_RECV`
- Recv = sys::IORING_OP_RECV as _,
+ Recv = sys::io_uring_op::IORING_OP_RECV as _,
/// `IORING_OP_RECVMSG`
- Recvmsg = sys::IORING_OP_RECVMSG as _,
+ Recvmsg = sys::io_uring_op::IORING_OP_RECVMSG as _,
/// `IORING_OP_REMOVE_BUFFERS`
- RemoveBuffers = sys::IORING_OP_REMOVE_BUFFERS as _,
+ RemoveBuffers = sys::io_uring_op::IORING_OP_REMOVE_BUFFERS as _,
/// `IORING_OP_RENAMEAT`
- Renameat = sys::IORING_OP_RENAMEAT as _,
+ Renameat = sys::io_uring_op::IORING_OP_RENAMEAT as _,
/// `IORING_OP_SEND`
- Send = sys::IORING_OP_SEND as _,
+ Send = sys::io_uring_op::IORING_OP_SEND as _,
/// `IORING_OP_SENDMSG`
- Sendmsg = sys::IORING_OP_SENDMSG as _,
+ Sendmsg = sys::io_uring_op::IORING_OP_SENDMSG as _,
/// `IORING_OP_SHUTDOWN`
- Shutdown = sys::IORING_OP_SHUTDOWN as _,
+ Shutdown = sys::io_uring_op::IORING_OP_SHUTDOWN as _,
/// `IORING_OP_SPLICE`
- Splice = sys::IORING_OP_SPLICE as _,
+ Splice = sys::io_uring_op::IORING_OP_SPLICE as _,
/// `IORING_OP_STATX`
- Statx = sys::IORING_OP_STATX as _,
+ Statx = sys::io_uring_op::IORING_OP_STATX as _,
/// `IORING_OP_SYMLINKAT`
- Symlinkat = sys::IORING_OP_SYMLINKAT as _,
+ Symlinkat = sys::io_uring_op::IORING_OP_SYMLINKAT as _,
/// `IORING_OP_SYNC_FILE_RANGE`
- SyncFileRange = sys::IORING_OP_SYNC_FILE_RANGE as _,
+ SyncFileRange = sys::io_uring_op::IORING_OP_SYNC_FILE_RANGE as _,
/// `IORING_OP_TEE`
- Tee = sys::IORING_OP_TEE as _,
+ Tee = sys::io_uring_op::IORING_OP_TEE as _,
/// `IORING_OP_TIMEOUT`
- Timeout = sys::IORING_OP_TIMEOUT as _,
+ Timeout = sys::io_uring_op::IORING_OP_TIMEOUT as _,
/// `IORING_OP_TIMEOUT_REMOVE`
- TimeoutRemove = sys::IORING_OP_TIMEOUT_REMOVE as _,
+ TimeoutRemove = sys::io_uring_op::IORING_OP_TIMEOUT_REMOVE as _,
/// `IORING_OP_UNLINKAT`
- Unlinkat = sys::IORING_OP_UNLINKAT as _,
+ Unlinkat = sys::io_uring_op::IORING_OP_UNLINKAT as _,
/// `IORING_OP_WRITE`
- Write = sys::IORING_OP_WRITE as _,
+ Write = sys::io_uring_op::IORING_OP_WRITE as _,
/// `IORING_OP_WRITEV`
- Writev = sys::IORING_OP_WRITEV as _,
+ Writev = sys::io_uring_op::IORING_OP_WRITEV as _,
/// `IORING_OP_WRITE_FIXED`
- WriteFixed = sys::IORING_OP_WRITE_FIXED as _,
+ WriteFixed = sys::io_uring_op::IORING_OP_WRITE_FIXED as _,
+
+ /// `IORING_OP_MSG_RING`
+ MsgRing = sys::io_uring_op::IORING_OP_MSG_RING as _,
+
+ /// `IORING_OP_FSETXATTR`
+ Fsetxattr = sys::io_uring_op::IORING_OP_FSETXATTR as _,
+
+ /// `IORING_OP_SETXATTR`
+ Setxattr = sys::io_uring_op::IORING_OP_SETXATTR as _,
+
+ /// `IORING_OP_FGETXATTR`
+ Fgetxattr = sys::io_uring_op::IORING_OP_FGETXATTR as _,
+
+ /// `IORING_OP_GETXATTR`
+ Getxattr = sys::io_uring_op::IORING_OP_GETXATTR as _,
+
+ /// `IORING_OP_SOCKET`
+ Socket = sys::io_uring_op::IORING_OP_SOCKET as _,
+
+ /// `IORING_OP_URING_CMD`
+ UringCmd = sys::io_uring_op::IORING_OP_URING_CMD as _,
+
+ /// `IORING_OP_SEND_ZC`
+ SendZc = sys::io_uring_op::IORING_OP_SEND_ZC as _,
+
+ /// `IORING_OP_SENDMSG_ZC`
+ SendmsgZc = sys::io_uring_op::IORING_OP_SENDMSG_ZC as _,
}
impl Default for IoringOp {
@@ -338,6 +385,19 @@ impl Default for IoringRestrictionOp {
}
}
+/// `IORING_MSG_*` constants which represent commands for use with
+/// [`IoringOp::MsgRing`], (`seq.addr`)
+#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
+#[repr(u64)]
+#[non_exhaustive]
+pub enum IoringMsgringCmds {
+ /// `IORING_MSG_DATA`
+ Data = sys::IORING_MSG_DATA as _,
+
+ /// `IORING_MSG_SEND_FD`
+ SendFd = sys::IORING_MSG_SEND_FD as _,
+}
+
bitflags::bitflags! {
/// `IORING_SETUP_*` flags for use with [`io_uring_params`].
#[derive(Default)]
@@ -362,6 +422,27 @@ bitflags::bitflags! {
/// `IORING_SETUP_SQ_AFF`
const SQ_AFF = sys::IORING_SETUP_SQ_AFF;
+
+ /// `IORING_SETUP_SQE128`
+ const SQE128 = sys::IORING_SETUP_SQE128;
+
+ /// `IORING_SETUP_CQE32`
+ const CQE32 = sys::IORING_SETUP_CQE32;
+
+ /// `IORING_SETUP_SUBMIT_ALL`
+ const SUBMIT_ALL = sys::IORING_SETUP_SUBMIT_ALL;
+
+ /// `IORING_SETUP_COOP_TRASKRUN`
+ const COOP_TASKRUN = sys::IORING_SETUP_COOP_TASKRUN;
+
+ /// `IORING_SETUP_TASKRUN_FLAG`
+ const TASKRUN_FLAG = sys::IORING_SETUP_TASKRUN_FLAG;
+
+ /// `IORING_SETUP_SINGLE_ISSUER`
+ const SINGLE_ISSUER = sys::IORING_SETUP_SINGLE_ISSUER;
+
+ /// `IORING_SETUP_DEFER_TASKRUN`
+ const DEFER_TASKRUN = sys::IORING_SETUP_DEFER_TASKRUN;
}
}
@@ -386,6 +467,9 @@ bitflags::bitflags! {
/// `1 << IOSQE_IO_LINK_BIT`
const IO_LINK = 1 << sys::IOSQE_IO_LINK_BIT as u8;
+
+ /// `1 << IOSQE_CQE_SKIP_SUCCESS_BIT`
+ const CQE_SKIP_SUCCESS = 1 << sys::IOSQE_CQE_SKIP_SUCCESS_BIT as u8;
}
}
@@ -398,6 +482,12 @@ bitflags::bitflags! {
/// `IORING_CQE_F_MORE`
const MORE = sys::IORING_CQE_F_MORE as _;
+
+ /// `IORING_CQE_F_SOCK_NONEMPTY`
+ const SOCK_NONEMPTY = sys::IORING_CQE_F_SOCK_NONEMPTY as _;
+
+ /// `IORING_CQE_F_NOTIF`
+ const NOTIF = sys::IORING_CQE_F_NOTIF as _;
}
}
@@ -451,6 +541,33 @@ bitflags::bitflags! {
}
bitflags::bitflags! {
+ /// `IORING_MSG_RING_*` flags for use with [`io_uring_sqe`].
+ #[derive(Default)]
+ pub struct IoringMsgringFlags: u32 {
+ /// `IORING_MSG_RING_CQE_SKIP`
+ const CQE_SKIP = sys::IORING_MSG_RING_CQE_SKIP;
+ }
+}
+
+bitflags::bitflags! {
+ /// `IORING_ASYNC_CANCEL_*` flags for use with [`io_uring_sqe`].
+ #[derive(Default)]
+ pub struct IoringAsyncCancelFlags: u32 {
+ /// `IORING_ASYNC_CANCEL_ALL`
+ const ALL = sys::IORING_ASYNC_CANCEL_ALL;
+
+ /// `IORING_ASYNC_CANCEL_FD`
+ const FD = sys::IORING_ASYNC_CANCEL_FD;
+
+ /// `IORING_ASYNC_CANCEL_FD`
+ const ANY = sys::IORING_ASYNC_CANCEL_ANY;
+
+ /// `IORING_ASYNC_CANCEL_FD`
+ const FD_FIXED = sys::IORING_ASYNC_CANCEL_FD_FIXED;
+ }
+}
+
+bitflags::bitflags! {
/// `IORING_FEAT_*` flags for use with [`io_uring_params`].
#[derive(Default)]
pub struct IoringFeatureFlags: u32 {
@@ -489,6 +606,9 @@ bitflags::bitflags! {
/// `IORING_FEAT_SUBMIT_STABLE`
const SUBMIT_STABLE = sys::IORING_FEAT_SUBMIT_STABLE;
+
+ /// `IORING_FEAT_LINKED_FILE`
+ const LINKED_FILE = sys::IORING_FEAT_LINKED_FILE;
}
}
@@ -502,6 +622,15 @@ bitflags::bitflags! {
}
bitflags::bitflags! {
+ /// `IORING_RSRC_*` flags for use with [`io_uring_rsrc_register`].
+ #[derive(Default)]
+ pub struct IoringRsrcFlags: u32 {
+ /// `IORING_RSRC_REGISTER_SPARSE`
+ const REGISTER_SPARSE = sys::IORING_RSRC_REGISTER_SPARSE as _;
+ }
+}
+
+bitflags::bitflags! {
/// `IORING_SQ_*` flags.
#[derive(Default)]
pub struct IoringSqFlags: u32 {
@@ -510,6 +639,9 @@ bitflags::bitflags! {
/// `IORING_SQ_CQ_OVERFLOW`
const CQ_OVERFLOW = sys::IORING_SQ_CQ_OVERFLOW;
+
+ /// `IORING_SQ_TASKRUN`
+ const TASKRUN = sys::IORING_SQ_TASKRUN;
}
}
@@ -534,11 +666,84 @@ bitflags::bitflags! {
/// `IORING_POLL_UPDATE_USER_DATA`
const UPDATE_USER_DATA = sys::IORING_POLL_UPDATE_USER_DATA;
+
+ /// `IORING_POLL_ADD_LEVEL`
+ const ADD_LEVEL = sys::IORING_POLL_ADD_LEVEL;
+ }
+}
+
+bitflags::bitflags! {
+ /// send/sendmsg flags (`sqe.ioprio`)
+ #[derive(Default)]
+ pub struct IoringSendFlags: u16 {
+ /// `IORING_RECVSEND_POLL_FIRST`.
+ ///
+ /// See also [`IoringRecvFlags::POLL_FIRST`].
+ const POLL_FIRST = sys::IORING_RECVSEND_POLL_FIRST as _;
+
+ /// `IORING_RECVSEND_FIXED_BUF`
+ ///
+ /// See also [`IoringRecvFlags::FIXED_BUF`].
+ const FIXED_BUF = sys::IORING_RECVSEND_FIXED_BUF as _;
+
+ /// `IORING_SEND_ZC_REPORT_USAGE` (since Linux 6.2)
+ const ZC_REPORT_USAGE = sys::IORING_SEND_ZC_REPORT_USAGE as _;
+ }
+}
+
+bitflags::bitflags! {
+ /// recv/recvmsg flags (`sqe.ioprio`)
+ #[derive(Default)]
+ pub struct IoringRecvFlags: u16 {
+ /// `IORING_RECVSEND_POLL_FIRST`
+ ///
+ /// See also [`IoringSendFlags::POLL_FIRST`].
+ const POLL_FIRST = sys::IORING_RECVSEND_POLL_FIRST as _;
+
+ /// `IORING_RECV_MULTISHOT`
+ const MULTISHOT = sys::IORING_RECV_MULTISHOT as _;
+
+ /// `IORING_RECVSEND_FIXED_BUF`
+ ///
+ /// See also [`IoringSendFlags::FIXED_BUF`].
+ const FIXED_BUF = sys::IORING_RECVSEND_FIXED_BUF as _;
+ }
+}
+
+bitflags::bitflags! {
+ /// accept flags (`sqe.ioprio`)
+ #[derive(Default)]
+ pub struct IoringAcceptFlags: u16 {
+ /// `IORING_ACCEPT_MULTISHOT`
+ const MULTISHOT = sys::IORING_ACCEPT_MULTISHOT as _;
+ }
+}
+
+bitflags::bitflags! {
+ /// recvmsg out flags
+ #[derive(Default)]
+ pub struct RecvmsgOutFlags: u32 {
+ /// `MSG_EOR`
+ const EOR = sys::MSG_EOR;
+
+ /// `MSG_TRUNC`
+ const TRUNC = sys::MSG_TRUNC;
+
+ /// `MSG_CTRUNC`
+ const CTRUNC = sys::MSG_CTRUNC;
+
+ /// `MSG_OOB`
+ const OOB = sys::MSG_OOB;
+
+ /// `MSG_ERRQUEUE`
+ const ERRQUEUE = sys::MSG_ERRQUEUE;
}
}
#[allow(missing_docs)]
pub const IORING_CQE_BUFFER_SHIFT: u32 = sys::IORING_CQE_BUFFER_SHIFT as _;
+#[allow(missing_docs)]
+pub const IORING_FILE_INDEX_ALLOC: i32 = sys::IORING_FILE_INDEX_ALLOC as _;
// Re-export these as `u64`, which is the `offset` type in `rustix::io::mmap`.
#[allow(missing_docs)]
@@ -554,12 +759,15 @@ pub const IORING_OFF_SQES: u64 = sys::IORING_OFF_SQES as _;
pub const fn io_uring_register_files_skip() -> BorrowedFd<'static> {
let files_skip = sys::IORING_REGISTER_FILES_SKIP as RawFd;
- // Safety: `IORING_REGISTER_FILES_SKIP` is a reserved value that is never
+ // SAFETY: `IORING_REGISTER_FILES_SKIP` is a reserved value that is never
// dynamically allocated, so it'll remain valid for the duration of
// `'static`.
unsafe { BorrowedFd::<'static>::borrow_raw(files_skip) }
}
+/// `IORING_NOTIF_USAGE_ZC_COPIED` (since Linux 6.2)
+pub const IORING_NOTIF_USAGE_ZC_COPIED: i32 = sys::IORING_NOTIF_USAGE_ZC_COPIED as _;
+
/// A pointer in the io_uring API.
///
/// `io_uring`'s native API represents pointers as `u64` values. In order to
@@ -626,7 +834,7 @@ impl io_uring_user_data {
/// Return the `u64` value.
#[inline]
pub fn u64_(self) -> u64 {
- // Safety: All the fields have the same underlying representation.
+ // SAFETY: All the fields have the same underlying representation.
unsafe { self.u64_ }
}
@@ -639,7 +847,7 @@ impl io_uring_user_data {
/// Return the `ptr` pointer value.
#[inline]
pub fn ptr(self) -> *mut c_void {
- // Safety: All the fields have the same underlying representation.
+ // SAFETY: All the fields have the same underlying representation.
unsafe { self.ptr }.ptr
}
@@ -656,7 +864,7 @@ impl Default for io_uring_user_data {
#[inline]
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
@@ -666,7 +874,7 @@ impl Default for io_uring_user_data {
impl core::fmt::Debug for io_uring_user_data {
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
- // Safety: Just format as a `u64`, since formatting doesn't preserve
+ // SAFETY: Just format as a `u64`, since formatting doesn't preserve
// provenance, and we don't have a discriminant.
unsafe { self.u64_.fmt(fmt) }
}
@@ -679,17 +887,51 @@ impl core::fmt::Debug for io_uring_user_data {
pub struct io_uring_sqe {
pub opcode: IoringOp,
pub flags: IoringSqeFlags,
- pub ioprio: u16,
+ pub ioprio: ioprio_union,
pub fd: RawFd,
pub off_or_addr2: off_or_addr2_union,
pub addr_or_splice_off_in: addr_or_splice_off_in_union,
- pub len: u32,
+ pub len: len_union,
pub op_flags: op_flags_union,
pub user_data: io_uring_user_data,
pub buf: buf_union,
pub personality: u16,
pub splice_fd_in_or_file_index: splice_fd_in_or_file_index_union,
- pub __pad2: [u64; 2],
+ pub addr3_or_cmd: addr3_or_cmd_union,
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union ioprio_union {
+ pub recv_flags: IoringRecvFlags,
+ pub send_flags: IoringSendFlags,
+ pub accept_flags: IoringAcceptFlags,
+ pub ioprio: u16,
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union len_union {
+ pub poll_flags: IoringPollFlags,
+ pub len: u32,
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub union addr3_or_cmd_union {
+ pub addr3: addr3_struct,
+ pub cmd: [u8; 0],
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Copy, Clone, Default)]
+pub struct addr3_struct {
+ pub addr3: u64,
+ pub __pad2: [u64; 1],
}
#[allow(missing_docs)]
@@ -698,6 +940,16 @@ pub struct io_uring_sqe {
pub union off_or_addr2_union {
pub off: u64,
pub addr2: io_uring_ptr,
+ pub cmd_op: cmd_op_struct,
+ pub user_data: io_uring_user_data,
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Copy, Clone)]
+pub struct cmd_op_struct {
+ pub cmd_op: u32,
+ pub __pad1: u32,
}
#[allow(missing_docs)]
@@ -706,6 +958,8 @@ pub union off_or_addr2_union {
pub union addr_or_splice_off_in_union {
pub addr: io_uring_ptr,
pub splice_off_in: u64,
+ pub msgring_cmd: IoringMsgringCmds,
+ pub user_data: io_uring_user_data,
}
#[allow(missing_docs)]
@@ -725,14 +979,15 @@ pub union op_flags_union {
pub recv_flags: crate::net::RecvFlags,
pub timeout_flags: IoringTimeoutFlags,
pub accept_flags: crate::net::AcceptFlags,
- pub cancel_flags: u32,
- pub open_flags: crate::fs::AtFlags,
+ pub cancel_flags: IoringAsyncCancelFlags,
+ pub open_flags: crate::fs::OFlags,
pub statx_flags: crate::fs::AtFlags,
pub fadvise_advice: crate::fs::Advice,
pub splice_flags: SpliceFlags,
pub rename_flags: crate::fs::RenameFlags,
pub unlink_flags: crate::fs::AtFlags,
pub hardlink_flags: crate::fs::AtFlags,
+ pub msg_ring_flags: IoringMsgringFlags,
}
#[allow(missing_docs)]
@@ -861,7 +1116,7 @@ pub struct io_uring_files_update {
#[derive(Debug, Copy, Clone, Default)]
pub struct io_uring_rsrc_register {
pub nr: u32,
- pub resv: u32,
+ pub flags: IoringRsrcFlags,
pub resv2: u64,
pub data: u64,
pub tags: u64,
@@ -900,6 +1155,16 @@ pub struct io_uring_getevents_arg {
#[allow(missing_docs)]
#[repr(C)]
+#[derive(Debug, Default, Copy, Clone)]
+pub struct io_uring_recvmsg_out {
+ pub namelen: u32,
+ pub controllen: u32,
+ pub payloadlen: u32,
+ pub flags: RecvmsgOutFlags,
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct iovec {
pub iov_base: *mut c_void,
@@ -923,75 +1188,96 @@ pub struct open_how {
pub resolve: crate::fs::ResolveFlags,
}
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Debug, Copy, Clone, Default)]
+pub struct io_uring_buf_reg {
+ pub ring_addr: u64,
+ pub ring_entries: u32,
+ pub bgid: u16,
+ pub pad: u16,
+ pub resv: [u64; 3_usize],
+}
+
+#[allow(missing_docs)]
+#[repr(C)]
+#[derive(Debug, Copy, Clone, Default)]
+pub struct io_uring_buf {
+ pub addr: u64,
+ pub len: u32,
+ pub bid: u16,
+ pub resv: u16,
+}
+
+impl Default for ioprio_union {
+ #[inline]
+ fn default() -> Self {
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
+ }
+}
+
+impl Default for len_union {
+ #[inline]
+ fn default() -> Self {
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
+ }
+}
+
impl Default for off_or_addr2_union {
#[inline]
fn default() -> Self {
- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
- unsafe {
- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
- s.assume_init()
- }
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
}
}
impl Default for addr_or_splice_off_in_union {
#[inline]
fn default() -> Self {
- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
- unsafe {
- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
- s.assume_init()
- }
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
+ }
+}
+
+impl Default for addr3_or_cmd_union {
+ #[inline]
+ fn default() -> Self {
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
}
}
impl Default for op_flags_union {
#[inline]
fn default() -> Self {
- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
- unsafe {
- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
- s.assume_init()
- }
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
}
}
impl Default for buf_union {
#[inline]
fn default() -> Self {
- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
- unsafe {
- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
- s.assume_init()
- }
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
}
}
impl Default for splice_fd_in_or_file_index_union {
#[inline]
fn default() -> Self {
- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
- unsafe {
- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
- s.assume_init()
- }
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
}
}
impl Default for register_or_sqe_op_or_sqe_flags_union {
#[inline]
fn default() -> Self {
- let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
- // Safety: All of Linux's io_uring structs may be zero-initialized.
- unsafe {
- ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
- s.assume_init()
- }
+ // SAFETY: All of Linux's io_uring structs may be zero-initialized.
+ unsafe { ::core::mem::zeroed::<Self>() }
}
}
@@ -1012,9 +1298,9 @@ fn io_uring_layouts() {
};
}
- // The same as `check_type`, but for unions we've renamed to avoid having
- // types like "bindgen_ty_1" in the API.
- macro_rules! check_renamed_union {
+ // The same as `check_type`, but for unions and anonymous structs we've
+ // renamed to avoid having types like "bindgen_ty_1" in the API.
+ macro_rules! check_renamed_type {
($to:ident, $from:ident) => {
assert_eq!(
(size_of::<$to>(), align_of::<$to>()),
@@ -1035,9 +1321,9 @@ fn io_uring_layouts() {
};
}
- // The same as `check_struct_field`, but for unions we've renamed to avoid
- // having types like "bindgen_ty_1" in the API.
- macro_rules! check_struct_renamed_union_field {
+ // The same as `check_struct_field`, but for unions and anonymous structs
+ // 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) => {
assert_eq!(offset_of!($struct, $to), offset_of!(sys::$struct, $from));
assert_eq!(span_of!($struct, $to), span_of!(sys::$struct, $from));
@@ -1052,7 +1338,7 @@ fn io_uring_layouts() {
// Check that we have all the fields.
let _test = $name {
- // Safety: All of io_uring's types can be zero-initialized.
+ // SAFETY: All of io_uring's types can be zero-initialized.
$($field: unsafe { core::mem::zeroed() }),*
};
@@ -1061,34 +1347,38 @@ fn io_uring_layouts() {
};
}
- check_renamed_union!(off_or_addr2_union, io_uring_sqe__bindgen_ty_1);
- check_renamed_union!(addr_or_splice_off_in_union, io_uring_sqe__bindgen_ty_2);
- check_renamed_union!(op_flags_union, io_uring_sqe__bindgen_ty_3);
- check_renamed_union!(buf_union, io_uring_sqe__bindgen_ty_4);
- check_renamed_union!(splice_fd_in_or_file_index_union, io_uring_sqe__bindgen_ty_5);
- check_renamed_union!(
+ check_renamed_type!(off_or_addr2_union, io_uring_sqe__bindgen_ty_1);
+ check_renamed_type!(addr_or_splice_off_in_union, io_uring_sqe__bindgen_ty_2);
+ check_renamed_type!(addr3_or_cmd_union, io_uring_sqe__bindgen_ty_6);
+ check_renamed_type!(op_flags_union, io_uring_sqe__bindgen_ty_3);
+ check_renamed_type!(buf_union, io_uring_sqe__bindgen_ty_4);
+ check_renamed_type!(splice_fd_in_or_file_index_union, io_uring_sqe__bindgen_ty_5);
+ check_renamed_type!(
register_or_sqe_op_or_sqe_flags_union,
io_uring_restriction__bindgen_ty_1
);
+ check_renamed_type!(addr3_struct, io_uring_sqe__bindgen_ty_6__bindgen_ty_1);
+ check_renamed_type!(cmd_op_struct, io_uring_sqe__bindgen_ty_1__bindgen_ty_1);
+
check_type!(io_uring_sqe);
check_struct_field!(io_uring_sqe, opcode);
check_struct_field!(io_uring_sqe, flags);
check_struct_field!(io_uring_sqe, ioprio);
check_struct_field!(io_uring_sqe, fd);
- check_struct_renamed_union_field!(io_uring_sqe, off_or_addr2, __bindgen_anon_1);
- check_struct_renamed_union_field!(io_uring_sqe, addr_or_splice_off_in, __bindgen_anon_2);
+ check_struct_renamed_field!(io_uring_sqe, off_or_addr2, __bindgen_anon_1);
+ check_struct_renamed_field!(io_uring_sqe, addr_or_splice_off_in, __bindgen_anon_2);
check_struct_field!(io_uring_sqe, len);
- check_struct_renamed_union_field!(io_uring_sqe, op_flags, __bindgen_anon_3);
+ check_struct_renamed_field!(io_uring_sqe, op_flags, __bindgen_anon_3);
check_struct_field!(io_uring_sqe, user_data);
- check_struct_renamed_union_field!(io_uring_sqe, buf, __bindgen_anon_4);
+ check_struct_renamed_field!(io_uring_sqe, buf, __bindgen_anon_4);
check_struct_field!(io_uring_sqe, personality);
- check_struct_renamed_union_field!(io_uring_sqe, splice_fd_in_or_file_index, __bindgen_anon_5);
- check_struct_field!(io_uring_sqe, __pad2);
+ check_struct_renamed_field!(io_uring_sqe, splice_fd_in_or_file_index, __bindgen_anon_5);
+ check_struct_renamed_field!(io_uring_sqe, addr3_or_cmd, __bindgen_anon_6);
check_type!(io_uring_restriction);
check_struct_field!(io_uring_restriction, opcode);
- check_struct_renamed_union_field!(
+ check_struct_renamed_field!(
io_uring_restriction,
register_or_sqe_op_or_sqe_flags,
__bindgen_anon_1
@@ -1134,13 +1424,16 @@ fn io_uring_layouts() {
resv1,
resv2
);
+ check_struct!(io_uring_recvmsg_out, namelen, controllen, payloadlen, flags);
check_struct!(io_uring_probe, last_op, ops_len, resv, resv2, ops);
check_struct!(io_uring_probe_op, op, resv, flags, resv2);
check_struct!(io_uring_files_update, offset, resv, fds);
- check_struct!(io_uring_rsrc_register, nr, resv, resv2, data, tags);
+ check_struct!(io_uring_rsrc_register, nr, flags, resv2, data, tags);
check_struct!(io_uring_rsrc_update, offset, resv, data);
check_struct!(io_uring_rsrc_update2, offset, resv, data, tags, nr, resv2);
check_struct!(io_uring_getevents_arg, sigmask, sigmask_sz, pad, ts);
check_struct!(iovec, iov_base, iov_len);
check_struct!(open_how, flags, mode, resolve);
+ check_struct!(io_uring_buf_reg, ring_addr, ring_entries, bgid, pad, resv);
+ check_struct!(io_uring_buf, addr, len, bid, resv);
}
diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs
index 83a686454..9e62b1594 100644
--- a/vendor/rustix/src/lib.rs
+++ b/vendor/rustix/src/lib.rs
@@ -4,7 +4,7 @@
//!
//! With rustix, you can write code like this:
//!
-//! ```rust
+//! ```
//! # #[cfg(feature = "net")]
//! # fn read(sock: std::net::TcpStream, buf: &mut [u8]) -> std::io::Result<()> {
//! # use rustix::net::RecvFlags;
@@ -16,7 +16,7 @@
//!
//! instead of like this:
//!
-//! ```rust
+//! ```
//! # #[cfg(feature = "net")]
//! # fn read(sock: std::net::TcpStream, buf: &mut [u8]) -> std::io::Result<()> {
//! # use std::convert::TryInto;
@@ -60,8 +60,8 @@
//! - Multiplexed functions (eg. `fcntl`, `ioctl`, etc.) are de-multiplexed.
//! - Variadic functions (eg. `openat`, etc.) are presented as non-variadic.
//! - Functions and types which need `l` prefixes or `64` suffixes to enable
-//! large-file support are used automatically, and file sizes and offsets
-//! are presented as `u64` and `i64`.
+//! large-file support (LFS) are used automatically. File sizes and offsets
+//! are always presented as `u64` and `i64`.
//! - Behaviors that depend on the sizes of C types like `long` are hidden.
//! - In some places, more human-friendly and less historical-accident names
//! are used (and documentation aliases are used so that the original names
@@ -86,12 +86,11 @@
//! [`io-streams`]: https://crates.io/crates/io-streams
//! [`getrandom`]: https://crates.io/crates/getrandom
//! [`bitflags`]: https://crates.io/crates/bitflags
-//! [`AsFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/trait.AsFd.html
-//! [`OwnedFd`]: https://docs.rs/io-lifetimes/latest/io_lifetimes/struct.OwnedFd.html
-//! [io-lifetimes crate]: https://crates.io/crates/io-lifetimes
+//! [`AsFd`]: https://doc.rust-lang.org/stable/std/os/fd/trait.AsFd.html
+//! [`OwnedFd`]: https://doc.rust-lang.org/stable/std/os/fd/struct.OwnedFd.html
//! [I/O-safe]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
-//! [`Result`]: https://docs.rs/rustix/latest/rustix/io/type.Result.html
-//! [`Arg`]: https://docs.rs/rustix/latest/rustix/path/trait.Arg.html
+//! [`Result`]: https://doc.rust-lang.org/stable/std/result/enum.Result.html
+//! [`Arg`]: https://docs.rs/rustix/*/rustix/path/trait.Arg.html
#![deny(missing_docs)]
#![allow(stable_features)]
diff --git a/vendor/rustix/src/mm/mmap.rs b/vendor/rustix/src/mm/mmap.rs
index 31d3a77b3..715c662ec 100644
--- a/vendor/rustix/src/mm/mmap.rs
+++ b/vendor/rustix/src/mm/mmap.rs
@@ -12,7 +12,7 @@ use core::ffi::c_void;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use backend::mm::types::MlockFlags;
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
pub use backend::mm::types::MremapFlags;
pub use backend::mm::types::{MapFlags, MprotectFlags, ProtFlags};
@@ -101,7 +101,7 @@ pub unsafe fn munmap(ptr: *mut c_void, len: usize) -> io::Result<()> {
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/mremap.2.html
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
#[inline]
pub unsafe fn mremap(
old_address: *mut c_void,
@@ -126,7 +126,7 @@ pub unsafe fn mremap(
/// - [Linux]
///
/// [Linux]: https://man7.org/linux/man-pages/man2/mremap.2.html
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+#[cfg(any(target_os = "emscripten", target_os = "linux"))]
#[inline]
#[doc(alias = "mremap")]
pub unsafe fn mremap_fixed(
diff --git a/vendor/rustix/src/mm/mod.rs b/vendor/rustix/src/mm/mod.rs
index 9fabea87f..5a439b34b 100644
--- a/vendor/rustix/src/mm/mod.rs
+++ b/vendor/rustix/src/mm/mod.rs
@@ -9,13 +9,7 @@ mod userfaultfd;
#[cfg(not(target_os = "redox"))]
pub use madvise::{madvise, Advice};
-pub use mmap::{
- mlock, mmap, mmap_anonymous, mprotect, munlock, munmap, MapFlags, MprotectFlags, ProtFlags,
-};
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use mmap::{mlock_with, MlockFlags};
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
-pub use mmap::{mremap, mremap_fixed, MremapFlags};
+pub use mmap::*;
pub use msync::{msync, MsyncFlags};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use userfaultfd::{userfaultfd, UserfaultfdFlags};
diff --git a/vendor/rustix/src/net/addr.rs b/vendor/rustix/src/net/addr.rs
index af9e51a8a..ca87298e9 100644
--- a/vendor/rustix/src/net/addr.rs
+++ b/vendor/rustix/src/net/addr.rs
@@ -1,14 +1,12 @@
//! The following is derived from Rust's
//! library/std/src/net/socket_addr.rs at revision
-//! f7e8ba28a4785e698a55fb95e4b3e803302de0ff.
+//! bd20fc1fd657b32f7aa1d70d8723f04c87f21606.
//!
//! All code in this file is licensed MIT or Apache 2.0 at your option.
//!
//! This defines `SocketAddr`, `SocketAddrV4`, and `SocketAddrV6` in a
//! platform-independent way. It is not the native representation.
-#![allow(unsafe_code)]
-
use crate::net::ip::{IpAddr, Ipv4Addr, Ipv6Addr};
use core::cmp::Ordering;
use core::hash;
diff --git a/vendor/rustix/src/net/ip.rs b/vendor/rustix/src/net/ip.rs
index 4d921cc10..ffa5302e3 100644
--- a/vendor/rustix/src/net/ip.rs
+++ b/vendor/rustix/src/net/ip.rs
@@ -1,6 +1,6 @@
//! The following is derived from Rust's
//! library/std/src/net/ip_addr.rs at revision
-//! 14230a7f8e117aa049d3ae661fa00ded7edefc68.
+//! bd20fc1fd657b32f7aa1d70d8723f04c87f21606.
//!
//! All code in this file is licensed MIT or Apache 2.0 at your option.
//!
@@ -1200,6 +1200,7 @@ impl Ipv6Addr {
rustc_const_stable(feature = "const_ip_32", since = "1.32.0")
)]
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
+ #[allow(clippy::too_many_arguments)]
#[must_use]
#[inline]
pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Ipv6Addr {
@@ -1222,6 +1223,9 @@ impl Ipv6Addr {
/// An IPv6 address representing localhost: `::1`.
///
+ /// This corresponds to constant `IN6ADDR_LOOPBACK_INIT` or `in6addr_loopback` in other
+ /// languages.
+ ///
/// # Examples
///
/// ```
@@ -1230,11 +1234,15 @@ impl Ipv6Addr {
/// let addr = Ipv6Addr::LOCALHOST;
/// assert_eq!(addr, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1));
/// ```
+ #[doc(alias = "IN6ADDR_LOOPBACK_INIT")]
+ #[doc(alias = "in6addr_loopback")]
#[cfg_attr(staged_api, stable(feature = "ip_constructors", since = "1.30.0"))]
pub const LOCALHOST: Self = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1);
/// An IPv6 address representing the unspecified address: `::`
///
+ /// This corresponds to constant `IN6ADDR_ANY_INIT` or `in6addr_any` in other languages.
+ ///
/// # Examples
///
/// ```
@@ -1243,6 +1251,8 @@ impl Ipv6Addr {
/// let addr = Ipv6Addr::UNSPECIFIED;
/// assert_eq!(addr, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0));
/// ```
+ #[doc(alias = "IN6ADDR_ANY_INIT")]
+ #[doc(alias = "in6addr_any")]
#[cfg_attr(staged_api, stable(feature = "ip_constructors", since = "1.30.0"))]
pub const UNSPECIFIED: Self = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0);
diff --git a/vendor/rustix/src/net/mod.rs b/vendor/rustix/src/net/mod.rs
index 24fe06dc3..4a3419737 100644
--- a/vendor/rustix/src/net/mod.rs
+++ b/vendor/rustix/src/net/mod.rs
@@ -4,8 +4,8 @@
//! of these APIs. [`wsa_cleanup`] may be used in the process if these APIs are
//! no longer needed.
//!
-//! [`wsa_startup`]: https://docs.rs/rustix/latest/x86_64-pc-windows-msvc/rustix/net/fn.wsa_startup.html
-//! [`wsa_cleanup`]: https://docs.rs/rustix/latest/x86_64-pc-windows-msvc/rustix/net/fn.wsa_cleanup.html
+//! [`wsa_startup`]: https://docs.rs/rustix/*/x86_64-pc-windows-msvc/rustix/net/fn.wsa_startup.html
+//! [`wsa_cleanup`]: https://docs.rs/rustix/*/x86_64-pc-windows-msvc/rustix/net/fn.wsa_cleanup.html
#[cfg(not(feature = "std"))]
mod addr;
@@ -21,14 +21,8 @@ mod wsa;
pub mod sockopt;
-pub use send_recv::{
- recv, recvfrom, send, sendto, sendto_any, sendto_v4, sendto_v6, RecvFlags, SendFlags,
-};
-pub use socket::{
- accept, accept_with, acceptfrom, acceptfrom_with, bind, bind_any, bind_v4, bind_v6, connect,
- connect_any, connect_v4, connect_v6, getpeername, getsockname, listen, shutdown, socket,
- socket_with, AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType,
-};
+pub use send_recv::*;
+pub use socket::*;
pub use socket_addr_any::{SocketAddrAny, SocketAddrStorage};
#[cfg(not(any(windows, target_os = "wasi")))]
pub use socketpair::socketpair;
diff --git a/vendor/rustix/src/net/socket.rs b/vendor/rustix/src/net/socket.rs
index 687022afe..5840d39ff 100644
--- a/vendor/rustix/src/net/socket.rs
+++ b/vendor/rustix/src/net/socket.rs
@@ -19,8 +19,10 @@ impl Default for Protocol {
/// `socket(domain, type_, protocol)`—Creates a socket.
///
/// POSIX guarantees that `socket` will use the lowest unused file descriptor,
-/// however it is not safe in general to rely on this, as file descriptors
-/// may be unexpectedly allocated on other threads or in libraries.
+/// however it is not safe in general to rely on this, as file descriptors may
+/// be unexpectedly allocated on other threads or in libraries.
+///
+/// To pass extra flags such as [`SocketFlags::CLOEXEC`], use [`socket_with`].
///
/// # References
/// - [POSIX]
@@ -41,8 +43,8 @@ pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> i
/// flags.
///
/// POSIX guarantees that `socket` will use the lowest unused file descriptor,
-/// however it is not safe in general to rely on this, as file descriptors
-/// may be unexpectedly allocated on other threads or in libraries.
+/// however it is not safe in general to rely on this, as file descriptors may
+/// be unexpectedly allocated on other threads or in libraries.
///
/// `socket_with` is the same as [`socket`] but adds an additional flags
/// operand.
diff --git a/vendor/rustix/src/net/socket_addr_any.rs b/vendor/rustix/src/net/socket_addr_any.rs
index 287c6c1ee..403ad11c2 100644
--- a/vendor/rustix/src/net/socket_addr_any.rs
+++ b/vendor/rustix/src/net/socket_addr_any.rs
@@ -32,6 +32,28 @@ pub enum SocketAddrAny {
Unix(SocketAddrUnix),
}
+impl From<SocketAddrV4> for SocketAddrAny {
+ #[inline]
+ fn from(from: SocketAddrV4) -> Self {
+ Self::V4(from)
+ }
+}
+
+impl From<SocketAddrV6> for SocketAddrAny {
+ #[inline]
+ fn from(from: SocketAddrV6) -> Self {
+ Self::V6(from)
+ }
+}
+
+#[cfg(unix)]
+impl From<SocketAddrUnix> for SocketAddrAny {
+ #[inline]
+ fn from(from: SocketAddrUnix) -> Self {
+ Self::Unix(from)
+ }
+}
+
impl SocketAddrAny {
/// Return the address family of this socket address.
#[inline]
diff --git a/vendor/rustix/src/net/sockopt.rs b/vendor/rustix/src/net/sockopt.rs
index 436d5bf86..ffdc67942 100644
--- a/vendor/rustix/src/net/sockopt.rs
+++ b/vendor/rustix/src/net/sockopt.rs
@@ -226,6 +226,28 @@ pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Du
backend::net::syscalls::sockopt::get_socket_timeout(fd.as_fd(), id)
}
+/// `getsockopt(fd, SOL_SOCKET, SO_ERROR)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `sys/socket.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `socket`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `SOL_SOCKET` options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html
+/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt
+/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options
+#[inline]
+#[doc(alias = "SO_ERROR")]
+pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), crate::io::Errno>> {
+ backend::net::syscalls::sockopt::get_socket_error(fd.as_fd())
+}
+
/// `setsockopt(fd, IPPROTO_IP, IP_TTL, ttl)`
///
/// # References
@@ -642,3 +664,49 @@ pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> {
pub fn get_tcp_nodelay<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
backend::net::syscalls::sockopt::get_tcp_nodelay(fd.as_fd())
}
+
+/// `getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+#[cfg(any(apple, target_os = "freebsd"))]
+#[doc(alias = "SO_NOSIGPIPE")]
+#[inline]
+pub fn getsockopt_nosigpipe<Fd: AsFd>(fd: Fd) -> io::Result<bool> {
+ backend::net::syscalls::sockopt::getsockopt_nosigpipe(fd.as_fd())
+}
+
+/// `setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, val)`
+///
+/// # References
+/// - [POSIX `getsockopt`]
+/// - [POSIX `netinet/tcp.h`]
+/// - [Linux `getsockopt`]
+/// - [Linux `tcp`]
+/// - [Winsock2 `getsockopt`]
+/// - [Winsock2 `IPPROTO_TCP` options]
+///
+/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html
+/// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html
+/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html
+/// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html
+/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt
+/// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
+#[cfg(any(apple, target_os = "freebsd"))]
+#[doc(alias = "SO_NOSIGPIPE")]
+#[inline]
+pub fn setsockopt_nosigpipe<Fd: AsFd>(fd: Fd, val: bool) -> io::Result<()> {
+ backend::net::syscalls::sockopt::setsockopt_nosigpipe(fd.as_fd(), val)
+}
diff --git a/vendor/rustix/src/param/mod.rs b/vendor/rustix/src/param/mod.rs
index c47aca985..c3838b62e 100644
--- a/vendor/rustix/src/param/mod.rs
+++ b/vendor/rustix/src/param/mod.rs
@@ -11,21 +11,6 @@ mod auxv;
mod init;
#[cfg(feature = "param")]
-#[cfg(not(target_os = "wasi"))]
-pub use auxv::clock_ticks_per_second;
-#[cfg(feature = "param")]
-pub use auxv::page_size;
-#[cfg(feature = "param")]
-#[cfg(any(
- linux_raw,
- all(
- libc,
- any(
- all(target_os = "android", target_pointer_width = "64"),
- target_os = "linux",
- )
- )
-))]
-pub use auxv::{linux_execfn, linux_hwcap};
+pub use auxv::*;
#[cfg(target_vendor = "mustang")]
pub use init::init;
diff --git a/vendor/rustix/src/path/arg.rs b/vendor/rustix/src/path/arg.rs
index 0ea673d19..3d976ce3e 100644
--- a/vendor/rustix/src/path/arg.rs
+++ b/vendor/rustix/src/path/arg.rs
@@ -41,7 +41,7 @@ use std::path::{Component, Components, Iter, Path, PathBuf};
///
/// # Example
///
-/// ```rust
+/// ```
/// # #[cfg(any(feature = "fs", feature = "net"))]
/// use rustix::ffi::CStr;
/// use rustix::io;
@@ -950,13 +950,15 @@ where
}
// Taken from
- // https://github.com/rust-lang/rust/blob/a00f8ba7fcac1b27341679c51bf5a3271fa82df3/library/std/src/sys/common/small_c_string.rs
+ // <https://github.com/rust-lang/rust/blob/a00f8ba7fcac1b27341679c51bf5a3271fa82df3/library/std/src/sys/common/small_c_string.rs>
let mut buf = MaybeUninit::<[u8; SMALL_PATH_BUFFER_SIZE]>::uninit();
let buf_ptr = buf.as_mut_ptr() as *mut u8;
+ // This helps test our safety condition below.
+ debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE);
+
// SAFETY: bytes.len() < SMALL_PATH_BUFFER_SIZE which means we have space for
// bytes.len() + 1 u8s:
- debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE);
unsafe {
ptr::copy_nonoverlapping(bytes.as_ptr(), buf_ptr, bytes.len());
buf_ptr.add(bytes.len()).write(0);
diff --git a/vendor/rustix/src/path/dec_int.rs b/vendor/rustix/src/path/dec_int.rs
index d0975694b..5ba8be4fc 100644
--- a/vendor/rustix/src/path/dec_int.rs
+++ b/vendor/rustix/src/path/dec_int.rs
@@ -30,7 +30,7 @@ use std::path::Path;
///
/// # Example
///
-/// ```rust
+/// ```
/// # #[cfg(feature = "path")]
/// use rustix::path::DecInt;
///
@@ -70,7 +70,7 @@ impl DecInt {
/// Return the raw byte buffer as a `&str`.
#[inline]
pub fn as_str(&self) -> &str {
- // Safety: `DecInt` always holds a formatted decimal number, so it's
+ // SAFETY: `DecInt` always holds a formatted decimal number, so it's
// always valid UTF-8.
unsafe { core::str::from_utf8_unchecked(self.as_bytes()) }
}
@@ -81,7 +81,7 @@ impl DecInt {
let bytes_with_nul = &self.buf[..=self.len];
debug_assert!(CStr::from_bytes_with_nul(bytes_with_nul).is_ok());
- // Safety: `self.buf` holds a single decimal ASCII representation and
+ // SAFETY: `self.buf` holds a single decimal ASCII representation and
// at least one extra NUL byte.
unsafe { CStr::from_bytes_with_nul_unchecked(bytes_with_nul) }
}
diff --git a/vendor/rustix/src/process/id.rs b/vendor/rustix/src/process/id.rs
index e7fff7e53..04f1b879c 100644
--- a/vendor/rustix/src/process/id.rs
+++ b/vendor/rustix/src/process/id.rs
@@ -105,7 +105,7 @@ impl Gid {
impl Pid {
/// A `Pid` corresponding to the init process (pid 1).
pub const INIT: Self = Self(
- // Safety: The init process' pid is always valid.
+ // SAFETY: The init process' pid is always valid.
unsafe { RawNonZeroPid::new_unchecked(1) },
);
@@ -140,7 +140,7 @@ impl Pid {
let id = child.id();
debug_assert_ne!(id, 0);
- // Safety: We know the returned ID is valid because it came directly
+ // SAFETY: We know the returned ID is valid because it came directly
// from an OS API.
unsafe { Self::from_raw_nonzero(RawNonZeroPid::new_unchecked(id as _)) }
}
diff --git a/vendor/rustix/src/process/membarrier.rs b/vendor/rustix/src/process/membarrier.rs
index b64deb82e..8709337bc 100644
--- a/vendor/rustix/src/process/membarrier.rs
+++ b/vendor/rustix/src/process/membarrier.rs
@@ -46,7 +46,7 @@ impl MembarrierQuery {
/// Test whether this query result contains the given command.
#[inline]
pub fn contains_command(self, cmd: MembarrierCommand) -> bool {
- // Safety: `MembarrierCommand` is an enum that only contains values
+ // SAFETY: `MembarrierCommand` is an enum that only contains values
// also valid in `MembarrierQuery`.
self.contains(unsafe { Self::from_bits_unchecked(cmd as _) })
}
diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs
index e6baa1935..3ae976439 100644
--- a/vendor/rustix/src/process/mod.rs
+++ b/vendor/rustix/src/process/mod.rs
@@ -9,6 +9,8 @@ mod id;
mod kill;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod membarrier;
+#[cfg(target_os = "linux")]
+mod pidfd;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod prctl;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] // WASI doesn't have [gs]etpriority.
@@ -25,60 +27,46 @@ mod rlimit;
))]
mod sched;
mod sched_yield;
+#[cfg(not(target_os = "wasi"))] // WASI doesn't have umask.
+mod umask;
#[cfg(not(target_os = "wasi"))] // WASI doesn't have uname.
mod uname;
#[cfg(not(target_os = "wasi"))]
mod wait;
#[cfg(not(target_os = "wasi"))]
-pub use chdir::chdir;
-#[cfg(not(any(target_os = "wasi", target_os = "fuchsia")))]
-pub use chdir::fchdir;
+pub use chdir::*;
+pub use exit::*;
#[cfg(not(target_os = "wasi"))]
-pub use chdir::getcwd;
+pub use id::*;
#[cfg(not(target_os = "wasi"))]
-pub use exit::EXIT_SIGNALED_SIGABRT;
-pub use exit::{EXIT_FAILURE, EXIT_SUCCESS};
+pub use kill::*;
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use id::Cpuid;
-#[cfg(not(target_os = "wasi"))]
-pub use id::{
- getegid, geteuid, getgid, getpgid, getpgrp, getpid, getppid, getuid, setsid, Gid, Pid, RawGid,
- RawNonZeroPid, RawPid, RawUid, Uid,
-};
-#[cfg(not(target_os = "wasi"))]
-pub use kill::{kill_current_process_group, kill_process, kill_process_group, Signal};
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use membarrier::{
- membarrier, membarrier_cpu, membarrier_query, MembarrierCommand, MembarrierQuery,
-};
+pub use membarrier::*;
+#[cfg(target_os = "linux")]
+pub use pidfd::*;
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use prctl::*;
#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
-pub use priority::nice;
-#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
-pub use priority::{
- getpriority_pgrp, getpriority_process, getpriority_user, setpriority_pgrp, setpriority_process,
- setpriority_user,
-};
+pub use priority::*;
#[cfg(target_os = "freebsd")]
pub use procctl::*;
-#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use rlimit::prlimit;
#[cfg(not(any(target_os = "fuchsia", target_os = "redox", target_os = "wasi")))]
-pub use rlimit::{getrlimit, setrlimit, Resource, Rlimit};
+pub use rlimit::*;
#[cfg(any(
target_os = "android",
target_os = "dragonfly",
target_os = "fuchsia",
target_os = "linux",
))]
-pub use sched::{sched_getaffinity, sched_setaffinity, CpuSet};
+pub use sched::*;
pub use sched_yield::sched_yield;
#[cfg(not(target_os = "wasi"))]
+pub use umask::*;
+#[cfg(not(target_os = "wasi"))]
pub use uname::{uname, Uname};
#[cfg(not(target_os = "wasi"))]
-pub use wait::{wait, waitpid, WaitOptions, WaitStatus};
+pub use wait::*;
#[cfg(not(target_os = "wasi"))]
#[cfg(feature = "fs")]
diff --git a/vendor/rustix/src/process/pidfd.rs b/vendor/rustix/src/process/pidfd.rs
new file mode 100644
index 000000000..c9ddb591f
--- /dev/null
+++ b/vendor/rustix/src/process/pidfd.rs
@@ -0,0 +1,25 @@
+use crate::fd::OwnedFd;
+use crate::process::Pid;
+use crate::{backend, io};
+
+bitflags::bitflags! {
+ /// `PIDFD_*` flags for use with [`pidfd_open`].
+ ///
+ /// [`pidfd_open`]: crate::process::pidfd_open
+ pub struct PidfdFlags: backend::c::c_uint {
+ /// `PIDFD_NONBLOCK`.
+ const NONBLOCK = backend::c::PIDFD_NONBLOCK;
+ }
+}
+
+/// `syscall(SYS_pidfd_open, pid, flags)`—Creates a file descriptor for
+/// a process.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/pidfd_open.2.html
+#[inline]
+pub fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> {
+ backend::process::syscalls::pidfd_open(pid, flags)
+}
diff --git a/vendor/rustix/src/process/prctl.rs b/vendor/rustix/src/process/prctl.rs
index 49927be25..34eef7aa4 100644
--- a/vendor/rustix/src/process/prctl.rs
+++ b/vendor/rustix/src/process/prctl.rs
@@ -1,7 +1,7 @@
//! Bindings for the Linux `prctl` system call.
//!
-//! There are similarities (but also differences) with FreeBSD's `procctl` system call, whose
-//! interface is located in the `procctl.rs` file.
+//! There are similarities (but also differences) with FreeBSD's `procctl`
+//! system call, whose interface is located in the `procctl.rs` file.
#![allow(unsafe_code)]
@@ -72,8 +72,8 @@ const PR_GET_PDEATHSIG: c_int = 2;
/// Get the current value of the parent process death signal.
///
/// # References
-/// - [Linux: `prctl(PR_GET_PDEATHSIG,...)`]
-/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
+/// - [Linux: `prctl(PR_GET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
///
/// [Linux: `prctl(PR_GET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
@@ -87,8 +87,8 @@ const PR_SET_PDEATHSIG: c_int = 1;
/// Set the parent-death signal of the calling process.
///
/// # References
-/// - [Linux: `prctl(PR_SET_PDEATHSIG,...)`]
-/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
+/// - [Linux: `prctl(PR_SET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
///
/// [Linux: `prctl(PR_SET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
@@ -136,7 +136,7 @@ impl TryFrom<i32> for DumpableBehavior {
/// Get the current state of the calling process's `dumpable` attribute.
///
/// # References
-/// - [`prctl(PR_GET_DUMPABLE,...)`]
+/// - [`prctl(PR_GET_DUMPABLE,...)`]
///
/// [`prctl(PR_GET_DUMPABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -146,16 +146,17 @@ pub fn dumpable_behavior() -> io::Result<DumpableBehavior> {
const PR_SET_DUMPABLE: c_int = 4;
-/// Set the state of the `dumpable` attribute, which determines whether the process can be traced
-/// and whether core dumps are produced for the calling process upon delivery of a signal whose
-/// default behavior is to produce a core dump.
+/// Set the state of the `dumpable` attribute, which determines whether the
+/// process can be traced and whether core dumps are produced for the calling
+/// process upon delivery of a signal whose default behavior is to produce a
+/// core dump.
///
-/// A similar function with the same name is available on FreeBSD (as part of the `procctl`
-/// interface), but it has an extra argument which allows to select a process other then the
-/// current process.
+/// A similar function with the same name is available on FreeBSD (as part of
+/// the `procctl` interface), but it has an extra argument which allows to
+/// select a process other then the current process.
///
/// # References
-/// - [`prctl(PR_SET_DUMPABLE,...)`]
+/// - [`prctl(PR_SET_DUMPABLE,...)`]
///
/// [`prctl(PR_SET_DUMPABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -182,7 +183,7 @@ bitflags! {
/// Get unaligned access control bits.
///
/// # References
-/// - [`prctl(PR_GET_UNALIGN,...)`]
+/// - [`prctl(PR_GET_UNALIGN,...)`]
///
/// [`prctl(PR_GET_UNALIGN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -196,7 +197,7 @@ const PR_SET_UNALIGN: c_int = 6;
/// Set unaligned access control bits.
///
/// # References
-/// - [`prctl(PR_SET_UNALIGN,...)`]
+/// - [`prctl(PR_SET_UNALIGN,...)`]
///
/// [`prctl(PR_SET_UNALIGN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -223,7 +224,7 @@ bitflags! {
/// Get floating point emulation control bits.
///
/// # References
-/// - [`prctl(PR_GET_FPEMU,...)`]
+/// - [`prctl(PR_GET_FPEMU,...)`]
///
/// [`prctl(PR_GET_FPEMU,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -237,7 +238,7 @@ const PR_SET_FPEMU: c_int = 10;
/// Set floating point emulation control bits.
///
/// # References
-/// - [`prctl(PR_SET_FPEMU,...)`]
+/// - [`prctl(PR_SET_FPEMU,...)`]
///
/// [`prctl(PR_SET_FPEMU,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -281,7 +282,7 @@ bitflags! {
/// Get floating point exception mode.
///
/// # References
-/// - [`prctl(PR_GET_FPEXC,...)`]
+/// - [`prctl(PR_GET_FPEXC,...)`]
///
/// [`prctl(PR_GET_FPEXC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -295,7 +296,7 @@ const PR_SET_FPEXC: c_int = 12;
/// Set floating point exception mode.
///
/// # References
-/// - [`prctl(PR_SET_FPEXC,...)`]
+/// - [`prctl(PR_SET_FPEXC,...)`]
///
/// [`prctl(PR_SET_FPEXC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -340,7 +341,7 @@ impl TryFrom<i32> for TimingMethod {
/// Get which process timing method is currently in use.
///
/// # References
-/// - [`prctl(PR_GET_TIMING,...)`]
+/// - [`prctl(PR_GET_TIMING,...)`]
///
/// [`prctl(PR_GET_TIMING,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -350,11 +351,11 @@ pub fn timing_method() -> io::Result<TimingMethod> {
const PR_SET_TIMING: c_int = 14;
-/// Set whether to use (normal, traditional) statistical process timing or accurate
-/// timestamp-based process timing.
+/// Set whether to use (normal, traditional) statistical process timing or
+/// accurate timestamp-based process timing.
///
/// # References
-/// - [`prctl(PR_SET_TIMING,...)`]
+/// - [`prctl(PR_SET_TIMING,...)`]
///
/// [`prctl(PR_SET_TIMING,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -400,7 +401,7 @@ impl TryFrom<u32> for EndianMode {
/// Get the endianness of the calling process.
///
/// # References
-/// - [`prctl(PR_GET_ENDIAN,...)`]
+/// - [`prctl(PR_GET_ENDIAN,...)`]
///
/// [`prctl(PR_GET_ENDIAN,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -413,7 +414,7 @@ const PR_SET_ENDIAN: c_int = 20;
/// Set the endianness of the calling process.
///
/// # References
-/// - [`prctl(PR_SET_ENDIAN,...)`]
+/// - [`prctl(PR_SET_ENDIAN,...)`]
///
/// # Safety
///
@@ -460,7 +461,7 @@ impl TryFrom<u32> for TimeStampCounterReadability {
/// Get the state of the flag determining if the timestamp counter can be read.
///
/// # References
-/// - [`prctl(PR_GET_TSC,...)`]
+/// - [`prctl(PR_GET_TSC,...)`]
///
/// [`prctl(PR_GET_TSC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -470,10 +471,11 @@ pub fn time_stamp_counter_readability() -> io::Result<TimeStampCounterReadabilit
const PR_SET_TSC: c_int = 26;
-/// Set the state of the flag determining if the timestamp counter can be read by the process.
+/// Set the state of the flag determining if the timestamp counter can be read
+/// by the process.
///
/// # References
-/// - [`prctl(PR_SET_TSC,...)`]
+/// - [`prctl(PR_SET_TSC,...)`]
///
/// [`prctl(PR_SET_TSC,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -493,8 +495,8 @@ const PR_TASK_PERF_EVENTS_ENABLE: c_int = 32;
/// Enable or disable all performance counters attached to the calling process.
///
/// # References
-/// - [`prctl(PR_TASK_PERF_EVENTS_ENABLE,...)`]
-/// - [`prctl(PR_TASK_PERF_EVENTS_DISABLE,...)`]
+/// - [`prctl(PR_TASK_PERF_EVENTS_ENABLE,...)`]
+/// - [`prctl(PR_TASK_PERF_EVENTS_DISABLE,...)`]
///
/// [`prctl(PR_TASK_PERF_EVENTS_ENABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
/// [`prctl(PR_TASK_PERF_EVENTS_DISABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
@@ -547,7 +549,7 @@ impl TryFrom<u32> for MachineCheckMemoryCorruptionKillPolicy {
/// Get the current per-process machine check kill policy.
///
/// # References
-/// - [`prctl(PR_MCE_KILL_GET,...)`]
+/// - [`prctl(PR_MCE_KILL_GET,...)`]
///
/// [`prctl(PR_MCE_KILL_GET,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -565,7 +567,7 @@ const PR_MCE_KILL_SET: usize = 1;
/// Set the machine check memory corruption kill policy for the calling thread.
///
/// # References
-/// - [`prctl(PR_MCE_KILL,...)`]
+/// - [`prctl(PR_MCE_KILL,...)`]
///
/// [`prctl(PR_MCE_KILL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -611,13 +613,16 @@ pub enum VirtualMemoryMapAddress {
CodeStart = PR_SET_MM_START_CODE,
/// Set the address below which the program text can run.
CodeEnd = PR_SET_MM_END_CODE,
- /// Set the address above which initialized and uninitialized (bss) data are placed.
+ /// Set the address above which initialized and uninitialized (bss) data
+ /// are placed.
DataStart = PR_SET_MM_START_DATA,
- /// Set the address below which initialized and uninitialized (bss) data are placed.
+ /// Set the address below which initialized and uninitialized (bss) data
+ /// are placed.
DataEnd = PR_SET_MM_END_DATA,
/// Set the start address of the stack.
StackStart = PR_SET_MM_START_STACK,
- /// Set the address above which the program heap can be expanded with `brk` call.
+ /// Set the address above which the program heap can be expanded with `brk`
+ /// call.
BrkStart = PR_SET_MM_START_BRK,
/// Set the current `brk` value.
BrkCurrent = PR_SET_MM_BRK,
@@ -631,10 +636,11 @@ pub enum VirtualMemoryMapAddress {
EnvironmentEnd = PR_SET_MM_ENV_END,
}
-/// Modify certain kernel memory map descriptor addresses of the calling process.
+/// Modify certain kernel memory map descriptor addresses of the calling
+/// process.
///
/// # References
-/// - [`prctl(PR_SET_MM,...)`]
+/// - [`prctl(PR_SET_MM,...)`]
///
/// # Safety
///
@@ -651,10 +657,11 @@ pub unsafe fn set_virtual_memory_map_address(
prctl_3args(PR_SET_MM, option as usize as *mut _, address).map(|_r| ())
}
-/// Supersede the `/proc/pid/exe` symbolic link with a new one pointing to a new executable file.
+/// Supersede the `/proc/pid/exe` symbolic link with a new one pointing to a
+/// new executable file.
///
/// # References
-/// - [`prctl(PR_SET_MM,PR_SET_MM_EXE_FILE,...)`]
+/// - [`prctl(PR_SET_MM,PR_SET_MM_EXE_FILE,...)`]
///
/// [`prctl(PR_SET_MM,PR_SET_MM_EXE_FILE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -666,7 +673,7 @@ pub fn set_executable_file(fd: BorrowedFd) -> io::Result<()> {
/// Set a new auxiliary vector.
///
/// # References
-/// - [`prctl(PR_SET_MM,PR_SET_MM_AUXV,...)`]
+/// - [`prctl(PR_SET_MM,PR_SET_MM_AUXV,...)`]
///
/// # Safety
///
@@ -689,7 +696,7 @@ pub unsafe fn set_auxiliary_vector(auxv: &[*const c_void]) -> io::Result<()> {
/// Get the size of the [`PrctlMmMap`] the kernel expects.
///
/// # References
-/// - [`prctl(PR_SET_MM,PR_SET_MM_MAP_SIZE,...)`]
+/// - [`prctl(PR_SET_MM,PR_SET_MM_MAP_SIZE,...)`]
///
/// [`prctl(PR_SET_MM,PR_SET_MM_MAP_SIZE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -700,8 +707,8 @@ pub fn virtual_memory_map_config_struct_size() -> io::Result<usize> {
Ok(value as usize)
}
-/// This structure provides new memory descriptor map which mostly modifies `/proc/pid/stat[m]`
-/// output for a task.
+/// This structure provides new memory descriptor map which mostly modifies
+/// `/proc/pid/stat[m]` output for a task.
/// This mostly done in a sake of checkpoint/restore functionality.
#[repr(C)]
#[derive(Debug, Clone)]
@@ -732,14 +739,16 @@ pub struct PrctlMmMap {
pub auxv: *mut u64,
/// Auxiliary vector size.
pub auxv_size: u32,
- /// File descriptor of executable file that was used to create this process.
+ /// File descriptor of executable file that was used to create this
+ /// process.
pub exe_fd: u32,
}
-/// Provides one-shot access to all the addresses by passing in a [`PrctlMmMap`].
+/// Provides one-shot access to all the addresses by passing in a
+/// [`PrctlMmMap`].
///
/// # References
-/// - [`prctl(PR_SET_MM,PR_SET_MM_MAP,...)`]
+/// - [`prctl(PR_SET_MM,PR_SET_MM_MAP,...)`]
///
/// # Safety
///
@@ -778,11 +787,11 @@ pub enum PTracer {
ProcessID(Pid),
}
-/// Declare that the ptracer process can `ptrace` the calling process as if it were a direct
-/// process ancestor.
+/// Declare that the ptracer process can `ptrace` the calling process as if it
+/// were a direct process ancestor.
///
/// # References
-/// - [`prctl(PR_SET_PTRACER,...)`]
+/// - [`prctl(PR_SET_PTRACER,...)`]
///
/// [`prctl(PR_SET_PTRACER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -805,7 +814,7 @@ const PR_GET_CHILD_SUBREAPER: c_int = 37;
/// Get the `child subreaper` setting of the calling process.
///
/// # References
-/// - [`prctl(PR_GET_CHILD_SUBREAPER,...)`]
+/// - [`prctl(PR_GET_CHILD_SUBREAPER,...)`]
///
/// [`prctl(PR_GET_CHILD_SUBREAPER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -821,7 +830,7 @@ const PR_SET_CHILD_SUBREAPER: c_int = 36;
/// Set the `child subreaper` attribute of the calling process.
///
/// # References
-/// - [`prctl(PR_SET_CHILD_SUBREAPER,...)`]
+/// - [`prctl(PR_SET_CHILD_SUBREAPER,...)`]
///
/// [`prctl(PR_SET_CHILD_SUBREAPER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -864,7 +873,7 @@ impl TryFrom<u32> for FloatingPointMode {
/// Get the current floating point mode.
///
/// # References
-/// - [`prctl(PR_GET_FP_MODE,...)`]
+/// - [`prctl(PR_GET_FP_MODE,...)`]
///
/// [`prctl(PR_GET_FP_MODE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -878,7 +887,7 @@ const PR_SET_FP_MODE: c_int = 45;
/// Allow control of the floating point mode from user space.
///
/// # References
-/// - [`prctl(PR_SET_FP_MODE,...)`]
+/// - [`prctl(PR_SET_FP_MODE,...)`]
///
/// [`prctl(PR_SET_FP_MODE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -954,7 +963,7 @@ bitflags! {
/// Get the state of the speculation misfeature.
///
/// # References
-/// - [`prctl(PR_GET_SPECULATION_CTRL,...)`]
+/// - [`prctl(PR_GET_SPECULATION_CTRL,...)`]
///
/// [`prctl(PR_GET_SPECULATION_CTRL,...)`]: https://www.kernel.org/doc/html/v5.18/userspace-api/spec_ctrl.html
#[inline]
@@ -970,7 +979,7 @@ const PR_SET_SPECULATION_CTRL: c_int = 53;
/// Sets the state of the speculation misfeature.
///
/// # References
-/// - [`prctl(PR_SET_SPECULATION_CTRL,...)`]
+/// - [`prctl(PR_SET_SPECULATION_CTRL,...)`]
///
/// [`prctl(PR_SET_SPECULATION_CTRL,...)`]: https://www.kernel.org/doc/html/v5.18/userspace-api/spec_ctrl.html
#[inline]
@@ -992,7 +1001,7 @@ const PR_GET_IO_FLUSHER: c_int = 58;
/// Get the `IO_FLUSHER` state of the caller.
///
/// # References
-/// - [`prctl(PR_GET_IO_FLUSHER,...)`]
+/// - [`prctl(PR_GET_IO_FLUSHER,...)`]
///
/// [`prctl(PR_GET_IO_FLUSHER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -1002,11 +1011,11 @@ pub fn is_io_flusher() -> io::Result<bool> {
const PR_SET_IO_FLUSHER: c_int = 57;
-/// Put the process in the `IO_FLUSHER` state, allowing it to make progress when
-/// allocating memory.
+/// Put the process in the `IO_FLUSHER` state, allowing it to make progress
+/// when allocating memory.
///
/// # References
-/// - [`prctl(PR_SET_IO_FLUSHER,...)`]
+/// - [`prctl(PR_SET_IO_FLUSHER,...)`]
///
/// [`prctl(PR_SET_IO_FLUSHER,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -1039,7 +1048,7 @@ bitflags! {
/// Get enabled pointer authentication keys.
///
/// # References
-/// - [`prctl(PR_PAC_GET_ENABLED_KEYS,...)`]
+/// - [`prctl(PR_PAC_GET_ENABLED_KEYS,...)`]
///
/// [`prctl(PR_PAC_GET_ENABLED_KEYS,...)`]: https://www.kernel.org/doc/html/v5.18/arm64/pointer-authentication.html
#[inline]
@@ -1053,7 +1062,7 @@ const PR_PAC_SET_ENABLED_KEYS: c_int = 60;
/// Set enabled pointer authentication keys.
///
/// # References
-/// - [`prctl(PR_PAC_SET_ENABLED_KEYS,...)`]
+/// - [`prctl(PR_PAC_SET_ENABLED_KEYS,...)`]
///
/// # Safety
///
@@ -1102,7 +1111,7 @@ const PR_SET_VMA_ANON_NAME: usize = 0;
/// Set the name for a virtual memory region.
///
/// # References
-/// - [`prctl(PR_SET_VMA,PR_SET_VMA_ANON_NAME,...)`]
+/// - [`prctl(PR_SET_VMA,PR_SET_VMA_ANON_NAME,...)`]
///
/// [`prctl(PR_SET_VMA,PR_SET_VMA_ANON_NAME,...)`]: https://lwn.net/Articles/867818/
#[inline]
diff --git a/vendor/rustix/src/process/priority.rs b/vendor/rustix/src/process/priority.rs
index 4835ceaa2..f8d061c6b 100644
--- a/vendor/rustix/src/process/priority.rs
+++ b/vendor/rustix/src/process/priority.rs
@@ -1,7 +1,7 @@
use crate::process::{Pid, Uid};
use crate::{backend, io};
-/// `nice()`—Adjust the scheduling priority of the current process.
+/// `nice(inc)`—Adjust the scheduling priority of the current process.
///
/// # References
/// - [POSIX]
diff --git a/vendor/rustix/src/process/procctl.rs b/vendor/rustix/src/process/procctl.rs
index ff842513f..9e2b3c6e6 100644
--- a/vendor/rustix/src/process/procctl.rs
+++ b/vendor/rustix/src/process/procctl.rs
@@ -1,11 +1,14 @@
//! Bindings for the FreeBSD `procctl` system call.
//!
-//! There are similarities (but also differences) with Linux's `prctl` system call, whose interface
-//! is located in the `prctl.rs` file.
+//! There are similarities (but also differences) with Linux's `prctl` system
+//! call, whose interface is located in the `prctl.rs` file.
#![allow(unsafe_code)]
use core::mem::MaybeUninit;
+use core::ptr;
+
+use bitflags::bitflags;
use crate::backend::c::{c_int, c_uint, c_void};
use crate::backend::process::syscalls;
@@ -28,9 +31,10 @@ pub enum IdType {
/// A process selector for use with the `procctl` interface.
///
-/// `None` represents the current process. `Some((IdType::Pid, pid))` represents the process
-/// with pid `pid`. `Some((IdType::Pgid, pgid))` represents the control processes belonging to
-/// the process group with id `pgid`.
+/// `None` represents the current process. `Some((IdType::Pid, pid))`
+/// represents the process with pid `pid`. `Some((IdType::Pgid, pgid))`
+/// represents the control processes belonging to the process group with id
+/// `pgid`.
pub type ProcSelector = Option<(IdType, Pid)>;
fn proc_selector_to_raw(selector: ProcSelector) -> (IdType, RawPid) {
match selector {
@@ -77,8 +81,8 @@ const PROC_PDEATHSIG_STATUS: c_int = 12;
/// Get the current value of the parent process death signal.
///
/// # References
-/// - [Linux: `prctl(PR_GET_PDEATHSIG,...)`]
-/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
+/// - [Linux: `prctl(PR_GET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]
///
/// [Linux: `prctl(PR_GET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
@@ -92,8 +96,8 @@ const PROC_PDEATHSIG_CTL: c_int = 11;
/// Set the parent-death signal of the calling process.
///
/// # References
-/// - [Linux: `prctl(PR_SET_PDEATHSIG,...)`]
-/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
+/// - [Linux: `prctl(PR_SET_PDEATHSIG,...)`]
+/// - [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]
///
/// [Linux: `prctl(PR_SET_PDEATHSIG,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
@@ -125,16 +129,18 @@ pub enum DumpableBehavior {
NotDumpableExecPreserved = PROC_TRACE_CTL_DISABLE_EXEC,
}
-/// Set the state of the `dumpable` attribute for the process indicated by `idtype` and `id`.
-/// This determines whether the process can be traced and whether core dumps are produced for
-/// the process upon delivery of a signal whose default behavior is to produce a core dump.
+/// Set the state of the `dumpable` attribute for the process indicated by
+/// `idtype` and `id`. This determines whether the process can be traced and
+/// whether core dumps are produced for the process upon delivery of a signal
+/// whose default behavior is to produce a core dump.
///
-/// This is similar to `set_dumpable_behavior` on Linux, with the exception that on FreeBSD
-/// there is an extra argument `process`. When `process` is set to `None`, the operation is
-/// performed for the current process, like on Linux.
+/// This is similar to `set_dumpable_behavior` on Linux, with the exception
+/// that on FreeBSD there is an extra argument `process`. When `process` is set
+/// to `None`, the operation is performed for the current process, like on
+/// Linux.
///
/// # References
-/// - [`procctl(PROC_TRACE_CTL,...)`]
+/// - [`procctl(PROC_TRACE_CTL,...)`]
///
/// [`procctl(PROC_TRACE_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
@@ -153,17 +159,18 @@ const PROC_TRACE_STATUS: c_int = 8;
pub enum TracingStatus {
/// Tracing is disabled for the process.
NotTraceble,
- /// Tracing is not disabled for the process, but not debugger/tracer is attached.
+ /// Tracing is not disabled for the process, but not debugger/tracer is
+ /// attached.
Tracable,
- /// The process is being traced by the process whose pid is stored in the first
- /// component of this variant.
+ /// The process is being traced by the process whose pid is stored in the
+ /// first component of this variant.
BeingTraced(Pid),
}
/// Get the tracing status of the process indicated by `idtype` and `id`.
///
/// # References
-/// - [`procctl(PROC_TRACE_STATUS,...)`]
+/// - [`procctl(PROC_TRACE_STATUS,...)`]
///
/// [`procctl(PROC_TRACE_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
#[inline]
@@ -178,3 +185,336 @@ pub fn trace_status(process: ProcSelector) -> io::Result<TracingStatus> {
}
}
}
+
+//
+// PROC_REAP_*
+//
+
+const PROC_REAP_ACQUIRE: c_int = 2;
+const PROC_REAP_RELEASE: c_int = 3;
+
+/// Acquire or release the reaper status of the calling process.
+///
+/// # References
+/// - [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]
+///
+/// [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn set_reaper_status(reaper: bool) -> io::Result<()> {
+ unsafe {
+ procctl(
+ if reaper {
+ PROC_REAP_ACQUIRE
+ } else {
+ PROC_REAP_RELEASE
+ },
+ None,
+ ptr::null_mut(),
+ )
+ }
+}
+
+const PROC_REAP_STATUS: c_int = 4;
+
+bitflags! {
+ /// `REAPER_STATUS_*`.
+ pub struct ReaperStatusFlags: c_uint {
+ /// The process has acquired reaper status.
+ const OWNED = 1;
+ /// The process is the root of the reaper tree (pid 1).
+ const REALINIT = 2;
+ }
+}
+
+#[repr(C)]
+struct procctl_reaper_status {
+ rs_flags: c_uint,
+ rs_children: c_uint,
+ rs_descendants: c_uint,
+ rs_reaper: RawPid,
+ rs_pid: RawPid,
+ rs_pad0: [c_uint; 15],
+}
+
+/// Reaper status as returned by [`get_reaper_status`].
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct ReaperStatus {
+ /// The flags.
+ pub flags: ReaperStatusFlags,
+ /// The number of children of the reaper among the descendants.
+ pub children: usize,
+ /// The total number of descendants of the reaper(s), not counting
+ /// descendants of the reaper in the subtree.
+ pub descendants: usize,
+ /// The pid of the reaper for the specified process id.
+ pub reaper: Pid,
+ /// The pid of one reaper child if there are any descendants.
+ pub pid: Pid,
+}
+
+/// Get information about the reaper of the specified process (or the process
+/// itself if it is a reaper).
+///
+/// # References
+/// - [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]
+///
+/// [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn get_reaper_status(process: ProcSelector) -> io::Result<ReaperStatus> {
+ let raw = unsafe { procctl_get_optional::<procctl_reaper_status>(PROC_REAP_STATUS, process) }?;
+ Ok(ReaperStatus {
+ flags: ReaperStatusFlags::from_bits_truncate(raw.rs_flags),
+ children: raw.rs_children as _,
+ descendants: raw.rs_descendants as _,
+ reaper: unsafe { Pid::from_raw(raw.rs_reaper) }.ok_or(io::Errno::RANGE)?,
+ pid: unsafe { Pid::from_raw(raw.rs_pid) }.ok_or(io::Errno::RANGE)?,
+ })
+}
+
+const PROC_REAP_GETPIDS: c_int = 5;
+
+bitflags! {
+ /// `REAPER_PIDINFO_*`.
+ pub struct PidInfoFlags: c_uint {
+ /// This structure was filled by the kernel.
+ const VALID = 1;
+ /// The pid field identifies a direct child of the reaper.
+ const CHILD = 2;
+ /// The reported process is itself a reaper. Descendants of a subordinate reaper are not reported.
+ const REAPER = 4;
+ }
+}
+
+#[repr(C)]
+#[derive(Default, Clone)]
+struct procctl_reaper_pidinfo {
+ pi_pid: RawPid,
+ pi_subtree: RawPid,
+ pi_flags: c_uint,
+ pi_pad0: [c_uint; 15],
+}
+
+#[repr(C)]
+struct procctl_reaper_pids {
+ rp_count: c_uint,
+ rp_pad0: [c_uint; 15],
+ rp_pids: *mut procctl_reaper_pidinfo,
+}
+
+/// A child process of a reaper.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct PidInfo {
+ /// The flags of the process.
+ pub flags: PidInfoFlags,
+ /// The pid of the process.
+ pub pid: Pid,
+ /// The pid of the child of the reaper which is the (grand-..)parent of the
+ /// process.
+ pub subtree: Pid,
+}
+
+/// Get the list of descendants of the specified reaper process.
+///
+/// # References
+/// - [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]
+///
+/// [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+pub fn get_reaper_pids(process: ProcSelector) -> io::Result<Vec<PidInfo>> {
+ // Sadly no better way to guarantee that we get all the results than to
+ // allocate ~8MB of memory..
+ const PID_MAX: usize = 99999;
+ let mut pids: Vec<procctl_reaper_pidinfo> = vec![Default::default(); PID_MAX];
+ let mut pinfo = procctl_reaper_pids {
+ rp_count: PID_MAX as _,
+ rp_pad0: [0; 15],
+ rp_pids: pids.as_mut_slice().as_mut_ptr(),
+ };
+ unsafe {
+ procctl(
+ PROC_REAP_GETPIDS,
+ process,
+ (&mut pinfo as *mut procctl_reaper_pids).cast(),
+ )?
+ };
+ let mut result = Vec::new();
+ for raw in pids.into_iter() {
+ let flags = PidInfoFlags::from_bits_truncate(raw.pi_flags);
+ if !flags.contains(PidInfoFlags::VALID) {
+ break;
+ }
+ result.push(PidInfo {
+ flags,
+ subtree: unsafe { Pid::from_raw(raw.pi_subtree) }.ok_or(io::Errno::RANGE)?,
+ pid: unsafe { Pid::from_raw(raw.pi_pid) }.ok_or(io::Errno::RANGE)?,
+ });
+ }
+ Ok(result)
+}
+
+const PROC_REAP_KILL: c_int = 6;
+
+bitflags! {
+ /// `REAPER_KILL_*`.
+ struct KillFlags: c_uint {
+ const CHILDREN = 1;
+ const SUBTREE = 2;
+ }
+}
+
+#[repr(C)]
+struct procctl_reaper_kill {
+ rk_sig: c_int,
+ rk_flags: c_uint,
+ rk_subtree: RawPid,
+ rk_killed: c_uint,
+ rk_fpid: RawPid,
+ rk_pad0: [c_uint; 15],
+}
+
+/// Reaper status as returned by [`get_reaper_status`].
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+pub struct KillResult {
+ /// The number of processes that were signalled.
+ pub killed: usize,
+ /// The pid of the first process that wasn't successfully signalled.
+ pub first_failed: Option<Pid>,
+}
+
+/// Deliver a signal to some subset of
+///
+/// # References
+/// - [FreeBSD: `procctl(PROC_REAP_KILL,...)`]
+///
+/// [FreeBSD: `procctl(PROC_REAP_KILL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+pub fn reaper_kill(
+ process: ProcSelector,
+ signal: Signal,
+ direct_children: bool,
+ subtree: Option<Pid>,
+) -> io::Result<KillResult> {
+ let mut flags = KillFlags::empty();
+ flags.set(KillFlags::CHILDREN, direct_children);
+ flags.set(KillFlags::SUBTREE, subtree.is_some());
+ let mut req = procctl_reaper_kill {
+ rk_sig: signal as c_int,
+ rk_flags: flags.bits(),
+ rk_subtree: subtree.map(|p| p.as_raw_nonzero().into()).unwrap_or(0),
+ rk_killed: 0,
+ rk_fpid: 0,
+ rk_pad0: [0; 15],
+ };
+ unsafe {
+ procctl(
+ PROC_REAP_KILL,
+ process,
+ (&mut req as *mut procctl_reaper_kill).cast(),
+ )?
+ };
+ Ok(KillResult {
+ killed: req.rk_killed as _,
+ first_failed: if req.rk_fpid == -1 {
+ None
+ } else {
+ unsafe { Pid::from_raw(req.rk_fpid) }
+ },
+ })
+}
+
+//
+// PROC_TRAPCAP_STATUS/PROC_TRAPCAP_CTL
+//
+
+const PROC_TRAPCAP_CTL: c_int = 9;
+
+const PROC_TRAPCAP_CTL_ENABLE: i32 = 1;
+const PROC_TRAPCAP_CTL_DISABLE: i32 = 2;
+
+/// `PROC_TRAPCAP_CTL_*`.
+#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[repr(i32)]
+pub enum TrapCapBehavior {
+ /// Disable the SIGTRAP signal delivery on capability mode access
+ /// violations.
+ Disable = PROC_TRAPCAP_CTL_DISABLE,
+ /// Enable the SIGTRAP signal delivery on capability mode access
+ /// violations.
+ Enable = PROC_TRAPCAP_CTL_ENABLE,
+}
+
+/// Set the current value of the capability mode violation trapping behavior.
+/// If this behavior is enabled, the kernel would deliver a SIGTRAP signal on
+/// any return from a system call that would result in a `ENOTCAPABLE` or
+/// `ECAPMODE` error.
+///
+/// This behavior is inherited by the children of the process and is kept
+/// across `execve` calls.
+///
+/// # References
+/// - [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]
+///
+/// [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn set_trap_cap_behavior(process: ProcSelector, config: TrapCapBehavior) -> io::Result<()> {
+ let config = config as c_int;
+ unsafe { procctl_set::<c_int>(PROC_TRAPCAP_CTL, process, &config) }
+}
+
+const PROC_TRAPCAP_STATUS: c_int = 10;
+
+/// Get the current value of the capability mode violation trapping behavior.
+///
+/// # References
+/// - [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]
+///
+/// [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn trap_cap_behavior(process: ProcSelector) -> io::Result<TrapCapBehavior> {
+ let val = unsafe { procctl_get_optional::<c_int>(PROC_TRAPCAP_STATUS, process) }?;
+ match val {
+ PROC_TRAPCAP_CTL_DISABLE => Ok(TrapCapBehavior::Disable),
+ PROC_TRAPCAP_CTL_ENABLE => Ok(TrapCapBehavior::Enable),
+ _ => Err(io::Errno::RANGE),
+ }
+}
+
+//
+// PROC_NO_NEW_PRIVS_STATUS/PROC_NO_NEW_PRIVS_CTL
+//
+
+const PROC_NO_NEW_PRIVS_CTL: c_int = 19;
+
+const PROC_NO_NEW_PRIVS_ENABLE: c_int = 1;
+
+/// Enable the `no_new_privs` mode that ignores SUID and SGID bits
+/// on `execve` in the specified process and its future descendants.
+///
+/// This is similar to `set_no_new_privs` on Linux, with the exception
+/// that on FreeBSD there is no argument `no_new_privs` argument as it's
+/// only possible to enable this mode and there's no going back.
+///
+/// # References
+/// - [Linux: `prctl(PR_SET_NO_NEW_PRIVS,...)`]
+/// - [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_CTL,...)`]
+///
+/// [Linux: `prctl(PR_SET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn set_no_new_privs(process: ProcSelector) -> io::Result<()> {
+ unsafe { procctl_set::<c_int>(PROC_NO_NEW_PRIVS_CTL, process, &PROC_NO_NEW_PRIVS_ENABLE) }
+}
+
+const PROC_NO_NEW_PRIVS_STATUS: c_int = 20;
+
+/// Check the `no_new_privs` mode of the specified process.
+///
+/// # References
+/// - [Linux: `prctl(PR_GET_NO_NEW_PRIVS,...)`]
+/// - [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_STATUS,...)`]
+///
+/// [Linux: `prctl(PR_GET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2
+#[inline]
+pub fn no_new_privs(process: ProcSelector) -> io::Result<bool> {
+ unsafe { procctl_get_optional::<c_int>(PROC_NO_NEW_PRIVS_STATUS, process) }
+ .map(|x| x == PROC_NO_NEW_PRIVS_ENABLE)
+}
diff --git a/vendor/rustix/src/process/rlimit.rs b/vendor/rustix/src/process/rlimit.rs
index e8216af79..089f6b4bb 100644
--- a/vendor/rustix/src/process/rlimit.rs
+++ b/vendor/rustix/src/process/rlimit.rs
@@ -8,9 +8,9 @@ pub use backend::process::types::Resource;
/// [`setrlimit`], and [`prlimit`].
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Rlimit {
- /// Current effective, "soft", limit.
+ /// Current effective, “soft”, limit.
pub current: Option<u64>,
- /// Maximum, "hard", value that `current` may be dynamically increased to.
+ /// Maximum, “hard”, value that `current` may be dynamically increased to.
pub maximum: Option<u64>,
}
diff --git a/vendor/rustix/src/process/umask.rs b/vendor/rustix/src/process/umask.rs
new file mode 100644
index 000000000..7d83d6686
--- /dev/null
+++ b/vendor/rustix/src/process/umask.rs
@@ -0,0 +1,21 @@
+//! Umask support.
+
+#[cfg(feature = "fs")]
+use crate::backend;
+#[cfg(feature = "fs")]
+use crate::fs::Mode;
+
+/// `umask(mask)`—Set the process file creation mask.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/umask.2.html
+#[inline]
+#[cfg_attr(doc_cfg, doc(cfg(feature = "fs")))]
+#[cfg(feature = "fs")]
+pub fn umask(mask: Mode) -> Mode {
+ backend::process::syscalls::umask(mask)
+}
diff --git a/vendor/rustix/src/process/uname.rs b/vendor/rustix/src/process/uname.rs
index 95dec2699..904532a99 100644
--- a/vendor/rustix/src/process/uname.rs
+++ b/vendor/rustix/src/process/uname.rs
@@ -65,7 +65,7 @@ impl Uname {
#[inline]
fn to_cstr<'a>(ptr: *const u8) -> &'a CStr {
- // Safety: Strings returned from the kernel are always NUL-terminated.
+ // SAFETY: Strings returned from the kernel are always NUL-terminated.
unsafe { CStr::from_ptr(ptr.cast()) }
}
}
diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs
index a4bd1b528..784e6627c 100644
--- a/vendor/rustix/src/process/wait.rs
+++ b/vendor/rustix/src/process/wait.rs
@@ -2,6 +2,9 @@ use crate::process::Pid;
use crate::{backend, io};
use bitflags::bitflags;
+#[cfg(target_os = "linux")]
+use crate::fd::BorrowedFd;
+
bitflags! {
/// Options for modifying the behavior of wait/waitpid
pub struct WaitOptions: u32 {
@@ -14,6 +17,23 @@ bitflags! {
}
}
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+bitflags! {
+ /// Options for modifying the behavior of waitid
+ pub struct WaitidOptions: u32 {
+ /// Return immediately if no child has exited.
+ const NOHANG = backend::process::wait::WNOHANG as _;
+ /// Return if a stopped child has been resumed by delivery of `SIGCONT`
+ const CONTINUED = backend::process::wait::WCONTINUED as _;
+ /// Wait for processed that have exited.
+ const EXITED = backend::process::wait::WEXITED as _;
+ /// Keep processed in a waitable state.
+ const NOWAIT = backend::process::wait::WNOWAIT as _;
+ /// Wait for processes that have been stopped.
+ const STOPPED = backend::process::wait::WSTOPPED as _;
+ }
+}
+
/// the status of the child processes the caller waited on
#[derive(Debug, Clone, Copy)]
pub struct WaitStatus(u32);
@@ -77,6 +97,33 @@ impl WaitStatus {
}
}
+/// The status of a process after calling [`waitid`].
+#[derive(Clone, Copy)]
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+pub struct WaitidStatus(pub(crate) backend::c::siginfo_t);
+
+/// The identifier to wait on in a call to [`waitid`].
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[derive(Debug, Clone)]
+#[non_exhaustive]
+pub enum WaitId<'a> {
+ /// Wait on all processes.
+ All,
+
+ /// Wait for a specific process ID.
+ Pid(Pid),
+
+ /// Wait for a specific process file descriptor.
+ #[cfg(target_os = "linux")]
+ PidFd(BorrowedFd<'a>),
+
+ /// Eat the lifetime for non-Linux platforms.
+ #[doc(hidden)]
+ #[cfg(not(target_os = "linux"))]
+ __EatLifetime(std::marker::PhantomData<&'a ()>),
+ // TODO(notgull): Once this crate has the concept of PGIDs, add a WaitId::Pgid
+}
+
/// `waitpid(pid, waitopts)`—Wait for a specific process to change state.
///
/// If the pid is `None`, the call will wait for any child process whose
@@ -127,3 +174,14 @@ pub fn waitpid(pid: Option<Pid>, waitopts: WaitOptions) -> io::Result<Option<Wai
pub fn wait(waitopts: WaitOptions) -> io::Result<Option<(Pid, WaitStatus)>> {
backend::process::syscalls::wait(waitopts)
}
+
+/// `waitid(_, _, _, opts)`—Wait for the specified child process to change
+/// state.
+#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))]
+#[inline]
+pub fn waitid<'a>(
+ id: impl Into<WaitId<'a>>,
+ options: WaitidOptions,
+) -> io::Result<Option<WaitidStatus>> {
+ backend::process::syscalls::waitid(id.into(), options)
+}
diff --git a/vendor/rustix/src/rand/mod.rs b/vendor/rustix/src/rand/mod.rs
index b8a1320a8..4a0936d6c 100644
--- a/vendor/rustix/src/rand/mod.rs
+++ b/vendor/rustix/src/rand/mod.rs
@@ -1,7 +1,7 @@
//! Random-related operations.
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
mod getrandom;
-#[cfg(any(linux_raw, all(libc, target_os = "linux")))]
+#[cfg(any(target_os = "android", target_os = "linux"))]
pub use getrandom::{getrandom, GetRandomFlags};
diff --git a/vendor/rustix/src/runtime.rs b/vendor/rustix/src/runtime.rs
index 84baeb463..af3c98ff9 100644
--- a/vendor/rustix/src/runtime.rs
+++ b/vendor/rustix/src/runtime.rs
@@ -65,7 +65,7 @@ pub unsafe fn set_tid_address(data: *mut c_void) -> Pid {
/// `prctl(PR_SET_NAME, name)`
///
/// # References
-/// - [Linux]: https://man7.org/linux/man-pages/man2/prctl.2.html
+/// - [Linux]
///
/// # Safety
///
diff --git a/vendor/rustix/src/termios/constants.rs b/vendor/rustix/src/termios/constants.rs
index e96f139eb..99b75c06e 100644
--- a/vendor/rustix/src/termios/constants.rs
+++ b/vendor/rustix/src/termios/constants.rs
@@ -1,692 +1,10 @@
use crate::backend;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B1000000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B1152000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B1500000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B2000000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B2500000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B3000000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B3500000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B4000000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd"
-)))]
-pub use backend::termios::types::B460800;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B500000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::B576000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd"
-)))]
-pub use backend::termios::types::B921600;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::BRKINT;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::BS0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::BS1;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::BSDLY;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
-)))]
-pub use backend::termios::types::CBAUD;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CBAUDEX;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
-)))]
-pub use backend::termios::types::CIBAUD;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CLOCAL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CMSPAR;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CR0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CR1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CR2;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CR3;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::CRDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CREAD;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::CRTSCTS;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CS5;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CS6;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CS7;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CS8;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CSIZE;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::CSTOPB;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ECHO;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::ECHOCTL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ECHOE;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ECHOK;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::ECHOKE;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ECHONL;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::ECHOPRT;
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::EXTA;
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::EXTB;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox"
-)))]
-pub use backend::termios::types::EXTPROC;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::FF0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::FF1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::FFDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::FLUSHO;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::HUPCL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ICRNL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::IEXTEN;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::IGNBRK;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::IGNCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::IGNPAR;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox"
-)))]
-pub use backend::termios::types::IMAXBEL;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::INLCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::INPCK;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ISIG;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ISTRIP;
-#[cfg(any(
- linux_raw,
- all(
- libc,
- any(target_os = "haiku", target_os = "illumos", target_os = "solaris"),
- )
-))]
-pub use backend::termios::types::IUCLC;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::IUTF8;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::IXANY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::IXOFF;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::IXON;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::NL0;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::NL1;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::NLDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::NOFLSH;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::OCRNL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
-)))]
-pub use backend::termios::types::OFDEL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
-)))]
-pub use backend::termios::types::OFILL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "redox",
-)))]
-pub use backend::termios::types::OLCUC;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ONLCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ONLRET;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::ONOCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::OPOST;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::PARENB;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::PARMRK;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::PARODD;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "redox")))]
-pub use backend::termios::types::PENDIN;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::TAB0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::TAB1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::TAB2;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::TAB3;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::TABDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos")))]
-pub use backend::termios::types::TOSTOP;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::VSWTC;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::VT0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::VT1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::VTDLY;
-#[cfg(any(linux_raw, all(libc, any(target_arch = "s390x", target_os = "haiku"))))]
-pub use backend::termios::types::XCASE;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
-)))]
-pub use backend::termios::types::XTABS;
-pub use backend::termios::types::{
- B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300, B38400, B4800,
- B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL, VMIN, VQUIT,
- VSTART, VSTOP, VSUSP, VTIME,
-};
-#[cfg(not(target_os = "haiku"))]
-pub use backend::termios::types::{VDISCARD, VLNEXT, VREPRINT, VWERASE};
+
+pub use backend::termios::types::*;
/// Translate from a `Speed` code to a speed value `u32`.
///
-/// ```rust
+/// ```
/// let speed = rustix::termios::speed_value(rustix::termios::B57600);
/// assert_eq!(speed, Some(57600));
/// ```
@@ -708,142 +26,73 @@ pub fn speed_value(speed: backend::termios::types::Speed) -> Option<u32> {
backend::termios::types::B9600 => Some(9600),
backend::termios::types::B19200 => Some(19200),
backend::termios::types::B38400 => Some(38400),
+ #[cfg(not(target_os = "aix"))]
backend::termios::types::B57600 => Some(57600),
+ #[cfg(not(target_os = "aix"))]
backend::termios::types::B115200 => Some(115_200),
+ #[cfg(not(target_os = "aix"))]
backend::termios::types::B230400 => Some(230_400),
#[cfg(not(any(
+ apple,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd"
)))]
backend::termios::types::B460800 => Some(460_800),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
backend::termios::types::B500000 => Some(500_000),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, solarish, target_os = "aix", target_os = "haiku")))]
backend::termios::types::B576000 => Some(576_000),
#[cfg(not(any(
+ apple,
+ target_os = "aix",
target_os = "dragonfly",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd"
)))]
backend::termios::types::B921600 => Some(921_600),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
backend::termios::types::B1000000 => Some(1_000_000),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
backend::termios::types::B1152000 => Some(1_152_000),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
backend::termios::types::B1500000 => Some(1_500_000),
- #[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- )))]
+ #[cfg(not(any(bsd, target_os = "aix", target_os = "haiku", target_os = "solaris")))]
backend::termios::types::B2000000 => Some(2_000_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
backend::termios::types::B2500000 => Some(2_500_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
backend::termios::types::B3000000 => Some(3_000_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
backend::termios::types::B3500000 => Some(3_500_000),
#[cfg(not(any(
target_arch = "sparc",
target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
+ bsd,
+ target_os = "aix",
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
target_os = "solaris",
)))]
backend::termios::types::B4000000 => Some(4_000_000),
diff --git a/vendor/rustix/src/termios/mod.rs b/vendor/rustix/src/termios/mod.rs
index 5c4cccca9..ffbb1b663 100644
--- a/vendor/rustix/src/termios/mod.rs
+++ b/vendor/rustix/src/termios/mod.rs
@@ -10,783 +10,10 @@ mod tc;
mod tty;
#[cfg(not(target_os = "wasi"))]
-pub use cf::{cfgetispeed, cfgetospeed, cfmakeraw, cfsetispeed, cfsetospeed, cfsetspeed};
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B1000000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B1152000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B1500000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B2000000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B2500000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B3000000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B3500000;
-#[cfg(not(any(
- target_arch = "sparc",
- target_arch = "sparc64",
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B4000000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "wasi",
-)))]
-pub use constants::B460800;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B500000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::B576000;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "wasi",
-)))]
-pub use constants::B921600;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::BRKINT;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::BS0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::BS1;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::BSDLY;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use constants::CBAUD;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CBAUDEX;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use constants::CIBAUD;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CLOCAL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CMSPAR;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CR0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CR1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CR2;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CR3;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::CRDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CREAD;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::CRTSCTS;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CS5;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CS6;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CS7;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CS8;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CSIZE;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::CSTOPB;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ECHO;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::ECHOCTL;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ECHOE;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ECHOK;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::ECHOKE;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ECHONL;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::ECHOPRT;
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::EXTA;
-#[cfg(not(any(
- target_os = "emscripten",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::EXTB;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use constants::EXTPROC;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::FF0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::FF1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::FFDLY;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::FLUSHO;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::HUPCL;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ICRNL;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::IEXTEN;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::IGNBRK;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::IGNCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::IGNPAR;
-#[cfg(not(any(
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use constants::IMAXBEL;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::INLCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::INPCK;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ISIG;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ISTRIP;
-#[cfg(any(
- linux_raw,
- all(
- libc,
- any(target_os = "haiku", target_os = "illumos", target_os = "solaris"),
- )
-))]
-pub use constants::IUCLC;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::IUTF8;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::IXANY;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::IXOFF;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::IXON;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::NL0;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::NL1;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::NLDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::NOFLSH;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::OCRNL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
-)))]
-pub use constants::OFDEL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "wasi",
-)))]
-pub use constants::OFILL;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use constants::OLCUC;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ONLCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ONLRET;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::ONOCR;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::OPOST;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::PARENB;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::PARMRK;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::PARODD;
-#[cfg(not(any(
- target_os = "ios",
- target_os = "macos",
- target_os = "redox",
- target_os = "wasi"
-)))]
-pub use constants::PENDIN;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::TAB0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::TAB1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::TAB2;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::TAB3;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "illumos",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::TABDLY;
-#[cfg(not(any(target_os = "ios", target_os = "macos", target_os = "wasi")))]
-pub use constants::TOSTOP;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::VSWTC;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::VT0;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "fuchsia",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::VT1;
-#[cfg(not(any(
- all(libc, target_env = "musl"),
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::VTDLY;
-#[cfg(any(linux_raw, all(libc, any(target_arch = "s390x", target_os = "haiku"))))]
-pub use constants::XCASE;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "illumos",
- target_os = "ios",
- target_os = "macos",
- target_os = "netbsd",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "solaris",
- target_os = "wasi",
-)))]
-pub use constants::XTABS;
+pub use cf::*;
#[cfg(not(target_os = "wasi"))]
-pub use constants::{
- speed_value, B0, B110, B115200, B1200, B134, B150, B1800, B19200, B200, B230400, B2400, B300,
- B38400, B4800, B50, B57600, B600, B75, B9600, ICANON, VEOF, VEOL, VEOL2, VERASE, VINTR, VKILL,
- VMIN, VQUIT, VSTART, VSTOP, VSUSP, VTIME,
-};
-#[cfg(not(any(target_os = "haiku", target_os = "wasi")))]
-pub use constants::{VDISCARD, VLNEXT, VREPRINT, VWERASE};
+pub use constants::*;
#[cfg(not(target_os = "wasi"))]
-pub use tc::{
- tcdrain, tcflow, tcflush, tcgetattr, tcgetpgrp, tcgetsid, tcgetwinsize, tcsendbreak, tcsetattr,
- tcsetpgrp, tcsetwinsize, Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios,
- Winsize,
-};
+pub use tc::*;
#[cfg(not(windows))]
-pub use tty::isatty;
-#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))]
-#[cfg(feature = "procfs")]
-pub use tty::ttyname;
+pub use tty::*;
diff --git a/vendor/rustix/src/termios/tc.rs b/vendor/rustix/src/termios/tc.rs
index e1a87b623..12f7f543c 100644
--- a/vendor/rustix/src/termios/tc.rs
+++ b/vendor/rustix/src/termios/tc.rs
@@ -2,6 +2,20 @@ use crate::fd::AsFd;
use crate::process::Pid;
use crate::{backend, io};
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub use backend::termios::types::Termios2;
pub use backend::termios::types::{
Action, OptionalActions, QueueSelector, Speed, Tcflag, Termios, Winsize,
};
@@ -25,6 +39,37 @@ pub fn tcgetattr<Fd: AsFd>(fd: Fd) -> io::Result<Termios> {
backend::termios::syscalls::tcgetattr(fd.as_fd())
}
+/// `tcgetattr2(fd)`—Get terminal attributes.
+///
+/// Also known as the `TCGETS2` operation with `ioctl`.
+///
+/// # References
+/// - [POSIX `tcgetattr`]
+/// - [Linux `ioctl_tty`]
+/// - [Linux `termios`]
+///
+/// [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
+#[inline]
+#[doc(alias = "TCGETS2")]
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub fn tcgetattr2<Fd: AsFd>(fd: Fd) -> io::Result<Termios2> {
+ backend::termios::syscalls::tcgetattr2(fd.as_fd())
+}
+
/// `tcgetwinsize(fd)`—Get the current terminal window size.
///
/// Also known as the `TIOCGWINSZ` operation with `ioctl`.
@@ -96,6 +141,41 @@ pub fn tcsetattr<Fd: AsFd>(
backend::termios::syscalls::tcsetattr(fd.as_fd(), optional_actions, termios)
}
+/// `tcsetattr2(fd)`—Set terminal attributes.
+///
+/// Also known as the `TCSETS2` operation with `ioctl`.
+///
+/// # References
+/// - [POSIX `tcsetattr`]
+/// - [Linux `ioctl_tty`]
+/// - [Linux `termios`]
+///
+/// [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
+#[inline]
+#[doc(alias = "TCSETS2")]
+#[cfg(all(
+ any(target_os = "android", target_os = "linux"),
+ any(
+ target_arch = "x86",
+ target_arch = "x86_64",
+ target_arch = "x32",
+ target_arch = "riscv64",
+ target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "mips",
+ target_arch = "mips64",
+ )
+))]
+pub fn tcsetattr2<Fd: AsFd>(
+ fd: Fd,
+ optional_actions: OptionalActions,
+ termios: &Termios2,
+) -> io::Result<()> {
+ backend::termios::syscalls::tcsetattr2(fd.as_fd(), optional_actions, termios)
+}
+
/// `tcsendbreak(fd, 0)`—Transmit zero-valued bits.
///
/// Also known as the `TCSBRK` operation with `ioctl`, with a duration of 0.
diff --git a/vendor/rustix/src/thread/clock.rs b/vendor/rustix/src/thread/clock.rs
index 57672fa17..620cb4ec0 100644
--- a/vendor/rustix/src/thread/clock.rs
+++ b/vendor/rustix/src/thread/clock.rs
@@ -3,11 +3,10 @@ use crate::{backend, io};
pub use backend::time::types::Timespec;
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
@@ -27,12 +26,11 @@ pub use backend::time::types::ClockId;
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_nanosleep.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
@@ -55,12 +53,11 @@ pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRel
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_nanosleep.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_nanosleep.2.html
#[cfg(not(any(
+ apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs
index 0d2fef026..59610ff03 100644
--- a/vendor/rustix/src/thread/id.rs
+++ b/vendor/rustix/src/thread/id.rs
@@ -1,5 +1,5 @@
-use crate::backend;
-use crate::process::Pid;
+use crate::process::{Gid, Pid, Uid};
+use crate::{backend, io};
/// `gettid()`—Returns the thread ID.
///
@@ -15,3 +15,97 @@ use crate::process::Pid;
pub fn gettid() -> Pid {
backend::thread::syscalls::gettid()
}
+
+/// `setuid(uid)`
+///
+/// # Warning
+///
+/// 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.
+///
+/// For details on this distinction, see the C library vs. kernel differences
+/// in the [man page][linux_notes]. This call implements the kernel behavior.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setuid.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/setuid.2.html
+/// [linux_notes]: https://man7.org/linux/man-pages/man2/setuid.2.html#NOTES
+#[inline]
+pub fn set_thread_uid(uid: Uid) -> io::Result<()> {
+ backend::thread::syscalls::setuid_thread(uid)
+}
+
+/// `setresuid(ruid, euid, suid)`
+///
+/// # Warning
+///
+/// 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.
+///
+/// For details on this distinction, see the C library vs. kernel differences
+/// in the [man page][linux_notes] and the notes in [`set_thread_uid`]. This
+/// call implements the kernel behavior.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/setresuid.2.html
+/// [linux_notes]: https://man7.org/linux/man-pages/man2/setresuid.2.html#NOTES
+#[inline]
+pub fn set_thread_res_uid(ruid: Uid, euid: Uid, suid: Uid) -> io::Result<()> {
+ backend::thread::syscalls::setresuid_thread(ruid, euid, suid)
+}
+
+/// `setgid(gid)`
+///
+/// # Warning
+///
+/// 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.
+///
+/// For details on this distinction, see the C library vs. kernel differences
+/// in the [man page][linux_notes]. This call implements the kernel behavior.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setgid.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/setgid.2.html
+/// [linux_notes]: https://man7.org/linux/man-pages/man2/setgid.2.html#NOTES
+#[inline]
+pub fn set_thread_gid(gid: Gid) -> io::Result<()> {
+ backend::thread::syscalls::setgid_thread(gid)
+}
+
+/// `setresgid(rgid, egid, sgid)`
+///
+/// # Warning
+///
+/// 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.
+///
+/// For details on this distinction, see the C library vs. kernel differences
+/// in the [man page][linux_notes] and the notes in [`set_thread_gid`]. This
+/// call implements the kernel behavior.
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/setresgid.2.html
+/// [linux_notes]: https://man7.org/linux/man-pages/man2/setresgid.2.html#NOTES
+#[inline]
+pub fn set_thread_res_gid(rgid: Gid, egid: Gid, sgid: Gid) -> io::Result<()> {
+ backend::thread::syscalls::setresgid_thread(rgid, egid, sgid)
+}
diff --git a/vendor/rustix/src/thread/libcap.rs b/vendor/rustix/src/thread/libcap.rs
new file mode 100644
index 000000000..f4798b8f4
--- /dev/null
+++ b/vendor/rustix/src/thread/libcap.rs
@@ -0,0 +1,187 @@
+use bitflags::bitflags;
+use core::mem::MaybeUninit;
+
+use crate::process::Pid;
+use crate::{backend, io};
+
+/// `__user_cap_data_struct`
+#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+pub struct CapabilitySets {
+ /// `__user_cap_data_struct.effective`
+ pub effective: CapabilityFlags,
+ /// `__user_cap_data_struct.permitted`
+ pub permitted: CapabilityFlags,
+ /// `__user_cap_data_struct.inheritable`
+ pub inheritable: CapabilityFlags,
+}
+
+bitflags! {
+ /// `CAP_*` constants.
+ pub struct CapabilityFlags: u64 {
+ /// `CAP_CHOWN`
+ const CHOWN = 1 << linux_raw_sys::general::CAP_CHOWN;
+ /// `CAP_DAC_OVERRIDE`
+ const DAC_OVERRIDE = 1 << linux_raw_sys::general::CAP_DAC_OVERRIDE;
+ /// `CAP_DAC_READ_SEARCH`
+ const DAC_READ_SEARCH = 1 << linux_raw_sys::general::CAP_DAC_READ_SEARCH;
+ /// `CAP_FOWNER`
+ const FOWNER = 1 << linux_raw_sys::general::CAP_FOWNER;
+ /// `CAP_FSETID`
+ const FSETID = 1 << linux_raw_sys::general::CAP_FSETID;
+ /// `CAP_KILL`
+ const KILL = 1 << linux_raw_sys::general::CAP_KILL;
+ /// `CAP_SETGID`
+ const SETGID = 1 << linux_raw_sys::general::CAP_SETGID;
+ /// `CAP_SETUID`
+ const SETUID = 1 << linux_raw_sys::general::CAP_SETUID;
+ /// `CAP_SETPCAP`
+ const SETPCAP = 1 << linux_raw_sys::general::CAP_SETPCAP;
+ /// `CAP_LINUX_IMMUTABLE`
+ const LINUX_IMMUTABLE = 1 << linux_raw_sys::general::CAP_LINUX_IMMUTABLE;
+ /// `CAP_NET_BIND_SERVICE`
+ const NET_BIND_SERVICE = 1 << linux_raw_sys::general::CAP_NET_BIND_SERVICE;
+ /// `CAP_NET_BROADCAST`
+ const NET_BROADCAST = 1 << linux_raw_sys::general::CAP_NET_BROADCAST;
+ /// `CAP_NET_ADMIN`
+ const NET_ADMIN = 1 << linux_raw_sys::general::CAP_NET_ADMIN;
+ /// `CAP_NET_RAW`
+ const NET_RAW = 1 << linux_raw_sys::general::CAP_NET_RAW;
+ /// `CAP_IPC_LOCK`
+ const IPC_LOCK = 1 << linux_raw_sys::general::CAP_IPC_LOCK;
+ /// `CAP_IPC_OWNER`
+ const IPC_OWNER = 1 << linux_raw_sys::general::CAP_IPC_OWNER;
+ /// `CAP_SYS_MODULE`
+ const SYS_MODULE = 1 << linux_raw_sys::general::CAP_SYS_MODULE;
+ /// `CAP_SYS_RAWIO`
+ const SYS_RAWIO = 1 << linux_raw_sys::general::CAP_SYS_RAWIO;
+ /// `CAP_SYS_CHROOT`
+ const SYS_CHROOT = 1 << linux_raw_sys::general::CAP_SYS_CHROOT;
+ /// `CAP_SYS_PTRACE`
+ const SYS_PTRACE = 1 << linux_raw_sys::general::CAP_SYS_PTRACE;
+ /// `CAP_SYS_PACCT`
+ const SYS_PACCT = 1 << linux_raw_sys::general::CAP_SYS_PACCT;
+ /// `CAP_SYS_ADMIN`
+ const SYS_ADMIN = 1 << linux_raw_sys::general::CAP_SYS_ADMIN;
+ /// `CAP_SYS_BOOT`
+ const SYS_BOOT = 1 << linux_raw_sys::general::CAP_SYS_BOOT;
+ /// `CAP_SYS_NICE`
+ const SYS_NICE = 1 << linux_raw_sys::general::CAP_SYS_NICE;
+ /// `CAP_SYS_RESOURCE`
+ const SYS_RESOURCE = 1 << linux_raw_sys::general::CAP_SYS_RESOURCE;
+ /// `CAP_SYS_TIME`
+ const SYS_TIME = 1 << linux_raw_sys::general::CAP_SYS_TIME;
+ /// `CAP_SYS_TTY_CONFIG`
+ const SYS_TTY_CONFIG = 1 << linux_raw_sys::general::CAP_SYS_TTY_CONFIG;
+ /// `CAP_MKNOD`
+ const MKNOD = 1 << linux_raw_sys::general::CAP_MKNOD;
+ /// `CAP_LEASE`
+ const LEASE = 1 << linux_raw_sys::general::CAP_LEASE;
+ /// `CAP_AUDIT_WRITE`
+ const AUDIT_WRITE = 1 << linux_raw_sys::general::CAP_AUDIT_WRITE;
+ /// `CAP_AUDIT_CONTROL`
+ const AUDIT_CONTROL = 1 << linux_raw_sys::general::CAP_AUDIT_CONTROL;
+ /// `CAP_SETFCAP`
+ const SETFCAP = 1 << linux_raw_sys::general::CAP_SETFCAP;
+ /// `CAP_MAC_OVERRIDE`
+ const MAC_OVERRIDE = 1 << linux_raw_sys::general::CAP_MAC_OVERRIDE;
+ /// `CAP_MAC_ADMIN`
+ const MAC_ADMIN = 1 << linux_raw_sys::general::CAP_MAC_ADMIN;
+ /// `CAP_SYSLOG`
+ const SYSLOG = 1 << linux_raw_sys::general::CAP_SYSLOG;
+ /// `CAP_WAKE_ALARM`
+ const WAKE_ALARM = 1 << linux_raw_sys::general::CAP_WAKE_ALARM;
+ /// `CAP_BLOCK_SUSPEND`
+ const BLOCK_SUSPEND = 1 << linux_raw_sys::general::CAP_BLOCK_SUSPEND;
+ /// `CAP_AUDIT_READ`
+ const AUDIT_READ = 1 << linux_raw_sys::general::CAP_AUDIT_READ;
+ /// `CAP_PERFMON`
+ const PERFMON = 1 << linux_raw_sys::general::CAP_PERFMON;
+ /// `CAP_BPF`
+ const BPF = 1 << linux_raw_sys::general::CAP_BPF;
+ /// `CAP_CHECKPOINT_RESTORE`
+ const CHECKPOINT_RESTORE = 1 << linux_raw_sys::general::CAP_CHECKPOINT_RESTORE;
+ }
+}
+
+/// `capget(_LINUX_CAPABILITY_VERSION_3, pid)`
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/capget.2.html
+#[inline]
+#[doc(alias = "capget")]
+pub fn capabilities(pid: Option<Pid>) -> io::Result<CapabilitySets> {
+ capget(pid)
+}
+
+/// `capset(_LINUX_CAPABILITY_VERSION_3, pid, effective, permitted,
+/// inheritable)`
+///
+/// # References
+/// - [Linux]
+///
+/// [Linux]: https://man7.org/linux/man-pages/man2/capget.2.html
+#[inline]
+#[doc(alias = "capset")]
+pub fn set_capabilities(pid: Option<Pid>, sets: CapabilitySets) -> io::Result<()> {
+ capset(pid, sets)
+}
+
+#[inline]
+#[allow(unsafe_code)]
+fn capget(pid: Option<Pid>) -> io::Result<CapabilitySets> {
+ let mut data = [MaybeUninit::<linux_raw_sys::general::__user_cap_data_struct>::uninit(); 2];
+
+ let data = {
+ let mut header = linux_raw_sys::general::__user_cap_header_struct {
+ version: linux_raw_sys::general::_LINUX_CAPABILITY_VERSION_3,
+ pid: Pid::as_raw(pid) as backend::c::c_int,
+ };
+
+ backend::thread::syscalls::capget(&mut header, &mut data)?;
+ // SAFETY: v3 is a 64-bit implementation, so the kernel filled in both data
+ // structs.
+ unsafe { (data[0].assume_init(), data[1].assume_init()) }
+ };
+
+ {
+ // TODO: With Rust 1.53, we can use u32::BITS in the shifts.
+ const BITS: u32 = 32;
+ let effective = u64::from(data.0.effective) | (u64::from(data.1.effective) << BITS);
+ let permitted = u64::from(data.0.permitted) | (u64::from(data.1.permitted) << BITS);
+ let inheritable = u64::from(data.0.inheritable) | (u64::from(data.1.inheritable) << BITS);
+
+ // SAFETY: the kernel returns a partitioned bitset that we just combined above
+ Ok(CapabilitySets {
+ effective: unsafe { CapabilityFlags::from_bits_unchecked(effective) },
+ permitted: unsafe { CapabilityFlags::from_bits_unchecked(permitted) },
+ inheritable: unsafe { CapabilityFlags::from_bits_unchecked(inheritable) },
+ })
+ }
+}
+
+#[inline]
+fn capset(pid: Option<Pid>, sets: CapabilitySets) -> io::Result<()> {
+ // TODO: With Rust 1.53, we can use u32::BITS in the shifts.
+ const BITS: u32 = 32;
+
+ let mut header = linux_raw_sys::general::__user_cap_header_struct {
+ version: linux_raw_sys::general::_LINUX_CAPABILITY_VERSION_3,
+ pid: Pid::as_raw(pid) as backend::c::c_int,
+ };
+ let data = [
+ linux_raw_sys::general::__user_cap_data_struct {
+ effective: sets.effective.bits() as u32,
+ permitted: sets.permitted.bits() as u32,
+ inheritable: sets.inheritable.bits() as u32,
+ },
+ linux_raw_sys::general::__user_cap_data_struct {
+ effective: (sets.effective.bits() >> BITS) as u32,
+ permitted: (sets.permitted.bits() >> BITS) as u32,
+ inheritable: (sets.inheritable.bits() >> BITS) as u32,
+ },
+ ];
+
+ backend::thread::syscalls::capset(&mut header, &data)
+}
diff --git a/vendor/rustix/src/thread/mod.rs b/vendor/rustix/src/thread/mod.rs
index b1dc849d9..86f231bcb 100644
--- a/vendor/rustix/src/thread/mod.rs
+++ b/vendor/rustix/src/thread/mod.rs
@@ -7,28 +7,20 @@ mod futex;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod id;
#[cfg(any(target_os = "android", target_os = "linux"))]
+mod libcap;
+#[cfg(any(target_os = "android", target_os = "linux"))]
mod prctl;
#[cfg(any(target_os = "android", target_os = "linux"))]
mod setns;
-#[cfg(not(any(
- target_os = "dragonfly",
- target_os = "emscripten",
- target_os = "freebsd",
- target_os = "haiku",
- target_os = "ios",
- target_os = "macos",
- target_os = "openbsd",
- target_os = "redox",
- target_os = "wasi",
-)))]
-pub use clock::{clock_nanosleep_absolute, clock_nanosleep_relative, ClockId};
#[cfg(not(target_os = "redox"))]
-pub use clock::{nanosleep, NanosleepRelativeResult, Timespec};
+pub use clock::*;
#[cfg(linux_raw)]
pub use futex::{futex, FutexFlags, FutexOperation};
#[cfg(any(target_os = "android", target_os = "linux"))]
-pub use id::gettid;
+pub use id::{gettid, set_thread_gid, set_thread_res_gid, set_thread_res_uid, set_thread_uid};
+#[cfg(any(target_os = "android", target_os = "linux"))]
+pub use libcap::{capabilities, set_capabilities, CapabilityFlags, CapabilitySets};
#[cfg(any(target_os = "android", target_os = "linux"))]
pub use prctl::*;
#[cfg(any(target_os = "android", target_os = "linux"))]
diff --git a/vendor/rustix/src/thread/prctl.rs b/vendor/rustix/src/thread/prctl.rs
index a2191f7c3..f1ddf7d36 100644
--- a/vendor/rustix/src/thread/prctl.rs
+++ b/vendor/rustix/src/thread/prctl.rs
@@ -1,3 +1,12 @@
+//! Linux `prctl` wrappers.
+//!
+//! Rustix wraps variadic/dynamic-dispatch functions like `prctl` in
+//! type-safe wrappers.
+//!
+//! # Safety
+//!
+//! The inner `prctl` calls are dynamically typed and must be called
+//! correctly.
#![allow(unsafe_code)]
use core::convert::TryFrom;
@@ -27,7 +36,7 @@ const PR_GET_KEEPCAPS: c_int = 7;
/// Get the current state of the calling thread's `keep capabilities` flag.
///
/// # References
-/// - [`prctl(PR_GET_KEEPCAPS,...)`]
+/// - [`prctl(PR_GET_KEEPCAPS,...)`]
///
/// [`prctl(PR_GET_KEEPCAPS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -40,7 +49,7 @@ const PR_SET_KEEPCAPS: c_int = 8;
/// Set the state of the calling thread's `keep capabilities` flag.
///
/// # References
-/// - [`prctl(PR_SET_KEEPCAPS,...)`]
+/// - [`prctl(PR_SET_KEEPCAPS,...)`]
///
/// [`prctl(PR_SET_KEEPCAPS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -57,7 +66,7 @@ const PR_GET_NAME: c_int = 16;
/// Get the name of the calling thread.
///
/// # References
-/// - [`prctl(PR_GET_NAME,...)`]
+/// - [`prctl(PR_GET_NAME,...)`]
///
/// [`prctl(PR_GET_NAME,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -74,7 +83,7 @@ const PR_SET_NAME: c_int = 15;
/// Set the name of the calling thread.
///
/// # References
-/// - [`prctl(PR_SET_NAME,...)`]
+/// - [`prctl(PR_SET_NAME,...)`]
///
/// [`prctl(PR_SET_NAME,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -131,7 +140,7 @@ impl TryFrom<i32> for SecureComputingMode {
/// of obtaining the same information, without the risk that the process is killed; see `proc(5)`.
///
/// # References
-/// - [`prctl(PR_GET_SECCOMP,...)`]
+/// - [`prctl(PR_GET_SECCOMP,...)`]
///
/// [`prctl(PR_GET_SECCOMP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -142,10 +151,11 @@ pub fn secure_computing_mode() -> io::Result<SecureComputingMode> {
const PR_SET_SECCOMP: c_int = 22;
-/// Set the secure computing mode for the calling thread, to limit the available system calls.
+/// Set the secure computing mode for the calling thread, to limit the
+/// available system calls.
///
/// # References
-/// - [`prctl(PR_SET_SECCOMP,...)`]
+/// - [`prctl(PR_SET_SECCOMP,...)`]
///
/// [`prctl(PR_SET_SECCOMP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -159,249 +169,234 @@ pub fn set_secure_computing_mode(mode: SecureComputingMode) -> io::Result<()> {
const PR_CAPBSET_READ: c_int = 23;
-const CAP_CHOWN: u32 = 0;
-const CAP_DAC_OVERRIDE: u32 = 1;
-const CAP_DAC_READ_SEARCH: u32 = 2;
-const CAP_FOWNER: u32 = 3;
-const CAP_FSETID: u32 = 4;
-const CAP_KILL: u32 = 5;
-const CAP_SETGID: u32 = 6;
-const CAP_SETUID: u32 = 7;
-const CAP_SETPCAP: u32 = 8;
-const CAP_LINUX_IMMUTABLE: u32 = 9;
-const CAP_NET_BIND_SERVICE: u32 = 10;
-const CAP_NET_BROADCAST: u32 = 11;
-const CAP_NET_ADMIN: u32 = 12;
-const CAP_NET_RAW: u32 = 13;
-const CAP_IPC_LOCK: u32 = 14;
-const CAP_IPC_OWNER: u32 = 15;
-const CAP_SYS_MODULE: u32 = 16;
-const CAP_SYS_RAWIO: u32 = 17;
-const CAP_SYS_CHROOT: u32 = 18;
-const CAP_SYS_PTRACE: u32 = 19;
-const CAP_SYS_PACCT: u32 = 20;
-const CAP_SYS_ADMIN: u32 = 21;
-const CAP_SYS_BOOT: u32 = 22;
-const CAP_SYS_NICE: u32 = 23;
-const CAP_SYS_RESOURCE: u32 = 24;
-const CAP_SYS_TIME: u32 = 25;
-const CAP_SYS_TTY_CONFIG: u32 = 26;
-const CAP_MKNOD: u32 = 27;
-const CAP_LEASE: u32 = 28;
-const CAP_AUDIT_WRITE: u32 = 29;
-const CAP_AUDIT_CONTROL: u32 = 30;
-const CAP_SETFCAP: u32 = 31;
-const CAP_MAC_OVERRIDE: u32 = 32;
-const CAP_MAC_ADMIN: u32 = 33;
-const CAP_SYSLOG: u32 = 34;
-const CAP_WAKE_ALARM: u32 = 35;
-const CAP_BLOCK_SUSPEND: u32 = 36;
-const CAP_AUDIT_READ: u32 = 37;
-const CAP_PERFMON: u32 = 38;
-const CAP_BPF: u32 = 39;
-const CAP_CHECKPOINT_RESTORE: u32 = 40;
-
/// Linux per-thread capability.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u32)]
pub enum Capability {
- /// In a system with the `_POSIX_CHOWN_RESTRICTED` option defined, this overrides
- /// the restriction of changing file ownership and group ownership.
- ChangeOwnership = CAP_CHOWN,
- /// Override all DAC access, including ACL execute access if `_POSIX_ACL` is defined.
+ /// In a system with the `_POSIX_CHOWN_RESTRICTED` option defined, this
+ /// overrides the restriction of changing file ownership and group
+ /// ownership.
+ ChangeOwnership = linux_raw_sys::general::CAP_CHOWN,
+ /// Override all DAC access, including ACL execute access if `_POSIX_ACL`
+ /// is defined. Excluding DAC access covered by
+ /// [`Capability::LinuxImmutable`].
+ DACOverride = linux_raw_sys::general::CAP_DAC_OVERRIDE,
+ /// Overrides all DAC restrictions regarding read and search on files and
+ /// directories, including ACL restrictions if `_POSIX_ACL` is defined.
/// Excluding DAC access covered by [`Capability::LinuxImmutable`].
- DACOverride = CAP_DAC_OVERRIDE,
- /// Overrides all DAC restrictions regarding read and search on files and directories,
- /// including ACL restrictions if `_POSIX_ACL` is defined. Excluding DAC access covered
- /// by [`Capability::LinuxImmutable`].
- DACReadSearch = CAP_DAC_READ_SEARCH,
- /// Overrides all restrictions about allowed operations on files, where file owner ID must be
- /// equal to the user ID, except where [`Capability::FileSetID`] is applicable.
- /// It doesn't override MAC and DAC restrictions.
- FileOwner = CAP_FOWNER,
- /// Overrides the following restrictions that the effective user ID shall match the file owner
- /// ID when setting the `S_ISUID` and `S_ISGID` bits on that file; that the effective group ID
- /// (or one of the supplementary group IDs) shall match the file owner ID when setting the
- /// `S_ISGID` bit on that file; that the `S_ISUID` and `S_ISGID` bits are cleared on successful
- /// return from `chown` (not implemented).
- FileSetID = CAP_FSETID,
- /// Overrides the restriction that the real or effective user ID of a process sending a signal
- /// must match the real or effective user ID of the process receiving the signal.
- Kill = CAP_KILL,
- /// Allows `setgid` manipulation. Allows `setgroups`. Allows forged gids on socket
- /// credentials passing.
- SetGroupID = CAP_SETGID,
- /// Allows `set*uid` manipulation (including fsuid). Allows forged pids on socket
- /// credentials passing.
- SetUserID = CAP_SETUID,
+ DACReadSearch = linux_raw_sys::general::CAP_DAC_READ_SEARCH,
+ /// Overrides all restrictions about allowed operations on files, where
+ /// file owner ID must be equal to the user ID, except where
+ /// [`Capability::FileSetID`] is applicable. It doesn't override MAC
+ /// and DAC restrictions.
+ FileOwner = linux_raw_sys::general::CAP_FOWNER,
+ /// Overrides the following restrictions that the effective user ID shall
+ /// match the file owner ID when setting the `S_ISUID` and `S_ISGID`
+ /// bits on that file; that the effective group ID (or one of the
+ /// supplementary group IDs) shall match the file owner ID when setting the
+ /// `S_ISGID` bit on that file; that the `S_ISUID` and `S_ISGID` bits are
+ /// cleared on successful return from `chown` (not implemented).
+ FileSetID = linux_raw_sys::general::CAP_FSETID,
+ /// Overrides the restriction that the real or effective user ID of a
+ /// process sending a signal must match the real or effective user ID
+ /// of the process receiving the signal.
+ Kill = linux_raw_sys::general::CAP_KILL,
+ /// Allows `setgid` manipulation. Allows `setgroups`. Allows forged gids on
+ /// socket credentials passing.
+ SetGroupID = linux_raw_sys::general::CAP_SETGID,
+ /// Allows `set*uid` manipulation (including fsuid). Allows forged pids on
+ /// socket credentials passing.
+ SetUserID = linux_raw_sys::general::CAP_SETUID,
/// Without VFS support for capabilities:
- /// - Transfer any capability in your permitted set to any pid.
- /// - remove any capability in your permitted set from any pid.
- /// With VFS support for capabilities (neither of above, but)
- /// - Add any capability from current's capability bounding set to the current process'
- /// inheritable set.
- /// - Allow taking bits out of capability bounding set.
- /// - Allow modification of the securebits for a process.
- SetPermittedCapabilities = CAP_SETPCAP,
+ /// - Transfer any capability in your permitted set to any pid.
+ /// - remove any capability in your permitted set from any pid. With VFS
+ /// support for capabilities (neither of above, but)
+ /// - Add any capability from current's capability bounding set to the
+ /// current process' inheritable set.
+ /// - Allow taking bits out of capability bounding set.
+ /// - Allow modification of the securebits for a process.
+ SetPermittedCapabilities = linux_raw_sys::general::CAP_SETPCAP,
/// Allow modification of `S_IMMUTABLE` and `S_APPEND` file attributes.
- LinuxImmutable = CAP_LINUX_IMMUTABLE,
- /// Allows binding to TCP/UDP sockets below 1024. Allows binding to ATM VCIs below 32.
- NetBindService = CAP_NET_BIND_SERVICE,
+ LinuxImmutable = linux_raw_sys::general::CAP_LINUX_IMMUTABLE,
+ /// Allows binding to TCP/UDP sockets below 1024. Allows binding to ATM
+ /// VCIs below 32.
+ NetBindService = linux_raw_sys::general::CAP_NET_BIND_SERVICE,
/// Allow broadcasting, listen to multicast.
- NetBroadcast = CAP_NET_BROADCAST,
- /// Allow interface configuration. Allow administration of IP firewall, masquerading and
- /// accounting. Allow setting debug option on sockets. Allow modification of routing tables.
- /// Allow setting arbitrary process / process group ownership on sockets. Allow binding to any
- /// address for transparent proxying (also via [`Capability::NetRaw`]). Allow setting TOS
- /// (type of service). Allow setting promiscuous mode. Allow clearing driver statistics.
- /// Allow multicasting. Allow read/write of device-specific registers. Allow activation of ATM
+ NetBroadcast = linux_raw_sys::general::CAP_NET_BROADCAST,
+ /// Allow interface configuration. Allow administration of IP firewall,
+ /// masquerading and accounting. Allow setting debug option on sockets.
+ /// Allow modification of routing tables. Allow setting arbitrary
+ /// process / process group ownership on sockets. Allow binding to any
+ /// address for transparent proxying (also via [`Capability::NetRaw`]).
+ /// Allow setting TOS (type of service). Allow setting promiscuous
+ /// mode. Allow clearing driver statistics. Allow multicasting. Allow
+ /// read/write of device-specific registers. Allow activation of ATM
/// control sockets.
- NetAdmin = CAP_NET_ADMIN,
- /// Allow use of `RAW` sockets. Allow use of `PACKET` sockets. Allow binding to any address for
- /// transparent proxying (also via [`Capability::NetAdmin`]).
- NetRaw = CAP_NET_RAW,
- /// Allow locking of shared memory segments. Allow mlock and mlockall (which doesn't really have
- /// anything to do with IPC).
- IPCLock = CAP_IPC_LOCK,
+ NetAdmin = linux_raw_sys::general::CAP_NET_ADMIN,
+ /// Allow use of `RAW` sockets. Allow use of `PACKET` sockets. Allow
+ /// binding to any address for transparent proxying (also via
+ /// [`Capability::NetAdmin`]).
+ NetRaw = linux_raw_sys::general::CAP_NET_RAW,
+ /// Allow locking of shared memory segments. Allow mlock and mlockall
+ /// (which doesn't really have anything to do with IPC).
+ IPCLock = linux_raw_sys::general::CAP_IPC_LOCK,
/// Override IPC ownership checks.
- IPCOwner = CAP_IPC_OWNER,
+ IPCOwner = linux_raw_sys::general::CAP_IPC_OWNER,
/// Insert and remove kernel modules - modify kernel without limit.
- SystemModule = CAP_SYS_MODULE,
- /// Allow ioperm/iopl access. Allow sending USB messages to any device via `/dev/bus/usb`.
- SystemRawIO = CAP_SYS_RAWIO,
+ SystemModule = linux_raw_sys::general::CAP_SYS_MODULE,
+ /// Allow ioperm/iopl access. Allow sending USB messages to any device via
+ /// `/dev/bus/usb`.
+ SystemRawIO = linux_raw_sys::general::CAP_SYS_RAWIO,
/// Allow use of `chroot`.
- SystemChangeRoot = CAP_SYS_CHROOT,
+ SystemChangeRoot = linux_raw_sys::general::CAP_SYS_CHROOT,
/// Allow `ptrace` of any process.
- SystemProcessTrace = CAP_SYS_PTRACE,
+ SystemProcessTrace = linux_raw_sys::general::CAP_SYS_PTRACE,
/// Allow configuration of process accounting.
- SystemProcessAccounting = CAP_SYS_PACCT,
- /// Allow configuration of the secure attention key. Allow administration of the random device.
- /// Allow examination and configuration of disk quotas. Allow setting the domainname.
- /// Allow setting the hostname. Allow `mount` and `umount`, setting up new smb connection.
- /// Allow some autofs root ioctls. Allow nfsservctl. Allow `VM86_REQUEST_IRQ`.
- /// Allow to read/write pci config on alpha. Allow `irix_prctl` on mips (setstacksize).
- /// Allow flushing all cache on m68k (`sys_cacheflush`). Allow removing semaphores.
- /// Used instead of [`Capability::ChangeOwnership`] to "chown" IPC message queues, semaphores
- /// and shared memory. Allow locking/unlocking of shared memory segment. Allow turning swap
- /// on/off. Allow forged pids on socket credentials passing. Allow setting readahead and
- /// flushing buffers on block devices. Allow setting geometry in floppy driver. Allow turning
- /// DMA on/off in `xd` driver. Allow administration of md devices (mostly the above, but some
- /// extra ioctls). Allow tuning the ide driver. Allow access to the nvram device. Allow
- /// administration of `apm_bios`, serial and bttv (TV) device. Allow manufacturer commands in
- /// isdn CAPI support driver. Allow reading non-standardized portions of pci configuration
- /// space. Allow DDI debug ioctl on sbpcd driver. Allow setting up serial ports. Allow sending
- /// raw qic-117 commands. Allow enabling/disabling tagged queuing on SCSI controllers and
- /// sending arbitrary SCSI commands. Allow setting encryption key on loopback filesystem.
- /// Allow setting zone reclaim policy. Allow everything under
- /// [`Capability::BerkeleyPacketFilters`] and [`Capability::PerformanceMonitoring`] for backward
- /// compatibility.
- SystemAdmin = CAP_SYS_ADMIN,
+ SystemProcessAccounting = linux_raw_sys::general::CAP_SYS_PACCT,
+ /// Allow configuration of the secure attention key. Allow administration
+ /// of the random device. Allow examination and configuration of disk
+ /// quotas. Allow setting the domainname. Allow setting the hostname.
+ /// Allow `mount` and `umount`, setting up new smb connection.
+ /// Allow some autofs root ioctls. Allow nfsservctl. Allow
+ /// `VM86_REQUEST_IRQ`. Allow to read/write pci config on alpha. Allow
+ /// `irix_prctl` on mips (setstacksize). Allow flushing all cache on
+ /// m68k (`sys_cacheflush`). Allow removing semaphores. Used instead of
+ /// [`Capability::ChangeOwnership`] to "chown" IPC message queues,
+ /// semaphores and shared memory. Allow locking/unlocking of shared
+ /// memory segment. Allow turning swap on/off. Allow forged pids on
+ /// socket credentials passing. Allow setting readahead and
+ /// flushing buffers on block devices. Allow setting geometry in floppy
+ /// driver. Allow turning DMA on/off in `xd` driver. Allow
+ /// administration of md devices (mostly the above, but some
+ /// extra ioctls). Allow tuning the ide driver. Allow access to the nvram
+ /// device. Allow administration of `apm_bios`, serial and bttv (TV)
+ /// device. Allow manufacturer commands in isdn CAPI support driver.
+ /// Allow reading non-standardized portions of pci configuration space.
+ /// Allow DDI debug ioctl on sbpcd driver. Allow setting up serial ports.
+ /// Allow sending raw qic-117 commands. Allow enabling/disabling tagged
+ /// queuing on SCSI controllers and sending arbitrary SCSI commands.
+ /// Allow setting encryption key on loopback filesystem. Allow setting
+ /// zone reclaim policy. Allow everything under
+ /// [`Capability::BerkeleyPacketFilters`] and
+ /// [`Capability::PerformanceMonitoring`] for backward compatibility.
+ SystemAdmin = linux_raw_sys::general::CAP_SYS_ADMIN,
/// Allow use of `reboot`.
- SystemBoot = CAP_SYS_BOOT,
- /// Allow raising priority and setting priority on other (different UID) processes. Allow use of
- /// FIFO and round-robin (realtime) scheduling on own processes and setting the scheduling
- /// algorithm used by another process. Allow setting cpu affinity on other processes.
- /// Allow setting realtime ioprio class. Allow setting ioprio class on other processes.
- SystemNice = CAP_SYS_NICE,
- /// Override resource limits. Set resource limits. Override quota limits. Override reserved
- /// space on ext2 filesystem. Modify data journaling mode on ext3 filesystem (uses journaling
- /// resources). NOTE: ext2 honors fsuid when checking for resource overrides, so you can
- /// override using fsuid too. Override size restrictions on IPC message queues. Allow more than
- /// 64hz interrupts from the real-time clock. Override max number of consoles on console
- /// allocation. Override max number of keymaps. Control memory reclaim behavior.
- SystemResource = CAP_SYS_RESOURCE,
- /// Allow manipulation of system clock. Allow `irix_stime` on mips. Allow setting the real-time
- /// clock.
- SystemTime = CAP_SYS_TIME,
+ SystemBoot = linux_raw_sys::general::CAP_SYS_BOOT,
+ /// Allow raising priority and setting priority on other (different UID)
+ /// processes. Allow use of FIFO and round-robin (realtime) scheduling
+ /// on own processes and setting the scheduling algorithm used by
+ /// another process. Allow setting cpu affinity on other processes.
+ /// Allow setting realtime ioprio class. Allow setting ioprio class on
+ /// other processes.
+ SystemNice = linux_raw_sys::general::CAP_SYS_NICE,
+ /// Override resource limits. Set resource limits. Override quota limits.
+ /// Override reserved space on ext2 filesystem. Modify data journaling
+ /// mode on ext3 filesystem (uses journaling resources). NOTE: ext2
+ /// honors fsuid when checking for resource overrides, so you can
+ /// override using fsuid too. Override size restrictions on IPC message
+ /// queues. Allow more than 64hz interrupts from the real-time clock.
+ /// Override max number of consoles on console allocation. Override max
+ /// number of keymaps. Control memory reclaim behavior.
+ SystemResource = linux_raw_sys::general::CAP_SYS_RESOURCE,
+ /// Allow manipulation of system clock. Allow `irix_stime` on mips. Allow
+ /// setting the real-time clock.
+ SystemTime = linux_raw_sys::general::CAP_SYS_TIME,
/// Allow configuration of tty devices. Allow `vhangup` of tty.
- SystemTTYConfig = CAP_SYS_TTY_CONFIG,
+ SystemTTYConfig = linux_raw_sys::general::CAP_SYS_TTY_CONFIG,
/// Allow the privileged aspects of `mknod`.
- MakeNode = CAP_MKNOD,
+ MakeNode = linux_raw_sys::general::CAP_MKNOD,
/// Allow taking of leases on files.
- Lease = CAP_LEASE,
+ Lease = linux_raw_sys::general::CAP_LEASE,
/// Allow writing the audit log via unicast netlink socket.
- AuditWrite = CAP_AUDIT_WRITE,
+ AuditWrite = linux_raw_sys::general::CAP_AUDIT_WRITE,
/// Allow configuration of audit via unicast netlink socket.
- AuditControl = CAP_AUDIT_CONTROL,
- /// Set or remove capabilities on files. Map `uid=0` into a child user namespace.
- SetFileCapabilities = CAP_SETFCAP,
- /// Override MAC access. The base kernel enforces no MAC policy. An LSM may enforce a MAC
- /// policy, and if it does and it chooses to implement capability based overrides of that
- /// policy, this is the capability it should use to do so.
- MACOverride = CAP_MAC_OVERRIDE,
- /// Allow MAC configuration or state changes. The base kernel requires no MAC configuration.
- /// An LSM may enforce a MAC policy, and if it does and it chooses to implement capability based
- /// checks on modifications to that policy or the data required to maintain it, this is the
- /// capability it should use to do so.
- MACAdmin = CAP_MAC_ADMIN,
+ AuditControl = linux_raw_sys::general::CAP_AUDIT_CONTROL,
+ /// Set or remove capabilities on files. Map `uid=0` into a child user
+ /// namespace.
+ SetFileCapabilities = linux_raw_sys::general::CAP_SETFCAP,
+ /// Override MAC access. The base kernel enforces no MAC policy. An LSM may
+ /// enforce a MAC policy, and if it does and it chooses to implement
+ /// capability based overrides of that policy, this is the capability
+ /// it should use to do so.
+ MACOverride = linux_raw_sys::general::CAP_MAC_OVERRIDE,
+ /// Allow MAC configuration or state changes. The base kernel requires no
+ /// MAC configuration. An LSM may enforce a MAC policy, and if it does
+ /// and it chooses to implement capability based
+ /// checks on modifications to that policy or the data required to maintain
+ /// it, this is the capability it should use to do so.
+ MACAdmin = linux_raw_sys::general::CAP_MAC_ADMIN,
/// Allow configuring the kernel's `syslog` (`printk` behaviour).
- SystemLog = CAP_SYSLOG,
+ SystemLog = linux_raw_sys::general::CAP_SYSLOG,
/// Allow triggering something that will wake the system.
- WakeAlarm = CAP_WAKE_ALARM,
+ WakeAlarm = linux_raw_sys::general::CAP_WAKE_ALARM,
/// Allow preventing system suspends.
- BlockSuspend = CAP_BLOCK_SUSPEND,
+ BlockSuspend = linux_raw_sys::general::CAP_BLOCK_SUSPEND,
/// Allow reading the audit log via multicast netlink socket.
- AuditRead = CAP_AUDIT_READ,
- /// Allow system performance and observability privileged operations using `perf_events`,
- /// `i915_perf` and other kernel subsystems.
- PerformanceMonitoring = CAP_PERFMON,
+ AuditRead = linux_raw_sys::general::CAP_AUDIT_READ,
+ /// Allow system performance and observability privileged operations using
+ /// `perf_events`, `i915_perf` and other kernel subsystems.
+ PerformanceMonitoring = linux_raw_sys::general::CAP_PERFMON,
/// This capability allows the following BPF operations:
- /// - Creating all types of BPF maps
- /// - Advanced verifier features
- /// - Indirect variable access
- /// - Bounded loops
- /// - BPF to BPF function calls
- /// - Scalar precision tracking
- /// - Larger complexity limits
- /// - Dead code elimination
- /// - And potentially other features
- /// - Loading BPF Type Format (BTF) data
- /// - Retrieve `xlated` and JITed code of BPF programs
- /// - Use `bpf_spin_lock` helper
+ /// - Creating all types of BPF maps
+ /// - Advanced verifier features
+ /// - Indirect variable access
+ /// - Bounded loops
+ /// - BPF to BPF function calls
+ /// - Scalar precision tracking
+ /// - Larger complexity limits
+ /// - Dead code elimination
+ /// - And potentially other features
+ /// - Loading BPF Type Format (BTF) data
+ /// - Retrieve `xlated` and JITed code of BPF programs
+ /// - Use `bpf_spin_lock` helper
///
- /// [`Capability::PerformanceMonitoring`] relaxes the verifier checks further:
- /// - BPF progs can use of pointer-to-integer conversions
- /// - speculation attack hardening measures are bypassed
- /// - `bpf_probe_read` to read arbitrary kernel memory is allowed
- /// - `bpf_trace_printk` to print kernel memory is allowed
+ /// [`Capability::PerformanceMonitoring`] relaxes the verifier checks
+ /// further:
+ /// - BPF progs can use of pointer-to-integer conversions
+ /// - speculation attack hardening measures are bypassed
+ /// - `bpf_probe_read` to read arbitrary kernel memory is allowed
+ /// - `bpf_trace_printk` to print kernel memory is allowed
///
/// [`Capability::SystemAdmin`] is required to use bpf_probe_write_user.
///
/// [`Capability::SystemAdmin`] is required to iterate system wide loaded
/// programs, maps, links, BTFs and convert their IDs to file descriptors.
///
- /// [`Capability::PerformanceMonitoring`] and [`Capability::BerkeleyPacketFilters`] are required
- /// to load tracing programs.
- /// [`Capability::NetAdmin`] and [`Capability::BerkeleyPacketFilters`] are required to load
+ /// [`Capability::PerformanceMonitoring`] and
+ /// [`Capability::BerkeleyPacketFilters`] are required to load tracing
+ /// programs. [`Capability::NetAdmin`] and
+ /// [`Capability::BerkeleyPacketFilters`] are required to load
/// networking programs.
- BerkeleyPacketFilters = CAP_BPF,
- /// Allow checkpoint/restore related operations. Allow PID selection during `clone3`.
- /// Allow writing to `ns_last_pid`.
- CheckpointRestore = CAP_CHECKPOINT_RESTORE,
+ BerkeleyPacketFilters = linux_raw_sys::general::CAP_BPF,
+ /// Allow checkpoint/restore related operations. Allow PID selection during
+ /// `clone3`. Allow writing to `ns_last_pid`.
+ CheckpointRestore = linux_raw_sys::general::CAP_CHECKPOINT_RESTORE,
}
-/// Check if the specified capability is in the calling thread's capability bounding set.
+/// Check if the specified capability is in the calling thread's capability
+/// bounding set.
///
/// # References
-/// - [`prctl(PR_CAPBSET_READ,...)`]
+/// - [`prctl(PR_CAPBSET_READ,...)`]
///
/// [`prctl(PR_CAPBSET_READ,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
-pub fn is_in_capability_bounding_set(capability: Capability) -> io::Result<bool> {
+pub fn capability_is_in_bounding_set(capability: Capability) -> io::Result<bool> {
unsafe { prctl_2args(PR_CAPBSET_READ, capability as usize as *mut _) }.map(|r| r != 0)
}
const PR_CAPBSET_DROP: c_int = 24;
-/// If the calling thread has the [`Capability::SetPermittedCapabilities`] capability within its
-/// user namespace, then drop the specified capability from the thread's capability bounding set.
+/// If the calling thread has the [`Capability::SetPermittedCapabilities`]
+/// capability within its user namespace, then drop the specified capability
+/// from the thread's capability bounding set.
///
/// # References
-/// - [`prctl(PR_CAPBSET_DROP,...)`]
+/// - [`prctl(PR_CAPBSET_DROP,...)`]
///
/// [`prctl(PR_CAPBSET_DROP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
-pub fn remove_capability_from_capability_bounding_set(capability: Capability) -> io::Result<()> {
+pub fn remove_capability_from_bounding_set(capability: Capability) -> io::Result<()> {
unsafe { prctl_2args(PR_CAPBSET_DROP, capability as usize as *mut _) }.map(|_r| ())
}
@@ -442,7 +437,7 @@ bitflags! {
/// Get the `securebits` flags of the calling thread.
///
/// # References
-/// - [`prctl(PR_GET_SECUREBITS,...)`]
+/// - [`prctl(PR_GET_SECUREBITS,...)`]
///
/// [`prctl(PR_GET_SECUREBITS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -456,7 +451,7 @@ const PR_SET_SECUREBITS: c_int = 28;
/// Set the `securebits` flags of the calling thread.
///
/// # References
-/// - [`prctl(PR_SET_SECUREBITS,...)`]
+/// - [`prctl(PR_SET_SECUREBITS,...)`]
///
/// [`prctl(PR_SET_SECUREBITS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -473,7 +468,7 @@ const PR_GET_TIMERSLACK: c_int = 30;
/// Get the `current` timer slack value of the calling thread.
///
/// # References
-/// - [`prctl(PR_GET_TIMERSLACK,...)`]
+/// - [`prctl(PR_GET_TIMERSLACK,...)`]
///
/// [`prctl(PR_GET_TIMERSLACK,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -486,7 +481,7 @@ const PR_SET_TIMERSLACK: c_int = 29;
/// Sets the `current` timer slack value for the calling thread.
///
/// # References
-/// - [`prctl(PR_SET_TIMERSLACK,...)`]
+/// - [`prctl(PR_SET_TIMERSLACK,...)`]
///
/// [`prctl(PR_SET_TIMERSLACK,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -504,7 +499,7 @@ const PR_GET_NO_NEW_PRIVS: c_int = 39;
/// Get the value of the `no_new_privs` attribute for the calling thread.
///
/// # References
-/// - [`prctl(PR_GET_NO_NEW_PRIVS,...)`]
+/// - [`prctl(PR_GET_NO_NEW_PRIVS,...)`]
///
/// [`prctl(PR_GET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -517,7 +512,7 @@ const PR_SET_NO_NEW_PRIVS: c_int = 38;
/// Set the calling thread's `no_new_privs` attribute.
///
/// # References
-/// - [`prctl(PR_SET_NO_NEW_PRIVS,...)`]
+/// - [`prctl(PR_SET_NO_NEW_PRIVS,...)`]
///
/// [`prctl(PR_SET_NO_NEW_PRIVS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -535,7 +530,7 @@ const PR_GET_TID_ADDRESS: c_int = 40;
/// and `clone`'s `CLONE_CHILD_CLEARTID` flag.
///
/// # References
-/// - [`prctl(PR_GET_TID_ADDRESS,...)`]
+/// - [`prctl(PR_GET_TID_ADDRESS,...)`]
///
/// [`prctl(PR_GET_TID_ADDRESS,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -552,7 +547,7 @@ const PR_GET_THP_DISABLE: c_int = 42;
/// Get the current setting of the `THP disable` flag for the calling thread.
///
/// # References
-/// - [`prctl(PR_GET_THP_DISABLE,...)`]
+/// - [`prctl(PR_GET_THP_DISABLE,...)`]
///
/// [`prctl(PR_GET_THP_DISABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -565,7 +560,7 @@ const PR_SET_THP_DISABLE: c_int = 41;
/// Set the state of the `THP disable` flag for the calling thread.
///
/// # References
-/// - [`prctl(PR_SET_THP_DISABLE,...)`]
+/// - [`prctl(PR_SET_THP_DISABLE,...)`]
///
/// [`prctl(PR_SET_THP_DISABLE,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -584,11 +579,11 @@ const PR_CAP_AMBIENT_IS_SET: usize = 1;
/// Check if the specified capability is in the ambient set.
///
/// # References
-/// - [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_IS_SET,...)`]
+/// - [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_IS_SET,...)`]
///
/// [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_IS_SET,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
-pub fn capability_is_in_ambient_capability_set(capability: Capability) -> io::Result<bool> {
+pub fn capability_is_in_ambient_set(capability: Capability) -> io::Result<bool> {
let cap = capability as usize as *mut _;
unsafe { prctl_3args(PR_CAP_AMBIENT, PR_CAP_AMBIENT_IS_SET as *mut _, cap) }.map(|r| r != 0)
}
@@ -598,7 +593,7 @@ const PR_CAP_AMBIENT_CLEAR_ALL: usize = 4;
/// Remove all capabilities from the ambient set.
///
/// # References
-/// - [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_CLEAR_ALL,...)`]
+/// - [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_CLEAR_ALL,...)`]
///
/// [`prctl(PR_CAP_AMBIENT,PR_CAP_AMBIENT_CLEAR_ALL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -612,14 +607,11 @@ const PR_CAP_AMBIENT_LOWER: usize = 3;
/// Add or remove the specified capability to the ambient set.
///
/// # References
-/// - [`prctl(PR_CAP_AMBIENT,...)`]
+/// - [`prctl(PR_CAP_AMBIENT,...)`]
///
/// [`prctl(PR_CAP_AMBIENT,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
-pub fn configure_capability_in_ambient_capability_set(
- capability: Capability,
- enable: bool,
-) -> io::Result<()> {
+pub fn configure_capability_in_ambient_set(capability: Capability, enable: bool) -> io::Result<()> {
let sub_operation = if enable {
PR_CAP_AMBIENT_RAISE
} else {
@@ -651,7 +643,7 @@ pub struct SVEVectorLengthConfig {
/// Get the thread's current SVE vector length configuration.
///
/// # References
-/// - [`prctl(PR_SVE_GET_VL,...)`]
+/// - [`prctl(PR_SVE_GET_VL,...)`]
///
/// [`prctl(PR_SVE_GET_VL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -670,7 +662,7 @@ const PR_SVE_SET_VL_ONEXEC: u32 = 1_u32 << 18;
/// Configure the thread's vector length of Scalable Vector Extension.
///
/// # References
-/// - [`prctl(PR_SVE_SET_VL,...)`]
+/// - [`prctl(PR_SVE_SET_VL,...)`]
///
/// # Safety
///
@@ -706,11 +698,11 @@ pub unsafe fn set_sve_vector_length_configuration(
const PR_PAC_RESET_KEYS: c_int = 54;
-/// Securely reset the thread's pointer authentication keys to fresh random values generated
-/// by the kernel.
+/// Securely reset the thread's pointer authentication keys to fresh random
+/// values generated by the kernel.
///
/// # References
-/// - [`prctl(PR_PAC_RESET_KEYS,...)`]
+/// - [`prctl(PR_PAC_RESET_KEYS,...)`]
///
/// # Safety
///
@@ -750,7 +742,7 @@ bitflags! {
/// Get the current tagged address mode for the calling thread.
///
/// # References
-/// - [`prctl(PR_GET_TAGGED_ADDR_CTRL,...)`]
+/// - [`prctl(PR_GET_TAGGED_ADDR_CTRL,...)`]
///
/// [`prctl(PR_GET_TAGGED_ADDR_CTRL,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html
#[inline]
@@ -766,7 +758,7 @@ const PR_SET_TAGGED_ADDR_CTRL: c_int = 55;
/// Controls support for passing tagged user-space addresses to the kernel.
///
/// # References
-/// - [`prctl(PR_SET_TAGGED_ADDR_CTRL,...)`]
+/// - [`prctl(PR_SET_TAGGED_ADDR_CTRL,...)`]
///
/// # Safety
///
@@ -795,7 +787,7 @@ const PR_SYS_DISPATCH_OFF: usize = 0;
/// Disable Syscall User Dispatch mechanism.
///
/// # References
-/// - [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_OFF,...)`]
+/// - [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_OFF,...)`]
///
/// # Safety
///
@@ -815,8 +807,8 @@ const SYSCALL_DISPATCH_FILTER_ALLOW: u8 = 0;
/// Block system calls from executing.
const SYSCALL_DISPATCH_FILTER_BLOCK: u8 = 1;
-/// Value of the fast switch flag controlling system calls user dispatch mechanism without the need
-/// to issue a syscall.
+/// Value of the fast switch flag controlling system calls user dispatch
+/// mechanism without the need to issue a syscall.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
#[repr(u8)]
pub enum SysCallUserDispatchFastSwitch {
@@ -841,7 +833,7 @@ impl TryFrom<u8> for SysCallUserDispatchFastSwitch {
/// Enable Syscall User Dispatch mechanism.
///
/// # References
-/// - [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_ON,...)`]
+/// - [`prctl(PR_SET_SYSCALL_USER_DISPATCH,PR_SYS_DISPATCH_ON,...)`]
///
/// # Safety
///
@@ -882,7 +874,8 @@ const PR_SCHED_CORE_SCOPE_PROCESS_GROUP: u32 = 2;
pub enum CoreSchedulingScope {
/// Operation will be performed for the thread.
Thread = PR_SCHED_CORE_SCOPE_THREAD,
- /// Operation will be performed for all tasks in the task group of the process.
+ /// Operation will be performed for all tasks in the task group of the
+ /// process.
ThreadGroup = PR_SCHED_CORE_SCOPE_THREAD_GROUP,
/// Operation will be performed for all processes in the process group.
ProcessGroup = PR_SCHED_CORE_SCOPE_PROCESS_GROUP,
@@ -904,7 +897,7 @@ impl TryFrom<u32> for CoreSchedulingScope {
/// Get core scheduling cookie of a process.
///
/// # References
-/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_GET,...)`]
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_GET,...)`]
///
/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_GET,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
#[inline]
@@ -927,7 +920,7 @@ const PR_SCHED_CORE_CREATE: usize = 1;
/// Create unique core scheduling cookie.
///
/// # References
-/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_CREATE,...)`]
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_CREATE,...)`]
///
/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_CREATE,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
#[inline]
@@ -949,7 +942,7 @@ const PR_SCHED_CORE_SHARE_TO: usize = 2;
/// Push core scheduling cookie to a process.
///
/// # References
-/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_TO,...)`]
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_TO,...)`]
///
/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_TO,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
#[inline]
@@ -971,7 +964,7 @@ const PR_SCHED_CORE_SHARE_FROM: usize = 3;
/// Pull core scheduling cookie from a process.
///
/// # References
-/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_FROM,...)`]
+/// - [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_FROM,...)`]
///
/// [`prctl(PR_SCHED_CORE,PR_SCHED_CORE_SHARE_FROM,...)`]: https://www.kernel.org/doc/html/v5.18/admin-guide/hw-vuln/core-scheduling.html
#[inline]
diff --git a/vendor/rustix/src/thread/setns.rs b/vendor/rustix/src/thread/setns.rs
index 5295bab94..81c9225e3 100644
--- a/vendor/rustix/src/thread/setns.rs
+++ b/vendor/rustix/src/thread/setns.rs
@@ -1,5 +1,3 @@
-#![allow(unsafe_code)]
-
use bitflags::bitflags;
use linux_raw_sys::general::{
CLONE_FILES, CLONE_FS, CLONE_NEWCGROUP, CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWNS, CLONE_NEWPID,
@@ -81,15 +79,16 @@ bitflags! {
}
}
-/// Reassociate the calling thread with the namespace associated with link referred to by `fd`.
+/// Reassociate the calling thread with the namespace associated with link
+/// referred to by `fd`.
///
-/// `fd` must refer to one of the magic links in a `/proc/[pid]/ns/` directory, or a bind mount
-/// to such a link.
+/// `fd` must refer to one of the magic links in a `/proc/[pid]/ns/` directory,
+/// or a bind mount to such a link.
///
/// # References
-/// - [`setns`]
+/// - [Linux]
///
-/// [`setns`]: https://man7.org/linux/man-pages/man2/setns.2.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/setns.2.html
pub fn move_into_link_name_space(
fd: BorrowedFd,
allowed_type: Option<LinkNameSpaceType>,
@@ -98,15 +97,15 @@ pub fn move_into_link_name_space(
syscalls::setns(fd, allowed_type).map(|_r| ())
}
-/// Atomically move the calling thread into one or more of the same namespaces as the thread
-/// referred to by `fd`.
+/// Atomically move the calling thread into one or more of the same namespaces
+/// as the thread referred to by `fd`.
///
/// `fd` must refer to a thread ID. See: `pidfd_open` and `clone`.
///
/// # References
-/// - [`setns`]
+/// - [Linux]
///
-/// [`setns`]: https://man7.org/linux/man-pages/man2/setns.2.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/setns.2.html
pub fn move_into_thread_name_spaces(
fd: BorrowedFd,
allowed_types: ThreadNameSpaceType,
@@ -118,9 +117,9 @@ pub fn move_into_thread_name_spaces(
/// context with other threads.
///
/// # References
-/// - [`unshare`]
+/// - [Linux]
///
-/// [`unshare`]: https://man7.org/linux/man-pages/man2/unshare.2.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/unshare.2.html
pub fn unshare(flags: UnshareFlags) -> io::Result<()> {
syscalls::unshare(flags)
}
diff --git a/vendor/rustix/src/time/clock.rs b/vendor/rustix/src/time/clock.rs
index f76e3fa18..1bf74d60b 100644
--- a/vendor/rustix/src/time/clock.rs
+++ b/vendor/rustix/src/time/clock.rs
@@ -14,7 +14,7 @@ pub use backend::time::types::{ClockId, DynamicClockId};
///
/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html
/// [Linux]: https://man7.org/linux/man-pages/man2/clock_getres.2.html
-#[cfg(any(not(any(target_os = "redox", target_os = "wasi"))))]
+#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
#[inline]
#[must_use]
pub fn clock_getres(id: ClockId) -> Timespec {
@@ -54,3 +54,25 @@ pub fn clock_gettime(id: ClockId) -> Timespec {
pub fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> {
backend::time::syscalls::clock_gettime_dynamic(id)
}
+
+/// `clock_settime(id, timespec)`—Sets the current value of a settable clock.
+///
+/// This fails with [`io::Errno::INVAL`] if the clock is not settable, and
+/// [`io::Errno::ACCESS`] if the current process does not have permission to
+/// set it.
+///
+/// # References
+/// - [POSIX]
+/// - [Linux]
+///
+/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_settime.html
+/// [Linux]: https://man7.org/linux/man-pages/man2/clock_settime.2.html
+#[cfg(not(any(
+ target_os = "redox",
+ target_os = "wasi",
+ all(apple, not(target_os = "macos"))
+)))]
+#[inline]
+pub fn clock_settime(id: ClockId, timespec: Timespec) -> io::Result<()> {
+ backend::time::syscalls::clock_settime(id, timespec)
+}
diff --git a/vendor/rustix/src/time/mod.rs b/vendor/rustix/src/time/mod.rs
index ca5b2b2dd..9a0dcb4d7 100644
--- a/vendor/rustix/src/time/mod.rs
+++ b/vendor/rustix/src/time/mod.rs
@@ -7,14 +7,7 @@ mod timerfd;
// TODO: Convert WASI'S clock APIs to use handles rather than ambient clock
// identifiers, update `wasi-libc`, and then add support in `rustix`.
-#[cfg(not(any(target_os = "redox", target_os = "wasi")))]
-pub use clock::clock_getres;
-#[cfg(not(target_os = "wasi"))]
-pub use clock::{clock_gettime, clock_gettime_dynamic, ClockId, DynamicClockId};
-pub use clock::{Nsecs, Secs, Timespec};
+pub use clock::*;
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
#[cfg(feature = "time")]
-pub use timerfd::{
- timerfd_create, timerfd_gettime, timerfd_settime, Itimerspec, TimerfdClockId, TimerfdFlags,
- TimerfdTimerFlags,
-};
+pub use timerfd::*;