Skip to contentSkip to conversation

rust: error: add ERESTARTSYS error code

PATCH In review Alice Ryhl 2 participants 2 messages May 3, 2023 Rust

lore
Share & tools
lore

Alice Ryhl

author reviewer
#0 lore raw

PATCH 1/1 rust: error: add ERESTARTSYS error code

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.

---
 rust/kernel/error.rs | 1 +
 1 file changed, 1 insertion(+)
rust/kernel/error.rs +1 -0
index 5f4114b30b94..cbde1b2d29f4 100644
@@ -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.

base-commit: ea76e08f4d901a450619831a255e9e0a4c0ed162

Signature · 1 line
2.40.1.495.gc816e09b53d-goog
#1 lore raw
Quoted 3 lines · Alice Ryhl

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