.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" .\" Updated with additions from Mitchum DSouza .\" Portions Copyright 1993 Mitchum DSouza .\" .\" %%%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 .\" .\" Modified Tue Oct 22 00:22:35 EDT 1996 by Eric S. Raymond .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki .\" all rights reserved. .\" Translated 1997-06-27, SUTO, Mitsuaki .\" Modified 1999-05-21, HANATAKA Shinya .\" .TH GETHOSTID 3 2010\-09\-20 Linux "Linux Programmer's Manual" .SH 名前 gethostid, sethostid \- 現在のホストの固有の識別子を取得/設定する .SH 書式 \fB#include \fP .sp \fBlong gethostid(void);\fP .br \fBint sethostid(long \fP\fIhostid\fP\fB);\fP .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp .ad l .br \fBgethostid\fP(): .RS 4 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE \fBsethostid\fP(): .RS 4 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) .RE .ad b .SH 説明 \fBgethostid\fP() と \fBsethostid\fP() は、それぞれ、現在使用しているホストに固有の 32 ビットの識別子の 取得/設定を行う。 この 32 ビットの識別子は、現在存在している全ての UNIX システム の中で唯一になるように決められる。通常は \fBgethostbyname\fP(3) により返されるローカルマシンの Internet アドレスが代わりに使用され、 普通は識別子をあえて設定する必要はない。 \fBsethostid\fP() はスーパーユーザしか使用できない。 .SH 返り値 \fBgethostid\fP() は、 \fBsethostid\fP() によって設定された、現在使用しているホストの 32 ビットの識別子の値を返す。 成功すると、 \fBsethostid\fP() は 0 を返す。 エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値を設定する。 .SH エラー \fBsethostid\fP() は以下のエラーで失敗する可能性がある。 .TP \fBEACCES\fP 呼び出し元がホスト ID を保存するのに使用されるファイルへの 書き込み許可を持っていなかった。 .TP \fBEPERM\fP 呼び出し元プロセスの実効 UID/GID が対応する実 UID/GID と同じではない。 .SH 準拠 4.2BSD。4.4BSD ではこれらの関数はなくなった。 SVr4 には \fBgethostid\fP() は含まれているが、 \fBsethostid\fP() は含まれていない。 POSIX.1\-2001 では、 \fBgethostid\fP() は規定されているが、 \fBsethostid\fP() は規定されていない。 .SH 注意 .\" libc5 used /etc/hostid; libc4 didn't have these functions glibc の実装では、 \fIhostid\fP はファイル \fI/etc/hostid\fP に保存される (バージョン 2.2 より前の glibc では、 \fI/var/adm/hostid\fP が使用されていた)。 glibc の実装では、ホスト ID を保存したファイルを オープンできなかった場合、 \fBgethostid\fP() は \fBgethostname\fP(2) を使ってホスト名を入手し、そのホスト名を \fBgethostbyname_r\fP(3) に渡しホストの IPv4 アドレスを取得して、 その IPv4 アドレスのビット入れ替えを行った値を返す。 .SH バグ 識別子が世界中で一意であることを保証することはできない。 .SH 関連項目 \fBhostid\fP(1), \fBgethostbyname\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。