OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / draft / 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 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
41 .\"         all rights reserved.
42 .\" Translated 1997-03-03, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
43 .\" Updated 2002-09-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
44 .\" Updated 2005-02-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
45 .\" Updated 2008-11-09, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>, LDP v3.13
46 .\"
47 .\"WORD:        socket                  ¥½¥±¥Ã¥È
48 .\"WORD:        pair                    ¥Ú¥¢
49 .\"WORD:        domain                  ¥É¥á¥¤¥ó
50 .\"WORD:        descriptor              ¥Ç¥£¥¹¥¯¥ê¥×¥¿
51 .\"WORD:        family                  ¥Õ¥¡¥ß¥ê
52 .\"WORD:        implement               ¼ÂÁõ
53 .\"
54 .TH SOCKETPAIR 2 2008-10-11 "Linux" "Linux Programmer's Manual"
55 .\"O .SH NAME
56 .\"O socketpair \- create a pair of connected sockets
57 .SH Ì¾Á°
58 socketpair \- Àܳ¤µ¤ì¤¿¥½¥±¥Ã¥È¤Î¥Ú¥¢¤òºîÀ®¤¹¤ë
59 .\"O .SH SYNOPSIS
60 .SH ½ñ¼°
61 .\"O .BR "#include <sys/types.h>" "          /* See NOTES */"
62 .BR "#include <sys/types.h>" "          /* ¡ÖÃí°Õ¡×»²¾È */"
63 .br
64 .B #include <sys/socket.h>
65 .sp
66 .BI "int socketpair(int " domain ", int " type ", int " protocol \
67 ", int " sv [2]);
68 .\"O .SH DESCRIPTION
69 .SH ÀâÌÀ
70 .\"O The
71 .\"O .BR socketpair ()
72 .\"O call creates an unnamed pair of connected sockets in the specified
73 .\"O .IR domain ,
74 .\"O of the specified
75 .\"O .IR type ,
76 .\"O and using the optionally specified
77 .\"O .IR protocol .
78 .BR socketpair ()
79 ¤Ï¡¢»ØÄꤵ¤ì¤¿¥É¥á¥¤¥ó
80 .I domain
81 ¤Ë»ØÄꤵ¤ì¤¿¼ïÎà
82 .I type
83 ¤Ç̾Á°¤Î¤Ê¤¤¥½¥±¥Ã¥È¤ÎÀܳ¤µ¤ì¤¿¥Ú¥¢¤òºîÀ®¤¹¤ë¡£
84 .I protocol
85 ¤¬»ØÄꤵ¤ì¤ë¤È¡¢¤³¤Î¥×¥í¥È¥³¥ë¤òÍѤ¤¤ë¡£
86 .\"O For further details of these arguments, see
87 .\"O .BR socket (2).
88 ¤³¤ì¤é¤Î°ú¤­¿ô¤Î¾ÜºÙ¤Ï
89 .BR socket (2)
90 ¤ò»²¾È¤Î¤³¤È¡£
91
92 .\"O The descriptors used in referencing the new sockets are returned in
93 .\"O .IR sv [0]
94 .\"O and
95 .\"O .IR sv [1].
96 ¿·¤·¤¤¥½¥±¥Ã¥È¤Î»²¾È¤Ë»ÈÍѤ¹¤ë¥Ç¥£¥¹¥¯¥ê¥×¥¿ (descriptor) ¤¬
97 .IR sv [0]
98 ¤È
99 .IR sv [1]
100 ¤ËÊÖ¤µ¤ì¤ë¡£
101 .\"O The two sockets are indistinguishable.
102 Æó¤Ä¤Î¥½¥±¥Ã¥È¤ÏÁ´¤¯Æ±¤¸¤Ç¤¢¤ë¡£
103 .\"O .SH "RETURN VALUE"
104 .SH ÊÖ¤êÃÍ
105 .\"O On success, zero is returned.
106 .\"O On error, \-1 is returned, and
107 .\"O .I errno
108 .\"O is set appropriately.
109 À®¸ù¤·¤¿¾ì¹ç¤Ï¥¼¥í¤òÊÖ¤¹¡¢¥¨¥é¡¼¤Î¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
110 .I errno
111 ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
112 .\"O .SH ERRORS
113 .SH ¥¨¥é¡¼
114 .TP
115 .B EAFNOSUPPORT
116 .\"O The specified address family is not supported on this machine.
117 ¤³¤Î¥Þ¥·¥ó¤Ç¤Ï»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¡¦¥Õ¥¡¥ß¥ê¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
118 .TP
119 .B EFAULT
120 .\"O The address
121 .\"O .I sv
122 .\"O does not specify a valid part of the process address space.
123 ¥¢¥É¥ì¥¹
124 .I sv
125 ¤¬¤³¤Î¥×¥í¥»¥¹¤Ç»È¤¨¤ë¥¢¥É¥ì¥¹¶õ´Ö¤ò»ØÄꤷ¤Æ¤¤¤Ê¤¤¡£
126 .TP
127 .B EMFILE
128 .\"O Too many descriptors are in use by this process.
129 ¤³¤Î¥×¥í¥»¥¹¤¬»ÈÍѤ·¤Æ¤¤¤ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Î¿ô¤¬Â¿¤¹¤®¤ë¡£
130 .TP
131 .B ENFILE
132 .\"O The system limit on the total number of open files has been reached.
133 ¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ÎÁí¿ô¤¬¥·¥¹¥Æ¥àÁ´ÂΤξå¸Â¤Ë㤷¤¿¡£
134 .TP
135 .B EOPNOTSUPP
136 .\"O The specified protocol does not support creation of socket pairs.
137 »ØÄꤵ¤ì¤¿¥×¥í¥È¥³¥ë¤Ç¤Ï¥½¥±¥Ã¥È¤Î¥Ú¥¢¤ÎºîÀ®¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
138 .TP
139 .B EPROTONOSUPPORT
140 .\"O The specified protocol is not supported on this machine.
141 ¤³¤Î¥Þ¥·¥ó¤Ç¤Ï»ØÄꤵ¤ì¤¿¥×¥í¥È¥³¥ë¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
142 .\"O .SH "CONFORMING TO"
143 .SH ½àµò
144 .\"O 4.4BSD, POSIX.1-2001.
145 .\"O The
146 .\"O .BR socketpair ()
147 .\"O function call appeared in 4.2BSD.
148 .\"O It is generally portable to/from
149 .\"O non-BSD systems supporting clones of the BSD socket layer (including
150 .\"O System V variants).
151 4.4BSD, POSIX.1-2001.
152 .BR socketpair ()
153 ´Ø¿ô¥³¡¼¥ë¤Ï 4.2BSD ¤Ç¸½¤ï¤ì¤¿¡£°ìÈ̤ˠ(System V ¤ÎÊѼï¤ò´Þ¤á¤Æ)
154 BSD ¤Î¥½¥±¥Ã¥ÈÁؤΥ¯¥í¡¼¥ó¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¡¢BSD °Ê³°¤Î¥·¥¹¥Æ¥à¤È¡¢
155 ¸ß¤¤¤Ë°Ü¿¢À­¤¬¤¢¤ë¡£
156 .\"O .SH NOTES
157 .SH Ãí°Õ
158 .\"O On Linux, the only supported domain for this call is
159 .\"O .B AF_UNIX
160 .\"O (or synonymously,
161 .\"O .BR AF_LOCAL ).
162 .\"O (Most implementations have the same restriction.)
163 Linux ¤Ç¤Ï¡¢¤³¤Î´Ø¿ô¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥É¥á¥¤¥ó¤Ï
164 .B AF_UNIX
165 (¤Þ¤¿¤ÏƱµÁ¸ì¤Ç¤¢¤ë
166 .BR AF_LOCAL )
167 ¤À¤±¤Ç¤¢¤ë¡£
168 (¤Û¤È¤ó¤É¤Î¼ÂÁõ¤ÇƱ¤¸À©¸Â¤¬¤¢¤ë)
169
170 .\"O Since Linux 2.6.27,
171 .\"O .BR socketpair ()
172 .\"O supports the
173 .\"O .BR SOCK_NONBLOCK
174 .\"O and
175 .\"O .BR SOCK_CLOEXEC
176 .\"O flags described in
177 .\"O .BR socket (2).
178 Linux 2.6.27 °Ê¹ß¤Ç¤Ï¡¢
179 .BR socketpair ()
180 ¤Ï¡¢¥Õ¥é¥°
181 .B SOCK_NONBLOCK
182 ¤È
183 .B SOCK_CLOEXEC
184 ¤ËÂбþ¤·¤Æ¤¤¤ë¡£¥Õ¥é¥°¤ÎÀâÌÀ¤Ï
185 .BR socket (2)
186 ¤ò»²¾È¤Î¤³¤È¡£
187
188 .\"O POSIX.1-2001 does not require the inclusion of
189 .\"O .IR <sys/types.h> ,
190 .\"O and this header file is not required on Linux.
191 .\"O However, some historical (BSD) implementations required this header
192 .\"O file, and portable applications are probably wise to include it.
193 POSIX.1-2001 ¤Ç¤Ï
194 .I <sys/types.h>
195 ¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ïɬ¿Ü¤È¤µ¤ì¤Æ¤ª¤é¤º¡¢
196 Linux ¤Ç¤Ï¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ÏɬÍפǤϤʤ¤¡£
197 ¤·¤«¤·¡¢Îò»ËŪ¤Ë¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¼ÂÁõ (BSD ·Ï) ¤Ç¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬
198 ɬÍפǤ¢¤ê¡¢°Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤ò
199 ¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤¬¸­ÌÀ¤Ç¤¢¤í¤¦¡£
200 .\"O .SH "SEE ALSO"
201 .SH ´ØÏ¢¹àÌÜ
202 .BR pipe (2),
203 .BR read (2),
204 .BR socket (2),
205 .BR write (2),
206 .BR socket (7),
207 .BR unix (7)