From dc1d55dfec29d43b5446d97d545cb819b8284e8a Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Wed, 6 Jul 2011 21:23:06 -0700 Subject: [PATCH] If we are only writing or reading a single iovec, use the non-v versions of the calls, so we are hitting the exact same syscalls as non-uv, and it makes dtruss output easier to read. --- uv-unix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/uv-unix.c b/uv-unix.c index df33f151..de92f3da 100644 --- a/uv-unix.c +++ b/uv-unix.c @@ -616,7 +616,12 @@ static uv_req_t* uv__write(uv_tcp_t* tcp) { * inside the iov each time we write. So there is no need to offset it. */ - n = writev(tcp->fd, iov, iovcnt); + if (iovcnt == 1) { + n = write(tcp->fd, iov[0].iov_base, iov[0].iov_len); + } + else { + n = writev(tcp->fd, iov, iovcnt); + } if (n < 0) { if (errno != EAGAIN) { @@ -735,7 +740,7 @@ void uv__read(uv_tcp_t* tcp) { iov = (struct iovec*) &buf; - nread = readv(tcp->fd, iov, 1); + nread = read(tcp->fd, buf.base, buf.len); if (nread < 0) { /* Error */