128 lines
4.3 KiB
Groff
128 lines
4.3 KiB
Groff
.\" Copyright (c) 1983, 1993
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
.\" must display the following acknowledgement:
|
|
.\" This product includes software developed by the University of
|
|
.\" California, Berkeley and its contributors.
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
.\" may be used to endorse or promote products derived from this software
|
|
.\" without specific prior written permission.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" @(#)bind.2 8.1 (Berkeley) 6/4/93
|
|
.\" %FreeBSD: src/lib/libc/sys/bind.2,v 1.11.2.9 2002/07/08 13:07:42 dannyboy Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd June 4, 1993
|
|
.Dt BIND 2
|
|
.Os
|
|
.Sh ̾¾Î
|
|
.Nm bind
|
|
.Nd assign a local protocol address to a socket
|
|
.Sh ¥é¥¤¥Ö¥é¥ê
|
|
.Lb libc
|
|
.Sh ½ñ¼°
|
|
.In sys/types.h
|
|
.In sys/socket.h
|
|
.Ft int
|
|
.Fn bind "int s" "const struct sockaddr *addr" "socklen_t addrlen"
|
|
.Sh ²òÀâ
|
|
.Fn bind
|
|
¤Ï¡¢¥í¡¼¥«¥ë¥×¥í¥È¥³¥ë¥¢¥É¥ì¥¹¤ò¥½¥±¥Ã¥È¤Ë³ä¤êÅö¤Æ¤Þ¤¹¡£¥½¥±¥Ã¥È¤Ï¡¢
|
|
.Xr socket 2
|
|
¤ÇºîÀ®¤µ¤ì¤ë»þ¤Ë¥¢¥É¥ì¥¹¥Õ¥¡¥ß¥ê¶õ´Ö¤Ë¸ºß¤·¤Þ¤¹¤¬¡¢
|
|
¥×¥í¥È¥³¥ë¥¢¥É¥ì¥¹¤Ï³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤Þ¤»¤ó¡£
|
|
.Fn bind
|
|
¤Ï¥½¥±¥Ã¥È¤Ë
|
|
.Fa addr
|
|
¤ò³ä¤êÅö¤Æ¤ë¤³¤È¤òÍ׵ᤷ¤Þ¤¹¡£
|
|
.Sh Ãí
|
|
UNIX ¥É¥á¥¤¥óÆâ¤Ç¤Î¥¢¥É¥ì¥¹¤Î¥Ð¥¤¥ó¥É¤Ë¤è¤Ã¤Æ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥àÆâ¤Ë
|
|
¥½¥±¥Ã¥È¤¬ºîÀ®¤µ¤ì¤Þ¤¹¡£
|
|
¤³¤ì¤Ï¡¢É¬Íפʤ¯¤Ê¤Ã¤¿¤È¤¤Ë¸Æ¤Ó½Ð¤·Â¦¤¬
|
|
.Pf ( Xr unlink 2
|
|
¤ò»ÈÍѤ·¤Æ) ºï½ü¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
|
|
.Pp
|
|
¥¢¥É¥ì¥¹¤Î¥Ð¥¤¥ó¥É¤Ç»ÈÍѤµ¤ì¤ëµ¬Â§¤ÏÄÌ¿®¥É¥á¥¤¥ó´Ö¤Ç°Û¤Ê¤ê¤Þ¤¹¡£
|
|
¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢
|
|
¥»¥¯¥·¥ç¥ó 4 ¤Î¥Þ¥Ë¥å¥¢¥ë¥¨¥ó¥È¥ê¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£
|
|
.Pp
|
|
°Ü¿¢À¤òºÇÂç¤Ë¤¹¤ë¤¿¤á¤Ë¤Ï¡¢¥½¥±¥Ã¥È¹½Â¤ÂΤϡ¢»ÈÍÑÁ°
|
|
¤Ä¤Þ¤ê¤³¤ì¤ò
|
|
.Fn bind
|
|
¤ËÅϤ¹Á°¤Ë¡¢0 ¤ÇËä¤á¤ë¤Ù¤¤Ç¤¹¡£
|
|
.Sh Ìá¤êÃÍ
|
|
.Rv -std bind
|
|
.Sh ¥¨¥é¡¼
|
|
.Fn bind
|
|
¸Æ¤Ó½Ð¤·¤Ï¼¡¤Î¾ì¹ç¤Ë¼ºÇÔ¤·¤Þ¤¹¡£
|
|
.Bl -tag -width Er
|
|
.It Bq Er EAGAIN
|
|
Í×µá¤òËþ¤¿¤¹¤¿¤á¤Î¥«¡¼¥Í¥ë¥ê¥½¡¼¥¹¤¬°ì»þŪ¤ËÍøÍѤǤ¤Þ¤»¤ó¡£
|
|
.It Bq Er EBADF
|
|
.Fa s
|
|
¤¬Í¸ú¤Êµ½Ò»Ò¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
.It Bq Er ENOTSOCK
|
|
.Fa s
|
|
¤¬¥½¥±¥Ã¥È¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
.It Bq Er EADDRNOTAVAIL
|
|
»ØÄê¤Î¥¢¥É¥ì¥¹¤¬¥í¡¼¥«¥ë¥Þ¥·¥ó¤«¤éÍøÍѤǤ¤Þ¤»¤ó¡£
|
|
.It Bq Er EADDRINUSE
|
|
»ØÄê¤Î¥¢¥É¥ì¥¹¤Ï´û¤Ë»ÈÍÑÃæ¤Ç¤¹¡£
|
|
.It Bq Er EACCES
|
|
Í׵ᤵ¤ì¤¿¥¢¥É¥ì¥¹¤ÏÊݸ¤ì¤Æ¤ª¤ê¡¢¸½ºß¤Î¥æ¡¼¥¶¤¬»ý¤Ã¤Æ¤¤¤ë¥Ñ¡¼¥ß¥Ã¥·¥ç¥ó¤Ï
|
|
¤½¤ì¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤Î¤Ë¤ÏÉÔŬÀڤǤ¹¡£
|
|
.It Bq Er EFAULT
|
|
.Fa addr
|
|
¥Ñ¥é¥á¡¼¥¿¤¬Í¸ú¤Ê¥æ¡¼¥¶¥¢¥É¥ì¥¹¶õ´Ö¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¡£
|
|
.El
|
|
.Pp
|
|
¼¡¤Î¥¨¥é¡¼¤Ï UNIX ¥É¥á¥¤¥óÆâ¤Î¥Ð¥¤¥ó¥É¥¢¥É¥ì¥¹¤Ë¸ÇͤΤâ¤Î¤Ç¤¹¡£
|
|
.Bl -tag -width EADDRNOTAVA
|
|
.It Bq Er ENOTDIR
|
|
¥Ñ¥¹¤Î¹½À®Í×ÁÇÃæ¤Ë¥Ç¥£¥ì¥¯¥È¥ê°Ê³°¤Î¤â¤Î¤¬´Þ¤Þ¤ì¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENAMETOOLONG
|
|
¥Ñ¥¹Ì¾¤Î¹½À®Í×ÁǤ¬ 255 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤ë¤«¡¢
|
|
¤Þ¤¿¤Ï¥Ñ¥¹Ì¾Á´ÂΤ¬ 1023 ʸ»ú¤ò±Û¤¨¤Æ¤¤¤Þ¤¹¡£
|
|
.It Bq Er ENOENT
|
|
¥Ñ¥¹Ì¾¤ÎÀÜÆ¬¼¹½À®Í×ÁǤ¬Â¸ºß¤·¤Þ¤»¤ó¡£
|
|
.It Bq Er ELOOP
|
|
¥Ñ¥¹Ì¾¤òÊÑ´¹¤¹¤ë¤È¤¤Ë¸¡½Ð¤µ¤ì¤¿¥·¥ó¥Ü¥ê¥Ã¥¯¥ê¥ó¥¯¤¬Â¿¤¹¤®¤Þ¤¹¡£
|
|
.It Bq Er EIO
|
|
¥Ç¥£¥ì¥¯¥È¥ê¥¨¥ó¥È¥ê¤òºîÀ®¤·¤Æ¤¤¤ë´Ö¡¢¤Þ¤¿¤Ï inode ¤ò³ä¤ê¿¶¤ê¤·¤Æ¤¤¤ë´Ö¤Ë
|
|
Æþ½ÐÎÏ¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£
|
|
.It Bq Er EROFS
|
|
»ØÄꤵ¤ì¤¿¥Õ¥¡¥¤¥ë¤ÏÆÉ¼è¤êÀìÍÑ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¾å¤Ë¤¢¤ê¤Þ¤¹¡£
|
|
.It Bq Er EISDIR
|
|
¶õ¤Î¥Ñ¥¹Ì¾¤¬»ØÄꤵ¤ì¤Þ¤·¤¿¡£
|
|
.El
|
|
.Sh ´ØÏ¢¹àÌÜ
|
|
.Xr connect 2 ,
|
|
.Xr getsockname 2 ,
|
|
.Xr listen 2 ,
|
|
.Xr socket 2
|
|
.Sh Îò»Ë
|
|
.Fn bind
|
|
´Ø¿ô¤Ï
|
|
.Bx 4.2
|
|
¤ÇÅо줷¤Þ¤·¤¿¡£
|