diff options
Diffstat (limited to 'rust/kernel/task.rs')
| -rw-r--r-- | rust/kernel/task.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index c2b3457b700c..3336df493dec 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -210,6 +210,13 @@ impl Task { unsafe { *ptr::addr_of!((*self.as_ptr()).pid) } } + /// Returns the TGID (Thread Group ID / Process ID) of the given task. + pub fn tgid(&self) -> Pid { + // SAFETY: The tgid of a task never changes after initialization, so reading this field is + // not a data race. + unsafe { *ptr::addr_of!((*self.as_ptr()).tgid) } + } + /// Returns the objective real UID of the given task. #[inline] pub fn uid(&self) -> Kuid { |
