Commit Graph

4148 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
42ebae18d6 linux: fix error checking in uv__open_file
uv__open_cloexec returns either the fd or a libuv error, which is -errno
on Unix, not -1.

PR-URL: https://github.com/libuv/libuv/pull/760
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-03-10 16:26:11 +01:00
Imran Iqbal
213e681acf test: fix poll_bad_fdtype for AIX
PR-URL: https://github.com/libuv/libuv/pull/757
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-10 09:50:33 -05:00
Saúl Ibarra Corretgé
86051a49d8 win: remove duplicated code when processing fsevents
PR-URL: https://github.com/libuv/libuv/pull/756
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-08 13:50:12 +01:00
Krishnaraj Bhat
365bdec434 linux: remove redundant call to rewind()
It's already called in callee read_times()

PR-URL: https://github.com/libuv/libuv/pull/751
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-08 09:12:40 +01:00
Kári Tristan Helgason
2f02ae5f51 linux: replace calls to fopen with uv__open_file
PR-URL: https://github.com/libuv/libuv/pull/743
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-08 09:10:56 +01:00
Kári Tristan Helgason
d7910e42d0 unix: add fork-safe open file function
PR-URL: https://github.com/libuv/libuv/pull/743
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-08 09:10:26 +01:00
Saúl Ibarra Corretgé
4972f7411c doc: add @cjihrig as a maintainer
PR-URL: https://github.com/libuv/libuv/pull/752
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-by: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-03-08 01:10:30 +01:00
Kári Tristan Helgason
80d9d86e0f linux: add braces to multi-statement if
PR-URL: https://github.com/libuv/libuv/pull/750
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-05 00:30:25 +01:00
Robert Chiras
4c765d72a6 unix: fix compile error in Android using bionic
When compiling with bionic, st_atime_nsec (and the other nsec members)
canot be found.
In order to compile uv with both NDK and bionic, tv_nsec should be
accessed from st_atimensec (and the others nsec members).
See "Compatibility with glibc" in stat.h from bionic.

Signed-off-by: Robert Chiras <robert.chiras@intel.com>

PR-URL: https://github.com/libuv/libuv/pull/746
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-05 08:14:34 +01:00
Saúl Ibarra Corretgé
cfef25dba2 win: remove unneeded condition
PR-URL: https://github.com/libuv/libuv/pull/745
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-05 08:12:42 +01:00
Ben Noordhuis
bb77113042 linux: call fclose(), fix fdopen() memory leak
Commit 6798876 ("linux: fix cpu count") switched the /proc/stat parser
to fdopen().  Use fclose() to close the file descriptor to avoid leaking
resources associated with the FILE struct.

PR-URL: https://github.com/libuv/libuv/pull/747
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-04 00:55:46 +01:00
Imran Iqbal
a7009a0353 unix: fix uv__handle_type for AIX
'getsockname' does not handle UNIX domain sockets on AIX[1], it does not
fail but simply returns an empty structure with length 0.
If 'getsockname' does not fail (i.e. does not return -1) and the length
is 0 we know, on AIX, that the type is AF_UNIX.

This fixes test pipe_sendmsg.

[1] https://goo.gl/ozqcmS

PR-URL: https://github.com/libuv/libuv/pull/748
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-03-03 20:47:31 +01:00
Lukasz Jagiello
6798876a6b linux: fix cpu count
When libuv is running inside container - eg. lxc container, cpu number
is not obvious. Linux control groups (cgroups) may limit numer of cpus.

As a result of different number cpu cores inside container and
outside container, libuv is crashing.

sysconf(_SC_NPROCESSORS_ONLN) - returns num of host cpus (eg. 32)
`/proc/stat` - sees only cpus limited by cgroups (eg. 4)

When libuv is trying to operate at both numbers and they're different
it's crashing with current test:

