pub trait Os: Send {
type ProcessType<'a>: Process + MemoryView + 'a
where Self: 'a;
type IntoProcessType: Process + MemoryView + Clone + 'static;
Show 32 methods
// Required 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(
&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;
// Provided methods
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(
&mut self,
addr: Address
) -> Result<Self::ProcessType<'_>> { ... }
fn process_by_name(&mut self, name: &str) -> Result<Self::ProcessType<'_>> { ... }
fn process_by_pid(&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.
Required Associated Types§
type ProcessType<'a>: Process + MemoryView + 'a where Self: 'a
type IntoProcessType: Process + MemoryView + Clone + 'static
Required Methods§
sourcefn 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.
sourcefn 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
sourcefn process_by_info(
&mut self,
info: ProcessInfo
) -> Result<Self::ProcessType<'_>>
fn process_by_info( &mut self, info: ProcessInfo ) -> Result<Self::ProcessType<'_>>
Construct a process by its info, borrowing the OS
It will share the underlying memory resources
sourcefn 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
sourcefn 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.
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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§
sourcefn 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
sourcefn 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.
sourcefn process_info_list(&mut self) -> Result<Vec<ProcessInfo>>
fn process_info_list(&mut self) -> Result<Vec<ProcessInfo>>
Retrieves a process list
sourcefn 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
.
sourcefn 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
sourcefn process_by_address(&mut self, addr: Address) -> Result<Self::ProcessType<'_>>
fn process_by_address(&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.
sourcefn process_by_name(&mut self, name: &str) -> Result<Self::ProcessType<'_>>
fn process_by_name(&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
.
sourcefn process_by_pid(&mut self, pid: Pid) -> Result<Self::ProcessType<'_>>
fn process_by_pid(&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.
sourcefn 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.
sourcefn 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
.
sourcefn 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.
sourcefn 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.
sourcefn 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
sourcefn module_list(&mut self) -> Result<Vec<ModuleInfo>>
fn module_list(&mut self) -> Result<Vec<ModuleInfo>>
Retrieves a module list for the OS
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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
sourcefn 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