Commit Graph

4148 Commits

Author SHA1 Message Date
Bert Belder
b6bf6d2d1f win,stream: add slot to remember CRT fd
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>
2015-06-14 16:22:17 -07:00
Saúl Ibarra Corretgé
60e515d9e6 Add SHA to ChangeLog 2015-06-05 19:46:28 +02:00
Saúl Ibarra Corretgé
30c8be07bb 2015.06.06, Version 1.6.1 (Stable)
Changes since version 1.6.0:

* unix: handle invalid _SC_GETPW_R_SIZE_MAX values (cjihrig)
2015-06-05 19:45:58 +02:00
cjihrig
d82e47a60f unix: handle invalid _SC_GETPW_R_SIZE_MAX values
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>
2015-06-05 19:44:31 +02:00
Saúl Ibarra Corretgé
f198b82f59 Add SHA to ChangeLog 2015-06-03 21:33:40 +02:00
Saúl Ibarra Corretgé
adfccad764 2015.06.04, Version 1.6.0 (Stable)
Changes since version 1.5.0:

* aix: fix setsockopt for multicast options (Michael)

* unix: don't block for io if any io handle is primed (Saúl Ibarra
  Corretgé)

* windows: MSVC 2015 has snprintf() (Rui Abreu Ferreira)

* windows: Add VS2015 support to vcbuild.bat (Jason Williams)

* doc: fix typo in tcp.rst (Igor Soarez)

* linux: work around epoll bug in kernels < 2.6.37 (Ben Noordhuis)

* unix,win: add uv_os_homedir() (cjihrig)

* stream: fix `select()` race condition (Fedor Indutny)

* unix: prevent infinite loop in uv__run_pending (Saúl Ibarra Corretgé)

* unix: make sure UDP send callbacks are asynchronous (Saúl Ibarra
  Corretgé)

* test: fix `platform_output` netmask printing. (Andrew Paprocki)

* aix: add ahafs autoconf detection and README notes (Andrew Paprocki)

* core: add ability to customize memory allocator (Saúl Ibarra Corretgé)
2015-06-03 21:32:57 +02:00
Miodrag Milanovic
7552305d32 win: fix compilation warning on MinGW
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>
2015-06-03 21:13:03 +02:00
cjihrig
a0c8815294 win: add XP support to uv_os_homedir()
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>
2015-06-03 00:26:56 +02:00
Saúl Ibarra Corretgé
d110a1b6c5 win: fix compilation
Yours truly broke compilation on bddd6a8489
2015-06-03 00:22:19 +02:00
Saúl Ibarra Corretgé
bddd6a8489 core: add ability to customize memory allocator
This patch is composed by the work done in
https://github.com/libuv/libuv/pull/231 and
https://github.com/libuv/libuv/pull/287 plus some changes by yours
truly.

Thanks @beevik and @mattsta for their work on this!

PR-URL: https://github.com/libuv/libuv/pull/368
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-02 12:05:20 +02:00
Andrew Paprocki
bb2632b339 aix: add ahafs autoconf detection and README notes
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>
2015-05-28 11:16:00 +02:00
Andrew Paprocki
266ee6424f test: fix platform_output netmask printing.
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>
2015-05-28 11:09:25 +02:00
Saúl Ibarra Corretgé
1816dbc85f unix: make sure UDP send callbacks are asynchronous
Fixes: https://github.com/libuv/libuv/issues/301
PR-URL: https://github.com/libuv/libuv/pull/371
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-28 11:05:45 +02:00
Saúl Ibarra Corretgé
3ceb260c65 unix: prevent infinite loop in uv__run_pending
If any of the callbacks called in uv__run_pending calls
uv__io_feed we enter an infinite loop, because we add the handle to the
same queue we are iterating over.

Refs: https://github.com/libuv/libuv/issues/301
PR-URL: https://github.com/libuv/libuv/pull/371
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-28 11:05:30 +02:00
Fedor Indutny
7005d29514 stream: fix select() race condition
Call `uv__read()`/`uv__write()` before re-entering `select` thread.
Otherwise we might get second event from it, and will block indefinitely
on `uv__read()`/`uv__write()`.

