Commit | Line | Data |
---|---|---|
74155b62 KB |
1 | .\" Copyright (c) 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
a85640dd MT |
3 | .\" |
4 | .\" %sccs.include.redist.roff% | |
5 | .\" | |
74155b62 | 6 | .\" @(#)tcsetpgrp.3 8.1 (Berkeley) %G% |
a85640dd | 7 | .\" |
d365c391 | 8 | .Dd "" |
546df655 | 9 | .Dt TCSETPGRP 3 |
0ae9fc64 MT |
10 | .Os |
11 | .Sh NAME | |
12 | .Nm tcsetpgrp | |
d365c391 KB |
13 | .Nd set foreground process group ID |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <sys/types.h> | |
6175c3fa | 16 | .Fd #include <unistd.h> |
d365c391 KB |
17 | .Ft int |
18 | .Fn tcsetpgrp "int fd" "pid_t pgrp_id" | |
19 | .Sh DESCRIPTION | |
20 | If the process has a controlling terminal, the | |
21 | .Nm tcsetpgrp | |
22 | function sets the foreground process group ID associated with the | |
23 | terminal device to | |
24 | .Fa pgrp_id . | |
25 | The terminal device associated with | |
26 | .Fa fd | |
27 | must be the controlling terminal of the calling process and the | |
28 | controlling terminal must be currently associated with the session | |
29 | of the calling process. | |
30 | The value of | |
31 | .Fa pgrp_id | |
32 | must be the same as the process group ID of a process in the same | |
33 | session as the calling process. | |
34 | .Pp | |
35 | Upon successful completion, | |
36 | .Nm tcsetpgrp | |
37 | returns a value of zero. | |
38 | .Sh ERRORS | |
39 | If an error occurs, | |
40 | .Nm tcgetpgrp | |
41 | returns -1 and the global variable | |
42 | .Va errno | |
43 | is set to indicate the error, as follows: | |
44 | .Bl -tag -width Er | |
45 | .It Bq Er EBADF | |
46 | The | |
47 | .Fa fd | |
48 | argument is not a valid file descriptor. | |
49 | .It Bq Er EINVAL | |
50 | An invalid value of | |
51 | .Fa pgrp_id | |
52 | was specified. | |
53 | .It Bq Er ENOTTY | |
54 | The calling process does not have a controlling terminal, or the file | |
55 | represented by | |
56 | .Fa fd | |
57 | is not the controlling terminal, or the controlling terminal is no | |
58 | longer associated with the session of the calling process. | |
59 | .It Bq Er EPERM | |
60 | The | |
61 | .Fa pgrp_id | |
62 | argument does not match the process group ID of a process in the same | |
63 | session as the calling process. | |
64 | .El | |
65 | .Sh SEE ALSO | |
66 | .Xr setpgid 3 , | |
67 | .Xr setsid 2 , | |
68 | .Xr tcgetpgrp 3 | |
69 | .Sh STANDARDS | |
70 | The | |
71 | .Nm tcsetpgprp | |
72 | function is expected to be compliant with the | |
73 | .St -p1003.1-88 | |
74 | specification. |