aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/bits/linux.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-10-29 18:20:38 -0400
committerGitHub <noreply@github.com>2020-10-29 18:20:38 -0400
commita41c0b63bbf313a0c473f526c391ee3c51d5b4e0 (patch)
tree49b0cf1a46dc7e2a73eaef803a4e3b97c9c18e9d /lib/std/os/bits/linux.zig
parentf51ccf0d1f015c0f3bf8c9bebce65665e557c7de (diff)
parente9ba12f456f37ec1f59a680cd9bf107e8e84e7b7 (diff)
downloadzig-a41c0b63bbf313a0c473f526c391ee3c51d5b4e0.tar.gz
zig-a41c0b63bbf313a0c473f526c391ee3c51d5b4e0.zip
Merge pull request #6356 from jorangreef/io_uring
std: add io_uring library
Diffstat (limited to 'lib/std/os/bits/linux.zig')
-rw-r--r--lib/std/os/bits/linux.zig58
1 files changed, 21 insertions, 37 deletions
diff --git a/lib/std/os/bits/linux.zig b/lib/std/os/bits/linux.zig
index 19cc3be775..8dbf21fcf2 100644
--- a/lib/std/os/bits/linux.zig
+++ b/lib/std/os/bits/linux.zig
@@ -1200,6 +1200,8 @@ pub const IORING_FEAT_NODROP = 1 << 1;
pub const IORING_FEAT_SUBMIT_STABLE = 1 << 2;
pub const IORING_FEAT_RW_CUR_POS = 1 << 3;
pub const IORING_FEAT_CUR_PERSONALITY = 1 << 4;
+pub const IORING_FEAT_FAST_POLL = 1 << 5;
+pub const IORING_FEAT_POLL_32BITS = 1 << 6;
// io_uring_params.flags
@@ -1252,6 +1254,9 @@ pub const io_sqring_offsets = extern struct {
/// needs io_uring_enter wakeup
pub const IORING_SQ_NEED_WAKEUP = 1 << 0;
+/// kernel has cqes waiting beyond the cq ring
+pub const IORING_SQ_CQ_OVERFLOW = 1 << 1;
+
pub const io_cqring_offsets = extern struct {
head: u32,
tail: u32,
@@ -1263,48 +1268,19 @@ pub const io_cqring_offsets = extern struct {
};
pub const io_uring_sqe = extern struct {
- pub const union1 = extern union {
- off: u64,
- addr2: u64,
- };
-
- pub const union2 = extern union {
- rw_flags: kernel_rwf,
- fsync_flags: u32,
- poll_events: u16,
- sync_range_flags: u32,
- msg_flags: u32,
- timeout_flags: u32,
- accept_flags: u32,
- cancel_flags: u32,
- open_flags: u32,
- statx_flags: u32,
- fadvise_flags: u32,
- };
-
- pub const union3 = extern union {
- struct1: extern struct {
- /// index into fixed buffers, if used
- buf_index: u16,
-
- /// personality to use, if used
- personality: u16,
- },
- __pad2: [3]u64,
- };
opcode: IORING_OP,
flags: u8,
ioprio: u16,
fd: i32,
-
- union1: union1,
+ off: u64,
addr: u64,
len: u32,
-
- union2: union2,
+ rw_flags: u32,
user_data: u64,
-
- union3: union3,
+ buf_index: u16,
+ personality: u16,
+ splice_fd_in: i32,
+ __pad2: [2]u64
};
pub const IOSQE_BIT = extern enum(u8) {
@@ -1313,7 +1289,8 @@ pub const IOSQE_BIT = extern enum(u8) {
IO_LINK,
IO_HARDLINK,
ASYNC,
-
+ BUFFER_SELECT,
+
_,
};
@@ -1332,7 +1309,10 @@ pub const IOSQE_IO_LINK = 1 << @enumToInt(IOSQE_BIT.IO_LINK);
pub const IOSQE_IO_HARDLINK = 1 << @enumToInt(IOSQE_BIT.IO_HARDLINK);
/// always go async
-pub const IOSQE_ASYNC = 1 << IOSQE_BIT.ASYNC;
+pub const IOSQE_ASYNC = 1 << @enumToInt(IOSQE_BIT.ASYNC);
+
+/// select buffer from buf_group
+pub const IOSQE_BUFFER_SELECT = 1 << @enumToInt(IOSQE_BIT.BUFFER_SELECT);
pub const IORING_OP = extern enum(u8) {
NOP,
@@ -1365,6 +1345,10 @@ pub const IORING_OP = extern enum(u8) {
RECV,
OPENAT2,
EPOLL_CTL,
+ SPLICE,
+ PROVIDE_BUFFERS,
+ REMOVE_BUFFERS,
+ TEE,
_,
};