1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 11:18:13 +00:00

Kernel: Distinguish between new and old process groups with equal pgids

This does not add any behaviour change to the processes, but it ties a
TTY to an active process group via TIOCSPGRP, and returns the TTY to the
kernel when all processes in the process group die.
Also makes the TTY keep a link to the original controlling process' parent (for
SIGCHLD) instead of the process itself.
This commit is contained in:
AnotherTest 2020-08-15 23:43:19 +04:30 committed by Andreas Kling
parent cf18bff72a
commit 688e54eac7
9 changed files with 176 additions and 23 deletions

View file

@ -30,6 +30,7 @@
#include <AK/WeakPtr.h>
#include <Kernel/Devices/CharacterDevice.h>
#include <Kernel/DoubleBuffer.h>
#include <Kernel/ProcessGroup.h>
#include <Kernel/UnixTypes.h>
namespace Kernel {
@ -50,7 +51,7 @@ public:
unsigned short rows() const { return m_rows; }
unsigned short columns() const { return m_columns; }
ProcessGroupID pgid() const;
ProcessGroupID pgid() const { return m_pg ? m_pg->pgid() : 0; }
void set_termios(const termios&);
bool should_generate_signals() const { return m_termios.c_lflag & ISIG; }
@ -91,7 +92,8 @@ private:
virtual bool is_tty() const final override { return true; }
CircularDeque<u8, 1024> m_input_buffer;
WeakPtr<Process> m_process;
WeakPtr<Process> m_original_process_parent;
WeakPtr<ProcessGroup> m_pg;
termios m_termios;
unsigned short m_rows { 0 };
unsigned short m_columns { 0 };