]>
Commit | Line | Data |
---|---|---|
a1eaacb1 | 1 | '\" t |
fea681da MK |
2 | .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl> |
3 | .\" | |
5fbde956 | 4 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 5 | .\" |
4c1c5274 | 6 | .TH tcgetpgrp 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
7 | .SH NAME |
8 | tcgetpgrp, tcsetpgrp \- get and set terminal foreground process group | |
95572a8b AC |
9 | .SH LIBRARY |
10 | Standard C library | |
8fc3b2cf | 11 | .RI ( libc ", " \-lc ) |
fea681da | 12 | .SH SYNOPSIS |
15d65653 | 13 | .nf |
0daa9e92 | 14 | .B "#include <unistd.h>" |
c6d039a3 | 15 | .P |
fea681da | 16 | .BI "pid_t tcgetpgrp(int " fd ); |
fea681da | 17 | .BI "int tcsetpgrp(int " fd ", pid_t " pgrp ); |
15d65653 | 18 | .fi |
fea681da MK |
19 | .SH DESCRIPTION |
20 | The function | |
63aa9df0 | 21 | .BR tcgetpgrp () |
fea681da MK |
22 | returns the process group ID of the foreground process group on the |
23 | terminal associated to | |
24 | .IR fd , | |
25 | which must be the controlling terminal of the calling process. | |
26 | .\" The process itself may be a background process. | |
c6d039a3 | 27 | .P |
fea681da | 28 | The function |
63aa9df0 | 29 | .BR tcsetpgrp () |
c6fa0841 MK |
30 | makes the process group with process group ID |
31 | .I pgrp | |
fea681da MK |
32 | the foreground process group on the terminal associated to |
33 | .IR fd , | |
34 | which must be the controlling terminal of the calling process, | |
35 | and still be associated with its session. | |
c6fa0841 MK |
36 | Moreover, |
37 | .I pgrp | |
38 | must be a (nonempty) process group belonging to | |
fea681da | 39 | the same session as the calling process. |
c6d039a3 | 40 | .P |
fea681da | 41 | If |
63aa9df0 | 42 | .BR tcsetpgrp () |
fea681da | 43 | is called by a member of a background process group in its session, |
8bd58774 MK |
44 | and the calling process is not blocking or ignoring |
45 | .BR SIGTTOU , | |
46 | a | |
47 | .B SIGTTOU | |
48 | signal is sent to all members of this background process group. | |
47297adb | 49 | .SH RETURN VALUE |
fea681da MK |
50 | When |
51 | .I fd | |
52 | refers to the controlling terminal of the calling process, | |
53 | the function | |
63aa9df0 | 54 | .BR tcgetpgrp () |
fea681da MK |
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. | |
58 | When | |
59 | .I fd | |
60 | does not refer to the controlling terminal of the calling process, | |
61 | \-1 is returned, and | |
62 | .I errno | |
f6a4078b | 63 | is set to indicate the error. |
c6d039a3 | 64 | .P |
fea681da | 65 | When successful, |
63aa9df0 | 66 | .BR tcsetpgrp () |
677f4766 MK |
67 | returns 0. |
68 | Otherwise, it returns \-1, and | |
fea681da | 69 | .I errno |
f6a4078b | 70 | is set to indicate the error. |
fea681da MK |
71 | .SH ERRORS |
72 | .TP | |
73 | .B EBADF | |
74 | .I fd | |
75 | is not a valid file descriptor. | |
76 | .TP | |
77 | .B EINVAL | |
78 | .I pgrp | |
79 | has an unsupported value. | |
80 | .TP | |
81 | .B ENOTTY | |
82 | The calling process does not have a controlling terminal, or | |
83 | it has one but it is not described by | |
84 | .IR fd , | |
85 | or, for | |
63aa9df0 | 86 | .BR tcsetpgrp (), |
fea681da MK |
87 | this controlling terminal is no longer associated with the session |
88 | of the calling process. | |
89 | .TP | |
90 | .B EPERM | |
91 | .I pgrp | |
92 | has a supported value, but is not the process group ID of a | |
93 | process in the same session as the calling process. | |
8f9d0619 | 94 | .SH ATTRIBUTES |
5bcd1ce4 PH |
95 | For an explanation of the terms used in this section, see |
96 | .BR attributes (7). | |
97 | .TS | |
98 | allbox; | |
c466875e | 99 | lbx lb lb |
5bcd1ce4 PH |
100 | l l l. |
101 | Interface Attribute Value | |
102 | T{ | |
9e54434e BR |
103 | .na |
104 | .nh | |
5bcd1ce4 | 105 | .BR tcgetpgrp (), |
8f9d0619 | 106 | .BR tcsetpgrp () |
5bcd1ce4 PH |
107 | T} Thread safety MT-Safe |
108 | .TE | |
4131356c | 109 | .SH VERSIONS |
097585ed MK |
110 | These functions are implemented via the |
111 | .B TIOCGPGRP | |
112 | and | |
113 | .B TIOCSPGRP | |
114 | ioctls. | |
4131356c AC |
115 | .SH STANDARDS |
116 | POSIX.1-2008. | |
117 | .SH HISTORY | |
118 | POSIX.1-2001. | |
c6d039a3 | 119 | .P |
889829be | 120 | The ioctls appeared in 4.2BSD. |
1c44bd5b | 121 | The functions are POSIX inventions. |
47297adb | 122 | .SH SEE ALSO |
fea681da | 123 | .BR setpgid (2), |
53a1443c MK |
124 | .BR setsid (2), |
125 | .BR credentials (7) |