about summary refs log tree commit diff
path: root/src/liblibc
AgeCommit message (Collapse)AuthorLines
2014-05-07std: Add close_{read,write}() methods to I/OAlex Crichton-1/+5
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-04Implement fallbacks for functions unavailable in older versions of WindowsAlan Williams-11/+4
2014-04-29rustc: Add search paths to dylib load pathsAlex Crichton-1/+1
When a syntax extension is loaded by the compiler, the dylib that is opened may have other dylibs that it depends on. The dynamic linker must be able to find these libraries on the system or else the library will fail to load. Currently, unix gets by with the use of rpaths. This relies on the dylib not moving around too drastically relative to its dependencies. For windows, however, this is no rpath available, and in theory unix should work without rpaths as well. This modifies the compiler to add all -L search directories to the dynamic linker's set of load paths. This is currently managed through environment variables for each platform. Closes #13848
2014-04-24std: Add timeouts to unix connect/acceptAlex Crichton-1/+1
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-19std: Add an experimental connect_timeout functionAlex Crichton-5/+10
This adds a `TcpStream::connect_timeout` function in order to assist opening connections with a timeout (cc #13523). There isn't really much design space for this specific operation (unlike timing out normal blocking reads/writes), so I am fairly confident that this is the correct interface for this function. The function is marked #[experimental] because it takes a u64 timeout argument, and the u64 type is likely to change in the future.
2014-04-16This is a Windows specific fix in libc. According to MSDN, the GUIDiancormac84-2/+2
structure's Data2 and Data3 members expect WORD types instead of DWORD. I discovered this discrepancy while experimenting with some bindings to Microsoft's OLE2 api. The discrepancy was corrupting the contents of the string returned by UuidToString after I used known GUIDs to test the accuracy of the function binding. I didn't add test cases because it would mean adding a dependency to my rather incomplete binding library. However, the fix produces expected string values when tested.
2014-04-16auto merge of #13454 : brson/rust/noglobs, r=alexcrichtonbors-61/+147
Them removes all the glob reexports from liblibc. I did it by removing them all, and then adding back per-platform explicit reexports until everything built again. I realize this isn't the best strategy for determining an API, but this is the lowest-impact change that solves the problem, plus I'm dissatisfied with the design of this library for other reasons and think it needs to be reconsidered from top to bottom (later). Progress on #11870.
2014-04-15Remove usage of private enum variantsAlex Crichton-2/+2
This replaces all uses of private enum variants with a struct that has one private field pointing at a private enum. RFC: 0006-remove-priv
2014-04-15libc: Deglob reexports. #11870Brian Anderson-61/+147
2014-04-10rustc: Don't succeed on shadowed nonexistent importAlex Crichton-1/+1
Previously resolve was checking the "import resolution" for whether an import had succeeded or not, but this was the same structure filled in by a previous import if a name is shadowed. Instead, this alters resolve to consult the local resolve state (as opposed to the shared one) to test whether an import succeeded or not. Closes #13404
2014-04-08Register new snapshotsAlex Crichton-8/+1
2014-04-05rustc: Pass --enable-long-section-names to gccAlex Crichton-0/+7
This was quite a curious bug on windows, and the details can be found in the comment I added to src/librustc/back/link.rs
2014-04-04Fix fallout from std::libc separationCorey Richardson-45/+29
2014-04-04Change how the readdir/opendir hack worksCorey Richardson-10/+6
2014-04-04Remove libc from stdCorey Richardson-0/+4323
These wrappers are bound to a specific libc, and they don't need to be part of libstd.