about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
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
2017-02-25Rollup merge of #40024 - raphlinus:readdir, r=alexcrichtonEduard-Mihai Burtescu-14/+15
Switch Fuchsia to readdir (instead of readdir_r) The readdir_r function is deprecated on newer Posix systems because of various problems, and not implemented at all for Fuchsia. There are already implementations using both, and this patch switches Fuchsia over to the readdir-based one. Fixes #40021 for Fuchsia, but that issue also contains discussion of what should happen for other Posix systems.
2017-02-25Rollup merge of #39961 - redox-os:redox, r=alexcrichtonEduard-Mihai Burtescu-1/+13
Fix compilation on Redox This updates the Redox sys module to fix compilation. The functions peek and peek_from are added to TcpStream and UdpSocket as stubs. The sys::backtrace module is now included correctly
2017-02-25Rollup merge of #39914 - raphlinus:mx_handle_wait, r=alexcrichtonEduard-Mihai Burtescu-3/+3
Follow rename of mx_handle_wait Magenta syscalls The mx_handle_wait_* syscalls in Magenta were renamed to mx_object_wait. The syscall is used in the Magenta/Fuchsia implementation of std::process, to wait on child processes. In addition, this patch enables the use of the system provided libbacktrace library on Fuchsia targets. Symbolization is not yet working, but at least it allows printing hex addresses in a backtrace and makes building succeed when the backtrace feature is not disabled.
2017-02-22Merge branch 'master' of https://github.com/rust-lang/rust into readdirRaph Levien-29/+9
2017-02-22Update name_bytes, scoop up latest libcRaph Levien-3/+3
Update the implementation of name_bytes to use the owned string (which is thread safe). Also bump the src/liblibc submodule now that's merged.
2017-02-21Switch Fuchsia to readdir (instead of readdir_r)Raph Levien-11/+12
The readdir_r function is deprecated on newer Posix systems because of various problems, and not implemented at all for Fuchsia. There are already implementations using both, and this patch switches Fuchsia over to the readdir-based one. Fixes #40021 for Fuchsia, but that issue also contains discussion of what should happen for other Posix systems.
2017-02-19Auto merge of #39871 - binarycrusader:issue-39868, r=alexcrichtonbors-29/+9
libstd needs update for pending libc change This updates libstd to accommodate the fixes made in https://github.com/rust-lang/libc/pull/523 Fixes #39868
2017-02-17Follow rename of mx_handle_wait Magenta syscallsRaph Levien-3/+3
The mx_handle_wait_* syscalls in Magenta were renamed to mx_object_wait. The syscall is used in the Magenta/Fuchsia implementation of std::process, to wait on child processes. In addition, this patch enables the use of the system provided libbacktrace library on Fuchsia targets. Symbolization is not yet working, but at least it allows printing hex addresses in a backtrace and makes building succeed when the backtrace feature is not disabled.
2017-02-15simplify home_dir by removing unnecessary getpwuid_r wrapperShawn Walker-Salas-18/+9
2017-02-15Rollup merge of #39861 - retep998:small-fix, r=alexcrichtonCorey Farwell-1/+1
Fix parameter to GetUserProfileDirectoryW
2017-02-15Rollup merge of #39844 - king6cong:sys, r=alexcrichtonCorey Farwell-6/+6
sys/mod doc update and mod import order adjust * Some doc updates. * Racer currently use the first mod it finds regardless of cfg attrs. Moving #[cfg(unix)] up should be a temporary tweak that works as expected for more people.
2017-02-15libstd needs update for pending libc changeShawn Walker-Salas-11/+0
Fixes #39868
2017-02-15Fix parameter to GetUserProfileDirectoryWPeter Atashian-1/+1
2017-02-15Improve backtrace formating while panicking.Yamakaky-322/+317
- `RUST_BACKTRACE=full` prints all the informations (old behaviour) - `RUST_BACKTRACE=(0|no)` disables the backtrace. - `RUST_BACKTRACE=<everything else>` (including `1`) shows a simplified backtrace, without the function addresses and with cleaned filenames and symbols. Also removes some unneded frames at the beginning and the end. Fixes #37783. PR is #38165.
2017-02-15sys/mod doc update and mod import order adjustking6cong-6/+6
2017-02-14Conversions between CStr/OsStr/Path and boxes.Clar Charr-0/+46
2017-02-08Fix compilation on RedoxJeremy Soller-1/+13
2017-02-08Rollup merge of #39512 - oconnor663:try_wait, r=alexcrichtonCorey Farwell-14/+14
make Child::try_wait return io::Result<Option<ExitStatus>> This is much nicer for callers who want to short-circuit real I/O errors with `?`, because they can write this if let Some(status) = foo.try_wait()? { ... } else { ... } instead of this match foo.try_wait() { Ok(status) => { ... } Err(err) if err.kind() == io::ErrorKind::WouldBlock => { ... } Err(err) => return Err(err), } The original design of `try_wait` was patterned after the `Read` and `Write` traits, which support both blocking and non-blocking implementations in a single API. But since `try_wait` is never blocking, it makes sense to optimize for the non-blocking case. Tracking issue: https://github.com/rust-lang/rust/issues/38903
2017-02-07Rollup merge of #39431 - alexcrichton:no-more-makefiles, r=brsonCorey Farwell-17/+1
Delete the makefile build system This PR deletes the makefile build system in favor of the rustbuild build system. The beta has now been branched so 1.16 will continue to be buildable from the makefiles, but going forward 1.17 will only be buildable with rustbuild. Rustbuild has been the default build system [since 1.15.0](https://github.com/rust-lang/rust/pull/37817) and the makefiles were [proposed for deletion](https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368) at this time back in November of last year. And now with the deletion of these makefiles we can start getting those sweet sweet improvements of using crates.io crates in the compiler!
2017-02-07Rollup merge of #39400 - alexcrichton:arm-cross-test, r=brsonCorey Farwell-1/+5
Add support for test suites emulated in QEMU This commit adds support to the build system to execute test suites that cannot run natively but can instead run inside of a QEMU emulator. A proof-of-concept builder was added for the `arm-unknown-linux-gnueabihf` target to show off how this might work. In general the architecture is to have a server running inside of the emulator which a local client connects to. The protocol between the server/client supports compiling tests on the host and running them on the target inside the emulator. Closes #33114
2017-02-06make Child::try_wait return io::Result<Option<ExitStatus>>Jack O'Connor-14/+14
This is much nicer for callers who want to short-circuit real I/O errors with `?`, because they can write this if let Some(status) = foo.try_wait()? { ... } else { ... } instead of this match foo.try_wait() { Ok(status) => { ... } Err(err) if err.kind() == io::ErrorKind::WouldBlock => { ... } Err(err) => return Err(err), } The original design of `try_wait` was patterned after the `Read` and `Write` traits, which support both blocking and non-blocking implementations in a single API. But since `try_wait` is never blocking, it makes sense to optimize for the non-blocking case. Tracking issue: https://github.com/rust-lang/rust/issues/38903