Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/v1.x' into v1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechsTech committed Aug 27, 2024
2 parents ec8b611 + 5cbc82e commit 495c403
Show file tree
Hide file tree
Showing 40 changed files with 606 additions and 289 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/CI-win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
run:
cmake -S . -B build -DBUILD_TESTING=ON
-G "${{ matrix.config.toolchain }}" -A ${{ matrix.config.arch }}
${{ matrix.config.config == 'ASAN' && '-DASAN=on -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' ||
matrix.config.config == 'UBSAN' && '-DUBSAN=on' || '' }}
${{ matrix.config.config == 'ASAN' && '-DASAN=on -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded' || '' }}

cmake --build build --config RelWithDebInfo

Expand Down
17 changes: 11 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,20 @@ if(TSAN)
endif()

if(UBSAN)
cmake_minimum_required(VERSION 3.13)
list(APPEND uv_defines __UBSAN__=1)
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang|GNU|Clang")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-omit-frame-pointer -fsanitize=undefined")
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=undefined")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=undefined")
elseif(MSVC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=undefined")
add_compile_options("-fsanitize=undefined" "-fno-sanitize-recover=undefined")
if (NOT WIN32)
add_link_options("-fsanitize=undefined")
endif()
if(MSVC)
add_compile_options("/Oy-")
else()
add_compile_options("-fno-omit-frame-pointer")
endif()
else()
message(SEND_ERROR "UndefinedBehaviorSanitizer support requires clang, gcc, or msvc. Try again with -DCMAKE_C_COMPILER.")
message(SEND_ERROR "UndefinedBehaviorSanitizer support requires clang or gcc. Try again with -DCMAKE_C_COMPILER.")
endif()
endif()

Expand Down
18 changes: 14 additions & 4 deletions docs/src/fs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ 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.
kernel features are unavailable or unsuitable. Starting with libuv v1.49.0 this
behavior was reverted and Libuv on Linux by default will be using the threadpool
again. In order to enable io_uring the :c:type:`uv_loop_t` instance must be
configured with the :c:type:`UV_LOOP_ENABLE_IO_URING_SQPOLL` option.

.. note::
On Windows `uv_fs_*` functions use utf-8 encoding.
Expand Down Expand Up @@ -129,10 +132,9 @@ Data types
uint64_t f_spare[4];
} uv_statfs_t;

.. c:enum:: uv_dirent_t
.. c:enum:: uv_dirent_type_t
Cross platform (reduced) equivalent of ``struct dirent``.
Used in :c:func:`uv_fs_scandir_next`.
Type of dirent.

::

Expand All @@ -147,6 +149,14 @@ Data types
UV_DIRENT_BLOCK
} uv_dirent_type_t;


.. c:type:: uv_dirent_t
Cross platform (reduced) equivalent of ``struct dirent``.
Used in :c:func:`uv_fs_scandir_next`.

::

typedef struct uv_dirent_s {
const char* name;
uv_dirent_type_t type;
Expand Down
11 changes: 7 additions & 4 deletions docs/src/fs_event.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ Data types
be a relative path to a file contained in the directory, or `NULL` if the
file name cannot be determined.

The `events` parameter is an ORed mask of :c:type:`uv_fs_event` elements.
The `events` parameter is an ORed mask of :c:enum:`uv_fs_event` elements.

.. c:type:: uv_fs_event
.. c:enum:: uv_fs_event
Event types that :c:type:`uv_fs_event_t` handles monitor.

Expand All @@ -58,7 +58,7 @@ Data types
UV_CHANGE = 2
};

