about summary refs log tree commit diff
path: root/src/libstd/sys/unix
AgeCommit message (Collapse)AuthorLines
2019-10-05Revert "Auto merge of #63649 - tlively:emscripten-upstream-upgrade, ↵Tyler Mandry-2/+1
r=alexcrichton" This reverts commit 7870050796e5904a0fc85ecbe6fa6dde1cfe0c91, reversing changes made to 2e7244807a7878f6eca3eb7d97ae9b413aa49014.
2019-10-04Upgrade Emscripten targets to use upstream LLVM backendThomas Lively-1/+2
- Refactors the Emscripten target spec to share code with other wasm targets. - Replaces the incorrect wasm32 C call ABI with the old asmjs version, which is correct for both wasm32 and JS. - Updates the varargs ABI used by Emscripten and deletes the old one. - Removes the obsolete wasm32-experimental-emscripten target. - Temporarily makes Emscripten targets use panic=abort by default because supporting unwinding will require an LLVM patch.
2019-09-25Fix ExitStatus on FuchsiaTyler Mandry-75/+93
Fuchsia exit codes don't follow the convention of libc::WEXITSTATUS et al, and they are 64 bits instead of 32 bits. This gives Fuchsia its own representation of ExitStatus. Additionally, the zircon syscall structs were out of date, causing us to see bogus return codes.
2019-09-07Rollup merge of #64023 - tmandry:libstd-fuchsia-fixes, r=cramertjMazdak Farrokhzad-27/+76
libstd fuchsia fixes This fixes two bugs in libstd on Fuchsia: - `zx_time_t` was changed to an `i64`, but this never made it into libstd - When spawning processes where any of the stdio were null, libstd attempts to open `/dev/null`, which doesn't exist on Fuchsia r? @cramertj
2019-09-06Rollup merge of #64198 - cramertj:fuchsia-monotonic, r=alexcrichtonMazdak Farrokhzad-0/+1
Add Fuchsia to actually_monotonic Fuchsia provides a fully monotonic clock. Fix https://github.com/rust-lang/rust/issues/64196 cc @joshlf @tmandry r? @alexcrichton
2019-09-05Add Fuchsia to actually_monotonicTaylor Cramer-0/+1
Fuchsia provides a fully monotonic clock.
2019-09-05std: Improve downstream codegen in `Command::env`Alex Crichton-4/+5
This commit rejiggers the generics used in the implementation of `Command::env` with the purpose of reducing the amount of codegen that needs to happen in consumer crates, instead preferring to generate code into libstd. This was found when profiling the compile times of the `cc` crate where the binary rlib produced had a lot of `BTreeMap` code compiled into it but the crate doesn't actually use `BTreeMap`. It turns out that `Command::env` is generic enough to codegen the entire implementation in calling crates, but in this case there's no performance concern so it's fine to compile the code into the standard library. This change is done by removing the generic on the `CommandEnv` map which is intended to handle case-insensitive variables on Windows. Instead now a generic isn't used but rather a `use` statement defined per-platform is used. With this commit a debug build of `Command::new("foo").env("a", "b")` drops from 21k lines of LLVM IR to 10k.
2019-08-30fuchsia: Fix default environment behavior when spawningTyler Mandry-2/+5
2019-08-30fuchsia: Don't fail to spawn if no stdin existsTyler Mandry-22/+41
2019-08-30Don't try to use /dev/null on FuchsiaTyler Mandry-9/+36
2019-08-29Update zx_time_t to an i64Tyler Mandry-3/+3
2019-08-23Auto merge of #63521 - newpavlov:redox_builder, r=pietroalbinibors-13/+12
Re-enable Redox builder (take 2) Closes: #63160
2019-08-19Consolidate sigemptyset workaroundsJoe Richey-40/+27
In sys/unix/process, we work around the sigemptyset linking issues on android in two different ways. This change consolidates these workarounds, and avoids duplicating bindings from `libc`.
2019-08-19remove any from cfgsArtyom Pavlov-2/+2
2019-08-19cfg fix 2Artyom Pavlov-1/+2
2019-08-19fix cfgArtyom Pavlov-11/+9
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-06Fix cfg_if usageJeremy Soller-2/+2
2019-08-06redox: convert to target_family unixJeremy Soller-32/+92
2019-08-06Add an overflow check in truncate implementation for Unix.Marcin Mielniczuk-3/+9
2019-08-03Add {IoSlice, IoSliceMut}::advanceThomas de Zeeuw-0/+24
2019-08-02Auto merge of #62309 - jlevon:62302, r=alexcrichtonbors-1/+14
provide thread name to OS for Solarish systems Fixes #62302 Passes a Linux bootstrap build. python x.py test src/tools/tidy happy. I tested this with a small test binary that spawns a few threads, and verified that: - on an illumos system lacking the libc function, the binary runs but no OS-level thread names are set - on an illumos system with the feature, the binary runs, and the thread names are visible and correct under tools like MDB, pstack, core dump, etc.
2019-08-02provide thread name to OS for Solarish systemsJohn Levon-1/+14
2019-08-01Remove mach dependencygnzlbg-5/+21
2019-08-01Update libc and use the Mach kernel APIs via the mach crate instead.gnzlbg-4/+5
2019-07-28Rollup merge of #62806 - mati865:clippy, r=TimNNMazdak Farrokhzad-2/+2
Fix few Clippy warnings
2019-07-26add repr(transparent) to IoSliceMut where missingNiv Kaminer-0/+1
2019-07-18Fix clippy::len_zero warningsMateusz Mikuła-1/+1
2019-07-18Fix clippy::clone_on_copy warningsMateusz Mikuła-1/+1
2019-07-11Rollup merge of #62425 - cyphar:linux-cloexec-use-fcntl, r=alexcrichtonMazdak Farrokhzad-0/+2
filedesc: don't use ioctl(FIOCLEX) on Linux All `ioctl(2)`s will fail on `O_PATH` file descriptors on Linux (because they use `&empty_fops` as a security measure against `O_PATH` descriptors affecting the backing file). As a result, `File::try_clone()` and various other methods would always fail with `-EBADF` on `O_PATH` file descriptors. The solution is to simply use `F_SETFD` (as is used on other unices) which works on `O_PATH` descriptors because it operates through the `fnctl(2)` layer and not through `ioctl(2)`s. Since this code is usually only used in strange error paths (a broken or ancient kernel), the extra overhead of one syscall shouldn't cause any dramas. Most other systems programming languages also use the fnctl(2) so this brings us in line with them. Fixes: rust-lang/rust#62314 Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-07-10filedesc: don't use ioctl(FIOCLEX) on LinuxAleksa Sarai-0/+2
All ioctl(2)s will fail on O_PATH file descriptors on Linux (because they use &empty_fops as a security measure against O_PATH descriptors affecting the backing file). As a result, File::try_clone() and various other methods would always fail with -EBADF on O_PATH file descriptors. The solution is to simply use F_SETFD (as is used on other unices) which works on O_PATH descriptors because it operates through the fnctl(2) layer and not through ioctl(2)s. Since this code is usually only used in strange error paths (a broken or ancient kernel), the extra overhead of one syscall shouldn't cause any dramas. Most other systems programming languages also use the fnctl(2) so this brings us in line with them. Fixes: rust-lang/rust#62314 Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-07-06Rollup merge of #62296 - RalfJung:memalign, r=alexcrichtonMazdak Farrokhzad-1/+9
request at least ptr-size alignment from posix_memalign Fixes https://github.com/rust-lang/rust/issues/62251
2019-07-03fix unused-import error on androidRalf Jung-2/+1
2019-07-02improve and deduplicate commentsRalf Jung-4/+3
2019-07-02request at least ptr-size alignment from posix_memalignRalf Jung-1/+11
2019-07-01Remove needless lifetimesJeremy Stucki-2/+2
2019-06-26Use pointer::write_bytes for android sigemptysetJosh Stone-5/+3
2019-06-26Avoid mem::uninitialized() in std::sys::unixJosh Stone-58/+57
For `libc` types that will be initialized in FFI calls, we can just use `MaybeUninit` and then pass around raw pointers. For `sun_path_offset()`, which really wants `offset_of`, all callers have a real `sockaddr_un` available, so we can use that reference.
2019-06-20Auto merge of #60341 - mtak-:macos-tlv-workaround, r=alexcrichtonbors-4/+0
macos tlv workaround fixes: #60141 Includes: * remove dead code: `requires_move_before_drop`. This hasn't been needed for a while now (oops I should have removed it in #57655) * redox had a copy of `fast::Key` (not sure why?). That has been removed. * Perform a `read_volatile` on OSX to reduce `tlv_get_addr` calls per `__getit` from (4-2 depending on context) to 1. `tlv_get_addr` is relatively expensive (~1.5ns on my machine). Previously, in contexts where `__getit` was inlined, 4 calls to `tlv_get_addr` were performed per lookup. For some reason when `__getit` is not inlined this is reduced to 2x - and performance improves to match. After this PR, I have only ever seen 1x call to `tlv_get_addr` per `__getit`, and macos now benefits from situations where `__getit` is inlined. I'm not sure if the `read_volatile(&&__KEY)` trick is working around an LLVM bug, or a rustc bug, or neither. r? @alexcrichton
2019-05-29Rollup merge of #61202 - oberien:permissionext-print-octal, r=varkorMazdak Farrokhzad-1/+1
Print PermissionExt::mode() in octal in Documentation Examples Printing the file permission mode on unix systems in decimal feels unintuitive. Printing it in octal gives the expected form of e.g. `664`.
2019-05-26Print file mode of PermissionExt in octal in Examplesoberien-1/+1
2019-05-25std: Depend on `backtrace` crate from crates.ioAlex Crichton-325/+0
This commit removes all in-tree support for generating backtraces in favor of depending on the `backtrace` crate on crates.io. This resolves a very longstanding piece of duplication where the standard library has long contained the ability to generate a backtrace on panics, but the code was later extracted and duplicated on crates.io with the `backtrace` crate. Since that fork each implementation has seen various improvements one way or another, but typically `backtrace`-the-crate has lagged behind libstd in one way or another. The goal here is to remove this duplication of a fairly critical piece of code and ensure that there's only one source of truth for generating backtraces between the standard library and the crate on crates.io. Recently I've been working to bring the `backtrace` crate on crates.io up to speed with the support in the standard library which includes: * Support for `StackWalkEx` on MSVC to recover inline frames with debuginfo. * Using `libbacktrace` by default on MinGW targets. * Supporting `libbacktrace` on OSX as an option. * Ensuring all the requisite support in `backtrace`-the-crate compiles with `#![no_std]`. * Updating the `libbacktrace` implementation in `backtrace`-the-crate to initialize the global state with the correct filename where necessary. After reviewing the code in libstd the `backtrace` crate should be at exact feature parity with libstd today. The backtraces generated should have the same symbols and same number of frames in general, and there's not known divergence from libstd currently. Note that one major difference between libstd's backtrace support and the `backtrace` crate is that on OSX the crates.io crate enables the `coresymbolication` feature by default. This feature, however, uses private internal APIs that aren't published for OSX. While they provide more accurate backtraces this isn't appropriate for libstd distributed as a binary, so libstd's dependency on the `backtrace` crate explicitly disables this feature and forces OSX to use `libbacktrace` as a symbolication strategy. The long-term goal of this refactoring is to eventually move us towards a world where we can drop `libbacktrace` entirely and simply use Gimli and the surrounding crates for backtrace support. That's still aways off but hopefully will much more easily enabled by having the source of truth for backtraces live in crates.io! Procedurally if we go forward with this I'd like to transfer the `backtrace-rs` crate to the rust-lang GitHub organization as well, but I figured I'd hold off on that until we get closer to merging.
2019-05-22Revert "Add implementations of last in terms of next_back on a bunch of ↵Steven Fackler-2/+0
DoubleEndedIterators." This reverts commit 3e86cf36b5114f201868bf459934fe346a76a2d4.
2019-05-22Rollup merge of #60581 - hellow554:fix_60580, r=alexcrichtonMazdak Farrokhzad-22/+16
convert custom try macro to `?` resolves #60580 r? @frewsxcv
2019-05-20Rollup merge of #60453 - tbu-:pr_getrandom_enoperm, r=sfacklerMazdak Farrokhzad-1/+6
Fall back to `/dev/urandom` on `EPERM` for `getrandom` This can happen because of seccomp or some VMs. Fixes #52609.
2019-05-15Revert "ensure fast thread local lookups occur once per access on macos"tyler-17/+0
This reverts commit d252f3b77f3b7d4cd59620588f9d026633c05816.
2019-05-15ensure fast thread local lookups occur once per access on macostyler-0/+17
2019-05-15remove dead code: requires_move_before_droptyler-4/+0
2019-05-15Auto merge of #60775 - hellow554:no_bitrig, r=joshtriplettbors-35/+9
Remove bitrig support from rust Resolves #60743 using `find` and `rg` I delete every occurence of "bitrig" in the sources, expect for the llvm submodule (is this correct?). There's also this file https://github.com/rust-lang/rls/blob/5b8e99bb61958ca8abcb7c5eda70521726be1065/rls-analysis/test_data/rust-analysis/libstd-af9bacceee784405.json which contains a bitrig string in it. What to do with that?