authorgravatar for 48591413+chrboesch@users.noreply.github.comChris Boesch <48591413+chrboesch@users.noreply.github.com> 2025-04-14 22:20:44+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-04-14 22:20:44+02:00
log206bd1ced863f0757a2e15b74b533170460dd328
treedcac754cf2d8057808efeb6095e422807576037c
parent667035fc7834079f26ee2c97a01a412d5ff64cc2
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #23268 from chrboesch/i19875

std.posix: Added 'error.ProcessNotFound' where necessary

5 files changed, 25 insertions(+), 8 deletions(-)

lib/std/fs.zig+1
...@@ -512,6 +512,7 @@ pub const SelfExePathError = error{...@@ -512,6 +512,7 @@ pub const SelfExePathError = error{
512512
513 /// On Windows, `\\server` or `\\server\share` was not found.513 /// On Windows, `\\server` or `\\server\share` was not found.
514 NetworkNotFound,514 NetworkNotFound,
515 ProcessNotFound,
515516
516 /// On Windows, antivirus software is enabled by default. It can be517 /// On Windows, antivirus software is enabled by default. It can be
517 /// disabled, but Windows Update sometimes ignores the user's preference518 /// disabled, but Windows Update sometimes ignores the user's preference
lib/std/fs/Dir.zig+7
...@@ -784,6 +784,7 @@ pub const OpenError = error{...@@ -784,6 +784,7 @@ pub const OpenError = error{
784 DeviceBusy,784 DeviceBusy,
785 /// On Windows, `\\server` or `\\server\share` was not found.785 /// On Windows, `\\server` or `\\server\share` was not found.
786 NetworkNotFound,786 NetworkNotFound,
787 ProcessNotFound,
787} || posix.UnexpectedError;788} || posix.UnexpectedError;
788789
789pub fn close(self: *Dir) void {790pub fn close(self: *Dir) void {
...@@ -1696,6 +1697,7 @@ pub const DeleteDirError = error{...@@ -1696,6 +1697,7 @@ pub const DeleteDirError = error{
1696 BadPathName,1697 BadPathName,
1697 /// On Windows, `\\server` or `\\server\share` was not found.1698 /// On Windows, `\\server` or `\\server\share` was not found.
1698 NetworkNotFound,1699 NetworkNotFound,
1700 ProcessNotFound,
1699 Unexpected,1701 Unexpected,
1700};1702};
17011703
...@@ -2005,6 +2007,7 @@ pub const DeleteTreeError = error{...@@ -2005,6 +2007,7 @@ pub const DeleteTreeError = error{
2005 FileSystem,2007 FileSystem,
2006 FileBusy,2008 FileBusy,
2007 DeviceBusy,2009 DeviceBusy,
2010 ProcessNotFound,
20082011
2009 /// One of the path components was not a directory.2012 /// One of the path components was not a directory.
2010 /// This error is unreachable if `sub_path` does not contain a path separator.2013 /// 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 {...@@ -2079,6 +2082,7 @@ pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void {
2079 error.PermissionDenied,2082 error.PermissionDenied,
2080 error.SymLinkLoop,2083 error.SymLinkLoop,
2081 error.ProcessFdQuotaExceeded,2084 error.ProcessFdQuotaExceeded,
2085 error.ProcessNotFound,
2082 error.NameTooLong,2086 error.NameTooLong,
2083 error.SystemFdQuotaExceeded,2087 error.SystemFdQuotaExceeded,
2084 error.NoDevice,2088 error.NoDevice,
...@@ -2175,6 +2179,7 @@ pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void {...@@ -2175,6 +2179,7 @@ pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void {
2175 error.AccessDenied,2179 error.AccessDenied,
2176 error.PermissionDenied,2180 error.PermissionDenied,
2177 error.SymLinkLoop,2181 error.SymLinkLoop,
2182 error.ProcessNotFound,
2178 error.ProcessFdQuotaExceeded,2183 error.ProcessFdQuotaExceeded,
2179 error.NameTooLong,2184 error.NameTooLong,
2180 error.SystemFdQuotaExceeded,2185 error.SystemFdQuotaExceeded,
...@@ -2282,6 +2287,7 @@ fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint...@@ -2282,6 +2287,7 @@ fn deleteTreeMinStackSizeWithKindHint(self: Dir, sub_path: []const u8, kind_hint
2282 error.AccessDenied,2287 error.AccessDenied,
2283 error.PermissionDenied,2288 error.PermissionDenied,
2284 error.SymLinkLoop,2289 error.SymLinkLoop,
2290 error.ProcessNotFound,
2285 error.ProcessFdQuotaExceeded,2291 error.ProcessFdQuotaExceeded,
2286 error.NameTooLong,2292 error.NameTooLong,
2287 error.SystemFdQuotaExceeded,2293 error.SystemFdQuotaExceeded,
...@@ -2383,6 +2389,7 @@ fn deleteTreeOpenInitialSubpath(self: Dir, sub_path: []const u8, kind_hint: File...@@ -2383,6 +2389,7 @@ fn deleteTreeOpenInitialSubpath(self: Dir, sub_path: []const u8, kind_hint: File
2383 error.PermissionDenied,2389 error.PermissionDenied,
2384 error.SymLinkLoop,2390 error.SymLinkLoop,
2385 error.ProcessFdQuotaExceeded,2391 error.ProcessFdQuotaExceeded,
2392 error.ProcessNotFound,
2386 error.NameTooLong,2393 error.NameTooLong,
2387 error.SystemFdQuotaExceeded,2394 error.SystemFdQuotaExceeded,
2388 error.NoDevice,2395 error.NoDevice,
lib/std/fs/File.zig+1
...@@ -52,6 +52,7 @@ pub const OpenError = error{...@@ -52,6 +52,7 @@ pub const OpenError = error{
52 Unexpected,52 Unexpected,
53 /// On Windows, `\\server` or `\\server\share` was not found.53 /// On Windows, `\\server` or `\\server\share` was not found.
54 NetworkNotFound,54 NetworkNotFound,
55 ProcessNotFound,
55 /// On Windows, antivirus software is enabled by default. It can be56 /// On Windows, antivirus software is enabled by default. It can be
56 /// disabled, but Windows Update sometimes ignores the user's preference57 /// disabled, but Windows Update sometimes ignores the user's preference
57 /// and re-enables it. When enabled, antivirus software on Windows58 /// and re-enables it. When enabled, antivirus software on Windows
lib/std/posix.zig+14-8
...@@ -869,7 +869,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {...@@ -869,7 +869,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
869 .INTR => continue,869 .INTR => continue,
870 .INVAL => unreachable,870 .INVAL => unreachable,
871 .FAULT => unreachable,871 .FAULT => unreachable,
872 .NOENT => return error.ProcessNotFound,872 .SRCH => return error.ProcessNotFound,
873 .AGAIN => return error.WouldBlock,873 .AGAIN => return error.WouldBlock,
874 .CANCELED => return error.Canceled,874 .CANCELED => return error.Canceled,
875 .BADF => return error.NotOpenForReading, // Can be a race condition.875 .BADF => return error.NotOpenForReading, // Can be a race condition.
...@@ -933,7 +933,7 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize {...@@ -933,7 +933,7 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize {
933 .INTR => continue,933 .INTR => continue,
934 .INVAL => unreachable,934 .INVAL => unreachable,
935 .FAULT => unreachable,935 .FAULT => unreachable,
936 .NOENT => return error.ProcessNotFound,936 .SRCH => return error.ProcessNotFound,
937 .AGAIN => return error.WouldBlock,937 .AGAIN => return error.WouldBlock,
938 .BADF => return error.NotOpenForReading, // can be a race condition938 .BADF => return error.NotOpenForReading, // can be a race condition
939 .IO => return error.InputOutput,939 .IO => return error.InputOutput,
...@@ -1013,7 +1013,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {...@@ -1013,7 +1013,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {
1013 .INTR => continue,1013 .INTR => continue,
1014 .INVAL => unreachable,1014 .INVAL => unreachable,
1015 .FAULT => unreachable,1015 .FAULT => unreachable,
1016 .NOENT => return error.ProcessNotFound,1016 .SRCH => return error.ProcessNotFound,
1017 .AGAIN => return error.WouldBlock,1017 .AGAIN => return error.WouldBlock,
1018 .BADF => return error.NotOpenForReading, // Can be a race condition.1018 .BADF => return error.NotOpenForReading, // Can be a race condition.
1019 .IO => return error.InputOutput,1019 .IO => return error.InputOutput,
...@@ -1155,7 +1155,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {...@@ -1155,7 +1155,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
1155 .INTR => continue,1155 .INTR => continue,
1156 .INVAL => unreachable,1156 .INVAL => unreachable,
1157 .FAULT => unreachable,1157 .FAULT => unreachable,
1158 .NOENT => return error.ProcessNotFound,1158 .SRCH => return error.ProcessNotFound,
1159 .AGAIN => return error.WouldBlock,1159 .AGAIN => return error.WouldBlock,
1160 .BADF => return error.NotOpenForReading, // can be a race condition1160 .BADF => return error.NotOpenForReading, // can be a race condition
1161 .IO => return error.InputOutput,1161 .IO => return error.InputOutput,
...@@ -1277,7 +1277,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {...@@ -1277,7 +1277,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
1277 .INTR => continue,1277 .INTR => continue,
1278 .INVAL => return error.InvalidArgument,1278 .INVAL => return error.InvalidArgument,
1279 .FAULT => unreachable,1279 .FAULT => unreachable,
1280 .NOENT => return error.ProcessNotFound,1280 .SRCH => return error.ProcessNotFound,
1281 .AGAIN => return error.WouldBlock,1281 .AGAIN => return error.WouldBlock,
1282 .BADF => return error.NotOpenForWriting, // can be a race condition.1282 .BADF => return error.NotOpenForWriting, // can be a race condition.
1283 .DESTADDRREQ => unreachable, // `connect` was never called.1283 .DESTADDRREQ => unreachable, // `connect` was never called.
...@@ -1353,7 +1353,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize {...@@ -1353,7 +1353,7 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize {
1353 .INTR => continue,1353 .INTR => continue,
1354 .INVAL => return error.InvalidArgument,1354 .INVAL => return error.InvalidArgument,
1355 .FAULT => unreachable,1355 .FAULT => unreachable,
1356 .NOENT => return error.ProcessNotFound,1356 .SRCH => return error.ProcessNotFound,
1357 .AGAIN => return error.WouldBlock,1357 .AGAIN => return error.WouldBlock,
1358 .BADF => return error.NotOpenForWriting, // Can be a race condition.1358 .BADF => return error.NotOpenForWriting, // Can be a race condition.
1359 .DESTADDRREQ => unreachable, // `connect` was never called.1359 .DESTADDRREQ => unreachable, // `connect` was never called.
...@@ -1443,7 +1443,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {...@@ -1443,7 +1443,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
1443 .INTR => continue,1443 .INTR => continue,
1444 .INVAL => return error.InvalidArgument,1444 .INVAL => return error.InvalidArgument,
1445 .FAULT => unreachable,1445 .FAULT => unreachable,
1446 .NOENT => return error.ProcessNotFound,1446 .SRCH => return error.ProcessNotFound,
1447 .AGAIN => return error.WouldBlock,1447 .AGAIN => return error.WouldBlock,
1448 .BADF => return error.NotOpenForWriting, // Can be a race condition.1448 .BADF => return error.NotOpenForWriting, // Can be a race condition.
1449 .DESTADDRREQ => unreachable, // `connect` was never called.1449 .DESTADDRREQ => unreachable, // `connect` was never called.
...@@ -1528,7 +1528,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz...@@ -1528,7 +1528,7 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usiz
1528 .INTR => continue,1528 .INTR => continue,
1529 .INVAL => return error.InvalidArgument,1529 .INVAL => return error.InvalidArgument,
1530 .FAULT => unreachable,1530 .FAULT => unreachable,
1531 .NOENT => return error.ProcessNotFound,1531 .SRCH => return error.ProcessNotFound,
1532 .AGAIN => return error.WouldBlock,1532 .AGAIN => return error.WouldBlock,
1533 .BADF => return error.NotOpenForWriting, // Can be a race condition.1533 .BADF => return error.NotOpenForWriting, // Can be a race condition.
1534 .DESTADDRREQ => unreachable, // `connect` was never called.1534 .DESTADDRREQ => unreachable, // `connect` was never called.
...@@ -1607,6 +1607,9 @@ pub const OpenError = error{...@@ -1607,6 +1607,9 @@ pub const OpenError = error{
1607 /// On Windows, `\\server` or `\\server\share` was not found.1607 /// On Windows, `\\server` or `\\server\share` was not found.
1608 NetworkNotFound,1608 NetworkNotFound,
16091609
1610 /// This error occurs in Linux if the process to be open was not found.
1611 ProcessNotFound,
1612
1610 /// One of these three things:1613 /// One of these three things:
1611 /// * pathname refers to an executable image which is currently being1614 /// * pathname refers to an executable image which is currently being
1612 /// executed and write access was requested.1615 /// executed and write access was requested.
...@@ -1666,6 +1669,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t {...@@ -1666,6 +1669,7 @@ pub fn openZ(file_path: [*:0]const u8, flags: O, perm: mode_t) OpenError!fd_t {
1666 .NFILE => return error.SystemFdQuotaExceeded,1669 .NFILE => return error.SystemFdQuotaExceeded,
1667 .NODEV => return error.NoDevice,1670 .NODEV => return error.NoDevice,
1668 .NOENT => return error.FileNotFound,1671 .NOENT => return error.FileNotFound,
1672 .SRCH => return error.ProcessNotFound,
1669 .NOMEM => return error.SystemResources,1673 .NOMEM => return error.SystemResources,
1670 .NOSPC => return error.NoSpaceLeft,1674 .NOSPC => return error.NoSpaceLeft,
1671 .NOTDIR => return error.NotDir,1675 .NOTDIR => return error.NotDir,
...@@ -1837,6 +1841,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O...@@ -1837,6 +1841,7 @@ pub fn openatZ(dir_fd: fd_t, file_path: [*:0]const u8, flags: O, mode: mode_t) O
1837 .NFILE => return error.SystemFdQuotaExceeded,1841 .NFILE => return error.SystemFdQuotaExceeded,
1838 .NODEV => return error.NoDevice,1842 .NODEV => return error.NoDevice,
1839 .NOENT => return error.FileNotFound,1843 .NOENT => return error.FileNotFound,
1844 .SRCH => return error.ProcessNotFound,
1840 .NOMEM => return error.SystemResources,1845 .NOMEM => return error.SystemResources,
1841 .NOSPC => return error.NoSpaceLeft,1846 .NOSPC => return error.NoSpaceLeft,
1842 .NOTDIR => return error.NotDir,1847 .NOTDIR => return error.NotDir,
...@@ -5483,6 +5488,7 @@ pub const RealPathError = error{...@@ -5483,6 +5488,7 @@ pub const RealPathError = error{
5483 FileSystem,5488 FileSystem,
5484 BadPathName,5489 BadPathName,
5485 DeviceBusy,5490 DeviceBusy,
5491 ProcessNotFound,
54865492
5487 SharingViolation,5493 SharingViolation,
5488 PipeBusy,5494 PipeBusy,
lib/std/zig/system.zig+2
...@@ -843,6 +843,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {...@@ -843,6 +843,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {
843 error.NoDevice,843 error.NoDevice,
844 => return error.GLibCNotFound,844 => return error.GLibCNotFound,
845845
846 error.ProcessNotFound,
846 error.ProcessFdQuotaExceeded,847 error.ProcessFdQuotaExceeded,
847 error.SystemFdQuotaExceeded,848 error.SystemFdQuotaExceeded,
848 error.SystemResources,849 error.SystemResources,
...@@ -886,6 +887,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {...@@ -886,6 +887,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {
886887
887 error.FileTooBig => return error.Unexpected,888 error.FileTooBig => return error.Unexpected,
888889
890 error.ProcessNotFound,
889 error.ProcessFdQuotaExceeded,891 error.ProcessFdQuotaExceeded,
890 error.SystemFdQuotaExceeded,892 error.SystemFdQuotaExceeded,
891 error.SystemResources,893 error.SystemResources,