mirror of
https://github.com/JakeHillion/scx.git
synced 2024-11-27 03:40:23 +00:00
uei: Expose exit code enums from user_exit_info.rs
Schedulers and the kernel can include an exit code when exiting a scheduler. There are some built-in codes that can be specified: SCX_ECODE_RSN_HOTPLUG, and SCX_ECODE_ACT_RESTART. Some schedulers may want to check the exit code against these values, so let's export them from user_exit_info.rs. We use lazy_static so that we can read the values for the enum for the currently-running kernel. Signed-off-by: David Vernet <void@manifault.com>
This commit is contained in:
parent
971ea6629e
commit
c6cc59e8b4
@ -44,6 +44,8 @@ pub use builder::Builder;
|
||||
mod user_exit_info;
|
||||
pub use user_exit_info::ScxExitKind;
|
||||
pub use user_exit_info::ScxConsts;
|
||||
pub use user_exit_info::SCX_ECODE_RSN_HOTPLUG;
|
||||
pub use user_exit_info::SCX_ECODE_ACT_RESTART;
|
||||
pub use user_exit_info::UeiDumpPtr;
|
||||
pub use user_exit_info::UserExitInfo;
|
||||
pub use user_exit_info::UEI_DUMP_PTR_MUTEX;
|
||||
|
@ -3,6 +3,7 @@
|
||||
// This software may be used and distributed according to the terms of the
|
||||
// GNU General Public License version 2.
|
||||
use crate::bindings;
|
||||
use crate::compat;
|
||||
use anyhow::bail;
|
||||
use anyhow::Result;
|
||||
use std::ffi::CStr;
|
||||
@ -18,6 +19,16 @@ pub static UEI_DUMP_PTR_MUTEX: Mutex<UeiDumpPtr> = Mutex::new(UeiDumpPtr {
|
||||
ptr: std::ptr::null(),
|
||||
});
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref SCX_ECODE_RSN_HOTPLUG: u64 =
|
||||
compat::read_enum("scx_exit_code", "SCX_ECODE_RSN_HOTPLUG").unwrap_or(0);
|
||||
}
|
||||
|
||||
lazy_static::lazy_static! {
|
||||
pub static ref SCX_ECODE_ACT_RESTART: u64 =
|
||||
compat::read_enum("scx_exit_code", "SCX_ECODE_ACT_RESTART").unwrap_or(0);
|
||||
}
|
||||
|
||||
pub enum ScxExitKind {
|
||||
None = bindings::scx_exit_kind_SCX_EXIT_NONE as isize,
|
||||
Done = bindings::scx_exit_kind_SCX_EXIT_DONE as isize,
|
||||
|
Loading…
Reference in New Issue
Block a user