.\" Hey Emacs! This file is -*- nroff -*- source. .\" .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) .\" .\" 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. .\" .\" Updated with additions from Mitchum DSouza .\" Portions Copyright 1993 Mitchum DSouza .\" .\" Modified Tue Oct 22 00:22:35 EDT 1996 by Eric S. Raymond .\" .\" (Previously this file is gethostid.2) .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki .\" all rights reserved. .\" Translated 1997-06-27, SUTO, Mitsuaki .\" Modified 1999-05-21, HANATAKA Shinya .\" .\" (Move to section 3 in LDP v3.16 since the interfaces are purely glibc) .\" Updated 2009-01-16, Akihiro MOTOKI , LDP v3.16 .\" .TH GETHOSTID 3 2010-09-20 "Linux" "Linux Programmer's Manual" .\"O .SH NAME .SH 名前 .\"O gethostid, sethostid \- get or set the unique identifier of the current host gethostid, sethostid \- 現在のホストの固有の識別子を取得/設定する .\"O .SH SYNOPSIS .SH 書式 .B #include .sp .B long gethostid(void); .br .BI "int sethostid(long " hostid ); .sp .in -4n .\"O Feature Test Macro Requirements for glibc (see .\"O .BR feature_test_macros (7)): glibc 向けの機能検査マクロの要件 .RB ( feature_test_macros (7) 参照): .in .sp .ad l .br .BR gethostid (): .RS 4 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED .RE .BR sethostid (): .RS 4 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500) .RE .ad b .\"O .SH DESCRIPTION .SH 説明 .\"O .BR gethostid () .\"O and .\"O .BR sethostid () .\"O respectively get or set a unique 32-bit identifier for the current machine. .\"O The 32-bit identifier is intended to be unique among all UNIX systems in .\"O existence. .\"O This normally resembles the Internet address for the local .\"O machine, as returned by .\"O .BR gethostbyname (3), .\"O and thus usually never needs to be set. .BR gethostid () と .BR sethostid () は、それぞれ、現在使用しているホストに固有の 32 ビットの識別子の 取得/設定を行う。 この 32 ビットの識別子は、現在存在している全ての UNIX システム の中で唯一になるように決められる。通常は .BR gethostbyname (3) により返されるローカルマシンの Internet アドレスが代わりに使用され、 普通は識別子をあえて設定する必要はない。 .\"O The .\"O .BR sethostid () .\"O call is restricted to the superuser. .BR sethostid () はスーパーユーザしか使用できない。 .\"O .SH "RETURN VALUE" .SH 返り値 .\"O .BR gethostid () .\"O returns the 32-bit identifier for the current host as set by .\"O .BR sethostid (). .BR gethostid () は、 .BR sethostid () によって設定された、現在使用しているホストの 32 ビットの識別子の値を返す。 .\"O On success, .\"O .BR sethostid () .\"O returns 0; on error, \-1 is returned, and .\"O .I errno .\"O is set to indicate the error. 成功すると、 .BR sethostid () は 0 を返す。 エラーの場合、\-1 を返し、 .I errno にエラーを示す値を設定する。 .\"O .SH ERRORS .SH エラー .\"O .BR sethostid () .\"O can fail with the following errors: .BR sethostid () は以下のエラーで失敗する可能性がある。 .TP .B EACCES .\"O The caller did not have permission to write to the file used .\"O to store the host ID. 呼び出し元がホスト ID を保存するのに使用されるファイルへの 書き込み許可を持っていなかった。 .TP .B EPERM .\"O The calling process's effective user or group ID is not the same .\"O as its corresponding real ID. 呼び出し元プロセスの実効 UID/GID が対応する実 UID/GID と同じではない。 .\"O .SH "CONFORMING TO" .SH 準拠 .\"O 4.2BSD; these functions were dropped in 4.4BSD. .\"O SVr4 includes .\"O .BR gethostid () .\"O but not .\"O .BR sethostid (). .\"O POSIX.1-2001 specifies .\"O .BR gethostid () .\"O but not .\"O .BR sethostid (). 4.2BSD。4.4BSD ではこれらの関数はなくなった。 SVr4 には .BR gethostid () は含まれているが、 .BR sethostid () は含まれていない。 POSIX.1-2001 では、 .BR gethostid () は規定されているが、 .BR sethostid () は規定されていない。 .\"O .SH NOTES .SH 注意 .\"O In the glibc implementation, the .\"O .I hostid .\"O is stored in the file .\"O .IR /etc/hostid . .\"O (In glibc versions before 2.2, the file .\"O .I /var/adm/hostid .\"O was used.) glibc の実装では、 .I hostid はファイル .I /etc/hostid に保存される (バージョン 2.2 より前の glibc では、 .I /var/adm/hostid が使用されていた)。 .\" libc5 used /etc/hostid; libc4 didn't have these functions .\"O In the glibc implementation, if .\"O .BR gethostid () .\"O cannot open the file containing the host ID, .\"O then it obtains the hostname using .\"O .BR gethostname (2), .\"O passes that hostname to .\"O .BR gethostbyname_r (3) .\"O in order to obtain the host's IPv4 address, .\"O and returns a value obtained by bit-twiddling the IPv4 address. .\"O (This value may not be unique.) glibc の実装では、ホスト ID を保存したファイルを オープンできなかった場合、 .BR gethostid () は .BR gethostname (2) を使ってホスト名を入手し、そのホスト名を .BR gethostbyname_r (3) に渡しホストの IPv4 アドレスを取得して、 その IPv4 アドレスのビット入れ替えを行った値を返す。 .\"O .SH BUGS .SH バグ .\"O It is impossible to ensure that the identifier is globally unique. 識別子が世界中で一意であることを保証することはできない。 .\"O .SH "SEE ALSO" .SH 関連項目 .BR hostid (1), .BR gethostbyname (3)