Lines Matching defs:current
36 macro_rules! current {
40 // leave current task context:
42 // * To return to userspace, the caller must leave the current scope.
48 unsafe { &*$crate::task::Task::current() }
63 /// The following is an example of getting the PID of the current thread with zero additional cost
67 /// let pid = current!().pid();
70 /// Getting the PID of the current process, also zero additional cost:
73 /// let pid = current!().group_leader().pid();
76 /// Getting the current task and storing it in some struct. The reference count is automatically
90 /// creator: ARef::from(&**current!()),
99 // SAFETY: By design, the only way to access a `Task` is via the `current` function or via an
110 /// Represents the [`Task`] in the `current` global.
112 /// This type exists to provide more efficient operations that are only valid on the current task.
114 /// the current task.
158 /// Returns a raw pointer to the current task.
163 // SAFETY: Getting the current pointer is always safe.
169 /// The recommended way to get the current task/thread is to use the
170 /// [`current`] macro because it is safe.
178 pub unsafe fn current() -> impl Deref<Target = CurrentTask> {
188 // the `TaskRef`, which the caller of `Task::current()` has promised will not
189 // outlive the task/thread for which `self.task` is the `current` pointer. Thus, it
287 /// Access the address space of the current task.
292 // SAFETY: The `mm` field of `current` is not modified from other threads, so reading it is
300 // SAFETY: If `current->mm` is non-null, then it references a valid mm with a non-zero
302 // `CurrentTask`, so it cannot escape the scope in which the current pointer was obtained.
312 // In either case, it's not possible to read `current->mm` and keep using it after the
317 /// Access the pid namespace of the current task.
326 // on the current task.
337 // From system call context retrieving the `PidNamespace` for the current task is always
339 // `PidNamespace` after `release_task()` for current will return `NULL` but no codepath
342 // SAFETY: If `current`'s pid ns is non-null, then it references a valid pid ns.
344 // escape the scope in which the current pointer was obtained, e.g. it cannot live past a
366 /// Get the current euid.
387 /// Uses the namespace of the current task.