diff --git a/lib/std/fs.zig b/lib/std/fs.zig index fc2da3de72bb..b33383dc2dbc 100644 --- a/lib/std/fs.zig +++ b/lib/std/fs.zig @@ -512,6 +512,7 @@ pub const SelfExePathError = error{ /// On Windows, `\\server` or `\\server\share` was not found. NetworkNotFound, + ProcessNotFound, /// On Windows, antivirus software is enabled by default. It can be /// disabled, but Windows Update sometimes ignores the user's preference diff --git a/lib/std/fs/Dir.zig b/lib/std/fs/Dir.zig index 3d869d9b5983..91a638639cd2 100644 --- a/lib/std/fs/Dir.zig +++ b/lib/std/fs/Dir.zig @@ -784,6 +784,7 @@ pub const OpenError = error{ DeviceBusy, /// On Windows, `\\server` or `\\server\share` was not found. NetworkNotFound, + ProcessNotFound, } || posix.UnexpectedError; pub fn close(self: *Dir) void { @@ -1696,6 +1697,7 @@ pub const DeleteDirError = error{ BadPathName, /// On Windows, `\\server` or `\\server\share` was not found. NetworkNotFound, + ProcessNotFound, Unexpected, }; @@ -2005,6 +2007,7 @@ pub const DeleteTreeError = error{ FileSystem, FileBusy, DeviceBusy, + ProcessNotFound, /// One of the path components was not a directory. /// This error is unreachable if `sub_path` does not contain a path separator. @@ -2079,6 +2082,7 @@ pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void { error.PermissionDenied, error.SymLinkLoop, error.ProcessFdQuotaExceeded, + error.ProcessNotFound, error.NameTooLong, error.SystemFdQuotaExceeded, error.NoDevice, @@ -2175,6 +2179,7 @@ pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void { error.AccessDenied, error.PermissionDenied, error.SymLinkLoop, + error.ProcessNotFound, error.ProcessFdQuotaExceeded, error.NameTooLong, error.SystemFdQuotaExceeded, @@ -2282,6 +2287,7 @@ fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint error.AccessDenied, error.PermissionDenied, error.SymLinkLoop, + error.ProcessNotFound, error.ProcessFdQuotaExceeded, error.NameTooLong, error.SystemFdQuotaExceeded, @@ -2383,6 +2389,7 @@ fn deleteTreeOpenInitialSubpath(self: Dir, sub_path: []const u8, kind_hint: File error.PermissionDenied, error.SymLinkLoop, error.ProcessFdQuotaExceeded, + error.ProcessNotFound, error.NameTooLong, error.SystemFdQuotaExceeded, error.NoDevice, diff --git a/lib/std/fs/File.zig b/lib/std/fs/File.zig index 9797a1b89688..5f0020ee6af3 100644 --- a/lib/std/fs/File.zig +++ b/lib/std/fs/File.zig @@ -52,6 +52,7 @@ pub const OpenError = error{ Unexpected, /// On Windows, `\\server` or `\\server\share` was not found. NetworkNotFound, + ProcessNotFound, /// On Windows, antivirus software is enabled by default. It can be /// disabled, but Windows Update sometimes ignores the user's preference /// and re-enables it. When enabled, antivirus software on Windows diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 2399fbc9c8e6..7200b87da64a 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -870,7 +870,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { .INTR => continue, .INVAL => unreachable, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .CANCELED => return error.Canceled, .BADF => return error.NotOpenForReading, // Can be a race condition. @@ -934,7 +934,7 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize { .INTR => continue, .INVAL => unreachable, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForReading, // can be a race condition .IO => return error.InputOutput, @@ -1014,7 +1014,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { .INTR => continue, .INVAL => unreachable, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForReading, // Can be a race condition. .IO => return error.InputOutput, @@ -1156,7 +1156,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize { .INTR => continue, .INVAL => unreachable, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForReading, // can be a race condition .IO => return error.InputOutput, @@ -1278,7 +1278,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { .INTR => continue, .INVAL => return error.InvalidArgument, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // can be a race condition. .DESTADDRREQ => unreachable, // `connect` was never called. @@ -1354,7 +1354,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize { .INTR => continue, .INVAL => return error.InvalidArgument, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // Can be a race condition. .DESTADDRREQ => unreachable, // `connect` was never called. @@ -1444,7 +1444,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { .INTR => continue, .INVAL => return error.InvalidArgument, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // Can be a race condition. .DESTADDRREQ => unreachable, // `connect` was never called. @@ -1529,7 +1529,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz .INTR => continue, .INVAL => return error.InvalidArgument, .FAULT => unreachable, - .NOENT => return error.ProcessNotFound, + .SRCH => return error.ProcessNotFound, .AGAIN => return error.WouldBlock, .BADF => return error.NotOpenForWriting, // Can be a race condition. .DESTADDRREQ => unreachable, // `connect` was never called. @@ -1608,6 +1608,9 @@ pub const OpenError = error{ /// On Windows, `\\server` or `\\server\share` was not found. NetworkNotFound, + /// This error occurs in Linux if the process to be open was not found. + ProcessNotFound, + /// One of these three things: /// * pathname refers to an executable image which is currently being /// executed and write access was requested. @@ -1667,6 +1670,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t { .NFILE => return error.SystemFdQuotaExceeded, .NODEV => return error.NoDevice, .NOENT => return error.FileNotFound, + .SRCH => return error.ProcessNotFound, .NOMEM => return error.SystemResources, .NOSPC => return error.NoSpaceLeft, .NOTDIR => return error.NotDir, @@ -1838,6 +1842,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O .NFILE => return error.SystemFdQuotaExceeded, .NODEV => return error.NoDevice, .NOENT => return error.FileNotFound, + .SRCH => return error.ProcessNotFound, .NOMEM => return error.SystemResources, .NOSPC => return error.NoSpaceLeft, .NOTDIR => return error.NotDir, @@ -5478,6 +5483,7 @@ pub const RealPathError = error{ FileSystem, BadPathName, DeviceBusy, + ProcessNotFound, SharingViolation, PipeBusy, diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 81a3013b3495..f49546e10958 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -838,6 +838,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion { error.NoDevice, => return error.GLibCNotFound, + error.ProcessNotFound, error.ProcessFdQuotaExceeded, error.SystemFdQuotaExceeded, error.SystemResources, @@ -881,6 +882,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion { error.FileTooBig => return error.Unexpected, + error.ProcessNotFound, error.ProcessFdQuotaExceeded, error.SystemFdQuotaExceeded, error.SystemResources,