Commit Graph

2385 Commits

Author SHA1 Message Date
Ben Noordhuis
91d3598475 unix: add atomic-ops.h
Add cmpxchgi(), cmpxchgl() and cpu_relax() functions that we can use
as simple primitives to build spinlocks out of.

PR-URL: https://github.com/libuv/libuv/pull/197
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

[NB: This is a back-port of commit a3c3b37 from the v1.x branch.]
2015-02-11 22:30:38 +01:00
Saúl Ibarra Corretgé
fb2dab826d Now working on v0.10.34 2015-01-28 21:43:47 +01:00
Saúl Ibarra Corretgé
7a2253d33a 2015.01.29, Version 0.10.33 (Stable)
Changes since version 0.10.32:

* linux: fix epoll_pwait() regression with < 2.6.19 (Ben Noordhuis)

* test: back-port uv_loop_configure() test (Ben Noordhuis)
2015-01-28 21:43:42 +01:00
Ben Noordhuis
77e85b9f30 test: back-port uv_loop_configure() test
Back-port the uv_loop_configure() test from commit 751ac48 from the v1.x
branch.

PR-URL: https://github.com/libuv/libuv/pull/165
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-25 14:59:58 +01:00
Ben Noordhuis
b214fe66ef linux: fix epoll_pwait() regression with < 2.6.19
Linux before kernel 2.6.19 does not support epoll_pwait().  Due to a
logic error in commit 2daf944 ("unix: add flag for blocking SIGPROF
during poll"), the fallback path for ENOSYS was not taken.

This commit also adds epoll_pwait() emulation using pthread_sigmask().
The block/unblock operations are not atomic but that is fine for our
particular use case, to wit, sleep through SIGPROF signals.

This is a back-port of commit 67bb2b5 from the v1.x branch.

Original-PR-URL: https://github.com/libuv/libuv/pull/162
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>

PR-URL: https://github.com/libuv/libuv/pull/165
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-01-25 14:59:28 +01:00
Saúl Ibarra Corretgé
8d07ddb8c2 Now working on v0.10.33 2015-01-05 20:10:50 +01:00
Saúl Ibarra Corretgé
378de30c59 2015.01.06, Version 0.10.32 (Stable)
Changes since version 0.10.31:

* linux: fix epoll_pwait() sigmask size calculation (Ben Noordhuis)
2015-01-05 20:10:43 +01:00
Ben Noordhuis
fa0b08ff5a linux: fix epoll_pwait() sigmask size calculation
Revisit the fix from commit b705b53.  The problem with using sigset_t
and _NSIG is that the size of sigset_t and the value of _NSIG depend
on what headers libuv picks up first, <signal.h> or <asm/signal.h>.
With the former, sizeof(sigset_t) = 128; with the latter, it's 8.

Simply sidestep the issue by calculating the signal mask as a 64 bits
integer, without using sigset_t or _NSIG.

This is a partial cherry-pick of commit 751ac48 from the v1.x branch.

Original PR-URL: https://github.com/libuv/libuv/pull/83
PR-URL: https://github.com/libuv/libuv/pull/84
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-25 15:30:52 +01:00
Saúl Ibarra Corretgé
03444aa4a0 Now working on v0.10.32 2014-12-24 08:53:52 +01:00
Saúl Ibarra Corretgé
4dbd27e221 2014.12.25, Version 0.10.31 (Stable)
Changes since version 0.10.30:

* test: test that closing a poll handle doesn't corrupt the stack (Bert
  Belder)

* win: fix compilation of tests (Marc Schlaich)

* Revert "win: keep a reference to AFD_POLL_INFO in cancel poll" (Bert
  Belder)

* win: avoid stack corruption when closing a poll handle (Bert Belder)

* gitignore: ignore Visual Studio files (Marc Schlaich)

* win: set fallback message if FormatMessage fails (Marc Schlaich)

* win: fall back to default language in uv_dlerror (Marc Schlaich)

* test: improve compatibility for dlerror test (Marc Schlaich)

* test: check dlerror is "no error" in no error case (Marc Schlaich)

* build: link against -pthread (Logan Rosen)

* win: scandir use 'ls' for formatting long strings (Kenneth Perry)
2014-12-24 08:53:45 +01:00
Kenneth Perry
796425205b win: scandir use 'ls' for formatting long strings
PR-URL: https://github.com/libuv/libuv/pull/75/files
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2014-12-19 16:59:48 +01:00
Logan Rosen
ccd9745a68 build: link against -pthread
Please see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773341 for
more information.  Libuv uses some of pthread's symbols, but it doesn't
link against it, which causes underlinking issues, especially in Ubuntu
where we use ld --as-needed.  The issue also shows up as warnings in
Debian's build logs.

PR-URL: https://github.com/libuv/libuv/pull/73
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-18 19:14:42 +01:00
Marc Schlaich
59f875d638 test: check dlerror is "no error" in no error case
PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-14 20:33:43 +01:00
Marc Schlaich
f70b69d055 test: improve compatibility for dlerror test
Check uv_dlerror() doesn't return "no_error", in order to make the test
less dependent on the exact error message the platform produces when
loading a dynamic library fails.

PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-14 20:31:41 +01:00
Marc Schlaich
4272e0a61a win: fall back to default language in uv_dlerror
PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-14 20:31:41 +01:00
Marc Schlaich
6eb2eaa753 win: set fallback message if FormatMessage fails
FormatMessage can fail, e.g. with ERROR_MUI_FILE_NOT_FOUND. In this case
no error message was set and uv_dlerror wrongly returned "no error".

With this patch the fallback error message "error: <errorno>" is
generated when FormatMessage fails.

PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-14 20:31:40 +01:00
Marc Schlaich
4298c1fb2c gitignore: ignore Visual Studio files
PR-URL: https://github.com/libuv/libuv/pull/59
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-14 20:25:51 +01:00
Bert Belder
48d39345bc win: avoid stack corruption when closing a poll handle
When the user closes an uv_poll_t handle, there may still be an
outstanding AFD_POLL request. Libuv can't cancel this AFD_POLL request
directly, so it has to submit another which makes the the previous
poll request return.

Libuv completely forgets about the "canceling" AFD_POLL request, but
at some point in time it may complete and store its result somewhere in
memory.

Without this patch the result of the canceling poll request is written
somewhere on the stack, which sometimes causes stack corruption. This
patch ensures that the result is written to some static scratch space
where it can do no harm.

PR-URL: https://github.com/libuv/libuv/pull/49
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Marc Schlaich <marc.schlaich@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-10 16:44:28 +01:00
Bert Belder
152c35d54d Revert "win: keep a reference to AFD_POLL_INFO in cancel poll"
The offending patch doesn't completely fix the issue, it just trades
stack corruption for heap corruption which is less likely.

In addition there is a much simpler solution for this problem.

This reverts commit cd894521dd.

PR-URL: https://github.com/libuv/libuv/pull/49
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Marc Schlaich <marc.schlaich@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-10 16:44:28 +01:00
Marc Schlaich
2e30a19641 win: fix compilation of tests
PR-URL: https://github.com/libuv/libuv/pull/51
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2014-12-10 16:44:27 +01:00
Bert Belder
5f2016a425 test: test that closing a poll handle doesn't corrupt the stack
This is a regression test for an issue that was originally reported
in https://github.com/libuv/libuv/pull/36, and fixed in cd89452.

PR-URL: https://github.com/libuv/libuv/pull/48
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-09 22:03:05 +01:00
Saúl Ibarra Corretgé
20fe7f9bc7 Now working on v0.10.31 2014-12-09 19:49:50 +01:00
Saúl Ibarra Corretgé
5a63f5e954 2014.12.10, Version 0.10.30 (Stable)
Changes since version 0.10.29:

* linux: fix sigmask size arg in epoll_pwait() call (Ben Noordhuis)

* linux: handle O_NONBLOCK != SOCK_NONBLOCK case (Helge Deller)

* doc: update project links (Ben Noordhuis)

* windows: fix compilation of tests (Marc Schlaich)

* unix: add flag for blocking SIGPROF during poll (Ben Noordhuis)

* unix, windows: add uv_loop_configure() function (Ben Noordhuis)

* win: keep a reference to AFD_POLL_INFO in cancel poll (Marc Schlaich)
2014-12-09 19:49:43 +01:00
schlamar
cd894521dd win: keep a reference to AFD_POLL_INFO in cancel poll 2014-12-09 08:49:59 +01:00
Ben Noordhuis
9da5fd443e unix, windows: add uv_loop_configure() function
The only supported option right now is UV_LOOP_BLOCK_SIGNAL, which only
supports the SIGPROF signal and only on UNIX platforms.  So yes, it is
kind of limited right now.  But everything has to start somewhere.

Refs strongloop/strong-agent#3 and strongloop-internal/scrum-cs#37.

PR-URL: https://github.com/libuv/libuv/pull/15
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-05 17:39:43 +01:00
Ben Noordhuis
2daf9448b1 unix: add flag for blocking SIGPROF during poll
Add a per-event loop flag for blocking SIGPROF signals when polling for
events.

The motivation for this addition is to reduce the number of wakeups and
subsequent clock_gettime() system calls when using a sampling profiler.

On Linux, this switches from epoll_wait() to epoll_pwait() when enabled.
Other platforms bracket the poll syscall with pthread_sigmask() calls.

Refs strongloop/strong-agent#3 and strongloop-internal/scrum-cs#37.

PR-URL: https://github.com/libuv/libuv/pull/15
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2014-12-05 17:38:31 +01:00
schlamar
0bcac64512 windows: fix compilation of tests 2014-11-26 08:32:59 +01:00
Ben Noordhuis
fa35193bb1 doc: update project links
This is like commit 7ce1113 from the v1.x branch but for the v0.10
branch.  The project home has moved, update the links in the README.
2014-11-25 17:20:34 +01:00
Helge Deller
5672bbd68a linux: handle O_NONBLOCK != SOCK_NONBLOCK case
linux-syscalls.h assumes that on all Linux platforms the value
of O_NONBLOCK is the same as SOCK_NONBLOCK.
This commit fixes it, as it is at least not true for hppa, and
resolves #1442.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-11-25 17:16:22 +01:00
Ben Noordhuis
b705b53edd linux: fix sigmask size arg in epoll_pwait() call
sizeof(sigset_t) = 128 whereas the kernel expects 8, the size of a long.

