about summary refs log tree commit diff
path: root/src/rt/rust_uv.cpp
AgeCommit message (Collapse)AuthorLines
2013-11-18Move runtime files to C instead of C++Alex Crichton-212/+0
Explicitly have the only C++ portion of the runtime be one file with exception handling. All other runtime files must now live in C and be fully defined in C.
2013-11-10Another round of test fixes from previous commitsAlex Crichton-4/+2
2013-11-10Update to the latest libuvAlex Crichton-152/+25
At this time, also point the libuv submodule to the official repo instead of my own off to the side. cc #10246 Closes #10329
2013-11-10Work around bugs in 32-bit enum FFIAlex Crichton-0/+5
cc #10308
2013-11-10Migrate uv timer bindings away from ~fn()Alex Crichton-5/+0
2013-11-10uv: Remove lots of uv/C++ wrappersAlex Crichton-352/+0
2013-11-03Fill out the remaining functionality in io::fileAlex Crichton-0/+4
This adds bindings to the remaining functions provided by libuv, all of which are useful operations on files which need to get exposed somehow. Some highlights: * Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type * Moved all file-related methods to be static methods under `File` * All directory related methods are still top-level functions * Created `io::FilePermission` types (backed by u32) that are what you'd expect * Created `io::FileType` and refactored `FileStat` to use FileType and FilePermission * Removed the expanding matrix of `FileMode` operations. The mode of reading a file will not have the O_CREAT flag, but a write mode will always have the O_CREAT flag. Closes #10130 Closes #10131 Closes #10121
2013-11-03Remove all blocking std::os blocking functionsAlex Crichton-0/+4
This commit moves all thread-blocking I/O functions from the std::os module. Their replacements can be found in either std::rt::io::file or in a hidden "old_os" module inside of native::file. I didn't want to outright delete these functions because they have a lot of special casing learned over time for each OS/platform, and I imagine that these will someday get integrated into a blocking implementation of IoFactory. For now, they're moved to a private module to prevent bitrot and still have tests to ensure that they work. I've also expanded the extensions to a few more methods defined on Path, most of which were previously defined in std::os but now have non-thread-blocking implementations as part of using the current IoFactory. The api of io::file is in flux, but I plan on changing it in the next commit as well. Closes #10057
2013-11-03Modify IoFactory's fs_mkdir, and add fs_renameAlex Crichton-0/+5
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-25Cache and buffer stdout per-task for printingAlex Crichton-1/+1
Almost all languages provide some form of buffering of the stdout stream, and this commit adds this feature for rust. A handle to stdout is lazily initialized in the Task structure as a buffered owned Writer trait object. The buffer behavior depends on where stdout is directed to. Like C, this line-buffers the stream when the output goes to a terminal (flushes on newlines), and also like C this uses a fixed-size buffer when output is not directed at a terminal. We may decide the fixed-size buffering is overkill, but it certainly does reduce write syscall counts when piping output elsewhere. This is a *huge* benefit to any code using logging macros or the printing macros. Formatting emits calls to `write` very frequently, and to have each of them backed by a write syscall was very expensive. In a local benchmark of printing 10000 lines of "what" to stdout, I got the following timings: when | terminal | redirected ---------------------------------- before | 0.575s | 0.525s after | 0.197s | 0.013s C | 0.019s | 0.004s I can also confirm that we're buffering the output appropriately in both situtations. We're still far slower than C, but I believe much of that has to do with the "homing" that all tasks due, we're still performing an order of magnitude more write syscalls than C does.
2013-10-24Another round of test fixes and merge conflictsAlex Crichton-10/+0
2013-10-24wrapping libuv signal for use in RustDo Nhat Minh-0/+15
descriptive names easier-to-use api reorganize and document
2013-10-24Test fixes and merge conflictsAlex Crichton-13/+0
2013-10-24Move as much I/O as possible off of native::ioAlex Crichton-0/+5
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-24Don't attempt to export uv functions directlyAlex Crichton-0/+31
2013-10-24Finish implementing io::net::addrinfoAlex Crichton-0/+13
This fills in the `hints` structure and exposes libuv's full functionality for doing dns lookups.
2013-09-18Implement process bindings to libuvAlex Crichton-0/+35
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-16std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanupJeff Olson-0/+9
2013-09-16std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriterJeff Olson-21/+21
add ignores for win32 tests on previous file io stuff...
2013-09-16merge cleanupJeff Olson-21/+21
2013-09-16std/rt: in-progress file io workJeff Olson-0/+42
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-06Upgrade libuv to the current master (again)Alex Crichton-9/+2
This is a reopening of the libuv-upgrade part of #8645. Hopefully this won't cause random segfaults all over the place. The windows regression in testing should also be fixed (it shouldn't build the whole compiler twice). A notable difference from before is that gyp is now a git submodule instead of always git-cloned at make time. This allows bundling for releases more easily. Closes #8850
2013-09-05std::rt: Add libuv bindings for getaddrinfoBrian Anderson-0/+5
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-36/+9
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-0/+34
Closes #6436
2013-08-27Upgrade libuv to the current master + our patchesAlex Crichton-9/+2
There were two main differences with the old libuv and the master version: 1. The uv_last_error function is now gone. The error code returned by each function is the "last error" so now a UvError is just a wrapper around a c_int. 2. The repo no longer includes a makefile, and the build system has change. According to the build directions on joyent/libuv, this now downloads a `gyp` program into the `libuv/build` directory and builds using that. This shouldn't add any dependences on autotools or anything like that. Closes #8407 Closes #6567 Closes #6315
2013-08-22make check appeasementJeff Olson-1/+1
2013-08-22rt: re-adding lines erroneous stripped out in merge conflictJeff Olson-0/+9
2013-08-22std: stripping unneeded fcntl.h include from rust_uv.cppJeff Olson-1/+0
2013-08-22std: remove fcntl const bindings + making valgrind clean w/ no owned vecsJeff Olson-36/+0
2013-08-22std: add read and unlink to low-level FileDescriptor + end-to-end CRUD testJeff Olson-5/+30
2013-08-22std: working tests for low-level libuv open, write and close operationsJeff Olson-4/+43
2013-08-19Instruct event loops to ignore SIGPIPE when constructed.Eric Reed-0/+9
libuv does not always catch SIGPIPE.
2013-08-16rt: Remove unused uv helpersBrian Anderson-93/+0
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-136/+0
2013-07-25libstd: Implement some missing udp methods.Luqman Aden-0/+6
2013-07-25libstd: Implement {peer, socket}_name for new rt tcp & udp.Luqman Aden-38/+22
2013-07-08Merge remote-tracking branch 'mozilla/master'Brian Anderson-1/+2
Conflicts: src/libextra/test.rs src/libstd/rt/global_heap.rs src/libstd/unstable/lang.rs src/libstd/vec.rs
2013-07-03Add x64 windows to platform.mk and mingw64 header fixes.Luqman Aden-1/+2
2013-07-02IPv6 support for UDP and TCP.Eric Reed-0/+94
2013-06-25satisfy the formatting checkEric Reed-2/+2
2013-06-14Added a utility function to extract the udp handle from udp send requests.Eric Reed-0/+5
2013-06-13Corrected libuv UDP bindings.Eric Reed-0/+37
2013-05-15core::rt: Add uv timer bindingsBrian Anderson-1/+1
2013-04-19librustc: WIP patch for using the return value.Patrick Walton-2/+1
2013-03-18core: Simplify uvll bindings and strip out currently-unused bitsBrian Anderson-0/+48
No more mapping uv structs to Rust structs
2013-03-11core: Add rt mod and add the new scheduler codeBrian Anderson-16/+25
2013-02-10rt/std: update of libuv API glue for libuv submodule updateJeff Olson-6/+6
2013-01-23std: Convert uv_global_loop to use pipesBrian Anderson-9/+0
2012-12-10Add license boilerplate to more files.Graydon Hoare-0/+10