1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:37:36 +00:00

Kernel: Track time-of-last-write in SlavePTY and report it as mtime

This commit is contained in:
Andreas Kling 2020-09-06 18:48:24 +02:00
parent ae9c5bf216
commit 4527d9852a
4 changed files with 17 additions and 5 deletions

View file

@ -74,6 +74,7 @@ void SlavePTY::on_master_write(const u8* buffer, ssize_t size)
ssize_t SlavePTY::on_tty_write(const u8* data, ssize_t size)
{
m_time_of_last_write = kgettimeofday().tv_sec;
return m_master->on_slave_write(data, size);
}

View file

@ -40,6 +40,8 @@ public:
void on_master_write(const u8*, ssize_t);
unsigned index() const { return m_index; }
time_t time_of_last_write() const { return m_time_of_last_write; }
private:
// ^TTY
virtual String tty_name() const override;
@ -57,7 +59,8 @@ private:
SlavePTY(MasterPTY&, unsigned index);
RefPtr<MasterPTY> m_master;
unsigned m_index;
time_t m_time_of_last_write { 0 };
unsigned m_index { 0 };
char m_tty_name[32];
};