1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
23 .TH TCGETPGRP 3 2003-01-28 "POSIX" "Linux Programmer's Manual"
25 tcgetpgrp, tcsetpgrp \- get and set terminal foreground process group
28 .BR "#include <unistd.h>"
30 .BI "pid_t tcgetpgrp(int " fd );
32 .BI "int tcsetpgrp(int " fd ", pid_t " pgrp );
36 returns the process group ID of the foreground process group on the
37 terminal associated to
39 which must be the controlling terminal of the calling process.
40 .\" The process itself may be a background process.
44 makes the process group with process group ID \fIpgrp\fP
45 the foreground process group on the terminal associated to
47 which must be the controlling terminal of the calling process,
48 and still be associated with its session.
49 Moreover, \fIpgrp\fP must be a (nonempty) process group belonging to
50 the same session as the calling process.
54 is called by a member of a background process group in its session,
55 and the calling process is not blocking or ignoring SIGTTOU,
56 a SIGTTOU signal is sent to all members of this background process group.
60 refers to the controlling terminal of the calling process,
63 will return the foreground process group ID of that terminal
64 if there is one, and some value larger than 1 that is not
65 presently a process group ID otherwise.
68 does not refer to the controlling terminal of the calling process,
75 returns 0. Otherwise, it returns \-1, and
82 is not a valid file descriptor.
86 has an unsupported value.
89 The calling process does not have a controlling terminal, or
90 it has one but it is not described by
94 this controlling terminal is no longer associated with the session
95 of the calling process.
99 has a supported value, but is not the process group ID of a
100 process in the same session as the calling process.
102 These functions are implemented via the TIOCGPGRP and
105 These ioctls appeared in 4.2 BSD. The functions are POSIX inventions.