mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +00:00
LibCore+Everywhere: Move SeekMode out of IODevice
This commit is contained in:
parent
a91a49337c
commit
1ae8775a1b
5 changed files with 10 additions and 10 deletions
|
@ -63,7 +63,7 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
bool discard_or_error(size_t count) override { return m_file->seek(count, IODevice::SeekMode::FromCurrentPosition); }
|
||||
bool discard_or_error(size_t count) override { return m_file->seek(count, SeekMode::FromCurrentPosition); }
|
||||
|
||||
bool unreliable_eof() const override { return m_file->eof(); }
|
||||
|
||||
|
|
|
@ -44,6 +44,12 @@ enum class OpenMode : unsigned {
|
|||
MustBeNew = 16,
|
||||
};
|
||||
|
||||
enum class SeekMode {
|
||||
SetPosition,
|
||||
FromCurrentPosition,
|
||||
FromEndPosition,
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(OpenMode)
|
||||
|
||||
class IODevice : public Object {
|
||||
|
@ -76,12 +82,6 @@ public:
|
|||
|
||||
bool can_read() const;
|
||||
|
||||
enum class SeekMode {
|
||||
SetPosition,
|
||||
FromCurrentPosition,
|
||||
FromEndPosition,
|
||||
};
|
||||
|
||||
bool seek(i64, SeekMode = SeekMode::SetPosition, off_t* = nullptr);
|
||||
|
||||
virtual bool open(OpenMode) = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@ HashMap<uid_t, String> ProcessStatisticsReader::s_usernames;
|
|||
Optional<HashMap<pid_t, Core::ProcessStatistics>> ProcessStatisticsReader::get_all(RefPtr<Core::File>& proc_all_file)
|
||||
{
|
||||
if (proc_all_file) {
|
||||
if (!proc_all_file->seek(0, Core::File::SeekMode::SetPosition)) {
|
||||
if (!proc_all_file->seek(0, Core::SeekMode::SetPosition)) {
|
||||
fprintf(stderr, "ProcessStatisticsReader: Failed to refresh /proc/all: %s\n", proc_all_file->error_string());
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue