1 .\" Copyright (c) 1983, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\" may be used to endorse or promote products derived from this software
14 .\" without specific prior written permission.
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 .\" @(#)bind.2 8.1 (Berkeley) 6/4/93
29 .\" $FreeBSD: src/lib/libc/sys/bind.2,v 1.11.2.9 2002/07/08 13:07:42 dannyboy Exp $
30 .\" $DragonFly: src/lib/libc/sys/bind.2,v 1.3 2007/07/30 22:11:33 swildner Exp $
37 .Nd assign a local protocol address to a socket
44 .Fn bind "int s" "const struct sockaddr *addr" "socklen_t addrlen"
47 assigns the local protocol address to a socket.
48 When a socket is created
51 it exists in an address family space but has no protocol address assigned.
55 be assigned to the socket.
57 Binding an address in the
59 domain creates a socket in the file
60 system that must be deleted by the caller when it is no longer
64 The rules used in address binding vary between communication domains.
65 Consult the manual entries in section 4 for detailed information.
67 For maximum portability, you should always zero the socket address structure
68 before populating it and passing it to
78 Kernel resources to complete the request are
79 temporarily unavailable.
82 is not a valid descriptor.
86 .It Bq Er EADDRNOTAVAIL
87 The specified address is not available from the local machine.
89 The specified address is already in use.
91 The requested address is protected, and the current user
92 has inadequate permission to access it.
96 parameter is not in a valid part of the user
100 The following errors are specific to binding addresses in the
103 .Bl -tag -width EADDRNOTAVA
105 A component of the path prefix is not a directory.
106 .It Bq Er ENAMETOOLONG
107 A component of a pathname exceeded 255 characters,
108 or an entire path name exceeded 1023 characters.
110 A prefix component of the path name does not exist.
112 Too many symbolic links were encountered in translating the pathname.
114 An I/O error occurred while making the directory entry or allocating the inode.
116 The name would reside on a read-only file system.
118 An empty pathname was specified.
128 function call appeared in