run-tests: ../src/unix/linux-core.c:766: read_times: Assertion `num ==
numcpus' failed.

Count the number of cpus based on `/proc/stat` instead.

PR-URL: https://github.com/libuv/libuv/pull/735
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-03 09:34:30 +01:00
Katsutoshi Horie
ca0b657891 test: fix deadlocks in uv_cond_wait
Calling uv_cond_wait without uv_cond_signal/uv_cond_broadcast may
cause deadlock. This commit avoids this situation as well as tests
these functions.

PR-URL: https://github.com/libuv/libuv/pull/728
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-03 09:29:39 +01:00
Saúl Ibarra Corretgé
2606ba22a7 unix, win: count null byte on UV_ENOBUFS
If an API function returns UV_ENOBUFS make sure we count the terminating
null, which we need space for. In case of success the null byte is not
included in the count, but the buffer *is* null terminated.

PR-URL: https://github.com/libuv/libuv/pull/690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-03 09:23:10 +01:00
Saúl Ibarra Corretgé
e5f4b79809 unix, win: consistently null-terminate buffers
libuv has multiple functions which return buffers. Make them consistent
with the following rules: the returned size *does not* include the null
byte, but the buffer *is* null terminated.

There is only one exception to the above: Linux abstract sockets,
because null bytes are not used as string terminators in those.

Refs: https://github.com/libuv/libuv/pull/674
PR-URL: https://github.com/libuv/libuv/pull/690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-03-03 09:20:41 +01:00
Imran Iqbal
e76e21389b test: reduce timeout in tcp_close_while_connecting
Somtimes (once every 10 runs or so) the socket would 'connect' before
'uv_close' was called. This caused EHOSTUNREACH to be set for SO_ERROR
instead of ECANCELED.

PR-URL: https://github.com/libuv/libuv/pull/744
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-03-03 09:15:21 +01:00
Imran Iqbal
b015b4d0ee test: fix threadpool_multiple_event_loops on PPC
On PPC (linux and AIX) uv_thread_join (which is just a call to
pthread_join) takes quite a while. Increased the timeout of this
specific test on PPC so that there is ample time for all threads to join
back. The fs_do and getaddrinfo_do calls do not take up much time.

Also removing the ifdef for AIX around fs_do since it did nothing.

Fixes: https://github.com/libuv/libuv/issues/687
PR-URL: https://github.com/libuv/libuv/pull/737
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-27 18:06:17 +01:00
Imran Iqbal
4a24df9167 build: compile with -D_THREAD_SAFE on AIX
This enables thread safe errno on AIX and causes the following tests to
pass:

    ipc_send_recv_pipe_inprocess
    ipc_send_recv_tcp_inprocess
    fs_poll
    fs_file_noent
    fs_file_nametoolong
    fs_file_loop
    fs_chown
    fs_readlink
    fs_realpath
    fs_scandir_file

PR-URL: https://github.com/libuv/libuv/pull/739
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-27 18:05:43 +01:00
Nándor István Krácser
729d68596c doc: add missing write callback to example
PR-URL: https://github.com/libuv/libuv/pull/734
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-25 08:56:54 +01:00
Saúl Ibarra Corretgé
a4213b7699 darwin: replace F_FULLFSYNC with fdatasync syscall
Refs: https://github.com/nodejs/node/pull/5402
PR-URL: https://github.com/libuv/libuv/pull/732
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-24 12:44:46 +01:00
Nan Xiang
12548de1b5 test: assume no IPv6 if interfaces cannot be listed
PR-URL: https://github.com/libuv/libuv/pull/724
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-16 08:47:21 +01:00
Rasmus Christian Pedersen
96da21d3f4 build: python 2.x/3.x consistent print usage
PR-URL: https://github.com/libuv/libuv/pull/723
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-15 10:03:03 +01:00
Saúl Ibarra Corretgé
2543f56406 doc: add missing link in README
PR-URL: https://github.com/libuv/libuv/pull/722
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-15 09:57:21 +01:00
Saúl Ibarra Corretgé
67e22296d7 doc: describe how to make release builds on Unix
Refs: https://github.com/libuv/libuv/issues/550
PR-URL: https://github.com/libuv/libuv/pull/722
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-15 09:56:56 +01:00
Saúl Ibarra Corretgé
befe1550b9 linux: fix compilation with musl
PR-URL: https://github.com/libuv/libuv/pull/720
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-09 23:51:44 +01:00
Samuel Lorétan
7dc1bd9230 osx: protected use of potentially undefined macro
The `__FreeBSD__` macro is not defined by default on OSX, and building
with `-Wundef` will cause a warning to be emitted. This change makes
sure that the macro is only used if defined, removing the warning.

PR-URL: https://github.com/libuv/libuv/pull/710
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-05 22:49:49 +01:00
Ben Noordhuis
ca6cd35d57 build: map 'AMD64' host arch to 'x64'
Fixes: https://github.com/libuv/libuv/issues/705
PR-URL: https://github.com/libuv/libuv/pull/706
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-02 08:40:16 +01:00
Nan Xiang
b6650dff56 test: use uv_loop_close and assert its result
uv_loop_delete is considered deprecated.

PR-URL: https://github.com/libuv/libuv/pull/696
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-02-01 09:15:41 +01:00
Saúl Ibarra Corretgé
51c1a28d7e test,win: fix compilation warning
PR-URL: https://github.com/libuv/libuv/pull/700
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-01 09:07:52 +01:00
Saúl Ibarra Corretgé
76da68ea04 build,win: remove unneeded condition from GYP file
The file itself contains include guards, so don't compile it
conditionally.

PR-URL: https://github.com/libuv/libuv/pull/697
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-26 12:40:24 +01:00
Saúl Ibarra Corretgé
af4c489e0a build,win: print the Visual Studio version in use
PR-URL: https://github.com/libuv/libuv/pull/698
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-26 12:31:16 +01:00
Nikolai Vavilov
3c59ad6d95 win: fix watching root files
When passing "\\?\C:" to CreateFile, it opens the drive rather than the root
directory. So include the trailing backslash in the directory name.

Fixes: https://github.com/nodejs/node/issues/4643
PR-URL: https://github.com/libuv/libuv/pull/689
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-26 09:58:49 +01:00
Ben Noordhuis
a0b56059cf unix: report errors for unpollable fds
Libuv would abort() when trying to watch a file descriptor that is
not compatible with epoll-style polling; file descriptors referring
to on-disk files fall into this category.

File descriptors that libuv creates itself are not an issue but
external ones that come in through the uv_poll_init() API are.

Make uv_poll_init() check whether the file descriptor is accepted by
the underlying system call and return an error when it's not.

Fixes: https://github.com/libuv/libuv/issues/658
PR-URL: https://github.com/libuv/libuv/pull/659
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-21 17:57:00 +01:00
Imran Iqbal
c21a75a16c test: fix threadpool_multiple_event_loops for AIX
Disabled the filesystem portion of the test as there are known issues
with AIX and its fs. This particular test was failing with a timeout.

PR-URL: https://github.com/libuv/libuv/pull/689
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-21 09:25:15 +01:00
Didiet
db680a1dff ios: fix undefined PTHREAD_STACK_MIN
PR-URL: https://github.com/libuv/libuv/pull/692
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-21 09:22:36 +01:00
cjihrig
c0fa2e7518 unix,win: add uv_os_tmpdir()
PR-URL: https://github.com/libuv/libuv/pull/672
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-21 09:11:56 +01:00
Imran Iqbal
d41749d546 test: fix race condition in pipe-close-stdout
If the child process reaches uv_run before the parent has closed the
write end of the pipe the test fails with the following output:

Assertion failed in test/test-pipe-close-stdout-read-stdin.c
on line 86: uv_run(uv_default_loop(), UV_RUN_NOWAIT) == 0
Assertion failed in test/test-pipe-close-stdout-read-stdin.c
on line 97: WIFEXITED(status) && WEXITSTATUS(status) == 0

This is mainly seen on AIX, but does not mean that it can not occur on
linux. This change causes the child process to be blocked until the
write end of the pipe is properly closed. See 'man 7 pipe'[0] for
more detail.

[0]http://linux.die.net/man/7/pipe

PR-URL: https://github.com/libuv/libuv/pull/688
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-21 09:08:41 +01:00
Alexis Murzeau
ad2cc8f6a7 test,win: fix compilation with shared lib
Tests were failing to link because of undefined snprintf symbol with
VS < 2015 and using shared library.

snprintf is implemented in libuv in src/win/snprintf.c when compiling
with VS < 2015, so this commit add src/win/snprintf.c to test sources
to make snprintf available in tests.

PR-URL: https://github.com/libuv/libuv/pull/678
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-21 09:05:35 +01:00
Saúl Ibarra Corretgé
f1a13e9b4a osx: avoid compilation warning with Clang
~~~~
src/unix/stream.c:1089:19: warning: variable length array folded to
constant array as an extension [-Wgnu-folding-constant]
  char cmsg_space[CMSG_SPACE(UV__CMSG_FD_SIZE)];
~~~~

PR-URL: https://github.com/libuv/libuv/pull/677
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-06 12:09:59 +01:00
Saúl Ibarra Corretgé
01ab8d64ad test: fixup eintr_handling
- Add missing include
- Fix test name on Windows
- Fixup style

Refs: https://github.com/libuv/libuv/pull/661
PR-URL: https://github.com/libuv/libuv/pull/673
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-01-06 08:30:49 +01:00
Ben Noordhuis
893195750d build: invoke libtoolize with --copy
Ensure that ltmain.sh gets copied, not symlinked, like we do with
automake artifacts.

PR-URL: https://github.com/libuv/libuv/pull/675
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-05 14:30:01 +01:00
Saúl Ibarra Corretgé
3db07cc379 osx: set the default thread stack size to RLIMIT_STACK
Fixes: https://github.com/libuv/libuv/issues/669
PR-URL: https://github.com/libuv/libuv/pull/671
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-01-05 09:06:15 +01:00
Dave
a564ef09dc fs: don't nullify req->bufs on EINTR
uv__fs_buf_iter currently sets req->bufs to NULL after it is done, but
if the operation fails with EINTR then it will be retried, at which
point it expects the bufs to not be NULL, causing a seg fault as in
https://github.com/nodejs/node/issues/4291.

uv__fs_buf_iter should not set req->bufs to NULL if the operation
fails with EINTR.

Also, when it sets req->bufs to NULL, it should set req->nbufs to 0 as
well, so we don't have the messy situation of a positive nbufs with no
actual bufs.

PR-URL: https://github.com/libuv/libuv/pull/661
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2016-01-04 14:07:50 -05:00
Ben Noordhuis
bcecc3dda3 test,unix: fix logic error in test runner
Fix the logic that guards against the system clock jumping back in time.

Fixes: https://github.com/libuv/libuv/issues/667
PR-URL: https://github.com/libuv/libuv/pull/670
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2016-01-04 12:20:27 +01:00
Dave
a0057d96be doc: indicate where new test files need to be added
PR-URL: https://github.com/libuv/libuv/pull/662
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-12-23 14:51:24 +01:00
Martin Bark
c861972140 unix: fix support for uClibc-ng
uClibc-ng is currently at v1.0.9.  The patch corrects the uClibc
version test so that HAVE_IFADDRS_H is defined for uClibc versions
after v0.9.32.

Signed-off-by: Martin Bark <martin@barkynet.com>

PR-URL: https://github.com/libuv/libuv/pull/653
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-12-16 12:11:56 +01:00
João Reis
427e4c9d48 win: wait for full timeout duration
uv_poll should wait for at least the full timeout duration when there
is nothing else to do. This was not happening because
GetQueuedCompletionStatus can occasionally return up to 15ms early.

The added test reproduces d13d7f74d7/test/simple/test-timers-first-fire.js
on libuv, being flaky before this fix.

Fixes: https://github.com/joyent/node/issues/8960
PR-URL: https://github.com/libuv/libuv/pull/385
Reviewed-By: Alexis Campailla <alexis@janeasystems.com>
Reviewed-by: Bert Belder <bertbelder@gmail.com>
2015-12-16 12:08:46 +01:00
Saúl Ibarra Corretgé
61f13a6d5e Now working on version 1.8.1 2015-12-14 21:07:52 +01:00
Saúl Ibarra Corretgé
59dab837d8 Add SHA to ChangeLog 2015-12-14 20:54:37 +01:00