The Open Group Base Specifications Issue 7
IEEE Std 1003.1-2008, 2016 Edition
Copyright © 2001-2016 The IEEE and The Open Group

#### NAME

> setpgrp - set the process group ID

#### SYNOPSIS

> ``[OB XSI] #include <unistd.h>
> pid_t setpgrp(void);``
> `
> `

#### DESCRIPTION

> If the calling process is not already a session leader, setpgrp() sets the process group ID of the calling process to the process ID of the calling process. If setpgrp() creates a new session, then the new session has no controlling terminal.

> The setpgrp() function has no effect when the calling process is a session leader.

#### RETURN VALUE

> Upon completion, setpgrp() shall return the process group ID.

#### ERRORS

> No errors are defined.

The following sections are informative.

#### EXAMPLES

> None.

#### APPLICATION USAGE

> It is unspecified whether this function behaves as setpgid(0,0) or setsid() unless the process is already a session leader. Therefore, applications are encouraged to use setpgid() or setsid() as appropriate.

#### RATIONALE

> None.

#### FUTURE DIRECTIONS

> The setpgrp() function may be removed in a future version.

#### SEE ALSO

> exec, fork, getpid, getsid, kill, setpgid, setsid

> XBD <unistd.h>

#### CHANGE HISTORY

> First released in Issue 4, Version 2.

#### Issue 5

> Moved from X/OPEN UNIX extension to BASE.

#### Issue 7

> The setpgrp() function is marked obsolescent.

End of informative text.

return to top of page

UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
Copyright © 2001-2016 The IEEE and The Open Group, All Rights Reserved
[ Main Index | XBD | XSH | XCU | XRAT ]