OSDN Git Service

(split) LDP v3.24 -> v3.29 の定型的な変更内容を反映。
[linuxjm/LDP_man-pages.git] / draft / man3 / gethostid.3
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" Updated with additions from Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
26 .\" Portions Copyright 1993 Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
27 .\"
28 .\" Modified Tue Oct 22 00:22:35 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
29 .\"
30 .\" (Previously this file is gethostid.2)
31 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
32 .\"         all rights reserved.
33 .\" Translated 1997-06-27, SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
34 .\" Modified 1999-05-21, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
35 .\"
36 .\" (Move to section 3 in LDP v3.16 since the interfaces are purely glibc)
37 .\" Updated 2009-01-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.16
38 .\"
39 .TH GETHOSTID 3 2010-09-20 "Linux" "Linux Programmer's Manual"
40 .\"O .SH NAME
41 .SH Ì¾Á°
42 .\"O gethostid, sethostid \- get or set the unique identifier of the current host
43 gethostid, sethostid \- ¸½ºß¤Î¥Û¥¹¥È¤Î¸ÇÍ­¤Î¼±Ê̻Ҥò¼èÆÀ/ÀßÄꤹ¤ë
44 .\"O .SH SYNOPSIS
45 .SH ½ñ¼°
46 .B #include <unistd.h>
47 .sp
48 .B long gethostid(void);
49 .br
50 .BI "int sethostid(long " hostid );
51 .sp
52 .in -4n
53 .\"O Feature Test Macro Requirements for glibc (see
54 .\"O .BR feature_test_macros (7)):
55 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
56 .RB ( feature_test_macros (7)
57 »²¾È):
58 .in
59 .sp
60 .ad l
61 .br
62 .BR gethostid ():
63 .RS 4
64 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
65 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
66 .RE
67 .BR sethostid ():
68 .RS 4
69 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
70 .RE
71 .ad b
72 .\"O .SH DESCRIPTION
73 .SH ÀâÌÀ
74 .\"O .BR gethostid ()
75 .\"O and
76 .\"O .BR sethostid ()
77 .\"O respectively get or set a unique 32-bit identifier for the current machine.
78 .\"O The 32-bit identifier is intended to be unique among all UNIX systems in
79 .\"O existence.
80 .\"O This normally resembles the Internet address for the local
81 .\"O machine, as returned by
82 .\"O .BR gethostbyname (3),
83 .\"O and thus usually never needs to be set.
84 .BR gethostid ()
85 ¤È
86 .BR sethostid ()
87 ¤Ï¡¢¤½¤ì¤¾¤ì¡¢¸½ºß»ÈÍѤ·¤Æ¤¤¤ë¥Û¥¹¥È¤Ë¸ÇÍ­¤Î 32 ¥Ó¥Ã¥È¤Î¼±Ê̻ҤÎ
88 ¼èÆÀ/ÀßÄê¤ò¹Ô¤¦¡£
89 ¤³¤Î 32 ¥Ó¥Ã¥È¤Î¼±Ê̻Ҥϡ¢¸½ºß¸ºß¤·¤Æ¤¤¤ëÁ´¤Æ¤Î UNIX ¥·¥¹¥Æ¥à
90 ¤ÎÃæ¤ÇÍ£°ì¤Ë¤Ê¤ë¤è¤¦¤Ë·è¤á¤é¤ì¤ë¡£Ä̾ï¤Ï
91 .BR gethostbyname (3)
92 ¤Ë¤è¤êÊÖ¤µ¤ì¤ë¥í¡¼¥«¥ë¥Þ¥·¥ó¤Î Internet ¥¢¥É¥ì¥¹¤¬Âå¤ï¤ê¤Ë»ÈÍѤµ¤ì¡¢
93 ÉáÄ̤ϼ±Ê̻Ҥò¤¢¤¨¤ÆÀßÄꤹ¤ëɬÍפϤʤ¤¡£
94
95 .\"O The
96 .\"O .BR sethostid ()
97 .\"O call is restricted to the superuser.
98 .BR sethostid ()
99 ¤Ï¥¹¡¼¥Ñ¡¼¥æ¡¼¥¶¤·¤«»ÈÍѤǤ­¤Ê¤¤¡£
100 .\"O .SH "RETURN VALUE"
101 .SH ÊÖ¤êÃÍ
102 .\"O .BR gethostid ()
103 .\"O returns the 32-bit identifier for the current host as set by
104 .\"O .BR sethostid ().
105 .BR gethostid ()
106 ¤Ï¡¢
107 .BR sethostid ()
108 ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤¿¡¢¸½ºß»ÈÍѤ·¤Æ¤¤¤ë¥Û¥¹¥È¤Î 32 ¥Ó¥Ã¥È¤Î¼±Ê̻ҤÎÃͤòÊÖ¤¹¡£
109
110 .\"O On success,
111 .\"O .BR sethostid ()
112 .\"O returns 0; on error, \-1 is returned, and
113 .\"O .I errno
114 .\"O is set to indicate the error.
115 À®¸ù¤¹¤ë¤È¡¢
116 .BR sethostid ()
117 ¤Ï 0 ¤òÊÖ¤¹¡£
118 ¥¨¥é¡¼¤Î¾ì¹ç¡¢\-1 ¤òÊÖ¤·¡¢
119 .I errno
120 ¤Ë¥¨¥é¡¼¤ò¼¨¤¹ÃͤòÀßÄꤹ¤ë¡£
121 .\"O .SH ERRORS
122 .SH ¥¨¥é¡¼
123 .\"O .BR sethostid ()
124 .\"O can fail with the following errors:
125 .BR sethostid ()
126 ¤Ï°Ê²¼¤Î¥¨¥é¡¼¤Ç¼ºÇÔ¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¡£
127 .TP
128 .B EACCES
129 .\"O The caller did not have permission to write to the file used
130 .\"O to store the host ID.
131 ¸Æ¤Ó½Ð¤·¸µ¤¬¥Û¥¹¥È ID ¤òÊݸ¤¹¤ë¤Î¤Ë»ÈÍѤµ¤ì¤ë¥Õ¥¡¥¤¥ë¤Ø¤Î
132 ½ñ¤­¹þ¤ßµö²Ä¤ò»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
133 .TP
134 .B EPERM
135 .\"O The calling process's effective user or group ID is not the same
136 .\"O as its corresponding real ID.
137 ¸Æ¤Ó½Ð¤·¸µ¥×¥í¥»¥¹¤Î¼Â¸ú UID/GID ¤¬Âбþ¤¹¤ë¼Â UID/GID ¤ÈƱ¤¸¤Ç¤Ï¤Ê¤¤¡£
138 .\"O .SH "CONFORMING TO"
139 .SH ½àµò
140 .\"O 4.2BSD; these functions were dropped in 4.4BSD.
141 .\"O SVr4 includes
142 .\"O .BR gethostid ()
143 .\"O but not
144 .\"O .BR sethostid ().
145 .\"O POSIX.1-2001 specifies
146 .\"O .BR gethostid ()
147 .\"O but not
148 .\"O .BR sethostid ().
149 4.2BSD¡£4.4BSD ¤Ç¤Ï¤³¤ì¤é¤Î´Ø¿ô¤Ï¤Ê¤¯¤Ê¤Ã¤¿¡£
150 SVr4 ¤Ë¤Ï
151 .BR gethostid ()
152 ¤Ï´Þ¤Þ¤ì¤Æ¤¤¤ë¤¬¡¢
153 .BR sethostid ()
154 ¤Ï´Þ¤Þ¤ì¤Æ¤¤¤Ê¤¤¡£
155 POSIX.1-2001 ¤Ç¤Ï¡¢
156 .BR gethostid ()
157 ¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤ë¤¬¡¢
158 .BR sethostid ()
159 ¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
160 .\"O .SH NOTES
161 .SH Ãí°Õ
162 .\"O In the glibc implementation, the
163 .\"O .I hostid
164 .\"O is stored in the file
165 .\"O .IR /etc/hostid .
166 .\"O (In glibc versions before 2.2, the file
167 .\"O .I /var/adm/hostid
168 .\"O was used.)
169 glibc ¤Î¼ÂÁõ¤Ç¤Ï¡¢
170 .I hostid
171 ¤Ï¥Õ¥¡¥¤¥ë
172 .I /etc/hostid
173 ¤ËÊݸ¤µ¤ì¤ë
174 (¥Ð¡¼¥¸¥ç¥ó 2.2 ¤è¤êÁ°¤Î glibc ¤Ç¤Ï¡¢
175 .I /var/adm/hostid
176 ¤¬»ÈÍѤµ¤ì¤Æ¤¤¤¿)¡£
177 .\" libc5 used /etc/hostid; libc4 didn't have these functions
178
179 .\"O In the glibc implementation, if
180 .\"O .BR gethostid ()
181 .\"O cannot open the file containing the host ID,
182 .\"O then it obtains the hostname using
183 .\"O .BR gethostname (2),
184 .\"O passes that hostname to
185 .\"O .BR gethostbyname_r (3)
186 .\"O in order to obtain the host's IPv4 address,
187 .\"O and returns a value obtained by bit-twiddling the IPv4 address.
188 .\"O (This value may not be unique.)
189 glibc ¤Î¼ÂÁõ¤Ç¤Ï¡¢¥Û¥¹¥È ID ¤òÊݸ¤·¤¿¥Õ¥¡¥¤¥ë¤ò
190 ¥ª¡¼¥×¥ó¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¡¢
191 .BR gethostid ()
192 ¤Ï
193 .BR gethostname (2)
194 ¤ò»È¤Ã¤Æ¥Û¥¹¥È̾¤òÆþ¼ê¤·¡¢¤½¤Î¥Û¥¹¥È̾¤ò
195 .BR gethostbyname_r (3)
196 ¤ËÅϤ·¥Û¥¹¥È¤Î IPv4 ¥¢¥É¥ì¥¹¤ò¼èÆÀ¤·¤Æ¡¢
197 ¤½¤Î IPv4 ¥¢¥É¥ì¥¹¤Î¥Ó¥Ã¥ÈÆþ¤ìÂؤ¨¤ò¹Ô¤Ã¤¿ÃͤòÊÖ¤¹¡£
198 .\"O .SH BUGS
199 .SH ¥Ð¥°
200 .\"O It is impossible to ensure that the identifier is globally unique.
201 ¼±Ê̻Ҥ¬À¤³¦Ãæ¤Ç°ì°Õ¤Ç¤¢¤ë¤³¤È¤òÊݾڤ¹¤ë¤³¤È¤Ï¤Ç¤­¤Ê¤¤¡£
202 .\"O .SH "SEE ALSO"
203 .SH ´ØÏ¢¹àÌÜ
204 .BR hostid (1),
205 .BR gethostbyname (3)