about summary refs log tree commit diff
path: root/src/libnative/io
AgeCommit message (Collapse)AuthorLines
2014-10-07Use slice syntax instead of slice_to, etc.Nick Cameron-2/+2
2014-10-05Fix cfg syntax warnings in libnativeMichael Gehring-8/+4
2014-10-02rollup merge of #17720 : ben0x539/shiftsAlex Crichton-8/+9
2014-10-02native: fix passing errno to parent after forkBenjamin Herr-8/+9
The bitshifts were wrong in that they invoked undefined behavior and only passed the lower byte of the presumed-to-be-32bit errno value. Apparently all actually possible values for errno happen to be easily under 256, so this didn't cause any actual problems. This commit fixes the bitshifts, but doesn't generalize to errno types that aren't 32bit.
2014-10-02Revert "Use slice syntax instead of slice_to, etc."Aaron Turon-1/+1
This reverts commit 40b9f5ded50ac4ce8c9323921ec556ad611af6b7.
2014-10-02Revert "Review and rebasing changes"Aaron Turon-1/+1
This reverts commit 6e0611a48707a1f5d90aee32a02b2b15957ef25b.
2014-10-02Review and rebasing changesNick Cameron-1/+1
2014-10-02Use slice syntax instead of slice_to, etc.Nick Cameron-1/+1
2014-10-01auto merge of #17630 : sfackler/rust/cfg-warnings, r=brsonbors-67/+66
Closes #17490
2014-09-30Fix libnativeSteven Fackler-67/+66
2014-09-30librustc: Forbid `..` in range patterns.Patrick Walton-1/+1
This breaks code that looks like: match foo { 1..3 => { ... } } Instead, write: match foo { 1...3 => { ... } } Closes #17295. [breaking-change]
2014-09-27auto merge of #17506 : sfackler/rust/cfg-attr, r=alexcrichtonbors-1/+1
cc #17490 Reopening of #16230
2014-09-23Deprecate `#[ignore(cfg(...))]`Steven Fackler-1/+1
Replace `#[ignore(cfg(a, b))]` with `#[cfg_attr(all(a, b), ignore)]`
2014-09-24liblibc and libnative: send() should use const buffers.NODA, Kai-2/+2
2014-09-24libnative/io: datasync() wrongly called fsync().NODA, Kai-1/+1
2014-09-22librustc: Forbid private types in public APIs.Patrick Walton-2/+1
This breaks code like: struct Foo { ... } pub fn make_foo() -> Foo { ... } Change this code to: pub struct Foo { // note `pub` ... } pub fn make_foo() -> Foo { ... } The `visible_private_types` lint has been removed, since it is now an error to attempt to expose a private type in a public API. In its place a `#[feature(visible_private_types)]` gate has been added. Closes #16463. RFC #48. [breaking-change]
2014-09-19Add enum variants to the type namespaceNick Cameron-4/+4
Change to resolve and update compiler and libs for uses. [breaking-change] Enum variants are now in both the value and type namespaces. This means that if you have a variant with the same name as a type in scope in a module, you will get a name clash and thus an error. The solution is to either rename the type or the variant.
2014-09-16Fallout from renamingAaron Turon-62/+62
2014-09-13librustc: Forbid inherent implementations that aren't adjacent to thePatrick Walton-0/+1
type they provide an implementation for. This breaks code like: mod foo { struct Foo { ... } } impl foo::Foo { ... } Change this code to: mod foo { struct Foo { ... } impl Foo { ... } } Additionally, if you used the I/O path extension methods `stat`, `lstat`, `exists`, `is_file`, or `is_dir`, note that these methods have been moved to the the `std::io::fs::PathExtensions` trait. This breaks code like: fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Change this code to: use std::io::fs::PathExtensions; fn is_it_there() -> bool { Path::new("/foo/bar/baz").exists() } Closes #17059. RFC #155. [breaking-change]
2014-09-09rollup merge of #17020 : nodakai/libnative-c_intAlex Crichton-34/+22
2014-09-08libnative/io: generic retry() for Unix 64 bit read/write().NODA, Kai-34/+22
Win32/WinSock APIs never call WSASetLastError() with WSAEINTR unless a programmer specifically cancels the ongoing blocking call by a deprecated WinSock1 API WSACancelBlockingCall(). So the errno check was simply removed and retry() became an id function on Windows. Note: Windows' equivalent of SIGINT is always handled in a separate thread: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682541%28v=vs.85%29.aspx "CTRL+C and CTRL+BREAK Signals" Also, incidentally rename a type parameter and clean up some module imports.
2014-09-07auto merge of #16942 : alexcrichton/rust/remove-net-assert, r=brsonbors-1/+1
This assert was likely inherited from some point, but it's not quite valid as a no-timeout read may enter this loop, but data could be stolen by any other read after the socket is deemed readable. I saw this fail in a recent bors run where the assertion was tripped.
2014-09-06readdir: return error instead of failing on invalid UTF-16Peter Atashian-26/+19
Fixes #15279 Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-09-04auto merge of #16982 : jbcrail/rust/comment-and-string-corrections, ↵bors-8/+8
r=alexcrichton I corrected spelling and capitalization errors in comments and strings.
2014-09-03Fix spelling errors and capitalization.Joseph Crail-8/+8
2014-09-03libnative/io/file_unix: remove superfluous retry().NODA, Kai-24/+12
These syscalls don't return EINTR: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/mkdir.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/rmdir.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/readlink.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/link.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstatat.html http://pubs.opengroup.org/onlinepubs/9699919799/functions/utime.html
2014-09-02native: Remove a bogus assert in net::readAlex Crichton-1/+1
This assert was likely inherited from some point, but it's not quite valid as a no-timeout read may enter this loop, but data could be stolen by any other read after the socket is deemed readable. I saw this fail in a recent bors run where the assertion was tripped.
2014-08-30Unify non-snake-case lints and non-uppercase statics lintsP1start-2/+2
This unifies the `non_snake_case_functions` and `uppercase_variables` lints into one lint, `non_snake_case`. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges the `non_uppercase_pattern_statics` lint into the `non_uppercase_statics` lint. Because the `uppercase_variables` lint is now part of the `non_snake_case` lint, all non-snake-case variables that start with lowercase characters (such as `fooBar`) will now trigger the `non_snake_case` lint. New code should be updated to use the new `non_snake_case` lint instead of the previous `non_snake_case_functions` and `uppercase_variables` lints. All use of the `non_uppercase_pattern_statics` should be replaced with the `non_uppercase_statics` lint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable the `non_snake_case` lint. Any code with non-camel-case type parameters should be changed to use camel case or disable the `non_camel_case_types` lint. [breaking-change]
2014-08-28Fallout from stabilizing core::optionAaron Turon-1/+1
2014-08-24native: clone/close_accept for win32 pipesAlex Crichton-40/+108
This commits takes a similar strategy to the previous commit to implement close_accept and clone for the native win32 pipes implementation. Closes #15595
2014-08-24native: Add some documentation for acceptAlex Crichton-0/+34
Document the new code for how close_accept and timeouts are implemented.
2014-08-24native: TCP close/close_accept for windowsAlex Crichton-78/+228
This commit implements TcpAcceptor::{close, close_accept} for windows via WSAEVENT types.
2014-08-24native: Implement clone/close_accept for unixAlex Crichton-46/+156
This commits implements {Tcp,Unix}Acceptor::{clone,close_accept} methods for unix. A windows implementation is coming in a later commit. The clone implementation is based on atomic reference counting (as with all other clones), and the close_accept implementation is based on selecting on a self-pipe which signals that a close has been seen.
2014-08-23Complete renaming of win32 to windowsVadim Chugunov-10/+9
2014-08-20libgreen: use FFI-safe typesCorey Richardson-1/+2
2014-08-20liblibc: don't use int/uint for intptr_t/uintptr_tCorey Richardson-0/+1
int/uint aren't considered FFI safe, replace them with the actual type they represent (i64/u64 or i32/u32). This is a breaking change, but at most a cast to `uint` or `int` needs to be added. [breaking-change]
2014-08-20Add #[repr(C)] to all the things!Corey Richardson-0/+13
2014-08-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-18/+18
of `use bar as foo`. Change all uses of `use foo = bar` to `use bar as foo`. Implements RFC #47. Closes #16461. [breaking-change]
2014-08-15auto merge of #16435 : vadimcn/rust/windows, r=pcwaltonbors-1/+2
Using "win32" to mean "Windows" is confusing, especially now, that Rust supports win64 builds. Let's call spade a spade.
2014-08-12libnative: process spawning should not close inherited file descriptorsIvan Petkov-1/+1
* The caller should be responsible for cleaning up file descriptors * If a caller safely creates a file descriptor (via native::io::file::open) the returned structure (FileDesc) will try to clean up the file, failing in the process and writing error messages to the screen. * This should not happen as the caller has no public interface for telling the FileDesc structure to NOT free the underlying fd. * Alternatively, if another file is opened under the same fd held by the FileDesc structure returned by native::io::file::open, it will close the wrong file upon destruction.
2014-08-12Replace #[cfg(target_os = "win32")] with #[cfg(target_os = "windows")]Vadim Chugunov-1/+2
2014-08-12auto merge of #16284 : alexcrichton/rust/issue-16272, r=aturonbors-1/+4
There was a bug in both libnative and libuv which prevented child processes from being spawned correctly on windows when one of the arguments was an empty string. The libuv bug has since been fixed upstream, and the libnative bug was fixed as part of this commit. When updating libuv, this also includes a fix for #15149. Closes #15149 Closes #16272
2014-08-07windows: Fix INVALID_HANDLE_VALUEPeter Atashian-13/+13
Made INVALID_HANDLE_VALUE actually a HANDLE. Removed all useless casts during INVALID_HANDLE_VALUE comparisons. Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-07windows: Fix several tests on 64-bit.Peter Atashian-0/+20
Signed-off-by: Peter Atashian <retep998@gmail.com>
2014-08-06auto merge of #16258 : aturon/rust/stabilize-atomics, r=alexcrichtonbors-12/+12
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-05native, rustuv: Fix spawning with empty argsAlex Crichton-1/+4
There was a bug in both libnative and libuv which prevented child processes from being spawned correctly on windows when one of the arguments was an empty string. The libuv bug has since been fixed upstream, and the libnative bug was fixed as part of this commit. When updating libuv, this also includes a fix for #15149. Closes #15149 Closes #16272
2014-08-05auto merge of #16243 : alexcrichton/rust/fix-utime-for-windows, r=brsonbors-2/+2
Apparently the units are in milliseconds, not in seconds!
2014-08-04stabilize atomics (now atomic)Aaron Turon-12/+12
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
2014-08-04Change everything returning `libc::sockaddr_storage` to use an &mut out-ptr ↵Andrew Poelstra-27/+30
instead The BSD socket code does some cast tricks with the `libc::sockaddr*` structs, which causes useful data to be stored in struct padding. Since Load/Store instructions do not copy struct padding, this makes these structures dangerous to pass or return by value. In particular, https://github.com/rust-lang/rust/issues/15763 changes return semantics so that a Load instruction is used, breaking the TCP code. Once this PR is merged, that one should merge without error.
2014-08-02native: Fix utime() for windowsAlex Crichton-2/+2
Apparently the units are in milliseconds, not in seconds!