.\" 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 2013\-06\-21 Linux "Linux Programmer's Manual" .SH 名前 ttyname, ttyname_r \- 端末名を返す .SH 書式 .nf \fB#include \fP .sp \fBchar *ttyname(int \fP\fIfd\fP\fB);\fP \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 \fBENOTTY\fP ファイルディスクリプターが端末デバイスを示していない。 .TP \fBERANGE\fP (\fBttyname_r\fP()) \fIbuflen\fP がパス名を格納するには短すぎる。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" \fBttyname\fP() 関数はスレッドセーフではない。 .LP \fBttyname_r\fP() 関数はスレッドセーフである。 .SH 準拠 4.2BSD, POSIX.1\-2001. .SH 関連項目 \fBfstat\fP(2), \fBctermid\fP(3), \fBisatty\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。