libuv 1.45.0, #include cleanup, probably something else.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4308 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
17
deps/libuv/docs/src/design.rst
vendored
17
deps/libuv/docs/src/design.rst
vendored
@ -60,16 +60,15 @@ stages of a loop iteration:
|
||||
:align: center
|
||||
|
||||
|
||||
#. The loop concept of 'now' is updated. The event loop caches the current time at the start of
|
||||
the event loop tick in order to reduce the number of time-related system calls.
|
||||
#. The loop concept of 'now' is initially set.
|
||||
|
||||
#. Due timers are run if the loop was run with ``UV_RUN_DEFAULT``. All active timers scheduled
|
||||
for a time before the loop's concept of *now* get their callbacks called.
|
||||
|
||||
#. If the loop is *alive* an iteration is started, otherwise the loop will exit immediately. So,
|
||||
when is a loop considered to be *alive*? If a loop has active and ref'd handles, active
|
||||
requests or closing handles it's considered to be *alive*.
|
||||
|
||||
#. Due timers are run. All active timers scheduled for a time before the loop's concept of *now*
|
||||
get their callbacks called.
|
||||
|
||||
#. Pending callbacks are called. All I/O callbacks are called right after polling for I/O, for the
|
||||
most part. There are cases, however, in which calling such a callback is deferred for the next
|
||||
loop iteration. If the previous iteration deferred any I/O callback it will be run at this point.
|
||||
@ -101,9 +100,11 @@ stages of a loop iteration:
|
||||
#. Close callbacks are called. If a handle was closed by calling :c:func:`uv_close` it will
|
||||
get the close callback called.
|
||||
|
||||
#. Special case in case the loop was run with ``UV_RUN_ONCE``, as it implies forward progress.
|
||||
It's possible that no I/O callbacks were fired after blocking for I/O, but some time has passed
|
||||
so there might be timers which are due, those timers get their callbacks called.
|
||||
#. The loop concept of 'now' is updated.
|
||||
|
||||
#. Due timers are run. Note that 'now' is not updated again until the next loop iteration.
|
||||
So if a timer became due while other timers were being processed, it won't be run until
|
||||
the following event loop iteration.
|
||||
|
||||
#. Iteration ends. If the loop was run with ``UV_RUN_NOWAIT`` or ``UV_RUN_ONCE`` modes the
|
||||
iteration ends and :c:func:`uv_run` will return. If the loop was run with ``UV_RUN_DEFAULT``
|
||||
|
23
deps/libuv/docs/src/fs.rst
vendored
23
deps/libuv/docs/src/fs.rst
vendored
@ -12,6 +12,12 @@ otherwise it will be performed asynchronously.
|
||||
All file operations are run on the threadpool. See :ref:`threadpool` for information
|
||||
on the threadpool size.
|
||||
|
||||
Starting with libuv v1.45.0, some file operations on Linux are handed off to
|
||||
`io_uring <https://en.wikipedia.org/wiki/Io_uring>` when possible. Apart from
|
||||
a (sometimes significant) increase in throughput there should be no change in
|
||||
observable behavior. Libuv reverts to using its threadpool when the necessary
|
||||
kernel features are unavailable or unsuitable.
|
||||
|
||||
.. note::
|
||||
On Windows `uv_fs_*` functions use utf-8 encoding.
|
||||
|
||||
@ -24,7 +30,8 @@ Data types
|
||||
|
||||
.. c:type:: uv_timespec_t
|
||||
|
||||
Portable equivalent of ``struct timespec``.
|
||||
Y2K38-unsafe data type for storing times with nanosecond resolution.
|
||||
Will be replaced with :c:type:`uv_timespec64_t` in libuv v2.0.
|
||||
|
||||
::
|
||||
|
||||
@ -160,6 +167,10 @@ Data types
|
||||
size_t nentries;
|
||||
} uv_dir_t;
|
||||
|
||||
.. c:type:: void (*uv_fs_cb)(uv_fs_t* req)
|
||||
|
||||
Callback called when a request is completed asynchronously.
|
||||
|
||||
|
||||
Public members
|
||||
^^^^^^^^^^^^^^
|
||||
@ -218,7 +229,8 @@ API
|
||||
|
||||
.. c:function:: int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb)
|
||||
|
||||
Equivalent to :man:`preadv(2)`.
|
||||
Equivalent to :man:`preadv(2)`. If the `offset` argument is `-1`, then
|
||||
the current file offset is used and updated.
|
||||
|
||||
.. warning::
|
||||
On Windows, under non-MSVC environments (e.g. when GCC or Clang is used
|
||||
@ -231,7 +243,8 @@ API
|
||||
|
||||
.. c:function:: int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, const uv_buf_t bufs[], unsigned int nbufs, int64_t offset, uv_fs_cb cb)
|
||||
|
||||
Equivalent to :man:`pwritev(2)`.
|
||||
Equivalent to :man:`pwritev(2)`. If the `offset` argument is `-1`, then
|
||||
the current file offset is used and updated.
|
||||
|
||||
.. warning::
|
||||
On Windows, under non-MSVC environments (e.g. when GCC or Clang is used
|
||||
@ -463,10 +476,6 @@ API
|
||||
The background story and some more details on these issues can be checked
|
||||
`here <https://github.com/nodejs/node/issues/7726>`_.
|
||||
|
||||
.. note::
|
||||
This function is not implemented on Windows XP and Windows Server 2003.
|
||||
On these systems, UV_ENOSYS is returned.
|
||||
|
||||
.. versionadded:: 1.8.0
|
||||
|
||||
.. c:function:: int uv_fs_chown(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_uid_t uid, uv_gid_t gid, uv_fs_cb cb)
|
||||
|
3
deps/libuv/docs/src/guide/networking.rst
vendored
3
deps/libuv/docs/src/guide/networking.rst
vendored
@ -164,7 +164,7 @@ IPv6 stack only
|
||||
|
||||
IPv6 sockets can be used for both IPv4 and IPv6 communication. If you want to
|
||||
restrict the socket to IPv6 only, pass the ``UV_UDP_IPV6ONLY`` flag to
|
||||
``uv_udp_bind`` [#]_.
|
||||
``uv_udp_bind``.
|
||||
|
||||
Multicast
|
||||
~~~~~~~~~
|
||||
@ -250,7 +250,6 @@ times, with each address being reported once.
|
||||
----
|
||||
|
||||
.. [#] https://beej.us/guide/bgnet/html/#broadcast-packetshello-world
|
||||
.. [#] on Windows only supported on Windows Vista and later.
|
||||
.. [#] https://www.tldp.org/HOWTO/Multicast-HOWTO-6.html#ss6.1
|
||||
.. [#] libuv use the system ``getaddrinfo`` in the libuv threadpool. libuv
|
||||
v0.8.0 and earlier also included c-ares_ as an alternative, but this has been
|
||||
|
2
deps/libuv/docs/src/guide/utilities.rst
vendored
2
deps/libuv/docs/src/guide/utilities.rst
vendored
@ -235,7 +235,7 @@ Our downloader is to be invoked as::
|
||||
|
||||
$ ./uvwget [url1] [url2] ...
|
||||
|
||||
So we add each argument as an URL
|
||||
So we add each argument as a URL
|
||||
|
||||
.. rubric:: uvwget/main.c - Adding urls
|
||||
.. literalinclude:: ../../code/uvwget/main.c
|
||||
|
3
deps/libuv/docs/src/handle.rst
vendored
3
deps/libuv/docs/src/handle.rst
vendored
@ -153,6 +153,9 @@ API
|
||||
In-progress requests, like uv_connect_t or uv_write_t, are cancelled and
|
||||
have their callbacks called asynchronously with status=UV_ECANCELED.
|
||||
|
||||
`close_cb` can be `NULL` in cases where no cleanup or deallocation is
|
||||
necessary.
|
||||
|
||||
.. c:function:: void uv_ref(uv_handle_t* handle)
|
||||
|
||||
Reference the given handle. References are idempotent, that is, if a handle
|
||||
|
48
deps/libuv/docs/src/metrics.rst
vendored
48
deps/libuv/docs/src/metrics.rst
vendored
@ -4,8 +4,46 @@
|
||||
Metrics operations
|
||||
======================
|
||||
|
||||
libuv provides a metrics API to track the amount of time the event loop has
|
||||
spent idle in the kernel's event provider.
|
||||
libuv provides a metrics API to track various internal operations of the event
|
||||
loop.
|
||||
|
||||
|
||||
Data types
|
||||
----------
|
||||
|
||||
.. c:type:: uv_metrics_t
|
||||
|
||||
The struct that contains event loop metrics. It is recommended to retrieve
|
||||
these metrics in a :c:type:`uv_prepare_cb` in order to make sure there are
|
||||
no inconsistencies with the metrics counters.
|
||||
|
||||
::
|
||||
|
||||
typedef struct {
|
||||
uint64_t loop_count;
|
||||
uint64_t events;
|
||||
uint64_t events_waiting;
|
||||
/* private */
|
||||
uint64_t* reserved[13];
|
||||
} uv_metrics_t;
|
||||
|
||||
|
||||
Public members
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
.. c:member:: uint64_t uv_metrics_t.loop_count
|
||||
|
||||
Number of event loop iterations.
|
||||
|
||||
.. c:member:: uint64_t uv_metrics_t.events
|
||||
|
||||
Number of events that have been processed by the event handler.
|
||||
|
||||
.. c:member:: uint64_t uv_metrics_t.events_waiting
|
||||
|
||||
Number of events that were waiting to be processed when the event provider
|
||||
was called.
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
@ -25,3 +63,9 @@ API
|
||||
:c:type:`UV_METRICS_IDLE_TIME`.
|
||||
|
||||
.. versionadded:: 1.39.0
|
||||
|
||||
.. c:function:: int uv_metrics_info(uv_loop_t* loop, uv_metrics_t* metrics)
|
||||
|
||||
Copy the current set of event loop metrics to the ``metrics`` pointer.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
85
deps/libuv/docs/src/misc.rst
vendored
85
deps/libuv/docs/src/misc.rst
vendored
@ -73,7 +73,8 @@ Data types
|
||||
|
||||
.. c:type:: uv_timeval_t
|
||||
|
||||
Data type for storing times.
|
||||
Y2K38-unsafe data type for storing times with microsecond resolution.
|
||||
Will be replaced with :c:type:`uv_timeval64_t` in libuv v2.0.
|
||||
|
||||
::
|
||||
|
||||
@ -84,7 +85,7 @@ Data types
|
||||
|
||||
.. c:type:: uv_timeval64_t
|
||||
|
||||
Alternative data type for storing times.
|
||||
Y2K38-safe data type for storing times with microsecond resolution.
|
||||
|
||||
::
|
||||
|
||||
@ -93,6 +94,28 @@ Data types
|
||||
int32_t tv_usec;
|
||||
} uv_timeval64_t;
|
||||
|
||||
.. c:type:: uv_timespec64_t
|
||||
|
||||
Y2K38-safe data type for storing times with nanosecond resolution.
|
||||
|
||||
::
|
||||
|
||||
typedef struct {
|
||||
int64_t tv_sec;
|
||||
int32_t tv_nsec;
|
||||
} uv_timespec64_t;
|
||||
|
||||
.. c:enum:: uv_clock_id
|
||||
|
||||
Clock source for :c:func:`uv_clock_gettime`.
|
||||
|
||||
::
|
||||
|
||||
typedef enum {
|
||||
UV_CLOCK_MONOTONIC,
|
||||
UV_CLOCK_REALTIME
|
||||
} uv_clock_id;
|
||||
|
||||
.. c:type:: uv_rusage_t
|
||||
|
||||
Data type for resource usage results.
|
||||
@ -119,7 +142,10 @@ Data types
|
||||
} uv_rusage_t;
|
||||
|
||||
Members marked with `(X)` are unsupported on Windows.
|
||||
See :man:`getrusage(2)` for supported fields on Unix
|
||||
See :man:`getrusage(2)` for supported fields on UNIX-like platforms.
|
||||
|
||||
The maximum resident set size is reported in kilobytes, the unit most
|
||||
platforms use natively.
|
||||
|
||||
.. c:type:: uv_cpu_info_t
|
||||
|
||||
@ -211,7 +237,7 @@ API
|
||||
type of the stdio streams.
|
||||
|
||||
For :man:`isatty(3)` equivalent functionality use this function and test
|
||||
for ``UV_TTY``.
|
||||
for `UV_TTY`.
|
||||
|
||||
.. c:function:: int uv_replace_allocator(uv_malloc_func malloc_func, uv_realloc_func realloc_func, uv_calloc_func calloc_func, uv_free_func free_func)
|
||||
|
||||
@ -225,8 +251,8 @@ API
|
||||
after all resources have been freed and thus libuv doesn't reference
|
||||
any allocated memory chunk.
|
||||
|
||||
On success, it returns 0, if any of the function pointers is NULL it
|
||||
returns UV_EINVAL.
|
||||
On success, it returns 0, if any of the function pointers is `NULL` it
|
||||
returns `UV_EINVAL`.
|
||||
|
||||
.. warning:: There is no protection against changing the allocator multiple
|
||||
times. If the user changes it they are responsible for making
|
||||
@ -362,6 +388,13 @@ API
|
||||
|
||||
Frees the `cpu_infos` array previously allocated with :c:func:`uv_cpu_info`.
|
||||
|
||||
.. c:function:: int uv_cpumask_size(void)
|
||||
|
||||
Returns the maximum size of the mask used for process/thread affinities,
|
||||
or `UV_ENOTSUP` if affinities are not supported on the current platform.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
||||
.. c:function:: int uv_interface_addresses(uv_interface_address_t** addresses, int* count)
|
||||
|
||||
Gets address information about the network interfaces on the system. An
|
||||
@ -541,18 +574,21 @@ API
|
||||
|
||||
.. c:function:: uint64_t uv_get_free_memory(void)
|
||||
|
||||
Gets the amount of free memory available in the system, as reported by the kernel (in bytes).
|
||||
Gets the amount of free memory available in the system, as reported by
|
||||
the kernel (in bytes). Returns 0 when unknown.
|
||||
|
||||
.. c:function:: uint64_t uv_get_total_memory(void)
|
||||
|
||||
Gets the total amount of physical memory in the system (in bytes).
|
||||
Returns 0 when unknown.
|
||||
|
||||
.. c:function:: uint64_t uv_get_constrained_memory(void)
|
||||
|
||||
Gets the amount of memory available to the process (in bytes) based on
|
||||
Gets the total amount of memory available to the process (in bytes) based on
|
||||
limits imposed by the OS. If there is no such constraint, or the constraint
|
||||
is unknown, `0` is returned. Note that it is not unusual for this value to
|
||||
be less than or greater than :c:func:`uv_get_total_memory`.
|
||||
is unknown, `0` is returned. If there is a constraining mechanism, but there
|
||||
is no constraint set, `UINT64_MAX` is returned. Note that it is not unusual
|
||||
for this value to be less than or greater than :c:func:`uv_get_total_memory`.
|
||||
|
||||
.. note::
|
||||
This function currently only returns a non-zero value on Linux, based
|
||||
@ -560,9 +596,23 @@ API
|
||||
|
||||
.. versionadded:: 1.29.0
|
||||
|
||||
.. c:function:: uint64_t uv_get_available_memory(void)
|
||||
|
||||
Gets the amount of free memory that is still available to the process (in bytes).
|
||||
This differs from :c:func:`uv_get_free_memory` in that it takes into account any
|
||||
limits imposed by the OS. If there is no such constraint, or the constraint
|
||||
is unknown, the amount returned will be identical to :c:func:`uv_get_free_memory`.
|
||||
|
||||
.. note::
|
||||
This function currently only returns a value that is different from
|
||||
what :c:func:`uv_get_free_memory` reports on Linux, based
|
||||
on cgroups if it is present.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
||||
.. c:function:: uint64_t uv_hrtime(void)
|
||||
|
||||
Returns the current high-resolution real time. This is expressed in
|
||||
Returns the current high-resolution timestamp. This is expressed in
|
||||
nanoseconds. It is relative to an arbitrary time in the past. It is not
|
||||
related to the time of day and therefore not subject to clock drift. The
|
||||
primary use is for measuring performance between intervals.
|
||||
@ -571,6 +621,19 @@ API
|
||||
Not every platform can support nanosecond resolution; however, this value will always
|
||||
be in nanoseconds.
|
||||
|
||||
.. c:function:: int uv_clock_gettime(uv_clock_id clock_id, uv_timespec64_t* ts)
|
||||
|
||||
Obtain the current system time from a high-resolution real-time or monotonic
|
||||
clock source.
|
||||
|
||||
The real-time clock counts from the UNIX epoch (1970-01-01) and is subject
|
||||
to time adjustments; it can jump back in time.
|
||||
|
||||
The monotonic clock counts from an arbitrary point in the past and never
|
||||
jumps back in time.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
||||
.. c:function:: void uv_print_all_handles(uv_loop_t* loop, FILE* stream)
|
||||
|
||||
Prints all handles associated with the given `loop` to the given `stream`.
|
||||
|
4
deps/libuv/docs/src/poll.rst
vendored
4
deps/libuv/docs/src/poll.rst
vendored
@ -101,7 +101,9 @@ API
|
||||
with one of the `UV_E*` error codes (see :ref:`errors`). The user should
|
||||
not close the socket while the handle is active. If the user does that
|
||||
anyway, the callback *may* be called reporting an error status, but this is
|
||||
**not** guaranteed.
|
||||
**not** guaranteed. If `status == UV_EBADF` polling is discontinued for the
|
||||
file handle and no further events will be reported. The user should
|
||||
then call :c:func:`uv_close` on the handle.
|
||||
|
||||
.. note::
|
||||
Calling :c:func:`uv_poll_start` on a handle that is already active is
|
||||
|
BIN
deps/libuv/docs/src/static/loop_iteration.png
vendored
BIN
deps/libuv/docs/src/static/loop_iteration.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 64 KiB |
40
deps/libuv/docs/src/threading.rst
vendored
40
deps/libuv/docs/src/threading.rst
vendored
@ -88,6 +88,46 @@ Threads
|
||||
|
||||
.. versionadded:: 1.26.0
|
||||
|
||||
.. c:function:: int uv_thread_setaffinity(uv_thread_t* tid, char* cpumask, char* oldmask, size_t mask_size)
|
||||
|
||||
Sets the specified thread's affinity to cpumask, which is specified in
|
||||
bytes. Optionally returning the previous affinity setting in oldmask.
|
||||
On Unix, uses :man:`pthread_getaffinity_np(3)` to get the affinity setting
|
||||
and maps the cpu_set_t to bytes in oldmask. Then maps the bytes in cpumask
|
||||
to a cpu_set_t and uses :man:`pthread_setaffinity_np(3)`. On Windows, maps
|
||||
the bytes in cpumask to a bitmask and uses SetThreadAffinityMask() which
|
||||
returns the previous affinity setting.
|
||||
|
||||
The mask_size specifies the number of entries (bytes) in cpumask / oldmask,
|
||||
and must be greater-than-or-equal-to :c:func:`uv_cpumask_size`.
|
||||
|
||||
.. note::
|
||||
Thread affinity setting is not atomic on Windows. Unsupported on macOS.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
||||
.. c:function:: int uv_thread_getaffinity(uv_thread_t* tid, char* cpumask, size_t mask_size)
|
||||
|
||||
Gets the specified thread's affinity setting. On Unix, this maps the
|
||||
cpu_set_t returned by :man:`pthread_getaffinity_np(3)` to bytes in cpumask.
|
||||
|
||||
The mask_size specifies the number of entries (bytes) in cpumask,
|
||||
and must be greater-than-or-equal-to :c:func:`uv_cpumask_size`.
|
||||
|
||||
.. note::
|
||||
Thread affinity getting is not atomic on Windows. Unsupported on macOS.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
||||
.. c:function:: int uv_thread_getcpu(void)
|
||||
|
||||
Gets the CPU number on which the calling thread is running.
|
||||
|
||||
.. note::
|
||||
Currently only implemented on Windows, Linux and FreeBSD.
|
||||
|
||||
.. versionadded:: 1.45.0
|
||||
|
||||
.. c:function:: uv_thread_t uv_thread_self(void)
|
||||
.. c:function:: int uv_thread_join(uv_thread_t *tid)
|
||||
.. c:function:: int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2)
|
||||
|
3
deps/libuv/docs/src/threadpool.rst
vendored
3
deps/libuv/docs/src/threadpool.rst
vendored
@ -14,6 +14,9 @@ is 1024).
|
||||
|
||||
.. versionchanged:: 1.30.0 the maximum UV_THREADPOOL_SIZE allowed was increased from 128 to 1024.
|
||||
|
||||
.. versionchanged:: 1.45.0 threads now have an 8 MB stack instead of the
|
||||
(sometimes too low) platform default.
|
||||
|
||||
The threadpool is global and shared across all event loops. When a particular
|
||||
function makes use of the threadpool (i.e. when using :c:func:`uv_queue_work`)
|
||||
libuv preallocates and initializes the maximum number of threads allowed by
|
||||
|
2
deps/libuv/docs/src/udp.rst
vendored
2
deps/libuv/docs/src/udp.rst
vendored
@ -56,7 +56,7 @@ Data types
|
||||
/*
|
||||
* Indicates if IP_RECVERR/IPV6_RECVERR will be set when binding the handle.
|
||||
* This sets IP_RECVERR for IPv4 and IPV6_RECVERR for IPv6 UDP sockets on
|
||||
* Linux. This stops the Linux kernel from supressing some ICMP error messages
|
||||
* Linux. This stops the Linux kernel from suppressing some ICMP error messages
|
||||
* and enables full ICMP error reporting for faster failover.
|
||||
* This flag is no-op on platforms other than Linux.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user