BIND(2,L) AIX Technical Reference BIND(2,L)
-------------------------------------------------------------------------------
bind
PURPOSE
Binds a name to a socket.
SYNTAX
#include <sys/types.h>
#include <sys/socket.h>
int bind (s, name, namelen)
int s;
struct sockaddr *name;
int namelen;
DESCRIPTION
The bind system call assigns a name to an unnamed socket. When a socket is
created with the socket system call, it belongs to the address family specified
in the socket call, but has no name assigned yet. The bind system call
requests that name be assigned to the socket.
Note that all named sockets must have unique names. A socket does not have to
have a name before it can make a connection to another socket, and a socket
returned by the accept system call already has a name assigned to it by the
call.
Note: Sockets in the AF_UNIX address family create a name in the file system
name space that must be deleted by the caller (using unlink) when it is
no longer needed.
Note: If the Transparent Computing Facility is installed, socket naming is not
unique across the cluster; each machine has its own name space of
sockets.
RETURN VALUE
Upon successful completion, a value of 0 is returned. If the bind system call
fails, a value of -1 is returned, and errno is set to indicate the error.
ERROR CONDITIONS
The system call fails if one or more of the following are true:
EBADF The s parameter is not valid.
ENOTSOCK The s parameter refers to a file, not a socket.
Processed November 7, 1990 BIND(2,L) 1
BIND(2,L) AIX Technical Reference BIND(2,L)
EADDRNOTAVAIL
The specified address is not available from the local machine.
EADDRINUSE
The specified address is already in use.
EINVAL The socket is already bound to an address.
EACCES The requested address is protected, and the current user does not
have permission to access it.
EFAULT The name parameter points to a location outside of the process's
allocated address space.
EINVAL The namelen parameter exceeds MLEN (see <sys/mbuf.h>).
The following errors are specific to binding names in the AF_UNIX address
family.
ENOTDIR A component of the path name is not a directory.
ENOENT A prefix component of the path name does not exist.
ELOOP A loop of symbolic links was detected.
EIO An I/O error occurred while making the directory entry or allocating
the inode.
EROFS The name would reside in a read-only file system.
EISDIR A null path name was specified.
ENOSPC The file system is out of inodes, or the directory in which the
socket is to be added does not have room for the new entry and cannot
be extended.
EACCES Search permission is denied for a component of the path.
EACCES The directory in which the file is to be created does not permit
writing.
If the Transparent Computing Facility is installed on your system, bind can
also fail if one or more of the following are true:
ESITEDN1 path cannot be accessed because a site went down.
ESITEDN2 The operation was terminated because a site failed.
ENOSTORE path is a name relative to the working directory, but no site which
stores this directory is currently up.
Processed November 7, 1990 BIND(2,L) 2
BIND(2,L) AIX Technical Reference BIND(2,L)
ENOSTORE A component of path is replicated but is not stored on any site which
is currently up.
EROFS Write access is requested for a file on a replicated file system in
which the primary copy is unavailable.
EINTR A signal was caught during the system call.
RELATED INFORMATION
In this book: "connect," "getsockname," "listen," and "socket."
Processed November 7, 1990 BIND(2,L) 3