]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/tcgetpgrp.3
Include Section number in .TH line for POSIX pages.
[thirdparty/man-pages.git] / man3 / tcgetpgrp.3
CommitLineData
fea681da
MK
1.\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2.\"
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.
6.\"
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.
c13182ef 11.\"
fea681da
MK
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
18.\" professionally.
c13182ef 19.\"
fea681da
MK
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\"
69962544 23.TH TCGETPGRP 3 2003-01-28 "GNU" "Linux Programmer's Manual"
fea681da
MK
24.SH NAME
25tcgetpgrp, tcsetpgrp \- get and set terminal foreground process group
26.SH SYNOPSIS
27.sp
28.BR "#include <unistd.h>"
29.sp
30.BI "pid_t tcgetpgrp(int " fd );
31.sp
32.BI "int tcsetpgrp(int " fd ", pid_t " pgrp );
33.SH DESCRIPTION
34The function
63aa9df0 35.BR tcgetpgrp ()
fea681da
MK
36returns the process group ID of the foreground process group on the
37terminal associated to
38.IR fd ,
39which must be the controlling terminal of the calling process.
40.\" The process itself may be a background process.
41.LP
42The function
63aa9df0 43.BR tcsetpgrp ()
fea681da
MK
44makes the process group with process group ID \fIpgrp\fP
45the foreground process group on the terminal associated to
46.IR fd ,
47which must be the controlling terminal of the calling process,
48and still be associated with its session.
49Moreover, \fIpgrp\fP must be a (nonempty) process group belonging to
50the same session as the calling process.
51.LP
52If
63aa9df0 53.BR tcsetpgrp ()
fea681da
MK
54is called by a member of a background process group in its session,
55and the calling process is not blocking or ignoring SIGTTOU,
56a SIGTTOU signal is sent to all members of this background process group.
57.SH "RETURN VALUE"
58When
59.I fd
60refers to the controlling terminal of the calling process,
61the function
63aa9df0 62.BR tcgetpgrp ()
fea681da
MK
63will return the foreground process group ID of that terminal
64if there is one, and some value larger than 1 that is not
65presently a process group ID otherwise.
66When
67.I fd
68does not refer to the controlling terminal of the calling process,
69\-1 is returned, and
70.I errno
71is set appropriately.
72.LP
73When successful,
63aa9df0 74.BR tcsetpgrp ()
677f4766
MK
75returns 0.
76Otherwise, it returns \-1, and
fea681da
MK
77.I errno
78is set appropriately.
79.SH ERRORS
80.TP
81.B EBADF
82.I fd
83is not a valid file descriptor.
84.TP
85.B EINVAL
86.I pgrp
87has an unsupported value.
88.TP
89.B ENOTTY
90The calling process does not have a controlling terminal, or
91it has one but it is not described by
92.IR fd ,
93or, for
63aa9df0 94.BR tcsetpgrp (),
fea681da
MK
95this controlling terminal is no longer associated with the session
96of the calling process.
97.TP
98.B EPERM
99.I pgrp
100has a supported value, but is not the process group ID of a
101process in the same session as the calling process.
2b2581ee
MK
102.SH "CONFORMING TO"
103POSIX.1-2001.
fea681da
MK
104.SH NOTES
105These functions are implemented via the TIOCGPGRP and
106TIOCSPGRP ioctls.
889829be
MK
107.SS History
108The ioctls appeared in 4.2BSD.
1c44bd5b 109The functions are POSIX inventions.
fea681da
MK
110.SH "SEE ALSO"
111.BR setpgid (2),
53a1443c
MK
112.BR setsid (2),
113.BR credentials (7)