FreeBSD/sys/net/raw_cb.c
/*
 * Allocate a control block and a nominal amount of buffer space for the
 * socket.
 */
Allocate a control block and a nominal amount of buffer space for the
socket.
Allocate a control block and a nominal amount of buffer space for the socket .
int
raw_attach(struct socket *so, int proto)
{
	struct rawcb *rp = sotorawcb(so);
	int error;
	KASSERT(rp != NULL, ("raw_attach: rp == NULL"));
	error = soreserve(so, raw_sendspace, raw_recvspace);
	if (error)
		return (error);
	rp->rcb_socket = so;
	rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family;
	rp->rcb_proto.sp_protocol = proto;
	mtx_lock(&rawcb_mtx);
	LIST_INSERT_HEAD(&V_rawcb_list, rp, list);
	mtx_unlock(&rawcb_mtx);
	return (0);
}
int raw_attach ( struct socket * so , int proto ) { struct rawcb * rp = sotorawcb ( so ) ; int error ; KASSERT ( rp != NULL , ( " " ) ) ; error = soreserve ( so , raw_sendspace , raw_recvspace ) ; if ( error ) return ( error ) ; rp -> rcb_socket = so ; rp -> rcb_proto . sp_family = so -> so_proto -> pr_domain -> dom_family ; rp -> rcb_proto . sp_protocol = proto ; mtx_lock ( & rawcb_mtx ) ; LIST_INSERT_HEAD ( & V_rawcb_list , rp , list ) ; mtx_unlock ( & rawcb_mtx ) ; return ( 0 ) ; }
Allocate a control block and a nominal amount of buffer space for the
 socket.
Allocate a control block and a nominal amount of buffer space for the socket .
/*
	 * It is assumed that raw_attach is called after space has been
	 * allocated for the rawcb; consumer protocols may simply allocate
	 * type struct rawcb, or a wrapper data structure that begins with a
	 * struct rawcb.
	 */