summary refs log tree commit diff
path: root/library/std/src/sys
AgeCommit message (Collapse)AuthorLines
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-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-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-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-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
2020-07-28Make use of macro to avoid repetitionLzu Tao-23/+10
2020-07-28Remove redundant len bindingLzu Tao-3/+1
2020-07-27mv std libs to library/mark-0/+41827