Merge commit '9276b3991ba20d5a5660887ba81b0bc7bed25a0c'
[unleashed.git] / share / man / man3c / tcgetpgrp.3c
blob28bf7ff8be7fca9d4f401730847eaf993d8800df
1 '\" te
2 .\"  Copyright (c) 2002, Sun Microsystems, Inc.  All Rights Reserved  Portions Copyright (c) 1992, X/Open Company Limited  All Rights Reserved
3 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
4 .\" http://www.opengroup.org/bookstore/.
5 .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
6 .\"  This notice shall appear on any product containing this material.
7 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
8 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
9 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
10 .TH TCGETPGRP 3C "Aug 14, 2002"
11 .SH NAME
12 tcgetpgrp \- get foreground process group ID
13 .SH SYNOPSIS
14 .LP
15 .nf
16 #include <sys/types.h>
17 #include <unistd.h>
19 \fBpid_t\fR \fBtcgetpgrp\fR(\fBint\fR \fIfildes\fR);
20 .fi
22 .SH DESCRIPTION
23 .sp
24 .LP
25 The \fBtcgetpgrp()\fR function will return the value of the process group
26 \fBID\fR of the foreground process group associated with the terminal.
27 .sp
28 .LP
29 If there is no foreground process group, \fBtcgetpgrp()\fR returns a value
30 greater than 1 that does not match the process group \fBID\fR of any existing
31 process group.
32 .sp
33 .LP
34 The \fBtcgetpgrp()\fR function is allowed from a process that is a member of a
35 background process group; however, the information may be subsequently changed
36 by a process that is a member of a foreground process group.
37 .SH RETURN VALUES
38 .sp
39 .LP
40 Upon successful completion, \fBtcgetpgrp()\fR returns the value of the process
41 group \fBID\fR of the foreground process associated with the terminal.
42 Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the
43 error.
44 .SH ERRORS
45 .sp
46 .LP
47 The \fBtcgetpgrp()\fR function will fail if:
48 .sp
49 .ne 2
50 .na
51 \fB\fBEBADF\fR\fR
52 .ad
53 .RS 10n
54 The \fIfildes\fR argument is not a valid file descriptor.
55 .RE
57 .sp
58 .ne 2
59 .na
60 \fB\fBENOTTY\fR\fR
61 .ad
62 .RS 10n
63 The calling process does not have a controlling terminal, or the file is not
64 the controlling terminal.
65 .RE
67 .SH ATTRIBUTES
68 .sp
69 .LP
70 See \fBattributes\fR(5) for descriptions of the following attributes:
71 .sp
73 .sp
74 .TS
75 box;
76 c | c
77 l | l .
78 ATTRIBUTE TYPE  ATTRIBUTE VALUE
80 Interface Stability     Standard
82 MT-Level        MT-Safe, and Async-Signal-Safe
83 .TE
85 .SH SEE ALSO
86 .sp
87 .LP
88 \fBsetpgid\fR(2), \fBsetsid\fR(2), \fBtcsetpgrp\fR(3C), \fBattributes\fR(5),
89 \fBstandards\fR(5), \fBtermio\fR(7I)