about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2017-10-26Rollup merge of #45059 - tmccombs:pid, r=alexcrichtonkennytm-0/+12
Add current_pid function Fixes #44971
2017-10-21Rollup merge of #45419 - steveklabnik:fix-commonmark-renderings, ↵Corey Farwell-1/+1
r=QuietMisdreavus Fix most rendering warnings from switching to CommonMark There's one big one lift, I'm filing a bug for it soon. r? @rust-lang/docs
2017-10-21Auto merge of #45391 - malbarbo:x32-1, r=alexcrichtonbors-7/+8
Update libc and some fixes for x86_64-unknown-linux-gnux32
2017-10-20Fix most rendering warnings from switching to CommonMarksteveklabnik-1/+1
2017-10-20Fix some tests for linux gnux32Marco A L Barbosa-7/+8
2017-10-18std: Update randomness implementation on WindowsAlex Crichton-46/+10
This commit updates the OS random number generator on Windows to match the upstream implementation in the `rand` crate. First proposed in rust-lang-nursery/rand#111 this implementation uses a "private" API of `RtlGenRandom`. Despite the [documentation][dox] indicating this is a private function its widespread use in Chromium and Firefox as well as [comments] from Microsoft internally indicates that it's highly unlikely to break. Another motivation for switching this is to also attempt to make progress on #44911. It may be the case that this function succeeds while the previous implementation may fail in "weird" scenarios. [dox]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa387694(v=vs.85).aspx [comments]: https://github.com/rust-lang-nursery/rand/issues/111#issuecomment-316140155
2017-10-17Remove duplicated wordGuillaume Gomez-2/+2
2017-10-14Fix TcpStream::connect_timeout on linuxSteven Fackler-4/+9
Linux appears to set POLLOUT when a conection's refused, which is pretty weird. Invert the check to look for an error explicitly. Also add an explict test for this case. Closes #45265.
2017-10-13Rollup merge of #44855 - federicomenaquintero:master, r=steveklabnikkennytm-0/+56
Improved docs for CStr, CString, OsStr, OsString This expands the documentation for those structs and their corresponding traits, per https://github.com/rust-lang/rust/issues/29354
2017-10-09Auto merge of #45041 - est31:master, r=alexcrichtonbors-29/+4
Remove support for the PNaCl target (le32-unknown-nacl) This removes support for the `le32-unknown-nacl` target which is currently supported by rustc on tier 3. Despite the "nacl" in the name, the target doesn't output native code (x86, ARM, MIPS), instead it outputs binaries in the PNaCl format. There are two reasons for the removal: * Google [has announced](https://blog.chromium.org/2017/05/goodbye-pnacl-hello-webassembly.html) deprecation of the PNaCl format. The suggestion is to migrate to wasm. Happens we already have a wasm backend! * Our PNaCl LLVM backend is provided by the fastcomp patch set that the LLVM fork used by rustc contains in addition to vanilla LLVM (`src/llvm/lib/Target/JSBackend/NaCl`). Upstream LLVM doesn't have PNaCl support. Removing PNaCl support will enable us to move away from fastcomp (#44006) and have a lighter set of patches on top of upstream LLVM inside our LLVM fork. This will help distribution packagers of Rust. Fixes #42420
2017-10-08Auto merge of #45030 - raggi:zircon-handle-t, r=alexcrichtonbors-18/+17
zircon: the type of zx_handle_t is now unsigned This is a kernel ABI change that landed today. I noticed some other ABI issues and have left a note to cleanup once they are better defined.
2017-10-06Add current_pid functionThayne McCombs-0/+12
Fixes #44971
2017-10-05replace libc::res_init with res_init_if_glibc_before_2_26Jack O'Connor-0/+83
The previous workaround for gibc's res_init bug is not thread-safe on other implementations of libc, and it can cause crashes. Use a runtime check to make sure we only call res_init when we need to, which is also when it's safe. See https://github.com/rust-lang/rust/issues/43592.
2017-10-05Remove nacl from libstdest31-29/+4
2017-10-04zircon: update some more zx and lp constantsJames Tucker-22/+16
* Use size_t where size_t is used, while it's not critical on our specifically supported architectures, this is more accurate. * Update HND_SPECIAL_COUNT to the correct value, and give it the size that enum is likely to be.
2017-10-04zircon: the type of zx_handle_t is now unsignedJames Tucker-1/+6
This is a kernel ABI change that landed today. I noticed some other ABI issues and have left a note to cleanup once they are better defined.
2017-10-04Auto merge of #44979 - hinaria:master, r=dtolnaybors-0/+13
make `backtrace = false` compile for windows targets. when building for windows with `backtrace = false`, `libstd` fails to compile because some modules that use items from `sys_common::backtrace::*` are still included, even though those modules aren't used or referenced by anything. `sys_common::backtrace` doesn't exist when the backtrace feature is turned off. -- i've also added `#[cfg(feature = "backtrace")]` to various items that exist exclusively to support `mod backtrace` since the compilation would fail since they would be unused in a configuration with backtraces turned off.
2017-10-03windows: make `backtrace = false` compilehinaria-0/+13
2017-09-27Made `fs::copy` return the length of the main streamStephane Raux-4/+4
On Windows with the NTFS filesystem, `fs::copy` would return the sum of the lengths of all streams, which can be different from the length reported by `metadata` and thus confusing for users unaware of this NTFS peculiarity. This makes `fs::copy` return the same length `metadata` reports which is the value it used to return before PR #26751. Note that alternate streams are still copied; their length is just not included in the returned value. This change relies on the assumption that the stream with index 1 is always the main stream in the `CopyFileEx` callback. I could not find any official document confirming this but empirical testing has shown this to be true, regardless of whether the alternate stream is created before or after the main stream. Resolves #44532
2017-09-25Module overview for std::os::windows:ffiFederico Mena Quintero-0/+56
2017-09-24LP_CLONE_FDIO_ROOT is now LP_CLONE_FDIO_NAMESPACEJames Tucker-2/+2
2017-09-24Fixed casing issues.P.Y. Laligand-16/+16
2017-09-24The Magenta kernel is now called Zircon.P.Y. Laligand-134/+134
2017-09-22Auto merge of #44624 - tmerr:master, r=sfacklerbors-3/+3
Retain suid/sgid/sticky bits in Metadata.permissions Most users would expect set_permissions(Metadata.permissions()) to be non-destructive. While we can't guarantee this, we can at least pass the needed info to chmod. Also update the PermissionsExt documentation to disambiguate what it contains, and to refer to the underlying value as `st_mode` rather than its type `mode_t`. Closes #44147
2017-09-19Rollup merge of #44513 - redox-os:master, r=alexcrichtonGuillaume Gomez-26/+186
[Redox] Sync with upstream syscall library This syncs the vendored syscalls with their upstream versions.
2017-09-17Remove st_mode maskTrevor Merrifield-3/+3
2017-09-16Fix network familiesJeremy Soller-2/+2
2017-09-15Retain suid/sgid/sticky bits in Metadata.permissionsTrevor Merrifield-3/+3
Most users would expect set_permissions(Metadata.permissions()) to be non-destructive. While we can't guarantee this, we can at least pass the needed info to chmod. Also update the PermissionsExt documentation to disambiguate what it contains, and to refer to the underlying value as `st_mode` rather than its type `mode_t`. Closes #44147
2017-09-14Merge branch 'master' into threadnameJoshua Sheard-58/+592
2017-09-14Auto merge of #43972 - TobiasSchaffner:std_clean, r=alexcrichtonbors-21/+508
Add the libstd-modifications needed for the L4Re target This commit adds the needed modifications to compile the std crate for the L4 Runtime environment (L4Re). A target for the L4Re was introduced in commit: c151220a84e40b65e45308cc0f3bbea4466d3acf In many aspects implementations for linux also apply for the L4Re microkernel. Some uncommon characteristics had to be resolved: * L4Re has no network funktionality * L4Re has a maximum stacksize of 1Mb for threads * L4Re has no uid or gid Co-authored-by: Sebastian Humenda <sebastian.humenda@tu-dresden.de>
2017-09-13Move default stack min size to thread implementationsTobias Schaffner-2/+11
The default min stack size value is smaller on l4re and therefore this value has to be different depending on the platform.
2017-09-11Fix tidy checksJeremy Soller-18/+44
2017-09-11Sync with upstream syscall libraryJeremy Soller-12/+146
2017-09-10Auto merge of #44220 - ↵bors-17/+36
kennytm:fix-44216-instance-plus-max-duration-should-panic, r=alexcrichton Properly detect overflow in Instance ± Duration. Fix #44216. Fix #42622 The computation `Instant::now() + Duration::from_secs(u64::max_value())` now panics. The call `receiver.recv_timeout(Duration::from_secs(u64::max_value()))`, which involves such time addition, will also panic. The reason #44216 arises is because of an unchecked cast from `u64` to `i64`, making the duration equivalent to -1 second. Note that the current implementation is over-conservative, since e.g. (-2⁶²) + (2⁶³) is perfectly fine for an `i64`, yet this is rejected because (2⁶³) overflows the `i64`.
2017-09-10Rollup merge of #44384 - alexcrichton:osx-segfault, r=estebankGuillaume Gomez-1/+2
std: Fix a segfault on OSX with backtraces Apparently `dladdr` can succeed but still give you NULL pointers! Closes #44379
2017-09-08Move the stack size value for L4Re to the min_stack_size functionSebastian Humenda-4/+0
2017-09-08Re-enable networking module fo rL4ReSebastian Humenda-1/+445
As suggested in the discussion of PR #43972, std should provide a uniform API to all platforms. Since there's no networking on L4Re, this now is a module in `sys::net` providing types and functions/methods returning an error for each action.
2017-09-08Add modifications needed for L4re in libstdTobias Schaffner-8/+42
This commit adds the needed modifications to compile the std crate for the L4 Runtime environment (L4Re). A target for the L4Re was introduced in commit: c151220a84e40b65e45308cc0f3bbea4466d3acf In many aspects implementations for linux also apply for the L4Re microkernel. Two uncommon characteristics had to be resolved: * L4Re has no network funktionality * L4Re has a maximum stacksize of 1Mb for threads Co-authored-by: Sebastian Humenda <sebastian.humenda@tu-dresden.de>
2017-09-08Match c_char definitions and enable signal reset for L4ReSebastian Humenda-13/+17
* Match definition of c_char in os/raw.rs with the libc definition Due to historic reasons, os/raw.rs redefines types for c_char from libc, but these didn't match. Now they do :). * Enable signal reset on exec for L4Re L4Re has full signal emulation and hence it needs to reset the signal set of the child with sigemptyset. However, gid and uid should *not* be set.
2017-09-07Properly detect overflow in Instance +/- Duration.kennytm-17/+36
Avoid unchecked cast from `u64` to `i64`. Use `try_into()` for checked cast. (On Unix, cast to `time_t` instead of `i64`.)
2017-09-06std: Fix a segfault on OSX with backtracesAlex Crichton-1/+2
Apparently `dladdr` can succeed but still give you NULL pointers! Closes #44379
2017-09-06Implement named threads on WindowsJoshua Sheard-7/+17
2017-09-02Fallback to dladdr-based resolve_symbol if backtrace failed.kennytm-14/+29
This programs compiled without -g on macOS still provide the resolve to actual symbols, instead of `<unknown>` everywhere.
2017-09-02Use env::current_exe for libbacktrace on macOSJohn Colanduoni-20/+7
2017-09-02Add libbacktrace support for Apple platformsJohn Colanduoni-5/+30
2017-08-28Update the libc submoduleAlex Crichton-8/+27
Brings in a few fixes for wasm/asmjs
2017-08-27Move unused-extern-crate to late passTatsuyuki Ishi-2/+0
2017-08-27Auto merge of #44112 - alexcrichton:thread-join, r=sfacklerbors-2/+8
std: Handle OS errors when joining threads Also add to the documentation that the `join` method can panic. cc #34971 cc #43539
2017-08-26std: Handle OS errors when joining threadsAlex Crichton-2/+8
Also add to the documentation that the `join` method can panic. cc #34971 cc #43539
2017-08-24Fix inconsistent doc headingslukaramu-2/+2
This fixes headings reading "Unsafety" and "Example", they should be "Safety" and "Examples" according to RFC 1574.