Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


setsid — create session and set process group ID


#include <unistd.h>

pid_t setsid(void);


If the calling process is not a process group leader, setsid() creates a new session. The calling process becomes the session leader of this new session, it becomes the process group leader of a new process group, and it has no controlling terminal. The process group ID of the calling process is set equal to the process ID of the calling process. The calling process is the only process in the new process group and the only process in the new session.

Security Restrictions

Some or all of the actions associated with this system call may require privileges. See privileges(5) for more information.


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


If setsid() fails, no changes occur and errno (see errno(2)) is set to one of the following values:


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.


The calling process does not have sufficient privileges.


setsid() was developed by HP and AT&T.


setsid(): AES, SVID3, XPG3, XPG4, XPG4.2, FIPS 151-2, POSIX.1

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.