pub struct LinuxTaskStruct<'a, Driver>{ /* private fields */ }
Expand description
A Linux task struct.
The task_struct
is the process descriptor in the Linux kernel,
representing a task (process or thread).
§Implementation Details
Corresponds to task_struct
.
Implementations§
Source§impl<'a, Driver> LinuxTaskStruct<'a, Driver>
impl<'a, Driver> LinuxTaskStruct<'a, Driver>
Sourcepub fn new(
vmi: VmiState<'a, Driver, LinuxOs<Driver>>,
process: ProcessObject,
) -> Self
pub fn new( vmi: VmiState<'a, Driver, LinuxOs<Driver>>, process: ProcessObject, ) -> Self
Creates a new Linux task struct.
Sourcepub fn flags(&self) -> Result<u32, VmiError>
pub fn flags(&self) -> Result<u32, VmiError>
Returns the process flags.
Process flags in Linux include information about the process state, such as whether it’s exiting, a kernel thread, etc.
§Implementation Details
Corresponds to task_struct.flags
.
Sourcepub fn mm(&self) -> Result<Option<LinuxMmStruct<'a, Driver>>, VmiError>
pub fn mm(&self) -> Result<Option<LinuxMmStruct<'a, Driver>>, VmiError>
Returns the memory descriptor (mm_struct
) of the user-mode process.
The mm_struct
contains the memory management information for a process.
Kernel threads don’t have an mm_struct
and return None
.
§Implementation Details
Corresponds to task_struct->mm
.
Sourcepub fn active_mm(&self) -> Result<LinuxMmStruct<'a, Driver>, VmiError>
pub fn active_mm(&self) -> Result<LinuxMmStruct<'a, Driver>, VmiError>
Returns the active memory context (mm_struct
) of the process.
Used by kernel threads to reference the last used mm_struct
before
entering kernel mode.
If a kernel thread (mm()
is None
) needs memory access,
it temporarily borrows active_mm
from the last scheduled user-space
process.
When the kernel thread exits, the original mm_struct
is restored.
§Implementation Details
Corresponds to task_struct->active_mm
.
Sourcepub fn fs(&self) -> Result<Option<LinuxFsStruct<'a, Driver>>, VmiError>
pub fn fs(&self) -> Result<Option<LinuxFsStruct<'a, Driver>>, VmiError>
Returns the filesystem context (fs_struct
) of the process.
fs_struct
contains:
All threads in the same process share the same fs_struct
, unless
explicitly changed.
Kernel threads don’t have an fs_struct
and return None
.
§Implementation Details
Corresponds to task_struct->fs
.
Sourcepub fn d_path(
&self,
path: &LinuxPath<'_, Driver>,
) -> Result<Option<String>, VmiError>
pub fn d_path( &self, path: &LinuxPath<'_, Driver>, ) -> Result<Option<String>, VmiError>
Constructs the absolute path from a path
structure.
Takes into account the process’s filesystem root when constructing the absolute path.
Returns the resolved path as a string if successful, or None
if the path
could not be resolved (e.g., if the root is null).
§Implementation Details
Concatenates task_struct->fs->root
with the path
structure to construct
the absolute path.
Sourcepub fn image_path(&self) -> Result<Option<String>, VmiError>
pub fn image_path(&self) -> Result<Option<String>, VmiError>
Returns the path of the executable image for a process.
Returns the executable path as a string, or None
for special processes
like kernel threads or those in the process of exiting.
§Implementation Details
Corresponds to d_path(task->mm->exe_file->f_path)
.