Provided by: manpages-ja-dev_0.5.0.0.20221215+dfsg-1_all 

名前
getnetent, getnetbyname, getnetbyaddr, setnetent, endnetent - ネットワークエントリーを取得する
書式
#include <netdb.h> struct netent *getnetent(void); struct netent *getnetbyname(const char *name); struct netent *getnetbyaddr(uint32_t net, int type); void setnetent(int stayopen); void endnetent(void);
説明
getnetent() 関数はネットワークデータベースから次のエントリーを読み込み、 そのエントリーを netent 構造体 の要素別のフィールドに格納し、 その構造体を返す。 必要であれば、データベースへの接続がオープンされる。 getnetbyname() 関数は、ネットワーク名 name にマッチするエントリーを データベースから探し、そのエントリー を収めた netent 構造体を返す。 getnetbyaddr() 関数は、type 型のネットワーク番号 net にマッチするエントリーを データベースから探し、その エントリーを収めた netent 構造体を返す。 net 引数はホストバイトオーダでなければならない。 setnetent() 関数はデータベースへの接続をオープンし、 次の読み込みエントリーを先頭のエントリーに設定す る。 stayopen が 0 でない場合、 一つ一つの getnet*() 関数の呼び出し間でデータベースへの接続をクローズし ない。 endnetent() 関数はデータベースへの接続をクローズする。 netent 構造体は <netdb.h> で以下のように定義されている。 struct netent { char *n_name; /* official network name */ char **n_aliases; /* alias list */ int n_addrtype; /* net address type */ uint32_t n_net; /* network number */ } netent 構造体のメンバは以下の通り。 n_name ネットワークの正式名 (official name)。 n_aliases ネットワークの別名からなるリスト。 リストはヌルで終端される。 n_addrtype ネットワーク番号の形式。現在は AF_INET のみ。 n_net ホストバイトオーダ形式のネットワーク番号。
返り値
getnetent(), getnetbyname(), getnetbyaddr() 関数は、静的に割り当てられた netent 構造体へのポインターを返 す。 エラーが起こったり、ファイルの末尾に達した場合はヌルポインターを返す。
ファイル
/etc/networks ネットワークデータベースファイル
属性
この節で使用されている用語の説明は attributes(7) を参照のこと。 ┌───────────────┬───────────────┬───────────────────────────┐ │Interface │ Attribute │ Value │ ├───────────────┼───────────────┼───────────────────────────┤ │getnetent() │ Thread safety │ MT-Unsafe race:netent │ │ │ │ race:netentbuf env locale │ ├───────────────┼───────────────┼───────────────────────────┤ │getnetbyname() │ Thread safety │ MT-Unsafe race:netbyname │ │ │ │ env locale │ ├───────────────┼───────────────┼───────────────────────────┤ │getnetbyaddr() │ Thread safety │ MT-Unsafe race:netbyaddr │ │ │ │ locale │ ├───────────────┼───────────────┼───────────────────────────┤ │setnetent(), │ Thread safety │ MT-Unsafe race:netent env │ │endnetent() │ │ locale │ └───────────────┴───────────────┴───────────────────────────┘ In the above table, netent in race:netent signifies that if any of the functions setnetent(), getnetent(), or endnetent() are used in parallel in different threads of a program, then data races could occur.
準拠
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
注意
バージョン 2.2 より前の glibc では、 getnetbyaddr() の引数 net は long 型だった。
関連項目
getnetent_r(3), getprotoent(3), getservent(3) RFC 1101
この文書について
この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告 に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。