OSDN Git Service

(split) LDP: Update the version to 3.53 in PO files
[linuxjm/LDP_man-pages.git] / draft / man2 / gethostname.2
index 888fe0e..8776c94 100644 (file)
@@ -1,7 +1,6 @@
-.\" Hey Emacs! This file is -*- nroff -*- source.
-.\"
 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
 .\"
+.\" %%%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.
@@ -9,7 +8,6 @@
 .\" 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
 .\" permission notice identical to this one.
 .\"
 .\" Since the Linux kernel and libraries are constantly changing, this
@@ -22,6 +20,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified 1995-07-22 by Michael Chastain <mec@duracef.shout.net>:
 .\"   'gethostname' is real system call on Linux/Alpha.
 .\" Modified 2004-06-17 by mtk
 .\" Modified 2008-11-27 by mtk
 .\"
-.\" Japanese Version Copyright (c) 1997 SUTO, Mitsuaki
-.\"         all rights reserved.
-.\" Translated 1997-06-27, SUTO, Mitsuaki <suto@av.crl.sony.co.jp>
-.\" Updated 2000-09-30, Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
-.\" Updated & Modified 2002-01-14, Yuichi SATO <ysato@h4.dion.ne.jp>
-.\" Updated & Modified 2004-12-30, Yuichi SATO <ysato444@yahoo.co.jp>
-.\" Updated & Modified 2006-01-31, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2008-12-26, Akihiro MOTOKI, LDP v3.15
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
 .\"
-.TH GETHOSTNAME 2 2010-09-26 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.SH Ì¾Á°
-.\"O gethostname, sethostname \- get/set hostname
-gethostname, sethostname \- ¥Û¥¹¥È̾¤Î¼èÆÀ¡¦ÀßÄê¤ò¤¹¤ë
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
-.B #include <unistd.h>
+.\"*******************************************************************
+.TH GETHOSTNAME 2 2010\-09\-26 Linux "Linux Programmer's Manual"
+.SH 名前
+gethostname, sethostname \- ホスト名の取得・設定をする
+.SH 書式
+\fB#include <unistd.h>\fP
 .sp
-.BI "int gethostname(char *" name ", size_t " len );
+\fBint gethostname(char *\fP\fIname\fP\fB, size_t \fP\fIlen\fP\fB);\fP
 .br
-.BI "int sethostname(const char *" name ", size_t " len );
+\fBint sethostname(const char *\fP\fIname\fP\fB, size_t \fP\fIlen\fP\fB);\fP
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
-.RB ( feature_test_macros (7)
-»²¾È):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .sp
 .ad l
 .PD 0
-.BR gethostname ():
+\fBgethostname\fP():
 .RS 4
-.\"O Since glibc 2.12:
-glibc 2.12 °Ê¹ß:
-_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
+glibc 2.12 以降: _BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
 .br
-.\"O || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200112L
-|| /* glibc 2.12 °Ê¹ß: */ _POSIX_C_SOURCE\ >=\ 200112L
+|| /* glibc 2.12 以降: */ _POSIX_C_SOURCE\ >=\ 200112L
 .RE
 .br
-.BR sethostname ():
+\fBsethostname\fP():
 .RS 4
 _BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
 .RE
 .PD
 .ad
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O These system calls are used to access or to change the hostname of the
-.\"O current processor.
-¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢¸½ºß¤Î¥×¥í¥»¥Ã¥µ¤Î¥Û¥¹¥È̾¤ò¼èÆÀ¡¦Êѹ¹¤¹¤ë¤¿¤á¤Ë
-»ÈÍѤµ¤ì¤ë¡£
+.SH 説明
+これらのシステムコールは、現在のプロセッサのホスト名を取得・変更するために 使用される。
 
-.\"O .BR sethostname ()
-.\"O sets the hostname to the value given in the character array
-.\"O .IR name .
-.\"O The
-.\"O .I len
-.\"O argument specifies the number of bytes in
-.\"O .IR name .
-.\"O (Thus,
-.\"O .I name
-.\"O does not require a terminating null byte.)
-.BR sethostname ()
-¤Ï¡¢¥Û¥¹¥È̾¤ò¡¢Ê¸»úÇÛÎó
-.I name
-¤Ç»ØÄꤵ¤ì¤¿ÃͤËÀßÄꤹ¤ë¡£
-°ú¤­¿ô
-.I len
-¤Ë¤Ï¡¢
-.I name
-¤Î¥Ð¥¤¥È¿ô¤ò»ØÄꤹ¤ë
-(¤½¤Î¤¿¤á¡¢
-.I name
-¤Ç¤Ïʸ»úÎó½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤ÏɬÍפʤ¤)¡£
+\fBsethostname\fP()  は、ホスト名を、文字配列 \fIname\fP で指定された値に設定する。 引き数 \fIlen\fP には、 \fIname\fP
+のバイト数を指定する (そのため、 \fIname\fP では文字列終端の NULL バイトは必要ない)。
 
-.\"O .BR gethostname ()
-.\"O returns the null-terminated hostname in the character array
-.\"O .IR name ,
-.\"O which has a length of
-.\"O .I len
-.\"O bytes.
-.\"O If the null-terminated hostname is too large to fit,
-.\"O then the name is truncated, and no error is returned (but see NOTES below).
-.\"O POSIX.1-2001 says that if such truncation occurs,
-.\"O then it is unspecified whether the returned buffer
-.\"O includes a terminating null byte.
-.BR gethostname ()
-¤Ï¡¢NULL ½ªÃ¼¤µ¤ì¤¿¥Û¥¹¥È̾¤ò¡¢
-.I len
-¥Ð¥¤¥È¤ÎŤµ¤Îʸ»úÇÛÎó
-.I name
-¤Ë³ÊǼ¤·¤ÆÊÖ¤¹¡£
-NULL ½ªÃ¼¤µ¤ì¤¿¥Û¥¹¥È̾¤¬³ÊǼÀè¤Î¥Ð¥Ã¥Õ¥¡¤è¤ê¤âŤ¤¾ì¹ç¤Ï¡¢
-¥Û¥¹¥È̾¤ÏÀÚ¤êµÍ¤á¤é¤ì¡¢¥¨¥é¡¼¤ÏÊÖ¤µ¤ì¤Ê¤¤ (²¼µ­¤Î¡ÖÃí°Õ¡×¤ÎÀá¤ò»²¾È)¡£
-POSIX.1-2001 ¤Ç¤Ï¡¢·ë²Ì¤ÎÀÚ¤êµÍ¤á¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¡¢
-ÊÖ¤µ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤Ë½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë¤«¤É¤¦¤«¤Ï
-µ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O On success, zero is returned.
-.\"O On error, \-1 is returned, and
-.\"O .I errno
-.\"O is set appropriately.
-À®¸ù¤·¤¿¾ì¹ç 0 ¤¬Ê֤롣¼ºÇÔ¤·¤¿¾ì¹ç \-1 ¤¬Ê֤ꡢ
-.I errno
-¤¬¥¨¥é¡¼¤ÎÆâÍƤ˽¾¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£
-.\"O .SH ERRORS
-.SH ¥¨¥é¡¼
-.TP
-.B EFAULT
-.\"O .I name
-.\"O is an invalid address.
-.I name
-¤¬ÉÔÀµ¤Ê¥¢¥É¥ì¥¹¤Ç¤¢¤ë¡£
-.TP
-.B EINVAL
-.\"O .I len
-.\"O is negative
-.\"O .\" Can't occur for gethostbyname() wrapper, since 'len' has an
-.\"O .\" unsigned type; can occur for the underlying system call.
-.\"O or, for
-.\"O .BR sethostname (),
-.\"O .I len
-.\"O is larger than the maximum allowed size.
-.I len
-¤¬Éé¤Ç¤¢¤ë¡£
-.\" gethostbyname() ¥é¥Ã¥Ñ¡¼´Ø¿ô¤Ç¤Ï¡¢'len' ¤Ï unsigned ·¿¤Ê¤Î¤Ç
-.\" ¤³¤Î¥¨¥é¡¼¤¬È¯À¸¤¹¤ë¤³¤È¤Ï¤Ê¤¤¡£
-.\" ¤½¤ÎÃæ¤Ç¸Æ¤Ð¤ì¤ë¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ç¤ÏȯÀ¸¤¹¤ë¤³¤È¤¬¤¢¤ë¡£
-.BR sethostname ()
-¤Ë¤ª¤¤¤Æ
-.I len
-¤¬µöÍƤµ¤ì¤¿ºÇÂ祵¥¤¥º¤ò±Û¤¨¤Æ¤¤¤ë¡£
-.TP
-.B ENAMETOOLONG
-.\"O .RB "(glibc " gethostname ())
-.\"O .I len
-.\"O is smaller than the actual size.
-.\"O (Before version 2.1, glibc uses
-.\"O .BR EINVAL
-.\"O for this case.)
-.RB "(glibc " gethostname ()
-¤Ç)
-.I len
-¤¬¼ÂºÝ¤Î¥Û¥¹¥È̾¤ÎŤµ¤è¤ê¤â¾®¤µ¤¤
-(glibc ¥Ð¡¼¥¸¥ç¥ó 2.1 ¤è¤êÁ°¤Ç¤Ï¡¢¤³¤Î¾õ¶·¤Ç
-.B EINVAL
-¤¬»ÈÍѤµ¤ì¤ë)¡£
-.TP
-.B EPERM
-.\"O For
-.\"O .BR sethostname (),
-.\"O the caller did not have the
-.\"O .B CAP_SYS_ADMIN
-.\"O capability.
-.BR sethostname ()
-¤Ë¤ª¤¤¤Æ¡¢¸Æ¤Ó½Ð¤·¤¿¿Í¤¬
-.B CAP_SYS_ADMIN
-¥±¡¼¥Ñ¥Ó¥ê¥Æ¥£ (capability) ¤ò»ý¤Ã¤Æ¤¤¤Ê¤«¤Ã¤¿¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-.\"O SVr4, 4.4BSD  (these interfaces first appeared in 4.2BSD).
-.\"O POSIX.1-2001 specifies
-.\"O .BR gethostname ()
-.\"O but not
-.\"O .BR sethostname ().
-SVr4, 4.4BSD  (¤³¤ì¤é¤Î¥¤¥ó¥¿¥Õ¥§¡¼¥¹¤Ï 4.2BSD ¤Ç½é¤á¤ÆÅо줷¤¿)¡£
-POSIX.1-2001 ¤Ç¤Ï
-.BR gethostname ()
-¤Ë¤Ä¤¤¤Æ¤Ïµ¬Äꤷ¤Æ¤¤¤ë¤¬¡¢
-.BR sethostname ()
-¤Ïµ¬Äꤷ¤Æ¤¤¤Ê¤¤¡£
-.\"O .SH NOTES
-.SH Ãí°Õ
-.\"O SUSv2 guarantees that "Host names are limited to 255 bytes".
-.\"O POSIX.1-2001 guarantees that "Host names (not including
-.\"O the terminating null byte) are limited to
-.\"O .B HOST_NAME_MAX
-.\"O bytes".
-SUSv2 ¤Ç¤Ï¡Ö¥Û¥¹¥È̾¤¬ 255 ¥Ð¥¤¥È¤ËÀ©¸Â¤µ¤ì¤ë¡×¤³¤È¤òÊݾڤ·¤Æ¤¤¤ë¡£
-POSIX.1-2001 ¤Ç¤Ï¡Ö¥Û¥¹¥È̾ (½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤Ï´Þ¤Þ¤Ê¤¤) ¤¬
-.B HOST_NAME_MAX
-¥Ð¥¤¥È¤ËÀ©¸Â¤µ¤ì¤ë¡×¤³¤È¤òÊݾڤ·¤Æ¤¤¤ë¡£
-.\"O On Linux,
-.\"O .B HOST_NAME_MAX
-.\"O is defined with the value 64, which has been the limit since Linux 1.0
-.\"O (earlier kernels imposed a limit of 8 bytes).
-Linux ¤Ç¤Ï¡¢
-.B HOST_NAME_MAX
-¤Ï 64 ¤ËÄêµÁ¤µ¤ì¤Æ¤ª¤ê¡¢
-Linux 1.0 °Ê¹ß¤Ç¤Ï¤³¤ì¤¬¾å¸Â¤È¤Ê¤Ã¤Æ¤­¤¿
-(¤â¤Ã¤È¸Å¤¤¥«¡¼¥Í¥ë¤Ç¤Ï 8 ¥Ð¥¤¥È¤Î¾å¸Â¤¬Å¬ÍѤµ¤ì¤Æ¤¤¤¿)¡£
-.\"O .SS Glibc Notes
-.SS "glibc ¤Ç¤ÎÃí°Õ"
-.\"O The GNU C library does not employ the
-.\"O .BR gethostname ()
-.\"O system call; instead, it implements
-.\"O .BR gethostname ()
-.\"O as a library function that calls
-.\"O .BR uname (2)
-.\"O and copies up to
-.\"O .I len
-.\"O bytes from the returned
-.\"O .I nodename
-.\"O field into
-.\"O .IR name .
-GNU C ¥é¥¤¥Ö¥é¥ê¤Ï¡¢
-.BR gethostname ()
-¥·¥¹¥Æ¥à¥³¡¼¥ë¤òÍøÍѤ·¤Æ¤¤¤Ê¤¤¡£¤½¤ÎÂå¤ï¤ê¡¢
-.BR gethostname ()
-¤ò¥é¥¤¥Ö¥é¥ê´Ø¿ô¤È¤·¤Æ¼ÂÁõ¤·¤Æ¤ª¤ê¡¢
-¤³¤Î´Ø¿ô¤Ï
-.BR uname (2)
-¤ò¸Æ¤Ó½Ð¤·¡¢
-.BR uname (2)
-¤¬ÊÖ¤·¤¿
-.I nodename
-¥Õ¥£¡¼¥ë¥É (¤ÎºÇÂç
-.I len
-¥Ð¥¤¥È) ¤ò
-.I name
-¤Ë¥³¥Ô¡¼¤¹¤ë¡£
-.\"O Having performed the copy, the function then checks if the length of the
-.\"O .I nodename
-.\"O was greater than or equal to
-.\"O .IR len ,
-.\"O and if it is, then the function returns \-1 with
-.\"O .I errno
-.\"O set to
-.\"O .BR ENAMETOOLONG ;
-.\"O in this case, a terminating null byte is not included in the returned
-.\"O .IR name .
-¥³¥Ô¡¼¤ò¹Ô¤Ã¤¿ºÝ¤Ë¡¢¤³¤Î´Ø¿ô¤Ï
-.I nodename
-¤ÎŤµ¤¬
-.I len
-°Ê¾å¤«¤Î³Îǧ¤ò¹Ô¤¤¡¢
-.I len
-°Ê¾å¤Î¾ì¹ç¤Ë¤Ï \-1 ¤òÊÖ¤·¡¢
-.I errno
-¤Ë
-.B ENAMETOOLONG
-¤òÀßÄꤹ¤ë¡£
-¤³¤Î¾ì¹ç¡¢ÊÖ¤µ¤ì¤¿
-.I name
-¤Ë¤Ï½ªÃ¼¤Î NULL ¥Ð¥¤¥È¤Ï´Þ¤Þ¤ì¤Ê¤¤¡£
+\fBgethostname\fP()  は、NULL 終端されたホスト名を、 \fIlen\fP バイトの長さの文字配列 \fIname\fP に格納して返す。
+NULL 終端されたホスト名が格納先のバッファよりも長い場合は、 ホスト名は切り詰められ、エラーは返されない (下記の「注意」の節を参照)。
+POSIX.1\-2001 では、結果の切り詰めが発生した場合に、 返されたバッファに終端の NULL バイトが含まれているかどうかは 規定されていない。
+.SH 返り値
+成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
+.SH エラー
+.TP 
+\fBEFAULT\fP
+\fIname\fP が不正なアドレスである。
+.TP 
+\fBEINVAL\fP
+.\" Can't occur for gethostbyname() wrapper, since 'len' has an
+.\" unsigned type; can occur for the underlying system call.
+\fIlen\fP が負である。 \fBsethostname\fP()  において \fIlen\fP が許容された最大サイズを越えている。
+.TP 
+\fBENAMETOOLONG\fP
+(glibc \fBgethostname\fP()  で)  \fIlen\fP が実際のホスト名の長さよりも小さい (glibc バージョン 2.1
+より前では、この状況で \fBEINVAL\fP が使用される)。
+.TP 
+\fBEPERM\fP
+\fBsethostname\fP()  において、呼び出した人が \fBCAP_SYS_ADMIN\fP ケーパビリティ (capability)
+を持っていなかった。
+.SH 準拠
+SVr4, 4.4BSD (これらのインタフェースは 4.2BSD で初めて登場した)。 POSIX.1\-2001 では
+\fBgethostname\fP()  については規定しているが、 \fBsethostname\fP()  は規定していない。
+.SH 注意
+SUSv2 では「ホスト名が 255 バイトに制限される」ことを保証している。 POSIX.1\-2001 では「ホスト名 (終端の NULL
+バイトは含まない) が \fBHOST_NAME_MAX\fP バイトに制限される」ことを保証している。 Linux では、 \fBHOST_NAME_MAX\fP
+は 64 に定義されており、 Linux 1.0 以降ではこれが上限となってきた (もっと古いカーネルでは 8 バイトの上限が適用されていた)。
+.SS "glibc での注意"
+GNU C ライブラリは、 \fBgethostname\fP()  システムコールを利用していない。その代わり、 \fBgethostname\fP()
+をライブラリ関数として実装しており、 この関数は \fBuname\fP(2)  を呼び出し、 \fBuname\fP(2)  が返した \fInodename\fP
+フィールド (の最大 \fIlen\fP バイト) を \fIname\fP にコピーする。 コピーを行った際に、この関数は \fInodename\fP の長さが
+\fIlen\fP 以上かの確認を行い、 \fIlen\fP 以上の場合には \-1 を返し、 \fIerrno\fP に \fBENAMETOOLONG\fP を設定する。
+この場合、返された \fIname\fP には終端の NULL バイトは含まれない。
 
-.\"O Versions of glibc before 2.2
-.\"O .\" At least glibc 2.0 and 2.1, older versions not checked
-.\"O handle the case where the length of the
-.\"O .I nodename
-.\"O was greater than or equal to
-.\"O .I len
-.\"O differently: nothing is copied into
-.\"O .I name
-.\"O and the function returns \-1 with
-.\"O .I errno
-.\"O set to
-.\"O .BR ENAMETOOLONG .
-¥Ð¡¼¥¸¥ç¥ó 2.2 ¤è¤êÁ°¤Î glibc
-.\" ¾¯¤Ê¤¯¤È¤â glibc 2.0 ¤È 2.1¡£¤½¤ì¤è¤ê¸Å¤¤¥Ð¡¼¥¸¥ç¥ó¤Ï̤³Îǧ
-¤Ç¤Ï¡¢
-.I nodename
-¤ÎŤµ¤¬
-.I len
-°Ê¾å¤Î¾ì¹ç¤Î°·¤¤¤¬°Û¤Ê¤ë;
-.I len
-°Ê¾å¤Î¾ì¹ç¤Ë¤Ï¡¢
-.I name
-¤Ë¤Ï²¿¤â¥³¥Ô¡¼¤»¤º¡¢´Ø¿ô¤Ï \-1 ¤òÊÖ¤·¡¢
-.I errno
-¤Ë
-.B ENAMETOOLONG
-¤òÀßÄꤹ¤ë¡£
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR getdomainname (2),
-.BR setdomainname (2),
-.BR uname (2)
+.\" At least glibc 2.0 and 2.1, older versions not checked
+バージョン 2.2 より前の glibc では、 \fInodename\fP の長さが \fIlen\fP 以上の場合の扱いが異なる; \fIlen\fP
+以上の場合には、 \fIname\fP には何もコピーせず、関数は \-1 を返し、 \fIerrno\fP に \fBENAMETOOLONG\fP を設定する。
+.SH 関連項目
+\fBgetdomainname\fP(2), \fBsetdomainname\fP(2), \fBuname\fP(2)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.53 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。