Struct procfs::process::Task

source ·
pub struct Task {
    pub pid: i32,
    pub tid: i32,
    /* private fields */
}
Expand description

A task (aka Thread) inside of a Process

Created by Process::tasks, tasks in general are similar to Processes and should have mostly the same fields.

Fields§

§pid: i32

The ID of the process that this task belongs to

§tid: i32

The task ID

Implementations§

source§

impl Task

source

pub fn stat(&self) -> ProcResult<Stat>

Thread info from /proc/<pid>/task/<tid>/stat

Many of the returned fields will be the same as the parent process, but some fields like utime and stime will be per-task

source

pub fn status(&self) -> ProcResult<Status>

Thread info from /proc/<pid>/task/<tid>/status

Many of the returned fields will be the same as the parent process

source

pub fn io(&self) -> ProcResult<Io>

Thread IO info from /proc/<pid>/task/<tid>/io

This data will be unique per task.

source

pub fn schedstat(&self) -> ProcResult<Schedstat>

Thread scheduler info from /proc/<pid>/task/<tid>/schedstat

This data will be unique per task.

source

pub fn children(&self) -> ProcResult<Vec<u32>>

Thread children from /proc/<pid>/task/<tid>/children

WARNING: This interface is not reliable unless all the child processes are stoppped or frozen. If a child task exits while the file is being read, non-exiting children may be omitted. See the procfs(5) man page for more information.

This data will be unique per task.

source

pub fn read<T: FromRead>(&self, path: &str) -> ProcResult<T>

Parse a file relative to the task proc structure.

Trait Implementations§

source§

impl Debug for Task

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnwindSafe for Task

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.