It made the system call fail with EINVAL when a non-NULL sigset was
passed in.  Fortunately, it's academic because there is just one call
site and it passes in NULL.

Fixes libuv/libuv#4.
2014-11-25 02:00:51 +01:00
Saúl Ibarra Corretgé
39a5728dd9 Now working on v0.10.30 2014-10-21 01:01:08 +02:00
Saúl Ibarra Corretgé
2d728542d3 2014.10.21, Version 0.10.29 (Stable)
Changes since version 0.10.28:

* darwin: allocate enough space for select() hack (Fedor Indutny)

* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle)

* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)
2014-10-21 01:01:03 +02:00
Saúl Ibarra Corretgé
5e507159c9 windows: map ERROR_INVALID_DRIVE to UV_ENOENT
Backport c44f264641 for v0.10 branch.
2014-10-21 00:23:48 +02:00
Michael Hudson-Doyle
ef7b783d8d linux: try epoll_pwait if epoll_wait is missing
It seems that epoll_wait is implemented in glibc in terms of epoll_pwait and
new architectures (like arm64) do not implement the epoll_wait syscall at all.
So if epoll_wait errors with ENOSYS, just call epoll_pwait.

This is a backport of 861de3d71d for v0.10
branch.
2014-10-20 23:40:28 +02:00
Fedor Indutny
c60d6af011 darwin: allocate enough space for select() hack
`fd_set`s are way too small for `select()` hack when stream's fd is
bigger than 1023. Make `fd_set`s a part of `uv__stream_select_t`
structure.

fix #1461

Conflicts:
	src/unix/stream.c
2014-09-08 09:09:21 +01:00
Timothy J Fontaine
71b7128987 Now working on v0.10.29 2014-07-31 09:29:01 -07:00
Timothy J Fontaine
9c14b616f5 2014.07.32, Version 0.10.28 (Stable)
Changes since version 0.10.27:

* windows: fix handling closed socket while poll handle is closing (Saúl
  Ibarra Corretgé)

* unix: return system error on EAI_SYSTEM (Saúl Ibarra Corretgé)

* unix: fix bogus structure field name (Saúl Ibarra Corretgé)

* darwin: invoke `mach_timebase_info` only once (Fedor Indutny)
2014-07-31 09:28:58 -07:00
Fedor Indutny
211bf4ec37 darwin: invoke mach_timebase_info only once
According to @aktau, the call to `mach_timebase_info` costs 90% of the
total execution time of `uv_hrtime()`. The result of the call is static
on all existing platforms, so there is no need in invoking it multiple
times.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-06-25 01:32:05 +04:00
Saúl Ibarra Corretgé
58f87691a4 unix: fix bogus structure field name 2014-06-19 09:12:52 +02:00
Saúl Ibarra Corretgé
dd893814ad unix: return system error on EAI_SYSTEM 2014-06-18 01:18:55 +02:00
Saúl Ibarra Corretgé
12bb46c095 windows: fix handling closed socket while poll handle is closing
fixes #1278

(backport from master for v0.10 branch)
2014-06-17 20:16:43 +02:00
Fedor Indutny
c38e97ee4d test: fix EPIPE race in spawn_closed_process_io
The just created stdin should not be closed by a child process before
writing to it, otherwise EPIPE happens.
2014-06-09 08:47:18 -07:00
Timothy J Fontaine
4f8d4a0135 Now working on v0.10.28 2014-05-01 09:23:46 -07:00
Timothy J Fontaine
6e24ce23b1 2014.05.02, Version 0.10.27 (Stable)
Changes since version 0.10.26:

* windows: fix console signal handler refcount (Saúl Ibarra Corretgé)

* win: always leave crit section in get_proc_title (Fedor Indutny)
2014-05-01 09:23:46 -07:00
Timothy J Fontaine
4a67d8cc0e build: add vc-set-2012 label 2014-04-14 10:07:33 -07:00
Fedor Indutny
ffb49220cf win: always leave crit section in get_proc_title
fix #1235
2014-04-14 20:49:15 +04:00
Fedor Indutny
23d130b209 Revert "inet: allow scope in uv_inet_pton ip6 check"
This reverts commit d30e3ab65a, because it
is a new feature!
2014-04-14 15:13:20 +04:00
Fedor Indutny
d30e3ab65a inet: allow scope in uv_inet_pton ip6 check
Note that isn't actually parsing it, since the output value is a
`struct in6_addr`.

see https://github.com/joyent/node/issues/7395
2014-04-14 12:45:42 +04:00
Saúl Ibarra Corretgé
b9d5396a40 windows: fix console signal handler refcount
Backport of 0c726e7 from master
2014-04-12 10:09:40 +02:00
Fedor Indutny
6855205ba5
Now working on v0.10.27
Signed-off-by: Fedor Indutny <fedor@indutny.com>
2014-04-07 15:28:59 +04:00