File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ impl Task {
164164 /// Returns the given task's pid in the current pid namespace.
165165 pub fn pid_in_current_ns ( & self ) -> Pid {
166166 // SAFETY: Calling `task_active_pid_ns` with the current task is always safe.
167- let namespace = unsafe { bindings:: task_active_pid_ns ( bindings :: get_current ( ) ) } ;
167+ let namespace = unsafe { bindings:: task_active_pid_ns ( current ! ( ) ) } ;
168168 // SAFETY: We know that `self.0.get()` is valid by the type invariant.
169169 unsafe { bindings:: task_tgid_nr_ns ( self . 0 . get ( ) , namespace) }
170170 }
@@ -176,6 +176,15 @@ impl Task {
176176 // running.
177177 unsafe { bindings:: wake_up_process ( self . 0 . get ( ) ) } ;
178178 }
179+
180+ /// Returns a raw pointer to the underlying C task struct.
181+ ///
182+ /// # Safety
183+ ///
184+ /// Callers must ensure that the pointer is not used after `Task` is invalidated.
185+ pub unsafe fn as_raw ( & self ) -> * const bindings:: task_struct {
186+ self . 0 . get ( )
187+ }
179188}
180189
181190impl Kuid {
You can’t perform that action at this time.
0 commit comments