diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2024-09-30 21:55:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-30 21:55:34 +0200 |
commit | f806be87d3276fc9f672dbf43753a3c44dc26228 (patch) | |
tree | 979e520fc911c071d3b8d278af12f9c98f923856 /src/unix/internal.h | |
parent | bcc6d1c1fce27de9d6d34cc21d37f7c3e5b9d40d (diff) | |
download | libuv-f806be87d3276fc9f672dbf43753a3c44dc26228.tar.gz libuv-f806be87d3276fc9f672dbf43753a3c44dc26228.zip |
linux: use IORING_OP_FTRUNCATE when available (#4554)
Route ftruncate() system calls through io_uring instead of the thread
pool when the kernel is new enough to support it (linux >= 6.9).
This commit harmonizes how libuv checks if the kernel is new enough.
Some ops were checking against `uv__kernel_version()` directly while
others stored the result of the version check as a feature flag.
Because the kernel version is cached, and because it is more direct
than a feature flag, I opted for the former approach.
Diffstat (limited to 'src/unix/internal.h')
-rw-r--r-- | src/unix/internal.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/unix/internal.h b/src/unix/internal.h index 529c783e..138685c9 100644 --- a/src/unix/internal.h +++ b/src/unix/internal.h @@ -344,6 +344,7 @@ int uv__random_sysctl(void* buf, size_t buflen); /* io_uring */ #ifdef __linux__ int uv__iou_fs_close(uv_loop_t* loop, uv_fs_t* req); +int uv__iou_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req); int uv__iou_fs_fsync_or_fdatasync(uv_loop_t* loop, uv_fs_t* req, uint32_t fsync_flags); @@ -362,6 +363,7 @@ int uv__iou_fs_symlink(uv_loop_t* loop, uv_fs_t* req); int uv__iou_fs_unlink(uv_loop_t* loop, uv_fs_t* req); #else #define uv__iou_fs_close(loop, req) 0 +#define uv__iou_fs_ftruncate(loop, req) 0 #define uv__iou_fs_fsync_or_fdatasync(loop, req, fsync_flags) 0 #define uv__iou_fs_link(loop, req) 0 #define uv__iou_fs_mkdir(loop, req) 0 |