mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:17:42 +00:00
Kernel: Have TTY subclasses cache their tty_name/pts_name.
This commit is contained in:
parent
d384c7815f
commit
88f03f86ff
6 changed files with 9 additions and 3 deletions
|
@ -13,6 +13,7 @@ MasterPTY::MasterPTY(unsigned index)
|
|||
, m_slave(adopt(*new SlavePTY(*this, index)))
|
||||
, m_index(index)
|
||||
{
|
||||
m_pts_name = String::format("/dev/pts/%u", m_index);
|
||||
set_uid(current->process().uid());
|
||||
set_gid(current->process().gid());
|
||||
}
|
||||
|
@ -27,7 +28,7 @@ MasterPTY::~MasterPTY()
|
|||
|
||||
String MasterPTY::pts_name() const
|
||||
{
|
||||
return String::format("/dev/pts/%u", m_index);
|
||||
return m_pts_name;
|
||||
}
|
||||
|
||||
ssize_t MasterPTY::read(Process&, byte* buffer, ssize_t size)
|
||||
|
|
|
@ -33,4 +33,5 @@ private:
|
|||
unsigned m_index;
|
||||
bool m_closed { false };
|
||||
DoubleBuffer m_buffer;
|
||||
String m_pts_name;
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
|
|||
, m_master(master)
|
||||
, m_index(index)
|
||||
{
|
||||
m_tty_name = String::format("/dev/pts/%u", m_index);
|
||||
set_uid(current->process().uid());
|
||||
set_gid(current->process().gid());
|
||||
DevPtsFS::the().register_slave_pty(*this);
|
||||
|
@ -26,7 +27,7 @@ SlavePTY::~SlavePTY()
|
|||
|
||||
String SlavePTY::tty_name() const
|
||||
{
|
||||
return String::format("/dev/pts/%u", m_index);
|
||||
return m_tty_name;
|
||||
}
|
||||
|
||||
void SlavePTY::on_master_write(const byte* buffer, ssize_t size)
|
||||
|
|
|
@ -32,5 +32,6 @@ private:
|
|||
RetainPtr<MasterPTY> m_master;
|
||||
unsigned m_index;
|
||||
InodeIdentifier m_devpts_inode_id;
|
||||
String m_tty_name;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ VirtualConsole::VirtualConsole(unsigned index, InitialContents initial_contents)
|
|||
: TTY(4, index)
|
||||
, m_index(index)
|
||||
{
|
||||
m_tty_name = String::format("/dev/tty%u", m_index);
|
||||
set_size(80, 25);
|
||||
m_horizontal_tabs = static_cast<byte*>(kmalloc(columns()));
|
||||
for (unsigned i = 0; i < columns(); ++i)
|
||||
|
@ -508,7 +509,7 @@ ssize_t VirtualConsole::on_tty_write(const byte* data, ssize_t size)
|
|||
|
||||
String VirtualConsole::tty_name() const
|
||||
{
|
||||
return String::format("/dev/tty%u", m_index);
|
||||
return m_tty_name;
|
||||
}
|
||||
|
||||
void VirtualConsole::set_vga_start_row(word row)
|
||||
|
|
|
@ -78,4 +78,5 @@ private:
|
|||
Vector<byte> m_parameters;
|
||||
Vector<byte> m_intermediates;
|
||||
byte* m_horizontal_tabs { nullptr };
|
||||
String m_tty_name;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue