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
11
13 tcsetpgrp — set the foreground process group ID
14
16 #include <unistd.h>
17
18 int tcsetpgrp(int fildes, pid_t pgid_id);
19
21 If the process has a controlling terminal, tcsetpgrp() shall set the
22 foreground process group ID associated with the terminal to pgid_id.
23 The application shall ensure that the file associated with fildes is
24 the controlling terminal of the calling process and the controlling
25 terminal is currently associated with the session of the calling
26 process. The application shall ensure that the value of pgid_id matches
27 a process group ID of a process in the same session as the calling
28 process.
29
30 Attempts to use tcsetpgrp() from a process which is a member of a back‐
31 ground process group on a fildes associated with its controlling termi‐
32 nal shall cause the process group to be sent a SIGTTOU signal. If the
33 calling thread is blocking SIGTTOU signals or the process is ignoring
34 SIGTTOU signals, the process shall be allowed to perform the operation,
35 and no signal is sent.
36
38 Upon successful completion, 0 shall be returned. Otherwise, −1 shall be
39 returned and errno set to indicate the error.
40
42 The tcsetpgrp() function shall fail if:
43
44 EBADF The fildes argument is not a valid file descriptor.
45
46 EINVAL This implementation does not support the value in the pgid_id
47 argument.
48
49 EIO The process group of the writing process is orphaned, the call‐
50 ing thread is not blocking SIGTTOU, and the process is not
51 ignoring SIGTTOU.
52
53 ENOTTY The calling process does not have a controlling terminal, or the
54 file is not the controlling terminal, or the controlling termi‐
55 nal is no longer associated with the session of the calling
56 process.
57
58 EPERM The value of pgid_id is a value supported by the implementation,
59 but does not match the process group ID of a process in the same
60 session as the calling process.
61
62 The following sections are informative.
63
65 None.
66
68 None.
69
71 None.
72
74 None.
75
77 tcgetpgrp()
78
79 The Base Definitions volume of POSIX.1‐2008, <sys_types.h>, <unistd.h>
80
82 Portions of this text are reprinted and reproduced in electronic form
83 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
84 -- Portable Operating System Interface (POSIX), The Open Group Base
85 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
86 cal and Electronics Engineers, Inc and The Open Group. (This is
87 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
88 event of any discrepancy between this version and the original IEEE and
89 The Open Group Standard, the original IEEE and The Open Group Standard
90 is the referee document. The original Standard can be obtained online
91 at http://www.unix.org/online.html .
92
93 Any typographical or formatting errors that appear in this page are
94 most likely to have been introduced during the conversion of the source
95 files to man page format. To report such errors, see https://www.ker‐
96 nel.org/doc/man-pages/reporting_bugs.html .
97
98
99
100IEEE/The Open Group 2013 TCSETPGRP(3P)