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{...@@ -39,6 +39,7 @@ pub const OpenError = error{
39 FileNotFound,39 FileNotFound,
40 AccessDenied,40 AccessDenied,
41 PipeBusy,41 PipeBusy,
42 NoDevice,
42 NameTooLong,43 NameTooLong,
43 /// WASI-only; file paths must be valid UTF-8.44 /// WASI-only; file paths must be valid UTF-8.
44 InvalidUtf8,45 InvalidUtf8,
lib/std/os/windows.zig+2
...@@ -132,6 +132,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN...@@ -132,6 +132,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
132 .SHARING_VIOLATION => return error.AccessDenied,132 .SHARING_VIOLATION => return error.AccessDenied,
133 .ACCESS_DENIED => return error.AccessDenied,133 .ACCESS_DENIED => return error.AccessDenied,
134 .PIPE_BUSY => return error.PipeBusy,134 .PIPE_BUSY => return error.PipeBusy,
135 .PIPE_NOT_AVAILABLE => return error.NoDevice,
135 .OBJECT_PATH_SYNTAX_BAD => unreachable,136 .OBJECT_PATH_SYNTAX_BAD => unreachable,
136 .OBJECT_NAME_COLLISION => return error.PathAlreadyExists,137 .OBJECT_NAME_COLLISION => return error.PathAlreadyExists,
137 .FILE_IS_A_DIRECTORY => return error.IsDir,138 .FILE_IS_A_DIRECTORY => return error.IsDir,
...@@ -801,6 +802,7 @@ pub fn CreateSymbolicLink(...@@ -801,6 +802,7 @@ pub fn CreateSymbolicLink(
801 error.NotDir => return error.Unexpected,802 error.NotDir => return error.Unexpected,
802 error.WouldBlock => return error.Unexpected,803 error.WouldBlock => return error.Unexpected,
803 error.PipeBusy => return error.Unexpected,804 error.PipeBusy => return error.Unexpected,
805 error.NoDevice => return error.Unexpected,
804 error.AntivirusInterference => return error.Unexpected,806 error.AntivirusInterference => return error.Unexpected,
805 else => |e| return e,807 else => |e| return e,
806 };808 };
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...@@ -2946,6 +2946,7 @@ pub fn mkdiratW(dir_fd: fd_t, sub_path_w: []const u16, mode: u32) MakeDirError!v
2946 }) catch |err| switch (err) {2946 }) catch |err| switch (err) {
2947 error.IsDir => return error.Unexpected,2947 error.IsDir => return error.Unexpected,
2948 error.PipeBusy => return error.Unexpected,2948 error.PipeBusy => return error.Unexpected,
2949 error.NoDevice => return error.Unexpected,
2949 error.WouldBlock => return error.Unexpected,2950 error.WouldBlock => return error.Unexpected,
2950 error.AntivirusInterference => return error.Unexpected,2951 error.AntivirusInterference => return error.Unexpected,
2951 else => |e| return e,2952 else => |e| return e,
...@@ -3040,6 +3041,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {...@@ -3040,6 +3041,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {
3040 }) catch |err| switch (err) {3041 }) catch |err| switch (err) {
3041 error.IsDir => return error.Unexpected,3042 error.IsDir => return error.Unexpected,
3042 error.PipeBusy => return error.Unexpected,3043 error.PipeBusy => return error.Unexpected,
3044 error.NoDevice => return error.Unexpected,
3043 error.WouldBlock => return error.Unexpected,3045 error.WouldBlock => return error.Unexpected,
3044 error.AntivirusInterference => return error.Unexpected,3046 error.AntivirusInterference => return error.Unexpected,
3045 else => |e| return e,3047 else => |e| return e,
lib/std/process/Child.zig+1
...@@ -743,6 +743,7 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {...@@ -743,6 +743,7 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {
743 }) catch |err| switch (err) {743 }) catch |err| switch (err) {
744 error.PathAlreadyExists => return error.Unexpected, // not possible for "NUL"744 error.PathAlreadyExists => return error.Unexpected, // not possible for "NUL"
745 error.PipeBusy => return error.Unexpected, // not possible for "NUL"745 error.PipeBusy => return error.Unexpected, // not possible for "NUL"
746 error.NoDevice => return error.Unexpected, // not possible for "NUL"
746 error.FileNotFound => return error.Unexpected, // not possible for "NUL"747 error.FileNotFound => return error.Unexpected, // not possible for "NUL"
747 error.AccessDenied => return error.Unexpected, // not possible for "NUL"748 error.AccessDenied => return error.Unexpected, // not possible for "NUL"
748 error.NameTooLong => return error.Unexpected, // not possible for "NUL"749 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 {...@@ -250,6 +250,7 @@ pub fn populateFile(comp: *Compilation, mod: *Module, file: *File) !void {
250 error.BadPathName => unreachable, // it's always "builtin.zig"250 error.BadPathName => unreachable, // it's always "builtin.zig"
251 error.NameTooLong => unreachable, // it's always "builtin.zig"251 error.NameTooLong => unreachable, // it's always "builtin.zig"
252 error.PipeBusy => unreachable, // it's not a pipe252 error.PipeBusy => unreachable, // it's not a pipe
253 error.NoDevice => unreachable, // it's not a pipe
253 error.WouldBlock => unreachable, // not asking for non-blocking I/O254 error.WouldBlock => unreachable, // not asking for non-blocking I/O
254255
255 error.FileNotFound => try writeFile(file, mod),256 error.FileNotFound => try writeFile(file, mod),
src/Zcu/PerThread.zig+1
...@@ -133,6 +133,7 @@ pub fn astGenFile(...@@ -133,6 +133,7 @@ pub fn astGenFile(
133 error.BadPathName => unreachable, // it's a hex encoded name133 error.BadPathName => unreachable, // it's a hex encoded name
134 error.NameTooLong => unreachable, // it's a fixed size name134 error.NameTooLong => unreachable, // it's a fixed size name
135 error.PipeBusy => unreachable, // it's not a pipe135 error.PipeBusy => unreachable, // it's not a pipe
136 error.NoDevice => unreachable, // it's not a pipe
136 error.WouldBlock => unreachable, // not asking for non-blocking I/O137 error.WouldBlock => unreachable, // not asking for non-blocking I/O
137 // There are no dir components, so you would think that this was138 // There are no dir components, so you would think that this was
138 // unreachable, however we have observed on macOS two processes racing139 // unreachable, however we have observed on macOS two processes racing