1TCSETPGRP(3P) POSIX Programmer's Manual TCSETPGRP(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 tcsetpgrp — set the foreground process group ID
13
15 #include <unistd.h>
16
17 int tcsetpgrp(int fildes, pid_t pgid_id);
18
20 If the process has a controlling terminal, tcsetpgrp() shall set the
21 foreground process group ID associated with the terminal to pgid_id.
22 The application shall ensure that the file associated with fildes is
23 the controlling terminal of the calling process and the controlling
24 terminal is currently associated with the session of the calling
25 process. The application shall ensure that the value of pgid_id matches
26 a process group ID of a process in the same session as the calling
27 process.
28
29 Attempts to use tcsetpgrp() from a process which is a member of a back‐
30 ground process group on a fildes associated with its controlling termi‐
31 nal shall cause the process group to be sent a SIGTTOU signal. If the
32 calling thread is blocking SIGTTOU signals or the process is ignoring
33 SIGTTOU signals, the process shall be allowed to perform the operation,
34 and no signal is sent.
35
37 Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
38 returned and errno set to indicate the error.
39
41 The tcsetpgrp() function shall fail if:
42
43 EBADF The fildes argument is not a valid file descriptor.
44
45 EINVAL This implementation does not support the value in the pgid_id
46 argument.
47
48 EIO The process group of the writing process is orphaned, the call‐
49 ing thread is not blocking SIGTTOU, and the process is not
50 ignoring SIGTTOU.
51
52 ENOTTY The calling process does not have a controlling terminal, or the
53 file is not the controlling terminal, or the controlling termi‐
54 nal is no longer associated with the session of the calling
55 process.
56
57 EPERM The value of pgid_id is a value supported by the implementation,
58 but does not match the process group ID of a process in the same
59 session as the calling process.
60
61 The following sections are informative.
62
64 None.
65
67 None.
68
70 None.
71
73 None.
74
76 tcgetpgrp()
77
78 The Base Definitions volume of POSIX.1‐2017, <sys_types.h>, <unistd.h>
79
81 Portions of this text are reprinted and reproduced in electronic form
82 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
83 table Operating System Interface (POSIX), The Open Group Base Specifi‐
84 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
85 Electrical and Electronics Engineers, Inc and The Open Group. In the
86 event of any discrepancy between this version and the original IEEE and
87 The Open Group Standard, the original IEEE and The Open Group Standard
88 is the referee document. The original Standard can be obtained online
89 at http://www.opengroup.org/unix/online.html .
90
91 Any typographical or formatting errors that appear in this page are
92 most likely to have been introduced during the conversion of the source
93 files to man page format. To report such errors, see https://www.ker‐
94 nel.org/doc/man-pages/reporting_bugs.html .
95
96
97
98IEEE/The Open Group 2017 TCSETPGRP(3P)