L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4Re::Core::Ds_file Class Reference

Implementation for files backed by an L4Re::Dataspace abstraction. More...

#include <ds_file.h>

Collaboration diagram for L4Re::Core::Ds_file:

Public Member Functions

L4::Cap< L4Re::Dataspacedata_space () noexcept override
 Get an L4Re::Dataspace object for the file.
int fstat (struct stat64 *buf) const noexcept override
 Get status information for the file.
int ioctl (unsigned long, va_list) noexcept override
 The famous IO control.
int get_status_flags () const noexcept override
 Get file status flags (fcntl F_GETFL).
int set_status_flags (long) noexcept override
 Set file status flags (fcntl F_SETFL).
bool check_ready (Ready_type rt) noexcept override
 Check whether the file is ready for an I/O operation/condition.

Detailed Description

Implementation for files backed by an L4Re::Dataspace abstraction.

Definition at line 17 of file ds_file.h.

Member Function Documentation

◆ check_ready()

bool L4Re::Core::Ds_file::check_ready ( Ready_type rt)
inlineoverridevirtualnoexcept

Check whether the file is ready for an I/O operation/condition.

By definition, a dataspace-backed file is always ready for reading. If the file has write permissions, it is also always ready for writing.

Parameters
rtType of the I/O operation/condition to be ready.
Returns
Always true for reading. True for writing if writable. Always false otherwise.

Implements L4Re::Vfs::Generic_file.

Definition at line 65 of file ds_file.h.

◆ data_space()

L4::Cap< L4Re::Dataspace > L4Re::Core::Ds_file::data_space ( )
inlineoverridevirtualnoexcept

Get an L4Re::Dataspace object for the file.

This is used as a backend for POSIX mmap and mmap2 functions.

Note
mmap is not possible if the function returns an invalid capability.
Returns
A capability to an L4Re::Dataspace that represents the file contents in an L4Re way.

Implements L4Re::Vfs::Regular_file.

Definition at line 40 of file ds_file.h.

◆ fstat()

int L4Re::Core::Ds_file::fstat ( struct stat64 * buf) const
overridevirtualnoexcept

Get status information for the file.

This is the backend for POSIX fstat, stat, fstat64 and friends.

Parameters
[out]bufThis buffer is filled with the status information.
Returns
0 on success, or <0 on error.

Implements L4Re::Vfs::Generic_file.

Definition at line 27 of file ds_file_impl.h.

References L4_PAGESIZE, and l4_round_page().

Here is the call graph for this function:

◆ get_status_flags()

int L4Re::Core::Ds_file::get_status_flags ( ) const
inlineoverridevirtualnoexcept

Get file status flags (fcntl F_GETFL).

This function is used by the fcntl implementation for the F_GETFL command.

Returns
flags such as O_RDONLY, O_WRONLY, O_RDWR, O_DIRECT, O_ASYNC, O_NOATIME, O_NONBLOCK, or <0 on error.

Implements L4Re::Vfs::Generic_file.

Definition at line 48 of file ds_file.h.

◆ ioctl()

int L4Re::Core::Ds_file::ioctl ( unsigned long cmd,
va_list args )
overridevirtualnoexcept

The famous IO control.

Backend for POSIX generic object invocation ioctl.

Parameters
cmdThe ioctl command.
argsThe arguments for the ioctl, usually some kind of pointer.
Returns
>=0 on success, or <0 on error.

Implements L4Re::Vfs::Special_file.

Definition at line 192 of file ds_file_impl.h.

◆ set_status_flags()

int L4Re::Core::Ds_file::set_status_flags ( long flags)
inlineoverridevirtualnoexcept

Set file status flags (fcntl F_SETFL).

This function is used by the fcntl implementation for the F_SETFL command.

Parameters
flagsThe file status flags to set. This must be a combination of O_RDONLY, O_WRONLY, O_RDWR, O_APPEND, O_ASYNC, O_DIRECT, O_NOATIME, O_NONBLOCK.
Note
Creation flags such as O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC are ignored.
Returns
0 on success, or <0 on error.

Implements L4Re::Vfs::Generic_file.

Definition at line 51 of file ds_file.h.


The documentation for this class was generated from the following files: