.\" Copyright (c) 2012 YOSHIFUJI Hideaki .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of .\" this manual under the conditions for verbatim copying, provided that .\" the entire resulting derived work is distributed under the terms of .\" a permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume .\" no responsibility for errors or omissions, or for damages resulting .\" from the use of the information contained herein. The author(s) may .\" not have taken the same level of care in the production of this .\" manual, which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2013 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2013-05-22, Akihiro MOTOKI .\" .TH IF_NAMETOINDEX 3 2014\-04\-01 GNU "Linux Programmer's Manual" .SH 名前 if_nametoindex, if_indextoname \- ネットワークインターフェースの名前とインデックスのマッピングを行う .SH 書式 .nf \fB#include \fP .sp \fBunsigned int if_nametoindex(const char *\fP\fIifname\fP\fB);\fP .sp \fBchar *if_indextoname(unsigned int ifindex, char *\fP\fIifname\fP\fB);\fP .fi .SH 説明 \fBif_nametoindex\fP() 関数は、 名前が \fIifname\fP のネットワークインターフェースのインデックスを返す。 \fBif_indextoname\fP() 関数は、 インターフェースのインデックスが \fIifindex\fP に対応するネットワークインターフェースの名前を返す。 名前は \fIifname\fP が指すバッファーに格納される。 バッファーは少なくとも \fBIF_NAMESIZE\fP バイトの領域が必要である。 .SH 返り値 成功した場合、 \fBif_nametoindex\fP() はネットワークインターフェースのインデックス番号を返す。エラーの場合、 0 を返し、 \fIerrno\fP を適切に設定にする。 成功した場合には \fBif_indextoname\fP() は \fIifname\fP を返す。エラー時には NULL が返され、 \fIerrno\fP が適切に設定される。 .SH エラー \fBif_indextoname\fP() は以下の \fIerrno\fP で失敗する場合がある。 .TP \fBENXIO\fP インデックスに対応するインターフェースがない。 .PP \fBif_nametoindex\fP() と \fBif_indextoname\fP() は、 \fBsocket\fP(2) と \fBioctl\fP(2) に対して規定されているエラーのいずれかで失敗する場合がある。 .SH 属性 .SS "マルチスレッディング (pthreads(7) 参照)" 関数 \fBif_nametoindex\fP() と \fBif_indextoname\fP() はスレッドセーフである。 .SH 準拠 RFC\ 3493, POSIX.1\-2001. この関数は BSDi 初めて登場した。 .SH 関連項目 \fBgetifaddrs\fP(3), \fBif_nameindex\fP(3), \fBifconfig\fP(8) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。