.. c:type:: uv_fs_event_flags
.. c:enum:: uv_fs_event_flags
Flags that can be passed to :c:func:`uv_fs_event_start` to control its
behavior.
Expand Down Expand Up @@ -109,10 +109,13 @@ API
.. c:function:: int uv_fs_event_start(uv_fs_event_t* handle, uv_fs_event_cb cb, const char* path, unsigned int flags)
Start the handle with the given callback, which will watch the specified
`path` for changes. `flags` can be an ORed mask of :c:type:`uv_fs_event_flags`.
`path` for changes. `flags` can be an ORed mask of :c:enum:`uv_fs_event_flags`.
.. note:: Currently the only supported flag is ``UV_FS_EVENT_RECURSIVE`` and
only on OSX and Windows.
.. note:: On macOS, events collected by the OS immediately before calling
``uv_fs_event_start`` might be reported to the `uv_fs_event_cb`
callback.
.. c:function:: int uv_fs_event_stop(uv_fs_event_t* handle)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/handle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Public members

.. c:member:: uv_handle_type uv_handle_t.type
The :c:type:`uv_handle_type`, indicating the type of the underlying handle. Readonly.
The :c:enum:`uv_handle_type`, indicating the type of the underlying handle. Readonly.

.. c:member:: void* uv_handle_t.data
Expand Down Expand Up @@ -248,7 +248,7 @@ just for some handle types.
.. versionadded:: 1.19.0
.. c:function:: void* uv_handle_set_data(uv_handle_t* handle, void* data)
.. c:function:: void uv_handle_set_data(uv_handle_t* handle, void* data)
Sets `handle->data` to `data`.
Expand Down
20 changes: 19 additions & 1 deletion docs/src/loop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ Data types
Loop data type.

.. c:enum:: uv_loop_option
Additional loop options.
See :c:func:`uv_loop_configure`.

::

typedef enum {
UV_LOOP_BLOCK_SIGNAL = 0,
UV_METRICS_IDLE_TIME,
UV_LOOP_USE_IO_URING_SQPOLL
} uv_loop_option;

.. c:enum:: uv_run_mode
Mode used to run the loop with :c:func:`uv_run`.
Expand Down Expand Up @@ -73,8 +86,13 @@ API

This option is necessary to use :c:func:`uv_metrics_idle_time`.

- UV_LOOP_ENABLE_IO_URING_SQPOLL: Enable SQPOLL io_uring instance to handle
asynchronous file system operations.

.. versionchanged:: 1.39.0 added the UV_METRICS_IDLE_TIME option.

.. versionchanged:: 1.49.0 added the UV_LOOP_ENABLE_IO_URING_SQPOLL option.

.. c:function:: int uv_loop_close(uv_loop_t* loop)
Releases all internal loop resources. Call this function only when the loop
Expand Down Expand Up @@ -238,7 +256,7 @@ API
.. versionadded:: 1.19.0
.. c:function:: void* uv_loop_set_data(uv_loop_t* loop, void* data)
.. c:function:: void uv_loop_set_data(uv_loop_t* loop, void* data)
Sets `loop->data` to `data`.
Expand Down
6 changes: 3 additions & 3 deletions docs/src/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ Data types
char* homedir;
} uv_passwd_t;

.. c:type:: uv_group_s
.. c:type:: uv_group_t
Data type for group file information.

Expand All @@ -209,7 +209,7 @@ Data types
char* groupname;
unsigned long gid;
char** members;
};
} uv_group_t;

.. c:type:: uv_utsname_t
Expand Down Expand Up @@ -590,7 +590,7 @@ API
.. versionadded:: 1.45.0
.. c:function:: int uv_os_get_group(uv_group_s* group, uv_uid_t gid)
.. c:function:: int uv_os_get_group(uv_group_t* group, uv_uid_t gid)
Gets a subset of the group file entry for the provided uid.
The populated data includes the group name, gid, and members. On non-Windows
Expand Down
2 changes: 1 addition & 1 deletion docs/src/poll.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Data types
Type definition for callback passed to :c:func:`uv_poll_start`.

.. c:type:: uv_poll_event
.. c:enum:: uv_poll_event
Poll event types

Expand Down
6 changes: 3 additions & 3 deletions docs/src/process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Data types
will indicate the exit status and the signal that caused the process to
terminate, if any.

.. c:type:: uv_process_flags
.. c:enum:: uv_process_flags
Flags to be set on the flags field of :c:type:`uv_process_options_t`.

