NetBSD supports:
- O_CLOEXEC
- accept4(2) like API with paccept(2)
NetBSD 8.0 will get compat accept4(2)
- SOCK_NONBLOCK
- SOCK_CLOEXEC
- dup3(2)
PR-URL: https://github.com/libuv/libuv/pull/1534
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
NetBSD and FreeBSD can share the can_ipv6_ipv4_dual() function as
is. This commit also corrects the function definition to be
compliant with C standards. This fixes a warning on
NetBSD 8.99.2 with GCC 5.4.0.
PR-URL: https://github.com/libuv/libuv/pull/1535
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit adds the O_TRUNC flag to the destination file in
the sendfile() fallback. This allows smaller source files to
be properly copied into larger existing destination files.
Refs: https://github.com/libuv/libuv/pull/1551
PR-URL: https://github.com/libuv/libuv/pull/1552
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Initialize the error variable in uv_fs_copyfile() to zero. If
the source file being copied has no data in it, then it's
possible to make it to the exit without ever setting error.
In this situation, the function's behavior is unpredictable.
Refs: https://github.com/libuv/libuv/pull/1551
PR-URL: https://github.com/libuv/libuv/pull/1552
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The uv__has_forked_with_cfrunloop local variable is unused on
BSDs and causes compilation warnings. Observed on NetBSD/amd64
8.99.2 with GCC 5.4.0.
PR-URL: https://github.com/libuv/libuv/pull/1529
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Changes since version 1.14.0:
* fs, win: add support for user symlinks (Bartosz Sosnowski)
* cygwin: include uv-posix.h header (Joel Winarske)
* zos: fix semaphore initialization (jBarz)
* zos: improve loop_count benchmark performance (jBarz)
* zos, test: flush out the oob data in callback (jBarz)
* unix,win: check for bad flags in uv_fs_copyfile() (cjihrig)
* unix: modify argv[0] when process title is set (Matthew Taylor)
* unix: don't use req->loop in uv__fs_copyfile() (cjihrig)
* doc: fix a trivial typo (Vladimír Čunát)
* android: fix uv_cond_timedwait on API level < 21 (Gergely Nagy)
* win: add uv__once_init() calls (Bartosz Sosnowski)
* unix,windows: init all requests in fs calls (cjihrig)
* unix,windows: return UV_EINVAL on NULL fs reqs (cjihrig)
* windows: add POST macro to fs functions (cjihrig)
* unix: handle partial sends in uv_fs_copyfile() (A. Hauptmann)
* Revert "win, test: fix double close in test runner" (Bartosz
Sosnowski)
* win, test: remove surplus CloseHandle (Bartosz Sosnowski)
uv_fs_sendfile() is used as the fallback for uv_fs_copyfile().
However, sendfile() does not necessarily send all of the bytes
in one call. This commit adds a loop to ensure all data is
sent.
Fixes: https://github.com/libuv/libuv/issues/1517
PR-URL: https://github.com/libuv/libuv/pull/1494
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit adds a POST macro to the Windows fs functions,
similar to the one used on Unix platforms.
PR-URL: https://github.com/libuv/libuv/pull/1509
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit introduces an INIT macro to file system functions on
Windows, similar to the one used on Unix platforms. The macro
checks for NULL requests, and returns UV_EINVAL in such
scenarios. This commit also adds support for passing NULL to
uv_fs_req_cleanup(). In this scenario, the function is a
no-op.
Fixes: https://github.com/libuv/libuv/issues/1508
PR-URL: https://github.com/libuv/libuv/pull/1509
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Prior to this change, several of the fs functions checked for
invalid arguments before initializing the fs request. If a
consumer received a UV_EINVAL from one of these functions, and
then called uv_fs_req_cleanup(), the application would crash, as
the pointer being freed was not allocated. This commit makes
sure that all fs functions initialize the request before returning.
Fixes: https://github.com/libuv/libuv/issues/1508
PR-URL: https://github.com/libuv/libuv/pull/1509
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Some functions, such as uv_fs_scandir() can be called with
a NULL loop argument. In this case, it's possible that the
Windows API hasn't been initialized, leading to a crash.
This commit adds additional uv__once_init() calls to mitigate
this situation.
Fixes: https://github.com/libuv/libuv/issues/1488
PR-URL: https://github.com/libuv/libuv/pull/1512
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit partly reverses libuv#1441.
It is true that pthread_cond_timedwait is available on older API levels,
but if we do not call pthread_condattr_setclock then we cannot use
timestamps from CLOCK_MONOTONIC with pthread_cond_timedwait.
PR-URL: https://github.com/libuv/libuv/pull/1511
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Need to flush out the OOB data. Otherwise, this callback will get
triggered on every poll with nread = 0.
PR-URL: https://github.com/libuv/libuv/pull/1484
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
After the poll call, the code updates all the event objects
in the array. Instead, use the integer value returned by poll
to limit the number of epoll_event objects that are updated.
e.g. If poll returns 5, we know that we only need to update
5 event objects.
PR-URL: https://github.com/libuv/libuv/pull/1391
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
To set an initial value to a semaphore, the semop call won't do it.
We need to use the semctl call with the SETVAL flag
PR-URL: https://github.com/libuv/libuv/pull/1473
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Add SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE to CreateSymbolicLink
which allows unelevated users to create symbolic links on supported
platforms.
Fixes: https://github.com/libuv/libuv/issues/1157
PR-URL: https://github.com/libuv/libuv/pull/1466
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Changes since version 1.13.1:
* unix: check for NULL in uv_os_unsetenv for parameter name (André
Klitzing)
* doc: add thread safety warning for process title (Matthew Taylor)
* unix: always copy process title into local buffer (Matthew Taylor)
* poll: add support for OOB TCP and GPIO interrupts (CurlyMoo)
* win,build: fix appveyor properly (Refael Ackermann)
* win: include filename in dlopen error message (Ben Noordhuis)
* aix: add netmask, mac address into net interfaces (Gireesh Punathil)
* unix, windows: map EREMOTEIO errno (Ben Noordhuis)
* unix: fix wrong MAC of uv_interface_address (XadillaX)
* win,build: fix building from Windows SDK or VS console (Saúl Ibarra
Corretgé)
* github: fix link to help repo in issue template (Ben Noordhuis)
* zos: remove nonexistent include from autotools build (Saúl Ibarra
Corretgé)
* misc: remove reference to pthread-fixes.h from LICENSE (Saúl Ibarra
Corretgé)
* docs: fix guide source code example paths (Anticrisis)
* android: fix compilation with new NDK versions (Saúl Ibarra Corretgé)
* misc: add android-toolchain to .gitignore (Saúl Ibarra Corretgé)
* win, fs: support unusual reparse points (Bartosz Sosnowski)
* android: fix detection of pthread_condattr_setclock (Saúl Ibarra
Corretgé)
* android: remove no longer needed check (Saúl Ibarra Corretgé)
* doc: update instructions for building on Android (Saúl Ibarra
Corretgé)
* win, process: support semicolons in PATH variable (Bartosz Sosnowski)
* doc: document uv_async_(init|send) return values (Ben Noordhuis)
* doc: add Android as a tier 3 supported platform (Saúl Ibarra Corretgé)
* unix: add missing semicolon (jBarz)
* win, test: fix double close in test runner (Bartosz Sosnowski)
* doc: update supported windows version baseline (Ben Noordhuis)
* test,zos: skip chown root test (jBarz)
* test,zos: use gid=-1 to test spawn_setgid_fails (jBarz)
* zos: fix hr timer resolution (jBarz)
* android: fix blocking recvmsg due to netlink bug (Jacob Segal)
* zos: read more accurate rss info from RSM (jBarz)
* win: allow bound/connected socket in uv_tcp_open() (Maciej Szeptuch
(Neverous))
* doc: differentiate SmartOS and SunOS support (cjihrig)
* unix: make uv_poll_stop() remove fd from pollset (Ben Noordhuis)
* unix, windows: add basic uv_fs_copyfile() (cjihrig)
Avoid repeated wake-ups in `uv__io_poll()` when the previously watched
file descriptor has been duplicated (with `dup(2)`) and then closed.
Because epoll reports events for _file descriptions_ rather than _file
descriptors_, events on the duplicated file descriptor cause the event
loop to wake up.
Libuv then tries to unregister the event listener for the original file
descriptor but that fails with EBADF because the file descriptor is
closed.
Since libuv uses epoll in level-triggered mode, it effectively results
in a busy loop because the event is re-reported as soon as libuv calls
epoll_wait() again.
I tried hard to write a test case for this but there is no directly
observable behavior, only increased CPU usuage.
Fixes: https://github.com/libuv/libuv/issues/1148
PR-URL: https://github.com/libuv/libuv/pull/1468
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On Unix you can pass bound and even connected socket to uv_tcp_open
and it will work as expected: you can run uv_listen or other io
functions (uv_read, uv_write) on it without problems.
On windows on the other hand the function always assumes to have clean
socket and for example uv_listen will try to bind it again, and
uv_read/write will return with errors about unreadable streams
(basically invalid internal flags).
To check if socket is already bound uv_tcp_getsockname is called which
on windows returns error when socket is unbound. To further
differentiate connected one from just bound, uv_tcp_getpeername also
returns error but when target socket is not connected.
PR-URL: https://github.com/libuv/libuv/pull/1447
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
More accurate Resident Set Size (Central Storage size on Z)
is stored in the MVS Data Areas managed by the RSM (Real
Storage Manager).
PR-URL: https://github.com/libuv/libuv/pull/1244
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Code was assuming that the nl_pid was always equal to the process id.
As the netlink documentation says, "nl_pid is usually the PID of the
process owning the destination socket. However, nl_pid identifies a
netlink socket, not a process".
There are two cases in which this assumption breaks down. The first is
that some other part of the application has already bound a netlink
socket with a nl_pid equal to the PID of the process. The second is
Android version 5.0 where it appears that nl_pid is not always defaulted
to the PID of the process.
The result of this bad assumption is that netlink message responses to
our request are ignored due to having a bad nl_pid. We eventually run
out of messages on the netlink socket and block forever awaiting our
response.
PR-URL: https://github.com/libuv/libuv/pull/1451
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
One tick on the high resolution clock (TOD clock) on z/OS
is equivalent to (1/4.096) nanoseconds.
PR-URL: https://github.com/libuv/libuv/pull/1453
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This is because on some platforms like z/OS, setgid(0) is
allowed for non-superusers. So instead, use setgid(-1) to
get UV_EINVAL to test that spawn failure returns the right
return code.
PR-URL: https://github.com/libuv/libuv/pull/1456
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
z/OS allows non root users to chown a file to root via the
CHOWN.UNRESTRICTED profile. So avoid that test on z/OS.
PR-URL: https://github.com/libuv/libuv/pull/1454
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Update the baseline from Windows XP SP1 to Windows 8.1
PR-URL: https://github.com/libuv/libuv/pull/1436
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
PR-URL: https://github.com/libuv/libuv/pull/1442
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
The latest NDK (r15 at the time of this writing) no longer needs this.
`pthread_cond_timedwait` is available at any (reasonable) API level.
PR-URL: https://github.com/libuv/libuv/pull/1441
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
It's only available on API level >= 21.
PR-URL: https://github.com/libuv/libuv/pull/1441
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>