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