diff options
Diffstat (limited to 'vendor/rustix')
96 files changed, 4207 insertions, 1134 deletions
diff --git a/vendor/rustix/.cargo-checksum.json b/vendor/rustix/.cargo-checksum.json index 4145db8aa..c6ff727fc 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":"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 +{"files":{"CODE_OF_CONDUCT.md":"f210602311e3f74b32f46237fd55f4ce36d798e85e3db1432ec667f63a7ffc44","CONTRIBUTING.md":"fb570c76cf924cd75b77bed52b0dbe1e87ce224dc3428c48d98301710dcc331e","COPYRIGHT":"377c2e7c53250cc5905c0b0532d35973392af16ffb9596a41d99d202cf3617c9","Cargo.toml":"13a27c14179179c44c9bf5393ce540881e31bc4ac658e5365cb263e3e2e92dee","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":"0b04fb65da07618e464c073e21d7b9dd50be7423924be9a95238ecf0cc142966","src/backend/libc/c.rs":"e91631918772a752429b53fb7674f288e27af0d133a583bd9d50af7af7802328","src/backend/libc/conv.rs":"9ad104d6e40e9d2f5cf42644e6b70bcea38ac79e3d0c70cdf2ce9069787f16ca","src/backend/libc/fs/dir.rs":"46a155f7f5564126e8323db67df9d10b864cb60c631ca6ed4ae2724e929e5955","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":"c369c5ce202547521035d03d7d282c059f37b04a6ee4baad932a892947616cde","src/backend/libc/fs/types.rs":"5ecdd9586fbae8b3a450494f8e4ed8634efd6c00d98c987176c5b67e799c7744","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":"a0cb287e379667a35e528780484d05ce82848f446401d7aa925906803335ba42","src/backend/libc/io/types.rs":"79a0f83d584c875442945b33c9d6233e8551a1cd9f9ee552506adc0edbabc860","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":"1165ccc11a762dd52d0e69df4e214916bf3944cf2606000a27481306a7a917ab","src/backend/libc/mod.rs":"68e45c42e0582d221126e8096ff23a222fa2b30261ee6ad547759b539d4b80c7","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":"d0ffe3aebccab498b7fdf6cfb0382fc10576ed0b8563d696a20878d2c01f0a28","src/backend/libc/net/syscalls.rs":"24d00de84aaa4bc0cbf23ca5f1457cd81adc39f2f7c1b01def3bbde12ca70174","src/backend/libc/net/types.rs":"5b39c7b6c43e532707b39efc7c3abaf6f9567bf00bf161ebd28fa19841a9db15","src/backend/libc/net/write_sockaddr.rs":"33c3d7304713cb63f8fa398f5f7c084fc1d9fbb6907dd19902a90e8ec64ad41f","src/backend/libc/offset.rs":"23c5cf54bcc441b77d36a730dcd243bc3b2fa129086530bcaffb4000c71bb9c5","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":"32a02feab8f316e317277239bb97901091e27b8c86e00267163026ffd11f0e7a","src/backend/libc/process/types.rs":"ad62474d3337b22a20ad3f0f386ba228ecc0ece4423d8c856c1db8874b4c7978","src/backend/libc/process/wait.rs":"36e84c05ae3a27b96da9521678b72ab004fe37a8b0d092a0b6f810015806c4d2","src/backend/libc/rand/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/libc/rand/syscalls.rs":"d5dd342aa16b547b809d9f97aaae307bc79427c74806facff050b60a4ea390b5","src/backend/libc/rand/types.rs":"85f72babe82857d4e47067ddc11525ab290208050fb8f5e5190975c0fdda9b7c","src/backend/libc/termios/mod.rs":"63a1e559981848581bbacad2adb567e5eb62d17caa2d8f826e977dc053ce26bb","src/backend/libc/termios/syscalls.rs":"bbc30adb93e82660b32d6cdba3c3e03109ab6d2aa9c270d96ec4c661f03ff29a","src/backend/libc/termios/types.rs":"53591313301633c49176af2eee33b775f12a11fee6b6c2201e4f2fcb314f6c67","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":"72b56e7fd3efc536b196cd8276f6ffb8eb7ff9cf9b9d77cb045f1a9abb8d564b","src/backend/libc/winsock_c.rs":"47764d20b700cfcc021b3a37c780ca3803565f11476857ec4d5273d92a4f9cfe","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":"ed5c6c14d19556c1a2ca077608fa515ac85d760eb931dc8968b39137700159d8","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":"3fcab403f297fd5160df6f4b7d8fd1d868267022c2f6e6448505bd363cb113ef","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":"8cd2648d0358ceb787159927090bb01ec4e4a3fd9e0937875eb5aae0d20cf583","src/backend/linux_raw/conv.rs":"a4809e08341e7546a3d346dcc3f0bd150b39f5d76e8a15d385ab2dc5d9bcc362","src/backend/linux_raw/elf.rs":"a257fbc3f22e4970605cf72a3b301dc2eaee2f5f1b3b0ea434fa192db3c3164e","src/backend/linux_raw/fs/dir.rs":"d54842a373968da54bdae73e10ccab7a8bc19c1bc75b6dca2bb70818c5b275ea","src/backend/linux_raw/fs/inotify.rs":"ecb0810843db7b0a0e31212fc5bc233dda17c97118fa002bcd85bc3bf29235d8","src/backend/linux_raw/fs/makedev.rs":"c6b4505c4bcbbc2460e80f3097eb15e2c8ef38d6c6e7abd78e39c53c372139e2","src/backend/linux_raw/fs/mod.rs":"e22bf30f312f6a05f1e79f7834c33a3c9821514da05fa4786fc31867203a4c74","src/backend/linux_raw/fs/syscalls.rs":"bbc5f19e88f726748c5582407a2afc4182f1b3d6178135ce46491303c45c27e9","src/backend/linux_raw/fs/types.rs":"794bcddf8dc4916a58c431a0249b1325ad9ad8eea3ea8029d61f7a4cbbdabe7c","src/backend/linux_raw/io/epoll.rs":"75de5fe04ed8f85a345ae5b54dc6106268bc05817a4e4abe9cf0bca08e2b1fb3","src/backend/linux_raw/io/errno.rs":"7fbc67fae5d94619b71f82717f9befbb5487f04ed880a5d2eeca5d4d2eabd31b","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":"85ee2d8a985c749617fe04df18c5560825ac50566c7d814e0f6e13688e48fab5","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":"69c173aea9d037a35a5236885efa6467009a62474e5a698fb273771dd4b723fa","src/backend/linux_raw/mod.rs":"d0871f7dd2ef5f02e669e1acceda99921f04128cfb8adab8def49acb1bc5851f","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":"602852a0cf2775c0fce7afbd813248386823b73f3069231860b348432f59450c","src/backend/linux_raw/net/syscalls.rs":"86a9f95ac682d54b21b5a0046e121fee3d992fbccff59022ff6f11afaed5233e","src/backend/linux_raw/net/types.rs":"87ed6b59a29aab219fd625393b1b9f4200eabacf1ee4ad8fe806a2b8b53169df","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":"42544daf757997d9dacccbcf9677ccba771a29f795e8f4513252070d2eb5939e","src/backend/linux_raw/process/types.rs":"f30b5299943a94b2a71f32b383a561dd0f51bbbc68f39b16f38e117250b84279","src/backend/linux_raw/process/wait.rs":"921aee4b0048746087f52615a98edc2aa0fb4b53d6df44be4533098df55d1b05","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":"c091d0dd651fdd15bdf8bf41a2fa1dc85ae3a97fd3b0e5f80cc5d654a08d5c1c","src/backend/linux_raw/runtime/tls.rs":"2913858a8fe4696f9c3f9a4921f776258a6d1c54b471f813471d57db23fd22ee","src/backend/linux_raw/termios/mod.rs":"8aa966faf3853d1a93d0ed91f7e5f4a53539b0287b25a5bfe489fa1d07f7cfd7","src/backend/linux_raw/termios/syscalls.rs":"48eb753f1cd48139eae40ba72241fc2d5fd67355c33a3906f82965e0e0e518d3","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":"7dd36425607ef96cda516525417ff7700ae28f47689a33b8377950475a925a3d","src/backend/linux_raw/time/mod.rs":"672724f55b7b7be6a7452bb1cc2d28b5f0aaa840a2856fe363acce624e1beefc","src/backend/linux_raw/time/syscalls.rs":"777d22d6e3ab7c5fe1d5921a91644543173bb4f783fd308b5886fca68500f98c","src/backend/linux_raw/time/types.rs":"8b5a464d0ef6752276416640dd3a341c07e3e901463231e8c66b2d2d661039af","src/backend/linux_raw/vdso.rs":"a5abab80f023088162fd81dc306b6bd86bd61b2018a191b384f57facb1d48d0a","src/backend/linux_raw/vdso_wrappers.rs":"34bdeadafff8feda511d41ecf560ea78dfcf496bbce4712bf676969639bf76ae","src/const_assert.rs":"ff08ab91f11f2ad29883096f4468bd9a65060d5a9e6681e9282bb081f8bdac27","src/cstr.rs":"976027b6c5cf2c82e369ab7ad9e97fa79d7823ded929c1816f37f97134e51fec","src/ffi/mod.rs":"1990dae8190991142bef24220f02b99c96c5bfa7dda2a7974d9dcac265d58945","src/fs/abs.rs":"3541ec38adff45be6464f52a786c0f4973e42fcae5efeeed737c83916b669d2f","src/fs/at.rs":"03dada6a317d1d10d7a162342f058cf623647431227432c78e8a3e0f7b09969a","src/fs/constants.rs":"9e2f596d004563c4811f43a082d91ac3a8703f281a00f0b263cecbaa68aa0f7e","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":"393dabe7d49740487dc8b16d94f0e3b73f34075a0eec29aff3ab06963b77944c","src/fs/file_type.rs":"fefd865f91011f66126213b0994773d99e373b468c31e866002228c98c64ad85","src/fs/getpath.rs":"28f6970fc1bbc37bb35c84724b59eac436ea7407a4522e18c2bdacb1fdd2edd9","src/fs/makedev.rs":"a56b9fa872e5fbf0f358ca14625b050077f45e8e265ba0c8eaeea22c421e0f92","src/fs/memfd_create.rs":"15a8f28e040cffd8c24c7903483440f88853b2e538ad48d80f3c00b4b2befdea","src/fs/mod.rs":"9647514e270a49c31c41900b3cdbb0e6f50f50d3c86854d9c6897383dd808d95","src/fs/mount.rs":"8ab26dcb422825bbd2df2e1f68e6b4f7cf08ce11387c688442ee1b4683b33d4f","src/fs/openat2.rs":"4a95c15dab533a41201b5fa25c8a212956b7571d58cad696bdaf45af8aef96db","src/fs/raw_dir.rs":"775c6c52786be92047cf2f71de07e99d929bec4de5e1a02a19d8eebb8e2cdd72","src/fs/sendfile.rs":"ac053f03608656bb675228ba61079b774498c0233d17e5816ac72538bb12b70e","src/fs/statx.rs":"397ae231c40ecee90e936bd9578152655bdd4852250830ac380798bd143760c0","src/fs/sync.rs":"a3b23543834281f347b0f873bd38154d31d404871188ac08f2b20b9196234cfd","src/fs/xattr.rs":"fcc16dab9927d7d6c8e4e4bf6752e65ff0c38d954cead8e6f6c2c26c11792929","src/io/close.rs":"0aa3cd05a8fed8e5244f97b8b6c2e7f65ed93a4e5435c6329852bb3da7514440","src/io/dup.rs":"913aaa2f5f9a5f0c381d053dd0e9560af55bc754dca23ff44dde4b0fa13ff172","src/io/errno.rs":"da7dc2d25cdbbf610ec82c32124789d6572fbc67d8ff265000597ac1f5b39ebd","src/io/eventfd.rs":"6886b17aa4d298a116bd4de15b22469133acc94695a623d0341174a0dc649a18","src/io/fcntl.rs":"08f42dc80832586afa6e0a7825571c84a97add1164926928960f0c4c5db76461","src/io/fd/mod.rs":"a1eab9ce9a2c4454053afdfd3f3705e4cb971e94cc453e4f13690f2f0d83dc2c","src/io/fd/owned.rs":"b3d1ac775461b9206f36df62495604a48820c0284276200101fd1847b0e9e756","src/io/fd/raw.rs":"9bcd00be7df3d9f4e6c49ca2d18ef25aee3d6f0ed5ee6b73df5a9beacefb6031","src/io/ioctl.rs":"9278cbb98645e68e97678b2bc73e69a80b594696584574dc83a11f3fa0a343ed","src/io/is_read_write.rs":"e8f7002ce5133af213b161546c67a8b52a9f1abbd22dd94c12bc20874769b15f","src/io/kqueue.rs":"8505df5fc636fd7f5a882b493f074caa7237063ab5038749d1f74dca54855e9f","src/io/mod.rs":"5b00546dd819aa710b87e06a3834cf7e59f38f698bf32a19e22748a78ccec1ee","src/io/pipe.rs":"fb8f5aad03b9899246f95b4220843ca7fe5551663034a64700ae5e40b493c888","src/io/poll.rs":"3a1dc003042a0b8e21f894ebdc0e123938b78c6323d61deacbc09b44e1b986a1","src/io/port.rs":"8be17096cdfd2425bb2f800d129913e2ed2032c02049d45b7dcda8d4189b1af2","src/io/procfs.rs":"0821281f09812960a17851a59981bf0ee4c62e33dd1572f795ad433bec992642","src/io/read_write.rs":"f81b54644cb52d59e34cefebd11c0c4fa5931fc86cca952cd52a396bd7a40973","src/io/seek_from.rs":"d7616a45e8a449df28b075ddded4d7c95d6c4575d6fe0cf0ca7b6625e9dc7eeb","src/io/stdio.rs":"0f761d5d103e95f3ca464c89079cd1a007761a23d21595b3090783fc9e655549","src/io_uring.rs":"5d1d74336a096e663b2b0b170427780b4b52d13afa5e95a0c4cb6cdbc4b4ea4a","src/lib.rs":"26f960a3d43bf8ed7ca3e2bbe5ab7afb3a1d9801b7330648584dfed5f3a11685","src/mm/madvise.rs":"3c262b3713a73fafcedf1b04bb12c048bb11d47ca43c959e5dfa48c27651f4f0","src/mm/mmap.rs":"35f9133f3d42c321bada86c2304c7ee0046d6dc740ff484b9f6609b7564b03fa","src/mm/mod.rs":"1a46082151c2ef319667078923df74b01d4a94d25d3777083775179bda8bf3bf","src/mm/msync.rs":"9dcfe5f54235e9314a595edb8d548ac79d222bbcc58bb3263cf7e96d603b23ad","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":"c65b268e5983ca7e356685f64a394e50d5f60815099185dab13980ec046d44ca","src/net/socket.rs":"691f2c1b8c09c8d1d7f5e4ae3d3254925d7ca98b4c449a27e732f4c3c1612646","src/net/socket_addr_any.rs":"d95c7002972fa98d4133e10ad6c404399494374d568816217edcb9f4fd93aad8","src/net/socketpair.rs":"0818c1f34a5031dfd83bffe90ad1fad2c1e124665cb807485c908893ca9b3d9f","src/net/sockopt.rs":"060a862fc0ad836cef2799b71977b62dbdeb8bee2d46d741cb676426e32bc541","src/net/wsa.rs":"6e546b42f50a851fc833c57cda76cfb347203ed4b0dea574a3d325bf5a2ebf80","src/param/auxv.rs":"988872f9bec2e12f35765ae8963cbb9535d4acaedd4c9a4d07ced6feb70e0aaa","src/param/init.rs":"671d8974f0d9b82e79076d1f4deabe0273a874a329f74b8aad26e07b86791ba3","src/param/mod.rs":"959d6bd6c7abb85e042f86047fb902891c5deb74c550ce21dac96fb9a9f16d36","src/path/arg.rs":"68979fff96dd627f98de0baf3091413b83c0c83791e3a5a1153b83d6204248d7","src/path/dec_int.rs":"a512618714fc3309253f65de605121c2aa056a780f9ab1de55f5a86469895295","src/path/mod.rs":"513fea21b1ba0226c3c5da769ded06a7cd7abe9f49cec9d165bc62a15da126a8","src/process/chdir.rs":"4c63c351e207b1bbefdd7c001e85fed383d5ac2147894d5a09fbd8b302d7c728","src/process/chroot.rs":"aa83fd57d8f43c22b8f26bdb61109b74f2e2bebed34a16fed02660cbb37cd4d4","src/process/exit.rs":"47bc2fc1ec25eb5c7a21ba84a70c6d799df206f9920c34804a17acf27d5cd66d","src/process/id.rs":"a4fe9b0da18d45d26be97fb472d8f6d1dc846606afe6607775b70592683205da","src/process/kill.rs":"0269dc9a2c0684223c6d9256548dcb1dfeb66c10fe53f45fdcb173f398ada4cc","src/process/membarrier.rs":"19f42cb66f211e8b23f4586bf29fdfa29c29e4e9169a06f3cc7b54aad4ef94e6","src/process/mod.rs":"e602402202b2754fa150f898f216fdfd8b74d46af5caafcb09e9e0b045bee54f","src/process/pidfd.rs":"88517949097414b77540b1c0801bdd034c28667b9386c0676cdaa1b637129ffa","src/process/prctl.rs":"e48791471ca608c1e2f8d7a1431246e9fd320d201e9d073b8ce5ab4228a74bd7","src/process/priority.rs":"ddfdeda52acbca8566dd3517f167f7e29e3daa7e71c3ebae4183f8cf4f309b0a","src/process/procctl.rs":"36b0837c6775e5eee7d0c4ba74c51f8413674cbdab094c9986d80a167175de60","src/process/rlimit.rs":"97c1e41533c74b5b71e471d1ed0a83a847b804da9e53be76c50f0187ac5d3eec","src/process/sched.rs":"ea8b20942ef09dbcd7a54d8218435129dfece427e4960055bcdf81c997e80f5f","src/process/sched_yield.rs":"6565faa3928b66ddc74a65e893e15edfa4b9be4f7e5f5f68527501a7f6bc3350","src/process/system.rs":"5c75c70a3b38619ec5b4932e640e24a9a4753f2e5eca39e63e5d1514e4332864","src/process/umask.rs":"f664e46dc6990a550d5ead5e394bfd90767bcb875c53722a5fb92823e15d8882","src/process/wait.rs":"db191eb594596fca37a8779222d656c0dfd95f74e4c075be5df808c755aaea31","src/rand/getrandom.rs":"8e64128584178c02f04c9781527c23ac2e2423f73445d0b4d25ae99204d7cc04","src/rand/mod.rs":"bd6839924ebfb7092f27f2ad42323768f39f76df157e7b8aa42f5bc17f700c9c","src/runtime.rs":"fcf31394b5f4bffa2115dcc2261d84fb9f0fd2da468602fc7afa8b05554f7f5c","src/termios/cf.rs":"cb13ee88cba541cbd683c7a5da034a126fd9e09dc6b5f25c9f32382f8318ffc0","src/termios/constants.rs":"7855cebd1e2169a2a760c6752138b3de1be00fd3b907b049d32ad5d6bdb0426e","src/termios/mod.rs":"b4d28ebeeae6782b4060d3e6f0156ed63bafa155d1bbdae9e28d06e574d69cb7","src/termios/tc.rs":"ae5d8799123747950c7f20ca3abaa3ec1918462ed95d1e78d07bcb491aedcccf","src/termios/tty.rs":"be5d14f787a27406baec459311d7a40b337cc04dc0d7c29b69c884897b79edfe","src/thread/clock.rs":"4e3f54aa5b50443bf502a81ee4814b3522e928e3b06241d24f924a6f69953662","src/thread/futex.rs":"4e78c84589b535ca9ca633633696ef212393a98f2890b181acaa8f908fbc5ae2","src/thread/id.rs":"f905c1c672082215c6502f88e7123a33abadb25791d3ee967335567560dfced3","src/thread/libcap.rs":"43a05e127ae57ecd8b93752571d1cac3359bebe265c964f1825eefe1cee25a42","src/thread/mod.rs":"a3839e32f920fa4be0812f6d40b677968cb3d9e99aa0af65c87ceb8ce015fdc9","src/thread/prctl.rs":"405dabb5376f97b08427e5c1a51b7b0863ad12e462e2590439c1bfef51b65473","src/thread/setns.rs":"5e08f98300e2ca8fc99272cf5408f0b27cb4c8ece54d76b92ede656982f11e69","src/time/clock.rs":"cbe15f6abe995476c815b31a9c3a931ad7292ec853342bc0fcb4417df1a558f1","src/time/mod.rs":"b8b7c5d2bdba60a69e8a557ce7017e4251a41f5633aec928da059c49bc080cfa","src/time/timerfd.rs":"f17092b84553741aa2d2b44c6992b5d2c8c96cc2c2007fc9a2c6b2064485e53f","src/utils.rs":"f541201ab5a90a7db05a918a0bdfe22158c55dbaea48feca8286d4bf44fc81c3","src/weak.rs":"5bd4bffa80e0d13d88994d9544c26893e82c20a3509d3a2879f84f7198a225c4"},"package":"a0661814f891c57c930a610266415528da53c4933e6dea5fb350cbfe048a9ece"}
\ No newline at end of file diff --git a/vendor/rustix/Cargo.toml b/vendor/rustix/Cargo.toml index b560499a8..c92852650 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.37.6" +version = "0.37.15" authors = [ "Dan Gohman <dev@sunfishcode.online>", "Jakub Konka <kubkon@jakubkonka.com>", @@ -78,7 +78,7 @@ optional = true package = "rustc-std-workspace-alloc" [dependencies.bitflags] -version = "1.2.1" +version = "1.3.2" [dependencies.compiler_builtins] version = "0.1.49" @@ -90,7 +90,7 @@ optional = true package = "rustc-std-workspace-core" [dependencies.io-lifetimes] -version = "1.0.0" +version = "1.0.10" features = ["close"] optional = true default-features = false @@ -104,15 +104,15 @@ default-features = false version = "1.0" [dev-dependencies.io-lifetimes] -version = "1.0.0" +version = "1.0.10" features = ["close"] default-features = false [dev-dependencies.libc] -version = "0.2.140" +version = "0.2.142" [dev-dependencies.libc_errno] -version = "0.3.0" +version = "0.3.1" default-features = false package = "errno" @@ -190,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.3.0" +version = "0.3.3" features = [ "general", "no_std", @@ -201,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.140" +version = "0.2.142" 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.3.0" +version = "0.3.1" 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.3.0" +version = "0.3.3" features = [ "general", "errno", @@ -221,12 +221,12 @@ 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.140" +[target."cfg(all(not(windows), 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.142" 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.3.0" +[target."cfg(all(not(windows), 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.3.1" default-features = false package = "errno" @@ -234,8 +234,13 @@ package = "errno" version = "1.5.2" optional = true +[target."cfg(windows)".dependencies.libc_errno] +version = "0.3.1" +default-features = false +package = "errno" + [target."cfg(windows)".dependencies.windows-sys] -version = "0.45.0" +version = "0.48.0" features = [ "Win32_Foundation", "Win32_Networking_WinSock", @@ -244,4 +249,4 @@ features = [ ] [target."cfg(windows)".dev-dependencies.ctor] -version = "0.1.21" +version = "0.2.0" diff --git a/vendor/rustix/build.rs b/vendor/rustix/build.rs index d8d1c8bd6..8b5c55a9d 100644 --- a/vendor/rustix/build.rs +++ b/vendor/rustix/build.rs @@ -3,7 +3,7 @@ use cc::Build; use std::env::var; use std::io::Write; -/// The directory for out-of-line ("outline") libraries. +/// The directory for out-of-line (“outline”) libraries. const OUTLINE_PATH: &str = "src/backend/linux_raw/arch/outline"; fn main() { @@ -24,6 +24,7 @@ fn main() { // Gather target information. let arch = var("CARGO_CFG_TARGET_ARCH").unwrap(); + let vendor = var("CARGO_CFG_TARGET_VENDOR").unwrap(); let asm_name = format!("{}/{}.s", OUTLINE_PATH, arch); let asm_name_present = std::fs::metadata(&asm_name).is_ok(); let target_os = var("CARGO_CFG_TARGET_OS").unwrap(); @@ -84,7 +85,7 @@ fn main() { // Use inline asm if we have it, or outline asm otherwise. On PowerPC // and MIPS, Rust's inline asm is considered experimental, so only use // it if `--cfg=rustix_use_experimental_asm` is given. - if (feature_rustc_dep_of_std || can_compile("use std::arch::asm;")) + if (feature_rustc_dep_of_std || vendor == "mustang" || can_compile("use std::arch::asm;")) && (arch != "x86" || has_feature("naked_functions")) && ((arch != "powerpc64" && arch != "mips" && arch != "mips64") || rustix_use_experimental_asm) @@ -138,6 +139,9 @@ fn main() { { use_feature("bsd"); } + if target_os == "wasi" { + use_feature_or_nothing("wasi_ext"); + } println!("cargo:rerun-if-env-changed=CARGO_CFG_RUSTIX_USE_EXPERIMENTAL_ASM"); println!("cargo:rerun-if-env-changed=CARGO_CFG_RUSTIX_USE_LIBC"); diff --git a/vendor/rustix/src/backend/libc/conv.rs b/vendor/rustix/src/backend/libc/conv.rs index 1e74ea9ba..b827d0bbc 100644 --- a/vendor/rustix/src/backend/libc/conv.rs +++ b/vendor/rustix/src/backend/libc/conv.rs @@ -88,20 +88,22 @@ pub(super) fn ret_u32(raw: c::c_int) -> io::Result<u32> { } #[inline] -pub(super) fn ret_ssize_t(raw: c::ssize_t) -> io::Result<c::ssize_t> { +pub(super) fn ret_usize(raw: c::ssize_t) -> io::Result<usize> { if raw == -1 { Err(io::Errno::last_os_error()) } else { - Ok(raw) + debug_assert!(raw >= 0); + Ok(raw as usize) } } #[inline] -pub(super) fn syscall_ret_ssize_t(raw: c::c_long) -> io::Result<c::ssize_t> { +pub(super) fn syscall_ret_usize(raw: c::c_long) -> io::Result<usize> { if raw == -1 { Err(io::Errno::last_os_error()) } else { - Ok(raw as c::ssize_t) + debug_assert!(raw >= 0); + Ok(raw as c::ssize_t as usize) } } @@ -210,13 +212,13 @@ pub(super) fn send_recv_len(len: usize) -> i32 { /// Convert the return value of a `send` or `recv` call. #[cfg(not(windows))] #[inline] -pub(super) fn ret_send_recv(len: isize) -> io::Result<c::ssize_t> { - ret_ssize_t(len) +pub(super) fn ret_send_recv(len: isize) -> io::Result<usize> { + ret_usize(len) } /// Convert the return value of a `send` or `recv` call. #[cfg(windows)] #[inline] -pub(super) fn ret_send_recv(len: i32) -> io::Result<c::ssize_t> { - ret_ssize_t(len as isize) +pub(super) fn ret_send_recv(len: i32) -> io::Result<usize> { + ret_usize(len as isize) } diff --git a/vendor/rustix/src/backend/libc/fs/dir.rs b/vendor/rustix/src/backend/libc/fs/dir.rs index d1c901323..b6eb32580 100644 --- a/vendor/rustix/src/backend/libc/fs/dir.rs +++ b/vendor/rustix/src/backend/libc/fs/dir.rs @@ -1,11 +1,10 @@ use super::super::c; use super::super::conv::owned_fd; +use super::super::offset::libc_ino_t; #[cfg(not(any(solarish, target_os = "haiku")))] use super::types::FileType; use crate::fd::{AsFd, BorrowedFd}; -use crate::ffi::CStr; -#[cfg(target_os = "wasi")] -use crate::ffi::CString; +use crate::ffi::{CStr, CString}; use crate::fs::{fcntl_getfl, fstat, openat, Mode, OFlags, Stat}; #[cfg(not(any( solarish, @@ -22,14 +21,11 @@ use crate::io; use crate::process::fchdir; #[cfg(target_os = "wasi")] use alloc::borrow::ToOwned; -#[cfg(not(any(linux_like, target_os = "openbsd")))] -use c::dirent as libc_dirent; #[cfg(not(linux_like))] use c::readdir as libc_readdir; #[cfg(linux_like)] -use c::{dirent64 as libc_dirent, readdir64 as libc_readdir}; +use c::readdir64 as libc_readdir; use core::fmt; -use core::mem::zeroed; use core::ptr::NonNull; use libc_errno::{errno, set_errno, Errno}; @@ -91,16 +87,24 @@ impl Dir { } else { // We successfully read an entry. unsafe { + let dirent = &*dirent_ptr; + // We have our own copy of OpenBSD's dirent; check that the // layout minimally matches libc's. #[cfg(target_os = "openbsd")] - check_dirent_layout(&*dirent_ptr); + check_dirent_layout(dirent); let result = DirEntry { - dirent: read_dirent(&*dirent_ptr.cast()), + #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] + d_type: dirent.d_type, + + #[cfg(not(any(freebsdlike, netbsdlike)))] + d_ino: dirent.d_ino, + + #[cfg(any(freebsdlike, netbsdlike))] + d_fileno: dirent.d_fileno, - #[cfg(target_os = "wasi")] - name: CStr::from_ptr((*dirent_ptr).d_name.as_ptr()).to_owned(), + name: CStr::from_ptr(dirent.d_name.as_ptr()).to_owned(), }; Some(Ok(result)) @@ -142,130 +146,6 @@ impl Dir { } } -// A `dirent` pointer returned from `readdir` may not point to a full `dirent` -// 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(solarish, target_os = "aix", target_os = "haiku")))] - let d_type = input.d_type; - - #[cfg(not(any( - apple, - freebsdlike, - target_os = "aix", - target_os = "haiku", - target_os = "netbsd", - target_os = "wasi", - )))] - let d_off = input.d_off; - - #[cfg(target_os = "aix")] - let d_offset = input.d_offset; - - #[cfg(not(any(freebsdlike, netbsdlike)))] - let d_ino = input.d_ino; - - #[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(bsd, target_os = "aix"))] - let d_namlen = input.d_namlen; - - #[cfg(apple)] - let d_seekoff = input.d_seekoff; - - #[cfg(target_os = "haiku")] - let d_dev = input.d_dev; - #[cfg(target_os = "haiku")] - let d_pdev = input.d_pdev; - #[cfg(target_os = "haiku")] - let d_pino = input.d_pino; - - // Construct the input. Rust will give us an error if any OS has a input - // with a field that we missed here. And we can avoid blindly copying the - // whole `d_name` field, which may not be entirely allocated. - #[cfg_attr(target_os = "wasi", allow(unused_mut))] - #[cfg(not(freebsdlike))] - let mut dirent = libc_dirent { - #[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 = "netbsd", - target_os = "wasi", - )))] - d_off, - #[cfg(target_os = "aix")] - d_offset, - #[cfg(not(any(netbsdlike, target_os = "freebsd")))] - d_ino, - #[cfg(any(netbsdlike, target_os = "freebsd"))] - d_fileno, - #[cfg(not(target_os = "wasi"))] - d_reclen, - #[cfg(any(apple, netbsdlike, target_os = "aix", target_os = "freebsd"))] - d_namlen, - #[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 - // extent of the `struct dirent`, because they may not be allocated. So - // don't read it from `dirent_ptr`. - // - // In theory this could use `MaybeUninit::uninit().assume_init()`, but - // that [invokes undefined behavior]. - // - // [invokes undefined behavior]: https://doc.rust-lang.org/stable/core/mem/union.MaybeUninit.html#initialization-invariant - d_name: zeroed(), - #[cfg(target_os = "openbsd")] - __d_padding: zeroed(), - #[cfg(target_os = "haiku")] - d_dev, - #[cfg(target_os = "haiku")] - d_pdev, - #[cfg(target_os = "haiku")] - d_pino, - }; - /* - pub d_ino: ino_t, - pub d_pino: i64, - pub d_reclen: ::c_ushort, - pub d_name: [::c_char; 1024], // Max length is _POSIX_PATH_MAX - */ - - // On dragonfly and FreeBSD 12, `dirent` has some non-public padding fields - // so we can't directly initialize it. - #[cfg(freebsdlike)] - let mut dirent = { - let mut dirent: libc_dirent = zeroed(); - dirent.d_fileno = d_fileno; - dirent.d_namlen = d_namlen; - dirent.d_type = d_type; - #[cfg(target_os = "freebsd")] - { - dirent.d_reclen = d_reclen; - } - dirent - }; - - // Copy from d_name, reading up to and including the first NUL. - #[cfg(not(target_os = "wasi"))] - { - let name_len = CStr::from_ptr(input.d_name.as_ptr()) - .to_bytes_with_nul() - .len(); - dirent.d_name[..name_len].copy_from_slice(&input.d_name[..name_len]); - } - - dirent -} - /// `Dir` implements `Send` but not `Sync`, because we use `readdir` which is /// not guaranteed to be thread-safe. Users can wrap this in a `Mutex` if they /// need `Sync`, which is effectively what'd need to do to implement `Sync` @@ -299,9 +179,15 @@ impl fmt::Debug for Dir { /// `struct dirent` #[derive(Debug)] pub struct DirEntry { - dirent: libc_dirent, + #[cfg(not(any(solarish, target_os = "aix", target_os = "haiku")))] + d_type: u8, + + #[cfg(not(any(freebsdlike, netbsdlike)))] + d_ino: libc_ino_t, + + #[cfg(any(freebsdlike, netbsdlike))] + d_fileno: libc_ino_t, - #[cfg(target_os = "wasi")] name: CString, } @@ -309,12 +195,6 @@ impl DirEntry { /// Returns the file name of this directory entry. #[inline] pub fn file_name(&self) -> &CStr { - #[cfg(not(target_os = "wasi"))] - unsafe { - CStr::from_ptr(self.dirent.d_name.as_ptr()) - } - - #[cfg(target_os = "wasi")] &self.name } @@ -322,14 +202,14 @@ impl DirEntry { #[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) + FileType::from_dirent_d_type(self.d_type) } /// Return the inode number of this directory entry. #[cfg(not(any(freebsdlike, netbsdlike)))] #[inline] pub fn ino(&self) -> u64 { - self.dirent.d_ino as u64 + self.d_ino as u64 } /// Return the inode number of this directory entry. @@ -337,7 +217,7 @@ impl DirEntry { #[inline] pub fn ino(&self) -> u64 { #[allow(clippy::useless_conversion)] - self.dirent.d_fileno.into() + self.d_fileno.into() } } diff --git a/vendor/rustix/src/backend/libc/fs/syscalls.rs b/vendor/rustix/src/backend/libc/fs/syscalls.rs index 77b49ee3e..40c160182 100644 --- a/vendor/rustix/src/backend/libc/fs/syscalls.rs +++ b/vendor/rustix/src/backend/libc/fs/syscalls.rs @@ -1,11 +1,9 @@ //! libc syscalls supporting `rustix::fs`. use super::super::c; -use super::super::conv::{ - borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd, ret_ssize_t, -}; +use super::super::conv::{borrowed_fd, c_str, ret, ret_c_int, ret_off_t, ret_owned_fd, ret_usize}; #[cfg(any(target_os = "android", target_os = "linux"))] -use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_ssize_t}; +use super::super::conv::{syscall_ret, syscall_ret_owned_fd, syscall_ret_usize}; #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] use super::super::offset::libc_fallocate; #[cfg(not(any( @@ -38,7 +36,7 @@ use super::super::offset::{libc_fstat, libc_fstatat, libc_ftruncate, libc_lseek, target_os = "wasi", )))] use super::super::offset::{libc_fstatfs, libc_statfs}; -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(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"), @@ -49,8 +47,6 @@ use crate::fd::{BorrowedFd, OwnedFd}; use crate::ffi::CStr; #[cfg(apple)] use crate::ffi::CString; -#[cfg(not(solarish))] -use crate::fs::Access; #[cfg(not(any( apple, netbsdlike, @@ -87,12 +83,14 @@ use crate::fs::SealFlags; target_os = "wasi", )))] use crate::fs::StatFs; +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +use crate::fs::XattrFlags; #[cfg(any(target_os = "android", target_os = "linux"))] use crate::fs::{cwd, RenameFlags, ResolveFlags, Statx, StatxFlags}; +use crate::fs::{Access, Mode, OFlags, Stat, Timestamps}; #[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(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] use crate::fs::{StatVfs, StatVfsMountFlags}; use crate::io::{self, SeekFrom}; #[cfg(not(target_os = "wasi"))] @@ -162,7 +160,7 @@ pub(crate) fn openat( mode: Mode, ) -> io::Result<OwnedFd> { // Work around <https://sourceware.org/bugzilla/show_bug.cgi?id=17523>. - // GLIBC versions before 2.25 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); @@ -196,7 +194,7 @@ pub(crate) fn statfs(filename: &CStr) -> io::Result<StatFs> { } } -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> { unsafe { @@ -210,13 +208,12 @@ pub(crate) fn statvfs(filename: &CStr) -> io::Result<StatVfs> { #[inline] pub(crate) fn readlinkat(dirfd: BorrowedFd<'_>, path: &CStr, buf: &mut [u8]) -> io::Result<usize> { unsafe { - ret_ssize_t(c::readlinkat( + ret_usize(c::readlinkat( borrowed_fd(dirfd), c_str(path), buf.as_mut_ptr().cast::<c::c_char>(), buf.len(), )) - .map(|nread| nread as usize) } } @@ -237,14 +234,13 @@ pub(crate) fn getdents_uninit( buf: &mut [MaybeUninit<u8>], ) -> io::Result<usize> { unsafe { - syscall_ret_ssize_t(c::syscall( + syscall_ret_usize(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"))] @@ -402,7 +398,7 @@ fn statat_old(dirfd: BorrowedFd<'_>, path: &CStr, flags: AtFlags) -> io::Result< } } -#[cfg(not(any(solarish, target_os = "emscripten", target_os = "redox")))] +#[cfg(not(any(target_os = "emscripten", target_os = "redox")))] pub(crate) fn accessat( dirfd: BorrowedFd<'_>, path: &CStr, @@ -549,7 +545,7 @@ pub(crate) fn utimensat( flags_arg, ) != 0 { - // Translate expected errno codes into ad-hoc integer + // Translate expected `errno` codes into ad-hoc integer // values suitable for exit statuses. let code = match libc_errno::errno().0 { c::EACCES => 2, @@ -573,7 +569,8 @@ pub(crate) fn utimensat( let mut wstatus = 0; let _ = ret_c_int(c::waitpid(child_pid, &mut wstatus, 0))?; if c::WIFEXITED(wstatus) { - // Translate our ad-hoc exit statuses back to errno codes. + // Translate our ad-hoc exit statuses back to `errno` + // codes. match c::WEXITSTATUS(wstatus) { 0 => Ok(()), 2 => Err(io::Errno::ACCESS), @@ -769,7 +766,7 @@ pub(crate) fn copy_file_range( null_mut() }; let copied = unsafe { - syscall_ret_ssize_t(c::syscall( + syscall_ret_usize(c::syscall( c::SYS_copy_file_range, borrowed_fd(fd_in), off_in_ptr, @@ -785,7 +782,7 @@ pub(crate) fn copy_file_range( if let Some(off_out) = off_out { *off_out = off_out_val as u64; } - Ok(copied as usize) + Ok(copied) } #[cfg(not(any( @@ -961,23 +958,23 @@ pub(crate) fn flock(fd: BorrowedFd<'_>, operation: FlockOperation) -> io::Result #[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`. + // Some versions of Android libc lack a `syncfs` function. #[cfg(target_os = "android")] unsafe { - syscall_ret(c::syscall(c::SYS_sync)).ok(); + syscall_ret(c::syscall(c::SYS_syncfs, borrowed_fd(fd))) } #[cfg(not(target_os = "android"))] unsafe { - c::sync() + ret(c::syncfs(borrowed_fd(fd))) } } +#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +pub(crate) fn sync() { + 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`. @@ -1033,7 +1030,7 @@ pub(crate) fn fstatfs(fd: BorrowedFd<'_>) -> io::Result<StatFs> { } } -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(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 { @@ -1042,7 +1039,7 @@ pub(crate) fn fstatvfs(fd: BorrowedFd<'_>) -> io::Result<StatVfs> { } } -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(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, @@ -1322,13 +1319,12 @@ pub(crate) fn sendfile( count: usize, ) -> io::Result<usize> { unsafe { - let nsent = ret_ssize_t(c::sendfile64( + ret_usize(c::sendfile64( borrowed_fd(out_fd), borrowed_fd(in_fd), offset.map_or(null_mut(), crate::utils::as_mut_ptr).cast(), count, - ))?; - Ok(nsent as usize) + )) } } @@ -1525,7 +1521,7 @@ pub(crate) fn statx( // // [it's deprecated]: https://patchwork.kernel.org/project/linux-fsdevel/patch/20200505095915.11275-7-mszeredi@redhat.com/ #[cfg(not(any(target_os = "android", target_env = "musl")))] - const STATX__RESERVED: u32 = libc::STATX__RESERVED as u32; + const STATX__RESERVED: u32 = c::STATX__RESERVED as u32; #[cfg(any(target_os = "android", target_env = "musl"))] const STATX__RESERVED: u32 = linux_raw_sys::general::STATX__RESERVED; if (mask.bits() & STATX__RESERVED) == STATX__RESERVED { @@ -1638,11 +1634,11 @@ pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> { // instead. let mut buf = alloc::vec![0; c::PATH_MAX as usize]; - // From the [macOS `fcntl` man page]: + // From the [macOS `fcntl` manual page]: // `F_GETPATH` - Get the path of the file descriptor `Fildes`. The argument // must be a buffer of size `MAXPATHLEN` or greater. // - // [macOS `fcntl` man page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html + // [macOS `fcntl` manual page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html unsafe { ret(c::fcntl(borrowed_fd(fd), c::F_GETPATH, buf.as_mut_ptr()))?; } @@ -1659,7 +1655,7 @@ pub(crate) fn getpath(fd: BorrowedFd<'_>) -> io::Result<CString> { #[cfg(apple)] pub(crate) fn fcntl_rdadvise(fd: BorrowedFd<'_>, offset: u64, len: u64) -> io::Result<()> { - // From the [macOS `fcntl` man page]: + // From the [macOS `fcntl` manual page]: // `F_RDADVISE` - Issue an advisory read async with no copy to user. // // The `F_RDADVISE` command operates on the following structure which holds @@ -1672,7 +1668,7 @@ pub(crate) fn fcntl_rdadvise(fd: BorrowedFd<'_>, offset: u64, len: u64) -> io::R // }; // ``` // - // [macOS `fcntl` man page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html + // [macOS `fcntl` manual page]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html let ra_offset = match offset.try_into() { Ok(len) => len, // If this conversion fails, the user is providing an offset outside @@ -1808,3 +1804,273 @@ pub(crate) fn mount( pub(crate) fn unmount(target: &CStr, flags: super::types::UnmountFlags) -> io::Result<()> { unsafe { ret(c::umount2(target.as_ptr(), flags.bits())) } } + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn getxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> { + let value_ptr = value.as_mut_ptr(); + + #[cfg(not(apple))] + unsafe { + ret_usize(c::getxattr( + path.as_ptr(), + name.as_ptr(), + value_ptr.cast::<c::c_void>(), + value.len(), + )) + } + + #[cfg(apple)] + unsafe { + ret_usize(c::getxattr( + path.as_ptr(), + name.as_ptr(), + value_ptr.cast::<c::c_void>(), + value.len(), + 0, + 0, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn lgetxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> { + let value_ptr = value.as_mut_ptr(); + + #[cfg(not(apple))] + unsafe { + ret_usize(c::lgetxattr( + path.as_ptr(), + name.as_ptr(), + value_ptr.cast::<c::c_void>(), + value.len(), + )) + } + + #[cfg(apple)] + unsafe { + ret_usize(c::getxattr( + path.as_ptr(), + name.as_ptr(), + value_ptr.cast::<c::c_void>(), + value.len(), + 0, + c::XATTR_NOFOLLOW, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn fgetxattr(fd: BorrowedFd<'_>, name: &CStr, value: &mut [u8]) -> io::Result<usize> { + let value_ptr = value.as_mut_ptr(); + + #[cfg(not(apple))] + unsafe { + ret_usize(c::fgetxattr( + borrowed_fd(fd), + name.as_ptr(), + value_ptr.cast::<c::c_void>(), + value.len(), + )) + } + + #[cfg(apple)] + unsafe { + ret_usize(c::fgetxattr( + borrowed_fd(fd), + name.as_ptr(), + value_ptr.cast::<c::c_void>(), + value.len(), + 0, + 0, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn setxattr( + path: &CStr, + name: &CStr, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + #[cfg(not(apple))] + unsafe { + ret(c::setxattr( + path.as_ptr(), + name.as_ptr(), + value.as_ptr().cast::<c::c_void>(), + value.len(), + flags.bits() as i32, + )) + } + + #[cfg(apple)] + unsafe { + ret(c::setxattr( + path.as_ptr(), + name.as_ptr(), + value.as_ptr().cast::<c::c_void>(), + value.len(), + 0, + flags.bits() as i32, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn lsetxattr( + path: &CStr, + name: &CStr, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + #[cfg(not(apple))] + unsafe { + ret(c::lsetxattr( + path.as_ptr(), + name.as_ptr(), + value.as_ptr().cast::<c::c_void>(), + value.len(), + flags.bits() as i32, + )) + } + + #[cfg(apple)] + unsafe { + ret(c::setxattr( + path.as_ptr(), + name.as_ptr(), + value.as_ptr().cast::<c::c_void>(), + value.len(), + 0, + flags.bits() as i32 | c::XATTR_NOFOLLOW, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn fsetxattr( + fd: BorrowedFd<'_>, + name: &CStr, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + #[cfg(not(apple))] + unsafe { + ret(c::fsetxattr( + borrowed_fd(fd), + name.as_ptr(), + value.as_ptr().cast::<c::c_void>(), + value.len(), + flags.bits() as i32, + )) + } + + #[cfg(apple)] + unsafe { + ret(c::fsetxattr( + borrowed_fd(fd), + name.as_ptr(), + value.as_ptr().cast::<c::c_void>(), + value.len(), + 0, + flags.bits() as i32, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn listxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> { + #[cfg(not(apple))] + unsafe { + ret_usize(c::listxattr(path.as_ptr(), list.as_mut_ptr(), list.len())) + } + + #[cfg(apple)] + unsafe { + ret_usize(c::listxattr( + path.as_ptr(), + list.as_mut_ptr(), + list.len(), + 0, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn llistxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> { + #[cfg(not(apple))] + unsafe { + ret_usize(c::llistxattr(path.as_ptr(), list.as_mut_ptr(), list.len())) + } + + #[cfg(apple)] + unsafe { + ret_usize(c::listxattr( + path.as_ptr(), + list.as_mut_ptr(), + list.len(), + c::XATTR_NOFOLLOW, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn flistxattr(fd: BorrowedFd<'_>, list: &mut [c::c_char]) -> io::Result<usize> { + let fd = borrowed_fd(fd); + + #[cfg(not(apple))] + unsafe { + ret_usize(c::flistxattr(fd, list.as_mut_ptr(), list.len())) + } + + #[cfg(apple)] + unsafe { + ret_usize(c::flistxattr(fd, list.as_mut_ptr(), list.len(), 0)) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn removexattr(path: &CStr, name: &CStr) -> io::Result<()> { + #[cfg(not(apple))] + unsafe { + ret(c::removexattr(path.as_ptr(), name.as_ptr())) + } + + #[cfg(apple)] + unsafe { + ret(c::removexattr(path.as_ptr(), name.as_ptr(), 0)) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn lremovexattr(path: &CStr, name: &CStr) -> io::Result<()> { + #[cfg(not(apple))] + unsafe { + ret(c::lremovexattr(path.as_ptr(), name.as_ptr())) + } + + #[cfg(apple)] + unsafe { + ret(c::removexattr( + path.as_ptr(), + name.as_ptr(), + c::XATTR_NOFOLLOW, + )) + } +} + +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> { + let fd = borrowed_fd(fd); + + #[cfg(not(apple))] + unsafe { + ret(c::fremovexattr(fd, name.as_ptr())) + } + + #[cfg(apple)] + unsafe { + ret(c::fremovexattr(fd, name.as_ptr(), 0)) + } +} diff --git a/vendor/rustix/src/backend/libc/fs/types.rs b/vendor/rustix/src/backend/libc/fs/types.rs index f635f2cca..0cf7fe8ff 100644 --- a/vendor/rustix/src/backend/libc/fs/types.rs +++ b/vendor/rustix/src/backend/libc/fs/types.rs @@ -138,8 +138,8 @@ bitflags! { } impl Mode { - /// Construct a `Mode` from the mode bits of the `st_mode` field of - /// a `Stat`. + /// Construct a `Mode` from the mode bits of the `st_mode` field of a + /// `Stat`. #[inline] pub const fn from_raw_mode(st_mode: RawMode) -> Self { Self::from_bits_truncate(st_mode) @@ -334,7 +334,9 @@ mod copyfile { #[cfg(apple)] bitflags! { - /// `COPYFILE_*` constants. + /// `COPYFILE_*` constants for use with [`fcopyfile`]. + /// + /// [`fcopyfile`]: crate::fs::fcopyfile pub struct CopyfileFlags: c::c_uint { /// `COPYFILE_ACL` const ACL = copyfile::ACL; @@ -440,6 +442,7 @@ pub enum FileType { impl FileType { /// Construct a `FileType` from the `S_IFMT` bits of the `st_mode` field of /// a `Stat`. + #[inline] pub const fn from_raw_mode(st_mode: RawMode) -> Self { match (st_mode as c::mode_t) & c::S_IFMT { c::S_IFREG => Self::RegularFile, @@ -456,6 +459,7 @@ impl FileType { } /// Construct an `st_mode` value from `Stat`. + #[inline] pub const fn as_raw_mode(self) -> RawMode { match self { Self::RegularFile => c::S_IFREG as RawMode, @@ -473,6 +477,7 @@ impl FileType { /// Construct a `FileType` from the `d_type` field of a `c::dirent`. #[cfg(not(any(solarish, target_os = "haiku", target_os = "redox")))] + #[inline] pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self { match d_type { c::DT_REG => Self::RegularFile, @@ -773,43 +778,43 @@ bitflags! { } } -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] bitflags! { /// `ST_*` constants for use with [`StatVfs`]. pub struct StatVfsMountFlags: u64 { /// `ST_MANDLOCK` #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] - const MANDLOCK = libc::ST_MANDLOCK as u64; + const MANDLOCK = c::ST_MANDLOCK as u64; /// `ST_NOATIME` #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] - const NOATIME = libc::ST_NOATIME as u64; + const NOATIME = c::ST_NOATIME as u64; /// `ST_NODEV` #[cfg(any(target_os = "aix", target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] - const NODEV = libc::ST_NODEV as u64; + const NODEV = c::ST_NODEV as u64; /// `ST_NODIRATIME` #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] - const NODIRATIME = libc::ST_NODIRATIME as u64; + const NODIRATIME = c::ST_NODIRATIME as u64; /// `ST_NOEXEC` #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] - const NOEXEC = libc::ST_NOEXEC as u64; + const NOEXEC = c::ST_NOEXEC as u64; /// `ST_NOSUID` - const NOSUID = libc::ST_NOSUID as u64; + const NOSUID = c::ST_NOSUID as u64; /// `ST_RDONLY` - const RDONLY = libc::ST_RDONLY as u64; + const RDONLY = c::ST_RDONLY as u64; /// `ST_RELATIME` #[cfg(any(target_os = "android", all(target_os = "linux", target_env = "gnu")))] - const RELATIME = libc::ST_RELATIME as u64; + const RELATIME = c::ST_RELATIME as u64; /// `ST_SYNCHRONOUS` #[cfg(any(target_os = "android", target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] - const SYNCHRONOUS = libc::ST_SYNCHRONOUS as u64; + const SYNCHRONOUS = c::ST_SYNCHRONOUS as u64; } } @@ -915,7 +920,7 @@ pub type StatFs = c::statfs64; /// /// [`statvfs`]: crate::fs::statvfs /// [`fstatvfs`]: crate::fs::fstatvfs -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[allow(missing_docs)] pub struct StatVfs { pub f_bsize: u64, @@ -1106,7 +1111,7 @@ bitflags! { bitflags! { /// `MS_*` constants for use with [`change_mount`]. /// - /// [`change_mount`]: crate::fs::mount::change_mount. + /// [`change_mount`]: crate::fs::mount::change_mount pub struct MountPropagationFlags: c::c_ulong { /// `MS_SHARED` const SHARED = c::MS_SHARED; diff --git a/vendor/rustix/src/backend/libc/io/syscalls.rs b/vendor/rustix/src/backend/libc/io/syscalls.rs index 03f9294d9..b74a63fa3 100644 --- a/vendor/rustix/src/backend/libc/io/syscalls.rs +++ b/vendor/rustix/src/backend/libc/io/syscalls.rs @@ -3,9 +3,12 @@ use super::super::c; #[cfg(any(target_os = "android", target_os = "linux"))] use super::super::conv::syscall_ret_owned_fd; -use super::super::conv::{ - borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_ssize_t, -}; +#[cfg(any( + target_os = "android", + all(target_os = "linux", not(target_env = "gnu")), +))] +use super::super::conv::syscall_ret_usize; +use super::super::conv::{borrowed_fd, ret, ret_c_int, ret_discarded_fd, ret_owned_fd, ret_usize}; use super::super::offset::{libc_pread, libc_pwrite}; #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] use super::super::offset::{libc_preadv, libc_pwritev}; @@ -18,11 +21,18 @@ use crate::io::kqueue::Event; use crate::io::port::Event; #[cfg(not(any(target_os = "aix", target_os = "wasi")))] use crate::io::DupFlags; +#[cfg(any( + target_os = "android", + target_os = "freebsd", + target_os = "illumos", + target_os = "linux" +))] +use crate::io::EventfdFlags; #[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"))] -use crate::io::{EventfdFlags, IoSliceRaw, ReadWriteFlags, SpliceFlags}; +use crate::io::{IoSliceRaw, ReadWriteFlags, SpliceFlags}; use core::cmp::min; use core::convert::TryInto; use core::mem::MaybeUninit; @@ -32,25 +42,23 @@ use core::ptr; use libc_errno::errno; pub(crate) fn read(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> { - let nread = unsafe { - ret_ssize_t(c::read( + unsafe { + ret_usize(c::read( borrowed_fd(fd), buf.as_mut_ptr().cast(), min(buf.len(), READ_LIMIT), - ))? - }; - Ok(nread as usize) + )) + } } pub(crate) fn write(fd: BorrowedFd<'_>, buf: &[u8]) -> io::Result<usize> { - let nwritten = unsafe { - ret_ssize_t(c::write( + unsafe { + ret_usize(c::write( borrowed_fd(fd), buf.as_ptr().cast(), min(buf.len(), READ_LIMIT), - ))? - }; - Ok(nwritten as usize) + )) + } } pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], offset: u64) -> io::Result<usize> { @@ -59,15 +67,14 @@ pub(crate) fn pread(fd: BorrowedFd<'_>, buf: &mut [u8], offset: u64) -> io::Resu // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; - let nread = unsafe { - ret_ssize_t(libc_pread( + unsafe { + ret_usize(libc_pread( borrowed_fd(fd), buf.as_mut_ptr().cast(), len, offset, - ))? - }; - Ok(nread as usize) + )) + } } pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result<usize> { @@ -76,37 +83,34 @@ pub(crate) fn pwrite(fd: BorrowedFd<'_>, buf: &[u8], offset: u64) -> io::Result< // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; - let nwritten = unsafe { - ret_ssize_t(libc_pwrite( + unsafe { + ret_usize(libc_pwrite( borrowed_fd(fd), buf.as_ptr().cast(), len, offset, - ))? - }; - Ok(nwritten as usize) + )) + } } pub(crate) fn readv(fd: BorrowedFd<'_>, bufs: &mut [IoSliceMut]) -> io::Result<usize> { - let nread = unsafe { - ret_ssize_t(c::readv( + unsafe { + ret_usize(c::readv( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()) as c::c_int, - ))? - }; - Ok(nread as usize) + )) + } } pub(crate) fn writev(fd: BorrowedFd<'_>, bufs: &[IoSlice]) -> io::Result<usize> { - let nwritten = unsafe { - ret_ssize_t(c::writev( + unsafe { + ret_usize(c::writev( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()) as c::c_int, - ))? - }; - Ok(nwritten as usize) + )) + } } #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] @@ -117,30 +121,28 @@ pub(crate) fn preadv( ) -> io::Result<usize> { // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; - let nread = unsafe { - ret_ssize_t(libc_preadv( + unsafe { + ret_usize(libc_preadv( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()) as c::c_int, offset, - ))? - }; - Ok(nread as usize) + )) + } } #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] pub(crate) fn pwritev(fd: BorrowedFd<'_>, bufs: &[IoSlice], offset: u64) -> io::Result<usize> { // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; - let nwritten = unsafe { - ret_ssize_t(libc_pwritev( + unsafe { + ret_usize(libc_pwritev( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()) as c::c_int, offset, - ))? - }; - Ok(nwritten as usize) + )) + } } #[cfg(all(target_os = "linux", target_env = "gnu"))] @@ -152,20 +154,19 @@ pub(crate) fn preadv2( ) -> io::Result<usize> { // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; - let nread = unsafe { - ret_ssize_t(libc_preadv2( + unsafe { + ret_usize(libc_preadv2( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()) as c::c_int, offset, flags.bits(), - ))? - }; - Ok(nread as usize) + )) + } } /// At present, `libc` only has `preadv2` defined for glibc. On other -/// ABIs, use `libc::syscall`. +/// ABIs, use `c::syscall`. #[cfg(any( target_os = "android", all(target_os = "linux", not(target_env = "gnu")), @@ -179,17 +180,16 @@ pub(crate) fn preadv2( ) -> io::Result<usize> { // 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, + unsafe { + syscall_ret_usize(c::syscall( + c::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"))] @@ -201,20 +201,19 @@ pub(crate) fn pwritev2( ) -> io::Result<usize> { // Silently cast; we'll get `EINVAL` if the value is negative. let offset = offset as i64; - let nwritten = unsafe { - ret_ssize_t(libc_pwritev2( + unsafe { + ret_usize(libc_pwritev2( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()) as c::c_int, offset, flags.bits(), - ))? - }; - Ok(nwritten as usize) + )) + } } /// At present, `libc` only has `pwritev2` defined for glibc. On other -/// ABIs, use `libc::syscall`. +/// ABIs, use `c::syscall`. #[cfg(any( target_os = "android", all(target_os = "linux", not(target_env = "gnu")), @@ -228,25 +227,24 @@ pub(crate) fn pwritev2( ) -> io::Result<usize> { // 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, + unsafe { + syscall_ret_usize(c::syscall( + c::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 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 -// `SSIZE_MAX` the result is "unspecified". +// manual page quoting that if the count of bytes to read is greater than +// `SSIZE_MAX` the result is “unspecified”. // // On macOS, however, apparently the 64-bit libc is either buggy or // intentionally showing odd behavior by rejecting any read with a size larger @@ -293,6 +291,11 @@ pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> unsafe { syscall_ret_owned_fd(c::syscall(c::SYS_eventfd2, initval, flags.bits())) } } +#[cfg(any(target_os = "freebsd", target_os = "illumos"))] +pub(crate) fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> { + unsafe { ret_owned_fd(c::eventfd(initval, flags.bits())) } +} + #[cfg(any(target_os = "android", target_os = "linux"))] #[inline] pub(crate) fn ioctl_blksszget(fd: BorrowedFd) -> io::Result<u32> { @@ -338,13 +341,15 @@ 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") - ))] + // TODO: Enable this on mips and power once libc is updated. + #[cfg(not(any( + target_arch = "mips", + target_arch = "mips64", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "sparc", + target_arch = "sparc64" + )))] unsafe { ret(c::ioctl( borrowed_fd(fd), @@ -352,10 +357,15 @@ pub(crate) fn ioctl_ficlone(fd: BorrowedFd<'_>, src_fd: BorrowedFd<'_>) -> io::R borrowed_fd(src_fd), )) } - #[cfg(not(all( - target_os = "linux", - any(target_arch = "x86", target_arch = "x86_64", target_arch = "aarch64") - )))] + + #[cfg(any( + target_arch = "mips", + target_arch = "mips64", + target_arch = "powerpc", + target_arch = "powerpc64", + target_arch = "sparc", + target_arch = "sparc64" + ))] { let _ = fd; let _ = src_fd; @@ -475,7 +485,13 @@ pub(crate) fn dup3(fd: BorrowedFd<'_>, new: &mut OwnedFd, _flags: DupFlags) -> i #[cfg(apple)] pub(crate) fn ioctl_fioclex(fd: BorrowedFd<'_>) -> io::Result<()> { - unsafe { ret(c::ioctl(borrowed_fd(fd), c::FIOCLEX)) } + unsafe { + ret(c::ioctl( + borrowed_fd(fd), + c::FIOCLEX, + core::ptr::null_mut::<u8>(), + )) + } } #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] @@ -565,17 +581,16 @@ pub fn splice( .map(|off| (off as *mut u64).cast()) .unwrap_or(ptr::null_mut()); - ret_ssize_t(unsafe { - c::splice( + unsafe { + ret_usize(c::splice( borrowed_fd(fd_in), off_in, borrowed_fd(fd_out), off_out, len, flags.bits(), - ) - }) - .map(|spliced| spliced as usize) + )) + } } #[cfg(any(target_os = "android", target_os = "linux"))] @@ -585,13 +600,12 @@ pub unsafe fn vmsplice( bufs: &[IoSliceRaw], flags: SpliceFlags, ) -> io::Result<usize> { - ret_ssize_t(c::vmsplice( + ret_usize(c::vmsplice( borrowed_fd(fd), bufs.as_ptr().cast::<c::iovec>(), min(bufs.len(), max_iov()), flags.bits(), )) - .map(|spliced| spliced as usize) } #[cfg(solarish)] diff --git a/vendor/rustix/src/backend/libc/io/types.rs b/vendor/rustix/src/backend/libc/io/types.rs index cbdd734b9..90a5e15b5 100644 --- a/vendor/rustix/src/backend/libc/io/types.rs +++ b/vendor/rustix/src/backend/libc/io/types.rs @@ -87,7 +87,12 @@ bitflags! { } } -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any( + target_os = "android", + target_os = "freebsd", + target_os = "illumos", + target_os = "linux" +))] bitflags! { /// `EFD_*` flags for use with [`eventfd`]. /// @@ -129,7 +134,7 @@ pub struct IoSliceRaw<'a> { #[cfg(any(target_os = "android", target_os = "linux"))] 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 { @@ -140,7 +145,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/libc/mm/types.rs b/vendor/rustix/src/backend/libc/mm/types.rs index cd6e521d2..798fda86b 100644 --- a/vendor/rustix/src/backend/libc/mm/types.rs +++ b/vendor/rustix/src/backend/libc/mm/types.rs @@ -346,9 +346,9 @@ pub enum Advice { } #[cfg(target_os = "emscripten")] +#[allow(non_upper_case_globals)] impl Advice { /// `POSIX_MADV_DONTNEED` - #[allow(non_upper_case_globals)] pub const DontNeed: Self = Self::Normal; } diff --git a/vendor/rustix/src/backend/libc/mod.rs b/vendor/rustix/src/backend/libc/mod.rs index 1961d1291..f3433903d 100644 --- a/vendor/rustix/src/backend/libc/mod.rs +++ b/vendor/rustix/src/backend/libc/mod.rs @@ -11,10 +11,6 @@ // one platform where it's redundant on another. #![allow(clippy::useless_conversion)] -#[cfg(not(any(windows, target_os = "wasi")))] -#[macro_use] -mod weak; - mod conv; mod offset; diff --git a/vendor/rustix/src/backend/libc/net/send_recv.rs b/vendor/rustix/src/backend/libc/net/send_recv.rs index 114807808..49c6f2c22 100644 --- a/vendor/rustix/src/backend/libc/net/send_recv.rs +++ b/vendor/rustix/src/backend/libc/net/send_recv.rs @@ -2,7 +2,10 @@ use super::super::c; use bitflags::bitflags; bitflags! { - /// `MSG_*` + /// `MSG_* flags for use with [`send`], [`send_to`], and related functions. + /// + /// [`send`]: crate::net::send + /// [`sendto`]: crate::net::sendto pub struct SendFlags: i32 { /// `MSG_CONFIRM` #[cfg(not(any( @@ -37,7 +40,10 @@ bitflags! { } bitflags! { - /// `MSG_*` + /// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions. + /// + /// [`recv`]: crate::net::recv + /// [`recvfrom`]: crate::net::recvfrom pub struct RecvFlags: i32 { #[cfg(not(any(apple, solarish, windows, target_os = "haiku")))] /// `MSG_CMSG_CLOEXEC` diff --git a/vendor/rustix/src/backend/libc/net/syscalls.rs b/vendor/rustix/src/backend/libc/net/syscalls.rs index ed4494394..ac260e552 100644 --- a/vendor/rustix/src/backend/libc/net/syscalls.rs +++ b/vendor/rustix/src/backend/libc/net/syscalls.rs @@ -12,7 +12,7 @@ use super::read_sockaddr::{maybe_read_sockaddr_os, read_sockaddr_os}; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] use super::send_recv::{RecvFlags, SendFlags}; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] -use super::types::{AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType}; +use super::types::{AddressFamily, Protocol, Shutdown, SocketFlags, SocketType}; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] use super::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6}; use crate::fd::{BorrowedFd, OwnedFd}; @@ -26,28 +26,26 @@ use core::ptr::null_mut; #[cfg(not(any(target_os = "redox", target_os = "wasi")))] pub(crate) fn recv(fd: BorrowedFd<'_>, buf: &mut [u8], flags: RecvFlags) -> io::Result<usize> { - let nrecv = unsafe { + unsafe { ret_send_recv(c::recv( borrowed_fd(fd), buf.as_mut_ptr().cast(), send_recv_len(buf.len()), flags.bits(), - ))? - }; - Ok(nrecv as usize) + )) + } } #[cfg(not(any(target_os = "redox", target_os = "wasi")))] pub(crate) fn send(fd: BorrowedFd<'_>, buf: &[u8], flags: SendFlags) -> io::Result<usize> { - let nwritten = unsafe { + unsafe { ret_send_recv(c::send( borrowed_fd(fd), buf.as_ptr().cast(), send_recv_len(buf.len()), flags.bits(), - ))? - }; - Ok(nwritten as usize) + )) + } } #[cfg(not(any(target_os = "redox", target_os = "wasi")))] @@ -65,18 +63,20 @@ pub(crate) fn recvfrom( // `AF_UNSPEC` so that we can detect this case. initialize_family_to_unspec(storage.as_mut_ptr()); - let nread = ret_send_recv(c::recvfrom( + ret_send_recv(c::recvfrom( borrowed_fd(fd), buf.as_mut_ptr().cast(), send_recv_len(buf.len()), flags.bits(), storage.as_mut_ptr().cast(), &mut len, - ))?; - Ok(( - nread as usize, - maybe_read_sockaddr_os(storage.as_ptr(), len.try_into().unwrap()), )) + .map(|nread| { + ( + nread, + maybe_read_sockaddr_os(storage.as_ptr(), len.try_into().unwrap()), + ) + }) } } @@ -87,7 +87,7 @@ pub(crate) fn sendto_v4( flags: SendFlags, addr: &SocketAddrV4, ) -> io::Result<usize> { - let nwritten = unsafe { + unsafe { ret_send_recv(c::sendto( borrowed_fd(fd), buf.as_ptr().cast(), @@ -95,9 +95,8 @@ pub(crate) fn sendto_v4( flags.bits(), as_ptr(&encode_sockaddr_v4(addr)).cast::<c::sockaddr>(), size_of::<SocketAddrV4>() as _, - ))? - }; - Ok(nwritten as usize) + )) + } } #[cfg(not(any(target_os = "redox", target_os = "wasi")))] @@ -107,7 +106,7 @@ pub(crate) fn sendto_v6( flags: SendFlags, addr: &SocketAddrV6, ) -> io::Result<usize> { - let nwritten = unsafe { + unsafe { ret_send_recv(c::sendto( borrowed_fd(fd), buf.as_ptr().cast(), @@ -115,9 +114,8 @@ pub(crate) fn sendto_v6( flags.bits(), as_ptr(&encode_sockaddr_v6(addr)).cast::<c::sockaddr>(), size_of::<SocketAddrV6>() as _, - ))? - }; - Ok(nwritten as usize) + )) + } } #[cfg(not(any(windows, target_os = "redox", target_os = "wasi")))] @@ -127,7 +125,7 @@ pub(crate) fn sendto_unix( flags: SendFlags, addr: &SocketAddrUnix, ) -> io::Result<usize> { - let nwritten = unsafe { + unsafe { ret_send_recv(c::sendto( borrowed_fd(fd), buf.as_ptr().cast(), @@ -135,9 +133,8 @@ pub(crate) fn sendto_unix( flags.bits(), as_ptr(&addr.unix).cast(), addr.addr_len(), - ))? - }; - Ok(nwritten as usize) + )) + } } #[cfg(not(any(target_os = "redox", target_os = "wasi")))] @@ -257,7 +254,7 @@ pub(crate) fn accept(sockfd: BorrowedFd<'_>) -> io::Result<OwnedFd> { target_os = "redox", target_os = "wasi", )))] -pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: AcceptFlags) -> io::Result<OwnedFd> { +pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<OwnedFd> { unsafe { let owned_fd = ret_owned_fd(c::accept4( borrowed_fd(sockfd), @@ -295,7 +292,7 @@ pub(crate) fn acceptfrom(sockfd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option< )))] pub(crate) fn acceptfrom_with( sockfd: BorrowedFd<'_>, - flags: AcceptFlags, + flags: SocketFlags, ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { unsafe { let mut storage = MaybeUninit::<c::sockaddr_storage>::uninit(); @@ -314,18 +311,18 @@ 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. +/// `SocketFlags` to have no flags, so we can discard it here. #[cfg(any(apple, windows, target_os = "haiku"))] -pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: AcceptFlags) -> io::Result<OwnedFd> { +pub(crate) fn accept_with(sockfd: BorrowedFd<'_>, _flags: SocketFlags) -> 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. +/// `SocketFlags` to have no flags, so we can discard it here. #[cfg(any(apple, windows, target_os = "haiku"))] pub(crate) fn acceptfrom_with( sockfd: BorrowedFd<'_>, - _flags: AcceptFlags, + _flags: SocketFlags, ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { acceptfrom(sockfd) } @@ -555,7 +552,7 @@ pub(crate) mod sockopt { // 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 + // “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); @@ -647,16 +644,53 @@ pub(crate) mod sockopt { } #[inline] - pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), crate::io::Errno>> { + pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), 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)) + Err(io::Errno::from_raw_os_error(err)) }) } #[inline] + pub(crate) fn set_socket_keepalive(fd: BorrowedFd<'_>, keepalive: bool) -> io::Result<()> { + setsockopt( + fd, + c::SOL_SOCKET as _, + c::SO_KEEPALIVE, + from_bool(keepalive), + ) + } + + #[inline] + pub(crate) fn get_socket_keepalive(fd: BorrowedFd<'_>) -> io::Result<bool> { + getsockopt(fd, c::SOL_SOCKET as _, c::SO_KEEPALIVE).map(to_bool) + } + + #[inline] + pub(crate) fn set_socket_recv_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> { + let size: c::c_int = size.try_into().map_err(|_| io::Errno::INVAL)?; + setsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF, size) + } + + #[inline] + pub(crate) fn get_socket_recv_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> { + getsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF).map(|size: u32| size as usize) + } + + #[inline] + pub(crate) fn set_socket_send_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> { + let size: c::c_int = size.try_into().map_err(|_| io::Errno::INVAL)?; + setsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF, size) + } + + #[inline] + pub(crate) fn get_socket_send_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> { + getsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF).map(|size: u32| size as usize) + } + + #[inline] pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> { setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl) } @@ -791,6 +825,20 @@ pub(crate) mod sockopt { } #[inline] + pub(crate) fn get_ipv6_unicast_hops(fd: BorrowedFd<'_>) -> io::Result<u8> { + getsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS).map(|hops: c::c_int| hops as u8) + } + + #[inline] + pub(crate) fn set_ipv6_unicast_hops(fd: BorrowedFd<'_>, hops: Option<u8>) -> io::Result<()> { + let hops = match hops { + Some(hops) => hops as c::c_int, + None => -1, + }; + setsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS, hops) + } + + #[inline] pub(crate) fn set_tcp_nodelay(fd: BorrowedFd<'_>, nodelay: bool) -> io::Result<()> { setsockopt(fd, c::IPPROTO_TCP as _, c::TCP_NODELAY, from_bool(nodelay)) } diff --git a/vendor/rustix/src/backend/libc/net/types.rs b/vendor/rustix/src/backend/libc/net/types.rs index 54f60ca50..d1d769cb4 100644 --- a/vendor/rustix/src/backend/libc/net/types.rs +++ b/vendor/rustix/src/backend/libc/net/types.rs @@ -53,6 +53,7 @@ pub type RawAddressFamily = c::sa_family_t; pub struct AddressFamily(pub(crate) RawAddressFamily); #[rustfmt::skip] +#[allow(non_upper_case_globals)] impl AddressFamily { /// `AF_UNSPEC` pub const UNSPEC: Self = Self(c::AF_UNSPEC as _); @@ -123,7 +124,6 @@ impl AddressFamily { )))] pub const ROSE: Self = Self(c::AF_ROSE as _); /// `AF_DECnet` - #[allow(non_upper_case_globals)] #[cfg(not(target_os = "haiku"))] pub const DECnet: Self = Self(c::AF_DECnet as _); /// `AF_NETBEUI` @@ -294,7 +294,10 @@ impl AddressFamily { #[doc(hidden)] pub type RawProtocol = i32; -/// `IPPROTO_*` +/// `IPPROTO_*` constants for use with [`socket`] and [`socket_with`]. +/// +/// [`socket`]: crate::net::socket +/// [`socket_with`]: crate::net::socket_with #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[repr(transparent)] pub struct Protocol(pub(crate) RawProtocol); @@ -464,25 +467,12 @@ pub enum Shutdown { } bitflags! { - /// `SOCK_*` constants for use with [`accept_with`] and [`acceptfrom_with`]. + /// `SOCK_*` constants for use with [`socket_with`], [`accept_with`] and + /// [`acceptfrom_with`]. /// + /// [`socket_with`]: crate::net::socket_with /// [`accept_with`]: crate::net::accept_with /// [`acceptfrom_with`]: crate::net::acceptfrom_with - pub struct AcceptFlags: c::c_int { - /// `SOCK_NONBLOCK` - #[cfg(not(any(apple, windows, target_os = "haiku")))] - const NONBLOCK = c::SOCK_NONBLOCK; - - /// `SOCK_CLOEXEC` - #[cfg(not(any(apple, windows, target_os = "haiku")))] - const CLOEXEC = c::SOCK_CLOEXEC; - } -} - -bitflags! { - /// `SOCK_*` constants for use with [`socket`]. - /// - /// [`socket`]: crate::net::socket pub struct SocketFlags: c::c_int { /// `SOCK_NONBLOCK` #[cfg(not(any(apple, windows, target_os = "haiku")))] diff --git a/vendor/rustix/src/backend/libc/offset.rs b/vendor/rustix/src/backend/libc/offset.rs index 9747eb954..d7a803415 100644 --- a/vendor/rustix/src/backend/libc/offset.rs +++ b/vendor/rustix/src/backend/libc/offset.rs @@ -6,15 +6,15 @@ use super::c; #[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, + fstat as libc_fstat, fstatat as libc_fstatat, ftruncate as libc_ftruncate, ino_t as libc_ino_t, + lseek as libc_lseek, off_t as libc_off_t, }; #[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, + ino64_t as libc_ino_t, lseek64 as libc_lseek, off64_t as libc_off_t, }; #[cfg(linux_like)] @@ -36,12 +36,11 @@ pub(super) use c::{rlimit as libc_rlimit, RLIM_INFINITY as LIBC_RLIM_INFINITY}; #[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(linux_like)] -pub(super) const LIBC_RLIM_INFINITY: u64 = !0_u64; - -#[cfg(linux_like)] -pub(super) use c::{getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit}; +pub(super) use c::{ + getrlimit64 as libc_getrlimit, setrlimit64 as libc_setrlimit, + RLIM64_INFINITY as LIBC_RLIM_INFINITY, +}; #[cfg(linux_like)] #[cfg(feature = "mm")] @@ -269,7 +268,7 @@ mod readwrite_pv { #[cfg(apple)] pub(super) use readwrite_pv::{preadv as libc_preadv, pwritev as libc_pwritev}; -// GLIBC added `preadv64v2` and `pwritev64v2` in version 2.26. +// glibc added `preadv64v2` and `pwritev64v2` in version 2.26. #[cfg(all(target_os = "linux", target_env = "gnu"))] mod readwrite_pv64v2 { use super::c; @@ -300,7 +299,7 @@ mod readwrite_pv64v2 { offset: c::off64_t, flags: c::c_int, ) -> c::ssize_t { - // Older GLIBC lacks `preadv64v2`, so use the `weak!` mechanism to + // 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. @@ -395,7 +394,6 @@ pub(super) use c::posix_fallocate64 as libc_posix_fallocate; pub(super) use {c::fstatfs as libc_fstatfs, c::statfs as libc_statfs}; #[cfg(not(any( linux_like, - solarish, windows, target_os = "haiku", target_os = "redox", diff --git a/vendor/rustix/src/backend/libc/process/syscalls.rs b/vendor/rustix/src/backend/libc/process/syscalls.rs index d208bda7a..d8f4fe3a4 100644 --- a/vendor/rustix/src/backend/libc/process/syscalls.rs +++ b/vendor/rustix/src/backend/libc/process/syscalls.rs @@ -5,7 +5,7 @@ use super::super::c; use super::super::conv::borrowed_fd; 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}; +use super::super::conv::{ret_infallible, ret_pid_t, ret_usize}; #[cfg(any(target_os = "android", target_os = "linux"))] use super::super::conv::{syscall_ret, syscall_ret_u32}; #[cfg(any( @@ -23,6 +23,8 @@ use crate::ffi::CStr; #[cfg(feature = "fs")] use crate::fs::Mode; use crate::io; +#[cfg(any(target_os = "android", target_os = "linux"))] +use crate::process::Sysinfo; #[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] use crate::process::{WaitId, WaitidOptions, WaitidStatus}; use core::mem::MaybeUninit; @@ -37,12 +39,12 @@ use { use { super::super::offset::{libc_getrlimit, libc_rlimit, libc_setrlimit, LIBC_RLIM_INFINITY}, crate::process::{Resource, Rlimit}, - core::convert::TryInto, }; #[cfg(not(target_os = "wasi"))] use { super::types::RawUname, crate::process::{Gid, Pid, RawNonZeroPid, RawPid, Signal, Uid, WaitOptions, WaitStatus}, + core::convert::TryInto, }; #[cfg(not(target_os = "wasi"))] @@ -55,6 +57,11 @@ pub(crate) fn fchdir(dirfd: BorrowedFd<'_>) -> io::Result<()> { unsafe { ret(c::fchdir(borrowed_fd(dirfd))) } } +#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +pub(crate) fn chroot(path: &CStr) -> io::Result<()> { + unsafe { ret(c::chroot(c_str(path))) } +} + #[cfg(not(target_os = "wasi"))] pub(crate) fn getcwd(buf: &mut [u8]) -> io::Result<()> { unsafe { ret_discarded_char_ptr(c::getcwd(buf.as_mut_ptr().cast(), buf.len())) } @@ -62,7 +69,7 @@ pub(crate) fn getcwd(buf: &mut [u8]) -> io::Result<()> { #[cfg(any(target_os = "android", target_os = "linux"))] pub(crate) fn membarrier_query() -> MembarrierQuery { - // GLIBC does not have a wrapper for `membarrier`; [the documentation] + // glibc does not have a wrapper for `membarrier`; [the documentation] // says to use `syscall`. // // [the documentation]: https://man7.org/linux/man-pages/man2/membarrier.2.html#NOTES @@ -166,6 +173,12 @@ pub(crate) fn getpgid(pid: Option<Pid>) -> io::Result<Pid> { #[cfg(not(target_os = "wasi"))] #[inline] +pub(crate) fn setpgid(pid: Option<Pid>, pgid: Option<Pid>) -> io::Result<()> { + unsafe { ret(c::setpgid(Pid::as_raw(pid) as _, Pid::as_raw(pgid) as _)) } +} + +#[cfg(not(target_os = "wasi"))] +#[inline] #[must_use] pub(crate) fn getpgrp() -> Pid { unsafe { @@ -426,7 +439,9 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Optio #[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(); + // `waitid` can return successfully without initializing the struct (no + // children found when using `WNOHANG`) + let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(c::waitid( c::P_ALL, @@ -442,7 +457,9 @@ fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> { #[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(); + // `waitid` can return successfully without initializing the struct (no + // children found when using `WNOHANG`) + let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(c::waitid( c::P_PID, @@ -458,7 +475,9 @@ fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStat #[cfg(target_os = "linux")] #[inline] fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> { - let mut status = MaybeUninit::<c::siginfo_t>::uninit(); + // `waitid` can return successfully without initializing the struct (no + // children found when using `WNOHANG`) + let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(c::waitid( c::P_PIDFD, @@ -481,6 +500,13 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Optio #[inline] unsafe fn cvt_waitid_status(status: MaybeUninit<c::siginfo_t>) -> Option<WaitidStatus> { let status = status.assume_init(); + // `si_pid` is supposedly the better way to check that the struct has been + // filled, e.g. the Linux manpage says about the `WNOHANG` case “zero out + // the si_pid field before the call and check for a nonzero value”. + // But e.g. NetBSD/OpenBSD don't have it exposed in the libc crate for now, and + // some platforms don't have it at all. For simplicity, always check + // `si_signo`. We have zero-initialized the whole struct, and all kernels + // should set `SIGCHLD` here. if status.si_signo == 0 { None } else { @@ -502,6 +528,16 @@ pub(crate) fn exit_group(code: c::c_int) -> ! { } } +#[cfg(not(any(target_os = "redox", target_os = "wasi")))] +#[inline] +pub(crate) fn getsid(pid: Option<Pid>) -> io::Result<Pid> { + unsafe { + let pid = ret_pid_t(c::getsid(Pid::as_raw(pid) as _))?; + debug_assert_ne!(pid, 0); + Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked(pid))) + } +} + #[cfg(not(target_os = "wasi"))] #[inline] pub(crate) fn setsid() -> io::Result<Pid> { @@ -535,6 +571,24 @@ pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> { unsafe { ret(c::kill(0, sig as i32)) } } +#[cfg(not(target_os = "wasi"))] +#[inline] +pub(crate) fn test_kill_process(pid: Pid) -> io::Result<()> { + unsafe { ret(c::kill(pid.as_raw_nonzero().get(), 0)) } +} + +#[cfg(not(target_os = "wasi"))] +#[inline] +pub(crate) fn test_kill_process_group(pid: Pid) -> io::Result<()> { + unsafe { ret(c::kill(pid.as_raw_nonzero().get().wrapping_neg(), 0)) } +} + +#[cfg(not(target_os = "wasi"))] +#[inline] +pub(crate) fn test_kill_current_process_group() -> io::Result<()> { + unsafe { ret(c::kill(0, 0)) } +} + #[cfg(any(target_os = "android", target_os = "linux"))] #[inline] pub(crate) unsafe fn prctl( @@ -561,10 +615,36 @@ pub(crate) unsafe fn procctl( #[cfg(target_os = "linux")] pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> { unsafe { - syscall_ret_owned_fd(libc::syscall( + syscall_ret_owned_fd(c::syscall( c::SYS_pidfd_open, pid.as_raw_nonzero().get(), flags.bits(), )) } } + +#[cfg(not(target_os = "wasi"))] +pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> { + let len = buf.len().try_into().map_err(|_| io::Errno::NOMEM)?; + + unsafe { ret_usize(c::getgroups(len, buf.as_mut_ptr().cast()) as isize) } +} + +#[cfg(any(target_os = "android", target_os = "linux"))] +pub(crate) fn sysinfo() -> Sysinfo { + let mut info = MaybeUninit::<Sysinfo>::uninit(); + unsafe { + ret_infallible(c::sysinfo(info.as_mut_ptr())); + info.assume_init() + } +} + +#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))] +pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> { + unsafe { + ret(c::sethostname( + name.as_ptr().cast(), + name.len().try_into().map_err(|_| io::Errno::INVAL)?, + )) + } +} diff --git a/vendor/rustix/src/backend/libc/process/types.rs b/vendor/rustix/src/backend/libc/process/types.rs index 203186b20..e7f10dbff 100644 --- a/vendor/rustix/src/backend/libc/process/types.rs +++ b/vendor/rustix/src/backend/libc/process/types.rs @@ -1,5 +1,9 @@ use super::super::c; +/// `sysinfo` +#[cfg(any(target_os = "android", target_os = "linux"))] +pub type Sysinfo = c::sysinfo; + /// A command for use with [`membarrier`] and [`membarrier_cpu`]. /// /// For `MEMBARRIER_CMD_QUERY`, see [`membarrier_query`]. @@ -7,8 +11,6 @@ use super::super::c; /// [`membarrier`]: crate::process::membarrier /// [`membarrier_cpu`]: crate::process::membarrier_cpu /// [`membarrier_query`]: crate::process::membarrier_query -// TODO: These are not yet exposed through libc, so we define the -// constants ourselves. #[cfg(any(target_os = "android", target_os = "linux"))] #[derive(Copy, Clone, Eq, PartialEq, Debug)] #[repr(u32)] @@ -16,23 +18,24 @@ pub enum MembarrierCommand { /// `MEMBARRIER_CMD_GLOBAL` #[doc(alias = "Shared")] #[doc(alias = "MEMBARRIER_CMD_SHARED")] - Global = 1, + Global = c::MEMBARRIER_CMD_GLOBAL as u32, /// `MEMBARRIER_CMD_GLOBAL_EXPEDITED` - GlobalExpedited = 2, + GlobalExpedited = c::MEMBARRIER_CMD_GLOBAL_EXPEDITED as u32, /// `MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED` - RegisterGlobalExpedited = 4, + RegisterGlobalExpedited = c::MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED as u32, /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED` - PrivateExpedited = 8, + PrivateExpedited = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED as u32, /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED` - RegisterPrivateExpedited = 16, + RegisterPrivateExpedited = c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED as u32, /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE` - PrivateExpeditedSyncCore = 32, + PrivateExpeditedSyncCore = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE as u32, /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE` - RegisterPrivateExpeditedSyncCore = 64, + RegisterPrivateExpeditedSyncCore = + c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE as u32, /// `MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10) - PrivateExpeditedRseq = 128, + PrivateExpeditedRseq = c::MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ as u32, /// `MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ` (since Linux 5.10) - RegisterPrivateExpeditedRseq = 256, + RegisterPrivateExpeditedRseq = c::MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ as u32, } /// A resource value for use with [`getrlimit`], [`setrlimit`], and @@ -98,9 +101,9 @@ pub enum Resource { } #[cfg(apple)] +#[allow(non_upper_case_globals)] impl Resource { /// `RLIMIT_RSS` - #[allow(non_upper_case_globals)] pub const Rss: Self = Self::As; } diff --git a/vendor/rustix/src/backend/libc/rand/syscalls.rs b/vendor/rustix/src/backend/libc/rand/syscalls.rs index ce1746055..2dcff139e 100644 --- a/vendor/rustix/src/backend/libc/rand/syscalls.rs +++ b/vendor/rustix/src/backend/libc/rand/syscalls.rs @@ -1,7 +1,7 @@ //! libc syscalls supporting `rustix::rand`. #[cfg(any(target_os = "android", target_os = "linux"))] -use {super::super::c, super::super::conv::ret_ssize_t, crate::io, crate::rand::GetRandomFlags}; +use {super::super::c, super::super::conv::ret_usize, crate::io, crate::rand::GetRandomFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> { @@ -10,7 +10,5 @@ pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usi fn getrandom(buf: *mut c::c_void, buflen: c::size_t, flags: c::c_uint) via SYS_getrandom -> c::ssize_t } - let nread = - unsafe { ret_ssize_t(getrandom(buf.as_mut_ptr().cast(), buf.len(), flags.bits()))? }; - Ok(nread as usize) + unsafe { ret_usize(getrandom(buf.as_mut_ptr().cast(), buf.len(), flags.bits())) } } diff --git a/vendor/rustix/src/backend/libc/termios/syscalls.rs b/vendor/rustix/src/backend/libc/termios/syscalls.rs index 097d368ed..dba73c960 100644 --- a/vendor/rustix/src/backend/libc/termios/syscalls.rs +++ b/vendor/rustix/src/backend/libc/termios/syscalls.rs @@ -193,8 +193,8 @@ pub(crate) fn isatty(fd: BorrowedFd<'_>) -> bool { // Use the return value of `isatty` alone. We don't check `errno` because // we return `bool` rather than `io::Result<bool>`, because we assume // `BorrrowedFd` protects us from `EBADF`, and any other reasonably - // anticipated errno value would end up interpreted as "assume it's not a - // terminal" anyway. + // anticipated `errno` value would end up interpreted as “assume it's not a + // terminal” anyway. unsafe { c::isatty(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 bbacdbea0..fdb7fc644 100644 --- a/vendor/rustix/src/backend/libc/termios/types.rs +++ b/vendor/rustix/src/backend/libc/termios/types.rs @@ -171,64 +171,52 @@ pub const VLNEXT: usize = c::VLNEXT as usize; pub const VEOL2: usize = c::VEOL2 as usize; /// `IGNBRK` -#[cfg(not(apple))] -pub const IGNBRK: c::c_uint = c::IGNBRK; +pub const IGNBRK: Tcflag = c::IGNBRK; /// `BRKINT` -#[cfg(not(apple))] -pub const BRKINT: c::c_uint = c::BRKINT; +pub const BRKINT: Tcflag = c::BRKINT; /// `IGNPAR` -#[cfg(not(apple))] -pub const IGNPAR: c::c_uint = c::IGNPAR; +pub const IGNPAR: Tcflag = c::IGNPAR; /// `PARMRK` -#[cfg(not(apple))] -pub const PARMRK: c::c_uint = c::PARMRK; +pub const PARMRK: Tcflag = c::PARMRK; /// `INPCK` -#[cfg(not(apple))] -pub const INPCK: c::c_uint = c::INPCK; +pub const INPCK: Tcflag = c::INPCK; /// `ISTRIP` -#[cfg(not(apple))] -pub const ISTRIP: c::c_uint = c::ISTRIP; +pub const ISTRIP: Tcflag = c::ISTRIP; /// `INLCR` -#[cfg(not(apple))] -pub const INLCR: c::c_uint = c::INLCR; +pub const INLCR: Tcflag = c::INLCR; /// `IGNCR` -#[cfg(not(apple))] -pub const IGNCR: c::c_uint = c::IGNCR; +pub const IGNCR: Tcflag = c::IGNCR; /// `ICRNL` -#[cfg(not(apple))] -pub const ICRNL: c::c_uint = c::ICRNL; +pub const ICRNL: Tcflag = c::ICRNL; /// `IUCLC` #[cfg(any(solarish, target_os = "haiku"))] -pub const IUCLC: c::c_uint = c::IUCLC; +pub const IUCLC: Tcflag = c::IUCLC; /// `IXON` -#[cfg(not(apple))] -pub const IXON: c::c_uint = c::IXON; +pub const IXON: Tcflag = c::IXON; /// `IXANY` -#[cfg(not(any(apple, target_os = "redox")))] -pub const IXANY: c::c_uint = c::IXANY; +#[cfg(not(target_os = "redox"))] +pub const IXANY: Tcflag = c::IXANY; /// `IXOFF` -#[cfg(not(apple))] -pub const IXOFF: c::c_uint = c::IXOFF; +pub const IXOFF: Tcflag = c::IXOFF; /// `IMAXBEL` -#[cfg(not(any(apple, target_os = "haiku", target_os = "redox")))] -pub const IMAXBEL: c::c_uint = c::IMAXBEL; +#[cfg(not(any(target_os = "haiku", target_os = "redox")))] +pub const IMAXBEL: Tcflag = c::IMAXBEL; /// `IUTF8` #[cfg(not(any( - apple, solarish, target_os = "aix", target_os = "dragonfly", @@ -239,11 +227,10 @@ pub const IMAXBEL: c::c_uint = c::IMAXBEL; target_os = "openbsd", target_os = "redox", )))] -pub const IUTF8: c::c_uint = c::IUTF8; +pub const IUTF8: Tcflag = c::IUTF8; /// `OPOST` -#[cfg(not(apple))] -pub const OPOST: c::c_uint = c::OPOST; +pub const OPOST: Tcflag = c::OPOST; /// `OLCUC` #[cfg(not(any( @@ -254,51 +241,47 @@ pub const OPOST: c::c_uint = c::OPOST; target_os = "netbsd", target_os = "redox", )))] -pub const OLCUC: c::c_uint = c::OLCUC; +pub const OLCUC: Tcflag = c::OLCUC; /// `ONLCR` -#[cfg(not(apple))] -pub const ONLCR: c::c_uint = c::ONLCR; +pub const ONLCR: Tcflag = c::ONLCR; /// `OCRNL` -#[cfg(not(apple))] -pub const OCRNL: c::c_uint = c::OCRNL; +pub const OCRNL: Tcflag = c::OCRNL; /// `ONOCR` -#[cfg(not(apple))] -pub const ONOCR: c::c_uint = c::ONOCR; +pub const ONOCR: Tcflag = c::ONOCR; /// `ONLRET` -#[cfg(not(apple))] -pub const ONLRET: c::c_uint = c::ONLRET; +pub const ONLRET: Tcflag = c::ONLRET; /// `OFILL` #[cfg(not(bsd))] -pub const OFILL: c::c_uint = c::OFILL; +pub const OFILL: Tcflag = c::OFILL; /// `OFDEL` #[cfg(not(bsd))] -pub const OFDEL: c::c_uint = c::OFDEL; +pub const OFDEL: Tcflag = c::OFDEL; /// `NLDLY` #[cfg(not(any(bsd, solarish, target_os = "redox")))] -pub const NLDLY: c::c_uint = c::NLDLY; +pub const NLDLY: Tcflag = c::NLDLY; /// `NL0` #[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))] -pub const NL0: c::c_uint = c::NL0; +pub const NL0: Tcflag = c::NL0; /// `NL1` #[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))] -pub const NL1: c::c_uint = c::NL1; +pub const NL1: Tcflag = c::NL1; /// `CRDLY` #[cfg(not(any(bsd, solarish, target_os = "redox")))] -pub const CRDLY: c::c_uint = c::CRDLY; +pub const CRDLY: Tcflag = c::CRDLY; /// `CR0` #[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))] -pub const CR0: c::c_uint = c::CR0; +pub const CR0: Tcflag = c::CR0; /// `CR1` #[cfg(not(any( @@ -309,7 +292,7 @@ pub const CR0: c::c_uint = c::CR0; target_os = "fuchsia", target_os = "redox", )))] -pub const CR1: c::c_uint = c::CR1; +pub const CR1: Tcflag = c::CR1; /// `CR2` #[cfg(not(any( @@ -320,7 +303,7 @@ pub const CR1: c::c_uint = c::CR1; target_os = "fuchsia", target_os = "redox", )))] -pub const CR2: c::c_uint = c::CR2; +pub const CR2: Tcflag = c::CR2; /// `CR3` #[cfg(not(any( @@ -331,28 +314,21 @@ pub const CR2: c::c_uint = c::CR2; target_os = "fuchsia", target_os = "redox", )))] -pub const CR3: c::c_uint = c::CR3; +pub const CR3: Tcflag = c::CR3; /// `TABDLY` -#[cfg(not(any( - apple, - netbsdlike, - solarish, - target_os = "dragonfly", - target_os = "redox", -)))] -pub const TABDLY: c::c_uint = c::TABDLY; +#[cfg(not(any(netbsdlike, solarish, target_os = "dragonfly", target_os = "redox",)))] +pub const TABDLY: Tcflag = c::TABDLY; /// `TAB0` #[cfg(not(any( - apple, netbsdlike, solarish, target_os = "dragonfly", target_os = "fuchsia", target_os = "redox", )))] -pub const TAB0: c::c_uint = c::TAB0; +pub const TAB0: Tcflag = c::TAB0; /// `TAB1` #[cfg(not(any( @@ -363,7 +339,7 @@ pub const TAB0: c::c_uint = c::TAB0; target_os = "fuchsia", target_os = "redox", )))] -pub const TAB1: c::c_uint = c::TAB1; +pub const TAB1: Tcflag = c::TAB1; /// `TAB2` #[cfg(not(any( @@ -374,7 +350,7 @@ pub const TAB1: c::c_uint = c::TAB1; target_os = "fuchsia", target_os = "redox", )))] -pub const TAB2: c::c_uint = c::TAB2; +pub const TAB2: Tcflag = c::TAB2; /// `TAB3` #[cfg(not(any( @@ -385,15 +361,15 @@ pub const TAB2: c::c_uint = c::TAB2; target_os = "fuchsia", target_os = "redox", )))] -pub const TAB3: c::c_uint = c::TAB3; +pub const TAB3: Tcflag = c::TAB3; /// `BSDLY` #[cfg(not(any(bsd, solarish, target_os = "redox")))] -pub const BSDLY: c::c_uint = c::BSDLY; +pub const BSDLY: Tcflag = c::BSDLY; /// `BS0` #[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))] -pub const BS0: c::c_uint = c::BS0; +pub const BS0: Tcflag = c::BS0; /// `BS1` #[cfg(not(any( @@ -404,15 +380,15 @@ pub const BS0: c::c_uint = c::BS0; target_os = "fuchsia", target_os = "redox", )))] -pub const BS1: c::c_uint = c::BS1; +pub const BS1: Tcflag = c::BS1; /// `FFDLY` #[cfg(not(any(target_env = "musl", bsd, solarish, target_os = "redox")))] -pub const FFDLY: c::c_uint = c::FFDLY; +pub const FFDLY: Tcflag = c::FFDLY; /// `FF0` #[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))] -pub const FF0: c::c_uint = c::FF0; +pub const FF0: Tcflag = c::FF0; /// `FF1` #[cfg(not(any( @@ -423,15 +399,15 @@ pub const FF0: c::c_uint = c::FF0; target_os = "fuchsia", target_os = "redox", )))] -pub const FF1: c::c_uint = c::FF1; +pub const FF1: Tcflag = c::FF1; /// `VTDLY` #[cfg(not(any(target_env = "musl", bsd, solarish, target_os = "redox")))] -pub const VTDLY: c::c_uint = c::VTDLY; +pub const VTDLY: Tcflag = c::VTDLY; /// `VT0` #[cfg(not(any(bsd, solarish, target_os = "fuchsia", target_os = "redox")))] -pub const VT0: c::c_uint = c::VT0; +pub const VT0: Tcflag = c::VT0; /// `VT1` #[cfg(not(any( @@ -442,7 +418,7 @@ pub const VT0: c::c_uint = c::VT0; target_os = "fuchsia", target_os = "redox", )))] -pub const VT1: c::c_uint = c::VT1; +pub const VT1: Tcflag = c::VT1; /// `B0` pub const B0: Speed = c::B0; @@ -594,111 +570,90 @@ pub const B4000000: Speed = c::B4000000; /// `BOTHER` #[cfg(any(target_os = "android", target_os = "linux"))] -pub const BOTHER: c::c_uint = c::BOTHER; +pub const BOTHER: Speed = c::BOTHER; /// `CSIZE` -#[cfg(not(apple))] -pub const CSIZE: c::c_uint = c::CSIZE; +pub const CSIZE: Tcflag = c::CSIZE; /// `CS5` -#[cfg(not(apple))] -pub const CS5: c::c_uint = c::CS5; +pub const CS5: Tcflag = c::CS5; /// `CS6` -#[cfg(not(apple))] -pub const CS6: c::c_uint = c::CS6; +pub const CS6: Tcflag = c::CS6; /// `CS7` -#[cfg(not(apple))] -pub const CS7: c::c_uint = c::CS7; +pub const CS7: Tcflag = c::CS7; /// `CS8` -#[cfg(not(apple))] -pub const CS8: c::c_uint = c::CS8; +pub const CS8: Tcflag = c::CS8; /// `CSTOPB` -#[cfg(not(apple))] -pub const CSTOPB: c::c_uint = c::CSTOPB; +pub const CSTOPB: Tcflag = c::CSTOPB; /// `CREAD` -#[cfg(not(apple))] -pub const CREAD: c::c_uint = c::CREAD; +pub const CREAD: Tcflag = c::CREAD; /// `PARENB` -#[cfg(not(apple))] -pub const PARENB: c::c_uint = c::PARENB; +pub const PARENB: Tcflag = c::PARENB; /// `PARODD` -#[cfg(not(apple))] -pub const PARODD: c::c_uint = c::PARODD; +pub const PARODD: Tcflag = c::PARODD; /// `HUPCL` -#[cfg(not(apple))] -pub const HUPCL: c::c_uint = c::HUPCL; +pub const HUPCL: Tcflag = c::HUPCL; /// `CLOCAL` -#[cfg(not(apple))] -pub const CLOCAL: c::c_uint = c::CLOCAL; +pub const CLOCAL: Tcflag = c::CLOCAL; /// `ISIG` -#[cfg(not(apple))] -pub const ISIG: c::c_uint = c::ISIG; +pub const ISIG: Tcflag = c::ISIG; /// `ICANON`—A flag for the `c_lflag` field of [`Termios`] indicating /// canonical mode. pub const ICANON: Tcflag = c::ICANON; /// `ECHO` -#[cfg(not(apple))] -pub const ECHO: c::c_uint = c::ECHO; +pub const ECHO: Tcflag = c::ECHO; /// `ECHOE` -#[cfg(not(apple))] -pub const ECHOE: c::c_uint = c::ECHOE; +pub const ECHOE: Tcflag = c::ECHOE; /// `ECHOK` -#[cfg(not(apple))] -pub const ECHOK: c::c_uint = c::ECHOK; +pub const ECHOK: Tcflag = c::ECHOK; /// `ECHONL` -#[cfg(not(apple))] -pub const ECHONL: c::c_uint = c::ECHONL; +pub const ECHONL: Tcflag = c::ECHONL; /// `NOFLSH` -#[cfg(not(apple))] -pub const NOFLSH: c::c_uint = c::NOFLSH; +pub const NOFLSH: Tcflag = c::NOFLSH; /// `TOSTOP` -#[cfg(not(apple))] -pub const TOSTOP: c::c_uint = c::TOSTOP; +pub const TOSTOP: Tcflag = c::TOSTOP; /// `IEXTEN` -#[cfg(not(apple))] -pub const IEXTEN: c::c_uint = c::IEXTEN; +pub const IEXTEN: Tcflag = c::IEXTEN; /// `EXTA` #[cfg(not(any( - apple, solarish, target_os = "emscripten", target_os = "haiku", target_os = "redox", )))] -pub const EXTA: c::c_uint = c::EXTA; +pub const EXTA: Speed = c::EXTA; /// `EXTB` #[cfg(not(any( - apple, solarish, target_os = "emscripten", target_os = "haiku", target_os = "redox", )))] -pub const EXTB: c::c_uint = c::EXTB; +pub const EXTB: Speed = c::EXTB; /// `CBAUD` #[cfg(not(any(bsd, target_os = "haiku", target_os = "redox")))] -pub const CBAUD: c::c_uint = c::CBAUD; +pub const CBAUD: Tcflag = c::CBAUD; /// `CBAUDEX` #[cfg(not(any( @@ -708,7 +663,7 @@ pub const CBAUD: c::c_uint = c::CBAUD; target_os = "haiku", target_os = "redox", )))] -pub const CBAUDEX: c::c_uint = c::CBAUDEX; +pub const CBAUDEX: Tcflag = c::CBAUDEX; /// `CIBAUD` #[cfg(not(any( @@ -719,12 +674,13 @@ pub const CBAUDEX: c::c_uint = c::CBAUDEX; target_os = "haiku", target_os = "redox", )))] -pub const CIBAUD: c::tcflag_t = c::CIBAUD; +pub const CIBAUD: Tcflag = c::CIBAUD; /// `CIBAUD` -// TODO: Upstream this. +// glibc on powerpc lacks a definition for `CIBAUD`, even though the Linux +// headers and Musl on powerpc both have one. So define it manually. #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] -pub const CIBAUD: c::tcflag_t = 0o77600000; +pub const CIBAUD: Tcflag = 0o77600000; /// `CMSPAR` #[cfg(not(any( @@ -735,39 +691,39 @@ pub const CIBAUD: c::tcflag_t = 0o77600000; target_os = "haiku", target_os = "redox", )))] -pub const CMSPAR: c::c_uint = c::CMSPAR; +pub const CMSPAR: Tcflag = c::CMSPAR; /// `CRTSCTS` -#[cfg(not(any(apple, target_os = "aix", target_os = "redox")))] -pub const CRTSCTS: c::c_uint = c::CRTSCTS; +#[cfg(not(any(target_os = "aix", target_os = "redox")))] +pub const CRTSCTS: Tcflag = c::CRTSCTS; /// `XCASE` #[cfg(any(target_arch = "s390x", target_os = "haiku"))] -pub const XCASE: c::c_uint = c::XCASE; +pub const XCASE: Tcflag = c::XCASE; /// `ECHOCTL` -#[cfg(not(any(apple, target_os = "redox")))] -pub const ECHOCTL: c::c_uint = c::ECHOCTL; +#[cfg(not(any(target_os = "redox")))] +pub const ECHOCTL: Tcflag = c::ECHOCTL; /// `ECHOPRT` -#[cfg(not(any(apple, target_os = "redox")))] -pub const ECHOPRT: c::c_uint = c::ECHOPRT; +#[cfg(not(any(target_os = "redox")))] +pub const ECHOPRT: Tcflag = c::ECHOPRT; /// `ECHOKE` -#[cfg(not(any(apple, target_os = "redox")))] -pub const ECHOKE: c::c_uint = c::ECHOKE; +#[cfg(not(any(target_os = "redox")))] +pub const ECHOKE: Tcflag = c::ECHOKE; /// `FLUSHO` -#[cfg(not(any(apple, target_os = "redox")))] -pub const FLUSHO: c::c_uint = c::FLUSHO; +#[cfg(not(any(target_os = "redox")))] +pub const FLUSHO: Tcflag = c::FLUSHO; /// `PENDIN` -#[cfg(not(any(apple, target_os = "redox")))] -pub const PENDIN: c::c_uint = c::PENDIN; +#[cfg(not(any(target_os = "redox")))] +pub const PENDIN: Tcflag = c::PENDIN; /// `EXTPROC` -#[cfg(not(any(apple, target_os = "aix", target_os = "haiku", target_os = "redox")))] -pub const EXTPROC: c::c_uint = c::EXTPROC; +#[cfg(not(any(target_os = "aix", target_os = "haiku", target_os = "redox")))] +pub const EXTPROC: Tcflag = c::EXTPROC; /// `XTABS` #[cfg(not(any( @@ -777,4 +733,4 @@ pub const EXTPROC: c::c_uint = c::EXTPROC; target_os = "haiku", target_os = "redox", )))] -pub const XTABS: c::c_uint = c::XTABS; +pub const XTABS: Tcflag = c::XTABS; diff --git a/vendor/rustix/src/backend/libc/time/types.rs b/vendor/rustix/src/backend/libc/time/types.rs index 47cd85701..c78aeb21a 100644 --- a/vendor/rustix/src/backend/libc/time/types.rs +++ b/vendor/rustix/src/backend/libc/time/types.rs @@ -108,7 +108,7 @@ impl From<Timespec> for LibcTimespec { /// `CLOCK_*` constants for use with [`clock_gettime`]. /// -/// These constants are always supported at runtime so `clock_gettime` never +/// These constants are always supported at runtime, so `clock_gettime` never /// 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. @@ -153,7 +153,7 @@ pub enum ClockId { /// `CLOCK_*` constants for use with [`clock_gettime`]. /// -/// These constants are always supported at runtime so `clock_gettime` never +/// These constants are always supported at runtime, so `clock_gettime` never /// 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. @@ -209,7 +209,11 @@ pub enum DynamicClockId<'a> { BoottimeAlarm, } -/// `struct itimerspec` +/// `struct itimerspec` for use with [`timerfd_gettime`] and +/// [`timerfd_settime`]. +/// +/// [`timerfd_gettime`]: crate::time::timerfd_gettime +/// [`timerfd_settime`]: crate::time::timerfd_settime #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] #[cfg(not(all( any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), @@ -217,7 +221,11 @@ pub enum DynamicClockId<'a> { )))] pub type Itimerspec = c::itimerspec; -/// `struct itimerspec` +/// `struct itimerspec` for use with [`timerfd_gettime`] and +/// [`timerfd_settime`]. +/// +/// [`timerfd_gettime`]: crate::time::timerfd_gettime +/// [`timerfd_settime`]: crate::time::timerfd_settime #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] #[cfg(all( any(target_arch = "arm", target_arch = "mips", target_arch = "x86"), @@ -286,6 +294,8 @@ impl From<Itimerspec> for LibcItimerspec { #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] bitflags! { /// `TFD_*` flags for use with [`timerfd_create`]. + /// + /// [`timerfd_create`]: crate::time::timerfd_create pub struct TimerfdFlags: c::c_int { /// `TFD_NONBLOCK` const NONBLOCK = c::TFD_NONBLOCK; @@ -298,6 +308,8 @@ bitflags! { #[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))] bitflags! { /// `TFD_TIMER_*` flags for use with [`timerfd_settime`]. + /// + /// [`timerfd_settime`]: crate::time::timerfd_settime pub struct TimerfdTimerFlags: c::c_int { /// `TFD_TIMER_ABSTIME` const ABSTIME = c::TFD_TIMER_ABSTIME; @@ -316,7 +328,7 @@ bitflags! { #[repr(i32)] #[non_exhaustive] pub enum TimerfdClockId { - /// `CLOCK_REALTIME`—A clock that tells the "real" time. + /// `CLOCK_REALTIME`—A clock that tells the “real” time. /// /// This is a clock that tells the amount of time elapsed since the /// Unix epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so diff --git a/vendor/rustix/src/backend/libc/weak.rs b/vendor/rustix/src/backend/libc/weak.rs deleted file mode 100644 index b7f185da3..000000000 --- a/vendor/rustix/src/backend/libc/weak.rs +++ /dev/null @@ -1,226 +0,0 @@ -// Implementation derived from `weak` in Rust's -// library/std/src/sys/unix/weak.rs at revision -// fd0cb0cdc21dd9c06025277d772108f8d42cb25f. - -//! Support for "weak linkage" to symbols on Unix -//! -//! Some I/O operations we do in libstd require newer versions of OSes but we -//! need to maintain binary compatibility with older releases for now. In order -//! to use the new functionality when available we use this module for -//! detection. -//! -//! One option to use here is weak linkage, but that is unfortunately only -//! really workable on Linux. Hence, use dlsym to get the symbol value at -//! runtime. This is also done for compatibility with older versions of glibc, -//! and to avoid creating dependencies on `GLIBC_PRIVATE` symbols. It assumes -//! that we've been dynamically linked to the library the symbol comes from, -//! but that is currently always the case for things like libpthread/libc. -//! -//! A long time ago this used weak linkage for the `__pthread_get_minstack` -//! symbol, but that caused Debian to detect an unnecessarily strict versioned -//! dependency on libc6 (#23628). - -// There are a variety of `#[cfg]`s controlling which targets are involved in -// each instance of `weak!` and `syscall!`. Rather than trying to unify all of -// that, we'll just allow that some unix targets don't use this module at all. -#![allow(dead_code, unused_macros)] -#![allow(clippy::doc_markdown)] - -use 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/backend/libc/winsock_c.rs b/vendor/rustix/src/backend/libc/winsock_c.rs index 521a7bbb1..a30f2c86f 100644 --- a/vendor/rustix/src/backend/libc/winsock_c.rs +++ b/vendor/rustix/src/backend/libc/winsock_c.rs @@ -5,52 +5,26 @@ use windows_sys::Win32::Networking::WinSock; -pub(crate) use libc::{ - c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong, - c_ushort, c_void, ssize_t, -}; -pub(crate) type socklen_t = i32; +// Define the basic C types. With Rust 1.64, we can use these from `core::ffi`. +pub(crate) type c_schar = i8; +pub(crate) type c_uchar = u8; +pub(crate) type c_short = i16; +pub(crate) type c_ushort = u16; +pub(crate) type c_int = i32; +pub(crate) type c_uint = u32; +pub(crate) type c_longlong = i64; +pub(crate) type c_ulonglong = u64; +pub(crate) type ssize_t = isize; +pub(crate) type c_char = i8; +pub(crate) type c_long = i32; +pub(crate) type c_ulong = u32; +pub(crate) use core::ffi::c_void; -// windows-sys declares these constants as unsigned. For better compatibility -// with Unix-family APIs, redeclare them as signed. Filed upstream: -// <https://github.com/microsoft/windows-rs/issues/1718> +// windows-sys declares these constants as u16. For better compatibility +// with Unix-family APIs, redeclare them as u32. pub(crate) const AF_INET: i32 = WinSock::AF_INET as _; pub(crate) const AF_INET6: i32 = WinSock::AF_INET6 as _; pub(crate) const AF_UNSPEC: i32 = WinSock::AF_UNSPEC as _; -pub(crate) const SO_TYPE: i32 = WinSock::SO_TYPE as _; -pub(crate) const SO_REUSEADDR: i32 = WinSock::SO_REUSEADDR as _; -pub(crate) const SO_BROADCAST: i32 = WinSock::SO_BROADCAST as _; -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 _; -pub(crate) const IP_DROP_MEMBERSHIP: i32 = WinSock::IP_DROP_MEMBERSHIP as _; -pub(crate) const IP_MULTICAST_TTL: i32 = WinSock::IP_MULTICAST_TTL as _; -pub(crate) const IP_MULTICAST_LOOP: i32 = WinSock::IP_MULTICAST_LOOP as _; -pub(crate) const IPV6_ADD_MEMBERSHIP: i32 = WinSock::IPV6_ADD_MEMBERSHIP as _; -pub(crate) const IPV6_DROP_MEMBERSHIP: i32 = WinSock::IPV6_DROP_MEMBERSHIP as _; -pub(crate) const IPV6_MULTICAST_LOOP: i32 = WinSock::IPV6_MULTICAST_LOOP as _; -pub(crate) const IPV6_V6ONLY: i32 = WinSock::IPV6_V6ONLY as _; -pub(crate) const POLLERR: i16 = WinSock::POLLERR as _; -pub(crate) const POLLIN: i16 = WinSock::POLLIN as _; -pub(crate) const POLLNVAL: i16 = WinSock::POLLNVAL as _; -pub(crate) const POLLHUP: i16 = WinSock::POLLHUP as _; -pub(crate) const POLLPRI: i16 = WinSock::POLLPRI as _; -pub(crate) const POLLOUT: i16 = WinSock::POLLOUT as _; -pub(crate) const POLLRDNORM: i16 = WinSock::POLLRDNORM as _; -pub(crate) const POLLWRNORM: i16 = WinSock::POLLWRNORM as _; -pub(crate) const POLLRDBAND: i16 = WinSock::POLLRDBAND as _; -pub(crate) const POLLWRBAND: i16 = WinSock::POLLWRBAND as _; - -// As above, cast the types for better compatibility, and also rename these to -// their Unix names. -pub(crate) const SHUT_RDWR: i32 = WinSock::SD_BOTH as _; -pub(crate) const SHUT_RD: i32 = WinSock::SD_RECEIVE as _; -pub(crate) const SHUT_WR: i32 = WinSock::SD_SEND as _; // Include the contents of `WinSock`, renaming as needed to match POSIX. // @@ -58,11 +32,16 @@ pub(crate) const SHUT_WR: i32 = WinSock::SD_SEND as _; // `WSAECANCELLED` will be removed in the future. // <https://docs.microsoft.com/en-us/windows/win32/api/ws2spi/nc-ws2spi-lpnsplookupserviceend#remarks> pub(crate) use WinSock::{ - closesocket as close, ioctlsocket as ioctl, WSAPoll as poll, ADDRESS_FAMILY as sa_family_t, - ADDRINFOA as addrinfo, IN6_ADDR as in6_addr, IN_ADDR as in_addr, IPV6_MREQ as ipv6_mreq, - IP_MREQ as ip_mreq, LINGER as linger, SOCKADDR as sockaddr, SOCKADDR_IN as sockaddr_in, - SOCKADDR_IN6 as sockaddr_in6, SOCKADDR_STORAGE as sockaddr_storage, WSAEACCES as EACCES, - WSAEADDRINUSE as EADDRINUSE, WSAEADDRNOTAVAIL as EADDRNOTAVAIL, + closesocket as close, ioctlsocket as ioctl, socklen_t, WSAPoll as poll, + ADDRESS_FAMILY as sa_family_t, ADDRINFOA as addrinfo, IN6_ADDR as in6_addr, IN_ADDR as in_addr, + IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MREQ as ipv6_mreq, IPV6_MULTICAST_LOOP, + IPV6_V6ONLY, IP_ADD_MEMBERSHIP, IP_DROP_MEMBERSHIP, IP_MREQ as ip_mreq, IP_MULTICAST_LOOP, + IP_MULTICAST_TTL, IP_TTL, LINGER as linger, POLLERR, POLLHUP, POLLIN, POLLNVAL, POLLOUT, + POLLPRI, POLLRDBAND, POLLRDNORM, POLLWRBAND, POLLWRNORM, SD_BOTH as SHUT_RDWR, + SD_RECEIVE as SHUT_RD, SD_SEND as SHUT_WR, SOCKADDR as sockaddr, SOCKADDR_IN as sockaddr_in, + SOCKADDR_IN6 as sockaddr_in6, SOCKADDR_STORAGE as sockaddr_storage, SOL_SOCKET, SO_BROADCAST, + SO_ERROR, SO_LINGER, SO_RCVTIMEO, SO_REUSEADDR, SO_SNDTIMEO, SO_TYPE, TCP_NODELAY, + WSAEACCES as EACCES, WSAEADDRINUSE as EADDRINUSE, WSAEADDRNOTAVAIL as EADDRNOTAVAIL, WSAEAFNOSUPPORT as EAFNOSUPPORT, WSAEALREADY as EALREADY, WSAEBADF as EBADF, WSAECONNABORTED as ECONNABORTED, WSAECONNREFUSED as ECONNREFUSED, WSAECONNRESET as ECONNRESET, WSAEDESTADDRREQ as EDESTADDRREQ, WSAEDISCON as EDISCON, WSAEDQUOT as EDQUOT, diff --git a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs index 524c449d9..4783747ac 100644 --- a/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs +++ b/vendor/rustix/src/backend/linux_raw/arch/inline/mod.rs @@ -3,6 +3,10 @@ //! Compilers should really have intrinsics for making system calls. They're //! much like regular calls, with custom calling conventions, and calling //! conventions are otherwise the compiler's job. But for now, use inline asm. +//! +//! The calling conventions for Linux syscalls are [documented here]. +//! +//! [documented here]: https://man7.org/linux/man-pages/man2/syscall.2.html #[cfg_attr(target_arch = "aarch64", path = "aarch64.rs")] #[cfg_attr(all(target_arch = "arm", not(thumb_mode)), path = "arm.rs")] diff --git a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs index a6a5f270d..5e6f5e1f5 100644 --- a/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs +++ b/vendor/rustix/src/backend/linux_raw/arch/outline/mod.rs @@ -1,9 +1,13 @@ //! Declare functions defined in out-of-line ("outline") asm files. //! -//! Kernel calling conventions differ from userspace calling conventions, -//! so we also define inline function wrappers which reorder the arguments -//! so that they match with the kernel convention as closely as possible, -//! to minimize the amount of out-of-line code we need. +//! Kernel calling conventions differ from userspace calling conventions, so we +//! also define inline function wrappers which reorder the arguments so that +//! they match with the kernel convention as closely as possible, to minimize +//! the amount of out-of-line code we need. +//! +//! This is needed in order to support our MSRV of 1.48, which doesn't support +//! inline asm. When using newer Rust versions, inline asm code is used instead +//! and these outline libraries are unused. #[cfg(target_arch = "x86")] mod x86; diff --git a/vendor/rustix/src/backend/linux_raw/c.rs b/vendor/rustix/src/backend/linux_raw/c.rs index e7263305a..89fee82f9 100644 --- a/vendor/rustix/src/backend/linux_raw/c.rs +++ b/vendor/rustix/src/backend/linux_raw/c.rs @@ -14,18 +14,20 @@ pub(crate) use linux_raw_sys::general::{ 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, + AF_WANPIPE, AF_X25, CLD_CONTINUED, CLD_DUMPED, CLD_EXITED, CLD_KILLED, CLD_STOPPED, + CLD_TRAPPED, 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, + IPPROTO_UDPLITE, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP, IPV6_MULTICAST_LOOP, + IPV6_UNICAST_HOPS, 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_KEEPALIVE, SO_LINGER, SO_PASSCRED, SO_RCVBUF, SO_RCVTIMEO_NEW, SO_RCVTIMEO_OLD, + SO_REUSEADDR, SO_SNDBUF, 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}; +pub(crate) use linux_raw_sys::general::{XATTR_CREATE, XATTR_REPLACE}; diff --git a/vendor/rustix/src/backend/linux_raw/conv.rs b/vendor/rustix/src/backend/linux_raw/conv.rs index b9fe725bb..f02b5c046 100644 --- a/vendor/rustix/src/backend/linux_raw/conv.rs +++ b/vendor/rustix/src/backend/linux_raw/conv.rs @@ -190,6 +190,11 @@ pub(super) fn slice_just_addr<T: Sized, Num: ArgNumber>(v: &[T]) -> ArgReg<Num> } #[inline] +pub(super) fn slice_just_addr_mut<T: Sized, Num: ArgNumber>(v: &mut [T]) -> ArgReg<Num> { + raw_arg(v.as_mut_ptr().cast()) +} + +#[inline] pub(super) fn slice<T: Sized, Num0: ArgNumber, Num1: ArgNumber>( v: &[T], ) -> (ArgReg<Num0>, ArgReg<Num1>) { @@ -314,6 +319,14 @@ impl<'a, Num: ArgNumber> From<crate::fs::AtFlags> for ArgReg<'a, Num> { } #[cfg(feature = "fs")] +impl<'a, Num: ArgNumber> From<crate::fs::XattrFlags> for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::fs::XattrFlags) -> Self { + c_uint(flags.bits()) + } +} + +#[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 { @@ -615,9 +628,9 @@ impl<'a, Num: ArgNumber> From<crate::net::SendFlags> for ArgReg<'a, Num> { } #[cfg(feature = "net")] -impl<'a, Num: ArgNumber> From<crate::net::AcceptFlags> for ArgReg<'a, Num> { +impl<'a, Num: ArgNumber> From<crate::net::SocketFlags> for ArgReg<'a, Num> { #[inline] - fn from(flags: crate::net::AcceptFlags) -> Self { + fn from(flags: crate::net::SocketFlags) -> Self { c_uint(flags.bits()) } } @@ -681,6 +694,13 @@ impl<'a, Num: ArgNumber, T> From<&'a mut MaybeUninit<T>> for ArgReg<'a, Num> { } } +impl<'a, Num: ArgNumber, T> From<&'a mut [MaybeUninit<T>]> for ArgReg<'a, Num> { + #[inline] + fn from(t: &'a mut [MaybeUninit<T>]) -> Self { + raw_arg(t.as_mut_ptr().cast()) + } +} + #[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> { @@ -713,6 +733,14 @@ impl<'a, Num: ArgNumber> From<crate::process::Gid> for ArgReg<'a, Num> { } } +#[cfg(feature = "runtime")] +impl<'a, Num: ArgNumber> From<crate::runtime::How> for ArgReg<'a, Num> { + #[inline] + fn from(flags: crate::runtime::How) -> Self { + c_uint(flags as u32) + } +} + /// Convert a `usize` returned from a syscall that effectively returns `()` on /// success. /// diff --git a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs index 4221565a6..a3c274741 100644 --- a/vendor/rustix/src/backend/linux_raw/fs/inotify.rs +++ b/vendor/rustix/src/backend/linux_raw/fs/inotify.rs @@ -80,7 +80,7 @@ pub fn inotify_init(flags: CreateFlags) -> io::Result<OwnedFd> { syscalls::inotify_init1(flags) } -/// `inotify_add_watch(self, path, flags)`—Adds a watch to inotify +/// `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. diff --git a/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs b/vendor/rustix/src/backend/linux_raw/fs/syscalls.rs index 8bd9ccc27..d0d855cc1 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_infallible, ret_owned_fd, ret_usize, size_of, slice_mut, zero, + ret_c_uint, ret_infallible, ret_owned_fd, ret_usize, size_of, slice, slice_mut, zero, }; #[cfg(target_pointer_width = "64")] use super::super::conv::{loff_t, loff_t_from_u64, ret_u64}; @@ -26,7 +26,7 @@ use crate::ffi::CStr; use crate::fs::{ inotify, Access, Advice, AtFlags, FallocateFlags, FileType, FlockOperation, MemfdFlags, Mode, OFlags, RenameFlags, ResolveFlags, SealFlags, Stat, StatFs, StatVfs, StatVfsMountFlags, - StatxFlags, Timestamps, + StatxFlags, Timestamps, XattrFlags, }; use crate::io::{self, SeekFrom}; use crate::process::{Gid, Uid}; @@ -1392,6 +1392,30 @@ pub(crate) fn accessat( access: Access, flags: AtFlags, ) -> io::Result<()> { + if !flags + .difference(AtFlags::EACCESS | AtFlags::SYMLINK_NOFOLLOW) + .is_empty() + { + return Err(io::Errno::INVAL); + } + + // Linux's `faccessat` syscall doesn't have a flags argument, so if we have + // any flags, use the newer `faccessat2` which does. Unless we're on + // Android where using newer system calls can cause seccomp to abort the + // process. + #[cfg(not(target_os = "android"))] + if !flags.is_empty() { + return unsafe { + ret(syscall_readonly!( + __NR_faccessat2, + dirfd, + path, + access, + flags + )) + }; + } + // Linux's `faccessat` doesn't have a flags parameter. If we have // `AT_EACCESS` and we're not setuid or setgid, we can emulate it. if flags.is_empty() @@ -1402,11 +1426,6 @@ pub(crate) fn accessat( return unsafe { ret(syscall_readonly!(__NR_faccessat, dirfd, path, access)) }; } - if flags.bits() != AT_EACCESS { - return Err(io::Errno::INVAL); - } - - // TODO: Use faccessat2 in newer Linux versions. Err(io::Errno::NOSYS) } @@ -1510,3 +1529,138 @@ pub(crate) fn inotify_add_watch( pub(crate) fn inotify_rm_watch(infd: BorrowedFd<'_>, wfd: i32) -> io::Result<()> { unsafe { ret(syscall_readonly!(__NR_inotify_rm_watch, infd, c_int(wfd))) } } + +#[inline] +pub(crate) fn getxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> { + let (value_addr_mut, value_len) = slice_mut(value); + unsafe { + ret_usize(syscall!( + __NR_getxattr, + path, + name, + value_addr_mut, + value_len + )) + } +} + +#[inline] +pub(crate) fn lgetxattr(path: &CStr, name: &CStr, value: &mut [u8]) -> io::Result<usize> { + let (value_addr_mut, value_len) = slice_mut(value); + unsafe { + ret_usize(syscall!( + __NR_lgetxattr, + path, + name, + value_addr_mut, + value_len + )) + } +} + +#[inline] +pub(crate) fn fgetxattr(fd: BorrowedFd<'_>, name: &CStr, value: &mut [u8]) -> io::Result<usize> { + let (value_addr_mut, value_len) = slice_mut(value); + unsafe { + ret_usize(syscall!( + __NR_fgetxattr, + fd, + name, + value_addr_mut, + value_len + )) + } +} + +#[inline] +pub(crate) fn setxattr( + path: &CStr, + name: &CStr, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + let (value_addr, value_len) = slice(value); + unsafe { + ret(syscall_readonly!( + __NR_setxattr, + path, + name, + value_addr, + value_len, + flags + )) + } +} + +#[inline] +pub(crate) fn lsetxattr( + path: &CStr, + name: &CStr, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + let (value_addr, value_len) = slice(value); + unsafe { + ret(syscall_readonly!( + __NR_lsetxattr, + path, + name, + value_addr, + value_len, + flags + )) + } +} + +#[inline] +pub(crate) fn fsetxattr( + fd: BorrowedFd<'_>, + name: &CStr, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + let (value_addr, value_len) = slice(value); + unsafe { + ret(syscall_readonly!( + __NR_fsetxattr, + fd, + name, + value_addr, + value_len, + flags + )) + } +} + +#[inline] +pub(crate) fn listxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> { + let (list_addr_mut, list_len) = slice_mut(list); + unsafe { ret_usize(syscall!(__NR_listxattr, path, list_addr_mut, list_len)) } +} + +#[inline] +pub(crate) fn llistxattr(path: &CStr, list: &mut [c::c_char]) -> io::Result<usize> { + let (list_addr_mut, list_len) = slice_mut(list); + unsafe { ret_usize(syscall!(__NR_llistxattr, path, list_addr_mut, list_len)) } +} + +#[inline] +pub(crate) fn flistxattr(fd: BorrowedFd<'_>, list: &mut [c::c_char]) -> io::Result<usize> { + let (list_addr_mut, list_len) = slice_mut(list); + unsafe { ret_usize(syscall!(__NR_flistxattr, fd, list_addr_mut, list_len)) } +} + +#[inline] +pub(crate) fn removexattr(path: &CStr, name: &CStr) -> io::Result<()> { + unsafe { ret(syscall!(__NR_removexattr, path, name)) } +} + +#[inline] +pub(crate) fn lremovexattr(path: &CStr, name: &CStr) -> io::Result<()> { + unsafe { ret(syscall!(__NR_lremovexattr, path, name)) } +} + +#[inline] +pub(crate) fn fremovexattr(fd: BorrowedFd<'_>, name: &CStr) -> io::Result<()> { + unsafe { ret(syscall!(__NR_fremovexattr, fd, name)) } +} diff --git a/vendor/rustix/src/backend/linux_raw/fs/types.rs b/vendor/rustix/src/backend/linux_raw/fs/types.rs index 9bafb8ac0..68bb9ed46 100644 --- a/vendor/rustix/src/backend/linux_raw/fs/types.rs +++ b/vendor/rustix/src/backend/linux_raw/fs/types.rs @@ -288,6 +288,7 @@ pub enum FileType { Symlink = linux_raw_sys::general::S_IFLNK as isize, /// `S_IFIFO` + #[doc(alias = "IFO")] Fifo = linux_raw_sys::general::S_IFIFO as isize, /// `S_IFSOCK` @@ -335,7 +336,7 @@ impl FileType { } } - /// Construct a `FileType` from the `d_type` field of a `dirent`. + /// Construct a `FileType` from the `d_type` field of a `c::dirent`. #[inline] pub(crate) const fn from_dirent_d_type(d_type: u8) -> Self { match d_type as u32 { @@ -645,7 +646,7 @@ pub type StatxTimestamp = linux_raw_sys::general::statx_timestamp; )))] pub type RawMode = linux_raw_sys::general::__kernel_mode_t; -/// `mode_t +/// `mode_t` #[cfg(any( target_arch = "x86", target_arch = "sparc", diff --git a/vendor/rustix/src/backend/linux_raw/io/errno.rs b/vendor/rustix/src/backend/linux_raw/io/errno.rs index b01910138..9db14d06e 100644 --- a/vendor/rustix/src/backend/linux_raw/io/errno.rs +++ b/vendor/rustix/src/backend/linux_raw/io/errno.rs @@ -60,7 +60,7 @@ impl Errno { Self::from_errno(raw as u32) } - /// Convert from a C errno value (which is positive) to an `Errno`. + /// Convert from a C `errno` value (which is positive) to an `Errno`. const fn from_errno(raw: u32) -> Self { // We store error values in negated form, so that we don't have to negate // them after every syscall. diff --git a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs index 3acf9ffdb..c76fb0635 100644 --- a/vendor/rustix/src/backend/linux_raw/io/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/io/syscalls.rs @@ -36,7 +36,7 @@ use linux_raw_sys::ioctl::{BLKPBSZGET, BLKSSZGET, FICLONE, FIONBIO, FIONREAD, TI #[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))] use { super::super::conv::{opt_ref, size_of}, - linux_raw_sys::general::{__kernel_timespec, sigset_t}, + linux_raw_sys::general::{__kernel_timespec, kernel_sigset_t}, }; #[inline] @@ -555,7 +555,7 @@ pub(crate) fn poll(fds: &mut [PollFd<'_>], timeout: c::c_int) -> io::Result<usiz fds_len, opt_ref(timeout.as_ref()), zero(), - size_of::<sigset_t, _>() + size_of::<kernel_sigset_t, _>() )) } #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))] diff --git a/vendor/rustix/src/backend/linux_raw/mm/types.rs b/vendor/rustix/src/backend/linux_raw/mm/types.rs index a58dd76be..a34c41f4f 100644 --- a/vendor/rustix/src/backend/linux_raw/mm/types.rs +++ b/vendor/rustix/src/backend/linux_raw/mm/types.rs @@ -197,12 +197,12 @@ pub enum Advice { LinuxPopulateWrite = linux_raw_sys::general::MADV_POPULATE_WRITE, } +#[allow(non_upper_case_globals)] impl Advice { /// `POSIX_MADV_DONTNEED` /// /// On Linux, this is mapped to `POSIX_MADV_NORMAL` because /// Linux's `MADV_DONTNEED` differs from `POSIX_MADV_DONTNEED`. See /// `LinuxDontNeed` for the Linux behavior. - #[allow(non_upper_case_globals)] pub const DontNeed: Self = Self::Normal; } diff --git a/vendor/rustix/src/backend/linux_raw/mod.rs b/vendor/rustix/src/backend/linux_raw/mod.rs index 1b91fc3ab..e7e073e32 100644 --- a/vendor/rustix/src/backend/linux_raw/mod.rs +++ b/vendor/rustix/src/backend/linux_raw/mod.rs @@ -14,11 +14,6 @@ //! 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/send_recv.rs b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs index 888e81e2b..fb82eaef3 100644 --- a/vendor/rustix/src/backend/linux_raw/net/send_recv.rs +++ b/vendor/rustix/src/backend/linux_raw/net/send_recv.rs @@ -2,7 +2,10 @@ use super::super::c; use bitflags::bitflags; bitflags! { - /// `MSG_*` + /// `MSG_* flags for use with [`send`], [`send_to`], and related functions. + /// + /// [`send`]: crate::net::send + /// [`sendto`]: crate::net::sendto pub struct SendFlags: u32 { /// `MSG_CONFIRM` const CONFIRM = c::MSG_CONFIRM; @@ -22,7 +25,10 @@ bitflags! { } bitflags! { - /// `MSG_*` + /// `MSG_* flags for use with [`recv`], [`recvfrom`], and related functions. + /// + /// [`recv`]: crate::net::recv + /// [`recvfrom`]: crate::net::recvfrom pub struct RecvFlags: u32 { /// `MSG_CMSG_CLOEXEC` const CMSG_CLOEXEC = c::MSG_CMSG_CLOEXEC; diff --git a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs index 6093cd3a5..7fe9f0ef4 100644 --- a/vendor/rustix/src/backend/linux_raw/net/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/net/syscalls.rs @@ -13,7 +13,7 @@ use super::super::conv::{ }; use super::read_sockaddr::{initialize_family_to_unspec, maybe_read_sockaddr_os, read_sockaddr_os}; use super::send_recv::{RecvFlags, SendFlags}; -use super::types::{AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType}; +use super::types::{AddressFamily, Protocol, Shutdown, SocketFlags, SocketType}; use super::write_sockaddr::{encode_sockaddr_v4, encode_sockaddr_v6}; use crate::fd::{BorrowedFd, OwnedFd}; use crate::io; @@ -143,7 +143,7 @@ pub(crate) fn accept(fd: BorrowedFd<'_>) -> io::Result<OwnedFd> { } #[inline] -pub(crate) fn accept_with(fd: BorrowedFd<'_>, flags: AcceptFlags) -> io::Result<OwnedFd> { +pub(crate) fn accept_with(fd: BorrowedFd<'_>, flags: SocketFlags) -> io::Result<OwnedFd> { #[cfg(not(target_arch = "x86"))] unsafe { let fd = ret_owned_fd(syscall_readonly!(__NR_accept4, fd, zero(), zero(), flags))?; @@ -200,7 +200,7 @@ pub(crate) fn acceptfrom(fd: BorrowedFd<'_>) -> io::Result<(OwnedFd, Option<Sock #[inline] pub(crate) fn acceptfrom_with( fd: BorrowedFd<'_>, - flags: AcceptFlags, + flags: SocketFlags, ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { #[cfg(not(target_arch = "x86"))] unsafe { @@ -1066,16 +1066,53 @@ pub(crate) mod sockopt { } #[inline] - pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), crate::io::Errno>> { + pub(crate) fn get_socket_error(fd: BorrowedFd<'_>) -> io::Result<Result<(), 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)) + Err(io::Errno::from_raw_os_error(err)) }) } #[inline] + pub(crate) fn set_socket_keepalive(fd: BorrowedFd<'_>, keepalive: bool) -> io::Result<()> { + setsockopt( + fd, + c::SOL_SOCKET as _, + c::SO_KEEPALIVE, + from_bool(keepalive), + ) + } + + #[inline] + pub(crate) fn get_socket_keepalive(fd: BorrowedFd<'_>) -> io::Result<bool> { + getsockopt(fd, c::SOL_SOCKET as _, c::SO_KEEPALIVE).map(to_bool) + } + + #[inline] + pub(crate) fn set_socket_recv_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> { + let size: c::c_int = size.try_into().map_err(|_| io::Errno::OVERFLOW)?; + setsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF, size) + } + + #[inline] + pub(crate) fn get_socket_recv_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> { + getsockopt(fd, c::SOL_SOCKET as _, c::SO_RCVBUF).map(|size: u32| size as usize) + } + + #[inline] + pub(crate) fn set_socket_send_buffer_size(fd: BorrowedFd<'_>, size: usize) -> io::Result<()> { + let size: c::c_int = size.try_into().map_err(|_| io::Errno::OVERFLOW)?; + setsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF, size) + } + + #[inline] + pub(crate) fn get_socket_send_buffer_size(fd: BorrowedFd<'_>) -> io::Result<usize> { + getsockopt(fd, c::SOL_SOCKET as _, c::SO_SNDBUF).map(|size: u32| size as usize) + } + + #[inline] pub(crate) fn set_ip_ttl(fd: BorrowedFd<'_>, ttl: u32) -> io::Result<()> { setsockopt(fd, c::IPPROTO_IP as _, c::IP_TTL, ttl) } @@ -1200,6 +1237,20 @@ pub(crate) mod sockopt { } #[inline] + pub(crate) fn get_ipv6_unicast_hops(fd: BorrowedFd<'_>) -> io::Result<u8> { + getsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS).map(|hops: c::c_int| hops as u8) + } + + #[inline] + pub(crate) fn set_ipv6_unicast_hops(fd: BorrowedFd<'_>, hops: Option<u8>) -> io::Result<()> { + let hops = match hops { + Some(hops) => hops as c::c_int, + None => -1, + }; + setsockopt(fd, c::IPPROTO_IPV6 as _, c::IPV6_UNICAST_HOPS, hops) + } + + #[inline] pub(crate) fn set_tcp_nodelay(fd: BorrowedFd<'_>, nodelay: bool) -> io::Result<()> { setsockopt(fd, c::IPPROTO_TCP as _, c::TCP_NODELAY, from_bool(nodelay)) } diff --git a/vendor/rustix/src/backend/linux_raw/net/types.rs b/vendor/rustix/src/backend/linux_raw/net/types.rs index b8f786b3f..3f0b571a5 100644 --- a/vendor/rustix/src/backend/linux_raw/net/types.rs +++ b/vendor/rustix/src/backend/linux_raw/net/types.rs @@ -52,6 +52,7 @@ pub type RawAddressFamily = c::sa_family_t; pub struct AddressFamily(pub(crate) RawAddressFamily); #[rustfmt::skip] +#[allow(non_upper_case_globals)] impl AddressFamily { /// `AF_UNSPEC` pub const UNSPEC: Self = Self(c::AF_UNSPEC as _); @@ -81,7 +82,6 @@ impl AddressFamily { /// `AF_ROSE` pub const ROSE: Self = Self(c::AF_ROSE as _); /// `AF_DECnet` - #[allow(non_upper_case_globals)] pub const DECnet: Self = Self(c::AF_DECnet as _); /// `AF_NETBEUI` pub const NETBEUI: Self = Self(c::AF_NETBEUI as _); @@ -143,7 +143,10 @@ impl AddressFamily { #[doc(hidden)] pub type RawProtocol = u32; -/// `IPPROTO_*` +/// `IPPROTO_*` constants for use with [`socket`] and [`socket_with`]. +/// +/// [`socket`]: crate::net::socket +/// [`socket_with`]: crate::net::socket_with #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[repr(transparent)] pub struct Protocol(pub(crate) RawProtocol); @@ -232,7 +235,7 @@ impl Protocol { #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] #[repr(u32)] pub enum Shutdown { - /// `SHUT_WR`—Disable further read operations. + /// `SHUT_RD`—Disable further read operations. Read = c::SHUT_RD, /// `SHUT_WR`—Disable further write operations. Write = c::SHUT_WR, @@ -241,22 +244,12 @@ pub enum Shutdown { } bitflags! { - /// `SOCK_*` constants for use with [`accept_with`] and [`acceptfrom_with`]. + /// `SOCK_*` constants for use with [`socket_with`], [`accept_with`] and + /// [`acceptfrom_with`]. /// + /// [`socket_with`]: crate::net::socket_with /// [`accept_with`]: crate::net::accept_with /// [`acceptfrom_with`]: crate::net::acceptfrom_with - pub struct AcceptFlags: c::c_uint { - /// `SOCK_NONBLOCK` - const NONBLOCK = c::O_NONBLOCK; - /// `SOCK_CLOEXEC` - const CLOEXEC = c::O_CLOEXEC; - } -} - -bitflags! { - /// `SOCK_*` constants for use with [`socket`]. - /// - /// [`socket`]: crate::net::socket pub struct SocketFlags: c::c_uint { /// `SOCK_NONBLOCK` const NONBLOCK = c::O_NONBLOCK; diff --git a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs index f86f8e5b9..0eb6489e7 100644 --- a/vendor/rustix/src/backend/linux_raw/process/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/process/syscalls.rs @@ -9,7 +9,8 @@ use super::super::c; use super::super::conv::{ by_mut, by_ref, c_int, c_uint, negative_pid, pass_usize, ret, ret_c_int, ret_c_uint, - ret_infallible, ret_usize, ret_usize_infallible, size_of, slice_just_addr, slice_mut, zero, + ret_infallible, ret_usize, ret_usize_infallible, size_of, slice, slice_just_addr, + slice_just_addr_mut, slice_mut, zero, }; use super::types::{RawCpuSet, RawUname}; use crate::backend::conv::ret_owned_fd; @@ -18,7 +19,8 @@ use crate::ffi::CStr; use crate::io; use crate::process::{ Cpuid, Gid, MembarrierCommand, MembarrierQuery, Pid, PidfdFlags, RawNonZeroPid, RawPid, - Resource, Rlimit, Signal, Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions, WaitidStatus, + Resource, Rlimit, Signal, Sysinfo, Uid, WaitId, WaitOptions, WaitStatus, WaitidOptions, + WaitidStatus, }; use core::convert::TryInto; use core::mem::MaybeUninit; @@ -43,6 +45,11 @@ pub(crate) fn fchdir(fd: BorrowedFd<'_>) -> io::Result<()> { } #[inline] +pub(crate) fn chroot(filename: &CStr) -> io::Result<()> { + unsafe { ret(syscall_readonly!(__NR_chroot, filename)) } +} + +#[inline] pub(crate) fn getcwd(buf: &mut [u8]) -> io::Result<usize> { let (buf_addr_mut, buf_len) = slice_mut(buf); unsafe { ret_usize(syscall!(__NR_getcwd, buf_addr_mut, buf_len)) } @@ -116,6 +123,17 @@ pub(crate) fn getpgid(pid: Option<Pid>) -> io::Result<Pid> { } #[inline] +pub(crate) fn setpgid(pid: Option<Pid>, pgid: Option<Pid>) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_setpgid, + c_uint(Pid::as_raw(pid)), + c_uint(Pid::as_raw(pgid)) + )) + } +} + +#[inline] pub(crate) fn getpgrp() -> Pid { // Use the `getpgrp` syscall if available. #[cfg(not(any(target_arch = "aarch64", target_arch = "riscv64")))] @@ -541,7 +559,9 @@ pub(crate) fn waitid(id: WaitId<'_>, options: WaitidOptions) -> io::Result<Optio #[inline] fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> { - let mut status = MaybeUninit::<c::siginfo_t>::uninit(); + // `waitid` can return successfully without initializing the struct (no + // children found when using `WNOHANG`) + let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(syscall!( __NR_waitid, @@ -558,7 +578,9 @@ fn _waitid_all(options: WaitidOptions) -> io::Result<Option<WaitidStatus>> { #[inline] fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> { - let mut status = MaybeUninit::<c::siginfo_t>::uninit(); + // `waitid` can return successfully without initializing the struct (no + // children found when using `WNOHANG`) + let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(syscall!( __NR_waitid, @@ -575,7 +597,9 @@ fn _waitid_pid(pid: Pid, options: WaitidOptions) -> io::Result<Option<WaitidStat #[inline] fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Option<WaitidStatus>> { - let mut status = MaybeUninit::<c::siginfo_t>::uninit(); + // `waitid` can return successfully without initializing the struct (no + // children found when using `WNOHANG`) + let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(syscall!( __NR_waitid, @@ -597,9 +621,10 @@ fn _waitid_pidfd(fd: BorrowedFd<'_>, options: WaitidOptions) -> io::Result<Optio /// The caller must ensure that `status` is initialized and that `waitid` /// returned successfully. #[inline] +#[rustfmt::skip] 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 { + if status.__bindgen_anon_1.__bindgen_anon_1._sifields._sigchld._pid == 0 { None } else { Some(WaitidStatus(status)) @@ -613,6 +638,17 @@ pub(crate) fn exit_group(code: c::c_int) -> ! { } #[inline] +pub(crate) fn getsid(pid: Option<Pid>) -> io::Result<Pid> { + unsafe { + let pid = ret_usize(syscall_readonly!(__NR_getsid, c_uint(Pid::as_raw(pid))))?; + debug_assert!(pid > 0); + Ok(Pid::from_raw_nonzero(RawNonZeroPid::new_unchecked( + pid as u32, + ))) + } +} + +#[inline] pub(crate) fn setsid() -> io::Result<Pid> { unsafe { let pid = ret_usize(syscall_readonly!(__NR_setsid))?; @@ -639,6 +675,27 @@ pub(crate) fn kill_current_process_group(sig: Signal) -> io::Result<()> { } #[inline] +pub(crate) fn test_kill_process(pid: Pid) -> io::Result<()> { + unsafe { ret(syscall_readonly!(__NR_kill, pid, pass_usize(0))) } +} + +#[inline] +pub(crate) fn test_kill_process_group(pid: Pid) -> io::Result<()> { + unsafe { + ret(syscall_readonly!( + __NR_kill, + negative_pid(pid), + pass_usize(0) + )) + } +} + +#[inline] +pub(crate) fn test_kill_current_process_group() -> io::Result<()> { + unsafe { ret(syscall_readonly!(__NR_kill, pass_usize(0), pass_usize(0))) } +} + +#[inline] pub(crate) unsafe fn prctl( option: c::c_int, arg2: *mut c::c_void, @@ -659,3 +716,31 @@ pub(crate) fn pidfd_open(pid: Pid, flags: PidfdFlags) -> io::Result<OwnedFd> { )) } } + +#[inline] +pub(crate) fn getgroups(buf: &mut [Gid]) -> io::Result<usize> { + let len = buf.len().try_into().map_err(|_| io::Errno::NOMEM)?; + + unsafe { + ret_usize(syscall!( + __NR_getgroups, + c_int(len), + slice_just_addr_mut(buf) + )) + } +} + +#[inline] +pub(crate) fn sysinfo() -> Sysinfo { + let mut info = MaybeUninit::<Sysinfo>::uninit(); + unsafe { + ret_infallible(syscall!(__NR_sysinfo, &mut info)); + info.assume_init() + } +} + +#[inline] +pub(crate) fn sethostname(name: &[u8]) -> io::Result<()> { + let (ptr, len) = slice(name); + unsafe { ret(syscall_readonly!(__NR_sethostname, ptr, len)) } +} diff --git a/vendor/rustix/src/backend/linux_raw/process/types.rs b/vendor/rustix/src/backend/linux_raw/process/types.rs index 53e2c7db1..efdaddbae 100644 --- a/vendor/rustix/src/backend/linux_raw/process/types.rs +++ b/vendor/rustix/src/backend/linux_raw/process/types.rs @@ -1,6 +1,9 @@ use super::super::c; use linux_raw_sys::general::membarrier_cmd; +/// `sysinfo` +pub type Sysinfo = linux_raw_sys::general::sysinfo; + /// A command for use with [`membarrier`] and [`membarrier_cpu`]. /// /// For `MEMBARRIER_CMD_QUERY`, see [`membarrier_query`]. @@ -78,10 +81,12 @@ pub enum Resource { Rttime = linux_raw_sys::general::RLIMIT_RTTIME, } -/// A signal number for use with [`kill_process`] and [`kill_process_group`]. +/// A signal number for use with [`kill_process`], [`kill_process_group`], +/// and [`kill_current_process_group`]. /// /// [`kill_process`]: crate::process::kill_process /// [`kill_process_group`]: crate::process::kill_process_group +/// [`kill_current_process_group`]: crate::process::kill_current_process_group #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(u32)] pub enum Signal { @@ -206,7 +211,7 @@ impl Signal { pub const EXIT_SUCCESS: c::c_int = 0; /// `EXIT_FAILURE` pub const EXIT_FAILURE: c::c_int = 1; -/// The status value of a child terminated with `SIGABRT`. +/// The status value of a child terminated with a [`Signal::Abort`] signal. pub const EXIT_SIGNALED_SIGABRT: c::c_int = 128 + linux_raw_sys::general::SIGABRT as i32; /// A process identifier as a raw integer. diff --git a/vendor/rustix/src/backend/linux_raw/process/wait.rs b/vendor/rustix/src/backend/linux_raw/process/wait.rs index edc564a9f..9af7f2b5e 100644 --- a/vendor/rustix/src/backend/linux_raw/process/wait.rs +++ b/vendor/rustix/src/backend/linux_raw/process/wait.rs @@ -1,8 +1,9 @@ // The functions replacing the C macros use the same names as in libc. -#![allow(non_snake_case)] +#![allow(non_snake_case, unsafe_code)] +use linux_raw_sys::ctypes::c_int; pub(crate) use linux_raw_sys::general::{ - WCONTINUED, WEXITED, WNOHANG, WNOWAIT, WSTOPPED, WUNTRACED, + siginfo_t, WCONTINUED, WEXITED, WNOHANG, WNOWAIT, WSTOPPED, WUNTRACED, }; #[inline] @@ -39,3 +40,29 @@ pub(crate) fn WIFEXITED(status: u32) -> bool { pub(crate) fn WEXITSTATUS(status: u32) -> u32 { (status >> 8) & 0xff } + +pub(crate) trait SiginfoExt { + fn si_code(&self) -> c_int; + unsafe fn si_status(&self) -> c_int; +} + +impl SiginfoExt for siginfo_t { + #[inline] + fn si_code(&self) -> c_int { + // SAFETY: This is technically a union access, but it's only a union + // with padding. + unsafe { self.__bindgen_anon_1.__bindgen_anon_1.si_code } + } + + /// Return the exit status or signal number recorded in a `siginfo_t`. + /// + /// # Safety + /// + /// `si_signo` must equal `SIGCHLD` (as it is guaranteed to do after a + /// `waitid` call). + #[inline] + #[rustfmt::skip] + unsafe fn si_status(&self) -> c_int { + self.__bindgen_anon_1.__bindgen_anon_1._sifields._sigchld._status + } +} diff --git a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs index a331786f9..74363fc32 100644 --- a/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/runtime/syscalls.rs @@ -9,15 +9,25 @@ use super::super::c; #[cfg(target_arch = "x86")] use super::super::conv::by_mut; -use super::super::conv::{c_int, c_uint, ret, ret_c_uint, ret_error, ret_usize_infallible, zero}; +use super::super::conv::{ + by_ref, c_int, c_uint, ret, ret_c_int, ret_c_uint, ret_error, ret_usize_infallible, size_of, + zero, +}; #[cfg(feature = "fs")] use crate::fd::BorrowedFd; use crate::ffi::CStr; #[cfg(feature = "fs")] use crate::fs::AtFlags; use crate::io; -use crate::process::{Pid, RawNonZeroPid}; -use linux_raw_sys::general::{__kernel_pid_t, PR_SET_NAME, SIGCHLD}; +use crate::process::{Pid, RawNonZeroPid, Signal}; +use crate::runtime::{How, Sigaction, Siginfo, Sigset, Stack, Timespec}; +use crate::utils::optional_as_ptr; +#[cfg(target_pointer_width = "32")] +use core::convert::TryInto; +use core::mem::MaybeUninit; +#[cfg(target_pointer_width = "32")] +use linux_raw_sys::general::__kernel_old_timespec; +use linux_raw_sys::general::{__kernel_pid_t, kernel_sigset_t, PR_SET_NAME, SIGCHLD}; #[cfg(target_arch = "x86_64")] use {super::super::conv::ret_infallible, linux_raw_sys::general::ARCH_SET_FS}; @@ -105,3 +115,135 @@ pub(crate) mod tls { unsafe { syscall_noreturn!(__NR_exit, c_int(code)) } } } + +#[inline] +pub(crate) unsafe fn sigaction(signal: Signal, new: Option<Sigaction>) -> io::Result<Sigaction> { + let mut old = MaybeUninit::<Sigaction>::uninit(); + let new = optional_as_ptr(new.as_ref()); + ret(syscall!( + __NR_rt_sigaction, + signal, + new, + &mut old, + size_of::<kernel_sigset_t, _>() + ))?; + Ok(old.assume_init()) +} + +#[inline] +pub(crate) unsafe fn sigaltstack(new: Option<Stack>) -> io::Result<Stack> { + let mut old = MaybeUninit::<Stack>::uninit(); + let new = optional_as_ptr(new.as_ref()); + ret(syscall!(__NR_sigaltstack, new, &mut old))?; + Ok(old.assume_init()) +} + +#[inline] +pub(crate) unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> { + ret(syscall_readonly!(__NR_tkill, tid, sig)) +} + +#[inline] +pub(crate) unsafe fn sigprocmask(how: How, set: &Sigset) -> io::Result<Sigset> { + let mut old = MaybeUninit::<Sigset>::uninit(); + ret(syscall!( + __NR_rt_sigprocmask, + how, + by_ref(set), + &mut old, + size_of::<kernel_sigset_t, _>() + ))?; + Ok(old.assume_init()) +} + +#[inline] +pub(crate) fn sigwait(set: &Sigset) -> io::Result<Signal> { + unsafe { + match Signal::from_raw(ret_c_int(syscall_readonly!( + __NR_rt_sigtimedwait, + by_ref(set), + zero(), + zero(), + size_of::<kernel_sigset_t, _>() + ))?) { + Some(signum) => Ok(signum), + None => Err(io::Errno::NOTSUP), + } + } +} + +#[inline] +pub(crate) fn sigwaitinfo(set: &Sigset) -> io::Result<Siginfo> { + let mut info = MaybeUninit::<Siginfo>::uninit(); + unsafe { + let _signum = ret_c_int(syscall!( + __NR_rt_sigtimedwait, + by_ref(set), + &mut info, + zero(), + size_of::<kernel_sigset_t, _>() + ))?; + Ok(info.assume_init()) + } +} + +#[inline] +pub(crate) fn sigtimedwait(set: &Sigset, timeout: Option<Timespec>) -> io::Result<Siginfo> { + let mut info = MaybeUninit::<Siginfo>::uninit(); + let timeout_ptr = optional_as_ptr(timeout.as_ref()); + + #[cfg(target_pointer_width = "32")] + unsafe { + match ret_c_int(syscall!( + __NR_rt_sigtimedwait_time64, + by_ref(set), + &mut info, + timeout_ptr, + size_of::<kernel_sigset_t, _>() + )) { + Ok(_signum) => (), + Err(io::Errno::NOSYS) => sigtimedwait_old(set, timeout, &mut info)?, + Err(err) => return Err(err), + } + Ok(info.assume_init()) + } + + #[cfg(target_pointer_width = "64")] + unsafe { + let _signum = ret_c_int(syscall!( + __NR_rt_sigtimedwait, + by_ref(set), + &mut info, + timeout_ptr, + size_of::<kernel_sigset_t, _>() + ))?; + Ok(info.assume_init()) + } +} + +#[cfg(target_pointer_width = "32")] +unsafe fn sigtimedwait_old( + set: &Sigset, + timeout: Option<Timespec>, + info: &mut MaybeUninit<Siginfo>, +) -> io::Result<()> { + let old_timeout = match timeout { + Some(timeout) => Some(__kernel_old_timespec { + tv_sec: timeout.tv_sec.try_into().map_err(|_| io::Errno::OVERFLOW)?, + tv_nsec: timeout.tv_nsec as _, + }), + None => None, + }; + + let old_timeout_ptr = optional_as_ptr(old_timeout.as_ref()); + + let _signum = ret_c_int(syscall!( + __NR_rt_sigtimedwait, + by_ref(set), + info, + old_timeout_ptr, + size_of::<kernel_sigset_t, _>() + ))?; + + Ok(()) +} diff --git a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs index f5643f3c3..3c8cbb0c9 100644 --- a/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/termios/syscalls.rs @@ -207,9 +207,9 @@ pub(crate) fn cfgetispeed(termios: &Termios) -> u32 { #[inline] pub(crate) fn cfmakeraw(termios: &mut Termios) { - // From the Linux [`cfmakeraw` man page]: + // From the Linux [`cfmakeraw` manual page]: // - // [`cfmakeraw` man page]: https://man7.org/linux/man-pages/man3/cfmakeraw.3.html + // [`cfmakeraw` manual page]: https://man7.org/linux/man-pages/man3/cfmakeraw.3.html termios.c_iflag &= !(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); termios.c_oflag &= !OPOST; termios.c_lflag &= !(ECHO | ECHONL | ICANON | ISIG | IEXTEN); @@ -269,7 +269,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> { // Quick check: if `fd` isn't a character device, it's not a tty. if FileType::from_raw_mode(fd_stat.st_mode) != FileType::CharacterDevice { - return Err(crate::io::Errno::NOTTY); + return Err(io::Errno::NOTTY); } // Check that `fd` is really a tty. @@ -295,7 +295,7 @@ pub(crate) fn ttyname(fd: BorrowedFd<'_>, buf: &mut [u8]) -> io::Result<usize> { let path_stat = super::super::fs::syscalls::stat(path)?; if path_stat.st_dev != fd_stat.st_dev || path_stat.st_ino != fd_stat.st_ino { - return Err(crate::io::Errno::NODEV); + return Err(io::Errno::NODEV); } Ok(r) diff --git a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs index af2c9ee8a..1895c8c6d 100644 --- a/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs +++ b/vendor/rustix/src/backend/linux_raw/thread/syscalls.rs @@ -302,7 +302,7 @@ pub(crate) fn capget( 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())) } + unsafe { ret(syscall!(__NR_capget, header, data)) } } #[cfg(any(target_os = "android", target_os = "linux"))] diff --git a/vendor/rustix/src/backend/linux_raw/time/types.rs b/vendor/rustix/src/backend/linux_raw/time/types.rs index 5a0fcc6f5..fcdd7f6d6 100644 --- a/vendor/rustix/src/backend/linux_raw/time/types.rs +++ b/vendor/rustix/src/backend/linux_raw/time/types.rs @@ -114,7 +114,7 @@ bitflags! { #[repr(u32)] #[non_exhaustive] pub enum TimerfdClockId { - /// `CLOCK_REALTIME`—A clock that tells the "real" time. + /// `CLOCK_REALTIME`—A clock that tells the “real” time. /// /// This is a clock that tells the amount of time elapsed since the /// Unix epoch, 1970-01-01T00:00:00Z. The clock is externally settable, so diff --git a/vendor/rustix/src/backend/linux_raw/vdso.rs b/vendor/rustix/src/backend/linux_raw/vdso.rs index 480378b50..606aee7d1 100644 --- a/vendor/rustix/src/backend/linux_raw/vdso.rs +++ b/vendor/rustix/src/backend/linux_raw/vdso.rs @@ -117,7 +117,7 @@ fn init_from_sysinfo_ehdr() -> Option<Vdso> { .as_ptr(); num_dyn = phdr.p_memsz / size_of::<Elf_Dyn>(); } else if phdr.p_type == PT_INTERP || phdr.p_type == PT_GNU_RELRO { - // Don't trust any ELF image that has an "interpreter" or that uses + // Don't trust any ELF image that has an “interpreter” or that uses // RELRO, which is likely to be a user ELF image rather and not the // kernel vDSO. return None; diff --git a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs index 5b2e084ea..97d5862a0 100644 --- a/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs +++ b/vendor/rustix/src/backend/linux_raw/vdso_wrappers.rs @@ -293,7 +293,7 @@ unsafe fn _rustix_clock_gettime_via_syscall( ret(syscall!(__NR_clock_gettime, c_int(clockid), res)) } -/// A symbol pointing to an `int 0x80` instruction. This "function" is only +/// A symbol pointing to an `int 0x80` instruction. This “function” is only /// called from assembly, and only with the x86 syscall calling convention, /// so its signature here is not its true signature. #[cfg(all(asm, target_arch = "x86"))] diff --git a/vendor/rustix/src/fs/abs.rs b/vendor/rustix/src/fs/abs.rs index cffcf709b..314895006 100644 --- a/vendor/rustix/src/fs/abs.rs +++ b/vendor/rustix/src/fs/abs.rs @@ -8,7 +8,7 @@ target_os = "wasi", )))] use crate::fs::StatFs; -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] use { crate::fs::StatVfs, crate::{backend, io, path}, @@ -48,7 +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(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(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 42bc5f807..2314cf763 100644 --- a/vendor/rustix/src/fs/at.rs +++ b/vendor/rustix/src/fs/at.rs @@ -7,15 +7,13 @@ use crate::fd::OwnedFd; use crate::ffi::{CStr, CString}; -#[cfg(not(solarish))] -use crate::fs::Access; #[cfg(apple)] use crate::fs::CloneFlags; #[cfg(not(any(apple, target_os = "wasi")))] use crate::fs::FileType; #[cfg(any(target_os = "android", target_os = "linux"))] use crate::fs::RenameFlags; -use crate::fs::{AtFlags, Mode, OFlags, Stat, Timestamps}; +use crate::fs::{Access, AtFlags, Mode, OFlags, Stat, Timestamps}; use crate::path::SMALL_PATH_BUFFER_SIZE; #[cfg(not(target_os = "wasi"))] use crate::process::{Gid, Uid}; @@ -271,7 +269,6 @@ 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(solarish))] #[inline] #[doc(alias = "faccessat")] pub fn accessat<P: path::Arg, Fd: AsFd>( diff --git a/vendor/rustix/src/fs/constants.rs b/vendor/rustix/src/fs/constants.rs index c8e261e66..3ccc383bb 100644 --- a/vendor/rustix/src/fs/constants.rs +++ b/vendor/rustix/src/fs/constants.rs @@ -3,7 +3,7 @@ use crate::backend; pub use crate::io::FdFlags; -pub use backend::fs::types::{Access, Mode, OFlags}; +pub use backend::fs::types::{Access, Dev, Mode, OFlags}; #[cfg(not(target_os = "redox"))] pub use backend::fs::types::AtFlags; @@ -14,7 +14,4 @@ pub use backend::fs::types::{CloneFlags, CopyfileFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] pub use backend::fs::types::*; -#[cfg(not(target_os = "redox"))] -pub use backend::fs::types::Dev; - pub use backend::time::types::{Nsecs, Secs, Timespec}; diff --git a/vendor/rustix/src/fs/fd.rs b/vendor/rustix/src/fs/fd.rs index 6ce8410b2..81e56d909 100644 --- a/vendor/rustix/src/fs/fd.rs +++ b/vendor/rustix/src/fs/fd.rs @@ -31,7 +31,7 @@ pub use backend::fs::types::Stat; )))] pub use backend::fs::types::StatFs; -#[cfg(not(any(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))] pub use backend::fs::types::{StatVfs, StatVfsMountFlags}; #[cfg(any(target_os = "android", target_os = "linux"))] @@ -55,17 +55,17 @@ pub struct Timestamps { /// The filesystem magic number for procfs. /// -/// See [the `fstatfs` man page] for more information. +/// See [the `fstatfs` manual page] for more information. /// -/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION +/// [the `fstatfs` manual 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::c::PROC_SUPER_MAGIC as FsWord; /// The filesystem magic number for NFS. /// -/// See [the `fstatfs` man page] for more information. +/// See [the `fstatfs` manual page] for more information. /// -/// [the `fstatfs` man page]: https://man7.org/linux/man-pages/man2/fstatfs.2.html#DESCRIPTION +/// [the `fstatfs` manual 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::c::NFS_SUPER_MAGIC as FsWord; @@ -185,7 +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(solarish, target_os = "haiku", target_os = "redox", target_os = "wasi")))] +#[cfg(not(any(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()) diff --git a/vendor/rustix/src/fs/memfd_create.rs b/vendor/rustix/src/fs/memfd_create.rs index dad964777..bbcbab258 100644 --- a/vendor/rustix/src/fs/memfd_create.rs +++ b/vendor/rustix/src/fs/memfd_create.rs @@ -7,8 +7,12 @@ pub use backend::fs::types::MemfdFlags; /// /// # References /// - [Linux] +/// - [glibc] +/// - [FreeBSD] /// /// [Linux]: https://man7.org/linux/man-pages/man2/memfd_create.2.html +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-memfd_005fcreate +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?memfd_create #[inline] pub fn memfd_create<P: path::Arg>(path: P, flags: MemfdFlags) -> io::Result<OwnedFd> { path.into_with_c_str(|path| backend::fs::syscalls::memfd_create(path, flags)) diff --git a/vendor/rustix/src/fs/mod.rs b/vendor/rustix/src/fs/mod.rs index 9588cebe0..e28ddab6f 100644 --- a/vendor/rustix/src/fs/mod.rs +++ b/vendor/rustix/src/fs/mod.rs @@ -42,9 +42,10 @@ mod raw_dir; 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")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi")))] mod sync; +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +mod xattr; #[cfg(any(target_os = "android", target_os = "linux"))] pub use crate::backend::fs::inotify; @@ -90,13 +91,15 @@ pub use raw_dir::{RawDir, RawDirEntry}; 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")))] +#[cfg(not(any(target_os = "redox", target_os = "wasi")))] pub use sync::sync; +#[cfg(any(apple, target_os = "android", target_os = "linux"))] +pub use xattr::*; /// Re-export types common to POSIX-ish platforms. #[cfg(feature = "std")] #[cfg(unix)] pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt}; #[cfg(feature = "std")] -#[cfg(target_os = "wasi")] +#[cfg(all(wasi_ext, target_os = "wasi"))] pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt}; diff --git a/vendor/rustix/src/fs/raw_dir.rs b/vendor/rustix/src/fs/raw_dir.rs index 780ff0e89..bad0bf97b 100644 --- a/vendor/rustix/src/fs/raw_dir.rs +++ b/vendor/rustix/src/fs/raw_dir.rs @@ -209,7 +209,7 @@ impl<'buf, Fd: AsFd> RawDir<'buf, Fd> { 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. + // SAFETY: The kernel guarantees a NUL-terminated string. file_name: unsafe { CStr::from_ptr(dirent.d_name.as_ptr().cast()) }, })) } diff --git a/vendor/rustix/src/fs/statx.rs b/vendor/rustix/src/fs/statx.rs index 716c66212..121f9270a 100644 --- a/vendor/rustix/src/fs/statx.rs +++ b/vendor/rustix/src/fs/statx.rs @@ -15,7 +15,7 @@ use compat::statx as _statx; /// /// This function returns [`io::Errno::NOSYS`] if `statx` is not available on /// the platform, such as Linux before 4.11. This also includes older Docker -/// versions where the actual syscall fails with different error codes; Rustix +/// versions where the actual syscall fails with different error codes; rustix /// handles this and translates them into `NOSYS`. /// /// # References diff --git a/vendor/rustix/src/fs/xattr.rs b/vendor/rustix/src/fs/xattr.rs new file mode 100644 index 000000000..e50841b49 --- /dev/null +++ b/vendor/rustix/src/fs/xattr.rs @@ -0,0 +1,197 @@ +use crate::{backend, io, path}; +use backend::c; +use backend::fd::AsFd; +use bitflags::bitflags; + +bitflags! { + /// `XATTR_*` constants for use with [`setxattr`], and other `*setxattr` + /// functions. + pub struct XattrFlags: c::c_uint { + /// `XATTR_CREATE` + const CREATE = c::XATTR_CREATE as c::c_uint; + + /// `XATTR_REPLACE` + const REPLACE = c::XATTR_REPLACE as c::c_uint; + } +} + +/// `getxattr(path, name, value.as_ptr(), value.len())`—Get extended +/// filesystem attributes. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/getxattr.2.html +#[inline] +pub fn getxattr<P: path::Arg, Name: path::Arg>( + path: P, + name: Name, + value: &mut [u8], +) -> io::Result<usize> { + path.into_with_c_str(|path| { + name.into_with_c_str(|name| backend::fs::syscalls::getxattr(path, name, value)) + }) +} + +/// `lgetxattr(path, name, value.as_ptr(), value.len())`—Get extended +/// filesystem attributes, without following symlinks in the last path +/// component. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/lgetxattr.2.html +#[inline] +pub fn lgetxattr<P: path::Arg, Name: path::Arg>( + path: P, + name: Name, + value: &mut [u8], +) -> io::Result<usize> { + path.into_with_c_str(|path| { + name.into_with_c_str(|name| backend::fs::syscalls::lgetxattr(path, name, value)) + }) +} + +/// `fgetxattr(fd, name, value.as_ptr(), value.len())`—Get extended +/// filesystem attributes on an open file descriptor. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/fgetxattr.2.html +#[inline] +pub fn fgetxattr<Fd: AsFd, Name: path::Arg>( + fd: Fd, + name: Name, + value: &mut [u8], +) -> io::Result<usize> { + name.into_with_c_str(|name| backend::fs::syscalls::fgetxattr(fd.as_fd(), name, value)) +} + +/// `setxattr(path, name, value.as_ptr(), value.len(), flags)`—Set extended +/// filesystem attributes. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/setxattr.2.html +#[inline] +pub fn setxattr<P: path::Arg, Name: path::Arg>( + path: P, + name: Name, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + path.into_with_c_str(|path| { + name.into_with_c_str(|name| backend::fs::syscalls::setxattr(path, name, value, flags)) + }) +} + +/// `setxattr(path, name, value.as_ptr(), value.len(), flags)`—Set extended +/// filesystem attributes, without following symlinks in the last path +/// component. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/lsetxattr.2.html +#[inline] +pub fn lsetxattr<P: path::Arg, Name: path::Arg>( + path: P, + name: Name, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + path.into_with_c_str(|path| { + name.into_with_c_str(|name| backend::fs::syscalls::lsetxattr(path, name, value, flags)) + }) +} + +/// `fsetxattr(fd, name, value.as_ptr(), value.len(), flags)`—Set extended +/// filesystem attributes on an open file descriptor. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/fsetxattr.2.html +#[inline] +pub fn fsetxattr<Fd: AsFd, Name: path::Arg>( + fd: Fd, + name: Name, + value: &[u8], + flags: XattrFlags, +) -> io::Result<()> { + name.into_with_c_str(|name| backend::fs::syscalls::fsetxattr(fd.as_fd(), name, value, flags)) +} + +/// `listxattr(path, list.as_ptr(), list.len())`—List extended filesystem +/// attributes. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/listxattr.2.html +#[inline] +pub fn listxattr<P: path::Arg>(path: P, list: &mut [c::c_char]) -> io::Result<usize> { + path.into_with_c_str(|path| backend::fs::syscalls::listxattr(path, list)) +} + +/// `llistxattr(path, list.as_ptr(), list.len())`—List extended filesystem +/// attributes, without following symlinks in the last path component. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/llistxattr.2.html +#[inline] +pub fn llistxattr<P: path::Arg>(path: P, list: &mut [c::c_char]) -> io::Result<usize> { + path.into_with_c_str(|path| backend::fs::syscalls::llistxattr(path, list)) +} + +/// `flistxattr(fd, list.as_ptr(), list.len())`—List extended filesystem +/// attributes on an open file descriptor. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/flistxattr.2.html +#[inline] +pub fn flistxattr<Fd: AsFd>(fd: Fd, list: &mut [c::c_char]) -> io::Result<usize> { + backend::fs::syscalls::flistxattr(fd.as_fd(), list) +} + +/// `removexattr(path, name)`—Remove an extended filesystem attribute. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/removexattr.2.html +pub fn removexattr<P: path::Arg, Name: path::Arg>(path: P, name: Name) -> io::Result<()> { + path.into_with_c_str(|path| { + name.into_with_c_str(|name| backend::fs::syscalls::removexattr(path, name)) + }) +} + +/// `lremovexattr(path, name)`—Remove an extended filesystem attribute, +/// without following symlinks in the last path component. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/lremovexattr.2.html +pub fn lremovexattr<P: path::Arg, Name: path::Arg>(path: P, name: Name) -> io::Result<()> { + path.into_with_c_str(|path| { + name.into_with_c_str(|name| backend::fs::syscalls::lremovexattr(path, name)) + }) +} + +/// `fremovexattr(fd, name)`—Remove an extended filesystem attribute on an +/// open file descriptor. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/fremovexattr.2.html +pub fn fremovexattr<Fd: AsFd, Name: path::Arg>(fd: Fd, name: Name) -> io::Result<()> { + name.into_with_c_str(|name| backend::fs::syscalls::fremovexattr(fd.as_fd(), name)) +} diff --git a/vendor/rustix/src/io/close.rs b/vendor/rustix/src/io/close.rs index b286d2368..aad2c20a3 100644 --- a/vendor/rustix/src/io/close.rs +++ b/vendor/rustix/src/io/close.rs @@ -21,15 +21,29 @@ use backend::fd::RawFd; /// [responsibility]: https://lwn.net/Articles/576518/ /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#close-and-shutdownget-outta-my-face /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html /// [Linux]: https://man7.org/linux/man-pages/man2/close.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/close.2.html#//apple_ref/doc/man/2/close /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-closesocket +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=close&sektion=2 +/// [NetBSD]: https://man.netbsd.org/close.2 +/// [OpenBSD]: https://man.openbsd.org/close.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=close§ion=2 +/// [illumos]: https://illumos.org/man/2/close +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Opening-and-Closing-Files.html#index-close /// /// # Safety /// diff --git a/vendor/rustix/src/io/dup.rs b/vendor/rustix/src/io/dup.rs index 97a11f35c..0ac99f3f3 100644 --- a/vendor/rustix/src/io/dup.rs +++ b/vendor/rustix/src/io/dup.rs @@ -21,12 +21,24 @@ pub use backend::io::types::DupFlags; /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258 /// [`fcntl_dupfd_cloexec`]: crate::io::fcntl_dupfd_cloexec /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html /// [Linux]: https://man7.org/linux/man-pages/man2/dup.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/dup.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=dup&sektion=2 +/// [NetBSD]: https://man.netbsd.org/dup.2 +/// [OpenBSD]: https://man.openbsd.org/dup.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup§ion=2 +/// [illumos]: https://illumos.org/man/2/dup +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Duplicating-Descriptors.html #[cfg(not(target_os = "wasi"))] #[inline] pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> { @@ -51,12 +63,24 @@ pub fn dup<Fd: AsFd>(fd: Fd) -> io::Result<OwnedFd> { /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258 /// [`fcntl_dupfd_cloexec`]: crate::io::fcntl_dupfd_cloexec /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/dup2.html /// [Linux]: https://man7.org/linux/man-pages/man2/dup2.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/dup2.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=dup2&sektion=2 +/// [NetBSD]: https://man.netbsd.org/dup2.2 +/// [OpenBSD]: https://man.openbsd.org/dup2.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup2§ion=2 +/// [illumos]: https://illumos.org/man/2/dup +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Duplicating-Descriptors.html #[cfg(not(target_os = "wasi"))] #[inline] pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> { @@ -73,9 +97,17 @@ pub fn dup2<Fd: AsFd>(fd: Fd, new: &mut OwnedFd) -> io::Result<()> { /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] /// /// [file description]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_258 /// [Linux]: https://man7.org/linux/man-pages/man2/dup3.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=dup3&sektion=3 +/// [NetBSD]: https://man.netbsd.org/dup3.2 +/// [OpenBSD]: https://man.openbsd.org/dup3.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=dup3§ion=3 #[cfg(not(any(target_os = "aix", target_os = "wasi")))] #[inline] pub fn dup3<Fd: AsFd>(fd: Fd, new: &mut OwnedFd, flags: DupFlags) -> io::Result<()> { diff --git a/vendor/rustix/src/io/errno.rs b/vendor/rustix/src/io/errno.rs index f39573797..7cb50f229 100644 --- a/vendor/rustix/src/io/errno.rs +++ b/vendor/rustix/src/io/errno.rs @@ -10,8 +10,6 @@ use core::{fmt, result}; use std::error; /// A specialized [`Result`] type for `rustix` APIs. -/// -/// [`Result`]: core::result::Result pub type Result<T> = result::Result<T, Errno>; /// `errno`—An error code. @@ -22,9 +20,23 @@ pub type Result<T> = result::Result<T, Errno>; /// # References /// - [POSIX] /// - [Linux] +/// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html /// [Linux]: https://man7.org/linux/man-pages/man3/errno.3.html +/// [Winsock2]: https://learn.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2 +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?errno +/// [NetBSD]: https://man.netbsd.org/errno.2 +/// [OpenBSD]: https://man.openbsd.org/errno.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=errno§ion=2 +/// [illumos]: https://illumos.org/man/3C/errno +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Error-Codes.html pub use backend::io::errno::Errno; impl Errno { diff --git a/vendor/rustix/src/io/eventfd.rs b/vendor/rustix/src/io/eventfd.rs index 22ffc627c..1f71c96b1 100644 --- a/vendor/rustix/src/io/eventfd.rs +++ b/vendor/rustix/src/io/eventfd.rs @@ -8,8 +8,12 @@ pub use backend::io::types::EventfdFlags; /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/eventfd.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?eventfd +/// [illumos]: https://illumos.org/man/3C/eventfd #[inline] pub fn eventfd(initval: u32, flags: EventfdFlags) -> io::Result<OwnedFd> { backend::io::syscalls::eventfd(initval, flags) diff --git a/vendor/rustix/src/io/fcntl.rs b/vendor/rustix/src/io/fcntl.rs index ba79149ff..0454821ff 100644 --- a/vendor/rustix/src/io/fcntl.rs +++ b/vendor/rustix/src/io/fcntl.rs @@ -18,9 +18,23 @@ pub use backend::io::types::FdFlags; /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html /// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2 +/// [NetBSD]: https://man.netbsd.org/fcntl.2 +/// [OpenBSD]: https://man.openbsd.org/fcntl.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl§ion=2 +/// [illumos]: https://illumos.org/man/2/fcntl +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function #[inline] #[doc(alias = "F_GETFD")] pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> { @@ -32,9 +46,23 @@ pub fn fcntl_getfd<Fd: AsFd>(fd: Fd) -> io::Result<FdFlags> { /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html /// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2 +/// [NetBSD]: https://man.netbsd.org/fcntl.2 +/// [OpenBSD]: https://man.openbsd.org/fcntl.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl§ion=2 +/// [illumos]: https://illumos.org/man/2/fcntl +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function #[inline] #[doc(alias = "F_SETFD")] pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> { @@ -53,9 +81,23 @@ pub fn fcntl_setfd<Fd: AsFd>(fd: Fd, flags: FdFlags) -> io::Result<()> { /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html /// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2 +/// [NetBSD]: https://man.netbsd.org/fcntl.2 +/// [OpenBSD]: https://man.openbsd.org/fcntl.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl§ion=2 +/// [illumos]: https://illumos.org/man/2/fcntl +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function #[cfg(not(any(target_os = "wasi", target_os = "espidf")))] #[inline] #[doc(alias = "F_DUPFD_CLOEXEC")] @@ -74,9 +116,23 @@ pub fn fcntl_dupfd_cloexec<Fd: AsFd>(fd: Fd, min: RawFd) -> io::Result<OwnedFd> /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html /// [Linux]: https://man7.org/linux/man-pages/man2/fcntl.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/fcntl.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=fcntl&sektion=2 +/// [NetBSD]: https://man.netbsd.org/fcntl.2 +/// [OpenBSD]: https://man.openbsd.org/fcntl.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=fcntl§ion=2 +/// [illumos]: https://illumos.org/man/2/fcntl +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Control-Operations.html#index-fcntl-function #[cfg(target_os = "espidf")] #[inline] #[doc(alias = "F_DUPFD")] diff --git a/vendor/rustix/src/io/ioctl.rs b/vendor/rustix/src/io/ioctl.rs index 429b4f8db..fde652e19 100644 --- a/vendor/rustix/src/io/ioctl.rs +++ b/vendor/rustix/src/io/ioctl.rs @@ -10,8 +10,14 @@ use backend::fd::AsFd; /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] /// /// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4 +/// [NetBSD]: https://man.netbsd.org/tty.4 +/// [OpenBSD]: https://man.openbsd.org/tty.4 #[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCEXCL")] @@ -23,8 +29,14 @@ pub fn ioctl_tiocexcl<Fd: AsFd>(fd: Fd) -> io::Result<()> { /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] /// /// [Linux]: https://man7.org/linux/man-pages/man4/tty_ioctl.4.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=tty&sektion=4 +/// [NetBSD]: https://man.netbsd.org/tty.4 +/// [OpenBSD]: https://man.openbsd.org/tty.4 #[cfg(not(any(windows, target_os = "haiku", target_os = "redox", target_os = "wasi")))] #[inline] #[doc(alias = "TIOCNXCL")] @@ -32,16 +44,18 @@ pub fn ioctl_tiocnxcl<Fd: AsFd>(fd: Fd) -> io::Result<()> { backend::io::syscalls::ioctl_tiocnxcl(fd.as_fd()) } -/// `ioctl(fd, FIOCLEX)`—Set the close-on-exec flag. +/// `ioctl(fd, FIOCLEX, NULL)`—Set the close-on-exec flag. /// /// Also known as `fcntl(fd, F_SETFD, FD_CLOEXEC)`. /// /// # References -/// - [Linux] /// - [Winsock2] +/// - [NetBSD] +/// - [OpenBSD] /// -/// [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 +/// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS +/// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS #[cfg(apple)] #[inline] #[doc(alias = "FIOCLEX")] @@ -53,11 +67,13 @@ pub fn ioctl_fioclex<Fd: AsFd>(fd: Fd) -> io::Result<()> { /// `ioctl(fd, FIONBIO, &value)`—Enables or disables non-blocking mode. /// /// # References -/// - [Linux] /// - [Winsock2] +/// - [NetBSD] +/// - [OpenBSD] /// -/// [Linux]: https://man7.org/linux/man-pages/man2/ioctl.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes +/// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS +/// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS #[inline] #[doc(alias = "FIONBIO")] pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { @@ -72,9 +88,15 @@ pub fn ioctl_fionbio<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { /// # References /// - [Linux] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] /// /// [Linux]: https://man7.org/linux/man-pages/man2/ioctl_tty.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/winsock/winsock-ioctls#unix-ioctl-codes +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=ioctl&sektion=2#GENERIC%09IOCTLS +/// [NetBSD]: https://man.netbsd.org/ioctl.2#GENERIC%20IOCTLS +/// [OpenBSD]: https://man.openbsd.org/ioctl.2#GENERIC_IOCTLS #[cfg(not(target_os = "redox"))] #[inline] #[doc(alias = "FIONREAD")] @@ -83,6 +105,10 @@ pub fn ioctl_fionread<Fd: AsFd>(fd: Fd) -> io::Result<u64> { } /// `ioctl(fd, BLKSSZGET)`—Returns the logical block size of a block device. +/// +/// This is mentioned in the [Linux `openat` manual page]. +/// +/// [Linux `openat` manual page]: https://man7.org/linux/man-pages/man2/openat.2.html #[cfg(any(target_os = "android", target_os = "linux"))] #[inline] #[doc(alias = "BLKSSZGET")] diff --git a/vendor/rustix/src/io/is_read_write.rs b/vendor/rustix/src/io/is_read_write.rs index 74007e7f9..39a2a03d4 100644 --- a/vendor/rustix/src/io/is_read_write.rs +++ b/vendor/rustix/src/io/is_read_write.rs @@ -1,4 +1,6 @@ //! The [`is_read_write`] function. +//! +//! [`is_read_write`]: https://docs.rs/rustix/*/rustix/io/fn.is_read_write.html #[cfg(all(feature = "fs", feature = "net"))] use crate::{backend, io}; diff --git a/vendor/rustix/src/io/kqueue.rs b/vendor/rustix/src/io/kqueue.rs index 09fa0a4e2..55d2acabf 100644 --- a/vendor/rustix/src/io/kqueue.rs +++ b/vendor/rustix/src/io/kqueue.rs @@ -3,12 +3,9 @@ use crate::fd::{AsFd, AsRawFd, OwnedFd, RawFd}; use crate::{backend, io}; -use backend::c::{self, kevent as kevent_t, uintptr_t}; +use backend::c::{self, intptr_t, 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; @@ -25,23 +22,24 @@ 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), + let (ident, data, filter, fflags) = match filter { + EventFilter::Read(fd) => (fd.as_raw_fd() as uintptr_t, 0, c::EVFILT_READ, 0), + EventFilter::Write(fd) => (fd.as_raw_fd() as _, 0, c::EVFILT_WRITE, 0), #[cfg(target_os = "freebsd")] - EventFilter::Empty(fd) => (fd.as_raw_fd() as _, c::EVFILT_EMPTY, 0), + EventFilter::Empty(fd) => (fd.as_raw_fd() as _, 0, c::EVFILT_EMPTY, 0), EventFilter::Vnode { vnode, flags } => { - (vnode.as_raw_fd() as _, c::EVFILT_VNODE, flags.bits()) + (vnode.as_raw_fd() as _, 0, c::EVFILT_VNODE, flags.bits()) } #[cfg(feature = "process")] EventFilter::Proc { pid, flags } => ( crate::process::Pid::as_raw(Some(pid)) as _, + 0, c::EVFILT_PROC, flags.bits(), ), #[cfg(feature = "process")] - EventFilter::Signal { signal, times: _ } => (signal as _, c::EVFILT_SIGNAL, 0), - EventFilter::Timer(timer) => { + EventFilter::Signal { signal, times: _ } => (signal as _, 0, c::EVFILT_SIGNAL, 0), + EventFilter::Timer { ident, timer } => { #[cfg(any(apple, target_os = "freebsd", target_os = "netbsd"))] let (data, fflags) = match timer { Some(timer) => { @@ -53,22 +51,22 @@ impl Event { (timer.as_nanos() as _, c::NOTE_NSECONDS) } } - None => (uintptr_t::MAX, c::NOTE_SECONDS), + None => (intptr_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), + None => (intptr_t::MAX, 0), }; - (data, c::EVFILT_TIMER, fflags) + (ident as _, 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), + } => (ident as _, 0, c::EVFILT_USER, flags.bits() | user_flags.0), EventFilter::Unknown => panic!("unknown filter"), }; @@ -78,7 +76,10 @@ impl Event { filter: filter as _, flags: flags.bits() as _, fflags, - data: 0, + data: { + // On openbsd, data is an i64 and not an isize + data as _ + }, udata: { // On netbsd, udata is an isize and not a pointer. // TODO: Strict provenance, prevent int-to-ptr cast. @@ -123,21 +124,24 @@ impl Event { 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 + c::EVFILT_TIMER => EventFilter::Timer { + ident: self.inner.ident as _, + 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(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 _, @@ -198,7 +202,13 @@ pub enum EventFilter { }, /// A timer filter. - Timer(Option<Duration>), + Timer { + /// The identifier for this event. + ident: intptr_t, + + /// The duration for this event. + timer: Option<Duration>, + }, /// A user filter. #[cfg(any(apple, freebsdlike))] @@ -292,7 +302,7 @@ bitflags::bitflags! { /// The process executed a new process. const EXEC = c::NOTE_EXEC; - /// Follow the process through fork() calls (write only). + /// Follow the process through `fork()` calls (write only). const TRACK = c::NOTE_TRACK; /// An error has occurred with following the process. @@ -307,13 +317,13 @@ bitflags::bitflags! { /// Ignore the user input flags. const NOINPUT = c::NOTE_FFNOP; - /// Bitwise AND fflags. + /// Bitwise AND `fflags`. const AND = c::NOTE_FFAND; - /// Bitwise OR fflags. + /// Bitwise OR `fflags`. const OR = c::NOTE_FFOR; - /// Copy fflags. + /// Copy `fflags`. const COPY = c::NOTE_FFCOPY; /// Control mask for operations. @@ -355,13 +365,13 @@ impl UserDefinedFlags { /// - [FreeBSD] /// - [OpenBSD] /// - [NetBSD] -/// - [DragonflyBSD] +/// - [DragonFly BSD] /// /// [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 +/// [FreeBSD]: https://man.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 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=kqueue§ion=2 pub fn kqueue() -> io::Result<OwnedFd> { syscalls::kqueue() } @@ -382,13 +392,13 @@ pub fn kqueue() -> io::Result<OwnedFd> { /// - [FreeBSD] /// - [OpenBSD] /// - [NetBSD] -/// - [DragonflyBSD] +/// - [DragonFly BSD] /// /// [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 +/// [FreeBSD]: https://man.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 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=kevent§ion=2 pub unsafe fn kevent( kqueue: impl AsFd, changelist: &[Event], diff --git a/vendor/rustix/src/io/mod.rs b/vendor/rustix/src/io/mod.rs index 4e9b3e23a..1fe302a6e 100644 --- a/vendor/rustix/src/io/mod.rs +++ b/vendor/rustix/src/io/mod.rs @@ -4,7 +4,12 @@ mod close; #[cfg(not(windows))] mod dup; mod errno; -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any( + target_os = "android", + target_os = "freebsd", + target_os = "illumos", + target_os = "linux" +))] mod eventfd; #[cfg(not(windows))] mod fcntl; @@ -34,7 +39,12 @@ pub use close::close; #[cfg(not(windows))] pub use dup::*; pub use errno::{retry_on_intr, Errno, Result}; -#[cfg(any(target_os = "android", target_os = "linux"))] +#[cfg(any( + target_os = "android", + target_os = "freebsd", + target_os = "illumos", + target_os = "linux" +))] pub use eventfd::{eventfd, EventfdFlags}; #[cfg(not(windows))] pub use fcntl::*; diff --git a/vendor/rustix/src/io/pipe.rs b/vendor/rustix/src/io/pipe.rs index 9d4b081c5..40acc814d 100644 --- a/vendor/rustix/src/io/pipe.rs +++ b/vendor/rustix/src/io/pipe.rs @@ -42,9 +42,23 @@ pub const PIPE_BUF: usize = backend::io::types::PIPE_BUF; /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pipe.html /// [Linux]: https://man7.org/linux/man-pages/man2/pipe.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pipe.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pipe&sektion=2 +/// [NetBSD]: https://man.netbsd.org/pipe.2 +/// [OpenBSD]: https://man.openbsd.org/pipe.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pipe§ion=2 +/// [illumos]: https://illumos.org/man/2/pipe +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Pipe.html #[inline] pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { backend::io::syscalls::pipe() @@ -57,8 +71,18 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> { /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/pipe2.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pipe2&sektion=2 +/// [NetBSD]: https://man.netbsd.org/pipe2.2 +/// [OpenBSD]: https://man.openbsd.org/pipe2.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pipe2§ion=2 +/// [illumos]: https://illumos.org/man/2/pipe2 #[cfg(not(any(apple, target_os = "aix", target_os = "haiku")))] #[inline] #[doc(alias = "pipe2")] diff --git a/vendor/rustix/src/io/poll.rs b/vendor/rustix/src/io/poll.rs index 01f625af2..3f25d5ec3 100644 --- a/vendor/rustix/src/io/poll.rs +++ b/vendor/rustix/src/io/poll.rs @@ -5,15 +5,27 @@ pub use backend::io::poll_fd::{PollFd, PollFlags}; /// `poll(self.fds, timeout)` /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/slightly-advanced-techniques.html#poll /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html /// [Linux]: https://man7.org/linux/man-pages/man2/poll.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/poll.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=poll&sektion=2 +/// [NetBSD]: https://man.netbsd.org/poll.2 +/// [OpenBSD]: https://man.openbsd.org/poll.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=poll§ion=2 +/// [illumos]: https://illumos.org/man/2/poll #[inline] pub fn poll(fds: &mut [PollFd<'_>], timeout: i32) -> io::Result<usize> { backend::io::syscalls::poll(fds, timeout) diff --git a/vendor/rustix/src/io/procfs.rs b/vendor/rustix/src/io/procfs.rs index c6eeb08e0..605354759 100644 --- a/vendor/rustix/src/io/procfs.rs +++ b/vendor/rustix/src/io/procfs.rs @@ -181,10 +181,10 @@ fn check_procfs(file: BorrowedFd<'_>) -> io::Result<()> { Ok(()) } -/// Check whether the given directory handle is a mount point. We use a -/// `renameat` call that would otherwise fail, but which fails with `EXDEV` -/// first if it would cross a mount point. +/// Check whether the given directory handle is a mount point. fn is_mountpoint(file: BorrowedFd<'_>) -> bool { + // We use a `renameat` call that would otherwise fail, but which fails with + // `XDEV` first if it would cross a mount point. let err = renameat(file, cstr!("../."), file, cstr!(".")).unwrap_err(); match err { io::Errno::XDEV => true, // the rename failed due to crossing a mount point diff --git a/vendor/rustix/src/io/read_write.rs b/vendor/rustix/src/io/read_write.rs index d89ce7c7d..918bb9323 100644 --- a/vendor/rustix/src/io/read_write.rs +++ b/vendor/rustix/src/io/read_write.rs @@ -20,10 +20,22 @@ pub use backend::io::types::ReadWriteFlags; /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/read.html /// [Linux]: https://man7.org/linux/man-pages/man2/read.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/read.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=read&sektion=2 +/// [NetBSD]: https://man.netbsd.org/read.2 +/// [OpenBSD]: https://man.openbsd.org/read.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=read§ion=2 +/// [illumos]: https://illumos.org/man/2/read +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/I_002fO-Primitives.html#index-reading-from-a-file-descriptor #[inline] pub fn read<Fd: AsFd>(fd: Fd, buf: &mut [u8]) -> io::Result<usize> { backend::io::syscalls::read(fd.as_fd(), buf) @@ -35,10 +47,22 @@ pub fn read<Fd: AsFd>(fd: Fd, buf: &mut [u8]) -> io::Result<usize> { /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/write.html /// [Linux]: https://man7.org/linux/man-pages/man2/write.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/write.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=write&sektion=2 +/// [NetBSD]: https://man.netbsd.org/write.2 +/// [OpenBSD]: https://man.openbsd.org/write.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=write§ion=2 +/// [illumos]: https://illumos.org/man/2/write +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/I_002fO-Primitives.html#index-writing-to-a-file-descriptor #[inline] pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> { backend::io::syscalls::write(fd.as_fd(), buf) @@ -50,10 +74,20 @@ pub fn write<Fd: AsFd>(fd: Fd, buf: &[u8]) -> io::Result<usize> { /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pread.html /// [Linux]: https://man7.org/linux/man-pages/man2/pread.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pread.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pread&sektion=2 +/// [NetBSD]: https://man.netbsd.org/pread.2 +/// [OpenBSD]: https://man.openbsd.org/pread.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pread§ion=2 +/// [illumos]: https://illumos.org/man/2/pread #[inline] pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize> { backend::io::syscalls::pread(fd.as_fd(), buf, offset) @@ -69,10 +103,20 @@ pub fn pread<Fd: AsFd>(fd: Fd, buf: &mut [u8], offset: u64) -> io::Result<usize> /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pwrite.html /// [Linux]: https://man7.org/linux/man-pages/man2/pwrite.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/pwrite.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pwrite&sektion=2 +/// [NetBSD]: https://man.netbsd.org/pwrite.2 +/// [OpenBSD]: https://man.openbsd.org/pwrite.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pwrite§ion=2 +/// [illumos]: https://illumos.org/man/2/pwrite #[inline] pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: u64) -> io::Result<usize> { backend::io::syscalls::pwrite(fd.as_fd(), buf, offset) @@ -84,10 +128,20 @@ pub fn pwrite<Fd: AsFd>(fd: Fd, buf: &[u8], offset: u64) -> io::Result<usize> { /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/readv.html /// [Linux]: https://man7.org/linux/man-pages/man2/readv.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/readv.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=readv&sektion=2 +/// [NetBSD]: https://man.netbsd.org/readv.2 +/// [OpenBSD]: https://man.openbsd.org/readv.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=readv§ion=2 +/// [illumos]: https://illumos.org/man/2/readv #[inline] pub fn readv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> { backend::io::syscalls::readv(fd.as_fd(), bufs) @@ -99,10 +153,20 @@ pub fn readv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>]) -> io::Result<usize> /// - [POSIX] /// - [Linux] /// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/writev.html /// [Linux]: https://man7.org/linux/man-pages/man2/writev.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/writev.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=writev&sektion=2 +/// [NetBSD]: https://man.netbsd.org/writev.2 +/// [OpenBSD]: https://man.openbsd.org/writev.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=writev§ion=2 +/// [illumos]: https://illumos.org/man/2/writev #[inline] pub fn writev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result<usize> { backend::io::syscalls::writev(fd.as_fd(), bufs) @@ -113,8 +177,18 @@ pub fn writev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>]) -> io::Result<usize> { /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/preadv.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=preadv&sektion=2 +/// [NetBSD]: https://man.netbsd.org/preadv.2 +/// [OpenBSD]: https://man.openbsd.org/preadv.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=preadv§ion=2 +/// [illumos]: https://illumos.org/man/2/preadv #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] #[inline] pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io::Result<usize> { @@ -130,8 +204,18 @@ pub fn preadv<Fd: AsFd>(fd: Fd, bufs: &mut [IoSliceMut<'_>], offset: u64) -> io: /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/pwritev.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=pwritev&sektion=2 +/// [NetBSD]: https://man.netbsd.org/pwritev.2 +/// [OpenBSD]: https://man.openbsd.org/pwritev.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=pwritev§ion=2 +/// [illumos]: https://illumos.org/man/2/pwritev #[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "solaris")))] #[inline] pub fn pwritev<Fd: AsFd>(fd: Fd, bufs: &[IoSlice<'_>], offset: u64) -> io::Result<usize> { diff --git a/vendor/rustix/src/io/stdio.rs b/vendor/rustix/src/io/stdio.rs index 15af6b005..adfb776d5 100644 --- a/vendor/rustix/src/io/stdio.rs +++ b/vendor/rustix/src/io/stdio.rs @@ -32,9 +32,21 @@ use backend::fd::AsFd; /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdin.4 +/// [OpenBSD]: https://man.openbsd.org/stdin.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdin +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin #[cfg(feature = "std")] #[doc(alias = "STDIN_FILENO")] #[inline] @@ -66,9 +78,21 @@ pub const fn stdin() -> BorrowedFd<'static> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdin.4 +/// [OpenBSD]: https://man.openbsd.org/stdin.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdin +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin #[cfg(not(feature = "std"))] #[doc(alias = "STDIN_FILENO")] #[inline] @@ -94,9 +118,21 @@ pub const unsafe fn stdin() -> BorrowedFd<'static> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdin.4 +/// [OpenBSD]: https://man.openbsd.org/stdin.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdin +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin #[doc(alias = "STDIN_FILENO")] #[inline] pub unsafe fn take_stdin() -> OwnedFd { @@ -118,9 +154,21 @@ pub unsafe fn take_stdin() -> OwnedFd { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdout.4 +/// [OpenBSD]: https://man.openbsd.org/stdout.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdout +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout #[cfg(feature = "std")] #[doc(alias = "STDOUT_FILENO")] #[inline] @@ -133,7 +181,7 @@ pub const fn stdout() -> BorrowedFd<'static> { /// `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 +/// standard library already assumes that the stdout file descriptor is always /// valid. In `no_std` configurations, it is `unsafe`. /// /// # Safety @@ -152,9 +200,21 @@ pub const fn stdout() -> BorrowedFd<'static> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdout.4 +/// [OpenBSD]: https://man.openbsd.org/stdout.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdout +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout #[cfg(not(feature = "std"))] #[doc(alias = "STDOUT_FILENO")] #[inline] @@ -180,9 +240,21 @@ pub const unsafe fn stdout() -> BorrowedFd<'static> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdout.4 +/// [OpenBSD]: https://man.openbsd.org/stdout.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdout +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout #[doc(alias = "STDOUT_FILENO")] #[inline] pub unsafe fn take_stdout() -> OwnedFd { @@ -198,9 +270,21 @@ pub unsafe fn take_stdout() -> OwnedFd { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html /// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stderr.4 +/// [OpenBSD]: https://man.openbsd.org/stderr.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stderr +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr #[cfg(feature = "std")] #[doc(alias = "STDERR_FILENO")] #[inline] @@ -226,9 +310,21 @@ pub const fn stderr() -> BorrowedFd<'static> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html /// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stderr.4 +/// [OpenBSD]: https://man.openbsd.org/stderr.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stderr +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr #[cfg(not(feature = "std"))] #[doc(alias = "STDERR_FILENO")] #[inline] @@ -238,7 +334,7 @@ pub const unsafe fn stderr() -> BorrowedFd<'static> { /// `STDERR_FILENO`—Standard error, owned. /// -/// This is similar to [`stdout`], however it returns an `OwnedFd` which closes +/// This is similar to [`stderr`], however it returns an `OwnedFd` which closes /// standard output when it is dropped. /// /// # Safety @@ -259,9 +355,21 @@ pub const unsafe fn stderr() -> BorrowedFd<'static> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html /// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stderr.4 +/// [OpenBSD]: https://man.openbsd.org/stderr.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stderr +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr #[doc(alias = "STDERR_FILENO")] #[inline] pub unsafe fn take_stderr() -> OwnedFd { @@ -279,9 +387,21 @@ pub unsafe fn take_stderr() -> OwnedFd { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdin.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdin&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdin.4 +/// [OpenBSD]: https://man.openbsd.org/stdin.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdin§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdin +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdin #[doc(alias = "STDIN_FILENO")] #[inline] pub const fn raw_stdin() -> RawFd { @@ -299,9 +419,21 @@ pub const fn raw_stdin() -> RawFd { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stdout.html /// [Linux]: https://man7.org/linux/man-pages/man3/stdout.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stdout&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stdout.4 +/// [OpenBSD]: https://man.openbsd.org/stdout.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stdout§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stdout +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stdout #[doc(alias = "STDOUT_FILENO")] #[inline] pub const fn raw_stdout() -> RawFd { @@ -319,9 +451,21 @@ pub const fn raw_stdout() -> RawFd { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/stderr.html /// [Linux]: https://man7.org/linux/man-pages/man3/stderr.3.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=stderr&sektion=4 +/// [NetBSD]: https://man.netbsd.org/stderr.4 +/// [OpenBSD]: https://man.openbsd.org/stderr.4 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=stderr§ion=4 +/// [illumos]: https://illumos.org/man/4FS/stderr +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html#index-stderr #[doc(alias = "STDERR_FILENO")] #[inline] pub const fn raw_stderr() -> RawFd { diff --git a/vendor/rustix/src/io_uring.rs b/vendor/rustix/src/io_uring.rs index 0a7dc0872..b94b458f5 100644 --- a/vendor/rustix/src/io_uring.rs +++ b/vendor/rustix/src/io_uring.rs @@ -978,7 +978,7 @@ pub union op_flags_union { #[doc(alias = "msg_flags")] pub recv_flags: crate::net::RecvFlags, pub timeout_flags: IoringTimeoutFlags, - pub accept_flags: crate::net::AcceptFlags, + pub accept_flags: crate::net::SocketFlags, pub cancel_flags: IoringAsyncCancelFlags, pub open_flags: crate::fs::OFlags, pub statx_flags: crate::fs::AtFlags, diff --git a/vendor/rustix/src/lib.rs b/vendor/rustix/src/lib.rs index 9e62b1594..f0e093585 100644 --- a/vendor/rustix/src/lib.rs +++ b/vendor/rustix/src/lib.rs @@ -97,7 +97,7 @@ #![cfg_attr(linux_raw, deny(unsafe_code))] #![cfg_attr(rustc_attrs, feature(rustc_attrs))] #![cfg_attr(doc_cfg, feature(doc_cfg))] -#![cfg_attr(all(target_os = "wasi", feature = "std"), feature(wasi_ext))] +#![cfg_attr(all(wasi_ext, target_os = "wasi", feature = "std"), feature(wasi_ext))] #![cfg_attr( all(linux_raw, naked_functions, target_arch = "x86"), feature(naked_functions) @@ -122,6 +122,9 @@ #![allow(clippy::unnecessary_cast)] // It is common in linux and libc APIs for types to vary between platforms. #![allow(clippy::useless_conversion)] +// Redox and WASI have enough differences that it isn't worth +// precisely conditionallizing all the `use`s for them. +#![cfg_attr(any(target_os = "redox", target_os = "wasi"), allow(unused_imports))] #[cfg(not(feature = "rustc-dep-of-std"))] extern crate alloc; @@ -134,6 +137,18 @@ pub(crate) mod cstr; pub(crate) mod const_assert; pub(crate) mod utils; +// linux_raw: Weak symbols are used by the use-libc-auxv feature for +// glibc 2.15 support. +// +// libc: Weak symbols are used to call various functions available in some +// versions of libc and not others. +#[cfg(any( + all(linux_raw, feature = "use-libc-auxv"), + all(libc, not(any(windows, target_os = "wasi"))) +))] +#[macro_use] +mod weak; + // Pick the backend implementation to use. #[cfg_attr(libc, path = "backend/libc/mod.rs")] #[cfg_attr(linux_raw, path = "backend/linux_raw/mod.rs")] diff --git a/vendor/rustix/src/mm/madvise.rs b/vendor/rustix/src/mm/madvise.rs index cf13f951b..868a31a5e 100644 --- a/vendor/rustix/src/mm/madvise.rs +++ b/vendor/rustix/src/mm/madvise.rs @@ -24,10 +24,24 @@ pub use backend::mm::types::Advice; /// - [POSIX] /// - [Linux `madvise`] /// - [Linux `posix_madvise`] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_madvise.html /// [Linux `madvise`]: https://man7.org/linux/man-pages/man2/madvise.2.html /// [Linux `posix_madvise`]: https://man7.org/linux/man-pages/man3/posix_madvise.3.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/madvise.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=madvise&sektion=2 +/// [NetBSD]: https://man.netbsd.org/madvise.2 +/// [OpenBSD]: https://man.openbsd.org/madvise.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=madvise§ion=2 +/// [illumos]: https://illumos.org/man/3C/madvise +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-madvise #[inline] #[doc(alias = "posix_madvise")] pub unsafe fn madvise(addr: *mut c_void, len: usize, advice: Advice) -> io::Result<()> { diff --git a/vendor/rustix/src/mm/mmap.rs b/vendor/rustix/src/mm/mmap.rs index 715c662ec..8d4b7e23b 100644 --- a/vendor/rustix/src/mm/mmap.rs +++ b/vendor/rustix/src/mm/mmap.rs @@ -29,9 +29,23 @@ pub use backend::mm::types::{MapFlags, MprotectFlags, ProtFlags}; /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html /// [Linux]: https://man7.org/linux/man-pages/man2/mmap.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mmap.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mmap&sektion=2 +/// [NetBSD]: https://man.netbsd.org/mmap.2 +/// [OpenBSD]: https://man.openbsd.org/mmap.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mmap§ion=2 +/// [illumos]: https://illumos.org/man/2/mmap +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-mmap #[inline] pub unsafe fn mmap<Fd: AsFd>( ptr: *mut c_void, @@ -56,9 +70,23 @@ pub unsafe fn mmap<Fd: AsFd>( /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html /// [Linux]: https://man7.org/linux/man-pages/man2/mmap.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mmap.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mmap&sektion=2 +/// [NetBSD]: https://man.netbsd.org/mmap.2 +/// [OpenBSD]: https://man.openbsd.org/mmap.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mmap§ion=2 +/// [illumos]: https://illumos.org/man/2/mmap +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-mmap #[inline] #[doc(alias = "mmap")] pub unsafe fn mmap_anonymous( @@ -70,7 +98,7 @@ pub unsafe fn mmap_anonymous( backend::mm::syscalls::mmap_anonymous(ptr, len, prot, flags) } -/// `munmap(ptr, len)` +/// `munmap(ptr, len)`—Remove a memory mapping. /// /// # Safety /// @@ -79,9 +107,23 @@ pub unsafe fn mmap_anonymous( /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/munmap.html /// [Linux]: https://man7.org/linux/man-pages/man2/munmap.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/munmap.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=munmap&sektion=2 +/// [NetBSD]: https://man.netbsd.org/munmap.2 +/// [OpenBSD]: https://man.openbsd.org/munmap.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=munmap§ion=2 +/// [illumos]: https://illumos.org/man/2/munmap +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-munmap #[inline] pub unsafe fn munmap(ptr: *mut c_void, len: usize) -> io::Result<()> { backend::mm::syscalls::munmap(ptr, len) @@ -139,7 +181,8 @@ pub unsafe fn mremap_fixed( backend::mm::syscalls::mremap_fixed(old_address, old_size, new_size, flags, new_address) } -/// `mprotect(ptr, len, flags)` +/// `mprotect(ptr, len, flags)`—Change the protection flags of a region of +/// memory. /// /// # Safety /// @@ -148,9 +191,21 @@ pub unsafe fn mremap_fixed( /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mprotect.html /// [Linux]: https://man7.org/linux/man-pages/man2/mprotect.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mprotect.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mprotect&sektion=2 +/// [NetBSD]: https://man.netbsd.org/mprotect.2 +/// [OpenBSD]: https://man.openbsd.org/mprotect.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mprotect§ion=2 +/// [illumos]: https://illumos.org/man/2/mprotect #[inline] pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io::Result<()> { backend::mm::syscalls::mprotect(ptr, len, flags) @@ -172,16 +227,29 @@ pub unsafe fn mprotect(ptr: *mut c_void, len: usize, flags: MprotectFlags) -> io /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mlock.html /// [Linux]: https://man7.org/linux/man-pages/man2/mlock.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/mlock.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=mlock&sektion=2 +/// [NetBSD]: https://man.netbsd.org/mlock.2 +/// [OpenBSD]: https://man.openbsd.org/mlock.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=mlock§ion=2 +/// [illumos]: https://illumos.org/man/3C/mlock +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Page-Lock-Functions.html#index-mlock #[inline] pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> io::Result<()> { backend::mm::syscalls::mlock(ptr, len) } -/// `mlock2(ptr, len, flags)`—Lock memory into RAM, with -/// flags. +/// `mlock2(ptr, len, flags)`—Lock memory into RAM, with flags. /// /// `mlock_with` is the same as [`mlock`] but adds an additional flags operand. /// @@ -198,8 +266,10 @@ pub unsafe fn mlock(ptr: *mut c_void, len: usize) -> io::Result<()> { /// /// # References /// - [Linux] +/// - [glibc] /// /// [Linux]: https://man7.org/linux/man-pages/man2/mlock2.2.html +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Page-Lock-Functions.html#index-mlock2 #[cfg(any(target_os = "android", target_os = "linux"))] #[inline] #[doc(alias = "mlock2")] @@ -222,9 +292,23 @@ pub unsafe fn mlock_with(ptr: *mut c_void, len: usize, flags: MlockFlags) -> io: /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/munlock.html /// [Linux]: https://man7.org/linux/man-pages/man2/munlock.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/munlock.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=munlock&sektion=2 +/// [NetBSD]: https://man.netbsd.org/munlock.2 +/// [OpenBSD]: https://man.openbsd.org/munlock.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=munlock§ion=2 +/// [illumos]: https://illumos.org/man/3C/munlock +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Page-Lock-Functions.html#index-munlock #[inline] pub unsafe fn munlock(ptr: *mut c_void, len: usize) -> io::Result<()> { backend::mm::syscalls::munlock(ptr, len) diff --git a/vendor/rustix/src/mm/msync.rs b/vendor/rustix/src/mm/msync.rs index 3ca418fc4..0306e36b9 100644 --- a/vendor/rustix/src/mm/msync.rs +++ b/vendor/rustix/src/mm/msync.rs @@ -22,10 +22,24 @@ pub use backend::mm::types::MsyncFlags; /// /// # References /// - [POSIX] -/// - [Linux `msync`] +/// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/msync.html -/// [Linux `msync`]: https://man7.org/linux/man-pages/man2/msync.2.html +/// [Linux]: https://man7.org/linux/man-pages/man2/msync.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/msync.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=msync&sektion=2 +/// [NetBSD]: https://man.netbsd.org/msync.2 +/// [OpenBSD]: https://man.openbsd.org/msync.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=msync§ion=2 +/// [illumos]: https://illumos.org/man/3C/msync +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Memory_002dmapped-I_002fO.html#index-msync #[inline] pub unsafe fn msync(addr: *mut c_void, len: usize, flags: MsyncFlags) -> io::Result<()> { backend::mm::syscalls::msync(addr, len, flags) diff --git a/vendor/rustix/src/net/send_recv.rs b/vendor/rustix/src/net/send_recv.rs index 041077266..439711727 100644 --- a/vendor/rustix/src/net/send_recv.rs +++ b/vendor/rustix/src/net/send_recv.rs @@ -11,15 +11,29 @@ pub use backend::net::send_recv::{RecvFlags, SendFlags}; /// `recv(fd, buf, flags)`—Reads data from a socket. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendrecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html /// [Linux]: https://man7.org/linux/man-pages/man2/recv.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/recv.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=recv&sektion=2 +/// [NetBSD]: https://man.netbsd.org/recv.2 +/// [OpenBSD]: https://man.openbsd.org/recv.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=recv§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/recv +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Receiving-Data.html #[inline] pub fn recv<Fd: AsFd>(fd: Fd, buf: &mut [u8], flags: RecvFlags) -> io::Result<usize> { backend::net::syscalls::recv(fd.as_fd(), buf, flags) @@ -28,15 +42,29 @@ pub fn recv<Fd: AsFd>(fd: Fd, buf: &mut [u8], flags: RecvFlags) -> io::Result<us /// `send(fd, buf, flags)`—Writes data to a socket. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendrecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html /// [Linux]: https://man7.org/linux/man-pages/man2/send.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/send.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=send&sektion=2 +/// [NetBSD]: https://man.netbsd.org/send.2 +/// [OpenBSD]: https://man.openbsd.org/send.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=send§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/send +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Data.html #[inline] pub fn send<Fd: AsFd>(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result<usize> { backend::net::syscalls::send(fd.as_fd(), buf, flags) @@ -46,15 +74,29 @@ pub fn send<Fd: AsFd>(fd: Fd, buf: &[u8], flags: SendFlags) -> io::Result<usize> /// returns the sender address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html /// [Linux]: https://man7.org/linux/man-pages/man2/recvfrom.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/recvfrom.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recvfrom +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=recvfrom&sektion=2 +/// [NetBSD]: https://man.netbsd.org/recvfrom.2 +/// [OpenBSD]: https://man.openbsd.org/recvfrom.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=recvfrom§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/recvfrom +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Receiving-Datagrams.html #[inline] pub fn recvfrom<Fd: AsFd>( fd: Fd, @@ -68,15 +110,29 @@ pub fn recvfrom<Fd: AsFd>( /// address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 +/// [NetBSD]: https://man.netbsd.org/sendto.2 +/// [OpenBSD]: https://man.openbsd.org/sendto.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/sendto +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html pub fn sendto<Fd: AsFd>( fd: Fd, buf: &[u8], @@ -102,15 +158,29 @@ fn _sendto( /// address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 +/// [NetBSD]: https://man.netbsd.org/sendto.2 +/// [OpenBSD]: https://man.openbsd.org/sendto.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/sendto +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html pub fn sendto_any<Fd: AsFd>( fd: Fd, buf: &[u8], @@ -138,15 +208,29 @@ fn _sendto_any( /// a socket to a specific IPv4 address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 +/// [NetBSD]: https://man.netbsd.org/sendto.2 +/// [OpenBSD]: https://man.openbsd.org/sendto.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/sendto +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html #[inline] #[doc(alias = "sendto")] pub fn sendto_v4<Fd: AsFd>( @@ -162,15 +246,29 @@ pub fn sendto_v4<Fd: AsFd>( /// to a socket to a specific IPv6 address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 +/// [NetBSD]: https://man.netbsd.org/sendto.2 +/// [OpenBSD]: https://man.openbsd.org/sendto.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/sendto +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html #[inline] #[doc(alias = "sendto")] pub fn sendto_v6<Fd: AsFd>( @@ -186,15 +284,29 @@ pub fn sendto_v6<Fd: AsFd>( /// a socket to a specific Unix-domain socket address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#sendtorecv /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html /// [Linux]: https://man7.org/linux/man-pages/man2/sendto.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sendto.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-sendto +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=sendto&sektion=2 +/// [NetBSD]: https://man.netbsd.org/sendto.2 +/// [OpenBSD]: https://man.openbsd.org/sendto.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=sendto§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/sendto +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Sending-Datagrams.html #[cfg(unix)] #[inline] #[doc(alias = "sendto")] diff --git a/vendor/rustix/src/net/socket.rs b/vendor/rustix/src/net/socket.rs index 5840d39ff..dbfb391ba 100644 --- a/vendor/rustix/src/net/socket.rs +++ b/vendor/rustix/src/net/socket.rs @@ -5,9 +5,10 @@ use backend::fd::{AsFd, BorrowedFd}; #[cfg(unix)] pub use backend::net::addr::SocketAddrUnix; -pub use backend::net::types::{ - AcceptFlags, AddressFamily, Protocol, Shutdown, SocketFlags, SocketType, -}; +pub use backend::net::types::{AddressFamily, Protocol, Shutdown, SocketFlags, SocketType}; + +/// Compatibility alias for `SocketFlags`. Use `SocketFlags` instead of this. +pub type AcceptFlags = SocketFlags; impl Default for Protocol { #[inline] @@ -25,15 +26,29 @@ impl Default for Protocol { /// To pass extra flags such as [`SocketFlags::CLOEXEC`], use [`socket_with`]. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#socket /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html /// [Linux]: https://man7.org/linux/man-pages/man2/socket.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socket.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2 +/// [NetBSD]: https://man.netbsd.org/socket.2 +/// [OpenBSD]: https://man.openbsd.org/socket.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socket§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/socket +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Socket.html #[inline] pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> io::Result<OwnedFd> { backend::net::syscalls::socket(domain, type_, protocol) @@ -50,15 +65,29 @@ pub fn socket(domain: AddressFamily, type_: SocketType, protocol: Protocol) -> i /// operand. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#socket /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html /// [Linux]: https://man7.org/linux/man-pages/man2/socket.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socket.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-socket +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2 +/// [NetBSD]: https://man.netbsd.org/socket.2 +/// [OpenBSD]: https://man.openbsd.org/socket.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socket§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/socket +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Creating-a-Socket.html #[inline] pub fn socket_with( domain: AddressFamily, @@ -72,15 +101,29 @@ pub fn socket_with( /// `bind(sockfd, addr)`—Binds a socket to an IP address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 +/// [NetBSD]: https://man.netbsd.org/bind.2 +/// [OpenBSD]: https://man.openbsd.org/bind.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/bind +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html pub fn bind<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> { _bind(sockfd.as_fd(), addr) } @@ -95,15 +138,29 @@ fn _bind(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> { /// `bind(sockfd, addr)`—Binds a socket to an address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 +/// [NetBSD]: https://man.netbsd.org/bind.2 +/// [OpenBSD]: https://man.openbsd.org/bind.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/bind +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html #[doc(alias = "bind")] pub fn bind_any<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrAny) -> io::Result<()> { _bind_any(sockfd.as_fd(), addr) @@ -122,15 +179,29 @@ fn _bind_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> { /// IPv4 address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 +/// [NetBSD]: https://man.netbsd.org/bind.2 +/// [OpenBSD]: https://man.openbsd.org/bind.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/bind +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html #[inline] #[doc(alias = "bind")] pub fn bind_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { @@ -141,15 +212,29 @@ pub fn bind_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { /// IPv6 address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 +/// [NetBSD]: https://man.netbsd.org/bind.2 +/// [OpenBSD]: https://man.openbsd.org/bind.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/bind +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html #[inline] #[doc(alias = "bind")] pub fn bind_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { @@ -160,15 +245,29 @@ pub fn bind_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { /// Unix-domain address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#bind /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html /// [Linux]: https://man7.org/linux/man-pages/man2/bind.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/bind.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-bind +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=bind&sektion=2 +/// [NetBSD]: https://man.netbsd.org/bind.2 +/// [OpenBSD]: https://man.openbsd.org/bind.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=bind§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/bind +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Setting-Address.html #[cfg(unix)] #[inline] #[doc(alias = "bind")] @@ -179,15 +278,29 @@ pub fn bind_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<()> /// `connect(sockfd, addr)`—Initiates a connection to an IP address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 +/// [NetBSD]: https://man.netbsd.org/connect.2 +/// [OpenBSD]: https://man.openbsd.org/connect.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/connect +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html pub fn connect<Fd: AsFd>(sockfd: Fd, addr: &SocketAddr) -> io::Result<()> { _connect(sockfd.as_fd(), addr) } @@ -202,15 +315,29 @@ fn _connect(sockfd: BorrowedFd<'_>, addr: &SocketAddr) -> io::Result<()> { /// `connect(sockfd, addr)`—Initiates a connection. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 +/// [NetBSD]: https://man.netbsd.org/connect.2 +/// [OpenBSD]: https://man.openbsd.org/connect.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/connect +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html #[doc(alias = "connect")] pub fn connect_any<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrAny) -> io::Result<()> { _connect_any(sockfd.as_fd(), addr) @@ -229,15 +356,29 @@ fn _connect_any(sockfd: BorrowedFd<'_>, addr: &SocketAddrAny) -> io::Result<()> /// connection to an IPv4 address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 +/// [NetBSD]: https://man.netbsd.org/connect.2 +/// [OpenBSD]: https://man.openbsd.org/connect.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/connect +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html #[inline] #[doc(alias = "connect")] pub fn connect_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { @@ -248,15 +389,29 @@ pub fn connect_v4<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV4) -> io::Result<()> { /// connection to an IPv6 address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 +/// [NetBSD]: https://man.netbsd.org/connect.2 +/// [OpenBSD]: https://man.openbsd.org/connect.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/connect +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html #[inline] #[doc(alias = "connect")] pub fn connect_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { @@ -267,15 +422,29 @@ pub fn connect_v6<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrV6) -> io::Result<()> { /// connection to a Unix-domain address. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#connect /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html /// [Linux]: https://man7.org/linux/man-pages/man2/connect.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/connect.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-connect +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=connect&sektion=2 +/// [NetBSD]: https://man.netbsd.org/connect.2 +/// [OpenBSD]: https://man.openbsd.org/connect.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=connect§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/connect +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Connecting.html #[cfg(unix)] #[inline] #[doc(alias = "connect")] @@ -286,15 +455,29 @@ pub fn connect_unix<Fd: AsFd>(sockfd: Fd, addr: &SocketAddrUnix) -> io::Result<( /// `listen(fd, backlog)`—Enables listening for incoming connections. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#listen /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html /// [Linux]: https://man7.org/linux/man-pages/man2/listen.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/listen.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-listen +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=listen&sektion=2 +/// [NetBSD]: https://man.netbsd.org/listen.2 +/// [OpenBSD]: https://man.openbsd.org/listen.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=listen§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/listen +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Listening.html #[inline] pub fn listen<Fd: AsFd>(sockfd: Fd, backlog: i32) -> io::Result<()> { backend::net::syscalls::listen(sockfd.as_fd(), backlog) @@ -309,17 +492,30 @@ pub fn listen<Fd: AsFd>(sockfd: Fd, backlog: i32) -> io::Result<()> { /// be unexpectedly allocated on other threads or in libraries. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#acceptthank-you-for-calling-port-3490. /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html /// [Linux]: https://man7.org/linux/man-pages/man2/accept.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/accept.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2 +/// [NetBSD]: https://man.netbsd.org/accept.2 +/// [OpenBSD]: https://man.openbsd.org/accept.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/accept +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Accepting-Connections.html #[inline] -#[doc(alias = "accept4")] pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> { backend::net::syscalls::accept(sockfd.as_fd()) } @@ -338,11 +534,21 @@ pub fn accept<Fd: AsFd>(sockfd: Fd) -> io::Result<OwnedFd> { /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/accept4.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept4&sektion=2 +/// [NetBSD]: https://man.netbsd.org/accept4.2 +/// [OpenBSD]: https://man.openbsd.org/accept4.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept4§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/accept4 #[inline] #[doc(alias = "accept4")] -pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<OwnedFd> { +pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: SocketFlags) -> io::Result<OwnedFd> { backend::net::syscalls::accept_with(sockfd.as_fd(), flags) } @@ -352,17 +558,31 @@ pub fn accept_with<Fd: AsFd>(sockfd: Fd, flags: AcceptFlags) -> io::Result<Owned /// Use [`accept`] if the peer address isn't needed. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#acceptthank-you-for-calling-port-3490. /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html /// [Linux]: https://man7.org/linux/man-pages/man2/accept.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/accept.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-accept +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept&sektion=2 +/// [NetBSD]: https://man.netbsd.org/accept.2 +/// [OpenBSD]: https://man.openbsd.org/accept.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/accept +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Accepting-Connections.html #[inline] -#[doc(alias = "accept4")] +#[doc(alias = "accept")] pub fn acceptfrom<Fd: AsFd>(sockfd: Fd) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { backend::net::syscalls::acceptfrom(sockfd.as_fd()) } @@ -377,13 +597,23 @@ pub fn acceptfrom<Fd: AsFd>(sockfd: Fd) -> io::Result<(OwnedFd, Option<SocketAdd /// /// # References /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [Linux]: https://man7.org/linux/man-pages/man2/accept4.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=accept4&sektion=2 +/// [NetBSD]: https://man.netbsd.org/accept4.2 +/// [OpenBSD]: https://man.openbsd.org/accept4.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=accept4§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/accept4 #[inline] #[doc(alias = "accept4")] pub fn acceptfrom_with<Fd: AsFd>( sockfd: Fd, - flags: AcceptFlags, + flags: SocketFlags, ) -> io::Result<(OwnedFd, Option<SocketAddrAny>)> { backend::net::syscalls::acceptfrom_with(sockfd.as_fd(), flags) } @@ -391,15 +621,29 @@ pub fn acceptfrom_with<Fd: AsFd>( /// `shutdown(fd, how)`—Closes the read and/or write sides of a stream. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#close-and-shutdownget-outta-my-face /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/shutdown.html /// [Linux]: https://man7.org/linux/man-pages/man2/shutdown.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/shutdown.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-shutdown +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=shutdown&sektion=2 +/// [NetBSD]: https://man.netbsd.org/shutdown.2 +/// [OpenBSD]: https://man.openbsd.org/shutdown.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=shutdown§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/shutdown +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Closing-a-Socket.html #[inline] pub fn shutdown<Fd: AsFd>(sockfd: Fd, how: Shutdown) -> io::Result<()> { backend::net::syscalls::shutdown(sockfd.as_fd(), how) @@ -412,11 +656,23 @@ pub fn shutdown<Fd: AsFd>(sockfd: Fd, how: Shutdown) -> io::Result<()> { /// - [Linux] /// - [Apple] /// - [Winsock2] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockname.html /// [Linux]: https://man7.org/linux/man-pages/man2/getsockname.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockname.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockname +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockname&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockname.2 +/// [OpenBSD]: https://man.openbsd.org/getsockname.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockname§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockname +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Reading-Address.html #[inline] pub fn getsockname<Fd: AsFd>(sockfd: Fd) -> io::Result<SocketAddrAny> { backend::net::syscalls::getsockname(sockfd.as_fd()) @@ -426,15 +682,29 @@ pub fn getsockname<Fd: AsFd>(sockfd: Fd) -> io::Result<SocketAddrAny> { /// to. /// /// # References +/// - [Beej's Guide to Network Programming] /// - [POSIX] /// - [Linux] /// - [Apple] /// - [Winsock2] -/// +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] +/// +/// [Beej's Guide to Network Programming]: https://beej.us/guide/bgnet/html/split/system-calls-or-bust.html#getpeernamewho-are-you /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getpeername.html /// [Linux]: https://man7.org/linux/man-pages/man2/getpeername.2.html /// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpeername.2.html /// [Winsock2]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getpeername +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getpeername&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getpeername.2 +/// [OpenBSD]: https://man.openbsd.org/getpeername.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getpeername§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getpeername +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Who-is-Connected.html #[inline] pub fn getpeername<Fd: AsFd>(sockfd: Fd) -> io::Result<Option<SocketAddrAny>> { backend::net::syscalls::getpeername(sockfd.as_fd()) diff --git a/vendor/rustix/src/net/socketpair.rs b/vendor/rustix/src/net/socketpair.rs index 4a9568ce7..b2d46060e 100644 --- a/vendor/rustix/src/net/socketpair.rs +++ b/vendor/rustix/src/net/socketpair.rs @@ -7,9 +7,23 @@ use crate::{backend, io}; /// # References /// - [POSIX] /// - [Linux] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/socketpair.html /// [Linux]: https://man7.org/linux/man-pages/man2/socketpair.2.html +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/socketpair.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=socketpair&sektion=2 +/// [NetBSD]: https://man.netbsd.org/socketpair.2 +/// [OpenBSD]: https://man.openbsd.org/socketpair.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=socketpair§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/socketpair +/// [glibc]: https://www.gnu.org/software/libc/manual/html_node/Socket-Pairs.html #[inline] pub fn socketpair( domain: AddressFamily, diff --git a/vendor/rustix/src/net/sockopt.rs b/vendor/rustix/src/net/sockopt.rs index ffdc67942..26de89e0a 100644 --- a/vendor/rustix/src/net/sockopt.rs +++ b/vendor/rustix/src/net/sockopt.rs @@ -22,6 +22,14 @@ pub use backend::net::types::Timeout; /// - [Linux `socket`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -29,6 +37,14 @@ pub use backend::net::types::Timeout; /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_TYPE")] pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> { @@ -44,6 +60,14 @@ pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> { /// - [Linux `socket`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -51,6 +75,14 @@ pub fn get_socket_type<Fd: AsFd>(fd: Fd) -> io::Result<SocketType> { /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_REUSEADDR")] pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { @@ -66,6 +98,14 @@ pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { /// - [Linux `socket`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -73,6 +113,14 @@ pub fn set_socket_reuseaddr<Fd: AsFd>(fd: Fd, value: bool) -> io::Result<()> { /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_BROADCAST")] pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()> { @@ -88,6 +136,14 @@ pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()> /// - [Linux `socket`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -95,6 +151,14 @@ pub fn set_socket_broadcast<Fd: AsFd>(fd: Fd, broadcast: bool) -> io::Result<()> /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_BROADCAST")] pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> { @@ -110,6 +174,14 @@ pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// - [Linux `socket`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -117,6 +189,14 @@ pub fn get_socket_broadcast<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_LINGER")] pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Result<()> { @@ -132,6 +212,14 @@ pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Resu /// - [Linux `socket`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -139,6 +227,14 @@ pub fn set_socket_linger<Fd: AsFd>(fd: Fd, linger: Option<Duration>) -> io::Resu /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_LINGER")] pub fn get_socket_linger<Fd: AsFd>(fd: Fd) -> io::Result<Option<Duration>> { @@ -175,8 +271,8 @@ pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> { backend::net::syscalls::sockopt::get_socket_passcred(fd.as_fd()) } -/// `setsockopt(fd, SOL_SOCKET, id, timeout)`—Set the sending -/// or receiving timeout. +/// `setsockopt(fd, SOL_SOCKET, id, timeout)`—Set the sending or receiving +/// timeout. /// /// # References /// - [POSIX `setsockopt`] @@ -185,6 +281,14 @@ pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// - [Linux `socket`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -192,6 +296,14 @@ pub fn get_socket_passcred<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_RCVTIMEO")] #[doc(alias = "SO_SNDTIMEO")] @@ -212,6 +324,14 @@ pub fn set_socket_timeout<Fd: AsFd>( /// - [Linux `socket`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -219,6 +339,14 @@ pub fn set_socket_timeout<Fd: AsFd>( /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_RCVTIMEO")] #[doc(alias = "SO_SNDTIMEO")] @@ -235,6 +363,14 @@ pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Du /// - [Linux `socket`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html @@ -242,12 +378,326 @@ pub fn get_socket_timeout<Fd: AsFd>(fd: Fd, id: Timeout) -> io::Result<Option<Du /// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html #[inline] #[doc(alias = "SO_ERROR")] -pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), crate::io::Errno>> { +pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), io::Errno>> { backend::net::syscalls::sockopt::get_socket_error(fd.as_fd()) } +/// `getsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE)` +/// +/// # References +/// - [POSIX `getsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `getsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `getsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[cfg(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 `setsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `setsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `setsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[cfg(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) +} + +/// `setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, keepalive)` +/// +/// # References +/// - [POSIX `setsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `setsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `setsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[inline] +#[doc(alias = "SO_KEEPALIVE")] +pub fn set_socket_keepalive<Fd: AsFd>(fd: Fd, keepalive: bool) -> io::Result<()> { + backend::net::syscalls::sockopt::set_socket_keepalive(fd.as_fd(), keepalive) +} + +/// `getsockopt(fd, SOL_SOCKET, SO_KEEPALIVE)` +/// +/// # References +/// - [POSIX `getsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `getsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `getsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[inline] +#[doc(alias = "SO_KEEPALIVE")] +pub fn get_socket_keepalive<Fd: AsFd>(fd: Fd) -> io::Result<bool> { + backend::net::syscalls::sockopt::get_socket_keepalive(fd.as_fd()) +} + +/// `setsockopt(fd, SOL_SOCKET, SO_RCVBUF, size)` +/// +/// # References +/// - [POSIX `setsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `setsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `setsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[inline] +#[doc(alias = "SO_RCVBUF")] +pub fn set_socket_recv_buffer_size<Fd: AsFd>(fd: Fd, size: usize) -> io::Result<()> { + backend::net::syscalls::sockopt::set_socket_recv_buffer_size(fd.as_fd(), size) +} + +/// `getsockopt(fd, SOL_SOCKET, SO_RCVBUF)` +/// +/// # References +/// - [POSIX `getsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `getsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `getsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[inline] +#[doc(alias = "SO_RCVBUF")] +pub fn get_socket_recv_buffer_size<Fd: AsFd>(fd: Fd) -> io::Result<usize> { + backend::net::syscalls::sockopt::get_socket_recv_buffer_size(fd.as_fd()) +} + +/// `setsockopt(fd, SOL_SOCKET, SO_SNDBUF, size)` +/// +/// # References +/// - [POSIX `setsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `setsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `setsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `setsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/setsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/setsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/setsockopt +/// [glibc `setsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[inline] +#[doc(alias = "SO_SNDBUF")] +pub fn set_socket_send_buffer_size<Fd: AsFd>(fd: Fd, size: usize) -> io::Result<()> { + backend::net::syscalls::sockopt::set_socket_send_buffer_size(fd.as_fd(), size) +} + +/// `getsockopt(fd, SOL_SOCKET, SO_SNDBUF)` +/// +/// # References +/// - [POSIX `getsockopt`] +/// - [POSIX `sys/socket.h`] +/// - [Linux `getsockopt`] +/// - [Linux `socket`] +/// - [Winsock2 `getsockopt`] +/// - [Winsock2 `SOL_SOCKET` options] +/// - [Apple] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] +/// - [glibc `getsockopt`] +/// - [glibc `SOL_SOCKET` Options] +/// +/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html +/// [POSIX `sys/socket.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html +/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html +/// [Linux `socket`]: https://man7.org/linux/man-pages/man7/socket.7.html +/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt +/// [Winsock2 `SOL_SOCKET` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/sol-socket-socket-options +/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [NetBSD]: https://man.netbsd.org/getsockopt.2 +/// [OpenBSD]: https://man.openbsd.org/getsockopt.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [illumos]: https://illumos.org/man/3SOCKET/getsockopt +/// [glibc `getsockopt`]: https://www.gnu.org/software/libc/manual/html_node/Socket-Option-Functions.html +/// [glibc `SOL_SOCKET` options]: https://www.gnu.org/software/libc/manual/html_node/Socket_002dLevel-Options.html +#[inline] +#[doc(alias = "SO_SNDBUF")] +pub fn get_socket_send_buffer_size<Fd: AsFd>(fd: Fd) -> io::Result<usize> { + backend::net::syscalls::sockopt::get_socket_send_buffer_size(fd.as_fd()) +} + /// `setsockopt(fd, IPPROTO_IP, IP_TTL, ttl)` /// /// # References @@ -257,12 +707,36 @@ pub fn get_socket_error<Fd: AsFd>(fd: Fd) -> io::Result<Result<(), crate::io::Er /// - [Linux `ip`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `setsockopt`] +/// - [illumos `ip`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html /// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip`]: https://man.netbsd.org/ip.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip`]: https://illumos.org/man/4P/ip #[inline] #[doc(alias = "IP_TTL")] pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> { @@ -277,7 +751,19 @@ pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> { /// - [Linux `getsockopt`] /// - [Linux `ip`] /// - [Winsock2 `getsockopt`] -/// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `getsockopt`] +/// - [illumos `ip`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -285,6 +771,18 @@ pub fn set_ip_ttl<Fd: AsFd>(fd: Fd, ttl: u32) -> io::Result<()> { /// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip`]: https://man.netbsd.org/ip.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip`]: https://illumos.org/man/4P/ip #[inline] #[doc(alias = "IP_TTL")] pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> { @@ -300,6 +798,18 @@ pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> { /// - [Linux `ipv6`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `setsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -307,6 +817,18 @@ pub fn get_ip_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> { /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IPV6_V6ONLY")] pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> { @@ -322,6 +844,18 @@ pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> { /// - [Linux `ipv6`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `getsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -329,6 +863,18 @@ pub fn set_ipv6_v6only<Fd: AsFd>(fd: Fd, only_v6: bool) -> io::Result<()> { /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IPV6_V6ONLY")] pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> { @@ -344,6 +890,18 @@ pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// - [Linux `ip`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `setsockopt`] +/// - [illumos `ip`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -351,6 +909,18 @@ pub fn get_ipv6_v6only<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip`]: https://man.netbsd.org/ip.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip`]: https://illumos.org/man/4P/ip #[inline] #[doc(alias = "IP_MULTICAST_LOOP")] pub fn set_ip_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Result<()> { @@ -366,6 +936,18 @@ pub fn set_ip_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Resu /// - [Linux `ip`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `getsockopt`] +/// - [illumos `ip`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -388,6 +970,18 @@ pub fn get_ip_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// - [Linux `ip`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `setsockopt`] +/// - [illumos `ip`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -395,6 +989,18 @@ pub fn get_ip_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip`]: https://man.netbsd.org/ip.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip`]: https://illumos.org/man/4P/ip #[inline] #[doc(alias = "IP_MULTICAST_TTL")] pub fn set_ip_multicast_ttl<Fd: AsFd>(fd: Fd, multicast_ttl: u32) -> io::Result<()> { @@ -410,6 +1016,18 @@ pub fn set_ip_multicast_ttl<Fd: AsFd>(fd: Fd, multicast_ttl: u32) -> io::Result< /// - [Linux `ip`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `getsockopt`] +/// - [illumos `ip`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -432,6 +1050,18 @@ pub fn get_ip_multicast_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> { /// - [Linux `ipv6`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `setsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -439,6 +1069,18 @@ pub fn get_ip_multicast_ttl<Fd: AsFd>(fd: Fd) -> io::Result<u32> { /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IPV6_MULTICAST_LOOP")] pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Result<()> { @@ -454,6 +1096,18 @@ pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Re /// - [Linux `ipv6`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `getsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -461,13 +1115,25 @@ pub fn set_ipv6_multicast_loop<Fd: AsFd>(fd: Fd, multicast_loop: bool) -> io::Re /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IPV6_MULTICAST_LOOP")] pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> { backend::net::syscalls::sockopt::get_ipv6_multicast_loop(fd.as_fd()) } -/// `setsockopt(fd, IPPROTO_IP, IPV6_MULTICAST_HOPS, multicast_hops)` +/// `setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, multicast_hops)` /// /// # References /// - [POSIX `setsockopt`] @@ -476,6 +1142,18 @@ pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// - [Linux `ipv6`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `setsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -483,13 +1161,117 @@ pub fn get_ipv6_multicast_loop<Fd: AsFd>(fd: Fd) -> io::Result<bool> { /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IP_MULTICAST_TTL")] pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Result<()> { backend::net::syscalls::sockopt::set_ipv6_multicast_hops(fd.as_fd(), multicast_hops) } -/// `getsockopt(fd, IPPROTO_IP, IPV6_MULTICAST_HOPS)` +/// `getsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS)` +/// +/// # References +/// - [POSIX `getsockopt`] +/// - [POSIX `netinet/in.h`] +/// - [Linux `getsockopt`] +/// - [Linux `ipv6`] +/// - [Winsock2 `getsockopt`] +/// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `getsockopt`] +/// - [illumos `ip6`] +/// +/// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html +/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html +/// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html +/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html +/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt +/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 +#[inline] +#[doc(alias = "IPV6_UNICAST_HOPS")] +pub fn get_ipv6_unicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u8> { + backend::net::syscalls::sockopt::get_ipv6_unicast_hops(fd.as_fd()) +} + +/// `setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, unicast_hops)` +/// +/// # References +/// - [POSIX `setsockopt`] +/// - [POSIX `netinet/in.h`] +/// - [Linux `setsockopt`] +/// - [Linux `ipv6`] +/// - [Winsock2 `setsockopt`] +/// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `setsockopt`] +/// - [illumos `ip6`] +/// +/// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html +/// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html +/// [Linux `setsockopt`]: https://man7.org/linux/man-pages/man2/setsockopt.2.html +/// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html +/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +/// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 +#[inline] +#[doc(alias = "IPV6_UNICAST_HOPS")] +pub fn set_ipv6_unicast_hops<Fd: AsFd>(fd: Fd, unicast_hops: Option<u8>) -> io::Result<()> { + backend::net::syscalls::sockopt::set_ipv6_unicast_hops(fd.as_fd(), unicast_hops) +} + +/// `getsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS)` /// /// # References /// - [POSIX `getsockopt`] @@ -498,6 +1280,18 @@ pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Res /// - [Linux `ipv6`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `getsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `getsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -505,6 +1299,18 @@ pub fn set_ipv6_multicast_hops<Fd: AsFd>(fd: Fd, multicast_hops: u32) -> io::Res /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IP_MULTICAST_TTL")] pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> { @@ -520,6 +1326,18 @@ pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> { /// - [Linux `ip`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `setsockopt`] +/// - [illumos `ip`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -527,6 +1345,18 @@ pub fn get_ipv6_multicast_hops<Fd: AsFd>(fd: Fd) -> io::Result<u32> { /// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip`]: https://man.netbsd.org/ip.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip`]: https://illumos.org/man/4P/ip #[inline] #[doc(alias = "IP_ADD_MEMBERSHIP")] pub fn set_ip_add_membership<Fd: AsFd>( @@ -545,9 +1375,21 @@ pub fn set_ip_add_membership<Fd: AsFd>( /// - [POSIX `setsockopt`] /// - [POSIX `netinet/in.h`] /// - [Linux `setsockopt`] -/// - [Linux `ipv6] +/// - [Linux `ipv6`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `setsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -555,6 +1397,18 @@ pub fn set_ip_add_membership<Fd: AsFd>( /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IPV6_JOIN_GROUP")] #[doc(alias = "IPV6_ADD_MEMBERSHIP")] @@ -575,6 +1429,18 @@ pub fn set_ipv6_add_membership<Fd: AsFd>( /// - [Linux `ip`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IP` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip`] +/// - [illumos `setsockopt`] +/// - [illumos `ip`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -582,6 +1448,18 @@ pub fn set_ipv6_add_membership<Fd: AsFd>( /// [Linux `ip`]: https://man7.org/linux/man-pages/man7/ip.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ip-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip`]: https://man.freebsd.org/cgi/man.cgi?query=ip&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip`]: https://man.netbsd.org/ip.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip`]: https://man.openbsd.org/ip.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip`]: https://man.dragonflybsd.org/?command=ip§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip`]: https://illumos.org/man/4P/ip #[inline] #[doc(alias = "IP_DROP_MEMBERSHIP")] pub fn set_ip_drop_membership<Fd: AsFd>( @@ -603,6 +1481,18 @@ pub fn set_ip_drop_membership<Fd: AsFd>( /// - [Linux `ipv6`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_IPV6` options] +/// - [Apple `setsockopt`] +/// - [Apple `ip6`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `ip6`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `ip6`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `ip6`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `ip6`] +/// - [illumos `setsockopt`] +/// - [illumos `ip6`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/in.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_in.h.html @@ -610,6 +1500,18 @@ pub fn set_ip_drop_membership<Fd: AsFd>( /// [Linux `ipv6`]: https://man7.org/linux/man-pages/man7/ipv6.7.html /// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt /// [Winsock2 `IPPROTO_IPV6` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `ip6`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/ip6.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `ip6`]: https://man.freebsd.org/cgi/man.cgi?query=ip6&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `ip6`]: https://man.netbsd.org/ip6.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `ip6`]: https://man.openbsd.org/ip6.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `ip6`]: https://man.dragonflybsd.org/?command=ip6§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `ip6`]: https://illumos.org/man/4P/ip6 #[inline] #[doc(alias = "IPV6_LEAVE_GROUP")] #[doc(alias = "IPV6_DROP_MEMBERSHIP")] @@ -630,6 +1532,18 @@ pub fn set_ipv6_drop_membership<Fd: AsFd>( /// - [Linux `tcp`] /// - [Winsock2 `setsockopt`] /// - [Winsock2 `IPPROTO_TCP` options] +/// - [Apple `setsockopt`] +/// - [Apple `tcp`] +/// - [FreeBSD `setsockopt`] +/// - [FreeBSD `tcp`] +/// - [NetBSD `setsockopt`] +/// - [NetBSD `tcp`] +/// - [OpenBSD `setsockopt`] +/// - [OpenBSD `tcp`] +/// - [DragonFly BSD `setsockopt`] +/// - [DragonFly BSD `tcp`] +/// - [illumos `setsockopt`] +/// - [illumos `tcp`] /// /// [POSIX `setsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html /// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html @@ -637,6 +1551,18 @@ pub fn set_ipv6_drop_membership<Fd: AsFd>( /// [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 +/// [Apple `setsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/setsockopt.2.html +/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html +/// [FreeBSD `setsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=setsockopt&sektion=2 +/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4 +/// [NetBSD `setsockopt`]: https://man.netbsd.org/setsockopt.2 +/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4 +/// [OpenBSD `setsockopt`]: https://man.openbsd.org/setsockopt.2 +/// [OpenBSD `tcp`]: https://man.openbsd.org/tcp.4 +/// [DragonFly BSD `setsockopt`]: https://man.dragonflybsd.org/?command=setsockopt§ion=2 +/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp§ion=4 +/// [illumos `setsockopt`]: https://illumos.org/man/3SOCKET/setsockopt +/// [illumos `tcp`]: https://illumos.org/man/4P/tcp #[inline] #[doc(alias = "TCP_NODELAY")] pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> { @@ -652,61 +1578,39 @@ pub fn set_tcp_nodelay<Fd: AsFd>(fd: Fd, nodelay: bool) -> io::Result<()> { /// - [Linux `tcp`] /// - [Winsock2 `getsockopt`] /// - [Winsock2 `IPPROTO_TCP` options] +/// - [Apple `getsockopt`] +/// - [Apple `tcp`] +/// - [FreeBSD `getsockopt`] +/// - [FreeBSD `tcp`] +/// - [NetBSD `getsockopt`] +/// - [NetBSD `tcp`] +/// - [OpenBSD `getsockopt`] +/// - [OpenBSD `tcp`] +/// - [DragonFly BSD `getsockopt`] +/// - [DragonFly BSD `tcp`] +/// - [illumos `getsockopt`] +/// - [illumos `tcp`] /// /// [POSIX `getsockopt`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html /// [POSIX `netinet/tcp.h`]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/netinet_tcp.h.html /// [Linux `getsockopt`]: https://man7.org/linux/man-pages/man2/getsockopt.2.html /// [Linux `tcp`]: https://man7.org/linux/man-pages/man7/tcp.7.html -/// [Winsock2 `setsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-setsockopt +/// [Winsock2 `getsockopt`]: https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-getsockopt /// [Winsock2 `IPPROTO_TCP` options]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options +/// [Apple `getsockopt`]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getsockopt.2.html +/// [Apple `tcp`]: https://opensource.apple.com/source/xnu/xnu-7195.81.3/bsd/man/man4/tcp.4.auto.html +/// [FreeBSD `getsockopt`]: https://man.freebsd.org/cgi/man.cgi?query=getsockopt&sektion=2 +/// [FreeBSD `tcp`]: https://man.freebsd.org/cgi/man.cgi?query=tcp&sektion=4 +/// [NetBSD `getsockopt`]: https://man.netbsd.org/getsockopt.2 +/// [NetBSD `tcp`]: https://man.netbsd.org/tcp.4 +/// [OpenBSD `getsockopt`]: https://man.openbsd.org/getsockopt.2 +/// [OpenBSD `tcp`]: https://man.openbsd.org/tcp.4 +/// [DragonFly BSD `getsockopt`]: https://man.dragonflybsd.org/?command=getsockopt§ion=2 +/// [DragonFly BSD `tcp`]: https://man.dragonflybsd.org/?command=tcp§ion=4 +/// [illumos `getsockopt`]: https://illumos.org/man/3SOCKET/getsockopt +/// [illumos `tcp`]: https://illumos.org/man/4P/tcp #[inline] #[doc(alias = "TCP_NODELAY")] 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/path/arg.rs b/vendor/rustix/src/path/arg.rs index 3d976ce3e..b6b2a8a73 100644 --- a/vendor/rustix/src/path/arg.rs +++ b/vendor/rustix/src/path/arg.rs @@ -957,8 +957,8 @@ where // 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: + // SAFETY: `bytes.len() < SMALL_PATH_BUFFER_SIZE` which means we have space for + // `bytes.len() + 1` u8s: unsafe { ptr::copy_nonoverlapping(bytes.as_ptr(), buf_ptr, bytes.len()); buf_ptr.add(bytes.len()).write(0); diff --git a/vendor/rustix/src/process/chroot.rs b/vendor/rustix/src/process/chroot.rs new file mode 100644 index 000000000..d68a8b081 --- /dev/null +++ b/vendor/rustix/src/process/chroot.rs @@ -0,0 +1,12 @@ +use crate::{backend, io, path}; + +/// `chroot(path)`—Change the process root directory. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/chroot.2.html +#[inline] +pub fn chroot<P: path::Arg>(path: P) -> io::Result<()> { + path.into_with_c_str(backend::process::syscalls::chroot) +} diff --git a/vendor/rustix/src/process/exit.rs b/vendor/rustix/src/process/exit.rs index 56db99b4f..2bbbcf538 100644 --- a/vendor/rustix/src/process/exit.rs +++ b/vendor/rustix/src/process/exit.rs @@ -24,11 +24,13 @@ pub const EXIT_SUCCESS: i32 = backend::process::types::EXIT_SUCCESS; /// [Linux]: https://man7.org/linux/man-pages/man3/exit.3.html pub const EXIT_FAILURE: i32 = backend::process::types::EXIT_FAILURE; -/// The exit status used by a process terminated with `SIGABRT` signal. +/// The exit status used by a process terminated with a [`Signal::Abort`] +/// signal. /// /// # References /// - [Linux] /// /// [Linux]: https://tldp.org/LDP/abs/html/exitcodes.html +/// [`Signal::Abort`]: crate::process::Signal::Abort #[cfg(not(target_os = "wasi"))] pub const EXIT_SIGNALED_SIGABRT: i32 = backend::process::types::EXIT_SIGNALED_SIGABRT; diff --git a/vendor/rustix/src/process/id.rs b/vendor/rustix/src/process/id.rs index 04f1b879c..687596a31 100644 --- a/vendor/rustix/src/process/id.rs +++ b/vendor/rustix/src/process/id.rs @@ -8,6 +8,7 @@ #![allow(unsafe_code)] use crate::{backend, io}; +use alloc::vec::Vec; #[cfg(any(target_os = "android", target_os = "linux"))] use backend::process::types::RawCpuid; @@ -280,6 +281,19 @@ pub fn getpgid(pid: Option<Pid>) -> io::Result<Pid> { backend::process::syscalls::getpgid(pid) } +/// `setpgid(pid, pgid)`—Sets the process group ID of the given process. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/setpgid.html +/// [Linux]: https://man7.org/linux/man-pages/man2/setpgid.2.html +#[inline] +pub fn setpgid(pid: Option<Pid>, pgid: Option<Pid>) -> io::Result<()> { + backend::process::syscalls::setpgid(pid, pgid) +} + /// `getpgrp()`—Returns the process' group ID. /// /// # References @@ -294,6 +308,20 @@ pub fn getpgrp() -> Pid { backend::process::syscalls::getpgrp() } +/// `getsid(pid)`—Get the session ID of the given process. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsid.html +/// [Linux]: https://man7.org/linux/man-pages/man2/getsid.2.html +#[cfg(not(target_os = "redox"))] +#[inline] +pub fn getsid(pid: Option<Pid>) -> io::Result<Pid> { + backend::process::syscalls::getsid(pid) +} + /// `setsid()`—Create a new session. /// /// # References @@ -307,9 +335,39 @@ pub fn setsid() -> io::Result<Pid> { backend::process::syscalls::setsid() } -// translate_fchown_args returns the raw value of the IDs. In case of `None` -// it returns `u32::MAX` since it has the same bit pattern as `-1` indicating -// no change to the owner/group ID. +/// `getgroups()`—Return a list of the current user's groups. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/getgroups.html +/// [Linux]: https://man7.org/linux/man-pages/man2/getgroups.2.html +pub fn getgroups() -> io::Result<Vec<Gid>> { + let mut buffer = Vec::new(); + + // This code would benefit from having a better way to read into + // uninitialized memory, but that requires `unsafe`. + buffer.reserve(8); + buffer.resize(buffer.capacity(), Gid::ROOT); + + loop { + let ngroups = backend::process::syscalls::getgroups(&mut buffer)?; + + let ngroups = ngroups as usize; + assert!(ngroups <= buffer.len()); + if ngroups < buffer.len() { + buffer.resize(ngroups, Gid::ROOT); + return Ok(buffer); + } + buffer.reserve(1); // use `Vec` reallocation strategy to grow capacity exponentially + buffer.resize(buffer.capacity(), Gid::ROOT); + } +} + +// Return the raw value of the IDs. In case of `None` it returns `u32::MAX` +// since it has the same bit pattern as `-1` indicating no change to the +// owner/group ID. pub(crate) fn translate_fchown_args(owner: Option<Uid>, group: Option<Gid>) -> (u32, u32) { let ow = match owner { Some(o) => o.as_raw(), diff --git a/vendor/rustix/src/process/kill.rs b/vendor/rustix/src/process/kill.rs index 69cfba261..807cc1028 100644 --- a/vendor/rustix/src/process/kill.rs +++ b/vendor/rustix/src/process/kill.rs @@ -49,3 +49,49 @@ pub fn kill_process_group(pid: Pid, sig: Signal) -> io::Result<()> { pub fn kill_current_process_group(sig: Signal) -> io::Result<()> { backend::process::syscalls::kill_current_process_group(sig) } + +/// `kill(pid, 0)`—Check validity of pid and permissions to send signals to +/// the process, without actually sending any signals. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html +/// [Linux]: https://man7.org/linux/man-pages/man2/kill.2.html +#[inline] +#[doc(alias = "kill")] +pub fn test_kill_process(pid: Pid) -> io::Result<()> { + backend::process::syscalls::test_kill_process(pid) +} + +/// `kill(-pid, 0)`—Check validity of pid and permissions to send signals to +/// all processes in the process group, without actually sending any signals. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html +/// [Linux]: https://man7.org/linux/man-pages/man2/kill.2.html +#[inline] +#[doc(alias = "kill")] +pub fn test_kill_process_group(pid: Pid) -> io::Result<()> { + backend::process::syscalls::test_kill_process_group(pid) +} + +/// `kill(0, 0)`—Check validity of pid and permissions to send signals to the +/// all processes in the current process group, without actually sending any +/// signals. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/kill.html +/// [Linux]: https://man7.org/linux/man-pages/man2/kill.2.html +#[inline] +#[doc(alias = "kill")] +pub fn test_kill_current_process_group() -> io::Result<()> { + backend::process::syscalls::test_kill_current_process_group() +} diff --git a/vendor/rustix/src/process/mod.rs b/vendor/rustix/src/process/mod.rs index 3ae976439..0002c0f46 100644 --- a/vendor/rustix/src/process/mod.rs +++ b/vendor/rustix/src/process/mod.rs @@ -2,6 +2,8 @@ #[cfg(not(target_os = "wasi"))] mod chdir; +#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +mod chroot; mod exit; #[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id. mod id; @@ -27,15 +29,17 @@ mod rlimit; ))] mod sched; mod sched_yield; +#[cfg(not(target_os = "wasi"))] // WASI doesn't have uname. +mod system; #[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::*; +#[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] +pub use chroot::*; pub use exit::*; #[cfg(not(target_os = "wasi"))] pub use id::*; @@ -62,9 +66,9 @@ pub use rlimit::*; pub use sched::*; pub use sched_yield::sched_yield; #[cfg(not(target_os = "wasi"))] -pub use umask::*; +pub use system::*; #[cfg(not(target_os = "wasi"))] -pub use uname::{uname, Uname}; +pub use umask::*; #[cfg(not(target_os = "wasi"))] pub use wait::*; diff --git a/vendor/rustix/src/process/prctl.rs b/vendor/rustix/src/process/prctl.rs index 34eef7aa4..a4e1e546c 100644 --- a/vendor/rustix/src/process/prctl.rs +++ b/vendor/rustix/src/process/prctl.rs @@ -76,7 +76,7 @@ const PR_GET_PDEATHSIG: c_int = 2; /// - [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 +/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn parent_process_death_signal() -> io::Result<Option<Signal>> { unsafe { prctl_get_at_arg2_optional::<c_int>(PR_GET_PDEATHSIG) }.map(Signal::from_raw) @@ -91,7 +91,7 @@ const PR_SET_PDEATHSIG: c_int = 1; /// - [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 +/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn set_parent_process_death_signal(signal: Option<Signal>) -> io::Result<()> { let signal = signal.map_or(0_usize, |signal| signal as usize); @@ -175,7 +175,7 @@ bitflags! { pub struct UnalignedAccessControl: u32 { /// Silently fix up unaligned user accesses. const NO_PRINT = 1; - /// Generate `SIGBUS` on unaligned user access. + /// Generate a [`Signal::Bus`] signal on unaligned user access. const SIGBUS = 2; } } @@ -216,7 +216,8 @@ bitflags! { pub struct FloatingPointEmulationControl: u32 { /// Silently emulate floating point operations accesses. const NO_PRINT = 1; - /// Don't emulate floating point operations, send `SIGFPE` instead. + /// Don't emulate floating point operations, send a [`Signal::Fpe`] + /// signal instead. const SIGFPE = 2; } } @@ -442,7 +443,7 @@ const PR_TSC_SIGSEGV: u32 = 2; pub enum TimeStampCounterReadability { /// Allow the use of the timestamp counter. Readable = PR_TSC_ENABLE, - /// Throw a `SIGSEGV` instead of reading the TSC. + /// Throw a [`Signal::Segv`] signal instead of reading the TSC. RaiseSIGSEGV = PR_TSC_SIGSEGV, } @@ -721,9 +722,9 @@ pub struct PrctlMmMap { pub start_data: u64, /// Data section end address. pub end_data: u64, - /// brk() start address. + /// `brk` start address. pub start_brk: u64, - /// brk() current address. + /// `brk` current address. pub brk: u64, /// Stack start address. pub start_stack: u64, diff --git a/vendor/rustix/src/process/procctl.rs b/vendor/rustix/src/process/procctl.rs index 9e2b3c6e6..443aa90a4 100644 --- a/vendor/rustix/src/process/procctl.rs +++ b/vendor/rustix/src/process/procctl.rs @@ -85,7 +85,7 @@ const PROC_PDEATHSIG_STATUS: c_int = 12; /// - [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 +/// [FreeBSD: `procctl(PROC_PDEATHSIG_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn parent_process_death_signal() -> io::Result<Option<Signal>> { unsafe { procctl_get_optional::<c_int>(PROC_PDEATHSIG_STATUS, None) }.map(Signal::from_raw) @@ -100,7 +100,7 @@ const PROC_PDEATHSIG_CTL: c_int = 11; /// - [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 +/// [FreeBSD: `procctl(PROC_PDEATHSIG_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn set_parent_process_death_signal(signal: Option<Signal>) -> io::Result<()> { let signal = signal.map_or(0, |signal| signal as c_int); @@ -140,9 +140,9 @@ pub enum DumpableBehavior { /// Linux. /// /// # References -/// - [`procctl(PROC_TRACE_CTL,...)`] +/// - [FreeBSD `procctl(PROC_TRACE_CTL,...)`] /// -/// [`procctl(PROC_TRACE_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD `procctl(PROC_TRACE_CTL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn set_dumpable_behavior(process: ProcSelector, config: DumpableBehavior) -> io::Result<()> { unsafe { procctl(PROC_TRACE_CTL, process, config as usize as *mut _) } @@ -170,9 +170,9 @@ pub enum TracingStatus { /// Get the tracing status of the process indicated by `idtype` and `id`. /// /// # References -/// - [`procctl(PROC_TRACE_STATUS,...)`] +/// - [FreeBSD `procctl(PROC_TRACE_STATUS,...)`] /// -/// [`procctl(PROC_TRACE_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD `procctl(PROC_TRACE_STATUS,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn trace_status(process: ProcSelector) -> io::Result<TracingStatus> { let val = unsafe { procctl_get_optional::<c_int>(PROC_TRACE_STATUS, process) }?; @@ -198,7 +198,7 @@ const PROC_REAP_RELEASE: c_int = 3; /// # References /// - [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`] /// -/// [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD: `procctl(PROC_REAP_ACQUIRE/RELEASE,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 #[inline] pub fn set_reaper_status(reaper: bool) -> io::Result<()> { unsafe { @@ -258,7 +258,7 @@ pub struct ReaperStatus { /// # References /// - [FreeBSD: `procctl(PROC_REAP_STATUS,...)`] /// -/// [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD: `procctl(PROC_REAP_STATUS,...)`]: https://man.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) }?; @@ -282,6 +282,12 @@ bitflags! { const CHILD = 2; /// The reported process is itself a reaper. Descendants of a subordinate reaper are not reported. const REAPER = 4; + /// The reported process is in the zombie state. + const ZOMBIE = 8; + /// The reported process is stopped by SIGSTOP/SIGTSTP. + const STOPPED = 16; + /// The reported process is in the process of exiting. + const EXITING = 32; } } @@ -318,7 +324,7 @@ pub struct PidInfo { /// # References /// - [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`] /// -/// [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD: `procctl(PROC_REAP_GETPIDS,...)`]: https://man.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.. @@ -385,7 +391,7 @@ pub struct KillResult { /// # References /// - [FreeBSD: `procctl(PROC_REAP_KILL,...)`] /// -/// [FreeBSD: `procctl(PROC_REAP_KILL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD: `procctl(PROC_REAP_KILL,...)`]: https://man.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 pub fn reaper_kill( process: ProcSelector, signal: Signal, @@ -433,18 +439,18 @@ const PROC_TRAPCAP_CTL_DISABLE: i32 = 2; #[derive(Copy, Clone, Debug, Eq, PartialEq)] #[repr(i32)] pub enum TrapCapBehavior { - /// Disable the SIGTRAP signal delivery on capability mode access + /// Disable the [`Signal::Trap`] signal delivery on capability mode access /// violations. Disable = PROC_TRAPCAP_CTL_DISABLE, - /// Enable the SIGTRAP signal delivery on capability mode access + /// Enable the [`Signal::Trap`] 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. +/// If this behavior is enabled, the kernel would deliver a [`Signal::Trap`] +/// signal on any return from a system call that would result in a +/// [`io::Errno::NOTCAPABLE`]` or [`io::Errno::CAPMODE`] error. /// /// This behavior is inherited by the children of the process and is kept /// across `execve` calls. @@ -452,7 +458,7 @@ pub enum TrapCapBehavior { /// # References /// - [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`] /// -/// [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD: `procctl(PROC_TRAPCAP_CTL,...)`]: https://man.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; @@ -466,7 +472,7 @@ const PROC_TRAPCAP_STATUS: c_int = 10; /// # References /// - [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`] /// -/// [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]: https://www.freebsd.org/cgi/man.cgi?query=procctl&sektion=2 +/// [FreeBSD: `procctl(PROC_TRAPCAP_STATUS,...)`]: https://man.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) }?; @@ -497,7 +503,7 @@ const PROC_NO_NEW_PRIVS_ENABLE: c_int = 1; /// - [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 +/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_CTL,...)`]: https://man.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) } @@ -512,7 +518,7 @@ const PROC_NO_NEW_PRIVS_STATUS: c_int = 20; /// - [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 +/// [FreeBSD: `procctl(PROC_NO_NEW_PRIVS_STATUS,...)`]: https://man.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) } diff --git a/vendor/rustix/src/process/uname.rs b/vendor/rustix/src/process/system.rs index 904532a99..cf9a312fc 100644 --- a/vendor/rustix/src/process/uname.rs +++ b/vendor/rustix/src/process/system.rs @@ -1,4 +1,4 @@ -//! Uname support. +//! Uname and other system-level functions. //! //! # Safety //! @@ -8,10 +8,22 @@ use crate::backend; use crate::ffi::CStr; +#[cfg(not(target_os = "emscripten"))] +use crate::io; use core::fmt; +#[cfg(any(target_os = "android", target_os = "linux"))] +pub use backend::process::types::Sysinfo; + /// `uname()`—Returns high-level information about the runtime OS and /// hardware. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/uname.html +/// [Linux]: https://man7.org/linux/man-pages/man2/uname.2.html #[inline] pub fn uname() -> Uname { Uname(backend::process::syscalls::uname()) @@ -99,3 +111,27 @@ impl fmt::Debug for Uname { } } } + +/// `sysinfo()`—Returns status information about the runtime OS. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/uname.2.html +#[cfg(any(target_os = "android", target_os = "linux"))] +#[inline] +pub fn sysinfo() -> Sysinfo { + backend::process::syscalls::sysinfo() +} + +/// `sethostname(name)—Sets the system host name. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/sethostname.2.html +#[cfg(not(any(target_os = "emscripten", target_os = "redox", target_os = "wasi")))] +#[inline] +pub fn sethostname(name: &[u8]) -> io::Result<()> { + backend::process::syscalls::sethostname(name) +} diff --git a/vendor/rustix/src/process/wait.rs b/vendor/rustix/src/process/wait.rs index 784e6627c..ea2691ae1 100644 --- a/vendor/rustix/src/process/wait.rs +++ b/vendor/rustix/src/process/wait.rs @@ -5,14 +5,20 @@ use bitflags::bitflags; #[cfg(target_os = "linux")] use crate::fd::BorrowedFd; +#[cfg(linux_raw)] +use crate::backend::process::wait::SiginfoExt; + bitflags! { /// Options for modifying the behavior of wait/waitpid pub struct WaitOptions: u32 { /// Return immediately if no child has exited. const NOHANG = backend::process::wait::WNOHANG as _; - /// Return if a child has stopped (but not traced via `ptrace(2)`) + /// Return if a child has stopped (but not traced via [`ptrace`]) + /// + /// [`ptrace`]: https://man7.org/linux/man-pages/man2/ptrace.2.html const UNTRACED = backend::process::wait::WUNTRACED as _; - /// Return if a stopped child has been resumed by delivery of `SIGCONT` + /// Return if a stopped child has been resumed by delivery of + /// [`Signal::Cont`]. const CONTINUED = backend::process::wait::WCONTINUED as _; } } @@ -23,7 +29,8 @@ bitflags! { 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` + /// Return if a stopped child has been resumed by delivery of + /// [`Signal::Cont`] const CONTINUED = backend::process::wait::WCONTINUED as _; /// Wait for processed that have exited. const EXITED = backend::process::wait::WEXITED as _; @@ -34,12 +41,13 @@ bitflags! { } } -/// the status of the child processes the caller waited on +/// The status of a child process after calling [`wait`]/[`waitpid`]. #[derive(Debug, Clone, Copy)] +#[repr(transparent)] pub struct WaitStatus(u32); impl WaitStatus { - /// create a `WaitStatus` out of an integer. + /// Creates a `WaitStatus` out of an integer. #[inline] pub(crate) fn new(status: u32) -> Self { Self(status) @@ -57,6 +65,18 @@ impl WaitStatus { backend::process::wait::WIFSTOPPED(self.0 as _) } + /// Returns whether the process has exited normally. + #[inline] + pub fn exited(self) -> bool { + backend::process::wait::WIFEXITED(self.0 as _) + } + + /// Returns whether the process was terminated by a signal. + #[inline] + pub fn signaled(self) -> bool { + backend::process::wait::WIFSIGNALED(self.0 as _) + } + /// Returns whether the process has continued from a job control stop. #[inline] pub fn continued(self) -> bool { @@ -78,7 +98,7 @@ impl WaitStatus { /// if it exited normally. #[inline] pub fn exit_status(self) -> Option<u32> { - if backend::process::wait::WIFEXITED(self.0 as _) { + if self.exited() { Some(backend::process::wait::WEXITSTATUS(self.0 as _) as _) } else { None @@ -89,7 +109,7 @@ impl WaitStatus { /// if the process was terminated by a signal. #[inline] pub fn terminating_signal(self) -> Option<u32> { - if backend::process::wait::WIFSIGNALED(self.0 as _) { + if self.signaled() { Some(backend::process::wait::WTERMSIG(self.0 as _) as _) } else { None @@ -99,9 +119,125 @@ impl WaitStatus { /// The status of a process after calling [`waitid`]. #[derive(Clone, Copy)] +#[repr(transparent)] #[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] pub struct WaitidStatus(pub(crate) backend::c::siginfo_t); +#[cfg(not(any(target_os = "wasi", target_os = "redox", target_os = "openbsd")))] +impl WaitidStatus { + /// Returns whether the process is currently stopped. + #[inline] + pub fn stopped(&self) -> bool { + self.si_code() == backend::c::CLD_STOPPED + } + + /// Returns whether the process is currently trapped. + #[inline] + pub fn trapped(&self) -> bool { + self.si_code() == backend::c::CLD_TRAPPED + } + + /// Returns whether the process has exited normally. + #[inline] + pub fn exited(&self) -> bool { + self.si_code() == backend::c::CLD_EXITED + } + + /// Returns whether the process was terminated by a signal + /// and did not create a core file. + #[inline] + pub fn killed(&self) -> bool { + self.si_code() == backend::c::CLD_KILLED + } + + /// Returns whether the process was terminated by a signal + /// and did create a core file. + #[inline] + pub fn dumped(&self) -> bool { + self.si_code() == backend::c::CLD_DUMPED + } + + /// Returns whether the process has continued from a job control stop. + #[inline] + pub fn continued(&self) -> bool { + self.si_code() == backend::c::CLD_CONTINUED + } + + /// Returns the number of the signal that stopped the process, + /// if the process was stopped by a signal. + #[inline] + #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))] + pub fn stopping_signal(&self) -> Option<u32> { + if self.stopped() { + Some(self.si_status() as _) + } else { + None + } + } + + /// Returns the number of the signal that trapped the process, + /// if the process was trapped by a signal. + #[inline] + #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))] + pub fn trapping_signal(&self) -> Option<u32> { + if self.trapped() { + Some(self.si_status() as _) + } else { + None + } + } + + /// Returns the exit status number returned by the process, + /// if it exited normally. + #[inline] + #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))] + pub fn exit_status(&self) -> Option<u32> { + if self.exited() { + Some(self.si_status() as _) + } else { + None + } + } + + /// Returns the number of the signal that terminated the process, + /// if the process was terminated by a signal. + #[inline] + #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))] + pub fn terminating_signal(&self) -> Option<u32> { + if self.killed() || self.dumped() { + Some(self.si_status() as _) + } else { + None + } + } + + /// Returns a reference to the raw platform-specific `siginfo_t` struct. + #[inline] + pub const fn as_raw(&self) -> &backend::c::siginfo_t { + &self.0 + } + + #[cfg(linux_raw)] + fn si_code(&self) -> u32 { + self.0.si_code() as u32 // CLD_ consts are unsigned + } + + #[cfg(not(linux_raw))] + fn si_code(&self) -> backend::c::c_int { + self.0.si_code + } + + #[cfg(not(any(target_os = "netbsd", target_os = "fuchsia", target_os = "emscripten")))] + #[allow(unsafe_code)] + fn si_status(&self) -> backend::c::c_int { + // SAFETY: POSIX [specifies] that the `siginfo_t` returned by a `waitid` + // call always has a valid `si_status` value. + // + // [specifies]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html + unsafe { self.0.si_status() } + } +} + /// 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)] diff --git a/vendor/rustix/src/rand/getrandom.rs b/vendor/rustix/src/rand/getrandom.rs index 83043800d..79d5319d5 100644 --- a/vendor/rustix/src/rand/getrandom.rs +++ b/vendor/rustix/src/rand/getrandom.rs @@ -1,6 +1,6 @@ use crate::{backend, io}; -/// `GRND_*` +/// `GRND_*` constants for use with `getrandom`. pub use backend::rand::types::GetRandomFlags; /// `getrandom(buf, flags)`—Reads a sequence of random bytes. diff --git a/vendor/rustix/src/runtime.rs b/vendor/rustix/src/runtime.rs index af3c98ff9..587ad1e2a 100644 --- a/vendor/rustix/src/runtime.rs +++ b/vendor/rustix/src/runtime.rs @@ -28,13 +28,45 @@ use crate::fs::AtFlags; #[cfg(linux_raw)] use crate::io; #[cfg(linux_raw)] -use crate::process::Pid; +use crate::process::{Pid, Signal}; #[cfg(linux_raw)] #[cfg(feature = "fs")] use backend::fd::AsFd; #[cfg(linux_raw)] use core::ffi::c_void; +/// `sigaction` +#[cfg(linux_raw)] +pub type Sigaction = linux_raw_sys::general::kernel_sigaction; + +/// `stack_t` +#[cfg(linux_raw)] +pub type Stack = linux_raw_sys::general::stack_t; + +/// `sigset_t` +#[cfg(linux_raw)] +pub type Sigset = linux_raw_sys::general::kernel_sigset_t; + +/// `siginfo_t` +#[cfg(linux_raw)] +pub type Siginfo = linux_raw_sys::general::siginfo_t; + +pub use backend::time::types::{Nsecs, Secs, Timespec}; + +/// `SIG_*` constants for use with [`sigprocmask`]. +#[cfg(linux_raw)] +#[repr(u32)] +pub enum How { + /// `SIG_BLOCK` + BLOCK = linux_raw_sys::general::SIG_BLOCK, + + /// `SIG_UNBLOCK` + UNBLOCK = linux_raw_sys::general::SIG_UNBLOCK, + + /// `SIG_SETMASK` + SETMASK = linux_raw_sys::general::SIG_SETMASK, +} + #[cfg(linux_raw)] #[cfg(target_arch = "x86")] #[inline] @@ -109,7 +141,7 @@ pub unsafe fn exit_thread(status: i32) -> ! { /// /// [POSIX `_Exit`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/_Exit.html /// [Linux `exit_group`]: https://man7.org/linux/man-pages/man2/exit_group.2.html -/// [Linux `_Exit`]: https://man7.org/linux/man-pages/man2/exit.2.html +/// [Linux `_Exit`]: https://man7.org/linux/man-pages/man2/_Exit.2.html #[doc(alias = "_exit")] #[doc(alias = "_Exit")] #[inline] @@ -211,7 +243,7 @@ pub use backend::runtime::tls::StartupTlsInfo; /// > It is better you /// > Do not. /// -/// - "Rules", by Karla Kuskin +/// - “Rules”, by Karla Kuskin /// /// [`MAP_SHARED`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html /// [not considered unsafe]: https://doc.rust-lang.org/reference/behavior-not-considered-unsafe.html#deadlocks @@ -267,3 +299,114 @@ pub unsafe fn execveat<Fd: AsFd>( pub unsafe fn execve(path: &CStr, argv: *const *const u8, envp: *const *const u8) -> io::Errno { backend::runtime::syscalls::execve(path, argv, envp) } + +/// `sigaction(signal, &new, &old)`—Modify or query a signal handler. +/// +/// # Safety +/// +/// You're on your own. And on top of all the troubles with signal handlers, +/// this implementation is highly experimental. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaction.html +/// [Linux]: https://man7.org/linux/man-pages/man2/sigaction.2.html +#[cfg(linux_raw)] +#[inline] +pub unsafe fn sigaction(signal: Signal, new: Option<Sigaction>) -> io::Result<Sigaction> { + backend::runtime::syscalls::sigaction(signal, new) +} + +/// `sigaltstack(new, old)`—Modify or query a signal stack. +/// +/// # Safety +/// +/// You're on your own. And on top of all the troubles with signal handlers, +/// this implementation is highly experimental. +/// +/// # References +/// - [POSIX] +/// - [Linux] +/// +/// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigaltstack.html +/// [Linux]: https://man7.org/linux/man-pages/man2/sigaltstack.2.html +#[cfg(linux_raw)] +#[inline] +pub unsafe fn sigaltstack(new: Option<Stack>) -> io::Result<Stack> { + backend::runtime::syscalls::sigaltstack(new) +} + +/// `tkill(tid, sig)`—Send a signal to a thread. +/// +/// # Safety +/// +/// You're on your own. And on top of all the troubles with signal handlers, +/// this implementation is highly experimental. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/tkill.2.html +#[cfg(linux_raw)] +#[inline] +pub unsafe fn tkill(tid: Pid, sig: Signal) -> io::Result<()> { + backend::runtime::syscalls::tkill(tid, sig) +} + +/// `sigprocmask(how, set, oldset)`—Adjust the process signal mask. +/// +/// # Safety +/// +/// You're on your own. And on top of all the troubles with signal handlers, +/// this implementation is highly experimental. +/// +/// # References +/// - [Linux `sigprocmask`] +/// - [Linux `pthread_sigmask`] +/// +/// [Linux `sigprocmask`]: https://man7.org/linux/man-pages/man2/sigprocmask.2.html +/// [Linux `pthread_sigmask`]: https://man7.org/linux/man-pages/man3/pthread_sigmask.3.html +#[cfg(linux_raw)] +#[inline] +#[doc(alias = "pthread_sigmask")] +pub unsafe fn sigprocmask(how: How, set: &Sigset) -> io::Result<Sigset> { + backend::runtime::syscalls::sigprocmask(how, set) +} + +/// `sigwait(set)`—Wait for signals. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man3/sigwait.3.html +#[cfg(linux_raw)] +#[inline] +pub fn sigwait(set: &Sigset) -> io::Result<Signal> { + backend::runtime::syscalls::sigwait(set) +} + +/// `sigwait(set)`—Wait for signals, returning a [`Siginfo`]. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/sigwaitinfo.2.html +#[cfg(linux_raw)] +#[inline] +pub fn sigwaitinfo(set: &Sigset) -> io::Result<Siginfo> { + backend::runtime::syscalls::sigwaitinfo(set) +} + +/// `sigtimedwait(set)`—Wait for signals, optionally with a timeout. +/// +/// # References +/// - [Linux] +/// +/// [Linux]: https://man7.org/linux/man-pages/man2/sigtimedwait.2.html +#[cfg(linux_raw)] +#[inline] +pub fn sigtimedwait(set: &Sigset, timeout: Option<Timespec>) -> io::Result<Siginfo> { + backend::runtime::syscalls::sigtimedwait(set, timeout) +} diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs index 2bf5d3ceb..76ffd8609 100644 --- a/vendor/rustix/src/termios/tty.rs +++ b/vendor/rustix/src/termios/tty.rs @@ -42,6 +42,7 @@ pub fn isatty<Fd: AsFd>(fd: Fd) -> bool { #[cfg(not(any(target_os = "fuchsia", target_os = "wasi")))] #[cfg(feature = "procfs")] #[cfg_attr(doc_cfg, doc(cfg(feature = "procfs")))] +#[doc(alias = "ttyname_r")] #[inline] pub fn ttyname<Fd: AsFd, B: Into<Vec<u8>>>(dirfd: Fd, reuse: B) -> io::Result<CString> { _ttyname(dirfd.as_fd(), reuse.into()) diff --git a/vendor/rustix/src/thread/id.rs b/vendor/rustix/src/thread/id.rs index 59610ff03..3143b068b 100644 --- a/vendor/rustix/src/thread/id.rs +++ b/vendor/rustix/src/thread/id.rs @@ -26,7 +26,8 @@ pub fn gettid() -> Pid { /// 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. +/// in the [manual page][linux_notes]. This call implements the kernel +/// behavior. /// /// # References /// - [POSIX] @@ -50,7 +51,7 @@ pub fn set_thread_uid(uid: Uid) -> io::Result<()> { /// 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 +/// in the [manual page][linux_notes] and the notes in [`set_thread_uid`]. This /// call implements the kernel behavior. /// /// # References @@ -73,7 +74,8 @@ pub fn set_thread_res_uid(ruid: Uid, euid: Uid, suid: Uid) -> io::Result<()> { /// 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. +/// in the [manual page][linux_notes]. This call implements the kernel +/// behavior. /// /// # References /// - [POSIX] @@ -97,7 +99,7 @@ pub fn set_thread_gid(gid: Gid) -> io::Result<()> { /// 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 +/// in the [manual page][linux_notes] and the notes in [`set_thread_gid`]. This /// call implements the kernel behavior. /// /// # References diff --git a/vendor/rustix/src/thread/prctl.rs b/vendor/rustix/src/thread/prctl.rs index f1ddf7d36..2e11ff247 100644 --- a/vendor/rustix/src/thread/prctl.rs +++ b/vendor/rustix/src/thread/prctl.rs @@ -129,20 +129,23 @@ impl TryFrom<i32> for SecureComputingMode { /* /// Get the secure computing mode of the calling thread. /// -/// If the caller is not in secure computing mode, this returns [`SecureComputingMode::Disabled`]. -/// If the caller is in strict secure computing mode, then this call will cause a `SIGKILL` signal -/// to be sent to the process. -/// If the caller is in filter mode, and this system call is allowed by the seccomp filters, -/// it returns [`SecureComputingMode::Filter`]; otherwise, the process is killed with -/// a `SIGKILL` signal. -/// -/// Since Linux 3.8, the Seccomp field of the `/proc/[pid]/status` file provides a method -/// of obtaining the same information, without the risk that the process is killed; see `proc(5)`. +/// If the caller is not in secure computing mode, this returns +/// [`SecureComputingMode::Disabled`]. If the caller is in strict secure +/// computing mode, then this call will cause a [`Signal::Kill`] signal to be +/// sent to the process. If the caller is in filter mode, and this system call +/// is allowed by the seccomp filters, it returns +/// [`SecureComputingMode::Filter`]; otherwise, the process is killed with +/// a [`Signal::Kill`] signal. +/// +/// Since Linux 3.8, the Seccomp field of the `/proc/[pid]/status` file +/// provides a method of obtaining the same information, without the risk that +/// the process is killed; see [the `proc` manual page]. /// /// # References /// - [`prctl(PR_GET_SECCOMP,...)`] /// /// [`prctl(PR_GET_SECCOMP,...)`]: https://man7.org/linux/man-pages/man2/prctl.2.html +/// [the `proc` manual page]: https://man7.org/linux/man-pages/man5/proc.5.html #[inline] pub fn secure_computing_mode() -> io::Result<SecureComputingMode> { unsafe { prctl_1arg(PR_GET_SECCOMP) }.and_then(TryInto::try_into) diff --git a/vendor/rustix/src/time/clock.rs b/vendor/rustix/src/time/clock.rs index 1bf74d60b..2aa38b213 100644 --- a/vendor/rustix/src/time/clock.rs +++ b/vendor/rustix/src/time/clock.rs @@ -11,9 +11,19 @@ pub use backend::time::types::{ClockId, DynamicClockId}; /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html /// [Linux]: https://man7.org/linux/man-pages/man2/clock_getres.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_getres&sektion=2 +/// [NetBSD]: https://man.netbsd.org/clock_getres.2 +/// [OpenBSD]: https://man.openbsd.org/clock_getres.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_getres§ion=2 +/// [illumos]: https://illumos.org/man/3C/clock_getres #[cfg(not(any(target_os = "redox", target_os = "wasi")))] #[inline] #[must_use] @@ -31,9 +41,19 @@ pub fn clock_getres(id: ClockId) -> Timespec { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_gettime.html /// [Linux]: https://man7.org/linux/man-pages/man2/clock_gettime.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_getres&sektion=2 +/// [NetBSD]: https://man.netbsd.org/clock_getres.2 +/// [OpenBSD]: https://man.openbsd.org/clock_getres.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_getres§ion=2 +/// [illumos]: https://illumos.org/man/3C/clock_gettime #[cfg(not(target_os = "wasi"))] #[inline] #[must_use] @@ -64,9 +84,19 @@ pub fn clock_gettime_dynamic(id: DynamicClockId<'_>) -> io::Result<Timespec> { /// # References /// - [POSIX] /// - [Linux] +/// - [FreeBSD] +/// - [NetBSD] +/// - [OpenBSD] +/// - [DragonFly BSD] +/// - [illumos] /// /// [POSIX]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_settime.html /// [Linux]: https://man7.org/linux/man-pages/man2/clock_settime.2.html +/// [FreeBSD]: https://man.freebsd.org/cgi/man.cgi?query=clock_settime&sektion=2 +/// [NetBSD]: https://man.netbsd.org/clock_settime.2 +/// [OpenBSD]: https://man.openbsd.org/clock_settime.2 +/// [DragonFly BSD]: https://man.dragonflybsd.org/?command=clock_settime§ion=2 +/// [illumos]: https://illumos.org/man/3C/clock_settime #[cfg(not(any( target_os = "redox", target_os = "wasi", diff --git a/vendor/rustix/src/utils.rs b/vendor/rustix/src/utils.rs index dcbadb260..d6ad43b54 100644 --- a/vendor/rustix/src/utils.rs +++ b/vendor/rustix/src/utils.rs @@ -12,6 +12,26 @@ pub(crate) fn as_mut_ptr<T>(t: &mut T) -> *mut T { t } +/// Convert an `Option<&T>` into a possibly-null `*const T`. +#[inline] +#[allow(dead_code)] +pub(crate) const fn optional_as_ptr<T>(t: Option<&T>) -> *const T { + match t { + Some(t) => t, + None => core::ptr::null(), + } +} + +/// Convert an `Option<&mut T>` into a possibly-null `*mut T`. +#[inline] +#[allow(dead_code)] +pub(crate) fn optional_as_mut_ptr<T>(t: Option<&mut T>) -> *mut T { + match t { + Some(t) => t, + None => core::ptr::null_mut(), + } +} + /// Convert a `*mut c_void` to a `*mut T`, checking that it is not null, /// misaligned, or pointing to a region of memory that wraps around the address /// space. diff --git a/vendor/rustix/src/backend/linux_raw/weak.rs b/vendor/rustix/src/weak.rs index ae7d6832e..fae3ce058 100644 --- a/vendor/rustix/src/backend/linux_raw/weak.rs +++ b/vendor/rustix/src/weak.rs @@ -2,7 +2,7 @@ // library/std/src/sys/unix/weak.rs at revision // fd0cb0cdc21dd9c06025277d772108f8d42cb25f. -#![allow(unsafe_code)] +#![cfg_attr(linux_raw, allow(unsafe_code))] //! Support for "weak linkage" to symbols on Unix //! @@ -40,8 +40,8 @@ const INVALID: *mut c_void = 1 as *mut c_void; macro_rules! weak { ($vis:vis fn $name:ident($($t:ty),*) -> $ret:ty) => ( #[allow(non_upper_case_globals)] - $vis static $name: $crate::backend::weak::Weak<unsafe extern fn($($t),*) -> $ret> = - $crate::backend::weak::Weak::new(concat!(stringify!($name), '\0')); + $vis static $name: $crate::weak::Weak<unsafe extern fn($($t),*) -> $ret> = + $crate::weak::Weak::new(concat!(stringify!($name), '\0')); ) } |