From b10d76563169aec09355502073c2ebba110af2e1 Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:34:55 +0200 Subject: [PATCH 1/7] std.posix: added missing posix error ENXIO --- lib/std/posix.zig | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/std/posix.zig b/lib/std/posix.zig index ce480928bff5..4ca198808b6a 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -834,6 +834,9 @@ pub const ReadError = error{ /// Unable to read file due to lock. LockViolation, + + /// The device is not available or the address is not found. + NoSuchDeviceOrAddress, } || UnexpectedError; /// Returns the number of bytes that were read, which can be less than @@ -901,6 +904,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, + .NXIO => return error.NoSuchDeviceOrAddress, else => |err| return unexpectedErrno(err), } } @@ -6231,6 +6235,9 @@ pub const SendError = error{ /// The destination address is not listening. ConnectionRefused, + + /// The device is not available or the address is not found. + NoSuchDeviceOrAddress, } || UnexpectedError; pub const SendMsgError = SendError || error{ @@ -6422,6 +6429,7 @@ pub fn sendto( .NETUNREACH => return error.NetworkUnreachable, .NOTCONN => return error.SocketNotConnected, .NETDOWN => return error.NetworkSubsystemFailed, + .NXIO => return error.NoSuchDeviceOrAddress, else => |err| return unexpectedErrno(err), } } From 2e7eeb8d6507295fb7bbd178000994e19a9ba4ba Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:57:18 +0200 Subject: [PATCH 2/7] added PReadError = ReadError etc. --- lib/std/posix.zig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 4ca198808b6a..34274b723a36 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -968,6 +968,7 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, + .NXIO => return error.NoSuchDeviceOrAddress, else => |err| return unexpectedErrno(err), } } @@ -1015,7 +1016,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.Unseekable, + .NXIO => return error.NoSuchDeviceOrAddress, .SPIPE => return error.Unseekable, .OVERFLOW => return error.Unseekable, .NOTCAPABLE => return error.AccessDenied, @@ -1048,7 +1049,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.Unseekable, + .NXIO => return error.NoSuchDeviceOrAddress, .SPIPE => return error.Unseekable, .OVERFLOW => return error.Unseekable, else => |err| return unexpectedErrno(err), @@ -1192,9 +1193,9 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.Unseekable, .SPIPE => return error.Unseekable, .OVERFLOW => return error.Unseekable, + .NXIO => return error.NoSuchDeviceOrAddress, else => |err| return unexpectedErrno(err), } } From 9b15b59b81817cac4a748f02b1227c9d88e5c4e5 Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:22:13 +0200 Subject: [PATCH 3/7] added ENXIO for preadAtLeast --- lib/std/zig/system.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index e237cecd5904..396d19d4357c 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -1284,6 +1284,7 @@ fn preadAtLeast(file: fs.File, buf: []u8, offset: u64, min_read_len: usize) !usi error.AccessDenied => return error.Unexpected, error.ProcessNotFound => return error.ProcessNotFound, error.LockViolation => return error.UnableToReadElfFile, + error.NoSuchDeviceOrAddress => return error.NoSuchDeviceOrAddress, }; if (len == 0) return error.UnexpectedEndOfFile; i += len; From 2a3d0505ccbdb26ef175de204ee72a0b90ee1460 Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:34:33 +0200 Subject: [PATCH 4/7] added ENXIO for preadAtLeast (2) --- lib/std/zig/system.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 396d19d4357c..3075fa7cc883 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -1181,6 +1181,7 @@ fn detectAbiAndDynamicLinker( error.UnexpectedEndOfFile, error.UnableToReadElfFile, error.ProcessNotFound, + error.NoSuchDeviceOrAddress, => return defaultAbiAndDynamicLinker(cpu, os, query), else => |e| return e, From 91b2fbf7faa6b3c832821be9cbfdef649c5cff43 Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:46:44 +0200 Subject: [PATCH 5/7] added ENXIO to AbiAndDynamicLinkerFromFileError --- lib/std/zig/system.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 3075fa7cc883..1a959c2f5b12 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -517,6 +517,7 @@ pub const AbiAndDynamicLinkerFromFileError = error{ NameTooLong, ProcessNotFound, StaticElfFile, + NoSuchDeviceOrAddress, }; pub fn abiAndDynamicLinkerFromFile( From f5483a3af18821e07c7f812576b0e779b7148f2a Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:56:58 +0200 Subject: [PATCH 6/7] added ENXIO to AbiAndDynamicLinkerFromFileError (2) --- lib/std/zig/system.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 1a959c2f5b12..7aabc6d19d79 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -926,6 +926,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion { error.Unexpected, error.FileSystem, error.ProcessNotFound, + error.NoSuchDeviceOrAddress, => |e| return e, }; } @@ -1239,6 +1240,7 @@ fn detectAbiAndDynamicLinker( error.UnexpectedEndOfFile, error.NameTooLong, error.StaticElfFile, + error.NoSuchDeviceOrAddress, // Finally, we fall back on the standard path. => |e| { std.log.warn("Encountered error: {s}, falling back to default ABI and dynamic linker.", .{@errorName(e)}); From 4b185b1503b1cbc741b620521ad1bde918846dbf Mon Sep 17 00:00:00 2001 From: Chris Boesch <48591413+chrboesch@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:08:15 +0200 Subject: [PATCH 7/7] changed NoSuchDeviceOrAddress to DeviceOrAddressNotFound --- lib/std/posix.zig | 16 ++++++++-------- lib/std/zig/system.zig | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 34274b723a36..0c793f52e12c 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -836,7 +836,7 @@ pub const ReadError = error{ LockViolation, /// The device is not available or the address is not found. - NoSuchDeviceOrAddress, + DeviceOrAddressNotFound, } || UnexpectedError; /// Returns the number of bytes that were read, which can be less than @@ -904,7 +904,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.NoSuchDeviceOrAddress, + .NXIO => return error.DeviceOrAddressNotFound, else => |err| return unexpectedErrno(err), } } @@ -968,7 +968,7 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.NoSuchDeviceOrAddress, + .NXIO => return error.DeviceOrAddressNotFound, else => |err| return unexpectedErrno(err), } } @@ -1016,7 +1016,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.NoSuchDeviceOrAddress, + .NXIO => return error.DeviceOrAddressNotFound, .SPIPE => return error.Unseekable, .OVERFLOW => return error.Unseekable, .NOTCAPABLE => return error.AccessDenied, @@ -1049,7 +1049,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { .NOTCONN => return error.SocketNotConnected, .CONNRESET => return error.ConnectionResetByPeer, .TIMEDOUT => return error.ConnectionTimedOut, - .NXIO => return error.NoSuchDeviceOrAddress, + .NXIO => return error.DeviceOrAddressNotFound, .SPIPE => return error.Unseekable, .OVERFLOW => return error.Unseekable, else => |err| return unexpectedErrno(err), @@ -1195,7 +1195,7 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize { .TIMEDOUT => return error.ConnectionTimedOut, .SPIPE => return error.Unseekable, .OVERFLOW => return error.Unseekable, - .NXIO => return error.NoSuchDeviceOrAddress, + .NXIO => return error.DeviceOrAddressNotFound, else => |err| return unexpectedErrno(err), } } @@ -6238,7 +6238,7 @@ pub const SendError = error{ ConnectionRefused, /// The device is not available or the address is not found. - NoSuchDeviceOrAddress, + DeviceOrAddressNotFound, } || UnexpectedError; pub const SendMsgError = SendError || error{ @@ -6430,7 +6430,7 @@ pub fn sendto( .NETUNREACH => return error.NetworkUnreachable, .NOTCONN => return error.SocketNotConnected, .NETDOWN => return error.NetworkSubsystemFailed, - .NXIO => return error.NoSuchDeviceOrAddress, + .NXIO => return error.DeviceOrAddressNotFound, else => |err| return unexpectedErrno(err), } } diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig index 7aabc6d19d79..bc0a7b4e96ae 100644 --- a/lib/std/zig/system.zig +++ b/lib/std/zig/system.zig @@ -517,7 +517,7 @@ pub const AbiAndDynamicLinkerFromFileError = error{ NameTooLong, ProcessNotFound, StaticElfFile, - NoSuchDeviceOrAddress, + DeviceOrAddressNotFound, }; pub fn abiAndDynamicLinkerFromFile( @@ -926,7 +926,7 @@ fn glibcVerFromRPath(rpath: []const u8) !std.SemanticVersion { error.Unexpected, error.FileSystem, error.ProcessNotFound, - error.NoSuchDeviceOrAddress, + error.DeviceOrAddressNotFound, => |e| return e, }; } @@ -1183,7 +1183,7 @@ fn detectAbiAndDynamicLinker( error.UnexpectedEndOfFile, error.UnableToReadElfFile, error.ProcessNotFound, - error.NoSuchDeviceOrAddress, + error.DeviceOrAddressNotFound, => return defaultAbiAndDynamicLinker(cpu, os, query), else => |e| return e, @@ -1240,7 +1240,7 @@ fn detectAbiAndDynamicLinker( error.UnexpectedEndOfFile, error.NameTooLong, error.StaticElfFile, - error.NoSuchDeviceOrAddress, + error.DeviceOrAddressNotFound, // Finally, we fall back on the standard path. => |e| { std.log.warn("Encountered error: {s}, falling back to default ABI and dynamic linker.", .{@errorName(e)}); @@ -1288,7 +1288,7 @@ fn preadAtLeast(file: fs.File, buf: []u8, offset: u64, min_read_len: usize) !usi error.AccessDenied => return error.Unexpected, error.ProcessNotFound => return error.ProcessNotFound, error.LockViolation => return error.UnableToReadElfFile, - error.NoSuchDeviceOrAddress => return error.NoSuchDeviceOrAddress, + error.DeviceOrAddressNotFound => return error.DeviceOrAddressNotFound, }; if (len == 0) return error.UnexpectedEndOfFile; i += len;