1*47208Scael.\" Copyright (c) 1983, 1991 Regents of the University of California. 2*47208Scael.\" All rights reserved. 320235Smckusick.\" 4*47208Scael.\" %sccs.include.redist.man% 520235Smckusick.\" 6*47208Scael.\" @(#)getpgrp.2 6.4 (Berkeley) 03/10/91 7*47208Scael.\" 8*47208Scael.Dd 9*47208Scael.Dt GETPGRP 2 10*47208Scael.Os BSD 4.2 11*47208Scael.Sh NAME 12*47208Scael.Nm getpgrp 13*47208Scael.Nd get process group 14*47208Scael.Sh SYNOPSIS 15*47208Scael.Ft pid_t 16*47208Scael.Fn getpgrp "int pid" 17*47208Scael.Sh DESCRIPTION 1820235SmckusickThe process group of the specified process is returned by 19*47208Scael.Fn getpgrp . 2020235SmckusickIf 21*47208Scael.Fa pid 22*47208Scaelis zero, the call applies to the current process. 23*47208Scael.Pp 2420235SmckusickProcess groups are used for distribution of signals, and 2520235Smckusickby terminals to arbitrate requests for their input: processes 2623805Ssechrestthat have the same process group as the terminal are foreground 2720235Smckusickand may read, while others will block with a signal if they attempt 2820235Smckusickto read. 29*47208Scael.Pp 3020235SmckusickThis call is thus used by programs such as 31*47208Scael.Xr csh 1 3220235Smckusickto create 3320235Smckusickprocess groups 3420235Smckusickin implementing job control. 35*47208ScaelThe 36*47208Scael.Dv TIOCGPGRP 37*47208Scaeland 38*47208Scael.Dv TIOCSPGRP 39*47208Scaelcalls 4020235Smckusickdescribed in 41*47208Scael.Xr termios 4 4220235Smckusickare used to get/set the process group of the control terminal. 43*47208Scael.Sh SEE ALSO 44*47208Scael.Xr setpgrp 2 , 45*47208Scael.Xr getuid 2 , 46*47208Scael.Xr termios 4 47*47208Scael.Sh HISTORY 48*47208ScaelThe 49*47208Scael.Nm 50*47208Scaelfunction call appeared in 51*47208Scael.Bx 4.0 . 52