xref: /original-bsd/lib/libc/sys/getpgrp.2 (revision 860e07fc)
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.6 (Berkeley) 08/01/92
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 "void"
17.Sh DESCRIPTION
18The process group of the current process is returned by
19.Fn getpgrp .
20.Pp
21Process groups are used for distribution of signals, and
22by terminals to arbitrate requests for their input: processes
23that have the same process group as the terminal are foreground
24and may read, while others will block with a signal if they attempt
25to read.
26.Pp
27This call is thus used by programs such as
28.Xr csh 1
29to create
30process groups
31in implementing job control.
32The
33.Fn tcgetpgrp
34and
35.Fn tcsetpgrp
36calls
37are used to get/set the process group of the control terminal.
38.Sh SEE ALSO
39.Xr setpgid 2 ,
40.Xr termios 4
41.Sh HISTORY
42The
43.Nm
44function call appeared in
45.Bx 4.0 .
46.Sh STANDARDS
47The
48.Fn getpgrp
49function conforms to IEEE Std 1003.1-1988
50.Pq Dq Tn POSIX .
51.Sh COMPATABILITY
52This version of
53.Fn getpgrp
54differs from past Berkeley versions by not taking a
55.Fa "pid_t pid"
56argument.
57This incompatibility is required by
58.St -p1003.1-88 .
59.Pp
60From the
61.St -p1003.1-88
62Rationale:
63.sp
644.3BSD provides a
65.Fn getpgrp
66function that returns the process group ID for a specified process.
67Although this function is used to support job control, all known
68job-control shells always specify the calling process with this
69function.
70Thus, the simpler System V
71.Fn getpgrp
72suffices, and the added complexity of the 4.3BSD
73.Fn getpgrp
74has been omitted from POSIX.1.
75