about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2017-06-05[fuchsia] Track change of mx_job_defaultRaph Levien-5/+1
The implementation of mx_job_default changed from a macro which accessed the __magenta_job_default global variable to a proper function call. This patch tracks that change.
2017-06-02Switch to repr(C) for syscall structsJeremy Soller-3/+3
2017-05-21Implement requires_synchronized_create() for RedoxIan Douglas Scott-0/+5
This was breaking the libstd build for Redox.
2017-05-20migrate everything to using mem::needs_dropAlexis Beingessner-6/+7
2017-05-19Rollup merge of #42056 - sylvestre:master, r=alexcrichtonMark Simulacrum-1/+6
Improve the error management when /proc is not mounted This PR does two things: * Triggers an error on GNU/Linux & Android when /proc/self/exe doesn't exist * Handle the error properly
2017-05-19Rollup merge of #41870 - excaliburHisSheath:iss29367-windows-docs, r=frewsxcvMark Simulacrum-57/+286
Improve docs in os::windows::ffi and os::windows::fs Part of #29367 This PR makes changes to the documentation in `os::windows::ffi` and `os::windows::fs` with the goal of fleshing them out and bringing them in line with Rust's quality standards. r? @steveklabnik
2017-05-19Fix doc test failure for OpenOptionsExtDavid LeGare-1/+1
2017-05-18Normalize docs in windows::ffi and windows::fsDavid LeGare-57/+64
- Remove `()` parens when referencing functions in docs. - Change some examples to be no_run instead of ignore. - Normalize style in examples for `OpenOptionsExt`. - Fix typo in windows mod docs.
2017-05-17Improve the error management when /proc is not mountedSylvestre Ledru-1/+6
This PR does two things: * Triggers an error on GNU/Linux & Android when /proc/self/exe doesn't exist * Handle the error properly
2017-05-11Auto merge of #41684 - jethrogb:feature/ntstatus, r=alexcrichtonbors-3/+38
Windows io::Error: also format NTSTATUS error codes `NTSTATUS` errors may be encoded as `HRESULT`, see [[MS-ERREF]](https://msdn.microsoft.com/en-us/library/cc231198.aspx). These error codes can still be formatted using `FormatMessageW` but require some different parameters to be passed in. I wasn't sure if this needed a test and if so, how to test it. Presumably we wouldn't want to make our tests dependent on localization-dependent strings returned from `FormatMessageW`. Users that get an `err: NTSTATUS` will need to do `io::Error::from_raw_os_error(err|0x1000_0000)` (the equivalent of [`HRESULT_FROM_NT`](https://msdn.microsoft.com/en-us/library/ms693780(VS.85).aspx))
2017-05-11Add testJethro Beekman-0/+14
2017-05-09Fix tidy errorsDavid LeGare-3/+6
2017-05-07Fix documentation tests in windows::fsDavid LeGare-3/+1
2017-05-06Update documentation in windows::fsDavid LeGare-10/+127
2017-05-06Fix definitions of ULONG_PTRJoshua Sheard-3/+4
2017-05-05Merge remote-tracking branch 'rust-lang/master' into iss29367-windows-docsDavid LeGare-118/+147
2017-05-05Update documentation in windows::ffiDavid LeGare-21/+91
2017-05-05Update documention in windows::ffiDavid LeGare-9/+43
2017-05-05std: Avoid locks during TLS destruction on WindowsAlex Crichton-100/+71
Gecko recently had a bug reported [1] with a deadlock in the Rust TLS implementation for Windows. TLS destructors are implemented in a sort of ad-hoc fashion on Windows as it doesn't natively support destructors for TLS keys. To work around this the runtime manages a list of TLS destructors and registers a hook to get run whenever a thread exits. When a thread exits it takes a look at the list and runs all destructors. Unfortunately it turns out that there's a lock which is held when our "at thread exit" callback is run. The callback then attempts to acquire a lock protecting the list of TLS destructors. Elsewhere in the codebase while we hold a lock over the TLS destructors we try to acquire the same lock held first before our special callback is run. And as a result, deadlock! This commit sidesteps the issue with a few small refactorings: * Removed support for destroying a TLS key on Windows. We don't actually ever exercise this as a public-facing API, and it's only used during `lazy_init` during racy situations. To handle that we just synchronize `lazy_init` globally on Windows so we never have to call `destroy`. * With no need to support removal the global synchronized `Vec` was tranformed to a lock-free linked list. With the removal of locks this means that iteration no long requires a lock and as such we won't run into the deadlock problem mentioned above. Note that it's still a general problem that you have to be extra super careful in TLS destructors. For example no code which runs a TLS destructor on Windows can call back into the Windows API to do a dynamic library lookup. Unfortunately I don't know of a great way around that, but this at least fixes the immediate problem that Gecko was seeing which is that with "well behaved" destructors the system would still deadlock! [1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1358151
2017-05-03Windows io::Error: also format NTSTATUS error codesJethro Beekman-3/+24
2017-04-25Fix a copy-paste error in `Instant::sub_duration`Tobias Bucher-1/+1
Fixes #41514.
2017-04-18Rollup merge of #41353 - redox-os:master, r=alexcrichtonCorey Farwell-9/+18
Improve Process::spawn with piped stdio on Redox - Adds `dup2`, and uses it for stdio piping - Removes `O_CLOEXEC` from piped stdio, as `dup` on Redox does not disable O_CLOEXEC
2017-04-16Fix stdio descriptors in exec by removing cloexec if present. Use dup2 ↵Jeremy Soller-9/+18
instead of dup
2017-04-14Update magenta error codesTheodore DeRego-34/+43
2017-04-06Rollup merge of #41111 - ollie27:docs_markdown_fix, r=GuillaumeGomezCorey Farwell-1/+2
Fix Markdown issues in the docs * Since the switch to pulldown-cmark reference links need a blank line before the URLs. (#40912) * Reference link references are not case sensitive. * Doc comments need to be indented uniformly otherwise rustdoc gets confused.
2017-04-06Fix Markdown issues in the docsOliver Middleton-1/+2
* Since the switch to pulldown-cmark reference links need a blank line before the URLs. * Reference link references are not case sensitive. * Doc comments need to be indented uniformly otherwise rustdoc gets confused.
2017-04-06Auto merge of #41039 - alexcrichton:process-poll, r=nagisabors-13/+9
std: Use `poll` instead of `select` This gives us the benefit of supporting file descriptors over the limit that select supports, which... Closes #40894
2017-04-05Rollup merge of #41054 - anatol:master, r=alexcrichtonAriel Ben-Yehuda-1/+1
Replace magic number with readable sig constant SIG_ERR is defined as 'pub const SIG_ERR: sighandler_t = !0 as sighandler_t;'
2017-04-04std: Use `poll` instead of `select`Alex Crichton-13/+9
This gives us the benefit of supporting file descriptors over the limit that select supports, which... Closes #40894
2017-04-03Replace magic number with readable sig constantAnatol Pomozov-1/+1
SIG_ERR is defined as 'pub const SIG_ERR: sighandler_t = !0 as sighandler_t;'
2017-04-03Revert "Implement AsRawFd/IntoRawFd for RawFd"Cody P Schafer-15/+0
This reverts commit 2cf686f2cdd6446a3cd47df0305ead40fabe85df (#40842) RawFd is a type alias for c_int, which is itself a type alias for i32. As a result, adding AsRawFd and IntoRawFd impls for RawFd actually adds them for i32. As a result, the reverted commit makes this valid: ``` use std::os::unix::io::AsRawFd; fn arf<T: AsRawFd>(_: T) {} fn main() { arf(32i32) } ``` Implimenting AsRawFd and IntoRawFd for i32 breaks the promises of both those traits that their methods return a valid RawFd. r? @aturon cc @Mic92 @kamalmarhubi
2017-03-31Rollup merge of #40842 - Mic92:RawFd, r=aturonCorey Farwell-0/+15
Implement AsRawFd/IntoRawFd for RawFd This is useful to build os abstraction like the nix crate does. It allows to define functions, which accepts generic arguments of data structures convertible to RawFd, including RawFd itself. For example: ``` fn write<FD: AsRawFd>(fd: FD, buf: &[u8]) -> Result<usize> write(file, buf); ``` instead of: ``` fn write(fd: RawFd, buf: &[u8]) -> Result<usize> write(file.as_raw_fd(), buf); ``` cc @kamalmarhubi
2017-03-27Rollup merge of #40516 - alexcrichton:no-cache-handles, r=aturonAlex Crichton-55/+46
std: Don't cache stdio handles on Windows This alters the stdio code on Windows to always call `GetStdHandle` whenever the stdio read/write functions are called as this allows us to track changes to the value over time (such as if a process calls `SetStdHandle` while it's running). Closes #40490
2017-03-26Implement AsRawFd/IntoRawFd for RawFdJörg Thalheim-0/+15
This is useful to build os abstraction like the nix crate does. It allows to define functions, which accepts generic arguments of data structures convertible to RawFd, including RawFd itself. For example: fn write<FD: AsRawFd>(fd: FD, buf: &[u8]) -> Result<usize> instead of: fn write(fd: RawFd, buf: &[u8]) -> Result<usize> write(foo.as_raw_fd(), buf);
2017-03-25Avoid using libc::sigemptyset on AndroidMarco A L Barbosa-2/+25
2017-03-25Fix libc::bind call on aarch64-linux-androidMarco A L Barbosa-2/+2
2017-03-23std: Don't cache stdio handles on WindowsAlex Crichton-55/+46
This alters the stdio code on Windows to always call `GetStdHandle` whenever the stdio read/write functions are called as this allows us to track changes to the value over time (such as if a process calls `SetStdHandle` while it's running). Closes #40490
2017-03-17Rollup merge of #40457 - frewsxcv:frewsxcv-macos, r=steveklabnikCorey Farwell-20/+20
Update usages of 'OSX' (and other old names) to 'macOS'. As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-03-17Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, ↵Corey Farwell-17/+17
r=GuillaumeGomez Remove function invokation parens from documentation links. This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-15Auto merge of #40009 - clarcharr:box_to_buf, r=alexcrichtonbors-0/+18
Leftovers from #39594; From<Box> impls These are a few more impls that follow the same reasoning as those from #39594. What's included: * `From<Box<str>> for String` * `From<Box<[T]>> for Vec<T>` * `From<Box<CStr>> for CString` * `From<Box<OsStr>> for OsString` * `From<Box<Path>> for PathBuf` * `Into<Box<str>> for String` * `Into<Box<[T]>> for Vec<T>` * `Into<Box<CStr>> for CString` * `Into<Box<OsStr>> for OsString` * `Into<Box<Path>> for PathBuf` * `<Box<CStr>>::into_c_string` * `<Box<OsStr>>::into_os_string` * `<Box<Path>>::into_path_buf` * Tracking issue for latter three methods + three from previous PR. Currently, the opposite direction isn't doable with `From` (only `Into`) because of the separation between `liballoc` and `libcollections`. I'm holding off on those for a later PR.
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-17/+17
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-12Update usages of 'OSX' (and other old names) to 'macOS'.Corey Farwell-20/+20
As of last year with version 'Sierra', the Mac operating system is now called 'macOS'.
2017-03-10Add From<Box<..>> implementations.Clar Charr-0/+18
2017-03-10OsString::shrink_to_fit.Clar Charr-0/+14
2017-03-02Rollup merge of #40139 - tedsta:fuchsia_std_process_fix, r=alexcrichtonCorey Farwell-27/+31
std::process for fuchsia: updated to latest liblaunchpad Our liblaunchpad changed a bit and so fuchsia's std::process impl needs to change a bit. @raphlinus
2017-02-28std::process for fuchsia: updated to latest liblaunchpadTheodore DeRego-27/+31
2017-02-27Auto merge of #38165 - Yamakaky:better-backtrace, r=petrochenkovbors-323/+319
Improve backtrace formating while panicking. Fixes #37783. Done: - Fix alignment of file paths for better readability - `RUST_BACKTRACE=full` prints all the informations (current behaviour) - `RUST_BACKTRACE=(short|yes)` is the default and does: - Skip irrelevant frames at the beginning and the end - Remove function address - Remove the current directory from the absolute paths - Remove `::hfabe6541873` at the end of the symbols - `RUST_BACKTRACE=(0|no)` disables the backtrace. - `RUST_BACKTRACE=<everything else>` is equivalent to `short` for backward compatibility. - doc - More uniform printing across platforms. Removed, TODO in a new PR: - Remove path prefix for libraries and libstd Example of short backtrace: ```rust fn fail() { panic!(); } fn main() { let closure = || fail(); closure(); } ``` Short: ``` thread 'main' panicked at 'explicit panic', t.rs:2 Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. stack backtrace: 0: t::fail at ./t.rs:2 1: t::main::{{closure}} at ./t.rs:6 2: t::main at ./t.rs:7 ``` Full: ``` thread 'main' panicked at 'This function never returns!', t.rs:2 stack backtrace: 0: 0x558ddf666478 - std::sys::imp::backtrace::tracing::imp::unwind_backtrace::hec84c9dd8389cc5d at /home/yamakaky/dev/rust/rust/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: 0x558ddf65d90e - std::sys_common::backtrace::_print::hfa25f8b31f4b4353 at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:71 2: 0x558ddf65cb5e - std::sys_common::backtrace::print::h9b711e11ac3ba805 at /home/yamakaky/dev/rust/rust/src/libstd/sys_common/backtrace.rs:60 3: 0x558ddf66796e - std::panicking::default_hook::{{closure}}::h736d216e74748044 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:355 4: 0x558ddf66743c - std::panicking::default_hook::h16baff397e46ea10 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:371 5: 0x558ddf6682bc - std::panicking::rust_panic_with_hook::h6d5a9bb4eca42c80 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:559 6: 0x558ddf64ea93 - std::panicking::begin_panic::h17dc549df2f10b99 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:521 7: 0x558ddf64ec42 - t::diverges::he6bc43fc925905f5 at /tmp/p/t.rs:2 8: 0x558ddf64ec5a - t::main::h0ffc20356b8a69c0 at /tmp/p/t.rs:6 9: 0x558ddf6687f5 - core::ops::FnOnce::call_once::hce41f19c0db56f93 10: 0x558ddf667cde - std::panicking::try::do_call::hd4c8c97efb4291df at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:464 11: 0x558ddf698d77 - __rust_try 12: 0x558ddf698c57 - __rust_maybe_catch_panic at /home/yamakaky/dev/rust/rust/src/libpanic_unwind/lib.rs:98 13: 0x558ddf667adb - std::panicking::try::h2c56ed2a59ec1d12 at /home/yamakaky/dev/rust/rust/src/libstd/panicking.rs:440 14: 0x558ddf66cc9a - std::panic::catch_unwind::h390834e0251cc9af at /home/yamakaky/dev/rust/rust/src/libstd/panic.rs:361 15: 0x558ddf6809ee - std::rt::lang_start::hb73087428e233982 at /home/yamakaky/dev/rust/rust/src/libstd/rt.rs:57 16: 0x558ddf64ec92 - main 17: 0x7fecb869e290 - __libc_start_main 18: 0x558ddf64e8b9 - _start 19: 0x0 - <unknown> ```
2017-02-26Remove unusedYamakaky-1/+0
2017-02-25typoYamakaky-1/+1
2017-02-25Fix tests on ARM Linux (#3)Vadim Petrochenkov-1/+3