Commit | Line | Data |
---|---|---|
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 | 18 | The process group of the specified process is returned by |
931b8415 | 19 | .Fn getpgrp . |
b0a4bad9 | 20 | If |
931b8415 CL |
21 | .Fa pid |
22 | is zero, the call applies to the current process. | |
23 | .Pp | |
b0a4bad9 KM |
24 | Process groups are used for distribution of signals, and |
25 | by terminals to arbitrate requests for their input: processes | |
214b5721 | 26 | that have the same process group as the terminal are foreground |
b0a4bad9 KM |
27 | and may read, while others will block with a signal if they attempt |
28 | to read. | |
931b8415 | 29 | .Pp |
b0a4bad9 | 30 | This call is thus used by programs such as |
931b8415 | 31 | .Xr csh 1 |
b0a4bad9 KM |
32 | to create |
33 | process groups | |
34 | in implementing job control. | |
931b8415 CL |
35 | The |
36 | .Dv TIOCGPGRP | |
37 | and | |
38 | .Dv TIOCSPGRP | |
39 | calls | |
b0a4bad9 | 40 | described in |
931b8415 | 41 | .Xr termios 4 |
b0a4bad9 | 42 | are 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 | |
48 | The | |
49 | .Nm | |
50 | function call appeared in | |
51 | .Bx 4.0 . |