maat::env::PhysicalFile class

This class represents a physical file on the disk

❱   Base classes

class maat::serial::Serializable
Virtual interface that serializable classes must implement.

❱   Public types

Types of files.

❱   Constructors, destructors, conversion operators

PhysicalFile(std::shared_ptr<SnapshotManager<env::Snapshot>> snapshots = nullptr, Type type = Type::REGULAR)
Create a new physical file.

❱   Public functions

auto write_buffer(const std::vector<Value>& buffer, addr_t& offset) -> unsigned int
Write abstract buffer to the file. Return the number of bytes written.

auto write_buffer(uint8_t* buffer, addr_t& offset, int len) -> unsigned int
Write concrete buffer to the file. Return the number of bytes written.

auto read_buffer(std::vector<Value>& buffer, addr_t& offset, unsigned int nb_elems, unsigned int elem_size) -> unsigned int
Read abstract buffer from file. Return the number of elements read.

auto size() -> unsigned int
Return the total size of the physical file content in bytes.

auto copy_real_file(const std::string& filename) -> unsigned int
Fill the emulated file with concrete content from a real file. Return the size of 'filename'.

auto status() -> node_status_t
Return the file status.

void set_deleted(bool deleted)
Set the deleted status of the file.

auto is_deleted() -> bool
Return 'True' if the file has been deleted by the emulated program.

auto is_symlink() -> bool
Return 'True' if the file is a symbolic link.

auto symlink() -> const std::string&
If symlink, returns the file it points to.

auto uid() -> unsigned int
Return the file uid.

auto class_uid() const -> serial::uid_t virtual
Return the class uid (see ClassId enum)

void dump(serial::Serializer&) const virtual
Dump the object contents in a serializer stream.

void load(serial::Deserializer&) virtual
Restore an object from a deserializer stream.

❱   Public variables

std::optional<std::reference_wrapper<std::ostream>> flush_stream
If this field is set, flush every write to the file in the stream as well. This is mostly used for stdout/stderr emulated files.

❱   Protected variables

bool deleted
'True' if the file was deleted by the emulated program

addr_t _size
Size in bytes.

std::string _symlink
Path if this file is a symlink.

❱   Enum documentation

enum class maat::env::PhysicalFile::Type

Types of files.


Regular file supporting arbitrary read write.


Stream (reads consume data from the beginning, writes append data at the end)


Symbolic link to another file.