Struct Process

Source
pub struct Process<'a> { /* private fields */ }
Available on macOS only.
Expand description

Information related to a process.

Implementations§

Source§

impl<'a> Process<'a>

Source

pub const fn new(raw: &'a es_process_t, version: u32) -> Self

Create a new Process instance.

Source

pub fn audit_token(&self) -> AuditToken

Audit token of the process.

Source

pub fn ppid(&self) -> pid_t

Parent pid of the process.

Warning: It is recommended to instead use Self::parent_audit_token() when available.

Source

pub fn original_ppid(&self) -> pid_t

Original ppid of the process.

Source

pub fn group_id(&self) -> pid_t

Process group id the process belongs to.

Source

pub fn session_id(&self) -> pid_t

Process session id the process belongs to.

Source

pub fn codesigning_flags(&self) -> u32

Code signing flags of the process.

Source

pub fn is_platform_binary(&self) -> bool

Indicates whether the process is a platform binary.

Note: A “platform binary” is a binary signed with Apple certificates.

§Usage of is_platform_binary with Messages and EventExecs

If your application is looking to allow/deny AuthExec events, be sure to check EventExec::target(), not Message::process(), else you will get the wrong result, especially since pretty much all processes are lauched through xpcproxy, a platform binary.

Source

pub fn is_es_client(&self) -> bool

Indicates this process has the Endpoint Security entitlement.

Source

pub fn cdhash(&self) -> [u8; 20]

Code directory hash of the code signature associated with this process.

Source

pub fn signing_id(&self) -> &'a OsStr

Signing id of the code signature associated with this process.

Source

pub fn team_id(&self) -> &'a OsStr

Team id of the code signature associated with this process.

Source

pub fn executable(&self) -> File<'a>

Executable file that is executing in this process.

Source

pub fn tty(&self) -> Option<File<'a>>

Available on crate feature macos_10_15_1 only.

TTY associated to this process (if present) on version 2 and later, otherwise None.

Source

pub fn start_time(&self) -> Option<SystemTime>

Available on crate feature macos_10_15_4 only.

Process start time on version 3 and later, otherwise None.

Source

pub fn responsible_audit_token(&self) -> Option<AuditToken>

Available on crate feature macos_11_0_0 only.

Audit token of the process responsible for this process on version 4 and later, if any.

Warning: It may be the process itself in case there is no responsible process or the responsible process has already exited.

Source

pub fn parent_audit_token(&self) -> Option<AuditToken>

Available on crate feature macos_11_0_0 only.

Audit token of the parent process on version 4 and later, otherwise None.

Trait Implementations§

Source§

impl<'a> Debug for Process<'a>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a> Hash for Process<'a>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for Process<'a>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for Process<'a>

Source§

impl Send for Process<'_>

Auto Trait Implementations§

§

impl<'a> Freeze for Process<'a>

§

impl<'a> RefUnwindSafe for Process<'a>

§

impl<'a> !Sync for Process<'a>

§

impl<'a> Unpin for Process<'a>

§

impl<'a> UnwindSafe for Process<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,