Alternatively, there could be a magic constructor function value that could specify zero-on-allocate, since PR_ZERO and having a constructor are really mutually-exclusive. int pool_cache_ctor_zero(void *arg __unused, void *obj __unused, int flags __unused) { return 0; } …then in pool_cache_get_paddr(), before “object” is successfully returned: If (__predict_false(pc->pc_ctor == pool_cache_ctor_zero) { memset(object, 0, pp->pp_pool->pr_reqsize); } Could even specify a magic destructor if you want to zero-on-free (e.g. security-sensitive uses). -- thorpej
|