2 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH tcgetpgrp 3 (date) "Linux man-pages (unreleased)"
8 tcgetpgrp, tcsetpgrp \- get and set terminal foreground process group
11 .RI ( libc ", " \-lc )
14 .B "#include <unistd.h>"
16 .BI "pid_t tcgetpgrp(int " fd );
17 .BI "int tcsetpgrp(int " fd ", pid_t " pgrp );
22 returns the process group ID of the foreground process group on the
23 terminal associated to
25 which must be the controlling terminal of the calling process.
26 .\" The process itself may be a background process.
30 makes the process group with process group ID
32 the foreground process group on the terminal associated to
34 which must be the controlling terminal of the calling process,
35 and still be associated with its session.
38 must be a (nonempty) process group belonging to
39 the same session as the calling process.
43 is called by a member of a background process group in its session,
44 and the calling process is not blocking or ignoring
48 signal is sent to all members of this background process group.
52 refers to the controlling terminal of the calling process,
55 will return the foreground process group ID of that terminal
56 if there is one, and some value larger than 1 that is not
57 presently a process group ID otherwise.
60 does not refer to the controlling terminal of the calling process,
63 is set to indicate the error.
68 Otherwise, it returns \-1, and
70 is set to indicate the error.
75 is not a valid file descriptor.
79 has an unsupported value.
82 The calling process does not have a controlling terminal, or
83 it has one but it is not described by
87 this controlling terminal is no longer associated with the session
88 of the calling process.
92 has a supported value, but is not the process group ID of a
93 process in the same session as the calling process.
95 For an explanation of the terms used in this section, see
101 Interface Attribute Value
107 T} Thread safety MT-Safe
110 These functions are implemented via the
120 The ioctls appeared in 4.2BSD.
121 The functions are POSIX inventions.