Fix: https://github.com/libuv/libuv/issues/304
PR-URL: https://github.com/libuv/libuv/pull/365
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-25 23:18:07 +02:00
cjihrig
a62c2d5928 unix,win: add uv_os_homedir()
PR-URL: https://github.com/libuv/libuv/pull/350
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-05-21 17:31:35 +02:00
Ben Noordhuis
d1b5008e76 linux: work around epoll bug in kernels < 2.6.37
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>
2015-05-19 12:28:53 +02:00
Igor Soarez
ccf90a1ea5 doc: fix typo in tcp.rst
PR-URL: https://github.com/libuv/libuv/pull/355
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-05-19 11:27:46 +02:00
Jason Williams
b8354c19d2 windows: Add VS2015 support to vcbuild.bat
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>
2015-05-19 11:24:16 +02:00
Rui Abreu Ferreira
18b857b9bd windows: MSVC 2015 has snprintf()
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>
2015-05-19 11:23:24 +02:00
Saúl Ibarra Corretgé
a6fa3ca99a unix: don't block for io if any io handle is primed
PR-URL: https://github.com/libuv/libuv/pull/347
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-12 07:37:26 +02:00
Michael Dawson
05ef2980ee aix: fix setsockopt for multicast options
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>
2015-05-07 20:14:20 +02:00
Saúl Ibarra Corretgé
9fe8acc902 Add SHA to ChangeLog 2015-05-06 22:27:17 +02:00
Saúl Ibarra Corretgé
4e77f74c7b 2015.05.07, Version 1.5.0 (Stable)
Changes since version 1.4.2:

* doc: clarify that the thread pool primites are not thread safe
  (Andrius Bentkus)

* aix: always deregister closing fds from epoll (Michael)

* unix: fix glibc-2.20+ macro incompatibility (Massimiliano Torromeo)

* doc: add Sphinx plugin for generating links to man pages (Saúl Ibarra
  Corretgé)

* doc: link system and library calls to man pages (Saúl Ibarra Corretgé)

* doc: document uv_getnameinfo_t.{host|service} (Saúl Ibarra Corretgé)

* build: update the location of gyp (Stephen von Takach)

* win: name all anonymous structs and unions (TomCrypto)

* linux: work around epoll bug in kernels 3.10-3.19 (Ben Noordhuis)

* darwin: fix size calculation in select() fallback (Ole André Vadla
  Ravnås)

* solaris: fix setsockopt for multicast options (Julien Gilli)

* test: fix race condition in multithreaded test (Ben Noordhuis)

* doc: fix long lines in tty.rst (Ben Noordhuis)

* test: use UV_TTY_MODE_* values in tty test (Ben Noordhuis)

* unix: don't clobber errno in uv_tty_reset_mode() (Ben Noordhuis)

* unix: reject non-tty fds in uv_tty_init() (Ben Noordhuis)

* win: fix pipe blocking writes (Alexis Campailla)

* build: fix cross-compiling for iOS (Steven Kabbes)

* win: remove unnecessary malloc.h

* include: use `extern "c++"` for defining C++ code (Kazuho Oku)

* unix: reap child on execvp() failure (Ryan Phillips)

* windows: fix handle leak on EMFILE (Brian Green)

* test: fix tty_file, close handle if initialized (Saúl Ibarra Corretgé)

* doc: clarify what uv_*_open accepts (Saúl Ibarra Corretgé)

* doc: clarify that we don't maintain external doc resources (Saúl
  Ibarra Corretgé)

* build: add documentation for ninja support (Devchandra Meetei
  Leishangthem)

* doc: document uv_buf_t members (Corey Farrell)

* linux: fix epoll_pwait() fallback on arm64 (Ben Noordhuis)

* android: fix compilation warning (Saúl Ibarra Corretgé)

* unix: don't close the fds we just setup (Sam Roberts)

* test: spawn child replacing std{out,err} to stderr (Saúl Ibarra
  Corretgé)

* unix: fix swapping fds order in uv_spawn (Saúl Ibarra Corretgé)

* unix: fix potential bug if dup2 fails in uv_spawn (Saúl Ibarra
  Corretgé)

* test: remove LOG and LOGF variadic macros (Saúl Ibarra Corretgé)

* win: fix uv_fs_access on directories (Saúl Ibarra Corretgé)

* win: fix of double free in uv_uptime (Per Nilsson)

* unix: open "/dev/null" instead of "/" for emfile_fd (Alan Rogers)

* docs: add some missing words (Daryl Haresign)

* unix: clean up uv_fs_open() O_CLOEXEC logic (Ben Noordhuis)

* build: set SONAME for shared library in uv.gyp (Rui Abreu Ferreira)

* windows: define snprintf replacement as inline instead of static (Rui
  Abreu Ferreira)

* win: fix unlink of readonly files (João Reis)

* doc: fix uv_run(UV_RUN_DEFAULT) description (Ben Noordhuis)

* linux: intercept syscall when running under memory sanitizer (Keno
  Fischer)

* aix: fix uv_interface_addresses return value (farblue68)

* windows: defer reporting TCP write failure until next tick (Saúl
  Ibarra Corretgé)

* test: add test for deferred TCP write failure (Saúl Ibarra Corretgé)
2015-05-06 21:48:15 +02:00
Saúl Ibarra Corretgé
e6e8124b95 test: add test for deferred TCP write failure
The test exhibits that write failures are deferred to the callback.

Refs: https://github.com/libuv/libuv/issues/339
PR_URL: https://github.com/libuv/libuv/pull/344
2015-05-05 23:25:49 +02:00
Saúl Ibarra Corretgé
710fcf7d10 unix: squelch compiler warning on release builds
Fixes: https://github.com/libuv/libuv/issues/343
2015-05-05 22:40:15 +02:00
Saúl Ibarra Corretgé
f880023b97 windows: defer reporting TCP write failure until next tick
Fixes: https://github.com/libuv/libuv/issues/339
Reviewed-By: Bert Belder <bertbelder@gmail.com>
2015-05-05 22:36:44 +02:00
farblue68
ee9c7bac8d aix: fix uv_interface_addresses return value
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>
2015-05-05 10:30:48 +02:00
Keno Fischer
af0d09bddc linux: intercept syscall when running under memory sanitizer
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>
2015-05-05 10:26:20 +02:00
Ben Noordhuis
7639dd510e doc: fix uv_run(UV_RUN_DEFAULT) description
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>
2015-05-01 01:20:39 +02:00
João Reis
0db81a98ff win: fix unlink of readonly files
Unix unlinks files even if they are not writable, windows version should behave similarly.

Fixes: https://github.com/joyent/node/issues/3006
PR-URL: https://github.com/libuv/libuv/pull/327
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-05-01 01:18:57 +02:00
Saúl Ibarra Corretgé
03df7e79c1 test: fix C++ style comment 2015-04-30 14:26:00 +02:00
Rui Abreu Ferreira
4a7c1268e0 windows: define snprintf replacement as inline instead of static
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>
2015-04-30 10:09:50 +02:00
Rui Abreu Ferreira
e49ebd696e build: set SONAME for shared library in uv.gyp
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>
2015-04-30 10:09:16 +02:00
Saúl Ibarra Corretgé
74990f3af2 gitignore: ignore IntelliJ project files 2015-04-30 10:04:34 +02:00
Ben Noordhuis
202195c2f4 unix: clean up uv_fs_open() O_CLOEXEC logic
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>
2015-04-29 15:10:08 +02:00
Saúl Ibarra Corretgé
1f711e4d6d Revert "memory: add uv_replace_allocator"
This reverts commit c272f1f1bc.

The concept will come back to libuv, but it needs some more work.
2015-04-29 09:37:02 +02:00
Daryl Haresign
706362083e docs: add some missing words
PR-URL: https://github.com/libuv/libuv/pull/332
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-04-28 22:36:33 +02:00
Alan Rogers
8fac49d0fc unix: open "/dev/null" instead of "/" for emfile_fd
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>
2015-04-24 09:38:19 +02:00
Per Nilsson
21bcacebba win: fix of double free in uv_uptime
PR-URL: https://github.com/libuv/libuv/pull/324
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-04-21 10:51:25 +02:00
Saúl Ibarra Corretgé
7dcc3e0cf0 win: fix uv_fs_access on directories
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>
2015-04-13 10:22:18 +02:00
Saúl Ibarra Corretgé
cdc10a907a test: remove LOG and LOGF variadic macros
Initial patch by @simar7, thanks!

PR-URL: https://github.com/libuv/libuv/pull/313
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-12 18:44:34 +02:00
Saúl Ibarra Corretgé
09cdc923c2 unix: fix potential bug if dup2 fails in uv_spawn
PR-URL: https://github.com/libuv/libuv/pull/309
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-10 15:27:04 +02:00
Saúl Ibarra Corretgé
009bbad4e7 unix: fix swapping fds order in uv_spawn
Alternative implementation (and test) to
https://github.com/libuv/libuv/pull/226

Fixes: https://github.com/joyent/libuv/issues/1084
PR-URL: https://github.com/libuv/libuv/pull/309
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-10 15:27:04 +02:00
Saúl Ibarra Corretgé
edcf04d5b1 test: spawn child replacing std{out,err} to stderr
Refs: https://github.com/libuv/libuv/pull/224

PR-URL: https://github.com/libuv/libuv/pull/309
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-10 15:11:14 +02:00
Sam Roberts
55cc5bac1b unix: don't close the fds we just setup
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>
2015-04-10 15:10:02 +02:00
Saúl Ibarra Corretgé
a7e7bafcc3 android: fix compilation warning
PR-URL: https://github.com/libuv/libuv/pull/285
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-04-10 11:32:40 +02:00
Ben Noordhuis
1d8332f7e6 linux: fix epoll_pwait() fallback on arm64
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>
2015-04-07 15:07:28 +02:00
Corey Farrell
e2e218b760 doc: document uv_buf_t members
PR-URL: https://github.com/libuv/libuv/pull/307
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2015-04-07 17:13:01 +02:00
Saúl Ibarra Corretgé
3e405d90d1 Revert "test: fix tcp_oob occassionally timing out"
This reverts commit 3346082132.

See https://github.com/libuv/libuv/issues/258
2015-04-07 11:15:49 +02:00