1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

LibCore/Userland: Introduce a simple tail implementation

Also introduce more seek modes on CIODevice, and an out param to find
the current position inside the file -- this means less syscalls (and
less potential races) than requesting it through a separate pos()
accessor or something.
This commit is contained in:
Robin Burchell 2019-05-16 15:02:17 +02:00 committed by Andreas Kling
parent 805e87a21c
commit c8fda23a03
3 changed files with 143 additions and 4 deletions

View file

@ -37,7 +37,13 @@ public:
bool can_read() const;
bool seek(signed_qword);
enum class SeekMode {
SetPosition,
FromCurrentPosition,
FromEndPosition,
};
bool seek(signed_qword, SeekMode = SeekMode::SetPosition, off_t* = nullptr);
virtual bool open(CIODevice::OpenMode) = 0;
virtual bool close();