OSDN Git Service

Complete unix.7
authorAkihiro MOTOKI <amotoki@gmail.com>
Thu, 8 Jan 2015 21:54:03 +0000 (06:54 +0900)
committerAkihiro MOTOKI <amotoki@gmail.com>
Thu, 8 Jan 2015 21:54:03 +0000 (06:54 +0900)
draft/man7/unix.7
po4a/net/po/ja.po
stats/net
untrans.html

index ade57b7..c77b05b 100644 (file)
@@ -73,10 +73,9 @@ struct sockaddr_un {
 .PP
 \fIsun_family\fP フィールドには必ず \fBAF_UNIX\fP が入っている。
 
-Various systems calls (for example, \fBbind\fP(2), \fBconnect\fP(2), and
-\fBsendto\fP(2))  take a \fIsockaddr_un\fP argument as input.  Some other system
-calls (for example, \fBgetsockname\fP(2), \fBgetpeername\fP(2), \fBrecvfrom\fP(2),
-and \fBaccept\fP(2))  return an argument of this type.
+様々なシステムコール (例えば \fBbind\fP(2), \fBconnect\fP(2), \fBsendto\fP(2)) は入力として
+\fIsockaddr_un\fP 引き数を取る。 他のいくつかのシステムコール (例えば \fBgetsockname\fP(2),
+\fBgetpeername\fP(2), \fBrecvfrom\fP(2), \fBaccept\fP(2)) はこの型の引き数を返す。
 
 \fIsockaddr_un\fP 構造体では 3 種類のアドレスが区別される。
 .IP * 3
@@ -90,7 +89,7 @@ and \fBaccept\fP(2))  return an argument of this type.
 \fIsizeof(sa_family_t)\fP の値と同じだが、 他の実装では \fIsun_path\fP の前に他のフィールドが含まれる場合もある。
 そのため、 \fBoffsetof\fP() 式を使う方がより移植性のある方法でアドレス構造体のサイズを知ることができる。)
 .IP
-For further details of pathname sockets, see below.
+パス名ソケットの詳細については、後で説明する。
 .IP *
 .\" There is quite some variation across implementations: FreeBSD
 .\" says the length is 16 bytes, HP-UX 11 says it's zero bytes.
@@ -105,44 +104,35 @@ For further details of pathname sockets, see below.
 より大きく)、 ソケットの名前は \fIsun_path\fP の最初の \fI(addrlen \- sizeof(sa_family_t))\fP
 バイトに格納される。 ソケットの抽象名前空間は Linux による拡張であり、移植性はない。
 .SS パス名ソケット
-When binding a socket to a pathname, a few rules should be observed for
-maximum portability and ease of coding:
+ソケットにパス名を結びつける際に、 最大限の移植性を持たせ、コーディングを簡単にするためのルールがいくつかある。
 .IP * 3
 \fIsun_path\fP のパス名はヌル終端すべきである。
 .IP *
 終端のヌルバイトを含めたパス名の長さは \fIsun_path\fP の大きさを超えないようにすべきである。
 .IP *
-The \fIaddrlen\fP argument that describes the enclosing \fIsockaddr_un\fP
-structure should have a value of at least:
+\fIsockaddr_un\fP 構造体の終わりを示す \fIaddrlen\fP 引き数は最低でも以下の値を持つべきである。
 
 .nf
     offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1
 .fi
 .IP
-or, more simply, \fIaddrlen\fP can be specified as \fIsizeof(struct
-sockaddr_un)\fP.
+もしくは、もっと簡単には、 \fIaddrlen\fP に \fIsizeof(struct sockaddr_un)\fP を指定することもできる。
 .PP
 .\" Linux does this, including for the case where the supplied path
 .\" is 108 bytes
-There is some variation in how implementations handle UNIX domain socket
-addresses that do not follow the above rules.  For example, some (but not
-all) implementations append a null terminator if none is present in the
-supplied \fIsun_path\fP.
+UNIX ドメインソケットアドレスの扱いが上記のルールに従っていない実装もいくつかある。 (全部ではないが) いくつかの実装では、
+\fIsun_path\fP に文字列終端の NULL がなかった場合に終端の NULL が追加される。
 
 .\" HP-UX
 .\" Modern BSDs generally have 104, Tru64 and AIX have 104,
 .\" Solaris and Irix have 108
-When coding portable applications, keep in mind that some implementations
-have \fIsun_path\fP as short as 92 bytes.
-
-Various system calls (\fBaccept\fP(2), \fBrecvfrom\fP(2), \fBgetsockname\fP(2),
-\fBgetpeername\fP(2))  return socket address structures.  When applied to UNIX
-domain sockets, the value\-result \fIaddrlen\fP argument supplied to the call
-should be initialized as above.  Upon return, the argument is set to
-indicate the \fIactual\fP size of the address structure.  The caller should
-check the value returned in this argument: if the output value exceeds the
-input value, then there is no guarantee that a null terminator is present in
-\fIsun_path\fP.  (See BUGS.)
+移植性があるアプリケーションを作成する際には、 いくつかの実装では \fIsun_path\fP は 92 バイトしかないという点にも留意しておくとよい。
+
+様々なシステムコール (\fBaccept\fP(2), \fBrecvfrom\fP(2), \fBgetsockname\fP(2),
+\fBgetpeername\fP(2)) がソケットアドレス構造体を返す。 これらのシステムコールが UNIX ドメインソケットに対して呼ばれた際には、
+これらの呼び出しに渡す \fIaddrlen\fP 引き数は上記の説明のように初期化すべきである。
+リターン時には、この引き数にはアドレス構造体の「実際の」サイズが設定される。 呼び出し側ではこの引き数で返された値を確認すべきである。
+返された値が入力値よりも大きい場合、 \fIsun_path\fP に終端の NULL バイトが存在する保証はない (「バグ」を参照)。
 .SS ソケットオプション
 歴史的な理由により、これらのオプションは たとえ \fBAF_UNIX\fP 固有のオプションであっても \fBSOL_SOCKET\fP 型で指定する。
 ソケットファミリーとして \fBSOL_SOCKET\fP を指定すると、 \fBsetsockopt\fP(2)  でオプションが設定でき、
@@ -319,27 +309,19 @@ Linux の実装では、 ファイルシステム上から見えるソケット
 UNIX ドメインのストリーム・ソケットでは、 帯域外データの概念はサポートされない。
 .SH バグ
 .\" The behavior on Solaris is quite similar.
-When binding a socket to an address, Linux is one of the implementations
-that appends a null terminator if none is supplied in \fIsun_path\fP.  In most
-cases this is unproblematic: when the socket address is retrieved, it will
-be one byte longer than that supplied when the socket was bound.  However,
-there is one case where confusing behavior can result: if 108 non\-null bytes
-are supplied when a socket is bound, then the addition of the null
-terminator takes the length of the pathname beyond \fIsizeof(sun_path)\fP.
-Consequently, when retrieving the socket address (for example, via
-\fBaccept\fP(2)), if the input \fIaddrlen\fP argument for the retrieving call is
-specified as \fIsizeof(struct sockaddr_un)\fP, then the returned address
-structure \fIwon't\fP have a null terminator in \fIsun_path\fP.
+ソケットをアドレスに結びつける際、 Linux は終端の NULL が \fIsun_path\fP になかった場合に追加する実装の一つである。
+ほとんどの場合、 これは問題にならない。 ソケットアドレスが取得された際、ソケットをバインドしたときに指定したものより 1 バイト長くなるだけである。
+しかしながら、紛らわしい動作が起こる場合が一つある。 ソケットをバインドした際に 108 個の NULL でないバイトを指定した場合、 終端の NULL
+が追加されるとパス名の長さが \fIsizeof(sun_path)\fP を超えてしまう。 結果として、(例えば \fBaccept\fP(2) で)
+ソケットアドレスを取得した際に、 値を取得する呼び出しの入力の \fIaddress\fP 引き数に \fIsizeof(struct
+sockaddr_un)\fP を指定したとすると、 返されるアドレス構造体は \fIsun_path\fP に終端の NULL を「含まない」ことになる。
 
 .\" i.e., traditional BSD
-In addition, some implementations don't require a null terminator when
-binding a socket (the \fIaddrlen\fP argument is used to determine the length of
-\fIsun_path\fP)  and when the socket address is retrieved on these
-implementations, there is no null terminator in \fIsun_path\fP.
+さらに、 いくつかの実装では、ソケットをバインドする際に終端の NULL が必要ではなく (\fIaddrlen\fP 引き数を使って \fIsun_path\fP
+の長さが判定される)、 このような実装でソケットアドレスを取得する際には、 \fIsun_path\fP に終端の NULL は存在しない。
 
