Commit 3dd8396a55
Changed files (2)
lib
std
os
bits
linux
lib/std/os/bits/linux.zig
@@ -2244,3 +2244,8 @@ pub const MADV_COLD = 20;
pub const MADV_PAGEOUT = 21;
pub const MADV_HWPOISON = 100;
pub const MADV_SOFT_OFFLINE = 101;
+
+pub const __kernel_timespec = extern struct {
+ tv_sec: i64,
+ tv_nsec: i64,
+};
lib/std/os/linux/io_uring.zig
@@ -526,7 +526,7 @@ pub const IO_Uring = struct {
pub fn timeout(
self: *IO_Uring,
user_data: u64,
- ts: *const os.timespec,
+ ts: *const os.__kernel_timespec,
count: u32,
flags: u32,
) !*io_uring_sqe {
@@ -884,7 +884,7 @@ pub fn io_uring_prep_close(sqe: *io_uring_sqe, fd: os.fd_t) void {
pub fn io_uring_prep_timeout(
sqe: *io_uring_sqe,
- ts: *const os.timespec,
+ ts: *const os.__kernel_timespec,
count: u32,
flags: u32,
) void {
@@ -1339,7 +1339,7 @@ test "timeout (after a relative time)" {
const ms = 10;
const margin = 5;
- const ts = os.timespec{ .tv_sec = 0, .tv_nsec = ms * 1000000 };
+ const ts = os.__kernel_timespec{ .tv_sec = 0, .tv_nsec = ms * 1000000 };
const started = std.time.milliTimestamp();
const sqe = try ring.timeout(0x55555555, &ts, 0, 0);
@@ -1366,7 +1366,7 @@ test "timeout (after a number of completions)" {
};
defer ring.deinit();
- const ts = os.timespec{ .tv_sec = 3, .tv_nsec = 0 };
+ const ts = os.__kernel_timespec{ .tv_sec = 3, .tv_nsec = 0 };
const count_completions: u64 = 1;
const sqe_timeout = try ring.timeout(0x66666666, &ts, count_completions, 0);
testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe_timeout.opcode);
@@ -1399,7 +1399,7 @@ test "timeout_remove" {
};
defer ring.deinit();
- const ts = os.timespec{ .tv_sec = 3, .tv_nsec = 0 };
+ const ts = os.__kernel_timespec{ .tv_sec = 3, .tv_nsec = 0 };
const sqe_timeout = try ring.timeout(0x88888888, &ts, 0, 0);
testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe_timeout.opcode);
testing.expectEqual(@as(u64, 0x88888888), sqe_timeout.user_data);