File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ impl Task {
164
164
/// Returns the given task's pid in the current pid namespace.
165
165
pub fn pid_in_current_ns ( & self ) -> Pid {
166
166
// 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 ! ( ) ) } ;
168
168
// SAFETY: We know that `self.0.get()` is valid by the type invariant.
169
169
unsafe { bindings:: task_tgid_nr_ns ( self . 0 . get ( ) , namespace) }
170
170
}
@@ -176,6 +176,15 @@ impl Task {
176
176
// running.
177
177
unsafe { bindings:: wake_up_process ( self . 0 . get ( ) ) } ;
178
178
}
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
+ }
179
188
}
180
189
181
190
impl Kuid {
You can’t perform that action at this time.
0 commit comments