about summary refs log tree commit diff
path: root/src/libstd/sys/unix/fs.rs
AgeCommit message (Collapse)AuthorLines
2020-07-27mv std libs to library/mark-1310/+0
2020-07-21Remove Linux workarounds for missing CLOEXEC supportJosh Stone-50/+1
Now that #74163 updated the minimum Linux kernel to 2.6.32, we can assume the availability of APIs that open file descriptors that are already set to close on exec, including the flags `O_CLOEXEC`, `SOCK_CLOEXEC`, and `F_DUPFD_CLOEXEC`.
2020-06-10Migrate to numeric associated constsLzu Tao-1/+1
2020-05-05explain the types used in the open64 callRalf Jung-0/+4
2020-04-26Update nameSteven Fackler-4/+4
2020-04-26Add Read/Write::can_read/write_vectoredSteven Fackler-0/+10
When working with an arbitrary reader or writer, code that uses vectored operations may end up being slower than code that copies into a single buffer when the underlying reader or writer doesn't actually support vectored operations. These new methods allow you to ask the reader or witer up front if vectored operations are efficiently supported. Currently, you have to use some heuristics to guess by e.g. checking if the read or write only accessed the first buffer. Hyper is one concrete example of a library that has to do this dynamically: https://github.com/hyperium/hyper/blob/0eaf304644a396895a4ce1f0146e596640bb666a/src/proto/h1/io.rs#L582-L594
2020-04-14Add illumos triplePatrick Mooney-6/+28
Co-Authored-By: Jason King <jason.brian.king@gmail.com> Co-Authored-By: Joshua M. Clulow <jmc@oxide.computer>
2020-01-08Try statx for all linux-gnu targetsoxalica-28/+6
2020-01-06Auto merge of #66899 - msizanoen1:riscv-std, r=alexcrichtonbors-0/+2
Standard library support for riscv64gc-unknown-linux-gnu Add std support for RISC-V 64-bit GNU/Linux and update libc for RISC-V support. r? @alexcrichton
2020-01-02Use drop instead of the toilet closure `|_| ()`Lzu Tao-1/+1
2020-01-01Add support for RISC-V 64-bit GNU/Linuxmsizanoen1-0/+2
2019-12-22Format the worldMark Rousskov-210/+243
2019-11-26Fix spelling typosBrian Wignall-2/+2
2019-10-26Auto merge of #65167 - hermitcore:rusty-hermit, r=alexcrichtonbors-5/+3
Redesign the interface to the unikernel HermitCore We are developing the unikernel HermitCore, where the kernel is written in Rust and is already part of the Rust Standard Library. The interface between the standard library and the kernel based on a small C library. With this pull request, we remove completely the dependency to C and use lld as linker. Currently, the kernel will be linked to the application as static library, which is published at https://github.com/hermitcore/libhermit-rs. We don’t longer support the C interface to the kernel. Consequently, we remove this part from the Rust Standard Library.
2019-10-23Some tweaksoxalica-49/+44
2019-10-22Merge branch 'master' into rusty-hermitStefan Lankes-2/+0
2019-10-22Fix check of `statx`oxalica-16/+34
2019-10-20Merge branch 'master' into rusty-hermitStefan Lankes-10/+217
2019-10-20Auto merge of #65469 - mati865:libc, r=alexcrichtonbors-2/+0
Update libc to 0.2.64 Passed local tests. cc potentially interested people: @gnzlbg @tlively
2019-10-18Fix cast of stx_btime.tv_nsecoxalica-1/+1
2019-10-18Fix cfgs for current libcoxalica-89/+139
2019-10-18Prefer statx on linux if availableoxalica-7/+164
2019-10-17Update emscripten functions declarationsMateusz Mikuła-2/+0
2019-10-06redesign of the interface to the unikernel HermitCoreStefan Lankes-5/+3
- the old interface between HermitCore and the Rust Standard Library based on a small C library (newlib) - remove this interface and call directly the unikernel - remove the dependency to the HermitCore linker - use rust-lld as linker
2019-08-08Rollup merge of #63332 - marmistrz:truncate, r=alexcrichtonMazdak Farrokhzad-3/+9
Add an overflow check in truncate implementation for Unix. Closes #63326. cc @alexcrichton
2019-08-08Move the TryInto import into the inner scopeMarcin Mielniczuk-1/+1
2019-08-06redox: convert to target_family unixJeremy Soller-6/+9
2019-08-06Add an overflow check in truncate implementation for Unix.Marcin Mielniczuk-3/+9
2019-05-13Remove bitrig support from rustMarcel Hellwig-7/+3
2019-05-02Make `std::fs::copy` attempt to create copy-on-write clones of files on MacOS.Edward Barnard-19/+69
2019-04-27Stabilized vectored IOSteven Fackler-3/+3
This renames `std::io::IoVec` to `std::io::IoSlice` and `std::io::IoVecMut` to `std::io::IoSliceMut`, and stabilizes `std::io::IoSlice`, `std::io::IoSliceMut`, `std::io::Read::read_vectored`, and `std::io::Write::write_vectored`. Closes #58452
2019-04-19Fix sync_all on macos/iosDavid Vázquez Púa-2/+9
sync_all should flush all metadata in macos/ios, so it should call fcntl with the F_FULLFSYNC flag as sync_data does. Fixes #55920
2019-04-10std: Add `{read,write}_vectored` for more typesAlex Crichton-1/+9
This commit implements the `{read,write}_vectored` methods on more types in the standard library, namely: * `std::fs::File` * `std::process::ChildStd{in,out,err}` * `std::io::Std{in,out,err}` * `std::io::Std{in,out,err}Lock` * `std::io::Std{in,out,err}Raw` Where supported the OS implementations hook up to native support, otherwise it falls back to the already-defaulted implementation.
2019-04-03wasi: Fill out `std::fs` module for WASIAlex Crichton-21/+2
This commit fills out the `std::fs` module and implementation for WASI. Not all APIs are implemented, such as permissions-related ones and `canonicalize`, but all others APIs have been implemented and very lightly tested so far. We'll eventually want to run a more exhaustive test suite! For now the highlights of this commit are: * The `std::fs::File` type is now backed by `WasiFd`, a raw WASI file descriptor. * All APIs in `std::fs` (except permissions/canonicalize) have implementations for the WASI target. * A suite of unstable extension traits were added to `std::os::wasi::fs`. These traits expose the raw filesystem functionality of WASI, namely `*at` syscalls (opening a file relative to an already opened one, for example). Additionally metadata only available on wasi is exposed through these traits. Perhaps one of the most notable parts is the implementation of path-taking APIs. WASI actually has no fundamental API that just takes a path, but rather everything is relative to a previously opened file descriptor. To allow existing APIs to work (that only take a path) WASI has a few syscalls to learn about "pre opened" file descriptors by the runtime. We use these to build a map of existing directory names to file descriptors, and then when using a path we try to anchor it at an already-opened file. This support is very rudimentary though and is intended to be shared with C since it's likely to be so tricky. For now though the C library doesn't expose quite an API for us to use, so we implement it for now and will swap it out as soon as one is available.
2019-03-31libstd: deny(elided_lifetimes_in_paths)Mazdak Farrokhzad-2/+2
2019-03-23fs::copy() set file mode earlyHarald Hoyer-55/+74
A convenience method like fs::copy() should try to prevent pitfalls a normal user doesn't think about. In case of an empty umask, setting the file mode early prevents temporarily world readable or even writeable files, because the default mode is 0o666. In case the target is a named pipe or special device node, setting the file mode can lead to unwanted side effects, like setting permissons on `/dev/stdout` or for root setting permissions on `/dev/null`. copy_file_range() returns EINVAL, if the destination is a FIFO/pipe or a device like "/dev/null", so fallback to io::copy, too. Use `fcopyfile` on MacOS instead of `copyfile`. Fixes: https://github.com/rust-lang/rust/issues/26933 Fixed: https://github.com/rust-lang/rust/issues/37885
2019-03-04Change `std::fs::copy` to use `copyfile` on MacOS and iOSEdward Barnard-1/+86
2019-02-28libstd => 2018Taiki Endo-24/+28
2018-12-25Remove licensesMark Rousskov-10/+0
2018-11-06refactor: use shorthand fieldsteresy-4/+4
2018-08-19Fix typos found by codespell.Matthias Krüger-1/+1
2018-07-30Add targets for HermitCore (https://hermitcore.org) to the Rust compiler and ↵Colin Finck-4/+6
port libstd to it. As a start, the port uses the simplest possible configuration (no jemalloc, abort on panic) and makes use of existing Unix-specific code wherever possible. It adds targets for x86_64 (current main HermitCore platform) and aarch64 (HermitCore platform under development). Together with the patches to "liblibc" and "llvm", this enables HermitCore applications to be written in Rust.
2018-06-26Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-SimulacrumPietro Albini-2/+2
Remove unnecessary stat64 pointer casts In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2018-06-26Auto merge of #50630 - sharkdp:fix-50619, r=sfacklerbors-7/+24
Fix possibly endless loop in ReadDir iterator Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
2018-06-25Remove unnecessary stat64 pointer castsJosh Stone-2/+2
In effect, these just casted `&mut stat64` to `*mut stat64`, twice. That's harmless, but it masked a problem when this was copied to new code calling `fstatat`, which takes a pointer to `struct stat`. That will be fixed by #51785, but let's remove the unnecessary casts here too.
2018-06-25Use fstatat64 where availableJosh Stone-6/+5
2018-06-12Fix possibly endless loop in ReadDir iteratorsharkdp-7/+24
Certain directories in `/proc` can cause the `ReadDir` iterator to loop indefinitely. We get an error code (22) when calling libc's `readdir_r` on these directories, but `entry_ptr` is `NULL` at the same time, signalling the end of the directory stream. This change introduces an internal state to the iterator such that the `Some(Err(..))` value will only be returned once when calling `next`. Subsequent calls will return `None`. fixes #50619
2018-06-01fs: copy: Add EPERM to fallback error conditionsNicolas Koch-5/+12
Fixes #51266
2018-05-31Rollup merge of #51213 - nicokoch:copy_permissions, r=cramertjGuillaume Gomez-5/+5
fs: copy: Use File::set_permissions instead of fs::set_permissions We already got the open file descriptor at this point. Don't make the kernel resolve the path again.
2018-05-31libstd/sys/unix/fs.rs: fix compilation on fuchsiaGuillaume Girol-1/+1