about summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
2020-09-02Update docs of OpenOptions::as_flagsFederico Ponzi-3/+3
2020-08-31Update OpenOptions::as_flags docs, and minor stylingFederico Ponzi-9/+9
2020-08-31Merge branch 'convert-openoptions-cint' of github.com:FedericoPonzi/rust ↵Federico Ponzi-1/+0
into convert-openoptions-cint
2020-08-31Add as_flag function to the OpenOptionsExt structFederico Ponzi-7/+35
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-1182/+1160
Also doing fmt inplace as requested.
2020-08-30Fix typo get openoptions function nameFederico Ponzi-1/+1
Co-authored-by: Ivan Tham <pickfire@riseup.net>
2020-08-30initial implementation of OpenOptions to c_intFederico Ponzi-0/+7
2020-08-30Rollup merge of #75990 - rylev:arm-fastfail, r=alexcrichtonDylan DPC-3/+13
Add __fastfail for Windows on arm/aarch64 Fixes #73215
2020-08-30Rollup merge of #75832 - kofls:intradoc-fix, r=jyn514Dylan DPC-25/+2
Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs… …, primitive_docs.rs & poison.rs Partial fix for #75080 r? @jyn514
2020-08-29Explicitly look for 'thumb-mode' before using __fastfail on 'arm'Ryan Levick-1/+1
2020-08-28Back to opcode for 32 bit ARM __fastfailRyan Levick-1/+1
2020-08-28Switch to asm! macro and use brk instruction on ARMRyan Levick-3/+3
2020-08-27Add __fastfail for Windows on arm/aarch64Ryan Levick-3/+13
2020-08-27Rollup merge of #75758 - bpangWR:master, r=Mark-SimulacrumDylan DPC-14/+5
Fixes for VxWorks r? @alexcrichton
2020-08-26Move to intra-doc links for wasi/ext/fs.rs, os_str_bytes.rs, ↵Surya Midatala-25/+2
primitive_docs.rs & poison.rs
2020-08-25For VxWorks:Pang, Baoshan-14/+5
fix building errors use wr-c++ as linker
2020-08-25Auto merge of #75364 - rylev:libpanic-abort-failfast, r=alexcrichtonbors-8/+4
Call into fastfail on abort in libpanic_abort on Windows x86(_64) This partially resolves #73215 though this is only for x86 targets. This code is directly lifted from [libstd](https://github.com/rust-lang/rust/blob/13290e83a6e20f3b408d177a9d64d8cf98fe4615/library/std/src/sys/windows/mod.rs#L315). `__fastfail` is the preferred way to abort a process on Windows as it will hook into debugger toolchains. Other platforms expose a `_rust_abort` symbol which wraps `std::sys::abort_internal`. This would also work on Windows, but is a slightly largely change as we'd need to make sure that the symbol is properly exposed to the linker. I'm inlining the call to the `__fastfail`, but the indirection through `rust_abort` might be a cleaner approach. A different instruction must be used on ARM architectures. I'd like to verify this works first before tackling ARM.
2020-08-21Make raw standard stream constructors constTomasz Miąsko-27/+27
2020-08-21Remove result type from raw standard streams constructorsTomasz Miąsko-61/+61
Raw standard streams constructors are infallible. Remove unnecessary result type.
2020-08-21Add `#![allow(unsafe_op_in_unsafe_fn)]` in sys/hermitmaekawatoshiki-0/+17
2020-08-21Revert "`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit"maekawatoshiki-147/+75
This reverts commit 7cae9e8c88e468e94c157d9aaee4b8e3cf90b9a4.
2020-08-19Enable stack-overflow detection on musl for non-main threadsTomasz Miąsko-6/+21
2020-08-19resolve commentsPrabakaran Kumaresshan-11/+0
2020-08-19Switch to intra-doc links in /src/sys/unix/ext/*.rsPrabakaran Kumaresshan-74/+35
2020-08-16Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rsPrabakaran Kumaresshan-34/+8
2020-08-15inline linkingPrabakaran Kumaresshan-6/+2
2020-08-15remove empty linesPrabakaran Kumaresshan-7/+0
2020-08-15resolve commentsPrabakaran Kumaresshan-16/+8
2020-08-15Switch to intra-doc links in std/src/sys/vxworks/ext/{fs,process}.rsPrabakaran Kumaresshan-19/+19
2020-08-15std/sys/unix/time: make it easier for LLVM to optimize `Instant` subtraction.Eduard-Mihai Burtescu-8/+20
2020-08-14perform copy_file_range until EOF is reached instead of basing things on ↵The8472-3/+12
file size This solves several problems - race conditions where a file is truncated while copying from it. if we blindly trusted the file size this would lead to an infinite loop - proc files appearing empty to copy_file_range but not to read/write https://github.com/coreutils/coreutils/commit/4b04a0c - copy_file_range returning 0 for some filesystems (overlay? bind mounts?) inside docker, again leading to an infinite loop
2020-08-13Rollup merge of #75189 - kawamuray:bugfix-wasi-append, r=KodrAusYuki Okushi-3/+5
Fix wasi::fs::OpenOptions to imply write when append is on This PR fixes a bug in `OpenOptions` of `wasi` platform that it currently doesn't imply write mode when only `append` is enabled. As explained in the [doc of OpenOptions#append](https://doc.rust-lang.org/std/fs/struct.OpenOptions.html#method.append), calling `.append(true)` should imply `.write(true)` as well. ## Reproduce Given below simple Rust program: ```rust use std::fs::OpenOptions; use std::io::Write; fn main() { let mut file = OpenOptions::new() .write(true) .create(true) .open("foo.txt") .unwrap(); writeln!(file, "abc").unwrap(); } ``` it can successfully compiled into wasm and execute by `wasmtime` runtime: ```sh $ rustc --target wasm32-wasi write.rs $ ~/wasmtime/target/debug/wasmtime run --dir=. write.wasm $ cat foo.txt abc ``` However when I change `.write(true)` to `.append(true)`, it fails to execute by the error "Capabilities insufficient": ```sh $ ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 76, kind: Other, message: "Capabilities insufficient" }', append.rs:10:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Error: failed to run main module `append.wasm` ... ``` This is because of lacking "rights" on the opened file: ```sh $ RUST_LOG=trace ~/wasmtime/target/debug/wasmtime run --dir=. append.wasm 2>&1 | grep validate_rights TRACE wasi_common::entry > | validate_rights failed: required rights = HandleRights { base: fd_write (0x40), inheriting: empty (0x0) }; actual rights = HandleRights { base: fd_seek|fd_fdstat_set_flags|fd_sync|fd_tell|fd_advise|fd_filestat_set_times|poll_fd_readwrite (0x88000bc), inheriting: empty (0x0) } ```
2020-08-12more concise error matchingThe8472-8/+4
2020-08-12Workaround for copy_file_range spuriously returning EOPNOTSUPP when attemted ↵The8472-2/+4
on a NFS mount under RHEL/CentOS 7. The syscall is supposed to return ENOSYS in most cases but when calling it on NFS it may leak through EOPNOTSUPP even though that's supposed to be handled by the kernel and not returned to userspace. Since it returns ENOSYS in some cases anyway this will trip the HAS_COPY_FILE_RANGE detection anyway, so treat EOPNOTSUPP as if it were a ENOSYS. https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/7.8_release_notes/deprecated_functionality#the_literal_copy_file_range_literal_call_has_been_disabled_on_local_file_systems_and_in_nfs https://bugzilla.redhat.com/show_bug.cgi?id=1783554
2020-08-10Reverse formattingRyan Levick-5/+1
2020-08-10Fix up docsRyan Levick-9/+9
2020-08-09Rollup merge of #74842 - hermitcore:thread_local, r=Mark-SimulacrumYuki Okushi-2/+2
adjust remaining targets - fix commit 7dc3886 - previous commit doesn't adjust all targets
2020-08-08Auto merge of #74289 - lzutao:unroll, r=LukasKalbertodtbors-28/+13
Remove some redundant parts from `unrolled_find_u16s` See each commit message for details. r? @wesleywiser from old PR #67705 .
2020-08-06Keep stdout open in limit_vector_count testTomasz Miąsko-2/+2
2020-08-05Add fallback for cfg(unix) targets that do not define libc::_SC_IOV_MAX.Adam Reichold-0/+7
2020-08-05Rely only on POSIX semantics for I/O vector countAdam Reichold-17/+3
All #[cfg(unix)] platforms follow the POSIX standard and define _SC_IOV_MAX so that we rely purely on POSIX semantics to determine the limits on I/O vector count.
2020-08-05Reduce synchronization overhead of I/O vector count memoizationAdam Reichold-10/+14
2020-08-05Memoize the I/O vector count limitAdam Reichold-12/+17
Keep the I/O vector count limit in a `SyncOnceCell` to avoid the overhead of repeatedly calling `sysconf` as these limits are guaranteed to not change during the lifetime of a process by POSIX.
2020-08-05Query maximum vector count on Linux and macOSAdam Reichold-2/+36
Both Linux and MacOS enforce limits on the vector count when performing vectored I/O via the readv and writev system calls and return EINVAL when these limits are exceeded. This changes the standard library to handle those limits as short reads and writes to avoid forcing its users to query these limits using platform specific mechanisms.
2020-08-05Fix wasi::fs::OpenOptions to imply write when append is onYuto Kawamura-3/+5
2020-07-31`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermitmaekawatoshiki-75/+147
2020-07-31Fix std::fs::File::metadata permission on WASI targetShen-Ta Hsieh-0/+1
Previously `std::fs::File::metadata` on wasm32-wasi would call `fd_filestat_get` to get metadata associated with fd, but that fd is opened without RIGHTS_FD_FILESTAT_GET right, so it will failed on correctly implemented WASI environment. This change instead to add the missing rights when opening an fd.
2020-07-28Update stdarch submoduleAlex Crichton-9/+9
This commit updates the src/stdarch submodule primarily to include rust-lang/stdarch#874 which updated and revamped WebAssembly SIMD intrinsics and renamed WebAssembly atomics intrinsics. This is all unstable surface area of the standard library so the changes should be ok here. The SIMD updates also enable SIMD intrinsics to be used by any program any any time, yay! cc #74372, a tracking issue I've opened for the stabilization of SIMD intrinsics
2020-07-28adjust remaining targetsStefan Lankes-2/+2
- fix commit 7dc3886 - previous commit doesn't adjust all targets
2020-07-28Get pointer from address of c directlyLzu Tao-2/+2