OSDN Git Service

(split) LDP: Release pages for LDP v3.39.
[linuxjm/LDP_man-pages.git] / release / man2 / socketpair.2
1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)socketpair.2        6.4 (Berkeley) 3/10/91
33 .\"
34 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
35 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
36 .\" Modified 2002-07-22 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
38 .\" 2008-10-11, mtk: Add description of SOCK_NONBLOCK and SOCK_CLOEXEC
39 .\"
40 .\"*******************************************************************
41 .\"
42 .\" This file was generated with po4a. Translate the source file.
43 .\"
44 .\"*******************************************************************
45 .TH SOCKETPAIR 2 2008\-10\-11 Linux "Linux Programmer's Manual"
46 .SH 名前
47 socketpair \- 接続されたソケットのペアを作成する
48 .SH 書式
49 \fB#include <sys/types.h>\fP /* 「注意」参照 */
50 .br
51 \fB#include <sys/socket.h>\fP
52 .sp
53 \fBint socketpair(int \fP\fIdomain\fP\fB, int \fP\fItype\fP\fB, int \fP\fIprotocol\fP\fB, int
54 \fP\fIsv\fP\fB[2]);\fP
55 .SH 説明
56 \fBsocketpair\fP()  は、指定されたドメイン \fIdomain\fP に指定された種類 \fItype\fP
57 で名前のないソケットの接続されたペアを作成する。 \fIprotocol\fP が指定されると、このプロトコルを用いる。 これらの引き数の詳細は
58 \fBsocket\fP(2)  を参照のこと。
59
60 新しいソケットの参照に使用するディスクリプタ (descriptor) が \fIsv\fP[0] と \fIsv\fP[1] に返される。
61 二つのソケットは全く同じである。
62 .SH 返り値
63 成功した場合にはゼロが返される。エラー時には \-1 が返され、 \fIerrno\fP が適切に設定される。
64 .SH エラー
65 .TP 
66 \fBEAFNOSUPPORT\fP
67 このマシンでは指定されたアドレス・ファミリがサポートされていない。
68 .TP 
69 \fBEFAULT\fP
70 アドレス \fIsv\fP がこのプロセスで使えるアドレス空間を指定していない。
71 .TP 
72 \fBEMFILE\fP
73 このプロセスが使用しているディスクリプタの数が多すぎる。
74 .TP 
75 \fBENFILE\fP
76 オープンされたファイルの総数がシステム全体の上限に達していた。
77 .TP 
78 \fBEOPNOTSUPP\fP
79 指定されたプロトコルではソケットのペアの作成がサポートされていない。
80 .TP 
81 \fBEPROTONOSUPPORT\fP
82 このマシンでは指定されたプロトコルがサポートされていない。
83 .SH 準拠
84 4.4BSD, POSIX.1\-2001.  \fBsocketpair\fP()  関数コールは 4.2BSD で現われた。一般に (System V
85 の変種を含めて)  BSD のソケット層のクローンをサポートしている、BSD 以外のシステムと、 互いに移植性がある。
86 .SH 注意
87 Linux では、この関数でサポートされているドメインは \fBAF_UNIX\fP (または同義語である \fBAF_LOCAL\fP)  だけである。
88 (ほとんどの実装で同じ制限がある)
89
90 Linux 2.6.27 以降では、 \fBsocketpair\fP()  は、フラグ \fBSOCK_NONBLOCK\fP と \fBSOCK_CLOEXEC\fP
91 に対応している。フラグの説明は \fBsocket\fP(2)  を参照のこと。
92
93 POSIX.1\-2001 では \fI<sys/types.h>\fP のインクルードは必須とされておらず、 Linux
94 ではこのヘッダファイルは必要ではない。 しかし、歴史的には、いくつかの実装 (BSD 系) でこのヘッダファイルが
95 必要であり、移植性が必要なアプリケーションではこのファイルを インクルードするのが賢明であろう。
96 .SH 関連項目
97 \fBpipe\fP(2), \fBread\fP(2), \fBsocket\fP(2), \fBwrite\fP(2), \fBsocket\fP(7), \fBunix\fP(7)