9.58 getpgid/setpgid

pid_t getpgid(pid_t pid);
int setpgid(pid_t pid, pid_t pgid);

This syscalls get and set the process group ID of a process, which is a separate ID inherited from parent to children processes used for grouping processes for operations like waiting or signal handling. The group ID of the first process started by Ironclad is 0, and userland takes care of it from there.

Both syscalls allow their arguments to be 0. When 0 is passed, it will be taken to be the PID of the calling process for either the pid or pgid fields.

On success, getpgid returns the desired group ID, and setpgid returns 0. On failure, both syscalls return -1 with the following errno:

ESRCH

The passed PID is not valid.