1TCSETPGRP(P) POSIX Programmer's Manual TCSETPGRP(P)
2
3
4
6 tcsetpgrp - set the foreground process group ID
7
9 #include <unistd.h>
10
11 int tcsetpgrp(int fildes, pid_t pgid_id);
12
13
15 If the process has a controlling terminal, tcsetpgrp() shall set the
16 foreground process group ID associated with the terminal to pgid_id.
17 The application shall ensure that the file associated with fildes is
18 the controlling terminal of the calling process and the controlling
19 terminal is currently associated with the session of the calling
20 process. The application shall ensure that the value of pgid_id matches
21 a process group ID of a process in the same session as the calling
22 process.
23
24 Attempts to use tcsetpgrp() from a process which is a member of a back‐
25 ground process group on a fildes associated with its controlling termi‐
26 nal shall cause the process group to be sent a SIGTTOU signal. If the
27 calling process is blocking or ignoring SIGTTOU signals, the process
28 shall be allowed to perform the operation, and no signal is sent.
29
31 Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
32 returned and errno set to indicate the error.
33
35 The tcsetpgrp() function shall fail if:
36
37 EBADF The fildes argument is not a valid file descriptor.
38
39 EINVAL This implementation does not support the value in the pgid_id
40 argument.
41
42 ENOTTY The calling process does not have a controlling terminal, or the
43 file is not the controlling terminal, or the controlling termi‐
44 nal is no longer associated with the session of the calling
45 process.
46
47 EPERM The value of pgid_id is a value supported by the implementation,
48 but does not match the process group ID of a process in the same
49 session as the calling process.
50
51
52 The following sections are informative.
53
55 None.
56
58 None.
59
61 None.
62
64 None.
65
67 tcgetpgrp() , the Base Definitions volume of IEEE Std 1003.1-2001,
68 <sys/types.h>, <unistd.h>
69
71 Portions of this text are reprinted and reproduced in electronic form
72 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
73 -- Portable Operating System Interface (POSIX), The Open Group Base
74 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
75 Electrical and Electronics Engineers, Inc and The Open Group. In the
76 event of any discrepancy between this version and the original IEEE and
77 The Open Group Standard, the original IEEE and The Open Group Standard
78 is the referee document. The original Standard can be obtained online
79 at http://www.opengroup.org/unix/online.html .
80
81
82
83IEEE/The Open Group 2003 TCSETPGRP(P)