pub struct FileDescriptorTable { /* private fields */ }Expand description
Per-process file descriptor table.
Implementations§
Source§impl FileDescriptorTable
impl FileDescriptorTable
Sourcepub fn insert(&mut self, file: Arc<OpenFile>) -> u32
pub fn insert(&mut self, file: Arc<OpenFile>) -> u32
Insert an open file and return its FD number.
Sourcepub fn insert_at(&mut self, fd: u32, file: Arc<OpenFile>)
pub fn insert_at(&mut self, fd: u32, file: Arc<OpenFile>)
Insert a file at a specific FD (for stdin/stdout/stderr).
Sourcepub fn insert_with_flags(&mut self, file: Arc<OpenFile>, cloexec: bool) -> u32
pub fn insert_with_flags(&mut self, file: Arc<OpenFile>, cloexec: bool) -> u32
Insert a file with explicit CLOEXEC flag.
Sourcepub fn get_cloexec(&self, fd: u32) -> Result<bool, SyscallError>
pub fn get_cloexec(&self, fd: u32) -> Result<bool, SyscallError>
Get the CLOEXEC flag for a file descriptor.
Sourcepub fn set_cloexec(
&mut self,
fd: u32,
cloexec: bool,
) -> Result<(), SyscallError>
pub fn set_cloexec( &mut self, fd: u32, cloexec: bool, ) -> Result<(), SyscallError>
Set the CLOEXEC flag for a file descriptor.
Sourcepub fn remove(&mut self, fd: u32) -> Result<Arc<OpenFile>, SyscallError>
pub fn remove(&mut self, fd: u32) -> Result<Arc<OpenFile>, SyscallError>
Remove an FD and return the file.
Sourcepub fn duplicate(&mut self, old_fd: u32) -> Result<u32, SyscallError>
pub fn duplicate(&mut self, old_fd: u32) -> Result<u32, SyscallError>
Duplicate an FD (fork/dup semantics).
Sourcepub fn duplicate_from(
&mut self,
old_fd: u32,
min_fd: u32,
) -> Result<u32, SyscallError>
pub fn duplicate_from( &mut self, old_fd: u32, min_fd: u32, ) -> Result<u32, SyscallError>
Duplicate an FD with a minimum target FD number (F_DUPFD semantics).
Sourcepub fn duplicate_to(
&mut self,
old_fd: u32,
new_fd: u32,
) -> Result<u32, SyscallError>
pub fn duplicate_to( &mut self, old_fd: u32, new_fd: u32, ) -> Result<u32, SyscallError>
Duplicate old_fd onto new_fd (dup2 semantics).
Sourcepub fn close_cloexec(&mut self)
pub fn close_cloexec(&mut self)
Close all file descriptors with CLOEXEC flag (execve cleanup).
Sourcepub fn clone_for_fork(&self) -> Self
pub fn clone_for_fork(&self) -> Self
Clone this FD table (fork semantics).
All descriptors are copied, including those with CLOEXEC.
CLOEXEC only takes effect at exec-time via close_cloexec().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FileDescriptorTable
impl !RefUnwindSafe for FileDescriptorTable
impl Send for FileDescriptorTable
impl Sync for FileDescriptorTable
impl Unpin for FileDescriptorTable
impl UnsafeUnpin for FileDescriptorTable
impl !UnwindSafe for FileDescriptorTable
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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