gno/usr.man/man2/getpgrp.2

113 lines
3.7 KiB
Groff
Raw Normal View History

1997-02-27 07:32:31 +00:00
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" 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.
.\"
.\" @(#)getpgrp.2 8.1 (Berkeley) 6/4/93
.\"
.TH GETPGRP 2 "16 January 1997" GNO "System Calls"
.SH NAME
.BR getpgrp
\- get process group
.SH SYNOPSIS
.br
#include <unistd.h>
.sp 1
pid_t
\fB_getpgrp\fR (pid_t \fIpid\fR);
.br
pid_t
\fBgetpgrp\fR (void);
.SH DESCRIPTION
.BR getpgrp
returns the process group of the current process.
.BR _getpgrp
returns the process group of the process specified by
.IR pid .
.LP
Process groups are used for distribution of signals, and
by terminals to arbitrate requests for their input: processes
that have the same process group as the terminal are foreground
and may read, while others will block with a signal if they attempt
to read.
.LP
This call is thus used by programs such as
.BR csh (1)
to create
process groups
in implementing job control.
The
.BR tcgetpgrp
and
.BR tcsetpgrp
calls
are used to get/set the process group of the control terminal.
.SH RETURNS
On success, the requested process group is returned. On failure, -1 is
returned and
.BR errno
is set.
.SH STANDARDS
The
.BR getpgrp
function conforms to IEEE Std 1003.1-1988 (POSIX).
.SH COMPATIBILITY
This version of
.BR getpgrp
differs from past GNO (pre-v2.0.6) and Berkeley versions by not taking a
.I "pid_t pid"
argument.
This incompatibility is required by
POSIX 1003.1-88.
.IP "From the POSIX 1003.1-88 Rationale:"
4.3BSD provides a
.BR getpgrp
function that returns the process group ID for a specified process.
Although this function is used to support job control, all known
job-control shells always specify the calling process with this
function.
Thus, the simpler System V
.BR getpgrp
suffices, and the added complexity of the 4.3BSD
.BR getpgrp
has been omitted from POSIX.1.
.LP
The older version of
.BR getpgrp
which takes an argument is available as the non-standard function
.BR _getpgrp .
.SH SEE ALSO
.BR job_control (2),
.BR setpgid (2),
.BR termios (4)
.SH HISTORY
The
.BR getpgrp
function call appeared in 4.0BSD.