Commit Graph

335 Commits

Author SHA1 Message Date
daomingq
e900006642
thread: add support for affinity (#3774)
Backported thread affinity feature and related dependency commits
from master. It will add support for those APIs: uv_cpumask_size,
uv_thread_setaffinity, uv_thread_getaffinity.
The supported platforms are Linux, Freebsd, and Windows.
Empty implementations (returning UV_ENOTSUP) on non-supported platforms
(such as OS X and AIX).
2022-10-21 09:18:10 -04:00
jensbjorgensen
821b0ba8cb
doc: add uv_poll_cb status==UV_EBADF note (#3797) 2022-10-21 11:02:43 +02:00
Ben Noordhuis
73b0c1f947
unix,win: give thread pool threads an 8 MB stack (#3787)
Give the threads in the thread pool a stack size that is consistent
across platforms and architectures.

Fixes: https://github.com/libuv/libuv/issues/3786
2022-10-18 23:06:47 +02:00
Steven Schveighoffer
a855c74183
doc: add note about offset -1 in uv_fs_read/write (#3677) 2022-09-07 11:19:08 -04:00
Ben Noordhuis
fb76f210eb
unix: fix uv_getrusage() ru_maxrss reporting (#3721)
Most platforms report it in kilobytes but macOS and Solaris report it in
bytes and pages respectively.

Fixes: https://github.com/nodejs/node/issues/44332
2022-08-21 23:29:42 +02:00
Ikko Ashimine
f1635257cb
docs: update introduction.rst (#3664)
Github -> GitHub
2022-07-07 14:07:29 -04:00
blogdaren
e0680d3061
doc: fix link to uvwget example main() function (#3605) 2022-04-27 10:23:28 +02:00
Jiawen Geng
a78671543b
doc: make sample cross-platform build (#3592)
Co-authored-by: Ben Noordhuis <info@bnoordhuis.nl>
2022-04-11 09:52:28 +08:00
Ben Noordhuis
f250c6c73e
unix,win: add uv_available_parallelism() (#3499)
Replacement for the usage pattern where people use uv_cpu_info() as an
imperfect heuristic for determining the amount of parallelism that is
available to their programs.

Fixes #3493.
2022-03-04 22:35:14 +01:00
wyckster
c2a345fa67
doc: checkout -> check out (#3489)
"check out" is a verb phrase, but "checkout" is a noun. Since it is
being used as a verb, the spelling "check out" is required.
2022-02-22 10:58:43 -05:00
Paul Evans
722d003076
document the values of enum uv_stdio_flags (#3039)
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
2022-02-14 11:37:19 -05:00
Luca Adrian L
50c1d00839
win: return fractional seconds in uv_uptime() (#3455)
Some systems return fractional seconds, some return full seconds.
On Windows uptime was artificially rounded down.

Fixes #3447.
2022-02-08 14:23:39 +01:00
woclass
870828c8af
doc/guide: update content and sample code (#3408)
- Add `Makefile` for example codes. (cherry-pick from old uvbook repo)
- Add a new example "Default loop" to "Basics of libuv"/"Default loop"
- Document review and update: `Introduction`, `Basics of libuv`, `Filesystem`
    + Update the referenced libuv code snippet
    + Link update: http->https
    **Content Updates**:
    - `filesystem.rst`#L291-L297: Add note for `uv_fs_event_start`
    - `filesystem.rst`#L334: Add description of the callback function parameter `status`

The following examples have been tested manually in WSL2 (Ubuntu 20.04) with libuv 1.42.0:
- helloworld
- default-loop
- idle-basic
- uvcat
- uvtee
- onchange (test on macOS)

Co-authored-by: Nikhil Marathe <nsm.nikhil@gmail.com>
2022-01-31 16:52:42 -05:00
Campbell He
c7843ecfbc
unix,win: add uv_ip_name to get name from sockaddr (#3368)
uv_ip_name is a kind of wrapper of uv_ip4_name and uv_ip6_name
which can be used after getaddrinfo to get the IP name directly
from addrinfo.ai_addr.
2021-11-25 10:05:15 +01:00
Ofek Lev
c273d8b9cf
doc: replace pyuv with uvloop (#3324)
- pyuv is not actively maintained
- uvloop is downloaded 11M/mo, pyuv only 25k/mo

Refs: https://github.com/saghul/pyuv/issues/270#issuecomment-925106097
2021-10-10 00:56:50 +02:00
YAKSH BARIYA
68355e7d15
doc: fix broken links for netbsd's sysctl manpage (#3312) 2021-10-05 21:58:20 +02:00
Mohamed Edrah
84c057a357
docs: fix wrong information about scheduling
Fixes: https://github.com/libuv/libuv/issues/3252
PR-URL: https://github.com/libuv/libuv/pull/3253
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-07-29 12:08:53 -04:00
Ryan Liptak
5c85d67bc7
doc,udp: note that suggested_size is 1 max-sized dgram
The intention here is to make working with recvmmsg more
straight-forward, since internally libuv expects buffers that are
multiples of UV__UDP_DGRAM_MAXSIZE, but previously the availability of
that value wasn't readily apparent to the caller.

Closes: https://github.com/libuv/libuv/issues/2822
Closes: https://github.com/libuv/libuv/issues/1025
Closes: https://github.com/libuv/libuv/pull/1114
PR-URL: https://github.com/libuv/libuv/pull/2986
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-07-13 11:20:53 -04:00
Jameson Nash
4a27d87a69 doc: switch discussion forum to github
Freenode is gone (replaced by Libera.chat), but IRC was unused anyways.

Fixes: https://github.com/libuv/libuv/issues/3157
Fixes: https://github.com/libuv/libuv/issues/3208
PR-URL: https://github.com/libuv/libuv/pull/3214
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2021-06-30 23:26:40 -04:00
Jameson Nash
9ec6bb914f
docs: move list of project links under PR control
Copied from 
https://github.com/libuv/libuv/wiki/Projects-that-use-libuv, since the 
wiki was vulnerable to spam content.

PR-URL: https://github.com/libuv/libuv/pull/3204
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2021-06-22 13:23:59 -04:00
twosee
79d836b996
doc: more accurate list of valid send_handle's
PR-URL: https://github.com/libuv/libuv/pull/3201
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-06-18 23:38:03 -04:00
twosee
bcc4f8fdde
stream: introduce uv_try_write2 function
`uv_try_write2(stream, bufs, nbufs, send_handle)` acts like 
`uv_try_write()` and extended write function for sending handles over a 
pipe like `uv_write2`. It always returns `UV_EAGAIN` instead of 
`UV_ENOSYS` on Windows so we can easily write cross-platform code 
without special treatment.

PR-URL: https://github.com/libuv/libuv/pull/3183
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-05-28 10:57:59 -04:00
Simon Kissane
4cf638de05 doc: uv_read_stop always succeeds
Fixes: https://github.com/libuv/libuv/issues/3041
PR-URL: https://github.com/libuv/libuv/pull/3076
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-05-24 16:32:41 -04:00
Ryan Liptak
46451737e6
errors: map ESOCKTNOSUPPORT errno
PR-URL: https://github.com/libuv/libuv/pull/3151
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-05-21 16:34:31 -04:00
Darshan Sen
9739400d41
include: add EOVERFLOW status code mapping
Refs: https://github.com/nodejs/node/pull/38159#discussion_r610288214
PR-URL: https://github.com/libuv/libuv/pull/3145
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-05-13 11:01:14 -04:00
Jameson Nash
614bdbc56f
docs: update read-the-docs version of sphinx
This is specified both as best-practice to specify the defaults
explicitly, and as required for updating sphinx from v1.8.5

Refs: https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
PR-URL: https://github.com/libuv/libuv/pull/3154
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-05-10 19:29:25 -04:00
Shuowang (Wayne) Zhang
bd4a357b3d
zos: implement uv_get_constrained_memory()
Implementation is based on RLIMIT_MEMLIMIT.

Co-authored-by: Igor Todorovski <itodorov@ca.ibm.com>
PR-URL: https://github.com/libuv/libuv/pull/3133
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-04-04 18:14:17 +02:00
Ondřej Surý
c382d39a85
linux,udp: enable full ICMP error reporting
The Linux kernel suppresses some ICMP error messages by default for UDP
sockets. This commit sets IP_RECVERR/IPV6_RECVERR on the socket to
enable full ICMP error reporting, hopefully resulting in faster failover
to working name servers.

PR-URL: https://github.com/libuv/libuv/pull/2872
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2021-02-17 10:29:53 +01:00
raisinten
c3d08b5d63
doc: fix code highlighting
Affected docs:
* basics.rst
* filesystem.rst
* eventloops.rst
* networking.rst
* processes.rst
* threads.rst
* utilities.rst

Fixes: https://github.com/libuv/libuv/issues/3033
PR-URL: https://github.com/libuv/libuv/pull/3082
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2021-02-14 09:13:34 +01:00
Colin Ihrig
493be3ed23
doc: fix versionadded metadata
This commit adds the versionadded metadata for uv_pipe() and
uv_socketpair().

Refs: https://github.com/libuv/libuv/pull/2953
PR-URL: https://github.com/libuv/libuv/pull/3087
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2021-01-04 22:04:25 -05:00
Ethel Weston
9cc2667f76
doc: clarify UDP errors and recvmmsg
PR-URL: https://github.com/libuv/libuv/pull/3061
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-12-28 09:20:07 +01:00
Jameson Nash
4ddc292774
stream: add uv_pipe and uv_socketpair to the API
Equivalents of `pipe` and `socketpair` for cross-platform use.

PR-URL: https://github.com/libuv/libuv/pull/2953
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-11-09 21:50:09 -05:00
Ben Noordhuis
06b7317422 unix,win: harmonize uv_read_start() error handling
The behavior of `uv_read_start()` when the handle is closing or already
busy reading wasn't consistent across platforms. Now it is.

Fixes: https://github.com/libuv/help/issues/137
PR-URL: https://github.com/libuv/libuv/pull/2795
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2020-11-05 16:41:44 -05:00
Elad Nachmias
c2afc2f02a
doc,poll: add notes (repeated cb & cancel pending cb)
Added notes to documentation of `uv_poll_t`:
- The callback will be called over-and-over again as long as the socket
remains readable/writable.
- uv_poll_stop() cancels pending callbacks of already happened events.

Fixes: https://github.com/libuv/libuv/issues/1078
PR-URL: https://github.com/libuv/libuv/pull/1100
Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-11-04 10:39:29 -05:00
Ben Noordhuis
03185b785b doc: uv_tcp_bind() never returns UV_EADDRINUSE
It defers the error to uv_listen() or uv_tcp_connect().

PR-URL: https://github.com/libuv/libuv/pull/2218
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-10-27 13:00:59 -04:00
Ulrik Strid
2a1b880f54
unix,win: add uv_timer_get_due_in()
Co-authored-by: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Refs: https://github.com/nodejs/node-report/pull/73
Refs: https://github.com/libuv/libuv/pull/1255
Fixes: https://github.com/libuv/libuv/issues/2950
PR-URL: https://github.com/libuv/libuv/pull/2951
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-09-21 22:15:46 -04:00
Ryan Liptak
8a782f1815
doc: add uv_metrics_idle_time() version metadata
Refs: https://github.com/libuv/libuv/pull/2725
PR-URL: https://github.com/libuv/libuv/pull/2984
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-09-03 11:08:10 -04:00
cjihrig
45478378fd
doc: correct UV_UDP_MMSG_FREE version added
Refs: https://github.com/libuv/libuv/pull/2836
PR-URL: https://github.com/libuv/libuv/pull/2985
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-09-03 11:05:03 -04:00
Ryan Liptak
ea17e1cffb
udp: add UV_UDP_MMSG_FREE recv_cb flag
Refs: https://github.com/libuv/libuv/issues/2822
PR-URL: https://github.com/libuv/libuv/pull/2836
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-09-02 20:21:07 -04:00
Jameson Nash
79c531cb7d
nfci: address some style nits
PR-URL: https://github.com/libuv/libuv/pull/2954
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-08-21 17:25:42 -04:00
Jameson Nash
707dd7f17d
doc: fix most sphinx warnings
PR-URL: https://github.com/libuv/libuv/pull/2956
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-08-18 13:07:04 -04:00
Richard Lau
ea92e9c720
aix: protect uv_exepath() from uv_set_process_title()
Store a copy of the original argv[0] to protect `uv_exepath()`
against `uv_set_process_title()` changing the value of argv[0].

Extract common code for finding a program on the current PATH.

Fixes: https://github.com/libuv/libuv/issues/2674
PR-URL: https://github.com/libuv/libuv/pull/2677
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-08-10 11:27:30 -04:00
Ryan Liptak
07e4168b67
unix: error when uv_setup_args() is not called
This commit updates uv_{get,set}_process_title() to return an
error when uv_setup_args() is needed, but has not been called.

Per-platform behavior after this commit:

- Windows: uv_setup_args() does nothing, get/set process title
  works as before.
- Unix: get/set process title will return ENOBUFS if
  uv_setup_args() wasn't called, if it failed, or if the process
  title memory has been freed by uv__process_title_cleanup()
  (via uv_library_shutdown()).
- AIX: set process title returns ENOBUFS if uv_setup_args()
  wasn't called, if it failed to allocate memory for the argv
  copy, or if the proctitle memory has been freed by
  uv__process_title_cleanup() (via uv_library_shutdown).
  Getting the process title will do the same except it can
  still succeed if uv_setup_args() was called but failed to
  allocate memory for the argv copy.
- BSD: uv_setup_args() is only needed for getting the initial
  process title; if uv_setup_args() is not called then any
  get_process_title calls() before a set_process_title() call
  will return an empty string.
- Platforms that use no-proctitle.c: get will return an empty
  string, set is a no-op (these are the same as before this commit)

Fixes: https://github.com/libuv/libuv/issues/2845
PR-URL: https://github.com/libuv/libuv/pull/2853
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-08-09 11:52:22 -04:00
Trevor Norris
e8effd4556 core: add API to measure event loop idle time
The API addition `uv_metrics_idle_time()` is a thread safe call that
allows the user to retrieve the amount of time the event loop has spent
in the kernel's event provider (i.e. poll). It was done this way to
allow retrieving this value without needing to interrupt the execution
of the event loop. This option can be enabled by passing
`UV_METRICS_IDLE_TIME` to `uv_loop_configure()`.

One important aspect of this change is, when enabled, to always first
call the event provider with a `timeout == 0`. This allows libuv to know
whether any events were waiting in the event queue when the event
provider was called. The importance of this is because libuv is tracking
the amount of "idle time", not "poll time". Thus the provider entry time
is not recorded when `timeout == 0` (the event provider never idles in
this case).

While this does add a small amount of overhead, when enabled, but the
overhead decreases when the event loop has a heavier load. This is
because poll events will be waiting when the event provider is called.
Thus never actually recording the provider entry time.

Checking if `uv_loop_t` is configured with `UV_METRICS_IDLE_TIME` always
happens in `uv__metrics_set_provider_entry_time()` and
`uv__metrics_update_idle_time()`. Making the conditional logic wrapping
each call simpler and allows for instrumentation to always hook into
those two function calls.

Rather than placing the fields directly on `uv__loop_internal_fields_t`
add the struct `uv__loop_metrics_t` as a location for future metrics API
additions.

Tests and additional documentation has been included.

PR-URL: https://github.com/libuv/libuv/pull/2725
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-08-04 10:31:42 -04:00
JinHyuk Kim
0a8c1c53b6
doc: add more error constants
PR-URL: https://github.com/libuv/libuv/pull/2932
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-07-31 14:29:54 -04:00
Ryan Liptak
6b5aa669db
udp: add uv_udp_using_recvmmsg query
Allows for determining if a buffer large enough for multiple dgrams
should be allocated in alloc_cb of uv_udp_recvstart, for example.
Contributes towards #2822.

PR-URL: https://github.com/libuv/libuv/pull/2830
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-07-28 23:28:18 -04:00
Juan Sebastian velez Posada
f7d162477a
docs: improve the descriptions for get memory info
PR-URL: https://github.com/libuv/libuv/pull/2780
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
2020-07-28 17:10:34 -04:00
MasterDuke17
5a0779ba32
doc: fix the order of arguments to calloc()
PR-URL: https://github.com/libuv/libuv/pull/2835
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-05-17 09:22:00 -04:00
Ben Noordhuis
7ccea60b1f doc: fix formatting
Fixes: https://github.com/libuv/libuv/issues/2831
PR-URL: https://github.com/libuv/libuv/pull/2833
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-05-07 10:53:56 +02:00
Bartosz Sosnowski
457285827c fs: report original error
Exposes the original system error of the filesystem syscalls. Adds a new
uv_fs_get_system_error which returns orignal errno on Linux or
GetLastError on Windows.

Ref: https://github.com/libuv/libuv/issues/2348

PR-URL: https://github.com/libuv/libuv/pull/2810
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-04-29 13:14:57 +02:00
twosee
06b2f13bad doc: add uv_replace_allocator thread safety warning
PR-URL: https://github.com/libuv/libuv/pull/2815/
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-04-28 23:16:06 +02:00
Ben Noordhuis
25368e2db1 doc: check/idle/prepare functions always succeed
Make the documentation reflect that the init/start/stop functions
for check/idle/prepare handles always succeed.

PR-URL: https://github.com/libuv/libuv/pull/2803
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-04-28 20:06:55 +02:00
Philip Chimento
002fe6e5f2 doc: fix unescaped character
This was causing a warning during the documentation build.

PR-URL: https://github.com/libuv/libuv/pull/2797
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-04-22 12:44:50 +02:00
Philip Chimento
a87bb3c5f6 doc: uv_cancel() handles uv_random_t requests
This seems to be the case from reading the code of uv_cancel().

Also fixes a broken link due to a markup typo.

PR-URL: https://github.com/libuv/libuv/pull/2797
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-04-22 12:44:12 +02:00
Shohei YOSHIDA
99f8ffcc4e doc: correct source lines
PR-URL: https://github.com/libuv/libuv/pull/2802
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-04-22 12:40:32 +02:00
Ben Noordhuis
72fe3543fe unix,win: add uv_library_shutdown()
Make it possible to explicitly tell libuv to release any resources
it's still holding onto (memory, threads, file descriptors, etc.)

Before this commit, cleanup was performed in various destructors.
This commit centralizes the cleanup logic, enabling the addition of
`uv_library_shutdown()`, but maintains the current observable behavior
of cleaning up when libuv is unloaded by means of `dlclose(3)`.

Fixes: https://github.com/libuv/libuv/issues/2763
PR-URL: https://github.com/libuv/libuv/pull/2764
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2020-04-22 12:24:36 +02:00
James Ross
37a8affbd3 linux: make cpu_times consistently be milliseconds
On Linux, cpu_times have been calculated differently to all other
platforms for a while. Other platforms (FreeBSD, Mac, Windows) are all
in milliseconds, but Linux has been returning values ten times larger.

libuv has not previously documented what unit cpu_times uses, even
though NodeJS did - as milliseconds.

Here we're both documenting that the cpu_times are indeed in
milliseconds, and fixing the inconsistency on Linux.

Fixes: https://github.com/libuv/libuv/issues/2773
PR-URL: https://github.com/libuv/libuv/pull/2796
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-04-22 10:46:07 +02:00
Saúl Ibarra Corretgé
5736658bee
udp: add flag to enable recvmmsg(2) explicitly
Instead of implicitly enabling it by checking the supplied buffer size
to alloc_cb, have a dedicated flag that must be set on `uv_udp_init_ex`.

Fixes: https://github.com/libuv/libuv/issues/2791
Closes: https://github.com/libuv/libuv/pull/2792
PR-URL: https://github.com/libuv/libuv/pull/2799
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-04-19 11:40:24 -04:00
Sk Sajidul Kadir
bd4292385f fs: add uv_fs_lutime()
PR-URL: https://github.com/libuv/libuv/pull/2723
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-04-14 10:06:33 +02:00
Xu Meng
d21f5aeab0
ibmi: set the highest process priority to -10
On IBMi PASE, the highest process priority is -10.

PR-URL: https://github.com/libuv/libuv/pull/2642
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-04-06 09:22:24 -04:00
Saúl Ibarra Corretgé
d9cd7d437d udp: return recvmmsg-ed datagrams in order
When recvmmsg support was added it returned the datagrams in reverse
received order, which may impact some applications.

To restore the previous behavior, we call recv_cb one last time with
nread == 0 and addr == NULL so applications can free the buffer.

PR-URL: https://github.com/libuv/libuv/pull/2736
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-03-24 08:27:00 +01:00
Marek Vavrusa
3d7136639a freebsd,linux: add recvmmsg() + sendmmsg() udp implementation
This commits adds support for recvmmsg() and sendmmsg() extensions to
recvmsg() and sendmsg() that allows the caller to receive and send
multiple message from a socket using a single system call. This has
performance benefits for some applications.

Co-authored-by: Ondřej Surý <ondrej@sury.org>
Co-authored-by: Witold Kręcicki <wpk@culm.net>

PR-URL: https://github.com/libuv/libuv/pull/2532
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-02-20 11:52:54 +01:00
Ben Noordhuis
fb4c563132 docs: uv_setup_args() may take ownership of argv
PR-URL: https://github.com/libuv/libuv/pull/2668
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2020-02-08 12:28:34 +01:00
Manuel BACHMANN
21aff3b4c4
unix: make uv_tcp_keepalive predictable
Current UNIX systems define various defaults for
TCP_KEEPINTVL and TCP_KEEPCNT, which makes the time
between TCP_KEEPIDLE delay is reached and timeout
effectively occurs unpredictable (Linux: /proc/sys
/net/ipv4/tcp_keepalive_intvl;tcp_keepalive_probes).

Do the following: set TCP_KEEPINTVL to 1 second (same
as Win32 default) and TCP_KEEPCNT to 10 times (same
as Win32 hardcoded value).

Fixes: https://github.com/libuv/libuv/issues/2664
PR-URL: https://github.com/libuv/libuv/pull/2669
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2020-02-07 22:52:45 +01:00
Dominique Dumont
fb5a35ee91
doc: strip ICC profile from 2 jpg files
The embedded color profiles are proprietary data. Considering that
embedding a color profile in a image is not necessary when color
accuracy is not important, it's better to strip them.

This was done with:

convert -strip docs/src/static/diagrams.key/Data/st0-311.jpg \
  docs/src/static/diagrams.key/Data/st0-311.jpg
convert -strip docs/src/static/diagrams.key/Data/st1-475.jpg \
  docs/src/static/diagrams.key/Data/st1-475.jpg

convert command comes from ImageMagick project.

Fixes: https://github.com/libuv/libuv/issues/2670
PR-URL: https://github.com/libuv/libuv/pull/2672
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2020-02-07 22:08:04 +01:00
Witold Kręcicki
a629688008 pipe: disallow listening on an IPC pipe
PR-URL: https://github.com/libuv/libuv/pull/2559
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
2020-01-31 11:09:16 +01:00
Jameson Nash
02a36bb3ba docs: clarify that uv_pipe_t is a pipe
Some people have misread this section to imply that libuv does not
support Unix `pipe` objects, while it only should be saying that the
UV_CREATE_PIPE makes a socketpair. Clarify the docs to say specifically
that `uv_pipe_t` represents any local file stream.

PR-URL: https://github.com/libuv/libuv/pull/2607
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2020-01-09 10:38:02 -05:00
Jameson Nash
8cb8afe253 docs: switch from linux.die.net to man7.org
The former was missing `urandom`, while the later is the host site for
https://www.kernel.org/doc/man-pages

PR-URL: https://github.com/libuv/libuv/pull/2608
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2020-01-08 11:52:02 -05:00
Jameson Nash
c072a3846d docs: fix linkcheck
Prefer https when available, follow permanent redirects, and find
alternate sources for dead links.

PR-URL: https://github.com/libuv/libuv/pull/2608
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2020-01-08 11:51:04 -05:00
Jameson Nash
2b79df6456
docs: fix formatting
Introduced in https://github.com/libuv/libuv/pull/2404
and https://github.com/libuv/libuv/pull/2347.

PR-URL: https://github.com/libuv/libuv/pull/2609
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-01-07 23:43:09 -05:00
Saúl Ibarra Corretgé
5500253cac fs: add uv_fs_mkstemp
Thanks to Andreas Hauptmann and Bastian Schmitz for their earlier work.

Supersedes: https://github.com/libuv/libuv/pull/2074
Closes: https://github.com/libuv/libuv/issues/2555
PR-URL: https://github.com/libuv/libuv/pull/2557
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-12-03 09:03:50 +01:00
cjihrig
8c73eee23f
unix,win: add uv_sleep()
This commit exposes the uv_sleep() function that previously
only existed in the test runner.

PR-URL: https://github.com/libuv/libuv/pull/2548
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2019-11-25 12:13:39 -05:00
nia
a62f8ced7a netbsd: use KERN_ARND sysctl to get entropy
PR-URL: https://github.com/libuv/libuv/pull/2528
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2019-10-29 13:36:05 +01:00
Stefan Bender
ddcaff9a10
unix: update uv_fs_copyfile() fallback logic
This commit fixes uv_fs_copyfile() in cases where an unknown error
occurs when copy-on-write is requested by setting
UV_FS_COPYFILE_FICLONE. The original approach tried to catch some of
the errors raised by the ioctl() call, assuming that sendfile() would
also fail in those cases. This is not necessarily true, as some
variants of ioctl() also raise EINVAL (some maybe EBADF), but sendfile()
works just fine.

This patch reverses the logic, falling back to sendfile() in any
case where ioctl() returns an error. In other words, it tries much
harder to make uv_fs_copyfile() work.

Related to that, the original approach returned UV_ENOTSUP
unconditionally in cases where ioctl() failed and
UV_FS_COPYFILE_FICLONE_FORCE was set. However, ioctl() may have
failed for other reasons than being not supported. The function
now returns the actual error raised by ioctl(), leaving it to the
caller to deal with it.

Fixes: https://github.com/libuv/libuv/issues/2483
PR-URL: https://github.com/libuv/libuv/pull/2514
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-10-16 10:49:42 -04:00
Ryan Liptak
e668e10acb
doc: improve uv_{send,recv}_buffer_size() docs
PR-URL: https://github.com/libuv/libuv/pull/2508
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-10-14 21:22:57 -04:00
erw7
fd2ce38dd6 win,tty: add uv_tty_{get,set}_vterm_state
PR-URL: https://github.com/libuv/libuv/pull/2501
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Reviewed-By: Jameson Nash <vtjnash+github@gmail.com>
2019-10-09 09:36:36 +02:00
cjihrig
d6b79ffb1b
doc: improve uv_fs_readdir() cleanup docs
When cleaning up after uv_fs_readdir(), it is important to
call uv_fs_req_cleanup() on the readdir request prior to calling
uv_fs_closedir(), because the latter frees memory that the
former needs in order to do its job.

PR-URL: https://github.com/libuv/libuv/pull/2497
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2019-10-06 16:08:04 +02:00
Nhan Khong
75075d6cdb docs: fix literal-includes in User Guide
Using raw copies in place of sphinx literalinclude
directives as the API of v1.x is now stable.

Fixes: https://github.com/libuv/libuv/issues/2350
PR-URL: https://github.com/libuv/libuv/pull/2353
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
2019-09-25 14:39:23 +02:00
Ben Noordhuis
4ed2a78f0e unix,win: add uv_random()
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>
2019-09-18 08:09:14 +02:00
Daniel Bevenius
25682fafeb
doc: uv_handle_t documentation suggestion
This commit contains a suggestion to hopefully improve the
documentation of uv_handle_t's member uv_loop_t.

PR-URL: https://github.com/libuv/libuv/pull/2446
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2019-09-09 11:09:30 -04:00
Bartosz Sosnowski
7d950c0d10 win, tty: improve SIGWINCH performance
Continuing improvement of SIGWINCH from PR #2308.

Running SetWinEventHook without filtering for the specific PIDs has
significant impact on the performance of the entire system. This PR
changes the way SIGWINCH is handled.

The SetWinEventHook callback now signals a separate thread,
uv__tty_console_resize_watcher_thread. This thread calls
uv__tty_console_signal_resize() which checks if the console was actually
resized. The uv__tty_console_resize_watcher_thread makes sure to not to
call the uv__tty_console_signal_resize function more than 30 times per
second.

The SetWinEventHook will not be installed, if the PID of the
conhost.exe process that owns the console window cannot be
determinated. This can happen when a 32bit libuv app is running on a
64bit Windows.

For such cases PR #1408 is partially reverted - when tty reads
WINDOW_BUFFER_SIZE_EVENT, it will also trigger a call to
uv__tty_console_signal_resize(). This will also help when the app is
running under console emulators. Documentation was also updated to
reflect that.

Refs: https://github.com/microsoft/terminal/issues/1811
Refs: https://github.com/microsoft/terminal/issues/410
Refs: https://github.com/libuv/libuv/pull/2308

PR-URL: https://github.com/libuv/libuv/pull/2381
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-09-05 11:36:02 +02:00
Vladimir Karnushin
91d95f8ceb
udp: add source-specific multicast support
PR-URL: https://github.com/libuv/libuv/pull/2202
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2019-08-23 21:09:47 +02:00
Tomas Krizek
641ec77265
doc: clarify uv_buf_t usage in uv_alloc_cb
Clarify the uv_buf_t isn't reused and the user is responsible for
freeing it in the recv/read callback.

Previously, this wasn't clear when reading only the docs for
uv_udp_recv_cb and uv_alloc_cb.

PR-URL: https://github.com/libuv/libuv/pull/2438
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2019-08-23 20:27:48 +02:00
Santiago Gimeno
958e85fbd8
tcp: add uv_tcp_close_reset method
It resets a TCP connection by sending a RST packet. Due to some platform
inconsistencies, mixing of `uv_shutdown` and `uv_tcp_close_reset` calls
is not allowed.

Fixes: https://github.com/libuv/libuv/issues/1991
PR-URL: https://github.com/libuv/libuv/pull/2425
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-08-19 23:41:15 +02:00
Crunkle
813264add0
win: remove try-except outside MSVC
Fixes: https://github.com/libuv/libuv/issues/2407
PR-URL: https://github.com/libuv/libuv/pull/2412
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2019-08-09 09:53:55 -04:00
Nan Xiao
f5ca3e868c
doc: fix typo in basics.rst
PR-URL: https://github.com/libuv/libuv/pull/2366
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-08-06 10:59:05 -04:00
Saúl Ibarra Corretgé
2480b6158a unix,win: add ability to retrieve all env variables
Fixes: https://github.com/libuv/libuv/issues/2400

PR-URL: https://github.com/libuv/libuv/pull/2404
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
2019-08-03 08:33:42 +02:00
cjihrig
bf86d5fbaf
unix,win: add uv_fs_statfs()
Fixes: https://github.com/libuv/libuv/issues/2386
PR-URL: https://github.com/libuv/libuv/pull/2396
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2019-08-01 07:21:15 -10:00
João Reis
2c279504f9 win: add UV_FS_O_FILEMAP
Reading and writing files using a memory file mapping can be
significantly faster on Windows.

PR-URL: https://github.com/libuv/libuv/pull/2295
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
2019-07-16 18:20:10 +02:00
cjihrig
1a06462cd3
doc: fix incorrect versionchanged
Version 1.29.2 never happened. Update the versionchanged from
9a10058e72 to be 1.30.0.

PR-URL: https://github.com/libuv/libuv/pull/2354
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-06-27 13:20:14 -04:00
Leo Chung
5fc58eb3d5 doc: fix wrong mutex function prototypes
The `:lines:` numbers were wrong, they showed the signatures of the
uv_fs_access and uv_fs_chmod functions.
2019-06-25 08:57:42 +02:00
Jenil Christo
805401b0b3
doc: add link to nodejs.org
PR-URL: https://github.com/libuv/libuv/pull/2325
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-06-24 21:32:13 -04:00
Vlad A
9a10058e72 threadpool: increase UV_THREADPOOL_SIZE limit
Increase the UV_THREADPOOL_SIZE limit to 1024 and update the docs.

Fixes: https://github.com/libuv/libuv/pull/2296
PR-URL: https://github.com/libuv/libuv/pull/2314
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2019-06-07 10:59:44 +02:00
Kelvin Jin
c4e9657d59
unix,win: add uv_get_constrained_memory()
Fixes: https://github.com/libuv/libuv/issues/2286
PR-URL: https://github.com/libuv/libuv/pull/2289
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-05-15 11:35:05 -04:00
FX Coudert
68173cc802
doc: fix build with sphinx 2.x
app.info() was deprecated on Jan 4, 2017 (sphinx-doc/sphinx#3267),
and removed as of Sphinx 2.0.0. This commit removes the usage of
app.info().

PR-URL: https://github.com/libuv/libuv/pull/2265
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
2019-05-13 16:06:29 -04:00
Michele Caini
557b04cdce
doc: add missing uv_fs_type entries
PR-URL: https://github.com/libuv/libuv/pull/2280
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-05-13 16:00:58 -04:00
Ben Noordhuis
03e389eb43 doc: mark uv_async_send() as async-signal-safe
Refs: https://github.com/libuv/libuv/issues/2173
PR-URL: https://github.com/libuv/libuv/pull/2273
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-23 10:46:56 +02:00
cjihrig
2a9d626b4c
doc: document uv_timeval_t and uv_timeval64_t
PR-URL: https://github.com/libuv/libuv/pull/2246
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-04-11 14:10:14 -04:00
cjihrig
2e090c8f2c
unix,win: introduce uv_timeval64_t
Fixes: https://github.com/libuv/libuv/issues/2243
PR-URL: https://github.com/libuv/libuv/pull/2246
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-04-11 14:08:17 -04:00
cjihrig
99440bb673
unix,win: add uv_fs_{open,read,close}dir()
Co-authored-by: Julien Gilli <jgilli@nodejs.org>
Co-authored-by: Jeremy Whitlock <jwhitlock@apache.org>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/libuv/libuv/pull/2057
Refs: https://github.com/joyent/libuv/issues/1430
Refs: https://github.com/joyent/libuv/pull/1521
Refs: https://github.com/joyent/libuv/pull/1574
Refs: https://github.com/libuv/libuv/pull/175
Refs: https://github.com/nodejs/node/issues/583
Refs: https://github.com/libuv/libuv/pull/416
Refs: https://github.com/libuv/libuv/issues/170
2019-03-26 18:47:51 -04:00