Module shadow_rs::host::descriptor

source ·
Expand description

Linux file descriptors and file descriptions (equivalent to Linux struct files).

Modules§

Structs§

  • Represents a counted reference to a legacy file object. Will decrement the legacy file’s ref count when dropped.
  • A file descriptor that reference an open file. Also contains flags that change the behaviour of this file descriptor.
  • These are flags that should generally not change (analagous to the Linux filp->f_mode). Since the plugin will never see these values and they’re not exposed by the kernel, we don’t match the kernel FMODE_ values here.
  • File-related signals that listeners can watch for.
  • Flags representing the state of a file. Listeners can subscribe to state changes using FileRefMut::add_listener (or similar methods on SocketRefMut, Pipe, etc).
  • These are flags that can potentially be changed from the plugin (analagous to the Linux filp->f_flags status flags). Not all O_ flags are valid here. For example file access mode flags (ex: O_RDWR) are stored elsewhere, and file creation flags (ex: O_CREAT) are not stored anywhere. Many of these can be represented in different ways, for example: O_NONBLOCK, SOCK_NONBLOCK, EFD_NONBLOCK, GRND_NONBLOCK, etc, and not all have the same value.
  • Used to track how many descriptors are open for a LegacyFile. When the close() method is called, the legacy file’s legacyfile_close() will only be called if this is the last descriptor for that legacy file. This is similar to an OpenFile object, but for C files.
  • Represents a POSIX file description, or a Linux struct file. An OpenFile wraps a reference to a File. Once there are no more OpenFile objects for a given File, the File will be closed. Typically this means that holding an OpenFile will ensure that the file remains open (the file’s status will not become FileState::CLOSED), but the underlying file may close itself in extenuating circumstances (for example if the file has an internal error).

Enums§