mirror of
https://github.com/RGBCube/serenity
synced 2025-05-21 13:05:06 +00:00
Add basic PTY support.
For now, there are four hard-coded PTYs: /dev/pt{m,s}[0123] Use this in the Terminal to open a pty pair and spawn a shell.
This commit is contained in:
parent
ecb4ab0943
commit
2f74c2f430
21 changed files with 287 additions and 10 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#ifdef SERENITY
|
||||
#include "TTY.h"
|
||||
#include "MasterPTY.h"
|
||||
#endif
|
||||
|
||||
RetainPtr<FileDescriptor> FileDescriptor::create(RetainPtr<Vnode>&& vnode)
|
||||
|
@ -258,6 +259,29 @@ TTY* FileDescriptor::tty()
|
|||
return static_cast<TTY*>(device);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool FileDescriptor::is_master_pty() const
|
||||
{
|
||||
if (is_fifo())
|
||||
return false;
|
||||
if (auto* device = m_vnode->characterDevice())
|
||||
return device->is_master_pty();
|
||||
return false;
|
||||
}
|
||||
|
||||
const MasterPTY* FileDescriptor::master_pty() const
|
||||
{
|
||||
if (!is_master_pty())
|
||||
return nullptr;
|
||||
return static_cast<const MasterPTY*>(m_vnode->characterDevice());
|
||||
}
|
||||
|
||||
MasterPTY* FileDescriptor::master_pty()
|
||||
{
|
||||
if (!is_master_pty())
|
||||
return nullptr;
|
||||
return static_cast<MasterPTY*>(m_vnode->characterDevice());
|
||||
}
|
||||
#endif
|
||||
|
||||
int FileDescriptor::close()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue