mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 01:15:07 +00:00
Add a PTY multiplexer (/dev/ptmx) device.
When you open /dev/ptmx, you get a file descriptor pointing to one of the available MasterPTY's. If none are available, you get an EBUSY. This makes it possible to open multiple (up to 4) Terminals. :^) To support this, I also added a CharacterDevice::open() that gets control when VFS is opening a CharacterDevice. This is useful when we want to return a custom FileDescriptor like we do here.
This commit is contained in:
parent
b46ae2bf09
commit
9dd29f9aa9
13 changed files with 75 additions and 37 deletions
|
@ -22,7 +22,7 @@
|
|||
#include "VirtualConsole.h"
|
||||
#include "Scheduler.h"
|
||||
#include "PS2MouseDevice.h"
|
||||
#include "MasterPTY.h"
|
||||
#include "PTYMultiplexer.h"
|
||||
|
||||
#define SPAWN_GUI_TEST_APP
|
||||
//#define SPAWN_MULTIPLE_SHELLS
|
||||
|
@ -37,10 +37,6 @@ VirtualConsole* tty3;
|
|||
Keyboard* keyboard;
|
||||
PS2MouseDevice* ps2mouse;
|
||||
GUIEventDevice* gui_event_device;
|
||||
MasterPTY* ptm0;
|
||||
MasterPTY* ptm1;
|
||||
MasterPTY* ptm2;
|
||||
MasterPTY* ptm3;
|
||||
|
||||
#ifdef STRESS_TEST_SPAWNING
|
||||
static void spawn_stress() NORETURN;
|
||||
|
@ -80,10 +76,8 @@ static void init_stage2()
|
|||
auto dev_random = make<RandomDevice>();
|
||||
vfs->register_character_device(*dev_random);
|
||||
|
||||
VFS::the().register_character_device(*new MasterPTY(0));
|
||||
VFS::the().register_character_device(*new MasterPTY(1));
|
||||
VFS::the().register_character_device(*new MasterPTY(2));
|
||||
VFS::the().register_character_device(*new MasterPTY(3));
|
||||
auto dev_ptmx = make<PTYMultiplexer>();
|
||||
vfs->register_character_device(*dev_ptmx);
|
||||
|
||||
vfs->register_character_device(*keyboard);
|
||||
vfs->register_character_device(*ps2mouse);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue