xref: /original-bsd/lib/libc/gen/tcsetpgrp.3 (revision ca98dac2)
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.3 (Berkeley) 03/29/92
7.\"
8.Dd ""
9.Dt TCSETPGRP
10.Os
11.Sh NAME
12.Nm tcsetpgrp
13.Nd set foreground process group ID
14.Sh SYNOPSIS
15.Fd #include <sys/types.h>
16.Fd #include <unistd.h>
17.Ft int
18.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
19.Sh DESCRIPTION
20If the process has a controlling terminal, the
21.Nm tcsetpgrp
22function sets the foreground process group ID associated with the
23terminal device to
24.Fa pgrp_id .
25The terminal device associated with
26.Fa fd
27must be the controlling terminal of the calling process and the
28controlling terminal must be currently associated with the session
29of the calling process.
30The value of
31.Fa pgrp_id
32must be the same as the process group ID of a process in the same
33session as the calling process.
34.Pp
35Upon successful completion,
36.Nm tcsetpgrp
37returns a value of zero.
38.Sh ERRORS
39If an error occurs,
40.Nm tcgetpgrp
41returns -1 and the global variable
42.Va errno
43is set to indicate the error, as follows:
44.Bl -tag -width Er
45.It Bq Er EBADF
46The
47.Fa fd
48argument is not a valid file descriptor.
49.It Bq Er EINVAL
50An invalid value of
51.Fa pgrp_id
52was specified.
53.It Bq Er ENOTTY
54The calling process does not have a controlling terminal, or the file
55represented by
56.Fa fd
57is not the controlling terminal, or the controlling terminal is no
58longer associated with the session of the calling process.
59.It Bq Er EPERM
60The
61.Fa pgrp_id
62argument does not match the process group ID of a process in the same
63session 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
70The
71.Nm tcsetpgprp
72function is expected to be compliant with the
73.St -p1003.1-88
74specification.
75