Debian Codegraph @

upstream/debian-unstable/man2/TIOCSPGRP.2const

raw
1 .\" Copyright 2002, Walter Harms <[email protected]>
2 .\" Copyright 2002, Andries E. Brouwer <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\"
7 .TH TIOCSPGRP 2const 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 TIOCGPGRP,
10 TIOCSPGRP,
11 TIOCGSID
12 \-
13 process group and session ID
14 .SH LIBRARY
15 Standard C library
16 .RI ( libc ,\~ \-lc )
17 .SH SYNOPSIS
18 .nf
19 .BR "#include <asm/termbits.h>" " /* Definition of " TIOC* " constants */"
20 .B #include <sys/ioctl.h>
21 .P
22 .BI "int ioctl(int " fd ", TIOCGPGRP, pid_t *" argp );
23 .BI "int ioctl(int " fd ", TIOCSPGRP, const pid_t *" argp );
24 .BI "int ioctl(int " fd ", TIOCGSID, pid_t *" argp );
25 .fi
26 .SH DESCRIPTION
27 .TP
28 .B TIOCGPGRP
29 When successful, equivalent to
30 .IR "*argp = tcgetpgrp(fd)" .
31 .IP
32 Get the process group ID of the foreground process group on this terminal.
33 .TP
34 .B TIOCSPGRP
35 Equivalent to
36 .IR "tcsetpgrp(fd, *argp)" .
37 .IP
38 Set the foreground process group ID of this terminal.
39 .TP
40 .B TIOCGSID
41 When successful, equivalent to
42 .IR "*argp = tcgetsid(fd)" .
43 .IP
44 Get the session ID of the given terminal.
45 This fails with the error
46 .B ENOTTY
47 if the terminal is not a master pseudoterminal
48 and not our controlling terminal.
49 Strange.
50 .SH RETURN VALUE
51 On success,
52 0 is returned.
53 On error,
54 \-1 is returned, and
55 .I errno
56 is set to indicate the error.
57 .SH ERRORS
58 .TP
59 .B ENOTTY
60 The terminal is not a master pseudoterminal and not our controlling terminal.
61 .TP
62 .B EPERM
63 Insufficient permission.
64 .SH SEE ALSO
65 .BR ioctl (2),
66 .BR ioctl_tty (2),
67 .BR tcgetpgrp (3),
68 .BR tcsetpgrp (3),
69 .BR tcgetsid (3)