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 Jan 9, 2024
2 parents 9a3dfbc + a407b23 commit 15a3bc5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/unix/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,16 @@ static void uv__fs_done(struct uv__work* w, int status) {
}


void uv__fs_post(uv_loop_t* loop, uv_fs_t* req) {
uv__req_register(loop, req);
uv__work_submit(loop,
&req->work_req,
UV__WORK_FAST_IO,
uv__fs_work,
uv__fs_done);
}


int uv_fs_access(uv_loop_t* loop,
uv_fs_t* req,
const char* path,
Expand Down
1 change: 1 addition & 0 deletions src/unix/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ UV_UNUSED(static int uv__stat(const char* path, struct stat* s)) {
}

#if defined(__linux__)
void uv__fs_post(uv_loop_t* loop, uv_fs_t* req);
ssize_t
uv__fs_copy_file_range(int fd_in,
off_t* off_in,
Expand Down
8 changes: 7 additions & 1 deletion src/unix/kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,13 @@ static void uv__fs_event(uv_loop_t* loop, uv__io_t* w, unsigned int fflags) {

if (handle->event_watcher.fd != -1 &&
(!uv__fstat(handle->event_watcher.fd, &statbuf) && !(statbuf.st_mode & S_IFDIR))) {
kf.kf_structsize = KINFO_FILE_SIZE;
/* we are purposely not using KINFO_FILE_SIZE here
* as it is not available on non intl archs
* and here it gives 1392 too on intel.
* anyway, the man page also mentions we can proceed
* this way.
*/
kf.kf_structsize = sizeof(kf);
if (fcntl(handle->event_watcher.fd, F_KINFO, &kf) == 0)
path = uv__basename_r(kf.kf_path);
}
Expand Down
6 changes: 6 additions & 0 deletions src/unix/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,12 @@ static void uv__poll_io_uring(uv_loop_t* loop, struct uv__iou* iou) {
uv__req_unregister(loop, req);
iou->in_flight--;

/* If the op is not supported by the kernel retry using the thread pool */
if (e->res == -EOPNOTSUPP) {
uv__fs_post(loop, req);
continue;
}

/* io_uring stores error codes as negative numbers, same as libuv. */
req->result = e->res;

Expand Down

0 comments on commit 15a3bc5

Please sign in to comment.