FreeBSD/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c
/*
 * Accept a connection.  Essentially all the work is done at higher levels;
 * just return the address of the peer, storing through addr.
 *
 *
 * XXX This is broken XXX
 * 
 * The rationale for acquiring the sdp lock here is somewhat complicated,
 * and is described in detail in the commit log entry for r175612.  Acquiring
 * it delays an accept(2) racing with sonewconn(), which inserts the socket
 * before the address/port fields are initialized.  A better fix would
 * prevent the socket from being placed in the listen queue until all fields
 * are fully initialized.
 */
Accept a connection.  Essentially all the work is done at higher levels;
just return the address of the peer, storing through addr.

XXX This is broken XXX

The rationale for acquiring the sdp lock here is somewhat complicated,
and is described in detail in the commit log entry for r175612.  Acquiring
it delays an accept(2) racing with sonewconn(), which inserts the socket
before the address/port fields are initialized.  A better fix would
prevent the socket from being placed in the listen queue until all fields
are fully initialized.
Accept a connection . Essentially all the work is done at higher levels ; just return the address of the peer storing through addr . XXX This is broken XXX The rationale for acquiring the sdp lock here is somewhat complicated and is described in detail in the commit log entry for r175612 . Acquiring it delays an accept ( 2 ) racing with sonewconn () which inserts the socket before the address / port fields are initialized . A better fix would prevent the socket from being placed in the listen queue until all fields are fully initialized .
static int
sdp_accept(struct socket *so, struct sockaddr **nam)
{
	struct sdp_sock *ssk = NULL;
	struct in_addr addr;
	in_port_t port;
	int error;
	if (so->so_state & SS_ISDISCONNECTED)
		return (ECONNABORTED);
	port = 0;
	addr.s_addr = 0;
	error = 0;
	ssk = sdp_sk(so);
	SDP_WLOCK(ssk);
	if (ssk->flags & (SDP_TIMEWAIT | SDP_DROPPED)) {
		error = ECONNABORTED;
		goto out;
	}
	port = ssk->fport;
	addr.s_addr = ssk->faddr;
out:
	SDP_WUNLOCK(ssk);
	if (error == 0)
		*nam = sdp_sockaddr(port, &addr);
	return error;
}
static int sdp_accept ( struct socket * so , struct sockaddr * * nam ) { struct sdp_sock * ssk = NULL ; struct in_addr addr ; in_port_t port ; int error ; if ( so -> so_state & SS_ISDISCONNECTED ) return ( ECONNABORTED ) ; port = 0 ; addr . s_addr = 0 ; error = 0 ; ssk = sdp_sk ( so ) ; SDP_WLOCK ( ssk ) ; if ( ssk -> flags & ( SDP_TIMEWAIT | SDP_DROPPED ) ) { error = ECONNABORTED ; goto out ; } port = ssk -> fport ; addr . s_addr = ssk -> faddr ; out : SDP_WUNLOCK ( ssk ) ; if ( error == 0 ) * nam = sdp_sockaddr ( port , & addr ) ; return error ; }
Accept a connection.
Accept a connection .