unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Page:
Section:
Apropos / Subsearch:
optional field



setsid(2)							    setsid(2)



NAME
  setsid - Sets	the process group ID

SYNOPSIS

  #include <&lt;unistd.h>&gt;

  pid_t	setsid(	void );

  Application developers may want to specify an	#include statement for
  <&lt;sys/types.h>&gt;	before the one for <&lt;unistd.h>&gt; if programs are being developed
  for multiple platforms. The additional #include statement is not required
  on Tru64 UNIX	systems	or by ISO or X/Open standards, but may be required on
  other	vendors' systems that conform to these standards.

STANDARDS

  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  setsid():  XPG4, XPG4-UNIX

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.

DESCRIPTION

  The setsid() function	creates	a new session when the calling process is not
  a process group leader.  The calling process then becomes the	session
  leader of this session, becomes the process leader of	the new	process
  group, and has no controlling	terminal.  The process group ID	of the cal-
  ling process is set equal to its process ID.	The calling process becomes
  the only process in the new process group and	the only process in the	new
  session.

RETURN VALUES

  Upon successful completion, the setsid function returns the value of the
  new process group ID.	 Otherwise, a value of (pid_t)-1 is returned and
  errno	is set to indicate the error.

ERRORS

  The setsid() function	sets errno to the specified values for the following
  conditions:

  [EPERM]   The	calling	process	is already the process group leader, or	the
	    process group ID of	another	process	matches	the process ID of the
	    calling process.




RELATED	INFORMATION

  Functions: getpid(2),	getsid(2), setpgid(2)

  Standards: standards(5)