FreeBSD/sys/dev/hwpmc/hwpmc_mod.c
/*
 * allocate a 'struct pmc_owner' descriptor in the owner hash table.
 */
allocate a 'struct pmc_owner' descriptor in the owner hash table.
allocate a ' struct pmc_owner ' descriptor in the owner hash table .
static struct pmc_owner *
pmc_allocate_owner_descriptor(struct proc *p)
{
	uint32_t hindex;
	struct pmc_owner *po;
	struct pmc_ownerhash *poh;
	hindex = PMC_HASH_PTR(p, pmc_ownerhashmask);
	poh = &pmc_ownerhash[hindex];
	po = malloc(sizeof(struct pmc_owner), M_PMC, M_WAITOK|M_ZERO);
	po->po_owner = p;
	LIST_INSERT_HEAD(poh, po, po_next); 
	TAILQ_INIT(&po->po_logbuffers);
	mtx_init(&po->po_mtx, "pmc-owner-mtx", "pmc-per-proc", MTX_SPIN);
	PMCDBG4(OWN,ALL,1, "allocate-owner proc=%p (%d, %s) pmc-owner=%p",
	    p, p->p_pid, p->p_comm, po);
	return po;
}
static struct pmc_owner * pmc_allocate_owner_descriptor ( struct proc * p ) { uint32_t hindex ; struct pmc_owner * po ; struct pmc_ownerhash * poh ; hindex = PMC_HASH_PTR ( p , pmc_ownerhashmask ) ; poh = & pmc_ownerhash [ hindex ] ; po = malloc ( sizeof ( struct pmc_owner ) , M_PMC , M_WAITOK | M_ZERO ) ; po -> po_owner = p ; LIST_INSERT_HEAD ( poh , po , po_next ) ; TAILQ_INIT ( & po -> po_logbuffers ) ; mtx_init ( & po -> po_mtx , " " , " " , MTX_SPIN ) ; PMCDBG4 ( OWN , ALL , 1 , " " , p , p -> p_pid , p -> p_comm , po ) ; return po ; }
allocate a 'struct pmc_owner' descriptor in the owner hash table.
allocate a ' struct pmc_owner ' descriptor in the owner hash table .
/* allocate space for N pointers and one descriptor struct */ /* insert into hash table */