pub struct EpollFileObject { /* private fields */ }Expand description
EpollFileObject represents the FileObject used to implement epoll_create1/epoll_ctl/epoll_pwait.
Implementations§
Source§impl EpollFileObject
impl EpollFileObject
Sourcepub fn new_file<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
) -> FileHandlewhere
L: LockEqualOrBefore<FileOpsCore>,
pub fn new_file<L>(
locked: &mut Locked<L>,
current_task: &CurrentTask,
) -> FileHandlewhere
L: LockEqualOrBefore<FileOpsCore>,
Allocate a new, empty epoll object.
Sourcepub fn add<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
file: &FileHandle,
epoll_file_handle: &FileHandle,
epoll_event: EpollEvent,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn add<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
file: &FileHandle,
epoll_file_handle: &FileHandle,
epoll_event: EpollEvent,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Asynchronously wait on certain events happening on a FileHandle.
Sourcepub fn modify<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
file: &FileHandle,
epoll_event: EpollEvent,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn modify<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
file: &FileHandle,
epoll_event: EpollEvent,
) -> Result<(), Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Modify the events we are looking for on a Filehandle.
Sourcepub fn delete(&self, file: &FileObject) -> Result<(), Errno>
pub fn delete(&self, file: &FileObject) -> Result<(), Errno>
Cancel an asynchronous wait on an object. Events triggered before calling this will still be delivered.
Sourcepub fn wait<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
max_events: usize,
deadline: MonotonicInstant,
) -> Result<Vec<EpollEvent>, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
pub fn wait<L>(
&self,
locked: &mut Locked<L>,
current_task: &CurrentTask,
max_events: usize,
deadline: MonotonicInstant,
) -> Result<Vec<EpollEvent>, Errno>where
L: LockEqualOrBefore<FileOpsCore>,
Blocking wait on all waited upon events with a timeout.
Sourcepub fn drop_lease(&self, current_task: &CurrentTask, file: &FileHandle)
pub fn drop_lease(&self, current_task: &CurrentTask, file: &FileHandle)
Drop the wake lease associated with the file.
Sourcepub fn activate_lease(
&self,
current_task: &CurrentTask,
file: &FileHandle,
_baton_lease: &NullableHandle,
) -> Result<(), Errno>
pub fn activate_lease( &self, current_task: &CurrentTask, file: &FileHandle, _baton_lease: &NullableHandle, ) -> Result<(), Errno>
Activate the wake lease associated with the file.
baton_lease is passed by reference to ensure that the lease remains on hold until
this function returns.
Trait Implementations§
Source§impl Default for EpollFileObject
impl Default for EpollFileObject
Source§fn default() -> EpollFileObject
fn default() -> EpollFileObject
Returns the “default value” for a type. Read more
Source§impl FileOps for EpollFileObject
impl FileOps for EpollFileObject
Source§fn is_seekable(&self) -> bool
fn is_seekable(&self) -> bool
Returns whether the file is seekable.
Source§fn seek(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
_current_offset: off_t,
_target: SeekTarget,
) -> Result<off_t, Errno>
fn seek( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, _current_offset: off_t, _target: SeekTarget, ) -> Result<off_t, Errno>
Adjust the
current_offset if the file is seekable.Source§fn sync(
&self,
file: &FileObject,
_current_task: &CurrentTask,
) -> Result<(), Errno>
fn sync( &self, file: &FileObject, _current_task: &CurrentTask, ) -> Result<(), Errno>
Syncs cached state associated with the file descriptor to persistent storage. Read more
Source§fn write(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
_offset: usize,
_data: &mut dyn InputBuffer,
) -> Result<usize, Errno>
fn write( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, _offset: usize, _data: &mut dyn InputBuffer, ) -> Result<usize, Errno>
Write to the file with an offset. If the file does not have persistent offsets (either
directly, or because it is not seekable), offset will be 0 and can be ignored.
Returns the number of bytes written.
Source§fn read(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
_offset: usize,
_data: &mut dyn OutputBuffer,
) -> Result<usize, Errno>
fn read( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, _offset: usize, _data: &mut dyn OutputBuffer, ) -> Result<usize, Errno>
Read from the file at an offset. If the file does not have persistent offsets (either
directly, or because it is not seekable), offset will be 0 and can be ignored.
Returns the number of bytes read.
Source§fn wait_async(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
waiter: &Waiter,
events: FdEvents,
handler: EventHandler,
) -> Option<WaitCanceler>
fn wait_async( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, waiter: &Waiter, events: FdEvents, handler: EventHandler, ) -> Option<WaitCanceler>
Establish a one-shot, edge-triggered, asynchronous wait for the given FdEvents for the
given file and task. Returns
None if this file does not support blocking waits. Read moreSource§fn query_events(
&self,
locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
current_task: &CurrentTask,
) -> Result<FdEvents, Errno>
fn query_events( &self, locked: &mut Locked<FileOpsCore>, _file: &FileObject, current_task: &CurrentTask, ) -> Result<FdEvents, Errno>
The events currently active on this file. Read more
Source§fn close(
self: Box<Self>,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObjectState,
current_task: &CurrentTask,
)
fn close( self: Box<Self>, _locked: &mut Locked<FileOpsCore>, _file: &FileObjectState, current_task: &CurrentTask, )
Called when the FileObject is destroyed.
Source§fn open(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
) -> Result<(), Errno>
fn open( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, ) -> Result<(), Errno>
Called when the FileObject is opened/created
Source§fn flush(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
)
fn flush( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, )
Called every time close() is called on this file, even if the file is not ready to be
released.
Source§fn has_persistent_offsets(&self) -> bool
fn has_persistent_offsets(&self) -> bool
Returns whether the file has meaningful seek offsets. Returning
false is only
optimization and will makes FileObject never hold the offset lock when calling read and
write.Source§fn writes_update_seek_offset(&self) -> bool
fn writes_update_seek_offset(&self) -> bool
Returns true if
write() operations on the file will update the seek offset.Source§fn data_sync(
&self,
file: &FileObject,
current_task: &CurrentTask,
) -> Result<(), Errno>
fn data_sync( &self, file: &FileObject, current_task: &CurrentTask, ) -> Result<(), Errno>
Syncs cached data, and only enough metadata to retrieve said data, to persistent storage. Read more
Source§fn get_memory(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
_length: Option<usize>,
_prot: ProtectionFlags,
) -> Result<Arc<MemoryObject>, Errno>
fn get_memory( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, _length: Option<usize>, _prot: ProtectionFlags, ) -> Result<Arc<MemoryObject>, Errno>
Returns a VMO representing this file. At least the requested protection flags must
be set on the VMO. Reading or writing the VMO must read or write the file. If this is not
possible given the requested protection, an error must be returned.
The
length is a hint for the desired size of the VMO. The returned VMO may be larger or
smaller than the requested length.
This method is typically called by Self::mmap.Source§fn mmap(
&self,
locked: &mut Locked<FileOpsCore>,
file: &FileObject,
current_task: &CurrentTask,
addr: DesiredAddress,
memory_offset: u64,
length: usize,
prot_flags: ProtectionFlags,
options: MappingOptions,
filename: NamespaceNode,
) -> Result<UserAddress, Errno>
fn mmap( &self, locked: &mut Locked<FileOpsCore>, file: &FileObject, current_task: &CurrentTask, addr: DesiredAddress, memory_offset: u64, length: usize, prot_flags: ProtectionFlags, options: MappingOptions, filename: NamespaceNode, ) -> Result<UserAddress, Errno>
Responds to an mmap call. The default implementation calls
Self::get_memory to get a VMO
and then maps it with [crate::mm::MemoryManager::map].
Only implement this trait method if your file needs to control mapping, or record where
a VMO gets mapped.Source§fn readdir(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileObject,
_current_task: &CurrentTask,
_sink: &mut dyn DirentSink,
) -> Result<(), Errno>
fn readdir( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileObject, _current_task: &CurrentTask, _sink: &mut dyn DirentSink, ) -> Result<(), Errno>
fn ioctl( &self, locked: &mut Locked<Unlocked>, file: &FileObject, current_task: &CurrentTask, request: u32, arg: SyscallArg, ) -> Result<SyscallResult, Errno>
fn fcntl( &self, _file: &FileObject, _current_task: &CurrentTask, cmd: u32, _arg: u64, ) -> Result<SyscallResult, Errno>
Source§fn to_handle(
&self,
file: &FileObject,
current_task: &CurrentTask,
) -> Result<Option<NullableHandle>, Errno>
fn to_handle( &self, file: &FileObject, current_task: &CurrentTask, ) -> Result<Option<NullableHandle>, Errno>
Return a handle that allows access to this file descritor through the zxio protocols. Read more
Source§fn as_thread_group_key(
&self,
_file: &FileObject,
) -> Result<ThreadGroupKey, Errno>
fn as_thread_group_key( &self, _file: &FileObject, ) -> Result<ThreadGroupKey, Errno>
Returns the associated pid_t. Read more
fn readahead( &self, _file: &FileObject, _current_task: &CurrentTask, _offset: usize, _length: usize, ) -> Result<(), Errno>
Source§fn extra_fdinfo(
&self,
_locked: &mut Locked<FileOpsCore>,
_file: &FileHandle,
_current_task: &CurrentTask,
) -> Option<FsString>
fn extra_fdinfo( &self, _locked: &mut Locked<FileOpsCore>, _file: &FileHandle, _current_task: &CurrentTask, ) -> Option<FsString>
Extra information that is included in the /proc//fdfino/ entry.
Auto Trait Implementations§
impl !Freeze for EpollFileObject
impl !RefUnwindSafe for EpollFileObject
impl Send for EpollFileObject
impl Sync for EpollFileObject
impl Unpin for EpollFileObject
impl !UnwindSafe for EpollFileObject
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, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]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 moreSource§impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
impl<T, U> MultiArchFrom<T> for Uwhere
U: From<T>,
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
impl<T, U> TryIntoExt<U> for Twhere
U: TryFromExt<T>,
type Error = <U as TryFromExt<T>>::Error
§fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
fn try_into_ext(self) -> Result<U, <T as TryIntoExt<U>>::Error>
Tries to perform the conversion.