Certain types of streams may be opened from a CRT file descriptor (as
opposed to a Windows HANDLE). In order to close the file descriptor
later, libuv must store the file descriptor used to open the stream.
PR-URL: https://github.com/libuv/libuv/pull/396
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Some systems, FreeBSD for example, may return negative values.
sysconf() returns a long, which was being converted to a size_t.
This conversion lead to large allocations, and subsequent out of
memory failures. This commit checks the long value returned by
sysconf() properly, and uses a default value of 4096 if a negative
number is returned.
PR-URL: https://github.com/libuv/libuv/pull/389
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
src/win/util.c: In function 'uv_os_homedir':
src/win/util.c:1189:46: warning: passing argument 3 of 'GetUserProfileDirectoryW' from incompatible pointer type
if (!GetUserProfileDirectoryW(token, path, &bufsize)) {
^
In file included from src/win/util.c:39:0:
C:/buildtools/vendor/mingw64/x86_64-w64-mingw32/include/userenv.h:52:29: note: expected 'LPDWORD' but argument is of type 'size_t *'
USERENVAPI WINBOOL WINAPI GetUserProfileDirectoryW(HANDLE hToken,LPWSTR lpProfileDir,LPDWORD lpcchSize);
^
PR-URL: https://github.com/libuv/libuv/pull/388
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The previous Windows implementation used SHGetKnownFolderPath(),
which is only supported on Vista and up. This commit switches to
GetUserProfileDirectoryW(), which returns the same information,
but is supported back to Windows 2000, and is not deprecated.
PR-URL: https://github.com/libuv/libuv/pull/375
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The libuv filesystem events API on AIX requires the non-default IBM
`bos.ahafs` package to be installed. The library should still compile
and work on systems without this package. This patch adds proper
detection to `configure.ac` and makes the API return `-ENOSYS` at
runtime if the system does not support it.
PR-URL: https://github.com/libuv/libuv/pull/372
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The implementation will leave the family set to `AF_UNSPEC` if a
netmask is not present, but the test driver would always print the
uninitialized buffer as an `AF_INET4` address. It will now print
"none" if there is no netmask (e.g., for loopback interfaces).
PR-URL: https://github.com/libuv/libuv/pull/373
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Old 32 bits kernels (native and compat) have a bug where timeouts larger
than (LONG_MAX / CONFIG_HZ) milliseconds are treated as infinite.
Work around that by capping the timeout and polling again if necessary.
PR-URL: https://github.com/libuv/libuv/pull/354
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
gyp supports MSVC 2015, added a check for %VS140COMNTOOLS% and set
GYP_MSVS_VERSION=2015.
PR-URL: https://github.com/libuv/libuv/pull/341
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Prior to MSVC 2015, there was no standard compliant snprintf(), added a
compiler version check and disabled the snprintf() replacement for MSVC >=
2015 in test/task.h.
PR-URL: https://github.com/libuv/libuv/pull/341
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On AIX the length of socket options
for multicast and ttl options is not always sizeof(char).
AIX has the same issue as solaris which was fixed under
PR-URL: https://github.com/libuv/libuv/pull/243
This PR extends the fix to cover AIX as well.
PR-URL: https://github.com/libuv/libuv/pull/345
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Make it consistent with other platforms.
PR-URL: https://github.com/libuv/libuv/pull/303
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Since libuv has it's own syscall wrappers, the standard libc interception
mechanism of the sanitizers do not catch these, leading to false positives
for projects using libuv when running under memory sanitizer.
Fix this by adding the appropriate calls to unpoison manually.
PR-URL: https://github.com/libuv/libuv/pull/311
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Saying uv_run() always returns zero is incorrect in the presence of
calls to uv_stop().
PR-URL: https://github.com/libuv/libuv/pull/337
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The MSVC compiler does not accept static methods defined in headers,
when linking against a shared library. The snprintf replacement
function used for windows, is now an inline function.
PR-URL: https://github.com/libuv/libuv/pull/329
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
For autoconf the libuv shared library SONAME is libuv.so.1.0
but gyp builds in UNIX were missing the proper SONAME. gyp
does not have an explicit setting for SONAME. Changing the
output file extensions triggers the use of SONAME.
The previous gyp configuration also also caused issue
joyent/libuv#1382, that prevented building the tests against
a shared library - the issue is now fixed for UNIX.
PR-URL: https://github.com/libuv/libuv/pull/329
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Move the logic out of uv__fs_work() and into a function of its own.
PR-URL: https://github.com/libuv/libuv/pull/326
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
We may not have permission to open "/". This fix allows libuv to be
used in a OS X app that has sandboxing enabled, without the need for
a temporary entitlement to allow reading of "/" (Which would never
pass app review).
In some rare cases "/dev" isn't mounted, so we open "/" as a
fallback.
PR-URL: https://github.com/libuv/libuv/pull/328
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
For posterity, these are the rules for access on Windows (taken from
CPython's implementation), Access is possible if:
* Write access wasn't requested
* The file isn't read-only
* It's a directory (directories cannot be read-only on Windows)
PR-URL: https://github.com/libuv/libuv/pull/316
Reviewed-By: Bert Belder <bertbelder@gmail.com>
If a descriptor was being copied to an fd that *was not its current
value*, it should get closed after being copied. But the existing code
would close the fd, even when it no longer referred to the original
descriptor. Don't do this, only close fds that are not in the desired
range for the child process.
See https://github.com/iojs/io.js/issues/862
PR-URL: https://github.com/libuv/libuv/pull/309
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
arm64 doesn't have a epoll_wait() system call but a logic error stopped
libuv from falling back to epoll_pwait().
This bug was introduced in commit 67bb2b5 ("linux: fix epoll_pwait()
regression with < 2.6.19") which sadly exchanged one regression for
another.
PR-URL: https://github.com/libuv/libuv/pull/308
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>