authorgravatar for 32079903+JustinBraben@users.noreply.github.comJustin Braben <32079903+JustinBraben@users.noreply.github.com> 2024-11-27 14:33:29-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-11-27 22:33:29+01:00
logd16a9b0acb14ad217849de2a59d91cd4648ac1a7
treef098a2df827a0b7a40cecebf8cd72f2d40d9b564
parent1a99c99ee99fa3ca43935fe7d7d0865145b82d4e
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.os.windows: Map PIPE_NOT_AVAILABLE from OpenFile() to error.NoDevice (#21938)


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

lib/std/fs/File.zig+1
......@@ -39,6 +39,7 @@ pub const OpenError = error{
3939 FileNotFound,
4040 AccessDenied,
4141 PipeBusy,
42 NoDevice,
4243 NameTooLong,
4344 /// WASI-only; file paths must be valid UTF-8.
4445 InvalidUtf8,
lib/std/os/windows.zig+2
......@@ -132,6 +132,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
132132 .SHARING_VIOLATION => return error.AccessDenied,
133133 .ACCESS_DENIED => return error.AccessDenied,
134134 .PIPE_BUSY => return error.PipeBusy,
135 .PIPE_NOT_AVAILABLE => return error.NoDevice,
135136 .OBJECT_PATH_SYNTAX_BAD => unreachable,
136137 .OBJECT_NAME_COLLISION => return error.PathAlreadyExists,
137138 .FILE_IS_A_DIRECTORY => return error.IsDir,
......@@ -801,6 +802,7 @@ pub fn CreateSymbolicLink(
801802 error.NotDir => return error.Unexpected,
802803 error.WouldBlock => return error.Unexpected,
803804 error.PipeBusy => return error.Unexpected,
805 error.NoDevice => return error.Unexpected,
804806 error.AntivirusInterference => return error.Unexpected,
805807 else => |e| return e,
806808 };
lib/std/posix.zig+2
......@@ -2946,6 +2946,7 @@ pub fn mkdiratW(dir_fd: fd_t, sub_path_w: []const u16, mode: u32) MakeDirError!v
29462946 }) catch |err| switch (err) {
29472947 error.IsDir => return error.Unexpected,
29482948 error.PipeBusy => return error.Unexpected,
2949 error.NoDevice => return error.Unexpected,
29492950 error.WouldBlock => return error.Unexpected,
29502951 error.AntivirusInterference => return error.Unexpected,
29512952 else => |e| return e,
......@@ -3040,6 +3041,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {
30403041 }) catch |err| switch (err) {
30413042 error.IsDir => return error.Unexpected,
30423043 error.PipeBusy => return error.Unexpected,
3044 error.NoDevice => return error.Unexpected,
30433045 error.WouldBlock => return error.Unexpected,
30443046 error.AntivirusInterference => return error.Unexpected,
30453047 else => |e| return e,
lib/std/process/Child.zig+1
......@@ -743,6 +743,7 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {
743743 }) catch |err| switch (err) {
744744 error.PathAlreadyExists => return error.Unexpected, // not possible for "NUL"
745745 error.PipeBusy => return error.Unexpected, // not possible for "NUL"
746 error.NoDevice => return error.Unexpected, // not possible for "NUL"
746747 error.FileNotFound => return error.Unexpected, // not possible for "NUL"
747748 error.AccessDenied => return error.Unexpected, // not possible for "NUL"
748749 error.NameTooLong => return error.Unexpected, // not possible for "NUL"
src/Builtin.zig+1
......@@ -250,6 +250,7 @@ pub fn populateFile(comp: *Compilation, mod: *Module, file: *File) !void {
250250 error.BadPathName => unreachable, // it's always "builtin.zig"
251251 error.NameTooLong => unreachable, // it's always "builtin.zig"
252252 error.PipeBusy => unreachable, // it's not a pipe
253 error.NoDevice => unreachable, // it's not a pipe
253254 error.WouldBlock => unreachable, // not asking for non-blocking I/O
254255
255256 error.FileNotFound => try writeFile(file, mod),
src/Zcu/PerThread.zig+1
......@@ -133,6 +133,7 @@ pub fn astGenFile(
133133 error.BadPathName => unreachable, // it's a hex encoded name
134134 error.NameTooLong => unreachable, // it's a fixed size name
135135 error.PipeBusy => unreachable, // it's not a pipe
136 error.NoDevice => unreachable, // it's not a pipe
136137 error.WouldBlock => unreachable, // not asking for non-blocking I/O
137138 // There are no dir components, so you would think that this was
138139 // unreachable, however we have observed on macOS two processes racing