[v1] rust: error: add ERESTARTSYS error code

Message ID 20230503083941.499090-1-aliceryhl@google.com
State New
Headers
Series [v1] rust: error: add ERESTARTSYS error code |

Commit Message

Alice Ryhl May 3, 2023, 8:39 a.m. UTC
  This error code was probably excluded here originally because it never
actually reaches user programs when a syscall returns it. However, from
the perspective of a kernel driver, it is still a perfectly valid error
type, that the driver might need to return. E.g., this can be necessary
when a signal occurs during sleep.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
 rust/kernel/error.rs | 1 +
 1 file changed, 1 insertion(+)


base-commit: ea76e08f4d901a450619831a255e9e0a4c0ed162
  

Comments

Miguel Ojeda May 3, 2023, 9:50 a.m. UTC | #1
On Wed, May 3, 2023 at 10:40 AM Alice Ryhl <aliceryhl@google.com> wrote:
>
> This error code was probably excluded here originally because it never
> actually reaches user programs when a syscall returns it. However, from

The reason is that commit 266def2a0f5b ("rust: error: add codes from
`errno-base.h`") only introduced the ones from
`include/uapi/asm-generic/errno-base.h`, but not the ones from
`include/linux/errno.h` (or `include/uapi/asm-generic/errno.h`).

Given this is an independent patch, should we introduce the rest too, at once?

Cheers,
Miguel
  

Patch

diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index 5f4114b30b94..cbde1b2d29f4 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -58,6 +58,7 @@  pub mod code {
     declare_err!(EPIPE, "Broken pipe.");
     declare_err!(EDOM, "Math argument out of domain of func.");
     declare_err!(ERANGE, "Math result not representable.");
+    declare_err!(ERESTARTSYS, "Restart the system call.");
 }
 
 /// Generic integer kernel error.