Instead of doing it instead Makefile.am, this fixes libuv.pc on MinGW.
Previous version generates libuv.pc with LIBS = "-lpthread" instead of
"-lpthread -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv" on MinGW.
Previous version generates the following Makefile.am:
am__append_4 = -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv
...
LIBS = -lpthread $(am__append_4)
and the following configure.ac:
AS_IF([test "x$PKG_CONFIG" != "x"], [
AC_CONFIG_FILES([libuv.pc])
])
AC_CONFIG_FILES([Makefile])
Therefore, Makefile is generated after libuv.pc. Variables from
Makefile don't affect config.status and libuv.pc.
PR-URL: https://github.com/libuv/libuv/pull/841
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
`POLLHDRUP` is not implemented on AIX. Therefore `UV_DISCONNECT` will
never be set on `events`. This causes the socket to never be closed and
the tests to be stuck inside `pollset_poll` indefinitely, resulting in a
timeout.
This fixes the following tests:
- poll_duplex
- poll_unidirectional
Updated docs to let end users know that `UV_DISCONNECT` can be set, but
is unsupported on AIX.
Fixes: https://github.com/libuv/libuv/issues/844
PR-URL: https://github.com/libuv/libuv/pull/857
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The code for handling fs events is quite complex, this commits tries to
make it easier to follow.
First, there are 2 cases in which we use the name of the file straight
from the event (when watching a directory):
- if we cannot create the long path
- if the file got renamed or removed
So separate this logically, even if the code we need is the same.
Second, one way or anothwer we will always have some filename to report,
so remove an unnecessary if.
Third, nullify filenamew, to avoid having a dangling pointer, should the
code change.
PR-URL: https://github.com/libuv/libuv/pull/858
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Cast the `ru_majflt` and `ru_maxrss` field to `unsigned long long` when
printing them with `"%llu"`.
Warnings introduced in commit 6f17a61 ("win: add maxrss, pagefaults to
uv_getrusage()".)
PR-URL: https://github.com/libuv/libuv/pull/855
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The 'visibility%' gyp variable was designed as an override mechanism for
old (<=3.4) versions of gcc that don't know about -fvisibility=hidden.
It turns out it's fairly easy for embedders to muck up the define, as
witnessed by the fact that node.js is currently leaking internal libuv
symbols due to not properly setting 'visibility%'.
While that could be fixed by tweaking node.js, because we don't support
gcc 3.4 anymore and haven't for a long time, making -fvisibility=hidden
the default here seems all around easier.
PR-URL: https://github.com/libuv/libuv/pull/847
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
There was a memory corruption issue with the pthread barrier
implementation on android, where a barrier could still be in use by one
thread when being freed by another.
This fixes that issue and adds lots of missing error handling.
This implementation is now also used for the OSX fallback.
Fixes: https://github.com/libuv/libuv/issues/615
PR-URL: https://github.com/libuv/libuv/pull/790
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Currently when PATH_MAX is undefined realpath will default to using 4096.
There is a potential stack overflow attack that can be mitigated by having
PATH_MAX defined. This change conservatively errors if a system does not
have PATH_MAX defined.
This change also explicitly includes `limits.h` to ensure that all platforms
have PATH_MAX defined if it is available.
Ref: http://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html
Refs: https://github.com/nodejs/node/issues/2680#issuecomment-213521708
PR-URL: https://github.com/libuv/libuv/pull/843
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit populates the ru_majflt and ru_maxrss fields of
uv_getrusage() on Windows.
PR-URL: https://github.com/libuv/libuv/pull/805
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
The file descriptor that you receive from ahafs has to be part of the
pollset_poll set of interest in order to receive events. This does not
happen until we are in the event loop causing the test to hang and
therefore timeout.
PR-URL: https://github.com/libuv/libuv/pull/838
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
uv__close() won't clobber errno so there is no need to guard calls with
a SAVE_ERRNO(...) wrapper.
PR-URL: https://github.com/libuv/libuv/pull/837
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Libuv expects that free() does not clobber errno. The system allocator
honors that assumption but custom allocators may not be so careful.
PR-URL: https://github.com/libuv/libuv/pull/837
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
It has been reported that for SharePoint connections mapped as a drive,
uv_fs_scandir() returns "." and ".." entries when the expectation is
that they should be filtered out.
After some investigation it looks like the driver returns ".\0" and
"..\0" for those entries, that is, it includes the zero byte in the
filename length. Rewrite the filter to catch those entries as well.
Fixes: https://github.com/nodejs/node/issues/4002
PR-URL: https://github.com/libuv/libuv/pull/636
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Originally intended workaround is especially needed for Android <4.4.
However it fails to compare errno collected from pthread_sigmask.
This has been fixed separately in JXcore. See issue:
https://github.com/jxcore/jxcore-cordova/issues/55
PR-URL: https://github.com/libuv/libuv/pull/833
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
It was reported that some node.js tests fail on AIX because the exit
event sometimes comes before the final stdio output of a child process.
Work around that by deferring the signal watcher that is used for
process management until after the dispatch of regular i/o watchers.
Fixes: https://github.com/libuv/libuv/issues/610
PR-URL: https://github.com/libuv/libuv/pull/611
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Remove unused variables and code. Also remove some code duplication. End
result is code is cleaner, readable and easier to step through when
debugging.
PR-URL: https://github.com/libuv/libuv/pull/825
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Return an error instead of aborting when /proc/stat doesn't have the
expected format.
PR-URL: https://github.com/libuv/libuv/pull/822
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
'futimens' is only implemented on AIX 7.1. Other functions like
'utimes' and 'utimes' are merely stub functions that return ENOSYS
on AIX 6.1 and below. Skip test fs_futime for AIX versions below 7.1.
PR-URL: https://github.com/libuv/libuv/pull/811
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Currently, the tests assert that the home directory doesn't end
in a slash. However, if the home directory is / or something like
C:\, then this assertion is incorrect. This commit adds special
handling for these cases.
Fixes: https://github.com/libuv/libuv/issues/812
PR-URL: https://github.com/libuv/libuv/pull/813
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The comment removed by this commit is no longer relevant, as
the function's return type changed from int to void.
PR-URL: https://github.com/libuv/libuv/pull/804
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Find the real name of the tty using ttyname_r(3) instead of
opening "/dev/tty" which causes trouble if the fd doesn't point to the
controlling terminal.
PR-URL: https://github.com/libuv/libuv/pull/779
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Use `uv__close__nocheckstdio` instead of `close`.
PR-URL: https://github.com/libuv/libuv/pull/798
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
We only need the absolute path to create our .mon file under /aha. So
only duplicate the passed string. This keeps behaviour similar to other
platforms.
Fixes test fs_event_getpath.
PR-URL: https://github.com/libuv/libuv/pull/776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv__makedir_p was not processing all directories in passed string. Now
if a directory already exists (EEXIST) it simply moves onto the next
directory in the provided string.
Fixed bogus assert in uv__ahafs_event.
PR-URL: https://github.com/libuv/libuv/pull/776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The uid and gid fields in uv_passwd_t are of type long so use %ld for
printing them. Fixes two -Wformat compiler warnings.
PR-URL: https://github.com/libuv/libuv/pull/797
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
It can happen that the `parent` end of the `signal_pipe` is given a
STDIO file descriptor, so closing it using `uv__close` fails.
This problem is happening when running the `spawn_closed_process_io`
test in `SmartOS`. The reason being that when creating a socketpair in
`uv__process_init_stdio`, the `Illumos` implementation uses 3 sockets:
one is used as a listener, and the other 2 represent both ends of the
pipe. The listener socket is closed once the pipe is created. In the
test, the listener socket is assigned to the `0` fd, as it is the
first free fd in the system. So the fd `0` remained free after the call
to `socketpair`. Afterwards, when creating the `signal_pipe`, the fd `0`
is being assigned again, so closing it with `uv__close` made the test
fail. This issue is not happening in the other unixes because
`socketpair` doesn't use 3 fd's, but only 2.
To solve the issue, a new `uv__close__nocheckstdio()` function has been
added and used.
PR-URL: https://github.com/libuv/libuv/pull/796
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit adds the copyright header to the two tests that
were missing it.
PR-URL: https://github.com/libuv/libuv/pull/782
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
wcslen() returns a size_t, not an int.
Add bounds checking to dirlen to avoid undefined if dirlen is 0.
Cache relpath size calculation to replace redundant (- 1 + 1)
expression while still showing workings.
Change uv_relative_path return type to void and remove dead code which
branched on the return value.
PR-URL: https://github.com/libuv/libuv/pull/699
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
When converting an absolute path to a relative path on Windows,
uv_relative_path assumed that the relative path could be no longer than
MAX_PATH characters, and would allocate a buffer of MAX_PATH characters
for the relative path.
However, where a recursive watch is started for a directory using a UNC
path, and where events within that directory occur for pathnames longer
than MAX_PATH, it is possible for the relative path to exceed MAX_PATH
characters and overflow the buffer.
This commit fixes uv_relative_path to allocate a buffer for the exact
number of characters counted in the relative path.
Fixes: https://github.com/libuv/libuv/issues/693
PR-URL: https://github.com/libuv/libuv/pull/699
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Make explicit that handles and requests should be closed before calling
uv_loop_close().
Fixes: https://github.com/libuv/libuv/issues/765
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
fs__realpath_handle() removes the UNC prefixes \\?\ and \\?\UNC\
from paths returned by GetFinalPathNameByHandle, but doesn't
update the string length before sending it to fs__wide_to_utf8.
Fix that by decrement the correct size from the string length.
PR-URL: https://github.com/libuv/libuv/pull/733
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>