Add an API for obtaining cryptographically strong random data from the
system PRNG.
Co-authored-by: Saúl Ibarra Corretgé <s@saghul.net>
Refs: https://github.com/libuv/libuv/pull/1055
PR-URL: https://github.com/libuv/libuv/pull/2347
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
It was reported that uv_get_free_memory() and uv_get_total_memory()
report the wrong values inside an lxc container.
Libuv calls sysinfo(2) but that isn't intercepted by lxc. /proc/meminfo
however is because /proc is a FUSE fs inside the container.
This commit makes libuv try /proc/meminfo first and fall back to
sysinfo(2) in case /proc isn't mounted.
Fixes: https://github.com/libuv/libuv/issues/2249
PR-URL: https://github.com/libuv/libuv/pull/2258
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Encode domain names before passing them on to the libc resolver.
Some getaddrinfo() implementations support IDNA 2008, some only
IDNA 2003 and some don't support i18n domain names at all.
This is a potential security issue because it means a domain name
might resolve differently depending on the system that libuv is
running on.
Fixes: https://github.com/libuv/libuv/issues/2028
PR-URL: https://github.com/libuv/libuv/pull/2046
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Use `setproctitle()` in `FreeBSD` as in the other `BSD` flavours.
Move `uv_setup_args()`, `uv_set_process_title()` and `uv_get_process_title()` to
`bsd-proctitle.c` so it's used by the supported BSDs.
PR-URL: https://github.com/libuv/libuv/pull/2042
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Merge src/unix/timer.c and src/win/timer.c into src/timer.c. This
changes the Windows implementation from a binary tree to a binary
heap for generally better performance.
PR-URL: https://github.com/libuv/libuv/pull/1882
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This is a cherry-pick of commit d010030ad5 from the master branch.
Conflicts:
Makefile.am
include/uv.h
include/uv/unix.h
libuv.nsi (deleted)
src/unix/pthread-barrier.c (deleted)
PR-URL: https://github.com/libuv/libuv/pull/1850
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
IBM i compilers now predefine __PASE__. This commit updates
code to rely on that rather than manually setting (or relying on)
a _PASE definition.
PR-URL: https://github.com/libuv/libuv/pull/1782
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Faulty logic in commit fdf7c2a ("build: split off tests into separate
gyp file") accidentally disabled `-D_FILE_OFFSET_BITS=64` on Unices,
breaking file operations on files > 2 GB on 32 bits platforms.
Fixes: https://github.com/nodejs/node/issues/19455
PR-URL: https://github.com/libuv/libuv/pull/1779
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Make it easier for Node.js to ship libuv in its tarballs without also
including the test suite. Node.js already does so but recent changes
to its build system complicate that.
Kills two birds with one stone: it helps out Node.js and it makes it
harder for us to introduce hidden dependencies between the library and
the test suite.
PR-URL: https://github.com/libuv/libuv/pull/1725
Refs: https://github.com/nodejs/node/pull/18287
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Added a check in uv__fs_buf_iter to detect partial reads and writes.
Partial reads and writes are looped until all data has been processed.
PR-URL: https://github.com/libuv/libuv/pull/640
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On Linux when connecting IP addresses 0.0.0.0 and :: are automatically
converted to localhost. This adds same functionality to Windows.
PR-URL: https://github.com/libuv/libuv/pull/1515
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit uses the Register File Interest feature on z/OS
to enable users to monitor file system events.
The poll call is used to check for file descriptors as well
as a message queue that z/OS will report file system events
on. The last item on the list used by poll will contain the
message queue id instead of a file descriptor.
Limitation:
Writes to a directory (that is, file creation and deletion)
do not generate a change message for a registered directory.
PR-URL: https://github.com/libuv/libuv/pull/1311
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Used a shared uv_mutex_t in unix implementations of these functions
to prevent simultaneous execution.
Fixes: https://github.com/libuv/libuv/issues/271
PR-URL: https://github.com/libuv/libuv/pull/1640
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Add getter/setter functions for the fields of public structs that
might be relevant to e.g. Node.js addons.
Through these methods, ABI compatibility for a subset of the ABI
is easier to achieve, since using them makes code independent
of the exact offsets of these fields.
The intended use case that prompted this are N-API addons for
Node.js, which look for more long-term ABI compatibility guarantees
than typical Node code. With these helper functions, using libuv
directly should no longer be an obstacle for such addons.
PR-URL: https://github.com/libuv/libuv/pull/1657
Refs: https://github.com/nodejs/node/issues/13512
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Support the IBM i platform.
- add a new file src/unix/ibmi.c
- extract the common functions from /src/unix/aix.c into aix-common.c
- update uv.gyp and include/uv-unix.h to enable the new file ibmi.c
PR-URL: https://github.com/libuv/libuv/pull/1601
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.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>
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>
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>
Out-of-band TCP messages are used for TCP data
transmission outside (outband) the inbound TCP
data. These packets are sent with an
"urgent pointer", but previously discarded.
Additionally, when using (e)poll a POLLPRI is
triggered when an interrupt signal is received
on GPIO capable systems such as the Raspberry Pi.
PR-URL: https://github.com/libuv/libuv/pull/1040
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On Linux we read `/proc/self/exe` for the path to the executable.
Factor out a dedicated source file to make this implementation
available for use on other platforms that support it.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On Linux we use `sysinfo(2)` to look up the load average.
Factor out a dedicated source file to make this implementation
available for use on other platforms that support it.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On Linux we use `sysinfo(2)` to look up available memory.
Factor out a dedicated source file to make this implementation
available for use on other platforms that support it.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On os390 we implement no support for fsevents. Other platforms may not
support fsevents either, so provide a dedicated source file to use in
this case.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
On SunOS we implement no support for proctitle. Other platforms may not
support proctitle either, so provide a dedicated source file to use in
this case.
PR-URL: https://github.com/libuv/libuv/pull/1312
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Test that the fast path will continue writing. On failure, this test
will timeout.
PR-URL: https://github.com/libuv/libuv/pull/1308
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Added the uv_loop_fork() API that must be called in a child process to
continue using an existing loop. Internally this calls a uv__io_fork
function for each supported platform, similar to the way
uv__platform_loop_init works.
After this call, existing and new IO, async and signal watchers will
contiue working as before on all platforms, as will the
threadpool (although any threads it was using are of course gone).
On Linux and BSDs that use kqueue, existing and new fsevent watchers
will also continue to work as expected. On OS X, though, directory
fsevents will not be able to use the optimized CoreFoundation path if
they had already been used in the parent process, instead falling back
to the kqueue path used on other BSDs.
Existing fsevent watchers will not function on AIX or SunOS. This
could be relatively easily fixed by someone with AIX knowledge in the
future, but SunOS will require some additional work to keep track if
the watchers.
A new test file, test/test-fork.c, was added to contain fork-related
tests to verify functionality in the child process.
PR-URL: https://github.com/libuv/libuv/pull/846
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Create a dedicated source file to share among platforms on which we find
ifaddrs using the BSD getifaddrs API. De-duplicate our existing copies
of this implementation on such platforms.
PR-URL: https://github.com/libuv/libuv/pull/1240
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Create a dedicated source file to share among platforms on which we
implement hrtime using POSIX `clock_gettime`. De-duplicate our
existing copies of this implementation on such platforms.
PR-URL: https://github.com/libuv/libuv/pull/1239
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
On AIX, watch feature depends on AHAFS based Event infrastructure.
While in principle the watch use case is same across platforms, there
are subtle differences in the way AIX deals with this, with few
behavioral changes (external).
This commit opens up the AIX code for watch feature which was masked
under a macro HAVE_SYS_AHAFS_EVPRODS_H and addresses an assertion
failure on folder watch.
PR-URL: https://github.com/libuv/libuv/pull/1156
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Use built-in proctitle implementation because there is no such thing as
a process title on zOS.
PR-URL: https://github.com/libuv/libuv/pull/1208
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This is what `uname` on the system actually displays.
Also, other gyp based projects use 'os390'
PR-URL: https://github.com/libuv/libuv/pull/1207
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fix all functional test cases:
* use PLO compare,swap,store for atomic instruction
* do not use semaphore.h
* use xplink flag when linking
* scandir implementation
* nanosleep implementation
* add proctitle
* uv_loadavg
* uv_fs_event_init/start
* uv_fs_event_stop
* uv_exepath using __getthent syscall
* read free/total memory from mvs data areas
* uv_resident_set_memory implementation
* network interfaces implementation
* cpu_info implementation
* implement uv__hrtime
* make uv__fs_mkdtemp implementation
* epoll implementation for asyncio
* uv__fs_event_close implementation
* set process title
* read ancillary data that remains on queue
* ancillary data
* implement uv__fs_access
* use /dev/urandom for temporary directory name
* disable proctitle on zos completely
PR-URL: https://github.com/libuv/libuv/pull/1037
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This method uses the poll syscall to determine whether POLLNVAL is
flagged or not.
PR-URL: https://github.com/libuv/libuv/pull/957
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
zOS does not implement some pthread_barrier functions. So we will use
the provided helper functions in src/unix/pthread*.
PR-URL: https://github.com/libuv/libuv/pull/954
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
- zos: disable test cases not applicable
- zos: build options
- zos: semaphore implementation
- zos: use compare and swap builtins
- zos: struct rusage not the same as other platforms
- zos: backlog<=0 produces undefined behaviour
Will redefine backlog in the following way
* if backlog == 0, set it to 1
* if backlog < 0, set it to SOMAXCONN
- zos: define IMAXBEL as empty flag and implement uv__tty_make_raw
- zos: use udp multicast operations from aix
- zos: ESC in ebcdic
- zos: use LIBPATH for dynamic linker path
- zos: uv_udp_set_ttl only works for ipv6
- zos: increase pthread stack size by factor of 4
- zos: return ENODEV instead of ENXIO errors for setsockopt
- zos: use uv_cond_init the same way as aix
- test: enable oob test for zos
- zos: return EINVAL for zos error code EOPNOTSUPP
PR-URL: https://github.com/libuv/libuv/pull/937
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Treat both the base being NULL or the length being 0 as ENOBUFS.
PR-URL: https://github.com/libuv/libuv/pull/997
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When Windows resumes after sleep GetQueuedCompletionStatus timeout is
not updated. This commit adds a method for signaling all loops to
wake up and update their timers.
Fixes: https://github.com/nodejs/node/issues/6763
PR-URL: https://github.com/libuv/libuv/pull/962
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>