From d7a8671e7e86bd832966053116a838f55ee6fbdb Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 21 May 2024 01:07:59 +0800 Subject: [PATCH] allow a process to identify itself this makes debugging code a lot more ergonomic. I don't think this impacts security... --- kernel/src/arch/riscv/process.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/src/arch/riscv/process.rs b/kernel/src/arch/riscv/process.rs index 45908d123..4b7793984 100644 --- a/kernel/src/arch/riscv/process.rs +++ b/kernel/src/arch/riscv/process.rs @@ -543,6 +543,11 @@ impl Process { } None } + + /// This is used by debugging routines to sanity check state, which are typically #[cfg]'d out + /// but with complicated overlapping rules that constantly change. Hence, the #[allow(dead_code)]. + #[allow(dead_code)] + pub fn pid(&self) -> PID { self.pid } } impl Thread {