]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ctermid.3
membarrier.2: Remove redundant mention of return value of MEMBARRIER_CMD_SHARED
[thirdparty/man-pages.git] / man3 / ctermid.3
CommitLineData
bf5a7247 1.\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
fea681da 2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
4.\" Permission is granted to make and distribute verbatim copies of this
5.\" manual provided the copyright notice and this permission notice are
6.\" preserved on all copies.
7.\"
8.\" Permission is granted to copy and distribute modified versions of this
9.\" manual under the conditions for verbatim copying, provided that the
10.\" entire resulting derived work is distributed under the terms of a
11.\" permission notice identical to this one.
c13182ef 12.\"
fea681da
MK
13.\" Since the Linux kernel and libraries are constantly changing, this
14.\" manual page may be incorrect or out-of-date. The author(s) assume no
15.\" responsibility for errors or omissions, or for damages resulting from
16.\" the use of the information contained herein. The author(s) may not
17.\" have taken the same level of care in the production of this manual,
18.\" which is licensed free of charge, as they might when working
19.\" professionally.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
c08df37a 24.\"
fea681da 25.\" Modified Sat Jul 24 19:51:06 1993 by Rik Faith (faith@cs.unc.edu)
460495ca 26.TH CTERMID 3 2015-08-08 "GNU" "Linux Programmer's Manual"
fea681da
MK
27.SH NAME
28ctermid \- get controlling terminal name
29.SH SYNOPSIS
30.nf
31.B #include <stdio.h>
b5a476b0
MK
32.\" POSIX also requires this function to be declared in <unistd.h>,
33.\" and glibc does so if suitable feature test macros are defined.
fea681da
MK
34.sp
35.BI "char *ctermid(char *" "s" );
36.fi
cc4615cc
MK
37.sp
38.in -4n
39Feature Test Macro Requirements for glibc (see
40.BR feature_test_macros (7)):
41.in
42.sp
43.BR ctermid ():
0f200f07 44_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
cc4615cc 45.\" From <unistd.h>: _XOPEN_SOURCE
fea681da 46.SH DESCRIPTION
63aa9df0 47.BR ctermid ()
c13182ef
MK
48returns a string which is the pathname for the current
49controlling terminal for this process.
fea681da
MK
50If
51.I s
8478ee02 52is NULL,
fea681da
MK
53a static buffer is used, otherwise
54.I s
55points to a buffer used to hold the terminal pathname.
56The symbolic constant
57.B L_ctermid
58is the maximum number of characters in the returned pathname.
47297adb 59.SH RETURN VALUE
fea681da 60The pointer to the pathname.
d768f1d9 61.SH ATTRIBUTES
93f0f908
PH
62For an explanation of the terms used in this section, see
63.BR attributes (7).
64.TS
65allbox;
66lb lb lb
67l l l.
68Interface Attribute Value
69T{
d768f1d9 70.BR ctermid ()
d35f48a3 71T} Thread safety MT-Safe
93f0f908 72.TE
47297adb 73.SH CONFORMING TO
20379f08 74POSIX.1-2001, POSIX.1-2008, Svr4.
fea681da
MK
75.SH BUGS
76The path returned may not uniquely identify the controlling
77terminal; it may, for example, be
8478ee02 78.IR /dev/tty .
fea681da
MK
79.PP
80It is not assured that the program can open the terminal.
f2665a55 81.\" in glibc 2.3.x, x >= 4, the glibc headers threw an error
3f1c1b0a 82.\" if ctermid() was given an argument; fixed in 2.4.
47297adb 83.SH SEE ALSO
fea681da 84.BR ttyname (3)