Skip to main content

ProcessFdTable

Struct ProcessFdTable 

Source
pub struct ProcessFdTable { /* private fields */ }

Implementations§

Source§

impl ProcessFdTable

Source

pub fn max_fds(&self) -> usize

Source

pub fn available_fd_capacity(&self) -> usize

Source

pub fn init_stdio( &mut self, stdin_desc: SharedFileDescription, stdout_desc: SharedFileDescription, stderr_desc: SharedFileDescription, )

Source

pub fn init_stdio_with_types( &mut self, stdin_desc: SharedFileDescription, stdin_type: u8, stdout_desc: SharedFileDescription, stdout_type: u8, stderr_desc: SharedFileDescription, stderr_type: u8, )

Source

pub fn open(&mut self, path: &str, flags: u32) -> FdResult<u32>

Source

pub fn open_with_filetype( &mut self, path: &str, flags: u32, filetype: u8, ) -> FdResult<u32>

Source

pub fn open_with_details( &mut self, path: &str, flags: u32, filetype: u8, lock_target: Option<FileLockTarget>, ) -> FdResult<u32>

Source

pub fn open_with( &mut self, description: SharedFileDescription, filetype: u8, target_fd: Option<u32>, ) -> FdResult<u32>

Source

pub fn open_pair_with_details( &mut self, first_path: &str, second_path: &str, status_flags: u32, fd_flags: u32, filetype: u8, ) -> FdResult<(u32, u32, SharedFileDescription, SharedFileDescription)>

Source

pub fn transfer(&self, fd: u32) -> FdResult<TransferredFd>

Source

pub fn create_transfer( &self, path: &str, flags: u32, filetype: u8, ) -> TransferredFd

Create an open-file-description transfer without consuming an fd slot.

SCM_RIGHTS queues descriptions, not temporary descriptors in the sending process. Keeping this separate from open_with_details avoids spuriously returning EMFILE when the sender’s descriptor table is full.

Source

pub fn install_transferred( &mut self, transfers: &[TransferredFd], close_on_exec: bool, ) -> FdResult<Vec<u32>>

Source

pub fn get(&self, fd: u32) -> Option<&FdEntry>

Source

pub fn values(&self) -> Values<'_, u32, FdEntry>

Source

pub fn close(&mut self, fd: u32) -> bool

Source

pub fn close_on_exec_fds(&self) -> Vec<u32>

File descriptors that must be closed when the current process image is replaced by exec(2). The caller performs the closes through the kernel so pipe/socket lifecycle accounting receives the same notifications as an explicit close(2).

Source

pub fn dup(&mut self, fd: u32) -> FdResult<u32>

Source

pub fn dup_with_status_flags( &mut self, fd: u32, status_flags_override: Option<u32>, ) -> FdResult<u32>

Source

pub fn dup2(&mut self, old_fd: u32, new_fd: u32) -> FdResult<()>

Source

pub fn stat(&self, fd: u32) -> FdResult<FdStat>

Source

pub fn fcntl(&mut self, fd: u32, command: u32, arg: u32) -> FdResult<u32>

Source

pub fn fork(&self) -> Self

Source

pub fn fork_preserving_cloexec(&self) -> Self

Clone this descriptor table at the fork half of a deferred exec.

Linux keeps FD_CLOEXEC descriptors across fork(2) so spawn file actions can use them as sources. The exec half closes any descriptors that remain marked after those actions have run.

Source

pub fn len_for_exec(&self) -> usize

Source

pub fn close_all(&mut self)

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn iter(&self) -> Values<'_, u32, FdEntry>

Trait Implementations§

Source§

impl Clone for ProcessFdTable

Source§

fn clone(&self) -> ProcessFdTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessFdTable

Source§

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

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

impl<'a> IntoIterator for &'a ProcessFdTable

Source§

type Item = &'a FdEntry

The type of the elements being iterated over.
Source§

type IntoIter = Values<'a, u32, FdEntry>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more