about summary refs log tree commit diff
path: root/src/libstd/rt/uv/uvll.rs
AgeCommit message (Collapse)AuthorLines
2013-10-29Register new snapshotsAlex Crichton-1176/+0
2013-10-26Implement another error code found on windows.Alex Crichton-0/+2
Closes #8811
2013-10-25Cache and buffer stdout per-task for printingAlex Crichton-2/+3
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-32/+18
2013-10-24wrapping libuv signal for use in RustDo Nhat Minh-0/+24
descriptive names easier-to-use api reorganize and document
2013-10-24Test fixes and merge conflictsAlex Crichton-12/+13
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-10/+36
2013-10-24Move rt::io::stdio from FileStream to a TTYAlex Crichton-0/+7
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-24Implement io::net::unixAlex Crichton-0/+19
2013-10-23Made uv_stat_t.{st_dev, st_ino} public, #9958Ziad Hatahet-2/+2
2013-10-23Making ai_next field publicreedlepee-1/+1
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-29/+19
2013-10-23Making fields in std and extra : private #4386reedlepee-45/+55
2013-10-05std::rt: Add NotConnected to IoErrorKindklutzy-0/+2
2013-09-18Implement process bindings to libuvAlex Crichton-0/+91
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-18Register new snapshotsAlex Crichton-41/+0
2013-09-16std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanupJeff Olson-0/+14
2013-09-16std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriterJeff Olson-2/+2
add ignores for win32 tests on previous file io stuff...
2013-09-16std/rt: in-progress file io workJeff Olson-0/+87
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-16std::rt::uv::uvll: Fix uv_req_type on Win32klutzy-3/+27
Also enables request_sanity_check() test. Closes #8817
2013-09-13std::rt::io: Fix file I/O on Win32klutzy-0/+9
It was broken on win32 because of header inconsistency.
2013-09-06Upgrade libuv to the current master (again)Alex Crichton-41/+28
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: Fix addrinfo definition on BSDBrian Anderson-1/+15
2013-09-05std::rt: Add libuv bindings for getaddrinfoBrian Anderson-0/+58
2013-08-29auto merge of #8819 : vadimcn/rust/unit-tests, r=brsonbors-0/+1
Some of the tests are failing. I've only managed to fix 'memory_map_file', the rest are up for grabs... Fixes #5261.
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-122/+40
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-28Turned off libstd unit tests that currently fail on Windows.Vadim Chugunov-0/+1
2013-08-27Implement process bindings to libuvAlex Crichton-0/+94
Closes #6436
2013-08-27Upgrade libuv to the current master + our patchesAlex Crichton-40/+28
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-22std: adding #[fixed_stack_segment] as needed in new uvll callsJeff Olson-0/+16
2013-08-22std: remove fcntl const bindings + making valgrind clean w/ no owned vecsJeff Olson-18/+0
2013-08-22std: add read and unlink to low-level FileDescriptor + end-to-end CRUD testJeff Olson-0/+13
2013-08-22std: working tests for low-level libuv open, write and close operationsJeff Olson-15/+19
2013-08-22std: bootstrapping libuv-based fileio in newrt... open & closeJeff Olson-0/+45
the test "touch"es a new file
2013-08-21Adjust callbacks in the libraries for the new type of extern fnsNiko Matsakis-21/+102
cc #3678
2013-08-19Make IO thread-safe.Eric Reed-1/+1
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-19Instruct event loops to ignore SIGPIPE when constructed.Eric Reed-0/+1
libuv does not always catch SIGPIPE.
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+151
2013-08-18auto merge of #8551 : huonw/rust/speling, r=alexcrichtonbors-1/+1
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-16doc: correct spelling in documentation.Huon Wilson-1/+1
2013-08-15Add ToCStr method .with_c_str()Kevin Ballard-2/+2
.with_c_str() is a replacement for the old .as_c_str(), to avoid unnecessary boilerplate. Replace all usages of .to_c_str().with_ref() with .with_c_str().
2013-08-09auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=ericktbors-2/+3
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects: * No interior nulls * Ends with a trailing null
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-9/+0
2013-08-04std: replace str::as_c_str with std::c_strErick Tryzelaar-2/+3
2013-07-25libstd: Implement some missing udp methods.Luqman Aden-3/+13
2013-07-25libstd: Implement {peer, socket}_name for new rt tcp & udp.Luqman Aden-31/+17
2013-07-23std: move StrUtil::as_c_str into StrSliceErick Tryzelaar-2/+2
2013-07-02IPv6 support for UDP and TCP.Eric Reed-6/+86
2013-06-25removed obsolete FIXMEs. formatting changes.Eric Reed-54/+24