Penguin

Differences between current version and revision by previous author of bind(2).

Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History

Newer page: version 4 Last edited on Tuesday, December 31, 2002 2:48:39 am by PerryLorier
Older page: version 2 Last edited on Tuesday, June 4, 2002 12:23:39 am by perry Revert
@@ -1,179 +1,56 @@
 BIND 
 !!!BIND 
-NAME  
-SYNOPSIS  
-DESCRIPTION  
-NOTES  
-RETURN VALUE  
-ERRORS  
-BUGS  
-CONFORMING TO  
-NOTE  
-SEE ALSO  
 ---- 
 !!NAME 
-  
  
 bind - bind a name to a socket 
 !!SYNOPSIS 
  
  
-__#include __  
-#include __ 
+ __#include <sys/types.h> __  
+ __ #include <sys/socket.h> __ 
  
+ __int bind(int__ ''sockfd''__, struct sockaddr *__''my_addr''__, socklen_t__ ''addrlen''__);__  
  
-__int bind(int__ ''sockfd''__, struct sockaddr  
-*__''my_addr''__, socklen_t__  
-''addrlen''__);__  
 !!DESCRIPTION 
+__bind__ gives the socket ''sockfd'' the local address ''my_addr''. ''my_addr'' is ''addrlen'' bytes long. Traditionally, this is called ``assigning a name to a socket.'' When a socket is created with socket(2), it  
+exists in a name space (address family) but has no name assigned.  
  
+It is normally necessary to assign a local address using __bind__ before a __SOCK_STREAM__ socket may receive connections (see accept(2)).  
  
-__bind__ gives the socket ''sockfd'' the local address  
-''my_addr''. ''my_addr'' is ''addrlen'' bytes long.  
-Traditionally, this is called ``assigning a name to a  
-socket.'' When a socket is created with socket(2), it  
-exists in a name space (address family) but has no name  
-assigned.  
-  
-  
-It is normally necessary to assign a local address using  
-__bind__ before a __SOCK_STREAM__ socket may receive  
-connections (see accept(2)).  
 !!NOTES 
+The rules used in name binding vary between address families. Consult the manual entries in Section 7 for detailed information. For __AF_INET__ see ip(7), for __AF_UNIX__ see unix(7), for __AF_APPLETALK__ see ddp(7), for __AF_PACKET__ see packet(7), for __AF_X25__ see x25(7) and for __AF_NETLINK__ see netlink(7).  
  
-  
-The rules used in name binding vary between address  
-families. Consult the manual entries in Section 7 for  
-detailed information. For __AF_INET__ see ip(7),  
-for __AF_UNIX__ see unix(7), for  
-__AF_APPLETALK__ see ddp(7), for __AF_PACKET__  
-see packet(7), for __AF_X25__ see x25(7)  
-and for __AF_NETLINK__ see  
-netlink(7).  
 !!RETURN VALUE 
-  
-  
- On success, zero is returned. On error, -1 is returned, and  
- ''errno'' is set appropriately. 
+On success, zero is returned. On error, -1 is returned, and ''errno'' is set appropriately. 
 !!ERRORS 
  
+;[EBADF]: ''sockfd'' is not a valid descriptor.  
+;[EINVAL]: The socket is already bound to an address. This may change in the future: see ''linux/unix/sock.c'' for details.  
+;[EACCES]: The address is protected, and the user is not the super-user.  
+;[ENOTSOCK]: Argument is a descriptor for a file, not a socket.  
  
-__EBADF __ 
+The following errors are specific to UNIX domain ( __AF _UNIX __) sockets:  
  
+;[EINVAL]: The ''addrlen'' is wrong, or the socket was not in the __AF_UNIX__ family.  
+;[EROFS]: The socket inode would reside on a read-only file system.  
+;[EFAULT]: ''my_addr'' points outside the user's accessible address space.  
+;[ENAMETOOLONG]: ''my_addr'' is too long.  
+;[ENOENT]: The file does not exist.  
+;[ENOMEM]: Insufficient kernel memory was available.  
+;[ENOTDIR]: A component of the path prefix is not a directory.  
+;[EACCES]: Search permission is denied on a component of the path prefix.  
+;[ELOOP]: Too many symbolic links were encountered in resolving ''my_addr''.  
  
-''sockfd'' is not a valid descriptor.  
-  
-  
-__EINVAL__  
-  
-  
-The socket is already bound to an address. This may change  
-in the future: see ''linux/unix/sock.c'' for  
-details.  
-  
-  
-__EACCES__  
-  
-  
-The address is protected, and the user is not the  
-super-user.  
-  
-  
-__ENOTSOCK__  
-  
-  
-Argument is a descriptor for a file, not a  
-socket.  
-  
-  
-The following errors are specific to UNIX domain  
-(__AF_UNIX__) sockets:  
-  
-  
-__EINVAL__  
-  
-  
-The ''addrlen'' is wrong, or the socket was not in the  
-__AF_UNIX__ family.  
-  
-  
-__EROFS__  
-  
-  
-The socket inode would reside on a read-only file  
-system.  
-  
-  
-__EFAULT__  
-  
-  
-''my_addr'' points outside the user's accessible address  
-space.  
-  
-  
-__ENAMETOOLONG__  
-  
-  
-''my_addr'' is too long.  
-  
-  
-__ENOENT__  
-  
-  
-The file does not exist.  
-  
-  
-__ENOMEM__  
-  
-  
-Insufficient kernel memory was available.  
-  
-  
-__ENOTDIR__  
-  
-  
-A component of the path prefix is not a  
-directory.  
-  
-  
-__EACCES__  
-  
-  
-Search permission is denied on a component of the path  
-prefix.  
-  
-  
-__ELOOP__  
-  
-  
-Too many symbolic links were encountered in resolving  
-''my_addr''.  
 !!BUGS 
+The transparent proxy options are not described.  
  
-  
-The transparent proxy options are not  
-described.  
 !!CONFORMING TO 
+SVr4, 4.4BSD (the __bind__ function first appeared in BSD 4.2). SVr4 documents additional [EADDRNOTAVAIL], [EADDRINUSE], and [ENOSR] general error conditions, and additional [EIO] and [EISDIR]  
+Unix-domain error conditions.  
  
-  
-SVr4, 4.4BSD (the __bind__ function first appeared in BSD  
-4.2). SVr4 documents additional __EADDRNOTAVAIL__,  
-__EADDRINUSE__, and __ENOSR__ general error  
-conditions, and additional __EIO__ and __EISDIR__  
-Unix-domain error conditions.  
 !!NOTE 
+The third argument of __bind__ is in reality an int (and this is what BSD 4.* and libc4 and libc5 have). Some POSIX confusion resulted in the present socklen_t. The draft standard has not been adopted yet, but glibc2 already follows it and also has socklen_t. See also accept(2).  
  
-  
-The third argument of __bind__ is in reality an int (and  
-this is what BSD 4.* and libc4 and libc5 have). Some POSIX  
-confusion resulted in the present socklen_t. The draft  
-standard has not been adopted yet, but glibc2 already  
-follows it and also has socklen_t. See also  
-accept(2).  
 !!SEE ALSO 
-  
-  
- accept(2), connect(2), listen(2),  
- socket(2), getsockname(2), ip(7),  
- socket(7)  
-----  
+accept(2), connect(2), listen(2), socket(2), getsockname(2), ip(7), socket(7), CategorySocketSysCalls  
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.