Yann MAGNIN
97fb770fe1
* Multi-process management * Many syscall implementations * Sheared object creation * Fix process creation * Fix process return Implemented syscall list: * wait * waitpid * _exit * getpid * getppid * getpgid * setpgid Bugs found (but not fixed): * TTY cursor drawing crash. * Loader relocatable sections management (unable to load the file) * Loader relocatable sections management (symbols not relocalized, crash)
26 lines
496 B
C
26 lines
496 B
C
#include <kernel/syscall.h>
|
|
#include <kernel/scheduler.h>
|
|
#include <kernel/util/atomic.h>
|
|
|
|
int sys_setpgid(pid_t pid, pid_t pgid)
|
|
{
|
|
extern struct process *process_current;
|
|
struct process *proc;
|
|
|
|
// Start atomic operations
|
|
atomic_start();
|
|
|
|
// Get the appropriate process
|
|
proc = process_current;
|
|
if (pid != 0)
|
|
proc = process_get(pid);
|
|
|
|
// Check error
|
|
if (proc == NULL)
|
|
return (-1);
|
|
|
|
// Update Proocess Group ID
|
|
proc->pgid = (pgid == 0) ? process_current->pgid : pgid;
|
|
return (0);
|
|
}
|