about summary refs log tree commit diff
path: root/src/libstd/rt/rtio.rs
AgeCommit message (Collapse)AuthorLines
2013-11-03Modify IoFactory's fs_mkdir, and add fs_renameAlex Crichton-1/+2
The invocation for making a directory should be able to specify a mode to make the directory with (instead of defaulting to one particular mode). Additionally, libuv and various OSes implement efficient versions of renaming files, so this operation is exposed as an IoFactory call.
2013-10-30Make Writer::flush a no-op default methodAlex Crichton-1/+0
Closes #9126
2013-10-25Enhance timers to create portsAlex Crichton-1/+3
In addition to being able to sleep the current task, timers should be able to create ports which get notified after a period of time. Closes #10014
2013-10-24Remove the 'callback_ms' function from EventLoopAlex Crichton-1/+0
This is a peculiar function to require event loops to implement, and it's only used in one spot during tests right now. Instead, a possibly more robust apis for timers should be used rather than requiring all event loops to implement a curious-looking function.
2013-10-24Another round of test fixes and merge conflictsAlex Crichton-1/+15
2013-10-24wrapping libuv signal for use in RustDo Nhat Minh-0/+6
descriptive names easier-to-use api reorganize and document
2013-10-24Move stdin to using libuv's pipes instead of a ttyAlex Crichton-0/+1
I was seeing a lot of weird behavior with stdin behaving as a tty, and it doesn't really quite make sense, so instead this moves to using libuv's pipes instead (which make more sense for stdin specifically). This prevents piping input to rustc hanging forever.
2013-10-24Move as much I/O as possible off of native::ioAlex Crichton-1/+2
When uv's TTY I/O is used for the stdio streams, the file descriptors are put into a non-blocking mode. This means that other concurrent writes to the same stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we avoid this error. There is one location which cannot move, which is the runtime's dumb_println function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and simply retry again and again.
2013-10-24Migrate the last typedefs to ~Trait in rtioAlex Crichton-9/+4
There are no longer any remnants of typedefs, and everything is now built on true trait objects.
2013-10-24Don't attempt to export uv functions directlyAlex Crichton-1/+0
2013-10-24Remove IoFactoryObject for ~IoFactoryAlex Crichton-6/+27
This involved changing a fair amount of code, rooted in how we access the local IoFactory instance. I added a helper method to the rtio module to access the optional local IoFactory. This is different than before in which it was assumed that a local IoFactory was *always* present. Now, a separate io_error is raised when an IoFactory is not present, yet I/O is requested.
2013-10-24Remove rt::io::supportAlex Crichton-7/+6
This removes the PathLike trait associated with this "support module". This is yet another "container of bytes" trait, so I didn't want to duplicate what already exists throughout libstd. In actuality, we're going to pass of C strings to the libuv APIs, so instead the arguments are now bound with the 'ToCStr' trait instead. Additionally, a layer of complexity was removed by immediately converting these type-generic parameters into CStrings to get handed off to libuv apis.
2013-10-24Migrate Rtio objects to true trait objectsAlex Crichton-26/+20
This moves as many as I could over to ~Trait instead of ~Typedef. The only remaining one is the IoFactoryObject which should be coming soon...
2013-10-24Move rt::io::stdio from FileStream to a TTYAlex Crichton-0/+11
We get a little more functionality from libuv for these kinds of streams (things like terminal dimentions), and it also appears to more gracefully handle the stream being a window. Beforehand, if you used stdio and hit CTRL+d on a process, libuv would continually return 0-length successful reads instead of interpreting that the stream was closed. I was hoping to be able to write tests for this, but currently the testing infrastructure doesn't allow tests with a stdin and a stdout, but this has been manually tested! (not that it means much)
2013-10-24Remove unbound pipes from io::pipeAlex Crichton-2/+0
This isn't necessary for creating processes (or at least not right now), and it inherently attempts to expose implementation details.
2013-10-24Finish implementing io::net::addrinfoAlex Crichton-1/+3
This fills in the `hints` structure and exposes libuv's full functionality for doing dns lookups.
2013-10-24Implement io::net::unixAlex Crichton-1/+18
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-1/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-1/+2
2013-09-18Implement process bindings to libuvAlex Crichton-0/+19
This is a re-landing of #8645, except that the bindings are *not* being used to power std::run just yet. Instead, this adds the bindings as standalone bindings inside the rt::io::process module. I made one major change from before, having to do with how pipes are created/bound. It's much clearer now when you can read/write to a pipe, as there's an explicit difference (different types) between an unbound and a bound pipe. The process configuration now takes unbound pipes (and consumes ownership of them), and will return corresponding pipe structures back if spawning is successful (otherwise everything is destroyed normally).
2013-09-17std: remove RtioStreamJeff Olson-5/+0
2013-09-16std: remove impl'd/commented-out fstat signaturesJeff Olson-1/+0
2013-09-16std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanupJeff Olson-0/+2
2013-09-16std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriterJeff Olson-0/+2
add ignores for win32 tests on previous file io stuff...
2013-09-16std/rt: in-progress file io workJeff Olson-1/+8
std: remove unneeded field from RequestData struct std: rt::uv::file - map us_fs_stat & start refactoring calls into FsRequest std: stubbing out stat calls from the top-down into uvio std: us_fs_* operations are now by-val self methods on FsRequest std: post-rebase cleanup std: add uv_fs_mkdir|rmdir + tests & minor test cleanup in rt::uv::file WORKING: fleshing out FileStat and FileInfo + tests std: reverting test files.. refactoring back and cleanup...
2013-09-05std::rt: Add get_host_addresses functionBrian Anderson-0/+1
This is a very simplistic method for host name resolution. It converts a host name to a vector of IP addresses. Should be enough to get started.
2013-06-23Split out starting a listener from accepting incoming connections.Eric Reed-0/+5
The Listener trait takes two type parameters, the type of connection and the type of Acceptor, and specifies only one method, listen, which consumes the listener and produces an Acceptor. The Acceptor trait takes one type parameter, the type of connection, and defines two methods. The accept() method waits for an incoming connection attempt and returns the result. The incoming() method creates an iterator over incoming connections and is a default method. Example: let listener = TcpListener.bind(addr); // Bind to a socket let acceptor = listener.listen(); // Start the listener for stream in acceptor.incoming() { // Process incoming connections forever (or until you break out of the loop) }
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-19/+3
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-27Implement process bindings to libuvAlex Crichton-3/+19
Closes #6436
2013-08-22std: put FileMode/Access->whence-mask in uvio, open/unlink as fns in file::Jeff Olson-1/+2
2013-08-22std: slight refactor on UvFilestream seek behavior, pre-seek-refactorJeff Olson-1/+2
2013-08-22std: rework file io.. support [p]read,[p]write, impl seek/tell + more testsJeff Olson-5/+10
2013-08-22std: rt::io::file::FileStream fleshed out.. needs more work.. see extendedJeff Olson-2/+3
- change all uses of Path in fn args to &P - FileStream.read assumptions were wrong (libuv file io is non-positional) - the above will mean that we "own" Seek impl info .. should probably push it in UvFileDescriptor.. - needs more tests
2013-08-22std: CRUD file io bindings in uvio, fs_open()/unlink() in IoFactory + testJeff Olson-0/+23
2013-08-20auto merge of #8631 : anasazi/rust/homing-io, r=brsonbors-1/+1
libuv handles are tied to the event loop that created them. In order to perform IO, the handle must be on the thread with its home event loop. Thus, when as task wants to do IO it must first go to the IO handle's home event loop and pin itself to the corresponding scheduler while the IO action is in flight. Once the IO action completes, the task is unpinned and either returns to its home scheduler if it is a pinned task, or otherwise stays on the current scheduler. Making new blocking IO implementations (i.e. files) thread safe is rather simple. Add a home field to the IO handle's struct in uvio and implement the HomingIO trait. Wrap every IO call in the HomingIO.home_for_io method, which will take care of the scheduling. I'm not sure if this remains thread safe in the presence of asynchronous IO at the libuv level. If we decide to do that, then this set up should be revisited.
2013-08-19Make IO thread-safe.Eric Reed-2/+2
Each IO handle has a home event loop, which created it. When a task wants to use an IO handle, it must first make sure it is on that home event loop. It uses the scheduler handle in the IO handle to send itself there before starting the IO action. Once the IO action completes, the task restores its previous home state. If it is an AnySched task, then it will be executed on the new scheduler. If it has a normal home, then it will return there before executing any more code after the IO action.
2013-08-19Homed UDP socketsEric Reed-1/+1
2013-08-16Moved the logic for a pausible idle callback into a new type - ↵toddaaro-5/+8
PausibleIdleCallback and placed the appropriate signatures in rtio and implementation into uvio.
2013-08-03Rename IpAddr -> SocketAddr, extract IpAddr from SocketAddrStepan Koltsov-8/+8
multicast functions now take IpAddr (without port), because they dont't need port. Uv* types renamed: * UvIpAddr -> UvSocketAddr * UvIpv4 -> UvIpv4SocketAddr * UvIpv6 -> UvIpv6SocketAddr "Socket address" is a common name for (ip-address, port) pair (e.g. in sockaddr_in struct).
2013-07-25libstd: Implement some missing udp methods.Luqman Aden-8/+8
2013-07-25libstd: Implement some missing tcp methods.Luqman Aden-6/+6
2013-07-25libstd: Implement {peer, socket}_name for new rt tcp & udp.Luqman Aden-2/+2
2013-07-22std: add RtioTimer and UvTimer impl atop rt::uvJeff Olson-0/+6
2013-07-19Changed methods on UDP sockets and TCP/UDP watchers to &mut self to reflect ↵Eric Reed-20/+20
that libuv may change the underlying handle.
2013-07-02converted TODOs into XXXsEric Reed-1/+0
2013-07-02IPv6 support for UDP and TCP.Eric Reed-3/+27
2013-06-19socket based UDP ioEric Reed-7/+7
2013-06-17Added a RtioUdpStream traitEric Reed-0/+7
2013-05-29Merge remote-tracking branch 'brson/io' into incomingBrian Anderson-0/+11
Conflicts: src/libstd/rt/sched.rs
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+45
This only changes the directory names; it does not change the "real" metadata names.