OSDN Git Service

7824be5d097d6ee86d6939c8a6ad63a7d265b68c
[linuxjm/LDP_man-pages.git] / release / man3 / gethostid.3
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\"
3 .\" Updated with additions from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
4 .\" Portions Copyright 1993 Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
5 .\"
6 .\" %%%LICENSE_START(VERBATIM)
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\" %%%LICENSE_END
27 .\"
28 .\" Modified Tue Oct 22 00:22:35 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
29 .\"*******************************************************************
30 .\"
31 .\" This file was generated with po4a. Translate the source file.
32 .\"
33 .\"*******************************************************************
34 .TH GETHOSTID 3 2010\-09\-20 Linux "Linux Programmer's Manual"
35 .SH 名前
36 gethostid, sethostid \- 現在のホストの固有の識別子を取得/設定する
37 .SH 書式
38 \fB#include <unistd.h>\fP
39 .sp
40 \fBlong gethostid(void);\fP
41 .br
42 \fBint sethostid(long \fP\fIhostid\fP\fB);\fP
43 .sp
44 .in -4n
45 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
46 .in
47 .sp
48 .ad l
49 .br
50 \fBgethostid\fP():
51 .RS 4
52 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
53 .RE
54 \fBsethostid\fP():
55 .RS 4
56 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
57 .RE
58 .ad b
59 .SH 説明
60 \fBgethostid\fP()  と \fBsethostid\fP()  は、それぞれ、現在使用しているホストに固有の 32 ビットの識別子の
61 取得/設定を行う。 この 32 ビットの識別子は、現在存在している全ての UNIX システム の中で唯一になるように決められる。通常は
62 \fBgethostbyname\fP(3)  により返されるローカルマシンの Internet アドレスが代わりに使用され、
63 普通は識別子をあえて設定する必要はない。
64
65 \fBsethostid\fP()  はスーパーユーザしか使用できない。
66 .SH 返り値
67 \fBgethostid\fP()  は、 \fBsethostid\fP()  によって設定された、現在使用しているホストの 32 ビットの識別子の値を返す。
68
69 成功すると、 \fBsethostid\fP()  は 0 を返す。 エラーの場合、\-1 を返し、 \fIerrno\fP にエラーを示す値を設定する。
70 .SH エラー
71 \fBsethostid\fP()  は以下のエラーで失敗する可能性がある。
72 .TP 
73 \fBEACCES\fP
74 呼び出し元がホスト ID を保存するのに使用されるファイルへの 書き込み許可を持っていなかった。
75 .TP 
76 \fBEPERM\fP
77 呼び出し元プロセスの実効 UID/GID が対応する実 UID/GID と同じではない。
78 .SH 準拠
79 4.2BSD。4.4BSD ではこれらの関数はなくなった。 SVr4 には \fBgethostid\fP()  は含まれているが、
80 \fBsethostid\fP()  は含まれていない。 POSIX.1\-2001 では、 \fBgethostid\fP()  は規定されているが、
81 \fBsethostid\fP()  は規定されていない。
82 .SH 注意
83 .\" libc5 used /etc/hostid; libc4 didn't have these functions
84 glibc の実装では、 \fIhostid\fP はファイル \fI/etc/hostid\fP に保存される (バージョン 2.2 より前の glibc では、
85 \fI/var/adm/hostid\fP が使用されていた)。
86
87 glibc の実装では、ホスト ID を保存したファイルを オープンできなかった場合、 \fBgethostid\fP()  は
88 \fBgethostname\fP(2)  を使ってホスト名を入手し、そのホスト名を \fBgethostbyname_r\fP(3)  に渡しホストの IPv4
89 アドレスを取得して、 その IPv4 アドレスのビット入れ替えを行った値を返す。
90 .SH バグ
91 識別子が世界中で一意であることを保証することはできない。
92 .SH 関連項目
93 \fBhostid\fP(1), \fBgethostbyname\fP(3)
94 .SH この文書について
95 この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.52 の一部
96 である。プロジェクトの説明とバグ報告に関する情報は
97 http://www.kernel.org/doc/man\-pages/ に書かれている。