History log of /libuv/src/unix/stream.c (Results 101 – 125 of 249)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 513ce625 31-Jan-2014 Fedor Indutny

Merge branch 'v0.10'

Conflicts:
AUTHORS
ChangeLog
src/unix/stream.c
src/version.c


# a6ff04d2 31-Jan-2014 Oguz Bastemur

stream: start thread after assignments

Changed the order of the member assignments since the thread
may start before the parameters are assigned. This especially
happens when the osx

stream: start thread after assignments

Changed the order of the member assignments since the thread
may start before the parameters are assigned. This especially
happens when the osx scheduler is very busy.

show more ...

# 17648be2 28-Dec-2013 River Tarnell

unix: fix non-OSX builds

uv__stream_osx_interrupt_select was only defined on OS X, but is used
elsewhere on all platforms. The intention was to implement it as a
no-op on other plat

unix: fix non-OSX builds

uv__stream_osx_interrupt_select was only defined on OS X, but is used
elsewhere on all platforms. The intention was to implement it as a
no-op on other platforms, but the entire definition was inside
"#ifdef __APPLE__", so this didn't actually work.

Fix: move it above the #ifdef.

show more ...

# 08cafd09 20-Dec-2013 Fedor Indutny

stream: fix uv__stream_osx_select

Relying on `readable`/`writable` when polling will lead to the select
thread spinning in the loop and calling `uv_async_send()`, because
stream may

stream: fix uv__stream_osx_select

Relying on `readable`/`writable` when polling will lead to the select
thread spinning in the loop and calling `uv_async_send()`, because
stream may never become not `readable`/`writable`.

We should rely on `uv__io_active()` instead and interruprt select thread
every time it changes.

show more ...

# 8b6c19e2 23-Dec-2013 Fedor Indutny

Revert "pipe: allow queueing pending handles"

The commit is quite broken and must be refactored before going into.

This reverts commit 08aeaf61935060e01f15cc1df2c9f09e892b0980.

# 08aeaf61 22-Dec-2013 Fedor Indutny

pipe: allow queueing pending handles

If multiple handles arrive to the IPC pipe at the same time (happens on
some platforms), libuv will queue them internally, and call `read2_cb`
mu

pipe: allow queueing pending handles

If multiple handles arrive to the IPC pipe at the same time (happens on
some platforms), libuv will queue them internally, and call `read2_cb`
multiple times with a null-buffer and proper `handle_type`.

show more ...

# 17d60e3f 13-Dec-2013 Fedor Indutny

stream: allow multiple buffers for uv_try_write

# b5e7798a 06-Dec-2013 Fedor Indutny

stream: introduce uv_try_write(...)

`uv_try_write(stream, buf, size)` acts like `uv_write()`,
but without queueing actual write until UV_POLLOUT (or IOCP completion).
This is useful

stream: introduce uv_try_write(...)

`uv_try_write(stream, buf, size)` acts like `uv_write()`,
but without queueing actual write until UV_POLLOUT (or IOCP completion).
This is useful for doing writes using on-stack `uv_write_t` requests.

fix #1025

show more ...

# 5812e19b 30-Nov-2013 isaacs

Merge branch 'v0.10'


# 47d98b64 29-Nov-2013 Alex Gaynor

doc: Removed use of gendered pronouns

# 27795cfc 25-Nov-2013 Ben Noordhuis

unix: fix accept() EMFILE error handling

