diff --git a/src/unix/fs.c b/src/unix/fs.c index 9671f0dda12..3a74350f0e5 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -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, diff --git a/src/unix/internal.h b/src/unix/internal.h index fe588513603..bcb3be577e5 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -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, diff --git a/src/unix/kqueue.c b/src/unix/kqueue.c index d7aa60e77ce..4d09edc06a0 100644 --- a/src/unix/kqueue.c +++ b/src/unix/kqueue.c @@ -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); } diff --git a/src/unix/linux.c b/src/unix/linux.c index 7402a6fae07..3c1313e7efc 100644 --- a/src/unix/linux.c +++ b/src/unix/linux.c @@ -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;