Skip to main content

SandboxedProcess

Struct SandboxedProcess 

Source
pub struct SandboxedProcess { /* private fields */ }
Available on FreeBSD only.
Expand description

A plugin running inside its own pdfork child process, confined to a Capsicum capability sandbox.

The host talks to the child over the ipc socket. Drop (or shutdown) closes the IPC socket and reaps the child when the process descriptor is closed.

Implementations§

Source§

impl SandboxedProcess

Source

pub fn plugin_id(&self) -> u32

The plugin id used in IPC requests (always 0 in 0.1.0).

Source

pub fn request_metadata(&mut self) -> Result<PluginMetadataPayload>

Request the plugin’s static metadata over IPC.

§Errors

Returns PluginError::Sandbox on any IPC or protocol error, or when the child reports an error / unexpected response.

Source

pub fn shutdown(&mut self) -> Result<()>

Shut the child down: close the IPC socket (the child’s control loop observes EOF and _exits), then drop the process descriptor, which reaps the child via pdfork’s terminate-on-close semantics.

Safe to call more than once (subsequent calls are no-ops). This method does not block on the child: the kernel reaps it when the descriptor closes, regardless of timing.

§Errors

Currently always returns Ok; the Result is kept for API parity with the non-FreeBSD stub and future synchronous-reap variants.

Trait Implementations§

Source§

impl Debug for SandboxedProcess

Source§

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

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

impl Drop for SandboxedProcess

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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.