Fix a bug that was introduced in commit 3ee4d3f ("unix, windows:
return error codes directly") and add a regression test for good
measure.

unix: fix accept() EMFILE error handling

Fix a bug that was introduced in commit 3ee4d3f ("unix, windows:
return error codes directly") and add a regression test for good
measure.

Hat tip to Fedor for pointing out the issue.

Fixes #1007.

show more ...

# ab372499 18-Nov-2013 Ben Noordhuis

unix: nicer error message when kqueue() fails

Print the error message rather than just the errno. The fact that the
errno is 24 is only informative to people that have their operating

unix: nicer error message when kqueue() fails

Print the error message rather than just the errno. The fact that the
errno is 24 is only informative to people that have their operating
system's error codes memorized.

show more ...

# e9f75fb1 15-Nov-2013 Ben Noordhuis

unix: set close-on-exec flag on received fds

Set the close-on-exec flag on file descriptors that we've received with
recvmsg() so we don't leak them when calling fork() afterwards.

unix: set close-on-exec flag on received fds

Set the close-on-exec flag on file descriptors that we've received with
recvmsg() so we don't leak them when calling fork() afterwards.

On Linux, we use the MSG_CMSG_CLOEXEC flag when supported (2.6.23 and
up.)

On older Linux versions and other platforms, we walk the received file
descriptors and set the close-on-exec flag for each fd manually. That
won't entirely avoid race conditions when other threads call fork() or
clone() but at least we're less likely to leak file descriptors now.

show more ...

# fb36c099 26-Oct-2013 Keno Fischer

unix: move uv_shutdown() assertion

Allows uv_shutdown() to return an error as intended if the stream has
already been closed.

Fixes #972, refs JuliaLang/julia#4229.

# 359d6678 01-Oct-2013 Ben Noordhuis

unix: sanity-check fds before closing

Ensure that close() system calls don't close stdio file descriptors
because that is almost never the intention.

This is also a partial work

unix: sanity-check fds before closing

Ensure that close() system calls don't close stdio file descriptors
because that is almost never the intention.

This is also a partial workaround for a kernel bug that seems to affect
all Linux kernels when stdin is a pipe that gets closed: fd 0 keeps
signalling EPOLLHUP but a subsequent call to epoll_ctl(EPOLL_CTL_DEL)
fails with EBADF. See joyent/node#6271 for details and a test case.

show more ...

# d7115f06 12-Sep-2013 Ben Noordhuis

unix, windows: make uv_is_*() always return 0 or 1

Ensure that the following API functions always return either 0 or 1:

* uv_is_active()
* uv_is_closing()
* uv_is_read

unix, windows: make uv_is_*() always return 0 or 1

Ensure that the following API functions always return either 0 or 1:

* uv_is_active()
* uv_is_closing()
* uv_is_readable()
* uv_is_writable()

show more ...

# 779b8d81 31-Aug-2013 Ben Noordhuis

include: make uv_write{2} const correct

# b7d027c3 31-Aug-2013 Ben Noordhuis

include: uv_read{2}_cb now takes const uv_buf_t*

Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a

include: uv_read{2}_cb now takes const uv_buf_t*

Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.

show more ...

# 3fb66122 31-Aug-2013 Ben Noordhuis

include: uv_alloc_cb now takes uv_buf_t*

Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
poin

include: uv_alloc_cb now takes uv_buf_t*

Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.

show more ...

# 6837e480 08-Aug-2013 Ben Noordhuis

unix: fix missing return value warning in stream.c

# 1acbd768 26-Mar-2013 Ben Noordhuis

unix, windows: don't read/recv if buf.len==0

Make it possible for the libuv user to handle out of memory conditions
gracefully. When alloc_cb() returns a buffer with len==0, call the rea

unix, windows: don't read/recv if buf.len==0

Make it possible for the libuv user to handle out of memory conditions
gracefully. When alloc_cb() returns a buffer with len==0, call the read
or recv callback with nread=UV_ENOBUFS. It's up to the user to stop or
close the handle.

Fixes #752.

show more ...

# 3ee4d3f1 06-Jun-2013 Ben Noordhuis

unix, windows: return error codes directly

This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like

unix, windows: return error codes directly

This commit changes the libuv API to return error codes directly rather
than storing them in a loop-global field.

A code snippet like this one:

if (uv_foo(loop) < 0) {
uv_err_t err = uv_last_error(loop);
fprintf(stderr, "%s\n", uv_strerror(err));
}

Should be rewritten like this:

int err = uv_foo(loop);
if (err < 0)
fprintf(stderr, "%s\n", uv_strerror(err));

The rationale for this change is that it should make creating bindings
for other languages a lot easier: dealing with struct return values is
painful with most FFIs and often downright buggy.

show more ...

# 92040eb7 18-Jun-2013 Henry Rawas

stream: add an API to make streams do blocking writes

This patch adds the `uv_stream_set_blocking` API which makes all
uv_write calls to that stream blocking. It currently only works for

stream: add an API to make streams do blocking writes

This patch adds the `uv_stream_set_blocking` API which makes all
uv_write calls to that stream blocking. It currently only works for
pipes, on windows.

show more ...

# 0c3b061a 13-Jun-2013 Ben Noordhuis

Merge remote-tracking branch 'origin/v0.10'

Conflicts:
src/unix/stream.c
src/version.c


# 12210fe5 08-Jun-2013 Ben Noordhuis

unix: fix busy loop, write if POLLERR or POLLHUP

This fixes a busy loop by working around a quirk with Linux kernels
<= 2.6.32 where an EPIPE or ECONNRESET error on a file descriptor tha

unix: fix busy loop, write if POLLERR or POLLHUP

This fixes a busy loop by working around a quirk with Linux kernels
<= 2.6.32 where an EPIPE or ECONNRESET error on a file descriptor that
is polled for EPOLLOUT but not EPOLLIN gets reported by epoll_wait() as
just EPOLLERR|EPOLLHUP, like this:

epoll_wait(5, {{EPOLLERR|EPOLLHUP, {u32=12, u64=12}}}, 1024, 433) = 1

Before this commit, libuv called uv__read() which attempts to read from
the file descriptor. With newer kernels and on other operating systems
that fails like this:

read(12, "", 65536) = -1 EPIPE (Broken pipe)

Which tells libuv there is a connection error and it should notify the
user of that. On the affected Linux kernels however, the read succeeds
with an EOF:

read(12, "", 65536) = 0

Which is subsequently passed on to the user. In most cases, the user
will close the handle and everything is fine.

Node.js however sometimes keeps the handle open in an attempt to flush
pending write requests. While libuv doesn't officially support this,
unofficially it works...

...except on those older kernels. Because the kernel keeps waking up
the event loop without setting POLLOUT and because the read calls EOF
but don't error, libuv's I/O state machine doesn't progress.

That's why this commit changes uv__stream_io() to also write pending
data. While the read() system call doesn't error, the write() system
call will.

Fixes joyent/node#5504.

show more ...

12345678910