OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / release / man2 / gethostname.2
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 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein.  The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" Modified 1995-07-22 by Michael Chastain <mec@duracef.shout.net>:
27 .\"   'gethostname' is real system call on Linux/Alpha.
28 .\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
29 .\" Modified 2000-06-04, 2001-12-15 by aeb
30 .\" Modified 2004-06-17 by mtk
31 .\" Modified 2008-11-27 by mtk
32 .\"
33 .\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
34 .\"         all rights reserved.
35 .\" Translated 1997-06-27, SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
36 .\" Updated 2000-09-30, Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
37 .\" Updated & Modified 2002-01-14, Yuichi SATO <ysato@h4.dion.ne.jp>
38 .\" Updated & Modified 2004-12-30, Yuichi SATO <ysato444@yahoo.co.jp>
39 .\" Updated & Modified 2006-01-31, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
40 .\" Updated 2008-12-26, Akihiro MOTOKI, LDP v3.15
41 .\"
42 .TH GETHOSTNAME 2 2008-11-27 "Linux" "Linux Programmer's Manual"
43 .SH Ì¾Á°
44 gethostname, sethostname \- ¥Û¥¹¥È̾¤Î¼èÆÀ¡¦ÀßÄê¤ò¤¹¤ë
45 .SH ½ñ¼°
46 .B #include <unistd.h>
47 .sp
48 .BI "int gethostname(char *" name ", size_t " len );
49 .br
50 .BI "int sethostname(const char *" name ", size_t " len );
51 .sp
52 .in -4n
53 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
54 .RB ( feature_test_macros (7)
55 »²¾È):
56 .in
57 .sp
58 .ad l
59 .BR gethostname ():
60 _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
61 .br
62 .BR sethostname ():
63 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
64 .ad b
65 .SH ÀâÌÀ
66 ¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¸½ºß¤Î¥×¥í¥»¥Ã¥µ¤Î¥Û¥¹¥È̾¤ò¼èÆÀ¡¦Êѹ¹¤¹¤ë¤¿¤á¤Ë
67 »ÈÍѤµ¤ì¤ë¡£
68
69 .BR sethostname ()
70 ¤Ï¡¢¥Û¥¹¥È̾¤ò¡¢Ê¸»úÇÛÎó
71 .I name
72 ¤Ç»ØÄꤵ¤ì¤¿ÃͤËÀßÄꤹ¤ë¡£
73 °ú¤­¿ô
74 .I len
75 ¤Ë¤Ï¡¢
76 .I name
77 ¤Î¥Ð¥¤¥È¿ô¤ò»ØÄꤹ¤ë
78 (¤½¤Î¤¿¤á¡¢
79 .I name
80 ¤Ç¤Ïʸ»úÎó½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤ÏɬÍפʤ¤)¡£
81
82 .BR gethostname ()
83 ¤Ï¡¢NULL ½ªÃ¼¤µ¤ì¤¿¥Û¥¹¥È̾¤ò¡¢
84 .I len
85 ¥Ð¥¤¥È¤ÎŤµ¤Îʸ»úÇÛÎó
86 .I name
87 ¤Ë³ÊǼ¤·¤ÆÊÖ¤¹¡£
88 NULL ½ªÃ¼¤µ¤ì¤¿¥Û¥¹¥È̾¤¬³ÊǼÀè¤Î¥Ð¥Ã¥Õ¥¡¤è¤ê¤âŤ¤¾ì¹ç¤Ï¡¢
89 ¥Û¥¹¥È̾¤ÏÀÚ¤êµÍ¤á¤é¤ì¡¢¥¨¥é¡¼¤ÏÊÖ¤µ¤ì¤Ê¤¤ (²¼µ­¤Î¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È)¡£
90 POSIX.1-2001 ¤Ç¤Ï¡¢·ë²Ì¤ÎÀÚ¤êµÍ¤á¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¡¢
91 ÊÖ¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤Ë½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤Ï
92 µ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
93 .SH ÊÖ¤êÃÍ
94 À®¸ù¤·¤¿¾ì¹ç 0 ¤¬Ê֤롣¼ºÇÔ¤·¤¿¾ì¹ç \-1 ¤¬Ê֤ꡢ
95 .I errno
96 ¤¬¥¨¥é¡¼¤ÎÆâÍƤ˽¾¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£
97 .SH ¥¨¥é¡¼
98 .TP
99 .B EFAULT
100 .I name
101 ¤¬ÉÔÀµ¤Ê¥¢¥É¥ì¥¹¤Ç¤¢¤ë¡£
102 .TP
103 .B EINVAL
104 .I len
105 ¤¬Éé¤Ç¤¢¤ë¡£
106 .\" gethostbyname() ¥é¥Ã¥Ñ¡¼´Ø¿ô¤Ç¤Ï¡¢'len' ¤Ï unsigned ·¿¤Ê¤Î¤Ç
107 .\" ¤³¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤³¤È¤Ï¤Ê¤¤¡£
108 .\" ¤½¤ÎÃæ¤Ç¸Æ¤Ð¤ì¤ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤ÏȯÀ¸¤¹¤ë¤³¤È¤¬¤¢¤ë¡£
109 .BR sethostname ()
110 ¤Ë¤ª¤¤¤Æ
111 .I len
112 ¤¬µöÍƤµ¤ì¤¿ºÇÂ祵¥¤¥º¤ò±Û¤¨¤Æ¤¤¤ë¡£
113 .TP
114 .B ENAMETOOLONG
115 .RB "(glibc " gethostname ()
116 ¤Ç)
117 .I len
118 ¤¬¼ÂºÝ¤Î¥Û¥¹¥È̾¤ÎŤµ¤è¤ê¤â¾®¤µ¤¤
119 (glibc ¥Ð¡¼¥¸¥ç¥ó 2.1 ¤è¤êÁ°¤Ç¤Ï¡¢¤³¤Î¾õ¶·¤Ç
120 .B EINVAL
121 ¤¬»ÈÍѤµ¤ì¤ë)¡£
122 .TP
123 .B EPERM
124 .BR sethostname ()
125 ¤Ë¤ª¤¤¤Æ¡¢¸Æ¤Ó½Ð¤·¤¿¿Í¤¬
126 .B CAP_SYS_ADMIN
127 ¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (capability) ¤ò»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
128 .SH ½àµò
129 SVr4, 4.4BSD  (¤³¤ì¤é¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï 4.2BSD ¤Ç½é¤á¤ÆÅо줷¤¿)¡£
130 POSIX.1-2001 ¤Ç¤Ï
131 .BR gethostname ()
132 ¤Ë¤Ä¤¤¤Æ¤Ïµ¬Äꤷ¤Æ¤¤¤ë¤¬¡¢
133 .BR sethostname ()
134 ¤Ïµ¬Äꤷ¤Æ¤¤¤Ê¤¤¡£
135 .SH Ãí°Õ
136 SUSv2 ¤Ç¤Ï¡Ö¥Û¥¹¥È̾¤¬ 255 ¥Ð¥¤¥È¤ËÀ©¸Â¤µ¤ì¤ë¡×¤³¤È¤òÊݾڤ·¤Æ¤¤¤ë¡£
137 POSIX.1-2001 ¤Ç¤Ï¡Ö¥Û¥¹¥È̾ (½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤Ï´Þ¤Þ¤Ê¤¤) ¤¬
138 .B HOST_NAME_MAX
139 ¥Ð¥¤¥È¤ËÀ©¸Â¤µ¤ì¤ë¡×¤³¤È¤òÊݾڤ·¤Æ¤¤¤ë¡£
140 Linux ¤Ç¤Ï¡¢
141 .B HOST_NAME_MAX
142 ¤Ï 64 ¤ËÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
143 Linux 1.0 °Ê¹ß¤Ç¤Ï¤³¤ì¤¬¾å¸Â¤È¤Ê¤Ã¤Æ¤­¤¿
144 (¤â¤Ã¤È¸Å¤¤¥«¡¼¥Í¥ë¤Ç¤Ï 8 ¥Ð¥¤¥È¤Î¾å¸Â¤¬Å¬ÍѤµ¤ì¤Æ¤¤¤¿)¡£
145 .SS "glibc ¤Ç¤ÎÃí°Õ"
146 GNU C ¥é¥¤¥Ö¥é¥ê¤Ï¡¢
147 .BR gethostname ()
148 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤òÍøÍѤ·¤Æ¤¤¤Ê¤¤¡£¤½¤ÎÂå¤ï¤ê¡¢
149 .BR gethostname ()
150 ¤ò¥é¥¤¥Ö¥é¥ê´Ø¿ô¤È¤·¤Æ¼ÂÁõ¤·¤Æ¤ª¤ê¡¢
151 ¤³¤Î´Ø¿ô¤Ï
152 .BR uname (2)
153 ¤ò¸Æ¤Ó½Ð¤·¡¢
154 .BR uname (2)
155 ¤¬ÊÖ¤·¤¿
156 .I nodename
157 ¥Õ¥£¡¼¥ë¥É (¤ÎºÇÂç
158 .I len
159 ¥Ð¥¤¥È) ¤ò
160 .I name
161 ¤Ë¥³¥Ô¡¼¤¹¤ë¡£
162 ¥³¥Ô¡¼¤ò¹Ô¤Ã¤¿ºÝ¤Ë¡¢¤³¤Î´Ø¿ô¤Ï
163 .I nodename
164 ¤ÎŤµ¤¬
165 .I len
166 °Ê¾å¤«¤Î³Îǧ¤ò¹Ô¤¤¡¢
167 .I len
168 °Ê¾å¤Î¾ì¹ç¤Ë¤Ï \-1 ¤òÊÖ¤·¡¢
169 .I errno
170 ¤Ë
171 .B ENAMETOOLONG
172 ¤òÀßÄꤹ¤ë¡£
173 ¤³¤Î¾ì¹ç¡¢ÊÖ¤µ¤ì¤¿
174 .I name
175 ¤Ë¤Ï½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£
176
177 ¥Ð¡¼¥¸¥ç¥ó 2.2 ¤è¤êÁ°¤Î glibc
178 .\" ¾¯¤Ê¤¯¤È¤â glibc 2.0 ¤È 2.1¡£¤½¤ì¤è¤ê¸Å¤¤¥Ð¡¼¥¸¥ç¥ó¤Ï̤³Îǧ
179 ¤Ç¤Ï¡¢
180 .I nodename
181 ¤ÎŤµ¤¬
182 .I len
183 °Ê¾å¤Î¾ì¹ç¤Î°·¤¤¤¬°Û¤Ê¤ë;
184 .I len
185 °Ê¾å¤Î¾ì¹ç¤Ë¤Ï¡¢
186 .I name
187 ¤Ë¤Ï²¿¤â¥³¥Ô¡¼¤»¤º¡¢´Ø¿ô¤Ï \-1 ¤òÊÖ¤·¡¢
188 .I errno
189 ¤Ë
190 .B ENAMETOOLONG
191 ¤òÀßÄꤹ¤ë¡£
192 .SH ´ØÏ¢¹àÌÜ
193 .BR getdomainname (2),
194 .BR setdomainname (2),
195 .BR uname (2)