xref: /csrg-svn/lib/libc/sys/getpgrp.2 (revision 61181)
1*61181Sbostic.\" Copyright (c) 1983, 1991, 1993
2*61181Sbostic.\"	The Regents of the University of California.  All rights reserved.
320235Smckusick.\"
447208Scael.\" %sccs.include.redist.man%
520235Smckusick.\"
6*61181Sbostic.\"     @(#)getpgrp.2	8.1 (Berkeley) 06/04/93
747208Scael.\"
847208Scael.Dd
947208Scael.Dt GETPGRP 2
1047208Scael.Os BSD 4.2
1147208Scael.Sh NAME
1247208Scael.Nm getpgrp
1347208Scael.Nd get process group
1447208Scael.Sh SYNOPSIS
1556374Sbostic.Fd #include <unistd.h>
1647208Scael.Ft pid_t
1755794Smarc.Fn getpgrp "void"
1847208Scael.Sh DESCRIPTION
1955794SmarcThe process group of the current process is returned by
2047208Scael.Fn getpgrp .
2147208Scael.Pp
2220235SmckusickProcess groups are used for distribution of signals, and
2320235Smckusickby terminals to arbitrate requests for their input: processes
2423805Ssechrestthat have the same process group as the terminal are foreground
2520235Smckusickand may read, while others will block with a signal if they attempt
2620235Smckusickto read.
2747208Scael.Pp
2820235SmckusickThis call is thus used by programs such as
2947208Scael.Xr csh 1
3020235Smckusickto create
3120235Smckusickprocess groups
3220235Smckusickin implementing job control.
3347208ScaelThe
3455794Smarc.Fn tcgetpgrp
3547208Scaeland
3655794Smarc.Fn tcsetpgrp
3747208Scaelcalls
3820235Smckusickare used to get/set the process group of the control terminal.
3947208Scael.Sh SEE ALSO
4055794Smarc.Xr setpgid 2 ,
4147208Scael.Xr termios 4
4247208Scael.Sh HISTORY
4347208ScaelThe
4447208Scael.Nm
4547208Scaelfunction call appeared in
4647208Scael.Bx 4.0 .
4755794Smarc.Sh STANDARDS
4855794SmarcThe
4955794Smarc.Fn getpgrp
5055794Smarcfunction conforms to IEEE Std 1003.1-1988
5155794Smarc.Pq Dq Tn POSIX .
5255794Smarc.Sh COMPATABILITY
5355794SmarcThis version of
5455794Smarc.Fn getpgrp
5555801Sbosticdiffers from past Berkeley versions by not taking a
5655794Smarc.Fa "pid_t pid"
5755801Sbosticargument.
5855801SbosticThis incompatibility is required by
5955801Sbostic.St -p1003.1-88 .
6055794Smarc.Pp
6155801SbosticFrom the
6255801Sbostic.St -p1003.1-88
6355801SbosticRationale:
6455801Sbostic.sp
6555801Sbostic4.3BSD provides a
6655794Smarc.Fn getpgrp
6755794Smarcfunction that returns the process group ID for a specified process.
6855794SmarcAlthough this function is used to support job control, all known
6955794Smarcjob-control shells always specify the calling process with this
7055801Sbosticfunction.
7155801SbosticThus, the simpler System V
7255794Smarc.Fn getpgrp
7355794Smarcsuffices, and the added complexity of the 4.3BSD
7455794Smarc.Fn getpgrp
7555801Sbostichas been omitted from POSIX.1.
76