151200Smarc.\" Copyright (c) 1991 The Regents of the University of California. 251200Smarc.\" All rights reserved. 351200Smarc.\" 451200Smarc.\" %sccs.include.redist.roff% 551200Smarc.\" 6*52295Sbostic.\" @(#)tcgetpgrp.3 5.2 (Berkeley) 02/03/92 751200Smarc.\" 8*52295Sbostic.Dd "" 9*52295Sbostic.Dt TCGETPGRP 3 1052280Smarc.Os 1152280Smarc.Sh NAME 1252280Smarc.Nm tcgetpgrp 13*52295Sbostic.Nd get foreground process group ID 14*52295Sbostic.Sh SYNOPSIS 15*52295Sbostic.Fd #include <sys/types.h> 16*52295Sbostic.Ft pid_t 17*52295Sbostic.Fn tcgetpgrp "int fd" 18*52295Sbostic.Sh DESCRIPTION 19*52295SbosticThe 20*52295Sbostic.Nm tcgetpgrp 21*52295Sbosticfunction returns the value of the process group ID of the foreground 22*52295Sbosticprocess group associated with the terminal device. 23*52295SbosticIf there is no foreground process group, 24*52295Sbostic.Nm tcgetpgrp 25*52295Sbosticreturns an invalid process ID. 26*52295Sbostic.Sh ERRORS 27*52295SbosticIf an error occurs, 28*52295Sbostic.Nm tcgetpgrp 29*52295Sbosticreturns -1 and the global variable 30*52295Sbostic.Va errno 31*52295Sbosticis set to indicate the error, as follows: 32*52295Sbostic.Bl -tag -width Er 33*52295Sbostic.It Bq Er EBADF 34*52295SbosticThe 35*52295Sbostic.Fa fd 36*52295Sbosticargument is not a valid file descriptor. 37*52295Sbostic.It Bq Er ENOTTY 38*52295SbosticThe calling process does not have a controlling terminal or the 39*52295Sbosticunderlying terminal device represented by 40*52295Sbostic.Fa fd 41*52295Sbosticis not the controlling terminal. 42*52295Sbostic.El 43*52295Sbostic.Sh SEE ALSO 44*52295Sbostic.Xr setpgid 3 , 45*52295Sbostic.Xr setsid 2 , 46*52295Sbostic.Xr tcsetpgrp 3 47*52295Sbostic.Sh STANDARDS 48*52295SbosticThe 49*52295Sbostic.Nm tcgetpgrp 50*52295Sbosticfunction is expected to be compliant with the 51*52295Sbostic.St -p1003.1-88 52*52295Sbosticspecification. 53