2#include "job-control-syscalls.h"
3#include "pedigree/kernel/process/Scheduler.h"
4#include "pedigree/kernel/process/TerminationDeferral.h"
5#include "pedigree/kernel/process/Thread.h"
6#include "pedigree/kernel/processor/Processor.h"
7#include "pedigree/kernel/processor/ProcessorInformation.h"
8#include "pedigree/kernel/syscallError.h"
10#include "PosixProcess.h"
15 return process->getType() == Process::Posix ?
static_cast<PosixProcess*
>(process) : nullptr;
28 lease->getType() == Process::Posix)
31 task->
getParent()->getType() == Process::Posix) {
37 id = target->getSessionId(caller()->pidNamespace().get());
39 target->getProcessGroupId(
id, caller()->pidNamespace().get());
44 syscallError(result < 0 ? Error::NoSuchProcess : 0);
49int posix_getsid(
int pid) {
52int posix_getpgid(
int pid) {
65 SYSCALL_ERROR(NoSuchProcess);
68 return process->createSession();
71int posix_setpgid(
int pid,
int pgid) {
80 if (pid < 0 || !current)
81 error = Error::NoSuchProcess;
83 error = Error::InvalidArgument;
85 if (pid &&
static_cast<size_t>(pid) != current->
getUserspaceId()) {
87 lease->getType() != Process::Posix) {
89 ? Error::InvalidArgument
90 : Error::NoSuchProcess;
96 result = target->changeProcessGroup(
97 *current, pgid ? pgid : target->getUserspaceId(current->pidNamespace().get()));
size_t getUserspaceId() const
static ProcessorInformation & information()
static Scheduler & instance()
Process * getParent() const