📄 syscalls_42.html
字号:
<!-- This HTML file has been created by texi2html 1.29
from syscalls.texi on 4 June 1994 -->
<TITLE>Syscall specifications of Linux - bind</TITLE>
<P>Go to the <A HREF="syscalls_41.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_41.html">previous</A>, <A HREF="syscalls_43.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_43.html">next</A> section.<P>
<H2><A NAME="SEC42" HREF="syscalls_toc.html#SEC42" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_toc.html#SEC42">bind</A></H2>
<P>
<H3>SYNOPSIS</H3>
<P>
<CODE>int bind(int <VAR>sockfd</VAR>, struct sockaddr *<VAR>my_addr</VAR>, int
<VAR>addrlen</VAR>);</CODE>
<P>
<H3>PARAMETERS</H3>
<P>
<VAR>sockfd</VAR>: [in] the socket to bind.
<P>
<VAR>my_addr</VAR>: [in] the address to bind the socket to.
<P>
<VAR>addrlen</VAR>: [in] the length of addr (in bytes).
<P>
<H3>DESCRIPTION</H3>
<P>
Binds the socket <VAR>sockfd</VAR> to the local address <VAR>my_addr</VAR>. The
format of the address is network dependent.
<P>
<H3>RETURN VALUE</H3>
<P>
On success zero is returned. On error, -1 is returned and <CODE>errno</CODE> is
set to one of the following values:
<P>
<UL>
<LI><CODE>EINVAL</CODE>: the socket is already bound to an address, or
<VAR>addrlen</VAR> is invalid or the socket is not in the <CODE>AF_UNIX</CODE>
family.
<LI><CODE>EACCESS</CODE>: the address is reserved for super-user usage and
the calling task has not super-user privileges or the taks does not have
enough access rights on the path.
<LI><CODE>ENAMETOOLONG</CODE>: <VAR>my_addr</VAR> is too long.
<LI><CODE>EBADF</CODE>, <CODE>EROFS</CODE>, <CODE>EFAULT</CODE>, <CODE>ENOENT</CODE>, <CODE>ENOMEM</CODE>,
<CODE>ENOTDIR</CODE> or <CODE>ELOOP</CODE>.
</UL>
<P>
<P>Go to the <A HREF="syscalls_41.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_41.html">previous</A>, <A HREF="syscalls_43.html" tppabs="http://personal.xfol.com/%7erezaie/syscall/syscalls_43.html">next</A> section.<P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -