1*eb7c1594Sagc.\" $NetBSD: tcgetpgrp.3,v 1.11 2003/08/07 16:44:13 agc Exp $ 25f11a56cSjtc.\" 374e3014eSperry.\" Copyright (c) 1991, 1993 474e3014eSperry.\" The Regents of the University of California. All rights reserved. 55f11a56cSjtc.\" 65f11a56cSjtc.\" Redistribution and use in source and binary forms, with or without 75f11a56cSjtc.\" modification, are permitted provided that the following conditions 85f11a56cSjtc.\" are met: 95f11a56cSjtc.\" 1. Redistributions of source code must retain the above copyright 105f11a56cSjtc.\" notice, this list of conditions and the following disclaimer. 115f11a56cSjtc.\" 2. Redistributions in binary form must reproduce the above copyright 125f11a56cSjtc.\" notice, this list of conditions and the following disclaimer in the 135f11a56cSjtc.\" documentation and/or other materials provided with the distribution. 14*eb7c1594Sagc.\" 3. Neither the name of the University nor the names of its contributors 155f11a56cSjtc.\" may be used to endorse or promote products derived from this software 165f11a56cSjtc.\" without specific prior written permission. 175f11a56cSjtc.\" 185f11a56cSjtc.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 195f11a56cSjtc.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 205f11a56cSjtc.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 215f11a56cSjtc.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 225f11a56cSjtc.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 235f11a56cSjtc.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 245f11a56cSjtc.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 255f11a56cSjtc.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 265f11a56cSjtc.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 275f11a56cSjtc.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 285f11a56cSjtc.\" SUCH DAMAGE. 295f11a56cSjtc.\" 3074e3014eSperry.\" @(#)tcgetpgrp.3 8.1 (Berkeley) 6/4/93 315f11a56cSjtc.\" 32dc1e66a8Sperry.Dd June 4, 1993 335f11a56cSjtc.Dt TCGETPGRP 3 345f11a56cSjtc.Os 355f11a56cSjtc.Sh NAME 365f11a56cSjtc.Nm tcgetpgrp 375f11a56cSjtc.Nd get foreground process group ID 38312aca53Sperry.Sh LIBRARY 39312aca53Sperry.Lb libc 405f11a56cSjtc.Sh SYNOPSIS 41472351e1Swiz.In unistd.h 425f11a56cSjtc.Ft pid_t 435f11a56cSjtc.Fn tcgetpgrp "int fd" 445f11a56cSjtc.Sh DESCRIPTION 455f11a56cSjtcThe 465f11a56cSjtc.Nm tcgetpgrp 475f11a56cSjtcfunction returns the value of the process group ID of the foreground 485f11a56cSjtcprocess group associated with the terminal device. 495f11a56cSjtcIf there is no foreground process group, 505f11a56cSjtc.Nm tcgetpgrp 515f11a56cSjtcreturns an invalid process ID. 525f11a56cSjtc.Sh ERRORS 535f11a56cSjtcIf an error occurs, 545f11a56cSjtc.Nm tcgetpgrp 555f11a56cSjtcreturns -1 and the global variable 565f11a56cSjtc.Va errno 575f11a56cSjtcis set to indicate the error, as follows: 585f11a56cSjtc.Bl -tag -width Er 595f11a56cSjtc.It Bq Er EBADF 605f11a56cSjtcThe 615f11a56cSjtc.Fa fd 625f11a56cSjtcargument is not a valid file descriptor. 635f11a56cSjtc.It Bq Er ENOTTY 645f11a56cSjtcThe calling process does not have a controlling terminal or the 655f11a56cSjtcunderlying terminal device represented by 665f11a56cSjtc.Fa fd 675f11a56cSjtcis not the controlling terminal. 685f11a56cSjtc.El 695f11a56cSjtc.Sh SEE ALSO 7043cdfeecSmikel.Xr setpgid 2 , 715f11a56cSjtc.Xr setsid 2 , 725f11a56cSjtc.Xr tcsetpgrp 3 735f11a56cSjtc.Sh STANDARDS 745f11a56cSjtcThe 755f11a56cSjtc.Nm tcgetpgrp 76c213a3afSkleinkfunction conforms to 77c213a3afSkleink.St -p1003.1-90 . 78