setsid man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

SETSID(2)							     SETSID(2)

       setsid - create session and set process group ID

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

       pid_t setsid(void);

       The  setsid() function creates a new session, if the calling process is
       not a process group leader. Upon return the calling process will be the
       session leader of this new session, will be the process group leader of
       a new process group, and will have no controlling terminal. The process
       group  ID of the calling process will be set equal to the process ID of
       the calling process. The calling process will be the  only  process  in
       the new process group and the only process in the new session.

       Upon  successful	 completion, setsid() returns the value of the process
       group  ID of the calling process. Otherwise it  returns	(pid_t)−1  and
       sets errno to indicate the error.

       The setsid() function will fail if:

		The  calling process is already a process group leader, or the
		process group ID of a process other than the  calling  process
		matches the process ID of the calling process.

       See attributes(5) for descriptions of the following attributes:

       │Interface Stability │ Standard		│
       │MT-Level	    │ Async-Signal-Safe │

       getsid(2), setpgid(2), setpgrp(2), attributes(5), standards(5)

       A  call	to  setsid()  by a process that is a process group leader will
       fail.  A process can become a process group leader by  being  the  last
       member  of  a  pipeline started by a job control shell. Thus, a process
       that expects to be part of a pipeline, and that calls setsid(),	should
       always  first  fork;  the  parent should exit and the child should call
       setsid(). This will ensure that the calling process will work  reliably
       when started by both job control shells and non-job control shells.

				 Aug 21, 2002			     SETSID(2)

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net