xref: /netbsd/lib/libc/termios/tcsetpgrp.3 (revision eb7c1594)
1.\"	$NetBSD: tcsetpgrp.3,v 1.10 2003/08/07 16:44:14 agc Exp $
2.\"
3.\" Copyright (c) 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\"	@(#)tcsetpgrp.3	8.1 (Berkeley) 6/4/93
31.\"
32.Dd June 4, 1993
33.Dt TCSETPGRP 3
34.Os
35.Sh NAME
36.Nm tcsetpgrp
37.Nd set foreground process group ID
38.Sh LIBRARY
39.Lb libc
40.Sh SYNOPSIS
41.In unistd.h
42.Ft int
43.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
44.Sh DESCRIPTION
45If the process has a controlling terminal, the
46.Nm tcsetpgrp
47function sets the foreground process group ID associated with the
48terminal device to
49.Fa pgrp_id .
50The terminal device associated with
51.Fa fd
52must be the controlling terminal of the calling process and the
53controlling terminal must be currently associated with the session
54of the calling process.
55The value of
56.Fa pgrp_id
57must be the same as the process group ID of a process in the same
58session as the calling process.
59.Pp
60Upon successful completion,
61.Nm tcsetpgrp
62returns a value of zero.
63.Sh ERRORS
64If an error occurs,
65.Nm tcgetpgrp
66returns -1 and the global variable
67.Va errno
68is set to indicate the error, as follows:
69.Bl -tag -width Er
70.It Bq Er EBADF
71The
72.Fa fd
73argument is not a valid file descriptor.
74.It Bq Er EINVAL
75An invalid value of
76.Fa pgrp_id
77was specified.
78.It Bq Er ENOTTY
79The calling process does not have a controlling terminal, or the file
80represented by
81.Fa fd
82is not the controlling terminal, or the controlling terminal is no
83longer associated with the session of the calling process.
84.It Bq Er EPERM
85The
86.Fa pgrp_id
87argument does not match the process group ID of a process in the same
88session as the calling process.
89.El
90.Sh SEE ALSO
91.Xr setpgid 2 ,
92.Xr setsid 2 ,
93.Xr tcgetpgrp 3
94.Sh STANDARDS
95The
96.Nm tcsetpgprp
97function conforms to
98.St -p1003.1-90 .
99