xref: /csrg-svn/lib/libc/sys/getpgrp.2 (revision 55794)
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.5 (Berkeley) 07/30/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 because it does
55not take a
56.Fa "pid_t pid"
57argument.  We regret changing this but were forced to in
58order to comply with IEEE Std 1003.1-1988
59.Pq Dq Tn POSIX .
60The reasons \fIthey\fR gave for changing this are quoted
61in the next paragraph.  We wonder why they didn't just
62change the name to avoid this incompatability.
63.Pp
64(Quoted from the POSIX Rationale)
65.br
66\fI4.3BSD provides a
67.Fn getpgrp
68function that returns the process group ID for a specified process.
69Although this function is used to support job control, all known
70job-control shells always specify the calling process with this
71function.  Thus, the simpler System V
72.Fn getpgrp
73suffices, and the added complexity of the 4.3BSD
74.Fn getpgrp
75has been omitted from POSIX.1.\fP
76