xref: /original-bsd/lib/libc/sys/getpgrp.2 (revision 2d1a7683)
1.\" Copyright (c) 1983, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)getpgrp.2	6.4 (Berkeley) 03/10/91
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
18The process group of the specified process is returned by
19.Fn getpgrp .
20If
21.Fa pid
22is zero, the call applies to the current process.
23.Pp
24Process groups are used for distribution of signals, and
25by terminals to arbitrate requests for their input: processes
26that have the same process group as the terminal are foreground
27and may read, while others will block with a signal if they attempt
28to read.
29.Pp
30This call is thus used by programs such as
31.Xr csh 1
32to create
33process groups
34in implementing job control.
35The
36.Dv TIOCGPGRP
37and
38.Dv TIOCSPGRP
39calls
40described in
41.Xr termios 4
42are used to get/set the process group of the control terminal.
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 .
52