manual page first distributed with 4.2BSD
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 16 May 1985 02:52:44 +0000 (18:52 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 16 May 1985 02:52:44 +0000 (18:52 -0800)
SCCS-vsn: lib/libc/sys/bind.2 5.1

usr/src/lib/libc/sys/bind.2 [new file with mode: 0644]

diff --git a/usr/src/lib/libc/sys/bind.2 b/usr/src/lib/libc/sys/bind.2
new file mode 100644 (file)
index 0000000..0429bff
--- /dev/null
@@ -0,0 +1,77 @@
+.\" 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      5.1 (Berkeley) %G%
+.\"
+.TH BIND 2 "27 July 1983"
+.UC 5
+.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
+bind(s, name, namelen)
+int s;
+struct sockaddr *name;
+int namelen;
+.fi
+.SH DESCRIPTION
+.I Bind
+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.
+.I Bind
+requests the
+.IR name ,
+be assigned to the socket.
+.SH NOTES
+Binding a name in the UNIX domain creates a socket in the file
+system which must be deleted by the caller when it is no longer
+needed (using
+.IR unlink (2)).
+The file created
+is a side-effect of the current implementation,
+and will not be created in future versions
+of the UNIX ipc domain.
+.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
+further specified in the global \fIerrno\fP.
+.SH ERRORS
+The \fIbind\fP call will fail if:
+.TP 20
+[EBADF]
+\fIS\fP is not a valid descriptor.
+.TP 20
+[ENOTSOCK]
+\fIS\fP is not a socket.
+.TP 20
+[EADDRNOTAVAIL]
+The specified address is not available from the local machine.
+.TP 20
+[EADDRINUSE]
+The specified address is already in use.
+.TP 20
+[EINVAL]
+The socket is already bound to an address.
+.TP 20
+[EACCESS]
+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.
+.SH SEE ALSO
+connect(2), listen(2), socket(2), getsockname(2)