1951 leaking a vdev when removing an l2cache device
[unleashed.git] / usr / src / man / man3c / ctermid.3c
blob4fec552f59309a5686048db28e29a3b1cf869889
1 '\" te
2 .\"  Copyright 1989 AT&T  Copyright (c) 2000, Sun Microsystems, Inc.  All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH CTERMID 3C "Jul 25, 2000"
7 .SH NAME
8 ctermid, ctermid_r \- generate path name for controlling terminal
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <stdio.h>
14 \fBchar *\fR\fBctermid\fR(\fBchar *\fR\fIs\fR);
15 .fi
17 .LP
18 .nf
19 \fBchar *\fR\fBctermid_r\fR(\fBchar *\fR\fIs\fR);
20 .fi
22 .SH DESCRIPTION
23 .SS "\fBctermid()\fR"
24 .sp
25 .LP
26 The \fBctermid()\fR function generates the path name of the controlling
27 terminal for the current process and stores it in a string.
28 .sp
29 .LP
30 If \fIs\fR is a null pointer, the string is stored in an internal static area
31 whose address is returned and whose contents are overwritten at the next call
32 to \fBctermid()\fR. Otherwise, \fIs\fR is assumed to point to a character array
33 of at least \fBL_ctermid\fR elements. The path name is placed in this array and
34 the value of \fIs\fR is returned. The constant \fBL_ctermid\fR is defined in
35 the header \fB<stdio.h>\fR\&.
36 .SS "\fBctermid_r()\fR"
37 .sp
38 .LP
39 The \fBctermid_r()\fR function behaves as \fBctermid()\fR except that if
40 \fIs\fR is a null pointer, the function returns \fINULL\fR.
41 .SH USAGE
42 .sp
43 .LP
44 The difference between \fBctermid()\fR and \fBttyname\fR(3C) is that
45 \fBttyname()\fR must be passed a file descriptor and returns the actual name of
46 the terminal associated with that file descriptor, while \fBctermid()\fR
47 returns a string (\fB/dev/tty\fR) that will refer to the terminal if used as a
48 file name. The \fBttyname()\fR function is useful only if the process already
49 has at least one file open to a terminal.
50 .sp
51 .LP
52 The \fBctermid()\fR function is unsafe in multithreaded applications.  The
53 \fBctermid_r()\fR function is MT-Safe and should be used instead.
54 .sp
55 .LP
56 When compiling multithreaded applications, the  \fB_REENTRANT\fR flag must be
57 defined on the compile line.  This flag should be used only with multithreaded
58 applications.
59 .SH ATTRIBUTES
60 .sp
61 .LP
62 See \fBattributes\fR(5) for descriptions of the following attributes:
63 .sp
65 .sp
66 .TS
67 box;
68 c | c
69 l | l .
70 ATTRIBUTE TYPE  ATTRIBUTE VALUE
72 Interface Stability     \fBctermid()\fR is Standard
74 MT-Level        T{
75 \fBctermid()\fR is Unsafe; \fBctermid_r()\fR is MT-Safe
77 .TE
79 .SH SEE ALSO
80 .sp
81 .LP
82 \fBttyname\fR(3C), \fBattributes\fR(5)