1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH TCGETPGRP 3 2021-03-22 "GNU" "Linux Programmer's Manual"
27 tcgetpgrp, tcsetpgrp \- get and set terminal foreground process group
30 .B "#include <unistd.h>"
32 .BI "pid_t tcgetpgrp(int " fd );
33 .BI "int tcsetpgrp(int " fd ", pid_t " pgrp );
38 returns the process group ID of the foreground process group on the
39 terminal associated to
41 which must be the controlling terminal of the calling process.
42 .\" The process itself may be a background process.
46 makes the process group with process group ID
48 the foreground process group on the terminal associated to
50 which must be the controlling terminal of the calling process,
51 and still be associated with its session.
54 must be a (nonempty) process group belonging to
55 the same session as the calling process.
59 is called by a member of a background process group in its session,
60 and the calling process is not blocking or ignoring
64 signal is sent to all members of this background process group.
68 refers to the controlling terminal of the calling process,
71 will return the foreground process group ID of that terminal
72 if there is one, and some value larger than 1 that is not
73 presently a process group ID otherwise.
76 does not refer to the controlling terminal of the calling process,
79 is set to indicate the error.
84 Otherwise, it returns \-1, and
86 is set to indicate the error.
91 is not a valid file descriptor.
95 has an unsupported value.
98 The calling process does not have a controlling terminal, or
99 it has one but it is not described by
103 this controlling terminal is no longer associated with the session
104 of the calling process.
108 has a supported value, but is not the process group ID of a
109 process in the same session as the calling process.
111 For an explanation of the terms used in this section, see
119 Interface Attribute Value
123 T} Thread safety MT-Safe
129 POSIX.1-2001, POSIX.1-2008.
131 These functions are implemented via the
137 The ioctls appeared in 4.2BSD.
138 The functions are POSIX inventions.