mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge pull request #23268 from chrboesch/i19875
std.posix: Added 'error.ProcessNotFound' where necessary
This commit is contained in:
parent
667035fc78
commit
206bd1ced8
5 changed files with 25 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -869,7 +869,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.
|
||||
|
|
@ -933,7 +933,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,
|
||||
|
|
@ -1013,7 +1013,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,
|
||||
|
|
@ -1155,7 +1155,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,
|
||||
|
|
@ -1277,7 +1277,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.
|
||||
|
|
@ -1353,7 +1353,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.
|
||||
|
|
@ -1443,7 +1443,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.
|
||||
|
|
@ -1528,7 +1528,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.
|
||||
|
|
@ -1607,6 +1607,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.
|
||||
|
|
@ -1666,6 +1669,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,
|
||||
|
|
@ -1837,6 +1841,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,
|
||||
|
|
@ -5483,6 +5488,7 @@ pub const RealPathError = error{
|
|||
FileSystem,
|
||||
BadPathName,
|
||||
DeviceBusy,
|
||||
ProcessNotFound,
|
||||
|
||||
SharingViolation,
|
||||
PipeBusy,
|
||||
|
|
|
|||
|
|
@ -843,6 +843,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {
|
|||
error.NoDevice,
|
||||
=> return error.GLibCNotFound,
|
||||
|
||||
error.ProcessNotFound,
|
||||
error.ProcessFdQuotaExceeded,
|
||||
error.SystemFdQuotaExceeded,
|
||||
error.SystemResources,
|
||||
|
|
@ -886,6 +887,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion {
|
|||
|
||||
error.FileTooBig => return error.Unexpected,
|
||||
|
||||
error.ProcessNotFound,
|
||||
error.ProcessFdQuotaExceeded,
|
||||
error.SystemFdQuotaExceeded,
|
||||
error.SystemResources,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue