1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:37:34 +00:00

Kernel: Make sure processes always start out with fds 0, 1 and 2 open.

If we don't have a TTY for the process, fall back to /dev/null.
This commit is contained in:
Andreas Kling 2019-02-12 11:25:25 +01:00
parent 7def86c86d
commit 111589a558
5 changed files with 46 additions and 15 deletions

View file

@ -43,6 +43,7 @@ VirtualConsole* tty3;
Keyboard* keyboard;
PS2MouseDevice* ps2mouse;
GUIEventDevice* gui_event_device;
NullDevice* dev_null;
VFS* vfs;
#ifdef STRESS_TEST_SPAWNING
@ -72,7 +73,6 @@ static void init_stage2()
auto dev_zero = make<ZeroDevice>();
vfs->register_character_device(*dev_zero);
auto dev_null = make<NullDevice>();
vfs->register_character_device(*dev_null);
auto dev_full = make<FullDevice>();
@ -162,6 +162,7 @@ void init()
keyboard = new Keyboard;
ps2mouse = new PS2MouseDevice;
gui_event_device = new GUIEventDevice;
dev_null = new NullDevice;
VirtualConsole::initialize();
tty0 = new VirtualConsole(0, VirtualConsole::AdoptCurrentVGABuffer);