Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

exit(2)

fork(2)

getpid(2)

getpgid(2)

getsid(2)

setpgid(2)

setpgrp(2)

signal(2)

sigsend(2)

setsid(2)                                                         setsid(2)

NAME
     setsid - set session ID

SYNOPSIS
     #include <sys/types.h>
     #include <unistd.h>

     pidt setsid(void);

DESCRIPTION
     If the calling process is not already a process group leader, setsid()
     sets the process group ID and session ID of the calling process to the
     process ID of the calling process, and releases the process' control-
     ling terminal.

     setsid() will fail and return an error if the following is true:

     EPERM    The calling process is already a process group leader, or
              there are processes other than the calling process whose pro-
              cess group ID is equal to the process ID of the calling pro-
              cess.

NOTES
     If the calling process is the last member of a pipeline started by a
     job control shell, the shell may make the calling process a process
     group leader. The other processes of the pipeline become members of
     that process group. In this case, the call to setsid() will fail. For
     this reason, a process that calls setsid() and expects to be part of a
     pipeline should always execute a fork(2) first; the parent should exit
     and the child should call setsid(), thereby insuring that the process
     will work reliably when started by both job control shells and non-job
     control shells.

RESULT
     Upon successful completion, setsid() returns the calling process' ses-
     sion ID. Otherwise, a value of -1 is returned and errno is set to
     indicate the error.

SEE ALSO
     exec(2), exit(2), fork(2), getpid(2), getpgid(2), getsid(2),
     setpgid(2), setpgrp(2), signal(2), sigsend(2).














Page 1                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026