9.59 getsid/setsid

pid_t getsid(pid_t pid);
pid_t setsid(void);

This syscalls get and set the session ID of a process, which is a separate ID inherited from parent to children processes. The session ID of the first process started by Ironclad is 0, and userland takes care of it from there.

getsid allows its arguments to be 0. When 0 is passed, it will be taken to be the PID of the calling process.

On success, getsid returns the session ID, and setsid returns the new session ID. On failure, both syscalls return -1 with the following errno:

ESRCH

The passed PID is not valid.