-Applications that retrieve socket addresses can (portably) code to handle
-the possibility that there is no null terminator in \fIsun_path\fP by
-respecting the fact that the number of valid bytes in the pathname is:
+ソケットアドレスを取得するアプリケーションでは、 \fIsun_path\fP に終端の NULL が存在しないという移植性の問題を、
+パス名の有効なバイト数が以下のようになると事実を考慮することで取り扱うことができる。
 
 .\" The following patch to amend kernel behavior was rejected:
 .\" http://thread.gmane.org/gmane.linux.kernel.api/2437
@@ -353,11 +335,10 @@ respecting the fact that the number of valid bytes in the pathname is:
 .\" FIXME . Track http://austingroupbugs.net/view.php?id=561
     strnlen(addr.sun_path, addrlen \- offsetof(sockaddr_un, sun_path))
 
-Alternatively, an application can retrieve the socket address by allocating
-a buffer of size \fIsizeof(struct sockaddr_un)+1\fP that is zeroed out before
-the retrieval.  The retrieving call can specify \fIaddrlen\fP as
-\fIsizeof(struct sockaddr_un)\fP, and the extra zero byte ensures that there
-will be a null terminator for the string returned in \fIsun_path\fP:
+他の方法としては、 アプリケーションがソケットアドレスを取得する際、 取得の呼び出しを行う前に、 大きさが \fIsizeof(struct
+sockaddr_un)+1\fP のバッファーを割り当てることもできる。 取得の呼び出しでは \fIaddrlen\fP に \fIsizeof(struct
+sockaddr_un)\fP を指定すると、 余分な一つの 0 バイトにより \fIsun_path\fP で返される文字列に終端の NULL
+が含まれることが保証される。
 
 .nf
 .in +3
@@ -376,9 +357,7 @@ printf("sun_path = %s\en", ((struct sockaddr_un *) addrp)\->sun_path);
 .in
 .fi
 
-This sort of messiness can be avoided if it is guaranteed that the
-applications that \fIcreate\fP pathname sockets follow the rules outlined above
-under \fIPathname sockets\fP.
+アプリケーションが「パス名ソケット」の節で説明したルールにしたがってパス名を「作成」していれば、 このような分かりにくさは避けることができる。
 .SH 例
 \fBbind\fP(2)  参照。
 
index 3df1e4a..66d51b8 100644 (file)
@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "POT-Creation-Date: 2015-01-04 23:49+0900\n"
-"PO-Revision-Date: 2015-01-05 08:32+0900\n"
+"PO-Revision-Date: 2015-01-09 06:53+0900\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language: \n"
@@ -22662,7 +22662,7 @@ msgid ""
 "B<sendto>(2))  take a I<sockaddr_un> argument as input.  Some other system "
 "calls (for example, B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), "
 "and B<accept>(2))  return an argument of this type."
-msgstr ""
+msgstr "様々なシステムコール (例えば B<bind>(2), B<connect>(2), B<sendto>(2)) は入力として I<sockaddr_un> 引き数を取る。 他のいくつかのシステムコール (例えば B<getsockname>(2), B<getpeername>(2), B<recvfrom>(2), B<accept>(2)) はこの型の引き数を返す。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:95
@@ -22705,7 +22705,7 @@ msgstr ""
 #. type: Plain text
 #: build/C/man7/unix.7:120
 msgid "For further details of pathname sockets, see below."
-msgstr ""
+msgstr "パス名ソケットの詳細については、後で説明する。"
 
 #.  There is quite some variation across implementations: FreeBSD
 #.  says the length is 16 bytes, HP-UX 11 says it's zero bytes.
@@ -22759,7 +22759,7 @@ msgstr "パス名ソケット"
 msgid ""
 "When binding a socket to a pathname, a few rules should be observed for "
 "maximum portability and ease of coding:"
-msgstr ""
+msgstr "ソケットにパス名を結びつける際に、 最大限の移植性を持たせ、コーディングを簡単にするためのルールがいくつかある。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:166
@@ -22780,7 +22780,7 @@ msgstr ""
 msgid ""
 "The I<addrlen> argument that describes the enclosing I<sockaddr_un> "
 "structure should have a value of at least:"
-msgstr ""
+msgstr "I<sockaddr_un> 構造体の終わりを示す I<addrlen> 引き数は最低でも以下の値を持つべきである。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:179
@@ -22793,7 +22793,7 @@ msgstr "    offsetof(struct sockaddr_un, sun_path)+strlen(addr.sun_path)+1\n"
 msgid ""
 "or, more simply, I<addrlen> can be specified as I<sizeof(struct "
 "sockaddr_un)>."
-msgstr ""
+msgstr "もしくは、もっと簡単には、 I<addrlen> に I<sizeof(struct sockaddr_un)> を指定することもできる。"
 
 #.  Linux does this, including for the case where the supplied path
 #.  is 108 bytes
@@ -22804,7 +22804,7 @@ msgid ""
 "addresses that do not follow the above rules.  For example, some (but not "
 "all) implementations append a null terminator if none is present in the "
 "supplied I<sun_path>."
-msgstr ""
+msgstr "UNIX ドメインソケットアドレスの扱いが上記のルールに従っていない実装もいくつかある。 (全部ではないが) いくつかの実装では、 I<sun_path> に文字列終端の NULL がなかった場合に終端の NULL が追加される。"
 
 #.  HP-UX
 #.  Modern BSDs generally have 104, Tru64 and AIX have 104,
@@ -22814,7 +22814,7 @@ msgstr ""
 msgid ""
 "When coding portable applications, keep in mind that some implementations "
 "have I<sun_path> as short as 92 bytes."
-msgstr ""
+msgstr "移植性があるアプリケーションを作成する際には、 いくつかの実装では I<sun_path> は 92 バイトしかないという点にも留意しておくとよい。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:220
@@ -22827,7 +22827,7 @@ msgid ""
 "check the value returned in this argument: if the output value exceeds the "
 "input value, then there is no guarantee that a null terminator is present in "
 "I<sun_path>.  (See BUGS.)"
-msgstr ""
+msgstr "様々なシステムコール (B<accept>(2), B<recvfrom>(2), B<getsockname>(2), B<getpeername>(2)) がソケットアドレス構造体を返す。 これらのシステムコールが UNIX ドメインソケットに対して呼ばれた際には、 これらの呼び出しに渡す I<addrlen> 引き数は上記の説明のように初期化すべきである。 リターン時には、この引き数にはアドレス構造体の「実際の」サイズが設定される。 呼び出し側ではこの引き数で返された値を確認すべきである。 返された値が入力値よりも大きい場合、 I<sun_path> に終端の NULL バイトが存在する保証はない (「バグ」を参照)。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:233
@@ -23288,7 +23288,7 @@ msgid ""
 "B<accept>(2)), if the input I<addrlen> argument for the retrieving call is "
 "specified as I<sizeof(struct sockaddr_un)>, then the returned address "
 "structure I<won't> have a null terminator in I<sun_path>."
-msgstr ""
+msgstr "ソケットをアドレスに結びつける際、 Linux は終端の NULL が I<sun_path> になかった場合に追加する実装の一つである。 ほとんどの場合、 これは問題にならない。 ソケットアドレスが取得された際、ソケットをバインドしたときに指定したものより 1 バイト長くなるだけである。 しかしながら、紛らわしい動作が起こる場合が一つある。 ソケットをバインドした際に 108 個の NULL でないバイトを指定した場合、 終端の NULL が追加されるとパス名の長さが I<sizeof(sun_path)> を超えてしまう。 結果として、(例えば B<accept>(2) で) ソケットアドレスを取得した際に、 値を取得する呼び出しの入力の I<address> 引き数に I<sizeof(struct sockaddr_un)> を指定したとすると、 返されるアドレス構造体は I<sun_path> に終端の NULL を「含まない」ことになる。"
 
 #.  i.e., traditional BSD
 #. type: Plain text
@@ -23298,7 +23298,7 @@ msgid ""
 "binding a socket (the I<addrlen> argument is used to determine the length of "
 "I<sun_path>)  and when the socket address is retrieved on these "
 "implementations, there is no null terminator in I<sun_path>."
