summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2018-04-24Auto merge of #50079 - NickAtAccuPS:android_abstract_socket, r=sfacklerbors-1/+4
Android abstract unix domain sockets AddressKind correction The prior check causes abstract unix domain sockets to return AddressKind::Unnamed instead of AddressKind::Abstract on Android. Other than the immediately proceeding comment "macOS seems to return a len of 16 and a zeroed sun_path for unnamed addresses" the check as-implemented does not seem to have alternative explanation. I couldn't find an alternative explanation while stepping though git blame. I suspect the AddressKind::Unnamed nonzero check should instead be if macos, length 16, and zeroed array. @sfackler could you comment on this, the code as-is is the same from your initial addition of abstract uds support.
2018-04-24Rollup merge of #49829 - ecstatic-morse:os-docs, r=steveklabnikkennytm-47/+96
Add doc links to `std::os` extension traits Addresses a small subset of #29367. This adds documentation links to the original type for various OS-specific extension traits, and uses a common sentence for introducing such traits (which now consistently ends in a period).
2018-04-19Rustfmt result (for relevant changes) to satisfy Travis line length check.Nicholas Rishel-1/+4
Signed-off-by: Nicholas Rishel <nick@accups.com>
2018-04-19The prior check causes abstract unix domain sockets to return unnamed on ↵Nicholas Rishel-1/+1
Android. Signed-off-by: Nicholas Rishel <nick@accups.com>
2018-04-16Auto merge of #49488 - alexcrichton:small-wasm-panic, r=sfacklerbors-2/+22
std: Minimize size of panicking on wasm This commit applies a few code size optimizations for the wasm target to the standard library, namely around panics. We notably know that in most configurations it's impossible for us to print anything in wasm32-unknown-unknown so we can skip larger portions of panicking that are otherwise simply informative. This allows us to get quite a nice size reduction. Finally we can also tweak where the allocation happens for the `Box<Any>` that we panic with. By only allocating once unwinding starts we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2018-04-17Rollup merge of #49646 - glandium:uninitialized-box, r=alexcrichtonkennytm-1/+1
Use box syntax instead of Box::new in Mutex::remutex on Windows The Box::new(mem::uninitialized()) pattern actually actively copies uninitialized bytes from the stack into the box, which is a waste of time. Using the box syntax instead avoids the useless copy.
2018-04-17Rollup merge of #49606 - varkor:pipe-repair, r=alexcrichtonkennytm-2/+2
Prevent broken pipes causing ICEs As the private `std::io::print_to` panics if there is an I/O error, which is used by `println!`, the compiler would ICE if one attempted to use a broken pipe (e.g. `rustc --help | false`). This introduces a new (private) macro `try_println!` which allows us to avoid this. As a side note, it seems this macro might be useful publicly (and actually there seems to be [a crate specifically for this purpose](https://crates.io/crates/try_print/)), though that can probably be left for a future discussion. One slight alternative approach would be to simply early exit without an error (i.e. exit code `0`), which [this comment](https://github.com/rust-lang/rust/issues/34376#issuecomment-377822526) suggests is the usual approach. I've opted not to take that approach initially, because I think it's more helpful to know when there is a broken pipe. Fixes #34376.
2018-04-14Prefer unprefixed paths for well known structsDylan MacKenzie-23/+23
2018-04-14Add doc links to `std::os` extension traitsDylan MacKenzie-51/+100
Add documentation links to the original type for various OS-specific extension traits and normalize the language for introducing such traits. Also, remove some outdated comments around the extension trait definitions.
2018-04-13std: Minimize size of panicking on wasmAlex Crichton-2/+22
This commit applies a few code size optimizations for the wasm target to the standard library, namely around panics. We notably know that in most configurations it's impossible for us to print anything in wasm32-unknown-unknown so we can skip larger portions of panicking that are otherwise simply informative. This allows us to get quite a nice size reduction. Finally we can also tweak where the allocation happens for the `Box<Any>` that we panic with. By only allocating once unwinding starts we can reduce the size of a panicking wasm module from 44k to 350 bytes.
2018-04-12Import the `alloc` crate as `alloc_crate` in stdSimon Sapin-6/+6
… to make the name `alloc` available.
2018-04-12Move Utf8Lossy decoder to libcoreSimon Sapin-3/+3
2018-04-11Prevent EPIPE causing ICEs in rustc and rustdocvarkor-2/+2
2018-04-07Rollup merge of #49702 - alexcrichton:inline-methods, r=Mark-Simulacrumkennytm-0/+2
std: Inline some Termination-related methods These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
2018-04-05Rollup merge of #49686 - memoryleak47:typo, r=alexcrichtonAlex Crichton-1/+1
typos
2018-04-05std: Inline some Termination-related methodsAlex Crichton-0/+2
These were showing up in tests and in binaries but are trivially optimize-able away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them out.
2018-04-05typosmemoryleak47-1/+1
2018-04-05Rollup merge of #49637 - tmccombs:parent-id-stabilize, r=sfacklerkennytm-1/+1
Stabilize parent_id() Fixes #46104
2018-04-04Use box syntax instead of Box::new in Mutex::remutex on WindowsMike Hommey-1/+1
The Box::new(mem::uninitialized()) pattern actually actively copies uninitialized bytes from the stack into the box, which is a waste of time. Using the box syntax instead avoids the useless copy.
2018-04-04Auto merge of #48575 - ishitatsuyuki:unix-no-thread, r=alexcrichtonbors-10/+42
rustc_driver: get rid of the extra thread **Do not rollup** We can alter the stack size afterwards on Unix. Having a separate thread causes poor debugging experience when interrupting with signals. I have to get the backtrace of the all thread, as the main thread is waiting to join doing nothing else. This patch allows me to just run `bt` to get the desired backtrace.
2018-04-03Stabilize parent_id()Thayne McCombs-1/+1
Fixes #46104
2018-04-03Fix importsTatsuyuki Ishi-1/+1
2018-03-28Auto merge of #49460 - kennytm:rollup, r=kennytmbors-0/+20
Rollup of 12 pull requests - Successful merges: #49243, #49329, #49364, #49400, #49405, #49427, #49428, #49429, #49439, #49442, #49444, #49452 - Failed merges:
2018-03-28Auto merge of #49357 - frewsxcv:frewsxcv-termination-doc-examples, ↵bors-238/+240
r=GuillaumeGomez Remove hidden `foo` functions from doc examples; use `Termination` trait. Fixes https://github.com/rust-lang/rust/issues/49233. Easier to review with the white-space ignoring `?w=1` feature: https://github.com/rust-lang/rust/pull/49357/files?w=1
2018-03-28Rollup merge of #49400 - Diggsey:shrink-to, r=joshtriplettkennytm-0/+20
Implement `shrink_to` method on collections Fixes #49385
2018-03-28Remove hidden `foo` functions from doc examples; use `Termination` trait.Corey Farwell-238/+240
Fixes https://github.com/rust-lang/rust/issues/49233.
2018-03-28Use mprotect instead of mmapTatsuyuki Ishi-3/+2
2018-03-27Implement `shrink_to` method on collectionsDiggory Blake-0/+20
2018-03-25Use a more conservative way to deinit stack guardTatsuyuki Ishi-5/+15
2018-03-25Auto merge of #49315 - TheDan64:smaller_unsafe_block, r=joshtriplettbors-7/+5
Reduce scope of unsafe block in sun_path_offset I reduced the scope of the unsafe block to the `uninitialized` call which is the only actual unsafe bit.
2018-03-24Fix build on non-Unix platformsTatsuyuki Ishi-0/+5
2018-03-23Reduce scope of unsafe block in sun_path_offsetDaniel Kolsoi-7/+5
2018-03-23Rollup merge of #48624 - bdrewery:freebsd-posix-spawn, r=alexcrichtonAlex Crichton-28/+159
Command: Support posix_spawn() on FreeBSD/OSX/GNU Linux
2018-03-22Command::env_saw_path() may be unused on platforms not using posix_spawn()Bryan Drewery-0/+1
2018-03-21Deprecate the AsciiExt trait in favor of inherent methodsSimon Sapin-1/+0
The trait and some of its methods are stable and will remain. Some of the newer methods are unstable and can be removed later. Fixes https://github.com/rust-lang/rust/issues/39658
2018-03-20Refactor the stack addr aligning code into a functionTatsuyuki Ishi-16/+16
2018-03-19Don't use posix_spawn() if PATH was modified in the environment.Bryan Drewery-0/+4
The expected behavior is that the environment's PATH should be used to find the process. posix_spawn() could be used if we iterated PATH to search for the binary to execute. For now just skip posix_spawn() if PATH is modified.
2018-03-19Merge branch 'update-beta-freebsd' into freebsd-posix-spawnBryan Drewery-13/+188
2018-03-19Address review commentsTatsuyuki Ishi-1/+19
2018-03-06Rollup merge of #48618 - scottmcm:elaborate-exitcode, r=alexcrichtonAlex Crichton-3/+64
Better docs and associated SUCCESS/FAILURE for process::ExitCode Follow-up to https://github.com/rust-lang/rust/pull/48497#discussion_r170676525, since that PR was the minimal thing to unblock https://github.com/rust-lang/rust/issues/48453#issuecomment-368155082. r? @nikomatsakis
2018-03-03Move process::ExitCode internals to sysScott McMurray-3/+64
Now begins the saga of fixing compilation errors on other platforms...
2018-03-02Rollup merge of #48328 - frewsxcv:frewsxcv-clarify-error-zero-duration, ↵Manish Goregaokar-6/+65
r=sfackler Fixes #47311. r? @nrc
2018-03-02Support posix_spawn() for Linux glibc 2.24+.Bryan Drewery-2/+16
The relevant support was added in https://sourceware.org/bugzilla/show_bug.cgi?id=10354#c12
2018-03-02Move glibc version lookup handling to sys::os and add a simpler glibc_version()Bryan Drewery-28/+37
2018-03-02Use _Bryan Drewery-1/+1
2018-03-01Add comment explaining when posix_spawn() can be supported.Bryan Drewery-0/+2
2018-03-01posix_spawn() on OSX supports returning ENOENT.Bryan Drewery-2/+2
2018-02-28posix_spawn() always returns its error rather than setting errno.Bryan Drewery-1/+1
2018-02-28Support posix_spawn() for FreeBSD.Bryan Drewery-2/+2
spawn() is expected to return an error if the specified file could not be executed. FreeBSD's posix_spawn() supports returning ENOENT/ENOEXEC if the exec() fails, which not all platforms support. This brings a very significant performance improvement for FreeBSD, involving heavy use of Command in threads, due to fork() invoking jemalloc fork handlers and causing lock contention. FreeBSD's posix_spawn() avoids this problem due to using vfork() internally.
2018-02-28Remove excess newlineBryan Drewery-1/+0