uv_if_indextoname() is used to convert an IPv6 scope_id
to an interface identifier string such as %eth0 or %lo.
uv_if_indextoiid() returns an IPv6 interface identifier.
On Unix it calls uv_if_indextoname(). On Windows it uses
snprintf() to return the numeric interface identifier as
a string.
Refs: https://github.com/nodejs/node/pull/14500
PR-URL: https://github.com/libuv/libuv/pull/1445
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Adds new uv_pipe_chmod function which can be used to make the pipe
writable or readable by all users.
PR-URL: https://github.com/libuv/libuv/pull/1386
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
SetWinEventHook is not available on some Windows versions.
Fixes: https://github.com/nodejs/node/issues/16603
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
When initializing a stream on Windows, this also inits the
shutdown_req field, instead of waiting for a successful
connection. A NULL value is used as a sentinel to check for whether
this handle is currently in the shutdown state, and it may not get
set if a stream was not connected immediately.
PR-URL: https://github.com/libuv/libuv/pull/1500
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
`options.file` is of type `const char*`, don't assign it to a variable
that is a non-const `char*`. The other way around is perfectly legal,
though.
PR-URL: https://github.com/libuv/libuv/pull/1588
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
When sorting tests, keeps platform_output as the first test.
PR-URL: https://github.com/libuv/libuv/pull/1584
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
z/OS does not allow a child process to create threads if it was
forked from a multi-threaded parent.
PR-URL: https://github.com/libuv/libuv/pull/1596
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Remove all the epoll file descriptors after a fork since they are
no longer valid. The uv__signal_global_once_init function needs to
be run after uv__platform_loop_init so that the epoll pthread_atfork
handlers get run first.
PR-URL: https://github.com/libuv/libuv/pull/1496
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The kqueue documentation states that the file descriptor is not
inherited by the child process. Hence, do not close it in uv_loop_fork
to avoid tampering with a possibly valid file descriptor already opened
by the child process.
PR-URL: https://github.com/libuv/libuv/pull/1583
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
These have been around for some time apparently (commit 391f0098de from
May 2011) but went unnoticed so far. No longer.
PR-URL: https://github.com/libuv/libuv/pull/1581
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Fixes uv_fs_stat and uv_fs_lstat returning EINVAL when invoked on a
non-symlink reparse point.
1. Only tries to read symlinks when invoked via lstat (do_lstat == 1).
Rationale is that only lstat can set S_IFLNK because when a file is
tested by stat, symlinks are resolved by the OS and the returned file
must be real. Note that broken symlinks fail at CreateFile.
FILE_ATTRIBUTE_REPARSE_POINT is used by filesystem drivers for purposes
besides symlinks, and uv_fs_stat fails when invoked on these files
because fs__readlink_handle returns ERROR_SYMLINK_NOT_SUPPORTED. By
ignoring the attribute in uv_fs_stat, these files are now handled
correctly.
2. Modifies the logic added to fs__stat_handle to fix#995 as follows:
A failed fs__readlink_handle on a file with a reparse point indicates
that the file is not a symlink. The fix for #995 added code to fall
through and behave as with a normal file in this case. However, this is
not correct because lstat had opened the file with
FILE_FLAG_OPEN_REPARSE_POINT, preventing the filesystem from acting
based on the reparse point contents.
The fix makes fs__stat_handle fail back to the higher level
fs__stat_impl, which sets do_lstat to 0 and re-opens the file without
FILE_FLAG_OPEN_REPARSE_POINT, allowing normal filesystem processing to
take place.
This is also a slightly cleaner solution as symlink fallback is only
handled in one place (fs__stat_impl) instead of two (fs__stat_impl and
fs__stat_handle).
Note that the error tested in the fix for #995,
ERROR_NOT_A_REPARSE_POINT, is not actually returned by Windows in the
case of a non-symlink reparse point. I attempted to reproduce the error
by repeating the test steps in the issue but failed. However, the the
fix logic is preserved out of caution.
3. Adds tests to fs-test.c for the above two changes.
Thorough testing requires some non-trivial setup - like an OSX computer
on the LAN or a custom filesystem driver - so these tests are left
commented out for manual invocation.
PR-URL: https://github.com/libuv/libuv/pull/1522
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Define stable cross-platform file open constants so that users can
pass `UV_FS_O_RDWR` rather than `_O_RDWR` (win) or `O_RDWR` (unix).
Map `UV_FS_O_DIRECT`, `UV_FS_O_DSYNC` and `UV_FS_O_SYNC` to
`FILE_FLAG_NO_BUFFERING` and `FILE_FLAG_WRITE_THROUGH` (win).
Fixes: https://github.com/libuv/libuv/issues/1550
PR-URL: https://github.com/libuv/libuv/pull/1567
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
`fs__stat_handle()` used to set st_blksize to `2048` regardless of the
underlying physical sector size of the disk.
`4096` is a better constant to avoid read-modify-write behavior on
advanced format drives.
Fixes: https://github.com/libuv/libuv/issues/1563
PR-URL: https://github.com/libuv/libuv/pull/1566
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
libuv retries when sendmsg(2) fails with EAGAIN or
EWOULDBLOCK. This commit adds similar functionality for
ENOBUFS.
PR-URL: https://github.com/libuv/libuv/pull/1573
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
On NetBSD, do not exclude PF_INET6 in uv__ifaddr_exclude().
PR-URL: https://github.com/libuv/libuv/pull/1576
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
NetBSD must use the uv_udp_set_membership call with
"::1%lo0", similar to FreeBSD.
PR-URL: https://github.com/libuv/libuv/pull/1577
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit causes NetBSD, like other BSDs, to reuse
uv__cloexec_ioctl and uv__nonblock_ioctl. This fixes
poll_nested_kqueue.
PR-URL: https://github.com/libuv/libuv/pull/1575
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Follow other BSDs and disable the failing poll_bad_fdtype test on
NetBSD.
PR-URL: https://github.com/libuv/libuv/pull/1574
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
PR-URL: https://github.com/libuv/libuv/pull/1578
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Libuv is not aliasing-safe if you consider aliasing to be nominal
rather than structural and it's not as if it makes much of a
difference in the quality of the generated code, at least for libuv.
PR-URL: https://github.com/libuv/libuv/pull/1457
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
As it is, when the tests run, there is no indicator as to how long the
tests will run, how many more tests are pending.
PR-URL: https://github.com/libuv/libuv/pull/1543
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
On z/OS, fs mounts can have variables starting with '$'. The problem is
that following symlinks that contain these variables can lead to a loop
because readlink($SYSVAR) will return $SYSVAR. To work around this, we
must resolve the $SYSVAR to an actual path using realpath.
More information about z/OS symlink resolution is available here:
https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/
com.ibm.zos.v2r1.bpxb100/sym.htm
PR-URL: https://github.com/libuv/libuv/pull/1472
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
NetBSD as an extension returns with ptsname(3) and ptsname_r(3) the
slave device name for both descriptors, the master one and slave one.
Workaround this problem and verify the device major and compare it with
the pts driver. Major numbers for the master and the slave TTY are
machine-dependent. On amd64 they are respectively 6 (ptc) and 5 (pts).
PR-URL: https://github.com/libuv/libuv/pull/1533
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The most critical bug is using IFLA_RTA instead of IFA_RTA on address
message. This causes android to not return any ipv6 address.
PR-URL: https://github.com/libuv/libuv/pull/1561
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The latest python on z/OS (2.7.13) was changed to update sys.platform to
return "zos" instead of "os390". So a change has been submitted to the
official gyp repository here.
PR-URL: https://github.com/libuv/libuv/pull/1557
Refs: https://chromium-review.googlesource.com/c/external/gyp/+/679077
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
This will eliminate a race condition that occurs between
epoll_close_fd, epoll_ctl and epoll_create in the
signal_multiple_loops test.
PR-URL: https://github.com/libuv/libuv/pull/1560
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
On systems that use System V semaphores, it is necessary to destroy
semaphores to free up system resources when the process finishes
execution.
PR-URL: https://github.com/libuv/libuv/pull/1559
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Setup proper sysctl(2) arguments in order to retrieve the executable
name.
Use an intermediate buffer beacause if it is too short, the sysctl(2)
call will return error. With this intermediate buffer populate the outer
one.
Note issue with too long file names on NetBSD-8(beta), this is caused by
the current implementation of vnode to path translator in the kernel. It
does not cache longer file names than 31 character ones.
PR-URL: https://github.com/libuv/libuv/pull/1532
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
musl has tiny default thread stack sizes compared to glibc (80 kB vs.
2048 kB or more) so set an explicit stack size to harmonize between
different libcs.
Fixes: https://github.com/libuv/libuv/issues/1507
PR-URL: https://github.com/libuv/libuv/pull/1526
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>