OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / LDP_man-pages / draft / man2 / accept.2
1 .\" Copyright (c) 1983, 1990, 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 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
33 .\" Modified 1996-10-21 by Eric S. Raymond <esr@thyrsus.com>
34 .\" Modified 1998-2000 by Andi Kleen to match Linux 2.2 reality
35 .\" Modified 2002-04-23 by Roger Luethi <rl@hellgate.ch>
36 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
37 .\" 2008-12-04, mtk, Add documentation of accept4()
38 .\"
39 .\" Japanese Version Copyright (c) 1998-2000 Shinya HANATAKA,
40 .\"   Takeshi Hakamada and NAKANO Takeo
41 .\"         all rights reserved.
42 .\" Translated 1998-04-06, Shinya HANATAKA <shinya@abyss.rim.or.jp>
43 .\"                        Takeshi Hakamada <hakamada@nsg.sgi.com>
44 .\" Updated & Modified 2000-10-12, NAKANO Takeo <nakano@apm.seikei.ac.jp
45 .\" Updated & Modified 2002-09-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
46 .\" Updated & Modified 2005-02-23, Akihiro MOTOKI
47 .\" Updated & Modified 2006-04-14, Akihiro MOTOKI, LDP v2.29
48 .\" Updated & Modified 2008-12-24, Akihiro MOTOKI, LDP v3.15
49 .\" Updated 2008-04-13, Akihiro MOTOKI, LDP v3.20
50 .\"
51 .\"WORD:        pending                 ÊÝαÃæ¤Î
52 .\"WORD:        queue                   ¥­¥å¡¼
53 .\"WORD:        file descriptor         ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿
54 .\"WORD:        nonblocking             ÈóÄä»ß
55 .\"WORD:        async                   ÈóƱ´ü
56 .\"WORD:        communication layer     ÄÌ¿®ÁØ
57 .\"WORD:        value-result argument   Æþ½ÐÎÏξÍѤΰú¤­¿ô
58 .\"WORD:        confirmation            Àܳ³Îǧ
59 .\"WORD:        dequeue                 ¥­¥å¡¼¤«¤é¼è¤ê½Ð¤¹
60 .\"WORD:        rejection               ÀܳµñÈÝ
61 .\"
62 .TH ACCEPT 2 2009-02-23 "Linux" "Linux Programmer's Manual"
63 .\"O .SH NAME
64 .\"O accept \- accept a connection on a socket
65 .SH Ì¾Á°
66 accept \- ¥½¥±¥Ã¥È¤Ø¤ÎÀܳ¤ò¼õ¤±¤ë
67 .\"O .SH SYNOPSIS
68 .SH ½ñ¼°
69 .nf
70 .\"O .BR "#include <sys/types.h>" "          /* See NOTES */"
71 .BR "#include <sys/types.h>" "          /* ¡ÖÃí°Õ¡×»²¾È */"
72 .B #include <sys/socket.h>
73
74 .BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
75
76 .B #define _GNU_SOURCE
77 .B #include <sys/socket.h>
78
79 .BI "int accept4(int " sockfd ", struct sockaddr *" addr ,
80 .BI "            socklen_t *" addrlen ", int " flags );
81 .fi
82 .\"O .SH DESCRIPTION
83 .SH ÀâÌÀ
84 .\"O The
85 .\"O .BR accept ()
86 .\"O system call is used with connection-based socket types
87 .\"O .RB ( SOCK_STREAM ,
88 .\"O .BR SOCK_SEQPACKET ).
89 .BR accept ()
90 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï¡¢Àܳ»Ø¸þ¤Î¥½¥±¥Ã¥È·¿
91 .RB ( SOCK_STREAM ", " SOCK_SEQPACKET )
92 ¤ÇÍѤ¤¤é¤ì¤ë¡£
93 .\"O It extracts the first connection request on the queue of pending
94 .\"O connections for the listening socket,
95 .\"O .IR sockfd ,
96 .\"O creates a new connected socket, and returns a new file
97 .\"O descriptor referring to that socket.
98 ¤³¤Î´Ø¿ô¤Ï¡¢ÀܳÂÔ¤Á¥½¥±¥Ã¥È
99 .I socket
100 °¸¤Æ¤ÎÊÝα¾õÂÖ¤ÎÀܳÍ׵᤬Æþ¤Ã¤Æ¤¤¤ë¥­¥å¡¼¤«¤é
101 ÀèƬ¤ÎÀܳÍ×µá¤ò¼è¤ê½Ð¤·¡¢ÀܳºÑ¤ß¥½¥±¥Ã¥È¤ò¿·µ¬¤ËÀ¸À®¤·¡¢
102 ¤½¤Î¥½¥±¥Ã¥È¤ò»²¾È¤¹¤ë¿·¤·¤¤¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤òÊÖ¤¹¡£
103 .\"O The newly created socket is not in the listening state.
104 ¿·µ¬¤ËÀ¸À®¤µ¤ì¤¿¥½¥±¥Ã¥È¤Ï¡¢ÀܳÂÔ¤Á (listen) ¾õÂ֤ǤϤʤ¤¡£
105 .\"O The original socket
106 .\"O .I sockfd
107 .\"O is unaffected by this call.
108 ¤â¤È¤â¤È¤Î¥½¥±¥Ã¥È
109 .I sockfd
110 ¤Ï¤³¤Î¸Æ¤Ó½Ð¤·¤Ë¤è¤Ã¤Æ±Æ¶Á¤ò¼õ¤±¤Ê¤¤¡£
111 .PP
112 .\"O The argument
113 .\"O .I sockfd
114 .\"O is a socket that has been created with
115 .\"O .BR socket (2),
116 .\"O bound to a local address with
117 .\"O .BR bind (2),
118 .\"O and is listening for connections after a
119 .\"O .BR listen (2).
120 °ú¤­¿ô
121 .I sockfd
122 ¤Ï¡¢
123 .BR socket (2)
124 ¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¡¢
125 .BR bind (2)
126 ¤Ë¤è¤Ã¤Æ¥í¡¼¥«¥ë¥¢¥É¥ì¥¹¤Ë¥Ð¥¤¥ó¥É¤µ¤ì¡¢
127 .BR listen (2)
128 ¤ò·Ð¤ÆÀܳ¤òÂԤäƤ¤¤ë¥½¥±¥Ã¥È¤Ç¤¢¤ë¡£
129
130 .\"O The argument
131 .\"O .I addr
132 .\"O is a pointer to a
133 .\"O .I sockaddr
134 .\"O structure.
135 .\"O This structure is filled in with the address of the peer socket,
136 .\"O as known to the communications layer.
137 .\"O The exact format of the address returned
138 .\"O .I addr
139 .\"O is determined by the socket's address family (see
140 .\"O .BR socket (2)
141 .\"O and the respective protocol man pages).
142 .I addr
143 °ú¤­¿ô¤Ï
144 .I sockaddr
145 ¹½Â¤ÂΤؤΥݥ¤¥ó¥¿¤Ç¤¢¤ë¡£
146 ¤³¤Î¹½Â¤ÂΤˤÏÀܳÁê¼ê¤Î¥½¥±¥Ã¥È¤Î¥¢¥É¥ì¥¹¤¬Æþ¤Ã¤Æ¤¤¤ë¡£
147 .I addr
148 °ú¤­¿ô¤ÇÊÖ¤µ¤ì¤ë¥¢¥É¥ì¥¹¤ÎÀµ³Î¤Ê¥Õ¥©¡¼¥Þ¥Ã¥È¤Ï¡¢
149 ¥½¥±¥Ã¥È¤Î¥¢¥É¥ì¥¹¼ïÊ̤ˤè¤Ã¤ÆÊѤï¤ë
150 .RB ( socket (2)
151 ¤ª¤è¤Ó¤½¤ì¤¾¤ì¤Î¥×¥í¥È¥³¥ë¤Î man ¥Ú¡¼¥¸¤ò»²¾È)¡£
152 .\"O When
153 .\"O .I addr
154 .\"O is NULL, nothing is filled in; in this case,
155 .\"O .I addrlen
156 .\"O is not used, and should also be NULL.
157 .I addr
158 ¤¬ NULL ¤Î¾ì¹ç¡¢
159 .I addr
160 ¤Ë¤Ï²¿¤âÆþ¤é¤Ê¤¤¡£¤³¤Î¾ì¹ç¡¢
161 .I addrlen
162 ¤Ï»ÈÍѤµ¤ì¤º¡¢¤³¤Î°ú¤­¿ô¤Ï NULL ¤Ë¤·¤Æ¤ª¤¯¤Ù¤­¤Ç¤¢¤ë¡£
163
164 .\"O The
165 .\"O .I addrlen
166 .\"O argument is a value-result argument:
167 .\"O the caller must initialize it to contain the
168 .\"O size (in bytes) of the structure pointed to by
169 .\"O .IR addr ;
170 .\"O on return it will contain the actual size of the peer address.
171 .I addrlen
172 °ú¤­¿ô¤ÏÆþ½ÐÎÏξÍѤΰú¤­¿ô¤Ç¤¢¤ë¡£¸Æ¤Ó½Ð¤·»þ¤Ë¤Ï¡¢¸Æ¤Ó½Ð¤·¸µ¤¬
173 .I addr
174 ¤¬»Ø¤¹¹½Â¤ÂΤΥµ¥¤¥º (¥Ð¥¤¥Èñ°Ì) ¤Ç½é´ü²½¤·¤Æ¤ª¤«¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
175 Ê֤äƤ¯¤ë»þ¤Ë¤Ï¡¢ÀܳÁê¼ê¤Î¥¢¥É¥ì¥¹¤Î¼ÂºÝ¤ÎÂ礭¤µ¤¬³ÊǼ¤µ¤ì¤ë¡£
176
177 .\"O The returned address is truncated if the buffer provided is too small;
178 .\"O in this case,
179 .\"O .I addrlen
180 .\"O will return a value greater than was supplied to the call.
181 ÅϤµ¤ì¤¿¥Ð¥Ã¥Õ¥¡¤¬¾®¤µ²á¤®¤ë¾ì¹ç¤Ë¤Ï¡¢ÊÖ¤µ¤ì¤ë¥¢¥É¥ì¥¹¤ÎËöÈø¤Ï
182 ÀÚ¤êµÍ¤á¤é¤ì¤ë¡£¤³¤Î¾ì¹ç¤Ë¤Ï¡¢
183 .I addrlen
184 ¤Ç¤Ï¡¢¸Æ¤Ó½Ð¤·»þ¤ËÅϤµ¤ì¤¿Ãͤè¤ê¤âÂ礭¤ÊÃͤ¬ÊÖ¤µ¤ì¤ë¡£
185 .PP
186 .\"O If no pending
187 .\"O connections are present on the queue, and the socket is not marked as
188 .\"O nonblocking,
189 .\"O .BR accept ()
190 .\"O blocks the caller until a connection is present.
191 .\"O If the socket is marked
192 .\"O nonblocking and no pending connections are present on the queue,
193 .\"O .BR accept ()
194 .\"O fails with the error
195 .\"O .BR EAGAIN
196 .\"O or
197 .\"O .BR EWOULDBLOCK .
198 ¥­¥å¡¼¤ËÊÝα¤È¤Ê¤Ã¤Æ¤¤¤ëÀܳÍ׵᤬¤Ê¤¯¡¢
199 ¤«¤Ä¥½¥±¥Ã¥È¤¬ÈóÄä»ß¤Ë¤Ê¤Ã¤Æ¤¤¤Ê¤¤¤È¤­¤Ï¡¢
200 .BR accept ()
201 ¤ÏÀܳ¤¬È¯À¸¤¹¤ë¤Þ¤Ç¸Æ¤Ó½Ð¤·¸µ¤òÄä»ß (block) ¤¹¤ë¡£
202 ¥½¥±¥Ã¥È¤¬ÈóÄä»ß¤Ë¤Ê¤Ã¤Æ¤¤¤Æ¡¢
203 ÂÔ¤Á¾õÂÖ¤ÎÀܳÍ׵᤬¥­¥å¡¼¤Ë̵¤¤¤È¤­¤Ï¡¢
204 .BR accept ()
205 ¤Ï¥¨¥é¡¼
206 .B EAGAIN
207 ¤«
208 .B EWOULDBLOCK
209 ¤Ç¼ºÇÔ¤¹¤ë¡£
210 .PP
211 .\"O In order to be notified of incoming connections on a socket, you can use
212 .\"O .BR select (2)
213 .\"O or
214 .\"O .BR poll (2).
215 .\"O A readable event will be delivered when a new connection is attempted and you
216 .\"O may then call
217 .\"O .BR accept ()
218 .\"O to get a socket for that connection.
219 .\"O Alternatively, you can set the socket to deliver
220 .\"O .B SIGIO
221 .\"O when activity occurs on a socket; see
222 .\"O .BR socket (7)
223 .\"O for details.
224 ¥½¥±¥Ã¥È¤Ø¤ÎÀܳÅþÃå¤òÃΤë¤Ë¤Ï¡¢
225 .BR select (2)
226 ¤Þ¤¿¤Ï
227 .BR poll (2)
228 ¤òÍѤ¤¤ì¤Ð¤è¤¤¡£
229 ¿·¤·¤¤ÀܳÍ׵᤬Íè¤ë¤È¥½¥±¥Ã¥È¤ÏÆɤ߹þ¤ß²Äǽ¤Ë¤Ê¤ë¤Î¤Ç¡¢
230 ¤½¤¦¤·¤¿¤é
231 .BR accept ()
232 ¤ò¸Æ¤ó¤Ç¤½¤ÎÀܳ¤ËÂФ¹¤ë¥½¥±¥Ã¥È¤ò¼èÆÀ¤¹¤ì¤Ð¤è¤¤¡£
233 ¤¢¤ë¤¤¤Ï¥½¥±¥Ã¥È¤ËÀßÄê¤ò¹Ô¤¤¡¢²¿¤é¤«¤Î¥¢¥¯¥·¥ç¥ó¤¬¤¢¤Ã¤¿¤È¤­¤Ë
234 .B SIGIO
235 ¤òÇÛÁ÷ (deliver) ¤µ¤»¤ë¤è¤¦¤Ë¤¹¤ë¤³¤È¤â¤Ç¤­¤ë¡£¾ÜºÙ¤Ï
236 .BR socket (7)
237 ¤ò»²¾È¤Î¤³¤È¡£
238 .PP
239 .\"O For certain protocols which require an explicit confirmation,
240 .\"O such as
241 .\"O DECNet,
242 .\"O .BR accept ()
243 .\"O can be thought of as merely dequeuing the next connection request and not
244 .\"O implying confirmation.
245 .\"O Confirmation can be implied by
246 .\"O a normal read or write on the new file descriptor, and rejection can be
247 .\"O implied by closing the new socket.
248 .\"O Currently only
249 .\"O DECNet
250 .\"O has these semantics on Linux.
251 ÌÀ¼¨Åª¤ÊÀܳ³Îǧ (confirmation) ¤òɬÍפȤ¹¤ë¤è¤¦¤Ê¥×¥í¥È¥³¥ë
252 (DECNet ¤Ê¤É) ¤Ç¤Ï¡¢
253 .BR accept ()
254 ¤Ïñ¤Ë¼¡¤ÎÀܳÍ×µá¤ò¥­¥å¡¼¤«¤é¼è¤ê½Ð¤¹¤À¤±¤Ç¤¢¤ê¡¢
255 Àܳ³Îǧ¤Ï¹Ô¤ï¤Ê¤¤¤³¤È¤ËÃí°Õ¤»¤è¡£Àܳ³Îǧ¤Ï¡¢
256 ¿·¤·¤¤¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ¹¤ë
257 Ä̾ï¤ÎÆɤ߼è¤ê/½ñ¤­¹þ¤ß¤Ë¤è¤Ã¤Æ¤Ê¤µ¤ì¡¢ÀܳµñÈÝ (rejection)
258 ¤Ï¿·¤·¤¤¥½¥±¥Ã¥È¤ò¥¯¥í¡¼¥º¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¤Ê¤µ¤ì¤ë¡£
259 ¸½ºß¤Î¤È¤³¤í¡¢
260 Linux ¾å¤Ç¤³¤ì¤é¤Î¥»¥Þ¥ó¥Æ¥£¥¯¥¹¤ò»ý¤Ä¤Î¤Ï DECNet ¤À¤±¤Ç¤¢¤ë¡£
261
262 .\"O If
263 .\"O .IR flags
264 .\"O is 0, then
265 .\"O .BR accept4 ()
266 .\"O is the same as
267 .\"O .BR accept ().
268 .\"O The following values can be bitwise ORed in
269 .\"O .IR flags
270 .\"O to obtain different behavior:
271 .I flags
272 ¤¬ 0 ¤Î¾ì¹ç¡¢
273 .BR accept4 ()
274 ¤Ï
275 .BR accept ()
276 ¤ÈƱ¤¸¤Ç¤¢¤ë¡£
277 .I flags
278 ¤Ë°Ê²¼¤ÎÃͤò¥Ó¥Ã¥ÈËè¤ÎÏÀÍýÏ (OR) ¤Ç»ØÄꤹ¤ë¤³¤È¤Ç¡¢
279 °Û¤Ê¤ëÆ°ºî¤ò¤µ¤»¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
280 .TP 16
281 .B SOCK_NONBLOCK
282 .\"O Set the
283 .\"O .BR O_NONBLOCK
284 .\"O file status flag on the new open file description.
285 .\"O Using this flag saves extra calls to
286 .\"O .BR fcntl (2)
287 .\"O to achieve the same result.
288 ¿·¤·¤¯À¸À®¤µ¤ì¤ë¥ª¡¼¥×¥ó¥Õ¥¡¥¤¥ëµ­½Ò (open file description) ¤Î
289 .B O_NONBLOCK
290 ¥Õ¥¡¥¤¥ë¥¹¥Æ¡¼¥¿¥¹¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¡£
291 ¤³¤Î¥Õ¥é¥°¤ò»È¤¦¤³¤È¤Ç¡¢
292 .B O_NONBLOCK
293 ¤ò¥»¥Ã¥È¤¹¤ë¤¿¤á¤Ë
294 .BR fcntl (2)
295 ¤òÄɲäǸƤӽФ¹É¬Íפ¬¤Ê¤¯¤Ê¤ë¡£
296 .TP
297 .B SOCK_CLOEXEC
298 .\"O Set the close-on-exec
299 .\"O .RB ( FD_CLOEXEC )
300 .\"O flag on the new file descriptor.
301 .\"O See the description of the
302 .\"O .B O_CLOEXEC
303 .\"O flag in
304 .\"O .BR open (2)
305 .\"O for reasons why this may be useful.
306 ¿·¤·¤¤¥Õ¥¡¥¤¥ë¥Ç¥£¥¹¥¯¥ê¥×¥¿¤ËÂФ·¤Æ
307 close-on-exec
308 .RB ( FD_CLOEXEC )
309 ¥Õ¥é¥°¤ò¥»¥Ã¥È¤¹¤ë¡£
310 ¤³¤Î¥Õ¥é¥°¤¬Ìò¤ËΩ¤ÄÍýͳ¤Ë¤Ä¤¤¤Æ¤Ï¡¢
311 .BR open (2)
312 ¤Î
313 .B O_CLOEXEC
314 ¥Õ¥é¥°¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£
315 .\"O .SH "RETURN VALUE"
316 .SH ÊÖ¤êÃÍ
317 .\"O On success,
318 .\"O these system calls return a nonnegative integer that is a descriptor
319 .\"O for the accepted socket.
320 .\"O On error, \-1 is returned, and
321 .\"O .I errno
322 .\"O is set appropriately.
323 À®¸ù¤·¤¿¾ì¹ç¡¢¤³¤ì¤é¤Î¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï
324 ¼õ¤±ÉÕ¤±¤¿¥½¥±¥Ã¥È¤Î¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤¢¤ëÈóÉé¤ÎÀ°¿ôÃͤòÊÖ¤¹¡£
325 ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï \-1 ¤òÊÖ¤·¡¢
326 .I errno
327 ¤òŬÀÚ¤ËÀßÄꤹ¤ë¡£
328 .\"O .SS "Error Handling"
329 .SS ¥¨¥é¡¼½èÍý
330 .\"O Linux
331 .\"O .BR accept ()
332 .\"O (and
333 .\"O .BR accept4 ())
334 .\"O passes already-pending network errors on the new socket
335 .\"O as an error code from
336 .\"O .BR accept ().
337 Linux ¤Î
338 .BR accept ()
339 (¤È
340 .BR accept4 ())
341 ¤Ï¡¢¿·¤·¤¤¥½¥±¥Ã¥È¤Ë¤ª¤±¤ë¡¢È¯À¸ºÑ¤ß¤Î¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤ò
342 .BR accept ()
343 ¤«¤é¤Î¥¨¥é¡¼¥³¡¼¥É¤È¤·¤ÆÅϤ¹¡£
344 .\"O This behavior differs from other BSD socket
345 .\"O implementations.
346 .\"O For reliable operation the application should detect
347 .\"O the network errors defined for the protocol after
348 .\"O .BR accept ()
349 .\"O and treat
350 .\"O them like
351 .\"O .B EAGAIN
352 .\"O by retrying.
353 .\"O In case of TCP/IP these are
354 ¤³¤Î¿¶Éñ¤¤¤Ï BSD ¥½¥±¥Ã¥È¤Î¼ÂÁõ¤È¤Ï°Û¤Ê¤ë¡£
355 ¿®ÍêÀ­¤Î¹â¤¤Æ°ºî¤ò¹Ô¤¦¤¿¤á¤Ë¤Ï¡¢
356 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¥×¥í¥È¥³¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤Î¸¡ÃΤò
357 .BR accept ()
358 ¤Î¤¢¤È¤Ë¹Ô¤¤¡¢¤½¤ì¤é¤Î¥¨¥é¡¼¤ò
359 .B EAGAIN
360 ¤ÈƱ¤¸¤è¤¦¤Ë°·¤¤¡¢ºÆ»î¹Ô (retry) ¤ò¹Ô¤¦¤Ù¤­¤Ç¤¢¤ë¡£
361 .\"O .BR ENETDOWN ,
362 .\"O .BR EPROTO ,
363 .\"O .BR ENOPROTOOPT ,
364 .\"O .BR EHOSTDOWN ,
365 .\"O .BR ENONET ,
366 .\"O .BR EHOSTUNREACH ,
367 .\"O .BR EOPNOTSUPP ,
368 .\"O and
369 .\"O .BR ENETUNREACH .
370 TCP/IP ¤Ç¤Ï¡¢°Ê²¼¤Î¥¨¥é¡¼¤¬³ºÅö¤¹¤ë:
371 .BR ENETDOWN ,
372 .BR EPROTO ,
373 .BR ENOPROTOOPT ,
374 .BR EHOSTDOWN ,
375 .BR ENONET ,
376 .BR EHOSTUNREACH ,
377 .BR EOPNOTSUPP ,
378 .B ENETUNREACH
379 .\"O .SH ERRORS
380 .SH ¥¨¥é¡¼
381 .TP
382 .\"O .BR EAGAIN " or " EWOULDBLOCK
383 .BR EAGAIN " ¤Þ¤¿¤Ï " EWOULDBLOCK
384 .\" Actually EAGAIN on Linux
385 .\"O The socket is marked nonblocking and no connections are
386 .\"O present to be accepted.
387 .\"O POSIX.1-2001 allows either error to be returned for this case,
388 .\"O and does not require these constants to have the same value,
389 .\"O so a portable application should check for both possibilities.
390 ¥½¥±¥Ã¥È¤¬ÈóÄä»ß¤Ë¤Ê¤Ã¤Æ¤¤¤Æ¡¢
391 ¤«¤Ä¼õÉÕ¤±ÂоݤÎÀܳ¤¬Â¸ºß¤·¤Ê¤¤¡£
392 POSIX.1-2001 ¤Ï¡¢¤³¤Î¾ì¹ç¤Ë¤É¤Á¤é¤Î¥¨¥é¡¼¤òÊÖ¤¹¤³¤È¤âǧ¤á¤Æ¤ª¤ê¡¢
393 ¤³¤ì¤é 2 ¤Ä¤ÎÄê¿ô¤¬Æ±¤¸Ãͤò»ý¤Ä¤³¤È¤âµá¤á¤Æ¤¤¤Ê¤¤¡£
394 ¤·¤¿¤¬¤Ã¤Æ¡¢°Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¡¢Î¾Êý¤Î²ÄǽÀ­¤ò
395 ³Îǧ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
396 .TP
397 .B EBADF
398 .\"O The descriptor is invalid.
399 ¥Ç¥£¥¹¥¯¥ê¥×¥¿¤¬ÉÔÀµ¡£
400 .TP
401 .B ECONNABORTED
402 .\"O A connection has been aborted.
403 Àܳ¤¬Ãæ»ß¤µ¤ì¤¿¡£
404 .TP
405 .B EFAULT
406 .\"O The
407 .\"O .I addr
408 .\"O argument is not in a writable part of the user address space.
409 .I addr
410 °ú¤­¿ô¤¬¥æ¡¼¥¶¥¢¥É¥ì¥¹¶õ´Ö¤Î½ñ¤­¹þ¤ß²ÄǽÎΰè¤Ë¤Ê¤¤¡£
411 .TP
412 .B EINTR
413 .\"O The system call was interrupted by a signal that was caught
414 .\"O before a valid connection arrived; see
415 .\"O .BR signal (7).
416 Í­¸ú¤ÊÀܳ¤¬ÅþÃ夹¤ëÁ°¤ËÊ᪤µ¤ì¤¿¥·¥°¥Ê¥ë¤Ë¤è¤Ã¤Æ
417 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤¬ÃæÃǤµ¤ì¤¿¡£
418 .BR signal (7)
419 »²¾È¡£
420 .TP
421 .B EINVAL
422 .\"O Socket is not listening for connections, or
423 .\"O .I addrlen
424 .\"O is invalid (e.g., is negative).
425 ¥½¥±¥Ã¥È¤¬ÀܳÂÔ¤Á¾õÂ֤ǤϤʤ¤¡£¤â¤·¤¯¤Ï¡¢
426 .I addrlen
427 ¤¬ÉÔÀµ¤Ç¤¢¤ë (Î㤨¤Ð¡¢Éé¤Î¾ì¹ç¤Ê¤É)¡£
428 .TP
429 .B EINVAL
430 .\"O .RB ( accept4 ())
431 .\"O invalid value in
432 .\"O .IR flags .
433 .RB ( accept4 ())
434 .I flags
435 ¤ËÉÔÀµ¤ÊÃͤ¬»ØÄꤵ¤ì¤Æ¤¤¤ë¡£
436 .TP
437 .B EMFILE
438 .\"O The per-process limit of open file descriptors has been reached.
439 1¥×¥í¥»¥¹¤¬¥ª¡¼¥×¥ó¤Ç¤­¤ë¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¿ô¤Î¾å¸Â¤Ë㤷¤¿¡£
440 .TP
441 .B ENFILE
442 .\"O The system limit on the total number of open files has been reached.
443 ¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¤ÎÁí¿ô¤¬¥·¥¹¥Æ¥àÁ´ÂΤξå¸Â¤Ë㤷¤¿¡£
444 .TP
445 .BR ENOBUFS ", " ENOMEM
446 .\"O Not enough free memory.
447 .\"O This often means that the memory allocation is limited by the socket buffer
448 .\"O limits, not by the system memory.
449 ¥á¥â¥ê¤¬Â­¤ê¤Ê¤¤¡£
450 ¿¤¯¤Î¾ì¹ç¤Ï¡¢¥·¥¹¥Æ¥à¥á¥â¥ê¤¬Â­¤ê¤Ê¤¤¤ï¤±¤Ç¤Ï¤Ê¤¯¡¢
451 ¥½¥±¥Ã¥È¥Ð¥Ã¥Õ¥¡¤ÎÂ礭¤µ¤Ë¤è¤ë¥á¥â¥ê³ä¤êÅö¤Æ¤ÎÀ©¸Â¤Ç¤¢¤ë¡£
452 .TP
453 .B ENOTSOCK
454 .\"O The descriptor references a file, not a socket.
455 ¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ï¥½¥±¥Ã¥È¤Ç¤Ï¤Ê¤¯¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¡£
456 .TP
457 .B EOPNOTSUPP
458 .\"O The referenced socket is not of type
459 .\"O .BR SOCK_STREAM .
460 »²¾È¤·¤Æ¤¤¤ë¥½¥±¥Ã¥È¤Î·¿¤¬
461 .B SOCK_STREAM
462 ¤Ç¤Ê¤¤¡£
463 .TP
464 .B EPROTO
465 .\"O Protocol error.
466 ¥×¥í¥È¥³¥ë¡¦¥¨¥é¡¼¡£
467 .PP
468 .\"O In addition, Linux
469 .\"O .BR accept ()
470 .\"O may fail if:
471 ¾åµ­¤Ë²Ã¤¨¤Æ¡¢Linux ¤Î
472 .BR accept ()
473 ¤Ï°Ê²¼¤Î¥¨¥é¡¼¤Ç¼ºÇÔ¤¹¤ë:
474 .TP
475 .B EPERM
476 .\"O Firewall rules forbid connection.
477 ¥Õ¥¡¥¤¥¢¥¦¥©¡¼¥ë¤Î¥ë¡¼¥ë¤Ë¤è¤êÀܳ¤¬¶Ø»ß¤µ¤ì¤¿¡£
478 .PP
479 .\"O In addition, network errors for the new socket and as defined
480 .\"O for the protocol may be returned.
481 .\"O Various Linux kernels can
482 .\"O return other errors such as
483 ¤³¤Î¾¤Ë¡¢¿·¤·¤¤¥½¥±¥Ã¥È¤ËÂФ¹¤ë¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤¬ÊÖ¤µ¤ì¤ë¤³¤È¤â¤¢¤ë¡£
484 ¤³¤ì¤é¤Ï¤½¤ì¤¾¤ì¤Î¥×¥í¥È¥³¥ë¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
485 ¤¤¤í¤¤¤í¤Ê Linux ¥«¡¼¥Í¥ë¤Ç¤Ï¡¢
486 °Ê²¼¤Ë¼¨¤¹¤è¤¦¤Ê¥¨¥é¡¼¤òÊÖ¤¹¤³¤È¤â¤¢¤ë¡£
487 .BR ENOSR ,
488 .BR ESOCKTNOSUPPORT ,
489 .BR EPROTONOSUPPORT ,
490 .BR ETIMEDOUT .
491 .\"O The value
492 .\"O .B ERESTARTSYS
493 .\"O may be seen during a trace.
494 .B ERESTARTSYS
495 ¤¬¥È¥ì¡¼¥¹¤ÎºÇÃæ¤Ë¸½¤ì¤ë¤³¤È¤â¤¢¤ë¡£
496 .\"O .SH VERSIONS
497 .SH ¥Ð¡¼¥¸¥ç¥ó
498 .\"O The
499 .\"O .BR accept4 ()
500 .\"O system call is available starting with Linux 2.6.28;
501 .\"O support in glibc is available starting with version 2.10.
502 .BR accept4 ()
503 ¥·¥¹¥Æ¥à¥³¡¼¥ë¤Ï Linux 2.6.28 °Ê¹ß¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
504 glibc ¤Ç¤Î¥µ¥Ý¡¼¥È¤Ï¥Ð¡¼¥¸¥ç¥ó 2.10 °Ê¹ß¤ÇÍøÍѲÄǽ¤Ç¤¢¤ë¡£
505 .\"O .SH CONFORMING TO
506 .SH ½àµò
507 .\"O .BR accept ():
508 .\"O POSIX.1-2001,
509 .\"O SVr4, 4.4BSD,
510 .\"O .RB ( accept ()
511 .\"O first appeared in 4.2BSD).
512 .\"O .\" The BSD man page documents five possible error returns
513 .\"O .\" (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT).
514 .\"O .\" POSIX.1-2001 documents errors
515 .\"O .\" EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE,
516 .\"O .\" ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK.
517 .\"O .\" In addition, SUSv2 documents EFAULT and ENOSR.
518 .BR accept ():
519 POSIX.1-2001,
520 SVr4, 4.4BSD,
521 .RB ( accept ()
522 ¤Ï 4.2BSD ¤Ç½é¤á¤Æ¼ÂÁõ¤µ¤ì¤¿).
523 .\" BSD ¤Î man ¥Ú¡¼¥¸¤Ë¤Ï¡¢ 5 ¤Ä¤Î¥¨¥é¡¼¤¬ÊÖ¤µ¤ì¤¦¤ë¤È½ñ¤«¤ì¤Æ¤¤¤ë
524 .\" (EBADF, ENOTSOCK, EOPNOTSUPP, EWOULDBLOCK, EFAULT)¡£
525 .\" POSIX.1-2001 ¤Ç¤Ï¡¢
526 .\" EAGAIN, EBADF, ECONNABORTED, EINTR, EINVAL, EMFILE,
527 .\" ENFILE, ENOBUFS, ENOMEM, ENOTSOCK, EOPNOTSUPP, EPROTO, EWOULDBLOCK
528 .\" ¤¬¥¨¥é¡¼¤È¤·¤Æµ­½Ò¤µ¤ì¤Æ¤¤¤ë¡£
529 .\" ¤µ¤é¤Ë¡¢SUSv2 ¤Ë¤Ï EFAULT, ENOSR ¤âµ­½Ò¤µ¤ì¤Æ¤¤¤ë¡£
530
531 .\"O .BR accept4 ()
532 .\"O is a nonstandard Linux extension.
533 .BR accept4 ()
534 ¤ÏÈóɸ½à¤Î Linux ¤Ë¤è¤ë³ÈÄ¥¤Ç¤¢¤ë¡£
535 .LP
536 .\"O On Linux, the new socket returned by
537 .\"O .BR accept ()
538 .\"O does \fInot\fP inherit file status flags such as
539 .\"O .B O_NONBLOCK
540 .\"O and
541 .\"O .B O_ASYNC
542 .\"O from the listening socket.
543 .\"O This behavior differs from the canonical BSD sockets implementation.
544 .\"O .\" Some testing seems to show that Tru64 5.1 and HP-UX 11 also
545 .\"O .\" do not inherit file status flags -- MTK Jun 05
546 .\"O Portable programs should not rely on inheritance or noninheritance
547 .\"O of file status flags and always explicitly set all required flags on
548 .\"O the socket returned from
549 .\"O .BR accept ().
550 Linux ¤Ç¤Ï¡¢
551 .BR accept ()
552 ¤¬ÊÖ¤¹¿·¤·¤¤¥½¥±¥Ã¥È¤Ï listen ¤ò¹Ô¤Ã¤Æ¤¤¤ë¥½¥±¥Ã¥È¤Î
553 ¥Õ¥¡¥¤¥ë¾õÂ֥ե饰
554 .RB ( O_NONBLOCK
555 ¤ä
556 .B O_ASYNC
557 ¤Ê¤É) ¤ò·Ñ¾µ¡Ö¤·¤Ê¤¤¡×¡£
558 ¤³¤ÎÆ°ºî¤Ïɸ½àŪ¤Ê BSD ¥½¥±¥Ã¥È¤Î¼ÂÁõ¤È¤Ï°Û¤Ê¤Ã¤Æ¤¤¤ë¡£
559 .\" ¤¤¤¯¤Ä¤«¼Â¸³¤·¤¿¤È¤³¤í¤Ç¤Ï Tru64 5.1 ¤È HP-UX 11 ¤â
560 .\" ¥Õ¥¡¥¤¥ë¾õÂ֥ե饰¤ò·Ñ¾µ¤·¤Ê¤¤¤è¤¦¤Ç¤¢¤ë¡£ -- MTK Jun 05
561 °Ü¿¢À­¤ò¹Íθ¤·¤¿¥×¥í¥°¥é¥à¤Ç¤Ï¥Õ¥¡¥¤¥ë¾õÂ֥ե饰¤¬·Ñ¾µ¤µ¤ì¤ë¤«¤É¤¦¤«¤Ï
562 Á°Äó¤Ë¤»¤º¡¢¾ï¤Ë
563 .BR accept ()
564 ¤¬ÊÖ¤·¤¿¥½¥±¥Ã¥È¤ËÂФ·¤ÆÁ´¤Æ¤ÎɬÍפʥե饰¤òÌÀ¼¨Åª¤ËÀßÄꤹ¤ë¤è¤¦¤Ë
565 ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
566
567 .\"O .SH NOTES
568 .SH Ãí°Õ
569 .\"O POSIX.1-2001 does not require the inclusion of
570 .\"O .IR <sys/types.h> ,
571 .\"O and this header file is not required on Linux.
572 .\"O However, some historical (BSD) implementations required this header
573 .\"O file, and portable applications are probably wise to include it.
574 POSIX.1-2001 ¤Ç¤Ï
575 .I <sys/types.h>
576 ¤Î¥¤¥ó¥¯¥ë¡¼¥É¤Ïɬ¿Ü¤È¤µ¤ì¤Æ¤ª¤é¤º¡¢
577 Linux ¤Ç¤Ï¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤ÏɬÍפǤϤʤ¤¡£
578 ¤·¤«¤·¡¢Îò»ËŪ¤Ë¤Ï¡¢¤¤¤¯¤Ä¤«¤Î¼ÂÁõ (BSD ·Ï) ¤Ç¤³¤Î¥Ø¥Ã¥À¥Õ¥¡¥¤¥ë¤¬
579 ɬÍפǤ¢¤ê¡¢°Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¤³¤Î¥Õ¥¡¥¤¥ë¤ò
580 ¥¤¥ó¥¯¥ë¡¼¥É¤¹¤ë¤Î¤¬¸­ÌÀ¤Ç¤¢¤í¤¦¡£
581
582 .\"O There may not always be a connection waiting after a
583 .\"O .B SIGIO
584 .\"O is delivered or
585 .\"O .BR select (2)
586 .\"O or
587 .\"O .BR poll (2)
588 .\"O return a readability event because the connection might have been
589 .\"O removed by an asynchronous network error or another thread before
590 .\"O .BR accept ()
591 .\"O is called.
592 .B SIGIO
593 ¤¬ÆϤ±¤é¤ì¤¿¸å¤ä¡¢
594 .BR select (2)
595 ¤Þ¤¿¤Ï
596 .BR poll (2)
597 ¤¬Æɤ߹þ¤ß²Äǽ¥¤¥Ù¥ó¥È¤òÊÖ¤·¤¿¸å¤Ë¡¢
598 ɬ¤º¤·¤âÂÔµ¡Ãæ¤ÎÀܳ¤¬¤¢¤ë¤È¤Ï¸Â¤é¤Ê¤¤¡£
599 ¤Ê¤¼¤Ê¤é¤½¤ÎÀܳ¤Ï¡¢
600 .BR accept ()
601 ¤¬¸Æ¤Ð¤ì¤ëÁ°¤Ë¡¢ÈóƱ´üŪ¤Ê¥Í¥Ã¥È¥ï¡¼¥¯¥¨¥é¡¼¤ä
602 ¾¤Î¥¹¥ì¥Ã¥É¤«¤é¸Æ¤Ð¤ì¤¿ (Ê̤Î) accept ¤Ë¤è¤Ã¤Æ
603 ºï½ü¤µ¤ì¤Æ¤¤¤ë¤«¤â¤·¤ì¤Ê¤¤¤«¤é¤Ç¤¢¤ë¡£
604 .\"O If this happens then the call will block waiting for the next
605 .\"O connection to arrive.
606 .\"O To ensure that
607 .\"O .BR accept ()
608 .\"O never blocks, the passed socket
609 .\"O .I sockfd
610 .\"O needs to have the
611 .\"O .B O_NONBLOCK
612 .\"O flag set (see
613 .\"O .BR socket (7)).
614 ¤³¤Î¾ì¹ç¡¢¤½¤Î
615 .BR accept ()
616 ¸Æ¤Ó½Ð¤·¤ÏÄä»ß (block) ¤·¡¢¼¡¤ÎÀܳ¤ÎÅþÃå¤òÂÔ¤Á¤Ä¤Å¤±¤ë¡£
617 .BR accept ()
618 ¤ËÄä»ß¤ò¹Ô¤ï¤»¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï¡¢°ú¤­¿ô¤ËÅϤ¹¥½¥±¥Ã¥È
619 .I sockfd
620 ¤Ë
621 .B O_NONBLOCK
622 ¥Õ¥é¥°¤ò¥»¥Ã¥È¤·¤Æ¤ª¤¯É¬Íפ¬¤¢¤ë
623 .RB ( socket (7)
624 ¤ò¸«¤è)¡£
625 .\"O .SS The socklen_t type
626 .SS socklen_t ·¿
627 .\"O The third argument of
628 .\"O .BR accept ()
629 .\"O was originally declared as an \fIint *\fP (and is that under libc4 and libc5
630 .\"O and on many other systems like 4.x BSD, SunOS 4, SGI); a POSIX.1g draft
631 .\"O standard wanted to change it into a \fIsize_t *\fP, and that is what it is
632 .\"O for SunOS 5.
633 .BR accept ()
634 ¤ÎÂè 3 °ú¤­¿ô¤Ï¡¢¤â¤È¤â¤È \fIint *\fP ¤ÈÀë¸À¤µ¤ì¤Æ¤¤¤¿
635 (libc4 ¤ä libc5, 4.x BSD, SunOS 4, SGI ¤Ê¤É¿¤¯¤Î¥·¥¹¥Æ¥à¤Ç¤Ï¤½¤¦¤Ê¤Ã¤Æ¤¤¤ë)¡£
636 POSIX.1g draft É¸½à¤Ï¡¢
637 ¤³¤ì¤ò \fIsize_t *\fP ¤ËÊѹ¹¤·¤è¤¦¤È¤·¡¢SunOS 5 ¤Ç¤Ï¤½¤¦Àë¸À¤µ¤ì¤Æ¤¤¤ë¡£
638 .\"O Later POSIX drafts have \fIsocklen_t *\fP,
639 .\"O and so do the Single Unix Specification and glibc2.
640 ¸å¤Ë POSIX drafts ¤Ë¤Ï \fIsocklen_t *\fP ¤¬´Þ¤Þ¤ì¤ë¤è¤¦¤Ë¤Ê¤ê¡¢
641 Single Unix Specification ¤ä glibc2 ¤Ç¤Ï¤³¤Î¤è¤¦¤ËÀë¸À¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¡£
642 .\"O Quoting Linus Torvalds:
643 Linus Torvald ¤Îȯ¸À¤ò°úÍѤ¹¤ë:
644
645 .\" .I fails: only italicizes a single line
646 .\"O "_Any_ sane library _must_ have "socklen_t" be the same size
647 .\"O as int.
648 .\"O Anything else breaks any BSD socket layer stuff.
649 .\"O POSIX initially \fIdid\fP make it a size_t, and I (and hopefully others, but
650 .\"O obviously not too many) complained to them very loudly indeed.
651 .\"O Making it a size_t is completely broken, exactly because size_t very
652 .\"O seldom is the same size as "int" on 64-bit architectures, for example.
653 .\"O And it
654 .\"O \fIhas\fP to be the same size as "int" because that's what the BSD socket
655 .\"O interface is.
656 .\"O Anyway, the POSIX people eventually got a clue, and created "socklen_t".
657 .\"O They shouldn't have touched it in the first place, but once they did
658 .\"O they felt it had to have a named type for some unfathomable reason
659 .\"O (probably somebody didn't like losing face over having done the original
660 .\"O stupid thing, so they silently just renamed their blunder)."
661 ¡Ö¤Þ¤È¤â¤Ê¥é¥¤¥Ö¥é¥ê¤òºî¤ê¤¿¤±¤ì¤Ð¡¢ "socklen_t"
662 ¤Î¥µ¥¤¥º¤Ï int ¤ÈƱ¤¸¤Ë¤·¤Ê¤­¤ã¤Ê¤é¤Ê¤¤¡£
663 ¤µ¤â¤Ê¤¤¤È BSD ¥½¥±¥Ã¥ÈÁؤòÇ˲õ¤¹¤ë¤³¤È¤Ë¤Ê¤Ã¤Á¤ã¤¦¡£
664 POSIX ¤ÏºÇ½é¤³¤¤¤Ä¤ò size_t ¤Ë¤·¤¿¤ó¤Ç¡¢
665 ¤Ü¤¯¤ÏÈà¤é¤Ëʸ¶ç¤ò¤¬¤Ê¤ê¤¿¤Æ¤¿
666 (¿ʬ¤½¤¦¤¤¤¦¿Í¤Ï¾¤Ë¤â¤¤¤¿¤È»×¤¦¡£Â¿¤¯¤Ï¤Ê¤«¤Ã¤¿¤è¤¦¤À¤±¤É)¡£
667 ¤³¤¤¤Ä¤ò size_t ¤Ë¤¹¤ë¤Î¤Ï´°Á´¤Ë¤¤¤«¤ì¤Æ¤ë¡£
668 Î㤨¤Ð 64 ¥Ó¥Ã¥È¥¢¡¼¥­¥Æ¥¯¥Á¥ã¤Ç¤Ï¡¢
669 size_t ¤¬ "int" ¤ÈƱ¤¸¥µ¥¤¥º¤À¤Ê¤ó¤Æ¤³¤È¤Ï¤Û¤È¤ó¤É¤Ê¤¤¤«¤é¤Í¡£
670 ¤³¤Î¥µ¥¤¥º¤Ï "int" ¤È Æ±¤¸¤Ç¤Ê¤­¤ã¡Ø¥À¥á¡Ù¤Ê¤ó¤À¡£
671 BSD ¥½¥±¥Ã¥È¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ã¤Æ¤¤¤¦¤Î¤Ï¤½¤¦¤¤¤¦¤â¤Î¤Ê¤ó¤À¤«¤é¡£
672 ¤Þ¤¢¤È¤â¤«¤¯ POSIX ¤Î¿Í¤¿¤Á¤â¡¢
673 "socklen_t" ¤òºî¤ë¤È¤¤¤¦²ò·èºö¤ò¤Ê¤ó¤È¤«¤Ò¤Í¤ê½Ð¤·¤¿¡£
674 ¤½¤â¤½¤âºÇ½é¤«¤éÊü¤Ã¤Æ¤ª¤±¤ÐÎɤ«¤Ã¤¿¤ó¤À¤¬¡¢
675 ¤¤¤¸¤Ã¤Á¤ã¤Ã¤¿°Ê¾å¡¢
676 ̾Á°ÉÕ¤­¤Î·¿¤ò»ý¤¿¤»¤Ê¤­¤ã¤Ê¤é¤Ê¤¤¡¢¤È»×¤Ã¤¿¤ß¤¿¤¤¤À¤Í¡£
677 ¤Ê¤ó¤Ç¤«¤Ï¤ï¤«¤ó¤Ê¤¤¤±¤É
678 (¤­¤Ã¤ÈºÇ½é¤Ë¤ä¤Ã¤Á¤Þ¤Ã¤¿Çϼ¯¤Ê´Ö°ã¤¤¤Ç´é¤ò¤Ä¤Ö¤·¤¿¤¯¤Ê¤«¤Ã¤¿¤«¤é¡¢
679 ¤³¤Ã¤½¤ê̾Á°¤òÉÕ¤±Âؤ¨¤Æ¼«Ê¬¤¿¤Á¤ÎÂ缺ÇÔ¤ò¤´¤Þ¤«¤½¤¦¤È¤·¤¿¤ó¤À¤í¤¦)¡£¡×
680 .\"O .SH EXAMPLE
681 .SH Îã
682 .\"O See
683 .\"O .BR bind (2).
684 .BR bind (2)
685 »²¾È¡£
686 .\"O .SH "SEE ALSO"
687 .SH ´ØÏ¢¹àÌÜ
688 .BR bind (2),
689 .BR connect (2),
690 .BR listen (2),
691 .BR select (2),
692 .BR socket (2),
693 .BR socket (7)