Skip to content

Commit

Permalink
io_uring: handle INTR error from write (#119)
Browse files Browse the repository at this point in the history
It is possible to get an EINTR error from io_uring when copying cqes.
xev already handles EINTR automatically when it occurs during
io_uring_enter, but doesn't handle it if an individual cqe copy has this
error.

Add error.SignalInterrupt to the WriteError enum so that callers may
rearm their writes when encountering this error, if they desire.
  • Loading branch information
mitchellh authored Sep 23, 2024
2 parents dbe2291 + e59610a commit b8d1d93
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/backend/io_uring.zig
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,8 @@ pub const Completion = struct {
@intCast(res)
else switch (@as(posix.E, @enumFromInt(-res))) {
.CANCELED => error.Canceled,
// If a write is interrupted, we retry it automatically.
.INTR => return .rearm,
else => |errno| posix.unexpectedErrno(errno),
},
},
Expand Down

0 comments on commit b8d1d93

Please sign in to comment.