aboutsummaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/unix/stream.c')
-rw-r--r--deps/uv/src/unix/stream.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/deps/uv/src/unix/stream.c b/deps/uv/src/unix/stream.c
index 9043664dfc..7dbc556f74 100644
--- a/deps/uv/src/unix/stream.c
+++ b/deps/uv/src/unix/stream.c
@@ -159,9 +159,9 @@ static void uv__stream_osx_select(void* arg) {
memset(s->sread, 0, s->sread_sz);
memset(s->swrite, 0, s->swrite_sz);
- if (uv__io_active(&stream->io_watcher, UV__POLLIN))
+ if (uv__io_active(&stream->io_watcher, POLLIN))
FD_SET(fd, s->sread);
- if (uv__io_active(&stream->io_watcher, UV__POLLOUT))
+ if (uv__io_active(&stream->io_watcher, POLLOUT))
FD_SET(fd, s->swrite);
FD_SET(s->int_fd, s->sread);
@@ -202,9 +202,9 @@ static void uv__stream_osx_select(void* arg) {
/* Handle events */
events = 0;
if (FD_ISSET(fd, s->sread))
- events |= UV__POLLIN;
+ events |= POLLIN;
if (FD_ISSET(fd, s->swrite))
- events |= UV__POLLOUT;
+ events |= POLLOUT;
assert(events != 0 || FD_ISSET(s->int_fd, s->sread));
if (events != 0) {
@@ -233,14 +233,14 @@ static void uv__stream_osx_select_cb(uv_async_t* handle) {
ACCESS_ONCE(int, s->events) = 0;
assert(events != 0);
- assert(events == (events & (UV__POLLIN | UV__POLLOUT)));
+ assert(events == (events & (POLLIN | POLLOUT)));
/* Invoke callback on event-loop */
- if ((events & UV__POLLIN) && uv__io_active(&stream->io_watcher, UV__POLLIN))
- uv__stream_io(stream->loop, &stream->io_watcher, UV__POLLIN);
+ if ((events & POLLIN) && uv__io_active(&stream->io_watcher, POLLIN))
+ uv__stream_io(stream->loop, &stream->io_watcher, POLLIN);
- if ((events & UV__POLLOUT) && uv__io_active(&stream->io_watcher, UV__POLLOUT))
- uv__stream_io(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ if ((events & POLLOUT) && uv__io_active(&stream->io_watcher, POLLOUT))
+ uv__stream_io(stream->loop, &stream->io_watcher, POLLOUT);
if (stream->flags & UV_CLOSING)
return;
@@ -437,7 +437,7 @@ void uv__stream_flush_write_queue(uv_stream_t* stream, int error) {
void uv__stream_destroy(uv_stream_t* stream) {
- assert(!uv__io_active(&stream->io_watcher, UV__POLLIN | UV__POLLOUT));
+ assert(!uv__io_active(&stream->io_watcher, POLLIN | POLLOUT));
assert(stream->flags & UV_CLOSED);
if (stream->connect_req) {
@@ -511,11 +511,11 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
int err;
stream = container_of(w, uv_stream_t, io_watcher);
- assert(events == UV__POLLIN);
+ assert(events == POLLIN);
assert(stream->accepted_fd == -1);
assert(!(stream->flags & UV_CLOSING));
- uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
+ uv__io_start(stream->loop, &stream->io_watcher, POLLIN);
/* connection_cb can close the server socket while we're
* in the loop so check it on each iteration.
@@ -552,7 +552,7 @@ void uv__server_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
if (stream->accepted_fd != -1) {
/* The user hasn't yet accepted called uv_accept() */
- uv__io_stop(loop, &stream->io_watcher, UV__POLLIN);
+ uv__io_stop(loop, &stream->io_watcher, POLLIN);
return;
}
@@ -626,7 +626,7 @@ done:
} else {
server->accepted_fd = -1;
if (err == 0)
- uv__io_start(server->loop, &server->io_watcher, UV__POLLIN);
+ uv__io_start(server->loop, &server->io_watcher, POLLIN);
}
return err;
}
@@ -660,7 +660,7 @@ static void uv__drain(uv_stream_t* stream) {
int err;
assert(QUEUE_EMPTY(&stream->write_queue));
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
uv__stream_osx_interrupt_select(stream);
/* Shutdown? */
@@ -846,8 +846,8 @@ start:
/* Error */
req->error = -errno;
uv__write_req_finish(req);
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
- if (!uv__io_active(&stream->io_watcher, UV__POLLIN))
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
+ if (!uv__io_active(&stream->io_watcher, POLLIN))
uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
return;
@@ -910,7 +910,7 @@ start:
assert(!(stream->flags & UV_STREAM_BLOCKING));
/* We're not done. */
- uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
/* Notify select() thread about state change */
uv__stream_osx_interrupt_select(stream);
@@ -989,8 +989,8 @@ uv_handle_type uv__handle_type(int fd) {
static void uv__stream_eof(uv_stream_t* stream, const uv_buf_t* buf) {
stream->flags |= UV_STREAM_READ_EOF;
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
- if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
+ if (!uv__io_active(&stream->io_watcher, POLLOUT))
uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
stream->read_cb(stream, UV_EOF, buf);
@@ -1159,7 +1159,7 @@ static void uv__read(uv_stream_t* stream) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
/* Wait for the next one. */
if (stream->flags & UV_STREAM_READING) {
- uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
+ uv__io_start(stream->loop, &stream->io_watcher, POLLIN);
uv__stream_osx_interrupt_select(stream);
}
stream->read_cb(stream, 0, &buf);
@@ -1168,8 +1168,8 @@ static void uv__read(uv_stream_t* stream) {
stream->read_cb(stream, -errno, &buf);
if (stream->flags & UV_STREAM_READING) {
stream->flags &= ~UV_STREAM_READING;
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
- if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
+ if (!uv__io_active(&stream->io_watcher, POLLOUT))
uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
}
@@ -1230,7 +1230,7 @@ int uv_shutdown(uv_shutdown_t* req, uv_stream_t* stream, uv_shutdown_cb cb) {
stream->shutdown_req = req;
stream->flags |= UV_STREAM_SHUTTING;
- uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
uv__stream_osx_interrupt_select(stream);
return 0;
@@ -1255,7 +1255,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
assert(uv__stream_fd(stream) >= 0);
/* Ignore POLLHUP here. Even it it's set, there may still be data to read. */
- if (events & (UV__POLLIN | UV__POLLERR | UV__POLLHUP))
+ if (events & (POLLIN | POLLERR | POLLHUP))
uv__read(stream);
if (uv__stream_fd(stream) == -1)
@@ -1267,7 +1267,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
* have to do anything. If the partial read flag is not set, we can't
* report the EOF yet because there is still data to read.
*/
- if ((events & UV__POLLHUP) &&
+ if ((events & POLLHUP) &&
(stream->flags & UV_STREAM_READING) &&
(stream->flags & UV_STREAM_READ_PARTIAL) &&
!(stream->flags & UV_STREAM_READ_EOF)) {
@@ -1278,7 +1278,7 @@ static void uv__stream_io(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
if (uv__stream_fd(stream) == -1)
return; /* read_cb closed stream. */
- if (events & (UV__POLLOUT | UV__POLLERR | UV__POLLHUP)) {
+ if (events & (POLLOUT | POLLERR | POLLHUP)) {
uv__write(stream);
uv__write_callbacks(stream);
@@ -1327,7 +1327,7 @@ static void uv__stream_connect(uv_stream_t* stream) {
uv__req_unregister(stream->loop, req);
if (error < 0 || QUEUE_EMPTY(&stream->write_queue)) {
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
}
if (req->cb)
@@ -1422,7 +1422,7 @@ int uv_write2(uv_write_t* req,
* sufficiently flushed in uv__write.
*/
assert(!(stream->flags & UV_STREAM_BLOCKING));
- uv__io_start(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ uv__io_start(stream->loop, &stream->io_watcher, POLLOUT);
uv__stream_osx_interrupt_select(stream);
}
@@ -1461,7 +1461,7 @@ int uv_try_write(uv_stream_t* stream,
if (stream->connect_req != NULL || stream->write_queue_size != 0)
return -EAGAIN;
- has_pollout = uv__io_active(&stream->io_watcher, UV__POLLOUT);
+ has_pollout = uv__io_active(&stream->io_watcher, POLLOUT);
r = uv_write(&req, stream, bufs, nbufs, uv_try_write_cb);
if (r != 0)
@@ -1485,7 +1485,7 @@ int uv_try_write(uv_stream_t* stream,
/* Do not poll for writable, if we wasn't before calling this */
if (!has_pollout) {
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLOUT);
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLOUT);
uv__stream_osx_interrupt_select(stream);
}
@@ -1520,7 +1520,7 @@ int uv_read_start(uv_stream_t* stream,
stream->read_cb = read_cb;
stream->alloc_cb = alloc_cb;
- uv__io_start(stream->loop, &stream->io_watcher, UV__POLLIN);
+ uv__io_start(stream->loop, &stream->io_watcher, POLLIN);
uv__handle_start(stream);
uv__stream_osx_interrupt_select(stream);
@@ -1533,8 +1533,8 @@ int uv_read_stop(uv_stream_t* stream) {
return 0;
stream->flags &= ~UV_STREAM_READING;
- uv__io_stop(stream->loop, &stream->io_watcher, UV__POLLIN);
- if (!uv__io_active(&stream->io_watcher, UV__POLLOUT))
+ uv__io_stop(stream->loop, &stream->io_watcher, POLLIN);
+ if (!uv__io_active(&stream->io_watcher, POLLOUT))
uv__handle_stop(stream);
uv__stream_osx_interrupt_select(stream);
@@ -1621,7 +1621,7 @@ void uv__stream_close(uv_stream_t* handle) {
handle->queued_fds = NULL;
}
- assert(!uv__io_active(&handle->io_watcher, UV__POLLIN | UV__POLLOUT));
+ assert(!uv__io_active(&handle->io_watcher, POLLIN | POLLOUT));
}