summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 14deb2812a..24d0bdc16c 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1249,3 +1249,34 @@ int Process::sys$setpgid(pid_t specified_pid, pid_t specified_pgid)
process->m_pgid = new_pgid;
return 0;
}
+
+pid_t Process::sys$tcgetpgrp(int fd)
+{
+ auto* handle = fileHandleIfExists(fd);
+ if (!handle)
+ return -EBADF;
+ if (!handle->isTTY())
+ return -ENOTTY;
+ auto& tty = *handle->tty();
+ if (&tty != m_tty)
+ return -ENOTTY;
+ return tty.pgid();
+}
+
+int Process::sys$tcsetpgrp(int fd, pid_t pgid)
+{
+ if (pgid < 0)
+ return -EINVAL;
+ if (get_sid_from_pgid(pgid) != m_sid)
+ return -EINVAL;
+ auto* handle = fileHandleIfExists(fd);
+ if (!handle)
+ return -EBADF;
+ if (!handle->isTTY())
+ return -ENOTTY;
+ auto& tty = *handle->tty();
+ if (&tty != m_tty)
+ return -ENOTTY;
+ tty.set_pgid(pgid);
+ return 0;
+}