1TCGETPGRP(3) Linux Programmer's Manual TCGETPGRP(3)
2
3
4
6 tcgetpgrp, tcsetpgrp - get and set terminal foreground process group
7
9 #include <unistd.h>
10
11 pid_t tcgetpgrp(int fd);
12
13 int tcsetpgrp(int fd, pid_t pgrp);
14
16 The function tcgetpgrp() returns the process group ID of the foreground
17 process group on the terminal associated to fd, which must be the con‐
18 trolling terminal of the calling process.
19
20 The function tcsetpgrp() makes the process group with process group ID
21 pgrp the foreground process group on the terminal associated to fd,
22 which must be the controlling terminal of the calling process, and
23 still be associated with its session. Moreover, pgrp must be a
24 (nonempty) process group belonging to the same session as the calling
25 process.
26
27 If tcsetpgrp() is called by a member of a background process group in
28 its session, and the calling process is not blocking or ignoring SIGT‐
29 TOU, a SIGTTOU signal is sent to all members of this background process
30 group.
31
33 When fd refers to the controlling terminal of the calling process, the
34 function tcgetpgrp() will return the foreground process group ID of
35 that terminal if there is one, and some value larger than 1 that is not
36 presently a process group ID otherwise. When fd does not refer to the
37 controlling terminal of the calling process, -1 is returned, and errno
38 is set appropriately.
39
40 When successful, tcsetpgrp() returns 0. Otherwise, it returns -1, and
41 errno is set appropriately.
42
44 EBADF fd is not a valid file descriptor.
45
46 EINVAL pgrp has an unsupported value.
47
48 ENOTTY The calling process does not have a controlling terminal, or it
49 has one but it is not described by fd, or, for tcsetpgrp(), this
50 controlling terminal is no longer associated with the session of
51 the calling process.
52
53 EPERM pgrp has a supported value, but is not the process group ID of a
54 process in the same session as the calling process.
55
57 POSIX.1-2001.
58
60 These functions are implemented via the TIOCGPGRP and TIOCSPGRP ioctls.
61
62 History
63 The ioctls appeared in 4.2BSD. The functions are POSIX inventions.
64
66 setpgid(2), setsid(2), credentials(7)
67
69 This page is part of release 3.25 of the Linux man-pages project. A
70 description of the project, and information about reporting bugs, can
71 be found at http://www.kernel.org/doc/man-pages/.
72
73
74
75GNU 2003-01-28 TCGETPGRP(3)