Skip to content

Commit 2bc9469

Browse files
committed
Merge remote-tracking branch 'upstream/v1.x' into v1.x
2 parents 9287127 + 3e9ae1b commit 2bc9469

File tree

20 files changed

+390
-295
lines changed

20 files changed

+390
-295
lines changed

.github/workflows/CI-unix.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
strategy:
8181
fail-fast: false
8282
matrix:
83-
os: [macos-13, macos-14]
83+
os: [macos-14, macos-15, macos-15-intel]
8484
steps:
8585
- uses: actions/checkout@v6
8686
- name: Envinfo
@@ -107,6 +107,11 @@ jobs:
107107
run: |
108108
./build/uv_run_tests_a platform_output
109109
- name: Test
110+
if: ${{ matrix.os == 'macos-15' || matrix.os == 'macos-15-intel' }}
111+
run: |
112+
cd build && sudo UV_RUN_AS_ROOT=1 ctest -V
113+
- name: Test
114+
if: ${{ matrix.os != 'macos-15' && matrix.os != 'macos-15-intel' }}
110115
run: |
111116
cd build && ctest -V
112117
- name: Autotools configure
@@ -122,7 +127,7 @@ jobs:
122127
strategy:
123128
fail-fast: false
124129
matrix:
125-
os: [macos-13, macos-14]
130+
os: [macos-14, macos-15]
126131
steps:
127132
- uses: actions/checkout@v6
128133
- name: Configure

.github/workflows/CI-win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
`${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libatomic-1.dll` \
9898
build/usr/bin
9999
- name: Upload build artifacts
100-
uses: actions/upload-artifact@v5
100+
uses: actions/upload-artifact@v6
101101
with:
102102
name: mingw-${{ matrix.config.arch }}
103103
path: build/usr/**/*
@@ -115,7 +115,7 @@ jobs:
115115
- {arch: x86_64, server: 2022}
116116
steps:
117117
- name: Download build artifacts
118-
uses: actions/download-artifact@v6
118+
uses: actions/download-artifact@v7
119119
with:
120120
name: mingw-${{ matrix.config.arch }}
121121
- name: Test

.github/workflows/sanitizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
fi
5656
5757
sanitizers-macos:
58-
runs-on: macos-13
58+
runs-on: macos-14
5959
strategy:
6060
matrix:
6161
config:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ $ cmake ../.. \
215215
$ brew install --HEAD libuv
216216
```
217217

218-
Note to OS X users:
218+
Note to macOS users:
219219

220220
Make sure that you specify the architecture you wish to build for in the
221221
"ARCHS" flag. You can specify more than one by delimiting with a space

docs/src/design.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,31 @@ Requests represent (typically) short-lived operations. These operations can be p
3636
handle: write requests are used to write data on a handle; or standalone: getaddrinfo requests
3737
don't need a handle they run directly on the loop.
3838

39+
Guidelines for dealing with handles and requests:
40+
41+
1. If `uv_foo_init()` succeeds in initializing the handle, you must call
42+
:c:func:`uv_close()`. If the handle's init function errors, you don't
43+
need to do anything.
44+
45+
2. Only handles are closed, not requests. For example, :c:type:`uv_tcp_t`
46+
is a handle, :c:type:`uv_write_t` is a request.
47+
48+
3. The handle's memory can only be reclaimed or reused from inside the
49+
:c:type:`uv_close_cb` or afterwards, not before.
50+
51+
4. Most handles have init + start/stop functions; some handles don't.
52+
Example: :c:type:`uv_tcp_t` vs. :c:type:`uv_process_t`; :c:func:`uv_spawn()`
53+
combines handle initialization and process start into one.
54+
55+
5. Requests are closed automatically when they complete, or when they are
56+
cancelled with :c:func:`uv_cancel()`.
57+
58+
6. No additional cleanup is needed except for :c:type:`uv_fs_t` and
59+
:c:type:`uv_getaddrinfo_t` requests. For :c:type:`uv_fs_t`, call
60+
:c:func:`uv_fs_req_cleanup()` once you are done with it; for
61+
:c:type:`uv_getaddrinfo_t`, that's :c:func:`uv_freeaddrinfo()`.
62+
63+
7. The request's memory can only be reclaimed or reused from that point onward.
3964

4065
The I/O loop
4166
^^^^^^^^^^^^

docs/src/misc.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,16 @@ API
892892
893893
.. versionadded:: 1.34.0
894894
895+
.. code-block:: c
896+
#include <uv.h>
897+
#include <stdio.h>
898+
int main() {
899+
printf("Sleeping for 1 second...\n");
900+
uv_sleep(1000);
901+
printf("Awake!\n");
902+
return 0;
903+
}
904+
895905
String manipulation functions
896906
-----------------------------
897907

src/unix/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ int uv_os_environ(uv_env_item_t** envitems, int* count) {
15331533

15341534
fail:
15351535
for (i = 0; i < cnt; i++) {
1536-
envitem = &(*envitems)[cnt];
1536+
envitem = &(*envitems)[i];
15371537
uv__free(envitem->name);
15381538
}
15391539
uv__free(*envitems);

src/unix/fs.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,6 @@ static struct timespec uv__fs_to_timespec(double time) {
224224
ts.tv_sec = time;
225225
ts.tv_nsec = (time - ts.tv_sec) * 1e9;
226226

227-
/* TODO(bnoordhuis) Remove this. utimesat() has nanosecond resolution but we
228-
* stick to microsecond resolution for the sake of consistency with other
229-
* platforms. I'm the original author of this compatibility hack but I'm
230-
* less convinced it's useful nowadays.
231-
*/
232-
ts.tv_nsec -= ts.tv_nsec % 1000;
233-
234227
if (ts.tv_nsec < 0) {
235228
ts.tv_nsec += 1e9;
236229
ts.tv_sec -= 1;

src/unix/linux.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ int uv__iou_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req) {
875875
return 0;
876876

877877
sqe->fd = req->file;
878-
sqe->len = req->off;
878+
sqe->off = req->off;
879879
sqe->opcode = UV__IORING_OP_FTRUNCATE;
880880
uv__iou_submit(iou);
881881

src/unix/process.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,7 @@ int uv_spawn(uv_loop_t* loop,
10731073
return exec_errorno;
10741074

10751075
error:
1076+
uv__queue_remove(&process->handle_queue);
10761077
if (pipes != NULL) {
10771078
for (i = 0; i < stdio_count; i++) {
10781079
if (i < options->stdio_count)

0 commit comments

Comments
 (0)