mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
Update libuv
This commit is contained in:
@@ -21,11 +21,11 @@ def get_libuv_version():
|
||||
with open('../../include/uv-version.h') as f:
|
||||
data = f.read()
|
||||
try:
|
||||
m = re.search(r"""^#define UV_VERSION_MAJOR (\d)$""", data, re.MULTILINE)
|
||||
m = re.search(r"""^#define UV_VERSION_MAJOR (\d+)$""", data, re.MULTILINE)
|
||||
major = int(m.group(1))
|
||||
m = re.search(r"""^#define UV_VERSION_MINOR (\d)$""", data, re.MULTILINE)
|
||||
m = re.search(r"""^#define UV_VERSION_MINOR (\d+)$""", data, re.MULTILINE)
|
||||
minor = int(m.group(1))
|
||||
m = re.search(r"""^#define UV_VERSION_PATCH (\d)$""", data, re.MULTILINE)
|
||||
m = re.search(r"""^#define UV_VERSION_PATCH (\d+)$""", data, re.MULTILINE)
|
||||
patch = int(m.group(1))
|
||||
m = re.search(r"""^#define UV_VERSION_IS_RELEASE (\d)$""", data, re.MULTILINE)
|
||||
is_release = int(m.group(1))
|
||||
|
||||
@@ -8,6 +8,9 @@ In libuv errors are negative numbered constants. As a rule of thumb, whenever
|
||||
there is a status parameter, or an API functions returns an integer, a negative
|
||||
number will imply an error.
|
||||
|
||||
When a function which takes a callback returns an error, the callback will never
|
||||
be called.
|
||||
|
||||
.. note::
|
||||
Implementation detail: on Unix error codes are the negated `errno` (or `-errno`), while on
|
||||
Windows they are defined by libuv to arbitrary negative numbers.
|
||||
@@ -329,3 +332,13 @@ API
|
||||
|
||||
Returns the error name for the given error code. Leaks a few bytes
|
||||
of memory when you call it with an unknown error code.
|
||||
|
||||
.. c:function:: int uv_translate_sys_error(int sys_errno)
|
||||
|
||||
Returns the libuv error code equivalent to the given platform dependent error
|
||||
code: POSIX error codes on Unix (the ones stored in `errno`), and Win32 error
|
||||
codes on Windows (those returned by `GetLastError()` or `WSAGetLastError()`).
|
||||
|
||||
If `sys_errno` is already a libuv error, it is simply returned.
|
||||
|
||||
.. versionchanged:: 1.10.0 function declared public.
|
||||
|
||||
@@ -91,7 +91,8 @@ Data types
|
||||
UV_FS_SYMLINK,
|
||||
UV_FS_READLINK,
|
||||
UV_FS_CHOWN,
|
||||
UV_FS_FCHOWN
|
||||
UV_FS_FCHOWN,
|
||||
UV_FS_REALPATH
|
||||
} uv_fs_type;
|
||||
|
||||
.. c:type:: uv_dirent_t
|
||||
@@ -222,7 +223,7 @@ API
|
||||
.. c:function:: int uv_fs_fstat(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb)
|
||||
.. c:function:: int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
||||
|
||||
Equivalent to :man:`stat(2)`, :man:`fstat(2)` and :man:`fstat(2)` respectively.
|
||||
Equivalent to :man:`stat(2)`, :man:`fstat(2)` and :man:`lstat(2)` respectively.
|
||||
|
||||
.. c:function:: int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb)
|
||||
|
||||
@@ -258,6 +259,12 @@ API
|
||||
|
||||
Equivalent to :man:`utime(2)` and :man:`futime(2)` respectively.
|
||||
|
||||
.. note::
|
||||
AIX: This function only works for AIX 7.1 and newer. It can still be called on older
|
||||
versions but will return ``UV_ENOSYS``.
|
||||
|
||||
.. versionchanged:: 1.10.0 sub-second precission is supported on Windows
|
||||
|
||||
.. c:function:: int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* new_path, uv_fs_cb cb)
|
||||
|
||||
Equivalent to :man:`link(2)`.
|
||||
@@ -281,7 +288,26 @@ API
|
||||
|
||||
.. c:function:: int uv_fs_realpath(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb)
|
||||
|
||||
Equivalent to :man:`realpath(3)` on Unix. Windows uses ``GetFinalPathNameByHandle()``.
|
||||
Equivalent to :man:`realpath(3)` on Unix. Windows uses `GetFinalPathNameByHandle <https://msdn.microsoft.com/en-us/library/windows/desktop/aa364962(v=vs.85).aspx>`_.
|
||||
|
||||
.. warning::
|
||||
This function has certain platform specific caveats that were discovered when used in Node.
|
||||
|
||||
* macOS and other BSDs: this function will fail with UV_ELOOP if more than 32 symlinks are
|
||||
found while resolving the given path. This limit is hardcoded and cannot be sidestepped.
|
||||
* Windows: while this function works in the common case, there are a number of corner cases
|
||||
where it doesn't:
|
||||
|
||||
- Paths in ramdisk volumes created by tools which sidestep the Volume Manager (such as ImDisk)
|
||||
cannot be resolved.
|
||||
- Inconsistent casing when using drive letters.
|
||||
- Resolved path bypasses subst'd drives.
|
||||
|
||||
While this function can still be used, it's not recommended if scenarios such as the
|
||||
above need to be supported.
|
||||
|
||||
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.
|
||||
|
||||
@@ -8,6 +8,20 @@ FS Event handles allow the user to monitor a given path for changes, for example
|
||||
if the file was renamed or there was a generic change in it. This handle uses
|
||||
the best backend for the job on each platform.
|
||||
|
||||
.. note::
|
||||
For AIX, the non default IBM bos.ahafs package has to be installed.
|
||||
The AIX Event Infrastructure file system (ahafs) has some limitations:
|
||||
|
||||
- ahafs tracks monitoring per process and is not thread safe. A separate process
|
||||
must be spawned for each monitor for the same event.
|
||||
- Events for file modification (writing to a file) are not received if only the
|
||||
containing folder is watched.
|
||||
|
||||
See documentation_ for more details.
|
||||
|
||||
.. _documentation: http://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/
|
||||
|
||||
|
||||
|
||||
Data types
|
||||
----------
|
||||
|
||||
@@ -17,6 +17,34 @@ Data types
|
||||
|
||||
The base libuv handle type.
|
||||
|
||||
.. c:type:: uv_handle_type
|
||||
|
||||
The kind of the libuv handle.
|
||||
|
||||
::
|
||||
|
||||
typedef enum {
|
||||
UV_UNKNOWN_HANDLE = 0,
|
||||
UV_ASYNC,
|
||||
UV_CHECK,
|
||||
UV_FS_EVENT,
|
||||
UV_FS_POLL,
|
||||
UV_HANDLE,
|
||||
UV_IDLE,
|
||||
UV_NAMED_PIPE,
|
||||
UV_POLL,
|
||||
UV_PREPARE,
|
||||
UV_PROCESS,
|
||||
UV_STREAM,
|
||||
UV_TCP,
|
||||
UV_TIMER,
|
||||
UV_TTY,
|
||||
UV_UDP,
|
||||
UV_SIGNAL,
|
||||
UV_FILE,
|
||||
UV_HANDLE_TYPE_MAX
|
||||
} uv_handle_type;
|
||||
|
||||
.. c:type:: uv_any_handle
|
||||
|
||||
Union of all handle types.
|
||||
@@ -24,12 +52,28 @@ Data types
|
||||
.. c:type:: void (*uv_alloc_cb)(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf)
|
||||
|
||||
Type definition for callback passed to :c:func:`uv_read_start` and
|
||||
:c:func:`uv_udp_recv_start`. The user must fill the supplied :c:type:`uv_buf_t`
|
||||
structure with whatever size, as long as it's > 0. A suggested size (65536 at the moment)
|
||||
is provided, but it doesn't need to be honored. Setting the buffer's length to 0
|
||||
will trigger a ``UV_ENOBUFS`` error in the :c:type:`uv_udp_recv_cb` or
|
||||
:c:func:`uv_udp_recv_start`. The user must allocate memory and fill the supplied
|
||||
:c:type:`uv_buf_t` structure. If NULL is assigned as the buffer's base or 0 as its length,
|
||||
a ``UV_ENOBUFS`` error will be triggered in the :c:type:`uv_udp_recv_cb` or the
|
||||
:c:type:`uv_read_cb` callback.
|
||||
|
||||
A suggested size (65536 at the moment in most cases) is provided, but it's just an indication,
|
||||
not related in any way to the pending data to be read. The user is free to allocate the amount
|
||||
of memory they decide.
|
||||
|
||||
As an example, applications with custom allocation schemes such as using freelists, allocation
|
||||
pools or slab based allocators may decide to use a different size which matches the memory
|
||||
chunks they already have.
|
||||
|
||||
Example:
|
||||
|
||||
::
|
||||
|
||||
static void my_alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf) {
|
||||
buf->base = malloc(suggested_size);
|
||||
buf->len = suggested_size;
|
||||
}
|
||||
|
||||
.. c:type:: void (*uv_close_cb)(uv_handle_t* handle)
|
||||
|
||||
Type definition for callback passed to :c:func:`uv_close`.
|
||||
@@ -42,6 +86,10 @@ Public members
|
||||
|
||||
Pointer to the :c:type:`uv_loop_t` where the handle is running on. Readonly.
|
||||
|
||||
.. c:member:: uv_loop_t* uv_handle_t.type
|
||||
|
||||
Pointer to the :c:type:`uv_handle_type`. Readonly.
|
||||
|
||||
.. c:member:: void* uv_handle_t.data
|
||||
|
||||
Space for user-defined arbitrary data. libuv does not use this field.
|
||||
|
||||
@@ -17,11 +17,11 @@ Data types
|
||||
|
||||
.. c:member:: char* uv_buf_t.base
|
||||
|
||||
Pointer to the base of the buffer. Readonly.
|
||||
Pointer to the base of the buffer.
|
||||
|
||||
.. c:member:: size_t uv_buf_t.len
|
||||
|
||||
Total bytes in the buffer. Readonly.
|
||||
Total bytes in the buffer.
|
||||
|
||||
.. note::
|
||||
On Windows this field is ULONG.
|
||||
@@ -69,21 +69,24 @@ Data types
|
||||
uv_timeval_t ru_utime; /* user CPU time used */
|
||||
uv_timeval_t ru_stime; /* system CPU time used */
|
||||
uint64_t ru_maxrss; /* maximum resident set size */
|
||||
uint64_t ru_ixrss; /* integral shared memory size */
|
||||
uint64_t ru_idrss; /* integral unshared data size */
|
||||
uint64_t ru_isrss; /* integral unshared stack size */
|
||||
uint64_t ru_minflt; /* page reclaims (soft page faults) */
|
||||
uint64_t ru_ixrss; /* integral shared memory size (X) */
|
||||
uint64_t ru_idrss; /* integral unshared data size (X) */
|
||||
uint64_t ru_isrss; /* integral unshared stack size (X) */
|
||||
uint64_t ru_minflt; /* page reclaims (soft page faults) (X) */
|
||||
uint64_t ru_majflt; /* page faults (hard page faults) */
|
||||
uint64_t ru_nswap; /* swaps */
|
||||
uint64_t ru_nswap; /* swaps (X) */
|
||||
uint64_t ru_inblock; /* block input operations */
|
||||
uint64_t ru_oublock; /* block output operations */
|
||||
uint64_t ru_msgsnd; /* IPC messages sent */
|
||||
uint64_t ru_msgrcv; /* IPC messages received */
|
||||
uint64_t ru_nsignals; /* signals received */
|
||||
uint64_t ru_nvcsw; /* voluntary context switches */
|
||||
uint64_t ru_nivcsw; /* involuntary context switches */
|
||||
uint64_t ru_msgsnd; /* IPC messages sent (X) */
|
||||
uint64_t ru_msgrcv; /* IPC messages received (X) */
|
||||
uint64_t ru_nsignals; /* signals received (X) */
|
||||
uint64_t ru_nvcsw; /* voluntary context switches (X) */
|
||||
uint64_t ru_nivcsw; /* involuntary context switches (X) */
|
||||
} uv_rusage_t;
|
||||
|
||||
Members marked with `(X)` are unsupported on Windows.
|
||||
See :man:`getrusage(2)` for supported fields on Unix
|
||||
|
||||
.. c:type:: uv_cpu_info_t
|
||||
|
||||
Data type for CPU information.
|
||||
@@ -183,11 +186,17 @@ API
|
||||
|
||||
.. c:function:: int uv_get_process_title(char* buffer, size_t size)
|
||||
|
||||
Gets the title of the current process.
|
||||
Gets the title of the current process. If `buffer` is `NULL` or `size` is
|
||||
zero, `UV_EINVAL` is returned. If `size` cannot accommodate the process
|
||||
title and terminating `NULL` character, the function returns `UV_ENOBUFS`.
|
||||
|
||||
.. c:function:: int uv_set_process_title(const char* title)
|
||||
|
||||
Sets the current process title.
|
||||
Sets the current process title. On platforms with a fixed size buffer for the
|
||||
process title the contents of `title` will be copied to the buffer and
|
||||
truncated if larger than the available space. Other platforms will return
|
||||
`UV_ENOMEM` if they cannot allocate enough space to duplicate the contents of
|
||||
`title`.
|
||||
|
||||
.. c:function:: int uv_resident_set_memory(size_t* rss)
|
||||
|
||||
@@ -203,6 +212,7 @@ API
|
||||
|
||||
.. note::
|
||||
On Windows not all fields are set, the unsupported fields are filled with zeroes.
|
||||
See :c:type:`uv_rusage_t` for more details.
|
||||
|
||||
.. c:function:: int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count)
|
||||
|
||||
|
||||
@@ -26,7 +26,11 @@ Data types
|
||||
|
||||
.. c:type:: uv_write_t
|
||||
|
||||
Write request type.
|
||||
Write request type. Careful attention must be paid when reusing objects of
|
||||
this type. When a stream is in non-blocking mode, write requests sent
|
||||
with ``uv_write`` will be queued. Reusing objects at this point is undefined
|
||||
behaviour. It is safe to reuse the ``uv_write_t`` object only after the
|
||||
callback passed to ``uv_write`` is fired.
|
||||
|
||||
.. c:type:: void (*uv_read_cb)(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf)
|
||||
|
||||
@@ -61,7 +65,7 @@ Data types
|
||||
|
||||
.. c:type:: void (*uv_shutdown_cb)(uv_shutdown_t* req, int status)
|
||||
|
||||
Callback called after s shutdown request has been completed. `status` will
|
||||
Callback called after a shutdown request has been completed. `status` will
|
||||
be 0 in case of success, < 0 otherwise.
|
||||
|
||||
.. c:type:: void (*uv_connection_cb)(uv_stream_t* server, int status)
|
||||
@@ -92,7 +96,7 @@ Public members
|
||||
|
||||
.. c:member:: uv_stream_t* uv_write_t.send_handle
|
||||
|
||||
Pointer to the stream being sent using this write request..
|
||||
Pointer to the stream being sent using this write request.
|
||||
|
||||
.. seealso:: The :c:type:`uv_handle_t` members also apply.
|
||||
|
||||
@@ -169,6 +173,10 @@ API
|
||||
uv_write(&req1, stream, a, 2, cb);
|
||||
uv_write(&req2, stream, b, 2, cb);
|
||||
|
||||
.. note::
|
||||
The memory pointed to by the buffers must remain valid until the callback gets called.
|
||||
This also holds for :c:func:`uv_write2`.
|
||||
|
||||
.. c:function:: int uv_write2(uv_write_t* req, uv_stream_t* handle, const uv_buf_t bufs[], unsigned int nbufs, uv_stream_t* send_handle, uv_write_cb cb)
|
||||
|
||||
Extended write function for sending handles over a pipe. The pipe must be
|
||||
|
||||
@@ -53,7 +53,7 @@ API
|
||||
|
||||
.. c:function:: int uv_tcp_nodelay(uv_tcp_t* handle, int enable)
|
||||
|
||||
Enable / disable Nagle's algorithm.
|
||||
Enable `TCP_NODELAY`, which disables Nagle's algorithm.
|
||||
|
||||
.. c:function:: int uv_tcp_keepalive(uv_tcp_t* handle, int enable, unsigned int delay)
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ API
|
||||
If `repeat` is non-zero, the callback fires first after `timeout`
|
||||
milliseconds and then repeatedly after `repeat` milliseconds.
|
||||
|
||||
.. note::
|
||||
Does not update the event loop's concept of "now". See :c:func:`uv_update_time` for more information.
|
||||
|
||||
.. c:function:: int uv_timer_stop(uv_timer_t* handle)
|
||||
|
||||
Stop the timer, the callback will not be called anymore.
|
||||
|
||||
Reference in New Issue
Block a user