1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)getpgrp.2 8.1 (Berkeley) 06/04/93 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.Fd #include <unistd.h> 16.Ft pid_t 17.Fn getpgrp "void" 18.Sh DESCRIPTION 19The process group of the current process is returned by 20.Fn getpgrp . 21.Pp 22Process groups are used for distribution of signals, and 23by terminals to arbitrate requests for their input: processes 24that have the same process group as the terminal are foreground 25and may read, while others will block with a signal if they attempt 26to read. 27.Pp 28This call is thus used by programs such as 29.Xr csh 1 30to create 31process groups 32in implementing job control. 33The 34.Fn tcgetpgrp 35and 36.Fn tcsetpgrp 37calls 38are used to get/set the process group of the control terminal. 39.Sh SEE ALSO 40.Xr setpgid 2 , 41.Xr termios 4 42.Sh HISTORY 43The 44.Nm 45function call appeared in 46.Bx 4.0 . 47.Sh STANDARDS 48The 49.Fn getpgrp 50function conforms to IEEE Std 1003.1-1988 51.Pq Dq Tn POSIX . 52.Sh COMPATABILITY 53This version of 54.Fn getpgrp 55differs from past Berkeley versions by not taking a 56.Fa "pid_t pid" 57argument. 58This incompatibility is required by 59.St -p1003.1-88 . 60.Pp 61From the 62.St -p1003.1-88 63Rationale: 64.sp 654.3BSD provides a 66.Fn getpgrp 67function that returns the process group ID for a specified process. 68Although this function is used to support job control, all known 69job-control shells always specify the calling process with this 70function. 71Thus, 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. 76