xref: /csrg-svn/lib/libc/gen/tcsetpgrp.3 (revision 52281)
1.\" Copyright (c) 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.roff%
5.\"
6.\"	@(#)tcsetpgrp.3	5.1 (Berkeley) 02/02/92
7.\"
8.Dd Jun 11, 1991
9.Dt TCSETPGRP
10.Os
11.Sh NAME
12.Nm tcsetpgrp
13.LP
14.B "Process Group ID"
15.LP
16.B "Function:  tcsetpgrp()"
17.LP
18.B "Synopsis"
19.LP
20.nf
21#include <sys/types.h>
22
23int tcsetpgrp(int fildes, pid_t pgrp_id);
24.fi
25.LP
26.B "Description"
27.LP
28If the process has a controlling terminal, the tcsetpgrp() function
29shall set the foreground process group ID associated with the
30terminal to pgrp_id.  The file associated with fildes must be the
31controlling terminal of the calling process and the controlling
32terminal must be currently associated with the session of the
33calling process.  The value of pgrp_id must match a process group
34ID of a process in the same session as the calling process.
35.LP
36.B "Returns"
37.LP
38Upon successful completion, tcsetpgrp() returns a value of zero.
39Otherwise, a value of -1 is returned and errno is set to indicate the
40error.
41.LP
42.B "Errors"
43.LP
44If any of the following conditions occur, the tcsetpgrp() function shall
45return -1 and set errno to the corresponding value:
46.nf
47   [EBADF]       The fildes argument is not a valid file descriptor.
48
49   [EINVAL]      The value of the pgrp_id argument is a value not
50                 supported by the implementation.
51
52   [ENOSYS]      The tcsetpgrp() function is not supported in this
53                 implementation.
54
55   [ENOTTY]      The calling process does not have a controlling
56                 terminal, or the file is not the controlling terminal,
57                 or the controlling terminal is no longer associated with
58                 the session of the calling process.
59
60   [EPERM]       The value of pgrp_id is a value supported by the
61                 implementation but does not match the process group ID
62                 of a process in the same session as the calling process.
63.fi
64