* [PATCH] rust: error: add remaining error codes
@ 2026-06-29 18:30 Timur Tabi
2026-06-30 8:31 ` Alexandre Courbot
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Timur Tabi @ 2026-06-29 18:30 UTC (permalink / raw)
To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux
Add all of the remaining error codes from include/uapi/asm-generic/errno.h.
Previous updates to error.rs have been piecemeal -- adding single error
codes as needed. Instead, we can avoid future problems by adding all
the remaining error code in one swoop.
EDEADLOCK and EWOULDBLOCK are intentionally left out: they are just
deprecated compatibility aliases of EDEADLK and EAGAIN, kept around for
non-Linux/POSIX code, and have no use in new kernel code.
Signed-off-by: Timur Tabi <ttabi@nvidia.com>
---
rust/kernel/error.rs | 105 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index a56ba6309594..f3096d7c73ac 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -30,6 +30,8 @@ macro_rules! declare_err {
};
}
+ // From include/uapi/asm-generic/errno-base.h
+
declare_err!(EPERM, "Operation not permitted.");
declare_err!(ENOENT, "No such file or directory.");
declare_err!(ESRCH, "No such process.");
@@ -64,9 +66,112 @@ macro_rules! declare_err {
declare_err!(EPIPE, "Broken pipe.");
declare_err!(EDOM, "Math argument out of domain of func.");
declare_err!(ERANGE, "Math result not representable.");
+
+ // From include/uapi/asm-generic/errno.h
+
+ declare_err!(EDEADLK, "Resource deadlock would occur.");
+ declare_err!(ENAMETOOLONG, "File name too long.");
+ declare_err!(ENOLCK, "No record locks available.");
+ declare_err!(ENOSYS, "Invalid system call number.");
+ declare_err!(ENOTEMPTY, "Directory not empty.");
+ declare_err!(ELOOP, "Too many symbolic links encountered.");
+ declare_err!(ENOMSG, "No message of desired type.");
+ declare_err!(EIDRM, "Identifier removed.");
+ declare_err!(ECHRNG, "Channel number out of range.");
+ declare_err!(EL2NSYNC, "Level 2 not synchronized.");
+ declare_err!(EL3HLT, "Level 3 halted.");
+ declare_err!(EL3RST, "Level 3 reset.");
+ declare_err!(ELNRNG, "Link number out of range.");
+ declare_err!(EUNATCH, "Protocol driver not attached.");
+ declare_err!(ENOCSI, "No CSI structure available.");
+ declare_err!(EL2HLT, "Level 2 halted.");
+ declare_err!(EBADE, "Invalid exchange.");
+ declare_err!(EBADR, "Invalid request descriptor.");
+ declare_err!(EXFULL, "Exchange full.");
+ declare_err!(ENOANO, "No anode.");
+ declare_err!(EBADRQC, "Invalid request code.");
+ declare_err!(EBADSLT, "Invalid slot.");
+ declare_err!(EBFONT, "Bad font file format.");
+ declare_err!(ENOSTR, "Device not a stream.");
+ declare_err!(ENODATA, "No data available.");
+ declare_err!(ETIME, "Timer expired.");
+ declare_err!(ENOSR, "Out of streams resources.");
+ declare_err!(ENONET, "Machine is not on the network.");
+ declare_err!(ENOPKG, "Package not installed.");
+ declare_err!(EREMOTE, "Object is remote.");
+ declare_err!(ENOLINK, "Link has been severed.");
+ declare_err!(EADV, "Advertise error.");
+ declare_err!(ESRMNT, "Srmount error.");
+ declare_err!(ECOMM, "Communication error on send.");
+ declare_err!(EPROTO, "Protocol error.");
+ declare_err!(EMULTIHOP, "Multihop attempted.");
+ declare_err!(EDOTDOT, "RFS specific error.");
+ declare_err!(EBADMSG, "Not a data message.");
+ declare_err!(EFSBADCRC, "Bad CRC detected.");
declare_err!(EOVERFLOW, "Value too large for defined data type.");
+ declare_err!(ENOTUNIQ, "Name not unique on network.");
+ declare_err!(EBADFD, "File descriptor in bad state.");
+ declare_err!(EREMCHG, "Remote address changed.");
+ declare_err!(ELIBACC, "Can not access a needed shared library.");
+ declare_err!(ELIBBAD, "Accessing a corrupted shared library.");
+ declare_err!(ELIBSCN, ".lib section in a.out corrupted.");
+ declare_err!(ELIBMAX, "Attempting to link in too many shared libraries.");
+ declare_err!(ELIBEXEC, "Cannot exec a shared library directly.");
+ declare_err!(EILSEQ, "Illegal byte sequence.");
+ declare_err!(ERESTART, "Interrupted system call should be restarted.");
+ declare_err!(ESTRPIPE, "Streams pipe error.");
+ declare_err!(EUSERS, "Too many users.");
+ declare_err!(ENOTSOCK, "Socket operation on non-socket.");
+ declare_err!(EDESTADDRREQ, "Destination address required.");
declare_err!(EMSGSIZE, "Message too long.");
+ declare_err!(EPROTOTYPE, "Protocol wrong type for socket.");
+ declare_err!(ENOPROTOOPT, "Protocol not available.");
+ declare_err!(EPROTONOSUPPORT, "Protocol not supported.");
+ declare_err!(ESOCKTNOSUPPORT, "Socket type not supported.");
+ declare_err!(EOPNOTSUPP, "Operation not supported on transport endpoint.");
+ declare_err!(EPFNOSUPPORT, "Protocol family not supported.");
+ declare_err!(EAFNOSUPPORT, "Address family not supported by protocol.");
+ declare_err!(EADDRINUSE, "Address already in use.");
+ declare_err!(EADDRNOTAVAIL, "Cannot assign requested address.");
+ declare_err!(ENETDOWN, "Network is down.");
+ declare_err!(ENETUNREACH, "Network is unreachable.");
+ declare_err!(ENETRESET, "Network dropped connection because of reset.");
+ declare_err!(ECONNABORTED, "Software caused connection abort.");
+ declare_err!(ECONNRESET, "Connection reset by peer.");
+ declare_err!(ENOBUFS, "No buffer space available.");
+ declare_err!(EISCONN, "Transport endpoint is already connected.");
+ declare_err!(ENOTCONN, "Transport endpoint is not connected.");
+ declare_err!(ESHUTDOWN, "Cannot send after transport endpoint shutdown.");
+ declare_err!(ETOOMANYREFS, "Too many references: cannot splice.");
declare_err!(ETIMEDOUT, "Connection timed out.");
+ declare_err!(ECONNREFUSED, "Connection refused.");
+ declare_err!(EHOSTDOWN, "Host is down.");
+ declare_err!(EHOSTUNREACH, "No route to host.");
+ declare_err!(EALREADY, "Operation already in progress.");
+ declare_err!(EINPROGRESS, "Operation now in progress.");
+ declare_err!(ESTALE, "Stale file handle.");
+ declare_err!(EUCLEAN, "Structure needs cleaning.");
+ declare_err!(EFSCORRUPTED, "Filesystem is corrupted.");
+ declare_err!(ENOTNAM, "Not a XENIX named type file.");
+ declare_err!(ENAVAIL, "No XENIX semaphores available.");
+ declare_err!(EISNAM, "Is a named type file.");
+ declare_err!(EREMOTEIO, "Remote I/O error.");
+ declare_err!(EDQUOT, "Quota exceeded.");
+ declare_err!(ENOMEDIUM, "No medium found.");
+ declare_err!(EMEDIUMTYPE, "Wrong medium type.");
+ declare_err!(ECANCELED, "Operation Canceled.");
+ declare_err!(ENOKEY, "Required key not available.");
+ declare_err!(EKEYEXPIRED, "Key has expired.");
+ declare_err!(EKEYREVOKED, "Key has been revoked.");
+ declare_err!(EKEYREJECTED, "Key was rejected by service.");
+ declare_err!(EOWNERDEAD, "Owner died.");
+ declare_err!(ENOTRECOVERABLE, "State not recoverable.");
+ declare_err!(ERFKILL, "Operation not possible due to RF-kill.");
+ declare_err!(EHWPOISON, "Memory page has hardware error.");
+ declare_err!(EFTYPE, "Wrong file type for the intended operation.");
+
+ // From include/linux/errno.h
+
declare_err!(ERESTARTSYS, "Restart the system call.");
declare_err!(ERESTARTNOINTR, "System call was interrupted by a signal and will be restarted.");
declare_err!(ERESTARTNOHAND, "Restart if no handler.");
--
2.54.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] rust: error: add remaining error codes
2026-06-29 18:30 [PATCH] rust: error: add remaining error codes Timur Tabi
@ 2026-06-30 8:31 ` Alexandre Courbot
2026-06-30 10:45 ` Gary Guo
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Alexandre Courbot @ 2026-06-30 8:31 UTC (permalink / raw)
To: Timur Tabi
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Onur Özkan, rust-for-linux
On Tue Jun 30, 2026 at 3:30 AM JST, Timur Tabi wrote:
> Add all of the remaining error codes from include/uapi/asm-generic/errno.h.
>
> Previous updates to error.rs have been piecemeal -- adding single error
> codes as needed. Instead, we can avoid future problems by adding all
> the remaining error code in one swoop.
>
> EDEADLOCK and EWOULDBLOCK are intentionally left out: they are just
> deprecated compatibility aliases of EDEADLK and EAGAIN, kept around for
> non-Linux/POSIX code, and have no use in new kernel code.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Nice, no more ad-hoc patches to add newly required error codes! :) I
remember having some of these conflict in the past.
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] rust: error: add remaining error codes
2026-06-29 18:30 [PATCH] rust: error: add remaining error codes Timur Tabi
2026-06-30 8:31 ` Alexandre Courbot
@ 2026-06-30 10:45 ` Gary Guo
2026-06-30 12:39 ` Danilo Krummrich
2026-06-30 12:47 ` Fiona Behrens
3 siblings, 0 replies; 5+ messages in thread
From: Gary Guo @ 2026-06-30 10:45 UTC (permalink / raw)
To: Timur Tabi, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux
On Mon Jun 29, 2026 at 7:30 PM BST, Timur Tabi wrote:
> Add all of the remaining error codes from include/uapi/asm-generic/errno.h.
>
> Previous updates to error.rs have been piecemeal -- adding single error
> codes as needed. Instead, we can avoid future problems by adding all
> the remaining error code in one swoop.
>
> EDEADLOCK and EWOULDBLOCK are intentionally left out: they are just
> deprecated compatibility aliases of EDEADLK and EAGAIN, kept around for
> non-Linux/POSIX code, and have no use in new kernel code.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> rust/kernel/error.rs | 105 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 105 insertions(+)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: error: add remaining error codes
2026-06-29 18:30 [PATCH] rust: error: add remaining error codes Timur Tabi
2026-06-30 8:31 ` Alexandre Courbot
2026-06-30 10:45 ` Gary Guo
@ 2026-06-30 12:39 ` Danilo Krummrich
2026-06-30 12:47 ` Fiona Behrens
3 siblings, 0 replies; 5+ messages in thread
From: Danilo Krummrich @ 2026-06-30 12:39 UTC (permalink / raw)
To: Timur Tabi
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Daniel Almeida, Tamir Duberstein, Alexandre Courbot,
Onur Özkan, rust-for-linux
On 6/29/26 8:30 PM, Timur Tabi wrote:
> Add all of the remaining error codes from include/uapi/asm-generic/errno.h.
>
> Previous updates to error.rs have been piecemeal -- adding single error
> codes as needed. Instead, we can avoid future problems by adding all
> the remaining error code in one swoop.
>
> EDEADLOCK and EWOULDBLOCK are intentionally left out: they are just
> deprecated compatibility aliases of EDEADLK and EAGAIN, kept around for
> non-Linux/POSIX code, and have no use in new kernel code.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Seems reasonable,
Acked-by: Danilo Krummrich <dakr@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] rust: error: add remaining error codes
2026-06-29 18:30 [PATCH] rust: error: add remaining error codes Timur Tabi
` (2 preceding siblings ...)
2026-06-30 12:39 ` Danilo Krummrich
@ 2026-06-30 12:47 ` Fiona Behrens
3 siblings, 0 replies; 5+ messages in thread
From: Fiona Behrens @ 2026-06-30 12:47 UTC (permalink / raw)
To: Timur Tabi
Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
Danilo Krummrich, Daniel Almeida, Tamir Duberstein,
Alexandre Courbot, Onur Özkan, rust-for-linux
Timur Tabi <ttabi@nvidia.com> writes:
> Add all of the remaining error codes from include/uapi/asm-generic/errno.h.
>
> Previous updates to error.rs have been piecemeal -- adding single error
> codes as needed. Instead, we can avoid future problems by adding all
> the remaining error code in one swoop.
>
> EDEADLOCK and EWOULDBLOCK are intentionally left out: they are just
> deprecated compatibility aliases of EDEADLK and EAGAIN, kept around for
> non-Linux/POSIX code, and have no use in new kernel code.
>
> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-30 12:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 18:30 [PATCH] rust: error: add remaining error codes Timur Tabi
2026-06-30 8:31 ` Alexandre Courbot
2026-06-30 10:45 ` Gary Guo
2026-06-30 12:39 ` Danilo Krummrich
2026-06-30 12:47 ` Fiona Behrens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox