aboutsummaryrefslogtreecommitdiff
path: root/src/unix/internal.h
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2023-04-18 12:32:08 +0200
committerGitHub <noreply@github.com>2023-04-18 12:32:08 +0200
commitd2c31f429b87b476a7f1344d145dad4752a406d4 (patch)
tree1fe1a600c7f93871a2b57a3fe6d7ef26e2494e6b /src/unix/internal.h
parentcb5da592268551592f86b291652193f23270a8cb (diff)
downloadlibuv-d2c31f429b87b476a7f1344d145dad4752a406d4.tar.gz
libuv-d2c31f429b87b476a7f1344d145dad4752a406d4.zip
linux: introduce io_uring support (#3952)
Add io_uring support for several asynchronous file operations: - read, write - fsync, fdatasync - stat, fstat, lstat io_uring is used when the kernel is new enough, otherwise libuv simply falls back to the thread pool. Performance looks great; an 8x increase in throughput has been observed. This work was sponsored by ISC, the Internet Systems Consortium. Fixes: https://github.com/libuv/libuv/issues/1947
Diffstat (limited to 'src/unix/internal.h')
-rw-r--r--src/unix/internal.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/unix/internal.h b/src/unix/internal.h
index d439ae6d..08d2d1ce 100644
--- a/src/unix/internal.h
+++ b/src/unix/internal.h
@@ -329,6 +329,24 @@ int uv__random_getentropy(void* buf, size_t buflen);
int uv__random_readpath(const char* path, void* buf, size_t buflen);
int uv__random_sysctl(void* buf, size_t buflen);
+/* io_uring */
+#ifdef __linux__
+int uv__iou_fs_fsync_or_fdatasync(uv_loop_t* loop,
+ uv_fs_t* req,
+ uint32_t fsync_flags);
+int uv__iou_fs_read_or_write(uv_loop_t* loop,
+ uv_fs_t* req,
+ int is_read);
+int uv__iou_fs_statx(uv_loop_t* loop,
+ uv_fs_t* req,
+ int is_fstat,
+ int is_lstat);
+#else
+#define uv__iou_fs_fsync_or_fdatasync(loop, req, fsync_flags) 0
+#define uv__iou_fs_read_or_write(loop, req, is_read) 0
+#define uv__iou_fs_statx(loop, req, is_fstat, is_lstat) 0
+#endif
+
#if defined(__APPLE__)
int uv___stream_fd(const uv_stream_t* handle);
#define uv__stream_fd(handle) (uv___stream_fd((const uv_stream_t*) (handle)))
@@ -405,6 +423,7 @@ int uv__statx(int dirfd,
int flags,
unsigned int mask,
struct uv__statx* statxbuf);
+void uv__statx_to_stat(const struct uv__statx* statxbuf, uv_stat_t* buf);
ssize_t uv__getrandom(void* buf, size_t buflen, unsigned flags);
#endif