xref: /original-bsd/lib/libc/gen/tcgetpgrp.3 (revision 753853ba)
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.2 (Berkeley) 02/03/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.Ft pid_t
17.Fn tcgetpgrp "int fd"
18.Sh DESCRIPTION
19The
20.Nm tcgetpgrp
21function returns the value of the process group ID of the foreground
22process group associated with the terminal device.
23If there is no foreground process group,
24.Nm tcgetpgrp
25returns an invalid process ID.
26.Sh ERRORS
27If an error occurs,
28.Nm tcgetpgrp
29returns -1 and the global variable
30.Va errno
31is set to indicate the error, as follows:
32.Bl -tag -width Er
33.It Bq Er EBADF
34The
35.Fa fd
36argument is not a valid file descriptor.
37.It Bq Er ENOTTY
38The calling process does not have a controlling terminal or the
39underlying terminal device represented by
40.Fa fd
41is not the controlling terminal.
42.El
43.Sh SEE ALSO
44.Xr setpgid 3 ,
45.Xr setsid 2 ,
46.Xr tcsetpgrp 3
47.Sh STANDARDS
48The
49.Nm tcgetpgrp
50function is expected to be compliant with the
51.St -p1003.1-88
52specification.
53