.\" and Copyright (C) 2007, Michael Kerrisk <mtk.manpages@gmail.com>
.\" All rights reserved.
.\"
+.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
+.\" %%%LICENSE_END
.\"
.\" @(#)getpgrp.2 6.4 (Berkeley) 3/10/91
.\"
.\" 2007-07-25, mtk, fairly substantial rewrites and rearrangements
.\" of text.
.\"
-.TH SETPGID 2 2010-09-26 "Linux" "Linux Programmer's Manual"
+.TH SETPGID 2 2014-01-07 "Linux" "Linux Programmer's Manual"
.SH NAME
setpgid, getpgid, setpgrp, getpgrp \- set/get process group
.SH SYNOPSIS
.nf
_SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
+.br
+ || /* Since glibc 2.19: */ _BSD_SOURCE
.fi
.sp
.BR setpgrp "()\ (BSD),"
-.BR getpgrp "()\ (BSD):"
+.BR getpgrp "()\ (BSD) [before glibc 2.19]:"
.nf
_BSD_SOURCE &&
!\ (_POSIX_SOURCE || _POSIX_C_SOURCE || _XOPEN_SOURCE ||
.BR getpgrp ()
is preferred for that task.)
-The System V-style
+The System\ V-style
.BR setpgrp (),
which takes no arguments, is equivalent to
.IR "setpgid(0,\ 0)" .
.I pid
and
.IR pgid ,
-is equivalent to
-.IR "setpgid(pid, pgid)" .
+is is a wrapper function that calls
+
+ setpgid(pid, pgid)
+
.\" The true BSD setpgrp() system call differs in allowing the PGID
.\" to be set to arbitrary values, rather than being restricted to
.\" PGIDs in the same session.
+Since glibc 2.19, the BSD-specific
+.BR setpgrp ()
+function is no longer exposed by
+.IR <unistd.h> ;
+calls should be replaced with the
+.BR setpgid ()
+call shown above.
The BSD-specific
.BR getpgrp ()
call, which takes a single
.I pid
-argument, is equivalent to
-.IR "getpgid(pid)" .
-.SH "RETURN VALUE"
+argument, is a wrapper function that calls
+
+ getpgid(pid)
+
+Since glibc 2.19, the BSD-specific
+.BR getpgrp ()
+function is no longer exposed by
+.IR <unistd.h> ;
+calls should be replaced with calls to the POSIX.1
+.BR getpgrp ()
+which takes no arguments (if the intent is to obtain the caller's PGID),
+or with the
+.BR getpgid ()
+call shown above.
+.SH RETURN VALUE
On success,
.BR setpgid ()
and
.BR setpgid ():
.I pid
is not the calling process and not a child of the calling process.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
.BR setpgid ()
and the version of
.BR getpgrp ()
if a background process group tries to
.BR read (2)
from the terminal, then the group is sent a
-.B SIGTSTP
+.B SIGTTIN
signal, which suspends it.
The
.BR tcgetpgrp (3)
of the process group or is a member of a process group
in a different session (see also
.BR credentials (7)).
-.SH "SEE ALSO"
+.SH SEE ALSO
.BR getuid (2),
.BR setsid (2),
.BR tcgetpgrp (3),
.BR tcsetpgrp (3),
.BR termios (3),
.BR credentials (7)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.