FreeBSD/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
/*
 * Allocate a local address for the socket.
 */
Allocate a local address for the socket.
Allocate a local address for the socket .
static int
sdp_bind(struct socket *so, struct sockaddr *nam, struct thread *td)
{
	int error = 0;
	struct sdp_sock *ssk;
	struct sockaddr_in *sin;
	sin = (struct sockaddr_in *)nam;
	if (nam->sa_len != sizeof (*sin))
		return (EINVAL);
	if (sin->sin_family != AF_INET)
		return (EINVAL);
	if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
		return (EAFNOSUPPORT);
	ssk = sdp_sk(so);
	SDP_WLOCK(ssk);
	if (ssk->flags & (SDP_TIMEWAIT | SDP_DROPPED)) {
		error = EINVAL;
		goto out;
	}
	error = sdp_pcbbind(ssk, nam, td->td_ucred);
out:
	SDP_WUNLOCK(ssk);
	return (error);
}
static int sdp_bind ( struct socket * so , struct sockaddr * nam , struct thread * td ) { int error = 0 ; struct sdp_sock * ssk ; struct sockaddr_in * sin ; sin = ( struct sockaddr_in * ) nam ; if ( nam -> sa_len != sizeof ( * sin ) ) return ( EINVAL ) ; if ( sin -> sin_family != AF_INET ) return ( EINVAL ) ; if ( IN_MULTICAST ( ntohl ( sin -> sin_addr . s_addr ) ) ) return ( EAFNOSUPPORT ) ; ssk = sdp_sk ( so ) ; SDP_WLOCK ( ssk ) ; if ( ssk -> flags & ( SDP_TIMEWAIT | SDP_DROPPED ) ) { error = EINVAL ; goto out ; } error = sdp_pcbbind ( ssk , nam , td -> td_ucred ) ; out : SDP_WUNLOCK ( ssk ) ; return ( error ) ; }
Allocate a local address for the socket.
Allocate a local address for the socket .