1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH TCGETPGRP 3 2021-03-22 "Linux man-pages (unreleased)"
7 tcgetpgrp, tcsetpgrp \- get and set terminal foreground process group
10 .RI ( libc ", " \-lc )
13 .B "#include <unistd.h>"
15 .BI "pid_t tcgetpgrp(int " fd );
16 .BI "int tcsetpgrp(int " fd ", pid_t " pgrp );
21 returns the process group ID of the foreground process group on the
22 terminal associated to
24 which must be the controlling terminal of the calling process.
25 .\" The process itself may be a background process.
29 makes the process group with process group ID
31 the foreground process group on the terminal associated to
33 which must be the controlling terminal of the calling process,
34 and still be associated with its session.
37 must be a (nonempty) process group belonging to
38 the same session as the calling process.
42 is called by a member of a background process group in its session,
43 and the calling process is not blocking or ignoring
47 signal is sent to all members of this background process group.
51 refers to the controlling terminal of the calling process,
54 will return the foreground process group ID of that terminal
55 if there is one, and some value larger than 1 that is not
56 presently a process group ID otherwise.
59 does not refer to the controlling terminal of the calling process,
62 is set to indicate the error.
67 Otherwise, it returns \-1, and
69 is set to indicate the error.
74 is not a valid file descriptor.
78 has an unsupported value.
81 The calling process does not have a controlling terminal, or
82 it has one but it is not described by
86 this controlling terminal is no longer associated with the session
87 of the calling process.
91 has a supported value, but is not the process group ID of a
92 process in the same session as the calling process.
94 For an explanation of the terms used in this section, see
102 Interface Attribute Value
106 T} Thread safety MT-Safe
112 POSIX.1-2001, POSIX.1-2008.
114 These functions are implemented via the
120 The ioctls appeared in 4.2BSD.
121 The functions are POSIX inventions.