BSD 4_3 release
[unix-history] / usr / man / man2 / bind.2
index f048056..2c265ce 100644 (file)
@@ -1,9 +1,17 @@
-.TH BIND 2 2/12/83
+.\" Copyright (c) 1983 Regents of the University of California.
+.\" All rights reserved.  The Berkeley software License Agreement
+.\" specifies the terms and conditions for redistribution.
+.\"
+.\"    @(#)bind.2      6.6 (Berkeley) 5/22/86
+.\"
+.TH BIND 2 "May 22, 1986"
+.UC 5
 .SH NAME
 bind \- bind a name to a socket
 .SH SYNOPSIS
 .nf
 .ft B
 .SH NAME
 bind \- bind a name to a socket
 .SH SYNOPSIS
 .nf
 .ft B
+#include <sys/types.h>
 #include <sys/socket.h>
 .PP
 .ft B
 #include <sys/socket.h>
 .PP
 .ft B
@@ -14,17 +22,24 @@ int namelen;
 .fi
 .SH DESCRIPTION
 .I Bind
 .fi
 .SH DESCRIPTION
 .I Bind
-assigns gives a name to a unnamed socket.
+assigns a name to an unnamed socket.
 When a socket is created 
 with
 .IR socket (2)
 it exists in a name space (address family)
 but has no name assigned.
 When a socket is created 
 with
 .IR socket (2)
 it exists in a name space (address family)
 but has no name assigned.
-The
 .I Bind
 .I Bind
-requests the
-.IR name ,
+requests that
+.IR name 
 be assigned to the socket.
 be assigned to the socket.
+.SH NOTES
+Binding a name in the UNIX domain creates a socket in the file
+system that must be deleted by the caller when it is no longer
+needed (using
+.IR unlink (2)).
+.PP
+The rules used in name binding vary between communication domains.
+Consult the manual entries in section 4 for detailed information.
 .SH "RETURN VALUE
 If the bind is successful, a 0 value is returned.
 A return value of \-1 indicates an error, which is
 .SH "RETURN VALUE
 If the bind is successful, a 0 value is returned.
 A return value of \-1 indicates an error, which is
@@ -47,12 +62,39 @@ The specified address is already in use.
 [EINVAL]
 The socket is already bound to an address.
 .TP 20
 [EINVAL]
 The socket is already bound to an address.
 .TP 20
-[EACCESS]
+[EACCES]
 The requested address is protected, and the current user
 has inadequate permission to access it.
 .TP 20
 [EFAULT]
 The \fIname\fP parameter is not in a valid part of the user
 address space.
 The requested address is protected, and the current user
 has inadequate permission to access it.
 .TP 20
 [EFAULT]
 The \fIname\fP parameter is not in a valid part of the user
 address space.
+.PP
+The following errors are specific to binding names in the UNIX domain.
+.TP 15
+[ENOTDIR]
+A component of the path prefix is not a directory.
+.TP 15
+[EINVAL]
+The pathname contains a character with the high-order bit set.
+.TP 15
+[ENAMETOOLONG]
+A component of a pathname exceeded 255 characters,
+or an entire path name exceeded 1023 characters.
+.TP 15
+[ENOENT]
+A prefix component of the path name does not exist.
+.TP 15
+[ELOOP]
+Too many symbolic links were encountered in translating the pathname.
+.TP 15
+[EIO]
+An I/O error occurred while making the directory entry or allocating the inode.
+.TP 15
+[EROFS]
+The name would reside on a read-only file system.
+.TP 15
+[EISDIR]
+A null pathname was specified.
 .SH SEE ALSO
 .SH SEE ALSO
-connect(2), listen(2), socket(2), sockaddr(2)
+connect(2), listen(2), socket(2), getsockname(2)