mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.posix: read on timerfd can return error.Canceled
This commit is contained in:
parent
6976a5da19
commit
ca012e5b69
@ -185,6 +185,7 @@ const FmtError = error{
|
|||||||
BrokenPipe,
|
BrokenPipe,
|
||||||
Unexpected,
|
Unexpected,
|
||||||
WouldBlock,
|
WouldBlock,
|
||||||
|
Canceled,
|
||||||
FileClosed,
|
FileClosed,
|
||||||
DestinationAddressRequired,
|
DestinationAddressRequired,
|
||||||
DiskQuota,
|
DiskQuota,
|
||||||
|
|||||||
@ -791,6 +791,10 @@ pub const ReadError = error{
|
|||||||
/// and reading from the file descriptor would block.
|
/// and reading from the file descriptor would block.
|
||||||
WouldBlock,
|
WouldBlock,
|
||||||
|
|
||||||
|
/// reading a timerfd with CANCEL_ON_SET will lead to this error
|
||||||
|
/// when the clock goes through a discontinuous change
|
||||||
|
Canceled,
|
||||||
|
|
||||||
/// In WASI, this error occurs when the file descriptor does
|
/// In WASI, this error occurs when the file descriptor does
|
||||||
/// not hold the required rights to read from it.
|
/// not hold the required rights to read from it.
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
@ -851,6 +855,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
|
|||||||
.INVAL => unreachable,
|
.INVAL => unreachable,
|
||||||
.FAULT => unreachable,
|
.FAULT => unreachable,
|
||||||
.AGAIN => return error.WouldBlock,
|
.AGAIN => return error.WouldBlock,
|
||||||
|
.CANCELED => return error.Canceled,
|
||||||
.BADF => return error.NotOpenForReading, // Can be a race condition.
|
.BADF => return error.NotOpenForReading, // Can be a race condition.
|
||||||
.IO => return error.InputOutput,
|
.IO => return error.InputOutput,
|
||||||
.ISDIR => return error.IsDir,
|
.ISDIR => return error.IsDir,
|
||||||
|
|||||||
@ -1141,6 +1141,7 @@ fn preadAtLeast(file: fs.File, buf: []u8, offset: u64, min_read_len: usize) !usi
|
|||||||
const len = file.pread(buf[i..], offset + i) catch |err| switch (err) {
|
const len = file.pread(buf[i..], offset + i) catch |err| switch (err) {
|
||||||
error.OperationAborted => unreachable, // Windows-only
|
error.OperationAborted => unreachable, // Windows-only
|
||||||
error.WouldBlock => unreachable, // Did not request blocking mode
|
error.WouldBlock => unreachable, // Did not request blocking mode
|
||||||
|
error.Canceled => unreachable, // timerfd is unseekable
|
||||||
error.NotOpenForReading => unreachable,
|
error.NotOpenForReading => unreachable,
|
||||||
error.SystemResources => return error.SystemResources,
|
error.SystemResources => return error.SystemResources,
|
||||||
error.IsDir => return error.UnableToReadElfFile,
|
error.IsDir => return error.UnableToReadElfFile,
|
||||||
|
|||||||
@ -350,6 +350,7 @@ pub const File = struct {
|
|||||||
SocketNotConnected,
|
SocketNotConnected,
|
||||||
NotOpenForReading,
|
NotOpenForReading,
|
||||||
WouldBlock,
|
WouldBlock,
|
||||||
|
Canceled,
|
||||||
AccessDenied,
|
AccessDenied,
|
||||||
Unexpected,
|
Unexpected,
|
||||||
DiskQuota,
|
DiskQuota,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user