-msgstr ""
+msgstr "さらに、 いくつかの実装では、ソケットをバインドする際に終端の NULL が必要ではなく (I<addrlen> 引き数を使って I<sun_path> の長さが判定される)、 このような実装でソケットアドレスを取得する際には、 I<sun_path> に終端の NULL は存在しない。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:561
@@ -23306,7 +23306,7 @@ msgid ""
 "Applications that retrieve socket addresses can (portably) code to handle "
 "the possibility that there is no null terminator in I<sun_path> by "
 "respecting the fact that the number of valid bytes in the pathname is:"
-msgstr ""
+msgstr "ソケットアドレスを取得するアプリケーションでは、 I<sun_path> に終端の NULL が存在しないという移植性の問題を、 パス名の有効なバイト数が以下のようになると事実を考慮することで取り扱うことができる。"
 
 #
 #.  The following patch to amend kernel behavior was rejected:
@@ -23322,7 +23322,7 @@ msgstr ""
 #: build/C/man7/unix.7:573
 #, no-wrap
 msgid "    strnlen(addr.sun_path, addrlen - offsetof(sockaddr_un, sun_path))\n"
-msgstr ""
+msgstr "    strnlen(addr.sun_path, addrlen - offsetof(sockaddr_un, sun_path))\n"
 
 #. type: Plain text
 #: build/C/man7/unix.7:585
@@ -23332,7 +23332,7 @@ msgid ""
 "the retrieval.  The retrieving call can specify I<addrlen> as "
 "I<sizeof(struct sockaddr_un)>, and the extra zero byte ensures that there "
 "will be a null terminator for the string returned in I<sun_path>:"
-msgstr ""
+msgstr "他の方法としては、 アプリケーションがソケットアドレスを取得する際、 取得の呼び出しを行う前に、 大きさが I<sizeof(struct sockaddr_un)+1> のバッファーを割り当てることもできる。 取得の呼び出しでは I<addrlen> に I<sizeof(struct sockaddr_un)> を指定すると、 余分な一つの 0 バイトにより I<sun_path> で返される文字列に終端の NULL が含まれることが保証される。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:589
@@ -23378,7 +23378,7 @@ msgid ""
 "This sort of messiness can be avoided if it is guaranteed that the "
 "applications that I<create> pathname sockets follow the rules outlined above "
 "under I<Pathname sockets>."
-msgstr ""
+msgstr "アプリケーションが「パス名ソケット」の節で説明したルールにしたがってパス名を「作成」していれば、 このような分かりにくさは避けることができる。"
 
 #. type: Plain text
 #: build/C/man7/unix.7:611
index 72b5d20..229b68b 100644 (file)
--- a/stats/net
+++ b/stats/net
@@ -2,4 +2,3 @@
 getaddrinfo_a.3,81,41,122
 inet_net_pton.3,55,37,92
 nss.5,20,7,27
-unix.7,114,14,128
index e85a7a1..5eb07b1 100644 (file)
@@ -63,7 +63,6 @@
 <TR><TD>getaddrinfo_a.3</TD><TD>41/122</TD><TD>66.39</TD></TR>
 <TR><TD>inet_net_pton.3</TD><TD>37/92</TD><TD>59.78</TD></TR>
 <TR class="over70"><TD>nss.5</TD><TD>7/27</TD><TD>74.07</TD></TR>
-<TR class="over80"><TD>unix.7</TD><TD>14/128</TD><TD>89.06</TD></TR>
 <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>notify</B></TD></TR>
 <TR><TD>fanotify.7</TD><TD>94/191</TD><TD>50.79</TD></TR>
 <TR><TD>fanotify_init.2</TD><TD>46/77</TD><TD>40.26</TD></TR>
 <TR class="over80"><TD>zdump.8</TD><TD>1/22</TD><TD>95.45</TD></TR>
 <TR><TD ALIGN="center" COLSPAN=3 BGCOLOR="Yellow"><B>unistd</B></TD></TR>
 <TR class="over80"><TD>fcntl.2</TD><TD>46/241</TD><TD>80.91</TD></TR>
-<TR><TD COLSPAN=3>Total 71 pages</TD></TR>
+<TR><TD COLSPAN=3>Total 70 pages</TD></TR>
 </TABLE>
 </BODY></HTML>