pub trait OsInner<'a>: Send {
type ProcessType: Process + MemoryView + 'a;
type IntoProcessType: Process + MemoryView + Clone + 'static;
Show 32 methods
fn process_address_list_callback(
&mut self,
callback: AddressCallback<'_>
) -> Result<()>;
fn process_info_by_address(
&mut self,
address: Address
) -> Result<ProcessInfo>;
fn process_by_info(
&'a mut self,
info: ProcessInfo
) -> Result<Self::ProcessType>;
fn into_process_by_info(
self,
info: ProcessInfo
) -> Result<Self::IntoProcessType>;
fn module_address_list_callback(
&mut self,
callback: AddressCallback<'_>
) -> Result<()>;
fn module_by_address(&mut self, address: Address) -> Result<ModuleInfo>;
fn primary_module_address(&mut self) -> Result<Address>;
fn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: ImportCallback<'_>
) -> Result<()>;
fn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: ExportCallback<'_>
) -> Result<()>;
fn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: SectionCallback<'_>
) -> Result<()>;
fn info(&self) -> &OsInfo;
fn process_address_list(&mut self) -> Result<Vec<Address>> { ... }
fn process_info_list_callback(
&mut self,
callback: ProcessInfoCallback<'_>
) -> Result<()> { ... }
fn process_info_list(&mut self) -> Result<Vec<ProcessInfo>> { ... }
fn process_info_by_name(&mut self, name: &str) -> Result<ProcessInfo> { ... }
fn process_info_by_pid(&mut self, pid: Pid) -> Result<ProcessInfo> { ... }
fn process_by_address(
&'a mut self,
addr: Address
) -> Result<Self::ProcessType> { ... }
fn process_by_name(&'a mut self, name: &str) -> Result<Self::ProcessType> { ... }
fn process_by_pid(&'a mut self, pid: Pid) -> Result<Self::ProcessType> { ... }
fn into_process_by_address(
self,
addr: Address
) -> Result<Self::IntoProcessType>
where
Self: Sized,
{ ... }
fn into_process_by_name(self, name: &str) -> Result<Self::IntoProcessType>
where
Self: Sized,
{ ... }
fn into_process_by_pid(self, pid: Pid) -> Result<Self::IntoProcessType>
where
Self: Sized,
{ ... }
fn module_list_callback(
&mut self,
callback: ModuleInfoCallback<'_>
) -> Result<()> { ... }
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo> { ... }
fn module_list(&mut self) -> Result<Vec<ModuleInfo>> { ... }
fn primary_module(&mut self) -> Result<ModuleInfo> { ... }
fn module_import_list(
&mut self,
info: &ModuleInfo
) -> Result<Vec<ImportInfo>> { ... }
fn module_export_list(
&mut self,
info: &ModuleInfo
) -> Result<Vec<ExportInfo>> { ... }
fn module_section_list(
&mut self,
info: &ModuleInfo
) -> Result<Vec<SectionInfo>> { ... }
fn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ImportInfo> { ... }
fn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ExportInfo> { ... }
fn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<SectionInfo> { ... }
}
Expand description
High level OS trait implemented by OS layers.
This trait provides all necessary functions for handling an OS, retrieving processes, and moving resources into processes.
There are also methods for accessing system level modules.
Associated Types
type ProcessType: Process + MemoryView + 'a
type IntoProcessType: Process + MemoryView + Clone + 'static
Required methods
fn process_address_list_callback(
&mut self,
callback: AddressCallback<'_>
) -> Result<()>
fn process_address_list_callback(
&mut self,
callback: AddressCallback<'_>
) -> Result<()>
Walks a process list and calls a callback for each process structure address
The callback is fully opaque. We need this style so that C FFI can work seamlessly.
fn process_info_by_address(&mut self, address: Address) -> Result<ProcessInfo>
fn process_info_by_address(&mut self, address: Address) -> Result<ProcessInfo>
Find process information by its internal address
fn process_by_info(&'a mut self, info: ProcessInfo) -> Result<Self::ProcessType>
fn process_by_info(&'a mut self, info: ProcessInfo) -> Result<Self::ProcessType>
Construct a process by its info, borrowing the OS
It will share the underlying memory resources
fn into_process_by_info(
self,
info: ProcessInfo
) -> Result<Self::IntoProcessType>
fn into_process_by_info(
self,
info: ProcessInfo
) -> Result<Self::IntoProcessType>
Construct a process by its info, consuming the OS
This function will consume the Kernel instance and move its resources into the process
fn module_address_list_callback(
&mut self,
callback: AddressCallback<'_>
) -> Result<()>
fn module_address_list_callback(
&mut self,
callback: AddressCallback<'_>
) -> Result<()>
Walks the OS module list and calls the provided callback for each module structure address
Arguments
callback
- where to pass each matching module to. This is an opaque callback.
fn module_by_address(&mut self, address: Address) -> Result<ModuleInfo>
fn module_by_address(&mut self, address: Address) -> Result<ModuleInfo>
Retrieves a module by its structure address
Arguments
address
- address where module’s information resides in
fn primary_module_address(&mut self) -> Result<Address>
fn primary_module_address(&mut self) -> Result<Address>
Retrieves address of the primary module of the OS
This will generally be for the main kernel process/module
fn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: ImportCallback<'_>
) -> Result<()>
fn module_import_list_callback(
&mut self,
info: &ModuleInfo,
callback: ImportCallback<'_>
) -> Result<()>
Retrieves a list of all imports of a given module
fn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: ExportCallback<'_>
) -> Result<()>
fn module_export_list_callback(
&mut self,
info: &ModuleInfo,
callback: ExportCallback<'_>
) -> Result<()>
Retrieves a list of all exports of a given module
fn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: SectionCallback<'_>
) -> Result<()>
fn module_section_list_callback(
&mut self,
info: &ModuleInfo,
callback: SectionCallback<'_>
) -> Result<()>
Retrieves a list of all sections of a given module
Provided methods
fn process_address_list(&mut self) -> Result<Vec<Address>>
fn process_address_list(&mut self) -> Result<Vec<Address>>
Retrieves a process address list
This will be a list of unique internal addresses for underlying process structures
fn process_info_list_callback(
&mut self,
callback: ProcessInfoCallback<'_>
) -> Result<()>
fn process_info_list_callback(
&mut self,
callback: ProcessInfoCallback<'_>
) -> Result<()>
Walks a process list and calls a callback for each process
The callback is fully opaque. We need this style so that C FFI can work seamlessly.
fn process_info_list(&mut self) -> Result<Vec<ProcessInfo>>
fn process_info_list(&mut self) -> Result<Vec<ProcessInfo>>
Retrieves a process list
fn process_info_by_name(&mut self, name: &str) -> Result<ProcessInfo>
fn process_info_by_name(&mut self, name: &str) -> Result<ProcessInfo>
Find process information by its name
Remarks:
This function only returns processes whose state is not ProcessState::Dead
.
fn process_info_by_pid(&mut self, pid: Pid) -> Result<ProcessInfo>
fn process_info_by_pid(&mut self, pid: Pid) -> Result<ProcessInfo>
Find process information by its ID
fn process_by_address(&'a mut self, addr: Address) -> Result<Self::ProcessType>
fn process_by_address(&'a mut self, addr: Address) -> Result<Self::ProcessType>
Creates a process by its internal address, borrowing the OS
It will share the underlying memory resources
If no process with the specified address can be found this function will return an Error.
This function can be useful for quickly accessing a process.
fn process_by_name(&'a mut self, name: &str) -> Result<Self::ProcessType>
fn process_by_name(&'a mut self, name: &str) -> Result<Self::ProcessType>
Creates a process by its name, borrowing the OS
It will share the underlying memory resources
If no process with the specified name can be found this function will return an Error.
This function can be useful for quickly accessing a process.
Remarks:
This function only returns processes whose state is not ProcessState::Dead
.
fn process_by_pid(&'a mut self, pid: Pid) -> Result<Self::ProcessType>
fn process_by_pid(&'a mut self, pid: Pid) -> Result<Self::ProcessType>
Creates a process by its ID, borrowing the OS
It will share the underlying memory resources
If no process with the specified ID can be found this function will return an Error.
This function can be useful for quickly accessing a process.
fn into_process_by_address(self, addr: Address) -> Result<Self::IntoProcessType> where
Self: Sized,
fn into_process_by_address(self, addr: Address) -> Result<Self::IntoProcessType> where
Self: Sized,
Creates a process by its internal address, consuming the OS
It will consume the OS and not affect memory usage
If no process with the specified address can be found this function will return an Error.
This function can be useful for quickly accessing a process.
fn into_process_by_name(self, name: &str) -> Result<Self::IntoProcessType> where
Self: Sized,
fn into_process_by_name(self, name: &str) -> Result<Self::IntoProcessType> where
Self: Sized,
Creates a process by its name, consuming the OS
It will consume the OS and not affect memory usage
If no process with the specified name can be found this function will return an Error.
This function can be useful for quickly accessing a process.
Remarks:
This function only returns processes whose state is not ProcessState::Dead
.
fn into_process_by_pid(self, pid: Pid) -> Result<Self::IntoProcessType> where
Self: Sized,
fn into_process_by_pid(self, pid: Pid) -> Result<Self::IntoProcessType> where
Self: Sized,
Creates a process by its ID, consuming the OS
It will consume the OS and not affect memory usage
If no process with the specified ID can be found this function will return an Error.
This function can be useful for quickly accessing a process.
fn module_list_callback(
&mut self,
callback: ModuleInfoCallback<'_>
) -> Result<()>
fn module_list_callback(
&mut self,
callback: ModuleInfoCallback<'_>
) -> Result<()>
Walks the OS module list and calls the provided callback for each module
Arguments
callback
- where to pass each matching module to. This is an opaque callback.
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo>
fn module_by_name(&mut self, name: &str) -> Result<ModuleInfo>
Finds a OS module by its name
This function can be useful for quickly accessing a specific module
fn module_list(&mut self) -> Result<Vec<ModuleInfo>>
fn module_list(&mut self) -> Result<Vec<ModuleInfo>>
Retrieves a module list for the OS
fn primary_module(&mut self) -> Result<ModuleInfo>
fn primary_module(&mut self) -> Result<ModuleInfo>
Retrieves information for the primary module of the OS
This will generally be for the main kernel process/module
fn module_import_list(&mut self, info: &ModuleInfo) -> Result<Vec<ImportInfo>>
fn module_import_list(&mut self, info: &ModuleInfo) -> Result<Vec<ImportInfo>>
Retrieves a list of all imports of a given module
fn module_export_list(&mut self, info: &ModuleInfo) -> Result<Vec<ExportInfo>>
fn module_export_list(&mut self, info: &ModuleInfo) -> Result<Vec<ExportInfo>>
Retrieves a list of all exports of a given module
fn module_section_list(&mut self, info: &ModuleInfo) -> Result<Vec<SectionInfo>>
fn module_section_list(&mut self, info: &ModuleInfo) -> Result<Vec<SectionInfo>>
Retrieves a list of all sections of a given module
fn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ImportInfo>
fn module_import_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ImportInfo>
Finds a single import of a given module by its name
fn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ExportInfo>
fn module_export_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<ExportInfo>
Finds a single export of a given module by its name
fn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<SectionInfo>
fn module_section_by_name(
&mut self,
info: &ModuleInfo,
name: &str
) -> Result<SectionInfo>
Finds a single section of a given module by its name