authorgravatar for kernel@jfarr.ccJan Hendrik Farr <kernel@jfarr.cc> 2024-06-16 03:29:34+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-08 01:12:26-07:00
logca012e5b69b9ff275c6e366c0348219d1c816f18
tree8a82fa41a2709de3377beb853988b8abc8c3f7de
parent6976a5da19bf45f315eba2a0047977c6e659b2b3

std.posix: read on timerfd can return error.Canceled


4 files changed, 8 insertions(+), 0 deletions(-)

lib/compiler/fmt.zig+1
......@@ -185,6 +185,7 @@ const FmtError = error{
185185 BrokenPipe,
186186 Unexpected,
187187 WouldBlock,
188 Canceled,
188189 FileClosed,
189190 DestinationAddressRequired,
190191 DiskQuota,
lib/std/posix.zig+5
......@@ -791,6 +791,10 @@ pub const ReadError = error{
791791 /// and reading from the file descriptor would block.
792792 WouldBlock,
793793
794 /// reading a timerfd with CANCEL_ON_SET will lead to this error
795 /// when the clock goes through a discontinuous change
796 Canceled,
797
794798 /// In WASI, this error occurs when the file descriptor does
795799 /// not hold the required rights to read from it.
796800 AccessDenied,
......@@ -851,6 +855,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
851855 .INVAL => unreachable,
852856 .FAULT => unreachable,
853857 .AGAIN => return error.WouldBlock,
858 .CANCELED => return error.Canceled,
854859 .BADF => return error.NotOpenForReading, // Can be a race condition.
855860 .IO => return error.InputOutput,
856861 .ISDIR => return error.IsDir,
lib/std/zig/system.zig+1
......@@ -1141,6 +1141,7 @@ fn preadAtLeast(file: fs.File, buf: []u8, offset: u64, min_read_len: usize) !usi
11411141 const len = file.pread(buf[i..], offset + i) catch |err| switch (err) {
11421142 error.OperationAborted => unreachable, // Windows-only
11431143 error.WouldBlock => unreachable, // Did not request blocking mode
1144 error.Canceled => unreachable, // timerfd is unseekable
11441145 error.NotOpenForReading => unreachable,
11451146 error.SystemResources => return error.SystemResources,
11461147 error.IsDir => return error.UnableToReadElfFile,
src/link.zig+1
......@@ -350,6 +350,7 @@ pub const File = struct {
350350 SocketNotConnected,
351351 NotOpenForReading,
352352 WouldBlock,
353 Canceled,
353354 AccessDenied,
354355 Unexpected,
355356 DiskQuota,