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