Compare commits

...

4 Commits

Author SHA1 Message Date
Justin Braben
f14b1733d7
Merge c9facf0ba3 into f845fa04a0 2024-11-20 20:48:45 -08:00
Alex Rønne Petersen
f845fa04a0 std.debug: Gracefully handle process_vm_readv() EPERM in MemoryAccessor.read().
Closes #21815.
2024-11-20 23:07:46 +01:00
Justin Braben
c9facf0ba3 Fill in missed PipeNotAvailable 2024-11-08 14:27:32 -07:00
Justin Braben
43606ff3ec Add PipeNotAvailable error 2024-11-08 13:48:36 -07:00
9 changed files with 17 additions and 1 deletions

View File

@ -48,7 +48,8 @@ fn read(ma: *MemoryAccessor, address: usize, buf: []u8) bool {
switch (linux.E.init(bytes_read)) { switch (linux.E.init(bytes_read)) {
.SUCCESS => return bytes_read == buf.len, .SUCCESS => return bytes_read == buf.len,
.FAULT => return false, .FAULT => return false,
.INVAL, .PERM, .SRCH => unreachable, // own pid is always valid .INVAL, .SRCH => unreachable, // own pid is always valid
.PERM => {}, // Known to happen in containers.
.NOMEM => {}, .NOMEM => {},
.NOSYS => {}, // QEMU is known not to implement this syscall. .NOSYS => {}, // QEMU is known not to implement this syscall.
else => unreachable, // unexpected else => unreachable, // unexpected

View File

@ -507,6 +507,7 @@ pub const SelfExePathError = error{
DeviceBusy, DeviceBusy,
SharingViolation, SharingViolation,
PipeBusy, PipeBusy,
PipeNotAvailable,
NotLink, NotLink,
PathAlreadyExists, PathAlreadyExists,

View File

@ -39,6 +39,7 @@ pub const OpenError = error{
FileNotFound, FileNotFound,
AccessDenied, AccessDenied,
PipeBusy, PipeBusy,
PipeNotAvailable,
NameTooLong, NameTooLong,
/// WASI-only; file paths must be valid UTF-8. /// WASI-only; file paths must be valid UTF-8.
InvalidUtf8, InvalidUtf8,

View File

@ -37,6 +37,7 @@ pub const OpenError = error{
NoDevice, NoDevice,
AccessDenied, AccessDenied,
PipeBusy, PipeBusy,
PipeNotAvailable,
PathAlreadyExists, PathAlreadyExists,
Unexpected, Unexpected,
NameTooLong, NameTooLong,
@ -132,6 +133,7 @@ pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HAN
.SHARING_VIOLATION => return error.AccessDenied, .SHARING_VIOLATION => return error.AccessDenied,
.ACCESS_DENIED => return error.AccessDenied, .ACCESS_DENIED => return error.AccessDenied,
.PIPE_BUSY => return error.PipeBusy, .PIPE_BUSY => return error.PipeBusy,
.PIPE_NOT_AVAILABLE => return error.PipeNotAvailable,
.OBJECT_PATH_SYNTAX_BAD => unreachable, .OBJECT_PATH_SYNTAX_BAD => unreachable,
.OBJECT_NAME_COLLISION => return error.PathAlreadyExists, .OBJECT_NAME_COLLISION => return error.PathAlreadyExists,
.FILE_IS_A_DIRECTORY => return error.IsDir, .FILE_IS_A_DIRECTORY => return error.IsDir,
@ -801,6 +803,7 @@ pub fn CreateSymbolicLink(
error.NotDir => return error.Unexpected, error.NotDir => return error.Unexpected,
error.WouldBlock => return error.Unexpected, error.WouldBlock => return error.Unexpected,
error.PipeBusy => return error.Unexpected, error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.AntivirusInterference => return error.Unexpected, error.AntivirusInterference => return error.Unexpected,
else => |e| return e, else => |e| return e,
}; };
@ -1335,6 +1338,7 @@ pub fn GetFinalPathNameByHandle(
error.NoDevice => return error.Unexpected, error.NoDevice => return error.Unexpected,
error.AccessDenied => return error.Unexpected, error.AccessDenied => return error.Unexpected,
error.PipeBusy => return error.Unexpected, error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.PathAlreadyExists => return error.Unexpected, error.PathAlreadyExists => return error.Unexpected,
error.WouldBlock => return error.Unexpected, error.WouldBlock => return error.Unexpected,
error.NetworkNotFound => return error.Unexpected, error.NetworkNotFound => return error.Unexpected,

View File

@ -2574,6 +2574,7 @@ pub const RenameError = error{
NoDevice, NoDevice,
SharingViolation, SharingViolation,
PipeBusy, PipeBusy,
PipeNotAvailable,
/// On Windows, `\\server` or `\\server\share` was not found. /// On Windows, `\\server` or `\\server\share` was not found.
NetworkNotFound, NetworkNotFound,
/// On Windows, antivirus software is enabled by default. It can be /// On Windows, antivirus software is enabled by default. It can be
@ -2945,6 +2946,7 @@ pub fn mkdiratW(dir_fd: fd_t, sub_path_w: []const u16, mode: u32) MakeDirError!v
}) catch |err| switch (err) { }) catch |err| switch (err) {
error.IsDir => return error.Unexpected, error.IsDir => return error.Unexpected,
error.PipeBusy => return error.Unexpected, error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.WouldBlock => return error.Unexpected, error.WouldBlock => return error.Unexpected,
error.AntivirusInterference => return error.Unexpected, error.AntivirusInterference => return error.Unexpected,
else => |e| return e, else => |e| return e,
@ -3039,6 +3041,7 @@ pub fn mkdirW(dir_path_w: []const u16, mode: u32) MakeDirError!void {
}) catch |err| switch (err) { }) catch |err| switch (err) {
error.IsDir => return error.Unexpected, error.IsDir => return error.Unexpected,
error.PipeBusy => return error.Unexpected, error.PipeBusy => return error.Unexpected,
error.PipeNotAvailable => return error.Unexpected,
error.WouldBlock => return error.Unexpected, error.WouldBlock => return error.Unexpected,
error.AntivirusInterference => return error.Unexpected, error.AntivirusInterference => return error.Unexpected,
else => |e| return e, else => |e| return e,
@ -5368,6 +5371,7 @@ pub const RealPathError = error{
SharingViolation, SharingViolation,
PipeBusy, PipeBusy,
PipeNotAvailable,
/// Windows-only; file paths provided by the user must be valid WTF-8. /// Windows-only; file paths provided by the user must be valid WTF-8.
/// https://simonsapin.github.io/wtf-8/ /// https://simonsapin.github.io/wtf-8/

View File

@ -746,6 +746,7 @@ fn spawnWindows(self: *ChildProcess) SpawnError!void {
}) catch |err| switch (err) { }) catch |err| switch (err) {
error.PathAlreadyExists => return error.Unexpected, // not possible for "NUL" error.PathAlreadyExists => return error.Unexpected, // not possible for "NUL"
error.PipeBusy => return error.Unexpected, // not possible for "NUL" error.PipeBusy => return error.Unexpected, // not possible for "NUL"
error.PipeNotAvailable => return error.Unexpected, // not possible for "NUL"
error.FileNotFound => return error.Unexpected, // not possible for "NUL" error.FileNotFound => return error.Unexpected, // not possible for "NUL"
error.AccessDenied => return error.Unexpected, // not possible for "NUL" error.AccessDenied => return error.Unexpected, // not possible for "NUL"
error.NameTooLong => return error.Unexpected, // not possible for "NUL" error.NameTooLong => return error.Unexpected, // not possible for "NUL"

View File

@ -805,6 +805,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {
error.InvalidWtf8 => unreachable, // Windows only error.InvalidWtf8 => unreachable, // Windows only
error.BadPathName => unreachable, // Windows only error.BadPathName => unreachable, // Windows only
error.PipeBusy => unreachable, // Windows-only error.PipeBusy => unreachable, // Windows-only
error.PipeNotAvailable => unreachable, // Windows-only
error.SharingViolation => unreachable, // Windows-only error.SharingViolation => unreachable, // Windows-only
error.NetworkNotFound => unreachable, // Windows-only error.NetworkNotFound => unreachable, // Windows-only
error.AntivirusInterference => unreachable, // Windows-only error.AntivirusInterference => unreachable, // Windows-only
@ -1068,6 +1069,7 @@ fn detectAbiAndDynamicLinker(
error.InvalidWtf8 => unreachable, // Windows only error.InvalidWtf8 => unreachable, // Windows only
error.BadPathName => unreachable, error.BadPathName => unreachable,
error.PipeBusy => unreachable, error.PipeBusy => unreachable,
error.PipeNotAvailable => unreachable,
error.FileLocksNotSupported => unreachable, error.FileLocksNotSupported => unreachable,
error.WouldBlock => unreachable, error.WouldBlock => unreachable,
error.FileBusy => unreachable, // opened without write permissions error.FileBusy => unreachable, // opened without write permissions

View File

@ -250,6 +250,7 @@ pub fn populateFile(comp: *Compilation, mod: *Module, file: *File) !void {
error.BadPathName => unreachable, // it's always "builtin.zig" error.BadPathName => unreachable, // it's always "builtin.zig"
error.NameTooLong => unreachable, // it's always "builtin.zig" error.NameTooLong => unreachable, // it's always "builtin.zig"
error.PipeBusy => unreachable, // it's not a pipe error.PipeBusy => unreachable, // it's not a pipe
error.PipeNotAvailable => unreachable, // it's not a pipe
error.WouldBlock => unreachable, // not asking for non-blocking I/O error.WouldBlock => unreachable, // not asking for non-blocking I/O
error.FileNotFound => try writeFile(file, mod), error.FileNotFound => try writeFile(file, mod),

View File

@ -133,6 +133,7 @@ pub fn astGenFile(
error.BadPathName => unreachable, // it's a hex encoded name error.BadPathName => unreachable, // it's a hex encoded name
error.NameTooLong => unreachable, // it's a fixed size name error.NameTooLong => unreachable, // it's a fixed size name
error.PipeBusy => unreachable, // it's not a pipe error.PipeBusy => unreachable, // it's not a pipe
error.PipeNotAvailable => unreachable, // it's not a pipe
error.WouldBlock => unreachable, // not asking for non-blocking I/O error.WouldBlock => unreachable, // not asking for non-blocking I/O
// There are no dir components, so you would think that this was // There are no dir components, so you would think that this was
// unreachable, however we have observed on macOS two processes racing // unreachable, however we have observed on macOS two processes racing