OSDN Git Service

ca17cf2ca8afc619de37fe1b52e20d8a5b75091a
[linuxjm/LDP_man-pages.git] / draft / man7 / unix.7
1 .\" This man page is Copyright (C) 1999 Andi Kleen <ak@muc.de>.
2 .\" Permission is granted to distribute possibly modified copies
3 .\" of this page provided the header is included verbatim,
4 .\" and in case of nontrivial modification author and date
5 .\" of the modification is added to the header.
6 .\"
7 .\" Modified, 2003-12-02, Michael Kerrisk, <mtk.manpages@gmail.com>
8 .\" Modified, 2003-09-23, Adam Langley
9 .\" Modified, 2004-05-27, Michael Kerrisk, <mtk.manpages@gmail.com>
10 .\"     Added SOCK_SEQPACKET
11 .\" 2008-05-27, mtk, Provide a clear description of the three types of
12 .\"     address that can appear in the sockaddr_un structure: pathname,
13 .\"     unnamed, and abstract.
14 .\"
15 .\" Japanese Version Copyright (c) 1999 Shouichi Saito and
16 .\"     NAKANO Takeo all rights reserved.
17 .\" Translated 1999-12-06, NAKANO Takeo <nakano@apm.seikei.ac.jp>
18 .\"     based on the work by Shouichi Saito <ss236rx@ymg.urban.ne.jp>
19 .\" Updated 2003-01-07, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
20 .\" Updated 2005-02-21, Akihiro MOTOKI
21 .\" Updated 2005-12-26, Akihiro MOTOKI
22 .\" Updated 2008-08-08, Akihiro MOTOKI, LDP v3.05
23 .\"
24 .\"WORD         abstract namespace              抽象名前空間
25 .\"WORD         anonymous socket                名前無しソケット
26 .\"WORD         credential                      信任状
27 .\"WORD         ancillary message               補助メッセージ
28 .\"WORD         file descriptor                 ファイルディスクリプタ
29 .\"
30 .\" 訳注: 訳す際も Unix は capitalize しておくこと。
31 .\"       LDP_man-pages 1.66→2.01 において unix → Unix の変更があり、
32 .\"       意図的な表記と思われる。
33 .\"
34 .TH UNIX  7 2008-12-01 "Linux" "Linux Programmer's Manual"
35 .\"O .SH NAME
36 .SH 名前
37 .\"O unix, AF_UNIX, AF_LOCAL \- Sockets for local
38 .\"O interprocess communication
39 unix, AF_UNIX, AF_LOCAL \- ローカルな
40 プロセス間通信用のソケット
41 .\"O .SH SYNOPSIS
42 .SH 書式
43 .B #include <sys/socket.h>
44 .br
45 .B #include <sys/un.h>
46
47 .IB unix_socket " = socket(AF_UNIX, type, 0);"
48 .br
49 .IB error " = socketpair(AF_UNIX, type, 0, int *" sv ");"
50 .\"O .SH DESCRIPTION
51 .SH 説明
52 .\"O The
53 .\"O .B AF_UNIX
54 .\"O (also known as
55 .\"O .BR AF_LOCAL )
56 .\"O socket family is used to communicate between processes on the same machine
57 .\"O efficiently.
58 .\"O Traditionally, Unix sockets can be either unnamed,
59 .\"O or bound to a file system pathname (marked as being of type socket).
60 .B AF_UNIX
61 .RB ( AF_LOCAL
62 とも言われる) ソケットファミリーは、同じマシン上でプロセス同士が
63 効率的に通信するために用いられる。 
64 伝統的に、Unix ソケットは、名前なしにもできるし、
65 (ソケット型であると印のついた) ファイルシステムのパス名に
66 結び付けることもできる。
67 .\"O Linux also supports an abstract namespace which is independent of the
68 .\"O file system.
69 さらに Linux では、ファイルシステムに依存しない
70 抽象名前空間 (abstract namespace) もサポートしている。
71
72 .\"O Valid types are:
73 .\"O .BR SOCK_STREAM ,
74 .\"O for a stream-oriented socket and
75 .\"O .BR SOCK_DGRAM ,
76 .\"O for a datagram-oriented socket that preserves message boundaries
77 .\"O (as on most Unix implementations, Unix domain datagram
78 .\"O sockets are always reliable and don't reorder datagrams);
79 .\"O and (since Linux 2.6.4)
80 .\"O .BR SOCK_SEQPACKET ,
81 .\"O for a connection-oriented socket that preserves message boundaries
82 .\"O and delivers messages in the order that they were sent.
83 .\" MOTOKI: 見やすいように .TP 形式に変更
84 有効なタイプは以下の通りである:
85 .TP
86 .B SOCK_STREAM
87 ストリーム指向のソケット
88 .TP
89 .B SOCK_DGRAM
90 メッセージ境界を保存するデータグラム指向のソケット
91 (ほとんどの Unix の実装では、Unix ドメイン・データグラム・ソケットは
92 常に信頼でき、データグラムの並び替えは行わない)
93 .TP
94 .B SOCK_SEQPACKET
95 (Linux 2.6.4 以降で利用できる)
96 メッセージ境界を保存し、送信された順序でメッセージを届ける接続指向ソケット
97
98 .\"O Unix sockets support passing file descriptors or process credentials
99 .\"O to other processes using ancillary data.
100 Unix ソケットでは、補助データを使って
101 ファイルディスクリプタやプロセスの信任状 (credential) を
102 送受信することもできる。
103 .\"O .SS Address Format
104 .SS アドレスのフォーマット
105 .\"O A Unix domain socket address is represented in the following structure:
106 Unix ドメインソケットのアドレスは以下の構造体で表現される。
107 .in +4n
108 .nf
109
110 #define UNIX_PATH_MAX    108
111
112 struct sockaddr_un {
113     sa_family_t sun_family;               /* AF_UNIX */
114     char        sun_path[UNIX_PATH_MAX];  /* pathname */
115 };
116 .fi
117 .in
118 .PP
119 .\"O .I sun_family
120 .\"O always contains
121 .\"O .BR AF_UNIX .
122 .I sun_family
123 には必ず
124 .B AF_UNIX
125 が入っている。
126
127 .\"O Three types of address are distinguished in this structure:
128 この構造体では 3 種類のアドレスが区別される。
129 .IP * 3
130 .\"O .IR pathname :
131 .\"O a Unix domain socket can be bound to a null-terminated file
132 .\"O system pathname using
133 .\"O .BR bind (2).
134 .\"O When the address of the socket is returned by
135 .\"O .BR getsockname (2),
136 .\"O .BR getpeername (2),
137 .\"O and
138 .\"O .BR accept (2),
139 .\"O its length is
140 .\"O .IR "sizeof(sa_family_t) + strlen(sun_path) + 1" ,
141 .\"O and
142 .\"O .I sun_path
143 .\"O contains the null-terminated pathname.
144 .IR "pathname (パス名)" :
145 .BR bind (2)
146 を使って、Unix ドメインソケットを NULL 終端されたファイルシステム上の
147 パス名に結び付けることができる。
148 .BR getsockname (2),
149 .BR getpeername (2),
150 .BR accept (2)
151 がソケットのアドレスを返す際には、
152 その長さは
153 .I "sizeof(sa_family_t) + strlen(sun_path) + 1"
154 であり、
155 .I sun_path
156 に NULL 終端されたパス名が格納される。
157 .IP *
158 .\"O .IR unnamed :
159 .\"O A stream socket that has not been bound to a pathname using
160 .\"O .BR bind (2)
161 .\"O has no name.
162 .\"O Likewise, the two sockets created by
163 .\"O .BR socketpair (2)
164 .\"O are unnamed.
165 .\"O When the address of an unnamed socket is returned by
166 .\"O .BR getsockname (2),
167 .\"O .BR getpeername (2),
168 .\"O and
169 .\"O .BR accept (2),
170 .\"O its length is
171 .\"O .IR "sizeof(sa_family_t)" ,
172 .\"O and
173 .\"O .I sun_path
174 .\"O should not be inspected.
175 .\"O .\" There is quite some variation across implementations: FreeBSD
176 .\"O .\" says the length is 16 bytes, HP-UX 11 says it's zero bytes.
177 .IR "unnamed (名前なし)" :
178 .BR bind (2)
179 を使ってパス名に結び付けることができないストリーム型のソケットは
180 名前を持たない。同様に、
181 .BR socketpair (2)
182 で作成される 2 つのソケットも名前を持たない。
183 .BR getsockname (2),
184 .BR getpeername (2),
185 .BR accept (2)
186 が名前なしのソケットのアドレスを返す際には、
187 その長さは
188 .I "sizeof(sa_family_t)"
189 であり、
190 .I sun_path
191 は検査すべきではない。
192 .\" 実装ごとにかなりの違いが存在する。
193 .\" FreeBSD では長さは 16 バイトとなり、HP-UX では長さは 0 バイトとなる。
194 .IP *
195 .\"O .IR abstract :
196 .\"O an abstract socket address is distinguished by the fact that
197 .\"O .IR sun_path[0]
198 .\"O is a null byte ('\\0').
199 .\"O All of the remaining bytes in
200 .\"O .I sun_path
201 .\"O define the "name" of the socket.
202 .\"O (Null bytes in the name have no special significance.)
203 .\"O The name has no connection with file system pathnames.
204 .IR "abstract (抽象)" :
205 抽象ソケットアドレスは、
206 .I sun_path[0]
207 がヌルバイト ('\\0') であることから区別できる。
208 .I sun_path
209 の残りの全バイトによりソケットの「名前」が定義される
210 (名前中のヌルバイトには特別な意味はない)。
211 この名前はファイルシステムのパス名とは何の関係もない。
212 .\"O The socket's address in this namespace is given by the rest of the
213 .\"O bytes in
214 .\"O .IR sun_path .
215 .\"O When the address of an abstract socket is returned by
216 .\"O .BR getsockname (2),
217 .\"O .BR getpeername (2),
218 .\"O and
219 .\"O .BR accept (2),
220 .\"O its length is
221 .\"O .IR "sizeof(struct sockaddr_un)" ,
222 .\"O and
223 .\"O .I sun_path
224 .\"O contains the abstract name.
225 .\"O The abstract socket namespace is a nonportable Linux extension.
226 この名前空間におけるソケットのアドレスは、
227 .I sun_path
228 の残りのバイトで表される。
229 .BR getsockname (2),
230 .BR getpeername (2),
231 .BR accept (2)
232 が抽象ソケットのアドレスを返す際には、その長さは
233 .I "sizeof(struct sockaddr_un)"
234 であり、
235 .I sun_path
236 に抽象名前空間の名前が格納される。
237 ソケットの抽象名前空間は Linux による拡張であり、移植性はない。
238 .\"O .SS Socket Options
239 .SS ソケットオプション
240 .\"O For historical reasons these socket options are specified with a
241 .\"O .B SOL_SOCKET
242 .\"O type even though they are
243 .\"O .B AF_UNIX
244 .\"O specific.
245 .\"O They can be set with
246 .\"O .BR setsockopt (2)
247 .\"O and read with
248 .\"O .BR getsockopt (2)
249 .\"O by specifying
250 .\"O .B SOL_SOCKET
251 .\"O as the socket family.
252 歴史的な理由により、これらのオプションは
253 たとえ
254 .B AF_UNIX
255 固有のオプションであっても
256 .B SOL_SOCKET
257 型で指定する。
258 ソケットファミリーとして
259 .B SOL_SOCKET
260 を指定すると、
261 .BR setsockopt (2)
262 でオプションが設定でき、
263 .BR getsockopt (2)
264 で取得ができる。
265 .\" NAKANO added this TP
266 .TP
267 .B SO_PASSCRED
268 .\"O Enables the receiving of the credentials of the sending process
269 .\"O ancillary message.
270 .\"O When this option is set and the socket is not yet connected
271 .\"O a unique name in the abstract namespace will be generated automatically.
272 .\"O Expects an integer boolean flag.
273 送信プロセスの補助メッセージとして信任状を受信できるようにする。
274 このオプションがセットされていて、まだソケットが接続されていないと、
275 抽象名前空間に他と重ならない名前が自動的に生成される。
276 ブール整数値のフラグを取る。
277 .\"O .SS Sockets API
278 .SS ソケット API
279 .\"O The following paragraphs describe domain-specific details and
280 .\"O unsupported features of the sockets API for Unix domain sockets on Linux.
281 この節では、Linux の Unix ドメイン・ソケットでの、
282 ドメイン固有の詳細仕様とソケット API でサポートされていない機能に
283 ついて説明する。
284
285 .\"O Unix domain sockets do not support the transmission of
286 .\"O out-of-band data (the
287 .\"O .B MSG_OOB
288 .\"O flag for
289 .\"O .BR send (2)
290 .\"O and
291 .\"O .BR recv (2)).
292 Unix ドメイン・ソケットでは、帯域外データ (out-of-band data) の
293 送信
294 .RB ( send (2)
295
296 .BR recv (2)
297
298 .B MSG_OOB
299 フラグ) はサポートされていない。
300
301 .\"O The
302 .\"O .BR send (2)
303 .\"O .B MSG_MORE
304 .\"O flag is not supported by Unix domain sockets.
305 .BR send (2)
306 .B MSG_MORE
307 フラグは Unix ドメイン・ソケットではサポートされていない。
308
309 .\"O The use of
310 .\"O .B MSG_TRUNC
311 .\"O in the
312 .\"O .I flags
313 .\"O argument of
314 .\"O .BR recv (2)
315 .\"O is not supported by Unix domain sockets.
316 .BR recv (2)
317
318 .I flags
319 引き数での
320 .B MSG_TRUNC
321 の使用は Unix ドメイン・ソケットではサポートされていない。
322
323 .\"O The
324 .\"O .B SO_SNDBUF
325 .\"O socket option does have an effect for Unix domain sockets, but the
326 .\"O .B SO_RCVBUF
327 .\"O option does not.
328 .\"O For datagram sockets, the
329 .\"O .B SO_SNDBUF
330 .\"O value imposes an upper limit on the size of outgoing datagrams.
331 .\"O This limit is calculated as the doubled (see
332 .\"O .BR socket (7))
333 .\"O option value less 32 bytes used for overhead.
334 .B SO_SNDBUF
335 ソケットオプションは Unix ドメイン・ソケットで効果を持つが、
336 .B SO_RCVBUF
337 は効果がない。
338 データグラム・ソケットでは、
339 .B SO_SNDBUF
340 の値が出力データグラムの上限サイズとなる。
341 実際の上限値は、
342 .B SO_SNDBUF
343 オプションとして設定された値の 2倍
344 .RB ( socket (7)
345 参照) からオーバヘッドとして使用される 32 バイトを引いた値となる。
346 .\"O .SS Ancillary Messages
347 .SS 補助メッセージ
348 .\"O Ancillary data is sent and received using
349 .\"O .BR sendmsg (2)
350 .\"O and
351 .\"O .BR recvmsg (2).
352 補助データを送受するには、
353 .BR sendmsg (2)
354
355 .BR recvmsg (2)
356 を使用する。
357 .\"O For historical reasons the ancillary message types listed below
358 .\"O are specified with a
359 .\"O .B SOL_SOCKET
360 .\"O type even though they are
361 .\"O .B AF_UNIX
362 .\"O specific.
363 歴史的な理由により、以下に示す補助メッセージの型は
364 たとえ
365 .B AF_UNIX
366 固有のものであっても
367 .B SOL_SOCKET
368 型で指定する。
369 .\"O To send them set the
370 .\"O .I cmsg_level
371 .\"O field of the struct
372 .\"O .I cmsghdr
373 .\"O to
374 .\"O .B SOL_SOCKET
375 .\"O and the
376 .\"O .I cmsg_type
377 .\"O field to the type.
378 .\"O For more information see
379 .\"O .BR cmsg (3).
380 これらを送るには、構造体
381 .I cmsghdr
382
383 .I cmsg_level
384 フィールドに
385 .B SOL_SOCKET
386 をセットし、
387 .I cmsg_type
388 フィールドにタイプをセットする。
389 詳細は
390 .BR cmsg (3)
391 を見よ。
392 .TP
393 .B SCM_RIGHTS
394 .\"O Send or receive a set of open file descriptors from another process.
395 .\"O The data portion contains an integer array of the file descriptors.
396 .\"O The passed file descriptors behave as though they have been created with
397 .\"O .BR dup (2).
398 他のプロセスでオープンされたファイルディスクリプタのセットを送受信する。
399 データ部分にファイルディスクリプタの整数配列が入っている。
400 渡されたファイルディスクリプタは、あたかも
401 .BR dup (2)
402 で生成されたかのように振る舞う。
403 .TP
404 .B SCM_CREDENTIALS
405 .\"O Send or receive Unix credentials.
406 .\"O This can be used for authentication.
407 .\"O The credentials are passed as a
408 .\"O .I struct ucred
409 .\"O ancillary message.
410 .\"O Thus structure is defined in
411 .\"O .I <sys/socket.h>
412 .\"O as follows:
413 Unix 信任状を送受信する。これは認証に用いることができる。
414 信任状は、
415 .I struct ucred
416 の補助メッセージとして渡される。
417 この構造体は
418 .I <sys/socket.h>
419 で以下のように定義されている。
420
421 .in +4n
422 .nf
423 struct ucred {
424     pid_t pid;    /* process ID of the sending process */
425     uid_t uid;    /* user ID of the sending process */
426     gid_t gid;    /* group ID of the sending process */
427 };
428 .fi
429 .in
430
431 .\"O Since glibc 2.8, the
432 .\"O .B _GNU_SOURCE
433 .\"O feature test macro must be defined in order to obtain the definition
434 .\"O of this structure.
435 glibc 2.8 以降では、この構造体の定義を得るためには機能検査マクロ
436 .B _GNU_SOURCE
437 を定義しなければならない。
438
439 .\"O The credentials which the sender specifies are checked by the kernel.
440 .\"O A process with effective user ID 0 is allowed to specify values that do
441 .\"O not match its own.
442 送信側が指定した信任状は、カーネルがチェックする。
443 実効ユーザー ID が 0 のプロセスには、
444 自分自身以外の値を指定する事が許される。
445 .\"O The sender must specify its own process ID (unless it has the capability
446 .\"O .BR CAP_SYS_ADMIN ),
447 .\"O its user ID, effective user ID, or saved set-user-ID (unless it has
448 .\"O .BR CAP_SETUID ),
449 .\"O and its group ID, effective group ID, or saved set-group-ID
450 .\"O (unless it has
451 .\"O .BR CAP_SETGID ).
452 送信側は以下の 3 つを指定しなければならない。
453 1) 自分自身のプロセス ID
454 .RB ( CAP_SYS_ADMIN
455 権限を持っていない場合)、
456 2) 自分自身のユーザー ID あるいは実効ユーザー ID か保存 set-user-ID
457 .RB ( CAP_SETUID
458 権限を持っていない場合)、
459 3) 自分自身のグループ ID あるいは実行グループ ID か保存 set-group-ID
460 .RB ( CAP_SETGID
461 を持っていない場合)。
462 .\"O To receive a
463 .\"O .I struct ucred
464 .\"O message the
465 .\"O .B SO_PASSCRED
466 .\"O option must be enabled on the socket.
467 .I struct ucred
468 メッセージを受信するためには、ソケットに対し
469 .B SO_PASSCRED
470 オプションを有効にしなくてはならない。
471 .\"O .SH ERRORS
472 .SH エラー
473 .TP
474 .B EADDRINUSE
475 .\"O Selected local address is already taken or file system socket
476 .\"O object already exists.
477 選択したソケットが既に用いられていた。または、
478 ファイルシステムのソケットオブジェクトが既に存在していた。
479 .TP
480 .B ECONNREFUSED
481 .\"O .BR connect (2)
482 .\"O called with a socket object that isn't listening.
483 .\"O This can happen when
484 .\"O the remote socket does not exist or the filename is not a socket.
485 listen 状態にないソケットオブジェクトに対して
486 .BR connect (2)
487 が呼ばれた。リモートソケットが存在していなかった、
488 ファイル名がソケットではなかった、などのときに起こる。
489 .TP
490 .B ECONNRESET
491 .\"O Remote socket was unexpectedly closed.
492 リモートソケットが予期しないかたちでクローズされた。
493 .TP
494 .B EFAULT
495 .\"O User memory address was not valid.
496 ユーザーメモリアドレスが不正。
497 .TP
498 .B EINVAL
499 .\"O Invalid argument passed.
500 .\"O A common cause is the missing setting of AF_UNIX
501 .\"O in the
502 .\"O .I sun_type
503 .\"O field of passed addresses or the socket being in an
504 .\"O invalid state for the applied operation.
505 渡した引数が不正。よくある原因は、
506 渡したアドレスの
507 .I sun_type
508 フィールドに AF_UNIX を設定しなかった、
509 行おうとした操作に対してソケットの状態が有効ではなかった、など。
510 .TP
511 .B EISCONN
512 .\"O .BR connect (2)
513 .\"O called on an already connected socket or a target address was
514 .\"O specified on a connected socket.
515 既に接続されているソケットに対して
516 .BR connect (2)
517 が呼ばれた。または、指定したターゲットアドレスが
518 既に接続済みのソケットだった。
519 .TP
520 .B ENOMEM
521 .\"O Out of memory.
522 メモリが足りない。
523 .TP
524 .B ENOTCONN
525 .\"O Socket operation needs a target address, but the socket is not connected.
526 ソケット操作にターゲットアドレスが必要だが、
527 このソケットは接続されていない。
528 .TP
529 .B EOPNOTSUPP
530 .\"O Stream operation called on non-stream oriented socket or tried to
531 .\"O use the out-of-band data option.
532 ストリーム指向でないソケットに対してストリーム操作が呼び出された。
533 または帯域外データオプションを用いようとした。
534 .TP
535 .B EPERM
536 .\"O The sender passed invalid credentials in the
537 .\"O .IR "struct ucred" .
538 送信者が
539 .I struct ucred
540 に不正な信任状を渡した。
541 .TP
542 .B EPIPE
543 .\"O Remote socket was closed on a stream socket.
544 .\"O If enabled, a
545 .\"O .B SIGPIPE
546 .\"O is sent as well.
547 .\"O This can be avoided by passing the
548 .\"O .B MSG_NOSIGNAL
549 .\"O flag to
550 .\"O .BR sendmsg (2)
551 .\"O or
552 .\"O .BR recvmsg (2).
553 リモートソケットがストリームソケット上でクローズされた。
554 可能な場合は
555 .B SIGPIPE
556 も同時に送られる。これを避けるには
557 .B MSG_NOSIGNAL
558 フラグを
559 .BR sendmsg (2)
560
561 .BR recvmsg (2)
562 に渡す。
563 .TP
564 .B EPROTONOSUPPORT
565 .\"O Passed protocol is not AF_UNIX.
566 渡されたプロトコルが AF_UNIX でない。
567 .TP
568 .B EPROTOTYPE
569 .\"O Remote socket does not match the local socket type
570 .\"O .RB ( SOCK_DGRAM
571 .\"O vs.
572 .\"O .BR SOCK_STREAM )
573 リモートソケットとローカルソケットのタイプが一致していなかった
574 .RB ( SOCK_DGRAM
575
576 .BR SOCK_STREAM )。
577 .TP
578 .B ESOCKTNOSUPPORT
579 .\"O Unknown socket type.
580 未知のソケットタイプ。
581 .PP
582 .\"O Other errors can be generated by the generic socket layer or
583 .\"O by the file system while generating a file system socket object.
584 .\"O See the appropriate manual pages for more information.
585 他にも汎用のソケット層でエラーが起こったり、
586 ファイルシステム上にソケットオブジェクトを作ろうとした場合に
587 ファイルシステムのエラーが起こることがある。
588 それぞれの詳細は適切な man ページを参照すること。
589 .\"O .SH VERSIONS
590 .SH バージョン
591 .\"O .B SCM_CREDENTIALS
592 .\"O and the abstract namespace were introduced with Linux 2.2 and should not
593 .\"O be used in portable programs.
594 .B SCM_CREDENTIALS
595 と抽象名前空間は、Linux 2.2 で導入された。
596 移植性が必要なプログラムでは使うべきではない。
597 .\"O (Some BSD-derived systems also support credential passing,
598 .\"O but the implementation details differ.)
599 (BSD 由来のシステムの中にも信任状の送受信をサポートしているものがあるが、
600 その実装の詳細はシステムによって異なる)
601 .\"O .SH NOTES
602 .SH 注意
603 .\"O In the Linux implementation, sockets which are visible in the
604 .\"O file system honor the permissions of the directory they are in.
605 .\"O Their owner, group and their permissions can be changed.
606 .\"O Creation of a new socket will fail if the process does not have write and
607 .\"O search (execute) permission on the directory the socket is created in.
608 .\"O Connecting to the socket object requires read/write permission.
609 .\"O This behavior differs from many BSD-derived systems which
610 .\"O ignore permissions for Unix sockets.
611 .\"O Portable programs should not rely on
612 .\"O this feature for security.
613 Linux の実装では、ファイルシステム上から見えるソケットは、
614 それらが置かれているディレクトリのパーミッションに従う。
615 ソケットの所有者、グループ、パーミッションは変更できる。
616 新しいソケットを作るとき、作ろうとするディレクトリに対して
617 プロセスが書き込みと検索 (実行) 権限を持っていなければ、作成に失敗する。
618 ソケットオブジェクトに接続するには、 read/write 権限が必要である。
619 この動作は、多くの BSD 由来のシステムとは異なっている
620 (BSD では Unix ソケットに対してはパーミッションを無視する)。
621 移植性の必要なプログラムでは、
622 セキュリティをこの仕様に依存してはならない。
623
624 .\"O Binding to a socket with a filename creates a socket
625 .\"O in the file system that must be deleted by the caller when it is no
626 .\"O longer needed (using
627 .\"O .BR unlink (2)).
628 ファイル名を指定してソケットにバインドすると、
629 ファイルシステムにソケットが生成される。
630 これは必要なくなったときに呼びだしたユーザーが削除しなければならない
631 .RB ( unlink (2)
632 を用いる)。
633 .\"O The usual Unix close-behind semantics apply; the socket can be unlinked
634 .\"O at any time and will be finally removed from the file system when the last
635 .\"O reference to it is closed.
636 Unix で通常使われる「背後で閉じる方式」が適用される。
637 ソケットはいつでも unlink することができ、最後の参照が
638 クローズされたときにファイルシステムから削除される。
639
640 .\"O To pass file descriptors or credentials over a
641 .\"O .BR SOCK_STREAM ,
642 .\"O you need
643 .\"O to send or receive at least one byte of nonancillary data in the same
644 .\"O .BR sendmsg (2)
645 .\"O or
646 .\"O .BR recvmsg (2)
647 .\"O call.
648 .B SOCK_STREAM
649 上でファイルディスクリプタや信任状を渡すためには、同じ
650 .BR sendmsg (2)
651
652 .BR recvmsg (2)
653 コールで補助データ以外のデータを少なくとも
654 1 バイト送信/受信する必要がある。
655
656 .\"O Unix domain stream sockets do not support the notion of out-of-band data.
657 Unix ドメインのストリーム・ソケットでは、
658 帯域外データの概念はサポートされない。
659 .\"O .SH EXAMPLE
660 .SH 例
661 .\"O See
662 .\"O .BR bind (2).
663 .BR bind (2)
664 参照。
665 .\"O .SH "SEE ALSO"
666 .SH 関連項目
667 .BR recvmsg (2),
668 .BR sendmsg (2),
669 .BR socket (2),
670 .BR socketpair (2),
671 .BR cmsg (3),
672 .BR capabilities (7),
673 .BR credentials (7),
674 .BR socket (7)