Lines Matching defs:CurrentTask
39 // caller's scope. The following mechanisms ensure that the resulting `&CurrentTask` cannot
46 // closure to be `Send`, so the `NotThreadSafe` field of `CurrentTask` ensures that the
47 // `&CurrentTask` cannot cross the scope in either direction.
132 /// This means that a `CurrentTask` obtained before a `kthread_use_mm()` call may be used again
134 /// Conversely, a `CurrentTask` obtained between a `kthread_use_mm()`/`kthread_unuse_mm()` pair
137 pub struct CurrentTask(Task, NotThreadSafe);
139 // Make all `Task` methods available on `CurrentTask`.
140 impl Deref for CurrentTask {
174 /// Callers must ensure that the returned object is only used to access a [`CurrentTask`]
176 /// see the invariants section for [`CurrentTask`].
178 pub unsafe fn current() -> impl Deref<Target = CurrentTask> {
180 task: *const CurrentTask,
184 type Target = CurrentTask;
190 // is okay to return a `CurrentTask` reference here.
196 // CAST: The layout of `struct task_struct` and `CurrentTask` is identical.
286 impl CurrentTask {
302 // `CurrentTask`, so it cannot escape the scope in which the current pointer was obtained.
306 // * If the `&CurrentTask` was created before `kthread_use_mm()`, then it cannot be
308 // `NotThreadSafe` field of `CurrentTask`.
309 // * If the `&CurrentTask` was created within a `kthread_use_mm()`/`kthread_unuse_mm()`
310 // scope, then the `&CurrentTask` cannot escape that scope, so the returned `&MmWithUser`
343 // Furthermore, the returned `&PidNamespace` borrows from this `CurrentTask`, so it cannot