Lines Matching full:task
33 /// Returns the currently running task.
39 // leave current task context:
47 unsafe { &*$crate::task::Task::current() }
75 /// Getting the current task and storing it in some struct. The reference count is automatically
79 /// use kernel::{task::Task, sync::aref::ARef};
82 /// creator: ARef<Task>,
96 pub struct Task(pub(crate) Opaque<bindings::task_struct>); struct
98 // SAFETY: By design, the only way to access a `Task` is via the `current` function or via an
99 // `ARef<Task>` obtained through the `AlwaysRefCounted` impl. This means that the only situation in
100 // which a `Task` can be accessed mutably is when the refcount drops to zero and the destructor
102 unsafe impl Send for Task {} implementation
104 // SAFETY: It's OK to access `Task` through shared references from other threads because we're
107 unsafe impl Sync for Task {} implementation
109 /// Represents the [`Task`] in the `current` global.
111 /// This type exists to provide more efficient operations that are only valid on the current task.
112 /// For example, to retrieve the pid-namespace of a task, you must use rcu protection unless it is
113 /// the current task.
117 /// Each value of this type must only be accessed from the task context it was created within.
119 /// Of course, every thread is in a different task context, but for the purposes of this invariant,
120 /// these operations also permanently leave the task context:
136 pub struct CurrentTask(Task, NotThreadSafe);
138 // Make all `Task` methods available on `CurrentTask`.
140 type Target = Task;
142 fn deref(&self) -> &Task { in deref() argument
156 impl Task { implementation
157 /// Returns a raw pointer to the current task.
166 /// Returns a task reference for the currently executing task/thread.
168 /// The recommended way to get the current task/thread is to use the
174 /// within the task context that was active when this function was called. For more details,
179 task: *const CurrentTask, in current() field
187 // the `TaskRef`, which the caller of `Task::current()` has promised will not in current()
188 // outlive the task/thread for which `self.task` is the `current` pointer. Thus, it in current()
190 unsafe { &*self.task } in current()
196 task: Task::current_raw().cast(), in current()
200 /// Returns a raw pointer to the task.
206 /// Returns the PID of the given task.
208 // SAFETY: The pid of a task never changes after initialization, so reading this field is in pid()
213 /// Returns the UID of the given task.
216 // SAFETY: It's always safe to call `task_uid` on a valid task. in uid()
220 /// Returns the effective UID of the given task.
223 // SAFETY: It's always safe to call `task_euid` on a valid task. in euid()
227 /// Determines whether the given task has pending signals.
230 // SAFETY: It's always safe to call `signal_pending` on a valid task. in signal_pending()
234 /// Returns task's pid namespace with elevated reference count
249 /// Returns the given task's pid in the provided pid namespace.
264 /// Wakes up the task.
267 // SAFETY: It's always safe to call `wake_up_process` on a valid task, even if the task in wake_up()
274 /// Access the address space of the current task.
304 /// Access the pid namespace of the current task.
308 /// To access the pid namespace of another task, see [`Task::get_pid_ns`].
313 // on the current task. in active_pid_ns()
320 // The lifetime of `PidNamespace` is bound to `Task` and `struct pid`. in active_pid_ns()
322 // The `PidNamespace` of a `Task` doesn't ever change once the `Task` is alive. in active_pid_ns()
324 // From system call context retrieving the `PidNamespace` for the current task is always in active_pid_ns()
336 /// Returns the group leader of the current task.
337 pub fn group_leader(&self) -> &Task { in group_leader() argument
338 // SAFETY: The group leader of a task never changes while the task is running, and `self` in group_leader()
339 // is the current task, which is guaranteed running. in group_leader()
343 // is running, and the signature of this function ensures that the returned `&Task` can in group_leader()
349 // SAFETY: The type invariants guarantee that `Task` is always refcounted.
350 unsafe impl crate::sync::aref::AlwaysRefCounted for Task { implementation
364 impl PartialEq for Task { implementation
371 impl Eq for Task {} implementation
395 /// Uses the namespace of the current task.