about summary refs log tree commit diff
path: root/src/libnative/io/pipe_unix.rs
AgeCommit message (Collapse)AuthorLines
2014-11-08Runtime removal: refactor pipes and networkingAaron Turon-339/+0
This patch continues the runtime removal by moving pipe and networking-related code into `sys`. Because this eliminates APIs in `libnative` and `librustrt`, it is a: [breaking-change] This functionality is likely to be available publicly, in some form, from `std` in the future.
2014-09-24liblibc and libnative: send() should use const buffers.NODA, Kai-1/+1
2014-09-16Fallout from renamingAaron Turon-1/+1
2014-08-24native: clone/close_accept for win32 pipesAlex Crichton-5/+5
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: Implement clone/close_accept for unixAlex Crichton-18/+70
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-18libsyntax: Remove the `use foo = bar` syntax from the language in favorPatrick Walton-2/+2
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-04Change everything returning `libc::sockaddr_storage` to use an &mut out-ptr ↵Andrew Poelstra-10/+12
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-07-24libsyntax: Remove `~self` and `mut ~self` from the language.Patrick Walton-1/+2
This eliminates the last vestige of the `~` syntax. Instead of `~self`, write `self: Box<TypeOfSelf>`; instead of `mut ~self`, write `mut self: Box<TypeOfSelf>`, replacing `TypeOfSelf` with the self-type parameter as specified in the implementation. Closes #13885. [breaking-change]
2014-07-08std: Rename the `ToStr` trait to `ToString`, and `to_str` to `to_string`.Richo Healey-1/+1
[breaking-change]
2014-06-29c_str: replace .with_ref with .as_ptr throughout the codebase.Huon Wilson-1/+1
2014-06-28Rename all raw pointers as necessaryAlex Crichton-4/+4
2014-06-15Register new snapshotsAlex Crichton-6/+6
2014-06-08Remove the dead code identified by the new lintJakub Wieczorek-1/+4
2014-06-06native: Deal with the rtio changesAlex Crichton-10/+11
2014-05-21std,green: Mark some queue types as NoShareAlex Crichton-1/+1
2014-05-19native: Remove UnsafeArc in favor of just ArcAlex Crichton-7/+7
2014-05-11core: Remove the cast moduleAlex Crichton-2/+1
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-07Test fixes and rebase conflictsAlex Crichton-1/+1
2014-05-07native: Implement timeouts for unix networkingAlex Crichton-29/+70
This commit has an implementation of the previous commit's timeout interface for I/O objects on unix platforms. For implementation details, see the large comment at the end of libnative/io/net.rs which talks about the general strategy taken. Thankfully, all of these implementations can share code because they're performing all the same operations. This commit does not implement timeouts for named pipes on windows, only tcp/udp objects on windows (which are quite similar to their unix equivalents).
2014-05-07std: Add close_{read,write}() methods to I/OAlex Crichton-0/+7
Two new methods were added to TcpStream and UnixStream: fn close_read(&mut self) -> IoResult<()>; fn close_write(&mut self) -> IoResult<()>; These two methods map to shutdown()'s behavior (the system call on unix), closing the reading or writing half of a duplex stream. These methods are primarily added to allow waking up a pending read in another task. By closing the reading half of a connection, all pending readers will be woken up and will return with EndOfFile. The close_write() method was added for symmetry with close_read(), and I imagine that it will be quite useful at some point. Implementation-wise, librustuv got the short end of the stick this time. The native versions just delegate to the shutdown() syscall (easy). The uv versions can leverage uv_shutdown() for tcp/unix streams, but only for closing the writing half. Closing the reading half is done through some careful dancing to wake up a pending reader. As usual, windows likes to be different from unix. The windows implementation uses shutdown() for sockets, but shutdown() is not available for named pipes. Instead, CancelIoEx was used with same fancy synchronization to make sure everyone knows what's up. cc #11165
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-6/+10
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-05-02Replace most ~exprs with 'box'. #11779Brian Anderson-3/+3
2014-04-24std: Add timeouts to unix connect/acceptAlex Crichton-29/+30
This adds support for connecting to a unix socket with a timeout (a named pipe on windows), and accepting a connection with a timeout. The goal is to bring unix pipes/named sockets back in line with TCP support for timeouts. Similarly to the TCP sockets, all methods are marked #[experimental] due to uncertainty about the type of the timeout argument. This internally involved a good bit of refactoring to share as much code as possible between TCP servers and pipe servers, but the core implementation did not change drastically as part of this commit. cc #13523
2014-04-24native: Remove unused and untested UnixDatagramAlex Crichton-71/+0
2014-04-22native: Unlink unix socket paths on dropAlex Crichton-1/+15
This prevents unix sockets from remaining on the system all over the place, and more closely mirrors the behavior of libuv and windows pipes.
2014-04-04Fix fallout from std::libc separationCorey Richardson-1/+1
2014-03-31native: Switch field privacy as necessaryAlex Crichton-4/+4
2014-03-27Fix fallout of removing default boundsAlex Crichton-6/+6
This is all purely fallout of getting the previous commit to compile.
2014-02-27native: Improve windows file handlingAlex Crichton-2/+2
This commit splits the file implementation into file_unix and file_win32. The two implementations have diverged to the point that they share almost 0 code at this point, so it's easier to maintain as separate files. The other major change accompanied with this commit is that file::open is no longer based on libc's open function on windows, but rather windows's CreateFile function. This fixes dealing with binary files on windows (test added in previous commit). This also changes the read/write functions to use ReadFile and WriteFile instead of libc's read/write. Closes #12406
2014-02-23std: Move intrinsics to std::intrinsics.Brian Anderson-1/+1
Issue #1457
2014-02-20Mass rename if_ok! to try!Alex Crichton-5/+5
This "bubble up an error" macro was originally named if_ok! in order to get it landed, but after the fact it was discovered that this name is not exactly desirable. The name `if_ok!` isn't immediately clear that is has much to do with error handling, and it doesn't look fantastic in all contexts (if if_ok!(...) {}). In general, the agreed opinion about `if_ok!` is that is came in as subpar. The name `try!` is more invocative of error handling, it's shorter by 2 letters, and it looks fitting in almost all circumstances. One concern about the word `try!` is that it's too invocative of exceptions, but the belief is that this will be overcome with documentation and examples. Close #12037
2014-02-16Implement named pipes for windows, touch up unixAlex Crichton-182/+167
* Implementation of pipe_win32 filled out for libnative * Reorganize pipes to be clone-able * Fix a few file descriptor leaks on error * Factor out some common code into shared functions * Make use of the if_ok!() macro for less indentation Closes #11201
2014-02-16Move unix pipes implementation to pipe_unix.rsAlex Crichton-0/+300
The windows named pipes implementation will have almost nothing to do with unix pipes, so I think it's best if they live in separate files.