date and time created 91/04/12 13:40:31 by bostic
[unix-history] / usr / src / lib / libc / sys / getpgrp.2
CommitLineData
931b8415
CL
1.\" Copyright (c) 1983, 1991 Regents of the University of California.
2.\" All rights reserved.
b0a4bad9 3.\"
931b8415 4.\" %sccs.include.redist.man%
b0a4bad9 5.\"
931b8415
CL
6.\" @(#)getpgrp.2 6.4 (Berkeley) %G%
7.\"
8.Dd
9.Dt GETPGRP 2
10.Os BSD 4.2
11.Sh NAME
12.Nm getpgrp
13.Nd get process group
14.Sh SYNOPSIS
15.Ft pid_t
16.Fn getpgrp "int pid"
17.Sh DESCRIPTION
b0a4bad9 18The process group of the specified process is returned by
931b8415 19.Fn getpgrp .
b0a4bad9 20If
931b8415
CL
21.Fa pid
22is zero, the call applies to the current process.
23.Pp
b0a4bad9
KM
24Process groups are used for distribution of signals, and
25by terminals to arbitrate requests for their input: processes
214b5721 26that have the same process group as the terminal are foreground
b0a4bad9
KM
27and may read, while others will block with a signal if they attempt
28to read.
931b8415 29.Pp
b0a4bad9 30This call is thus used by programs such as
931b8415 31.Xr csh 1
b0a4bad9
KM
32to create
33process groups
34in implementing job control.
931b8415
CL
35The
36.Dv TIOCGPGRP
37and
38.Dv TIOCSPGRP
39calls
b0a4bad9 40described in
931b8415 41.Xr termios 4
b0a4bad9 42are used to get/set the process group of the control terminal.
931b8415
CL
43.Sh SEE ALSO
44.Xr setpgrp 2 ,
45.Xr getuid 2 ,
46.Xr termios 4
47.Sh HISTORY
48The
49.Nm
50function call appeared in
51.Bx 4.0 .