aboutsummaryrefslogtreecommitdiff
path: root/src/io/io_linux.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-30 22:04:26 -0800
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-30 22:04:26 -0800
commited71379aa1abe561405da544aa91b00d8069ecf1 (patch)
treee168c28a1c17fc44fbe5c8e330b6f19933b3b2aa /src/io/io_linux.zig
parentb1c3fce49b5c761654f4a40612c192210dd5ac64 (diff)
downloadbun-ed71379aa1abe561405da544aa91b00d8069ecf1.tar.gz
bun-ed71379aa1abe561405da544aa91b00d8069ecf1.tar.zst
bun-ed71379aa1abe561405da544aa91b00d8069ecf1.zip
linux
Diffstat (limited to 'src/io/io_linux.zig')
-rw-r--r--src/io/io_linux.zig9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/io/io_linux.zig b/src/io/io_linux.zig
index 5fd6aa709..67eadf5db 100644
--- a/src/io/io_linux.zig
+++ b/src/io/io_linux.zig
@@ -45,6 +45,7 @@ const os = struct {
pub const ECANCELED = 125;
pub const EFBIG = 27;
};
+const timespec = std.os.system.timespec;
const linux = os.linux;
const IO_Uring = linux.IO_Uring;
const io_uring_cqe = linux.io_uring_cqe;
@@ -112,15 +113,15 @@ pub fn tick(self: *IO) !void {
/// Pass all queued submissions to the kernel and run for `nanoseconds`.
/// The `nanoseconds` argument is a u63 to allow coercion to the i64 used
-/// in the __kernel_timespec struct.
+/// in the timespec struct.
pub fn run_for_ns(self: *IO, nanoseconds: u63) !void {
// We must use the same clock source used by io_uring (CLOCK_MONOTONIC) since we specify the
// timeout below as an absolute value. Otherwise, we may deadlock if the clock sources are
// dramatically different. Any kernel that supports io_uring will support CLOCK_MONOTONIC.
- var current_ts: os.timespec = undefined;
+ var current_ts: timespec = undefined;
os.clock_gettime(os.CLOCK_MONOTONIC, &current_ts) catch unreachable;
// The absolute CLOCK_MONOTONIC time after which we may return from this function:
- const timeout_ts: os.__kernel_timespec = .{
+ const timeout_ts: timespec = .{
.tv_sec = current_ts.tv_sec,
.tv_nsec = current_ts.tv_nsec + nanoseconds,
};
@@ -511,7 +512,7 @@ const Operation = union(enum) {
buffer: []const u8,
},
timeout: struct {
- timespec: os.__kernel_timespec,
+ timespec: os.timespec,
},
write: struct {
fd: os.fd_t,