.\" Copyright (c) 1995 Jim Van Zandt .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" Modified 2001-12-13, Martin Schulze .\" Added ttyname_r, aeb, 2002-07-20 .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 Hiroaki Nagoya .\" all rights reserved. .\" Translated Mon Feb 10 1997 by Hiroaki Nagoya .\" Updated Fri Dec 21 JST 2001 by Kentaro Shirakata .\" Updated Fri Oct 16 JST 2002 by Kentaro Shirakata .\" Updated 2013-03-26, Akihiro MOTOKI .\" Updated 2013-07-22, Akihiro MOTOKI .\" .TH TTYNAME 3 2019\-10\-10 Linux "Linux Programmer's Manual" .SH 名前 ttyname, ttyname_r \- 端末名を返す .SH 書式 .nf \fB#include \fP .PP \fBchar *ttyname(int \fP\fIfd\fP\fB);\fP .PP \fBint ttyname_r(int \fP\fIfd\fP\fB, char *\fP\fIbuf\fP\fB, size_t \fP\fIbuflen\fP\fB);\fP .fi .SH 説明 \fBttyname\fP() 関数は、ファイルディスクリプター \fIfd\fP がオープンしている端末デバイスの NULL 終端されたパス名へのポインターを返す。 エラーが起きたならば NULL を返す (たとえば、\fIfd\fP が端末を参照していないとき)。 返り値は静的データを指しているので、次の呼び出しで上書きされる可能性がある。 \fBttyname_r\fP() 関数は、このパス名を長さ \fIbuflen\fP のバッファー \fIbuf\fP に格納する。 .SH 返り値 \fBttyname\fP() 関数は、成功時はパス名へのポインターを返す。 エラー時は NULL を返し、 \fIerrno\fP が適切に設定される。 \fBttyname_r\fP() 関数は、成功時には 0 を返し、エラー時にはエラー番号を返す。 .SH エラー .TP \fBEBADF\fP ファイルディスクリプターが不正。 .TP .\" glibc commit 15e9a4f378c8607c2ae1aa465436af4321db0e23 \fBENODEV\fP \fIfd\fP refers to a slave pseudoterminal device but the corresponding pathname could not be found (see NOTES). .TP \fBENOTTY\fP \fIfd\fP が端末デバイスを参照していない。 .TP \fBERANGE\fP (\fBttyname_r\fP()) \fIbuflen\fP がパス名を格納するには短すぎる。 .SH 属性 この節で使用されている用語の説明については、 \fBattributes\fP(7) を参照。 .TS allbox; lb lb lb l l l. インターフェース 属性 値 T{ \fBttyname\fP() T} Thread safety MT\-Unsafe race:ttyname T{ \fBttyname_r\fP() T} Thread safety MT\-Safe .TE .SH 準拠 POSIX.1\-2001, POSIX.1\-2008, 4.2BSD. .SH 注意 A process that keeps a file descriptor that refers to a \fBpts\fP(4) device open when switching to another mount namespace that uses a different \fI/dev/ptmx\fP instance may still accidentally find that a device path of the same name for that file descriptor exists. However, this device path refers to a different device and thus can't be used to access the device that the file descriptor refers to. Calling \fBttyname\fP() or \fBttyname_r\fP() on the file descriptor in the new mount namespace will cause these functions to return NULL and set \fIerrno\fP to \fBENODEV\fP. .SH 関連項目 \fBtty\fP(1), \fBfstat\fP(2), \fBctermid\fP(3), \fBisatty\fP(3), \fBpts\fP(4) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。