Expand Down Expand Up @@ -190,7 +190,7 @@ Public members
Command line arguments. args[0] should be the path to the program. On
Windows this uses `CreateProcess` which concatenates the arguments into a
string this can cause some strange errors. See the
``UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS`` flag on :c:type:`uv_process_flags`.
``UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS`` flag on :c:enum:`uv_process_flags`.

.. c:member:: char** uv_process_options_t.env
Expand All @@ -203,7 +203,7 @@ Public members
.. c:member:: unsigned int uv_process_options_t.flags
Various flags that control how :c:func:`uv_spawn` behaves. See
:c:type:`uv_process_flags`.
:c:enum:`uv_process_flags`.

.. c:member:: int uv_process_options_t.stdio_count
.. c:member:: uv_stdio_container_t* uv_process_options_t.stdio
Expand Down
26 changes: 15 additions & 11 deletions docs/src/request.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,9 @@ Data types
Union of all request types.

.. c:enum:: uv_req_type
Public members
^^^^^^^^^^^^^^

.. c:member:: void* uv_req_t.data
Space for user-defined arbitrary data. libuv does not use this field.

.. c:member:: uv_req_type uv_req_t.type
Indicated the type of request. Readonly.
The kind of the libuv request.

::

Expand All @@ -50,6 +42,18 @@ Public members
} uv_req_type;


Public members
^^^^^^^^^^^^^^

.. c:member:: void* uv_req_t.data
Space for user-defined arbitrary data. libuv does not use this field.

.. c:member:: uv_req_type uv_req_t.type
The :c:enum:`uv_req_type`, indicating the type of the request. Readonly.


API
---

Expand Down Expand Up @@ -95,7 +99,7 @@ API
.. versionadded:: 1.19.0
.. c:function:: void* uv_req_set_data(uv_req_t* req, void* data)
.. c:function:: void uv_req_set_data(uv_req_t* req, void* data)
Sets `req->data` to `data`.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Data types
TCP handle type.

.. c:type:: uv_tcp_flags
.. c:enum:: uv_tcp_flags
Flags used in :c:func:`uv_tcp_bind`.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/tty.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ API
.. c:function:: int uv_tty_set_mode(uv_tty_t* handle, uv_tty_mode_t mode)
.. versionchanged:: 1.2.0: the mode is specified as a
:c:type:`uv_tty_mode_t` value.
:c:enum:`uv_tty_mode_t` value.
Set the TTY using the specified terminal mode.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/udp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Data types
UDP send request type.

.. c:type:: uv_udp_flags
.. c:enum:: uv_udp_flags
Flags used in :c:func:`uv_udp_bind` and :c:type:`uv_udp_recv_cb`..

Expand Down
4 changes: 3 additions & 1 deletion include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ typedef struct uv_metrics_s uv_metrics_t;

typedef enum {
UV_LOOP_BLOCK_SIGNAL = 0,
UV_METRICS_IDLE_TIME
UV_METRICS_IDLE_TIME,
UV_LOOP_USE_IO_URING_SQPOLL
#define UV_LOOP_USE_IO_URING_SQPOLL UV_LOOP_USE_IO_URING_SQPOLL
} uv_loop_option;

typedef enum {
Expand Down
4 changes: 2 additions & 2 deletions include/uv/tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ name##_RB_MINMAX(struct name *head, int val) \
#define RB_REMOVE(name, x, y) name##_RB_REMOVE(x, y)
#define RB_FIND(name, x, y) name##_RB_FIND(x, y)
#define RB_NFIND(name, x, y) name##_RB_NFIND(x, y)
#define RB_NEXT(name, x, y) name##_RB_NEXT(y)
#define RB_PREV(name, x, y) name##_RB_PREV(y)
#define RB_NEXT(name, x) name##_RB_NEXT(x)
#define RB_PREV(name, x) name##_RB_PREV(x)
#define RB_MIN(name, x) name##_RB_MINMAX(x, RB_NEGINF)
#define RB_MAX(name, x) name##_RB_MINMAX(x, RB_INF)

Expand Down
Loading

0 comments on commit 495c403

Please sign in to comment.