mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
std.os.windows: add possible error NETNAME_DELETED of ReadFile
Closes #13631
This commit is contained in:
parent
3cb1ab0e05
commit
55e879d2ed
@ -641,6 +641,9 @@ pub const ReadError = error{
|
||||
ConnectionTimedOut,
|
||||
NotOpenForReading,
|
||||
|
||||
// Windows only
|
||||
NetNameDeleted,
|
||||
|
||||
/// This error occurs when no global event loop is configured,
|
||||
/// and reading from the file descriptor would block.
|
||||
WouldBlock,
|
||||
|
||||
@ -435,8 +435,9 @@ pub fn FindClose(hFindFile: HANDLE) void {
|
||||
}
|
||||
|
||||
pub const ReadFileError = error{
|
||||
OperationAborted,
|
||||
BrokenPipe,
|
||||
NetNameDeleted,
|
||||
OperationAborted,
|
||||
Unexpected,
|
||||
};
|
||||
|
||||
@ -475,6 +476,7 @@ pub fn ReadFile(in_hFile: HANDLE, buffer: []u8, offset: ?u64, io_mode: std.io.Mo
|
||||
.IO_PENDING => unreachable,
|
||||
.OPERATION_ABORTED => return error.OperationAborted,
|
||||
.BROKEN_PIPE => return error.BrokenPipe,
|
||||
.NETNAME_DELETED => return error.NetNameDeleted,
|
||||
.HANDLE_EOF => return @as(usize, bytes_transferred),
|
||||
else => |err| return unexpectedError(err),
|
||||
}
|
||||
@ -506,9 +508,11 @@ pub fn ReadFile(in_hFile: HANDLE, buffer: []u8, offset: ?u64, io_mode: std.io.Mo
|
||||
} else null;
|
||||
if (kernel32.ReadFile(in_hFile, buffer.ptr, want_read_count, &amt_read, overlapped) == 0) {
|
||||
switch (kernel32.GetLastError()) {
|
||||
.IO_PENDING => unreachable,
|
||||
.OPERATION_ABORTED => continue,
|
||||
.BROKEN_PIPE => return 0,
|
||||
.HANDLE_EOF => return 0,
|
||||
.NETNAME_DELETED => return error.NetNameDeleted,
|
||||
else => |err| return unexpectedError(err),
|
||||
}
|
||||
}
|
||||
|
||||
@ -917,6 +917,7 @@ fn preadMin(file: fs.File, buf: []u8, offset: u64, min_read_len: usize) !usize {
|
||||
error.Unseekable => return error.UnableToReadElfFile,
|
||||
error.ConnectionResetByPeer => return error.UnableToReadElfFile,
|
||||
error.ConnectionTimedOut => return error.UnableToReadElfFile,
|
||||
error.NetNameDeleted => return error.UnableToReadElfFile,
|
||||
error.Unexpected => return error.Unexpected,
|
||||
error.InputOutput => return error.FileSystem,
|
||||
error.AccessDenied => return error.Unexpected,
|
||||
|
||||
@ -489,6 +489,7 @@ pub const File = struct {
|
||||
NameTooLong,
|
||||
CurrentWorkingDirectoryUnlinked,
|
||||
LockViolation,
|
||||
NetNameDeleted,
|
||||
};
|
||||
|
||||
/// Called from within the CodeGen to lower a local variable instantion as an unnamed
|
||||
|
||||
@ -4482,6 +4482,7 @@ const FmtError = error{
|
||||
UnsupportedEncoding,
|
||||
ConnectionResetByPeer,
|
||||
LockViolation,
|
||||
NetNameDeleted,
|
||||
} || fs.File.OpenError;
|
||||
|
||||
fn fmtPath(fmt: *Fmt, file_path: []const u8, check_mode: bool, dir: fs.Dir, sub_path: []const u8) FmtError!void {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user