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>
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>
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>
'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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>