Add copyright
[unix-history] / usr / src / lib / libc / sys / getpgrp.2
CommitLineData
b0a4bad9
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
588742b6 5.\" @(#)getpgrp.2 6.1 (Berkeley) %G%
b0a4bad9 6.\"
588742b6 7.TH GETPGRP 2 ""
b0a4bad9
KM
8.UC 5
9.SH NAME
10getpgrp \- get process group
11.SH SYNOPSIS
12.ft B
13.nf
14pgrp = getpgrp(pid)
15int prgp;
16int pid;
17.fi
18.ft R
19.SH DESCRIPTION
20The process group of the specified process is returned by
21.I getpgrp.
22If
23.I pid
24is zero, then the call applies to the current process.
25.PP
26Process groups are used for distribution of signals, and
27by terminals to arbitrate requests for their input: processes
28which have the same process group as the terminal are foreground
29and may read, while others will block with a signal if they attempt
30to read.
31.PP
32This call is thus used by programs such as
33.IR csh (1)
34to create
35process groups
36in implementing job control.
37The TIOCGPGRP and TIOCSPGRP calls
38described in
39.IR tty (4)
40are used to get/set the process group of the control terminal.
41.SH "SEE ALSO"
42setpgrp(2), getuid(2), tty(4)