Print this page
5045 use atomic_{inc,dec}_* instead of atomic_add_*
*** 85,95 ****
extern size_t max_vnode_path;
void
klpd_rele(klpd_reg_t *p)
{
! if (atomic_add_32_nv(&p->klpd_ref, -1) == 0) {
if (p->klpd_refp != NULL)
klpd_unlink(p);
if (p->klpd_cred != NULL)
crfree(p->klpd_cred);
door_ki_rele(p->klpd_door);
--- 85,95 ----
extern size_t max_vnode_path;
void
klpd_rele(klpd_reg_t *p)
{
! if (atomic_dec_32_nv(&p->klpd_ref) == 0) {
if (p->klpd_refp != NULL)
klpd_unlink(p);
if (p->klpd_cred != NULL)
crfree(p->klpd_cred);
door_ki_rele(p->klpd_door);
*** 114,124 ****
static void
klpd_hold(klpd_reg_t *p)
{
! atomic_add_32(&p->klpd_ref, 1);
}
/*
* Remove registration from where it is registered. Returns next in list.
*/
--- 114,124 ----
static void
klpd_hold(klpd_reg_t *p)
{
! atomic_inc_32(&p->klpd_ref);
}
/*
* Remove registration from where it is registered. Returns next in list.
*/
*** 348,358 ****
* restructured not to call with any of the locks held and
* no policies operate by default on most processes.
*/
if (mutex_owned(&pidlock) || mutex_owned(&curproc->p_lock) ||
mutex_owned(&curproc->p_crlock)) {
! atomic_add_32(&klpd_bad_locks, 1);
return (-1);
}
/*
* Enforce the limit set for the call process (still).
--- 348,358 ----
* restructured not to call with any of the locks held and
* no policies operate by default on most processes.
*/
if (mutex_owned(&pidlock) || mutex_owned(&curproc->p_lock) ||
mutex_owned(&curproc->p_crlock)) {
! atomic_inc_32(&klpd_bad_locks);
return (-1);
}
/*
* Enforce the limit set for the call process (still).
*** 672,688 ****
}
void
crklpd_hold(credklpd_t *crkpd)
{
! atomic_add_32(&crkpd->crkl_ref, 1);
}
void
crklpd_rele(credklpd_t *crkpd)
{
! if (atomic_add_32_nv(&crkpd->crkl_ref, -1) == 0) {
if (crkpd->crkl_reg != NULL)
klpd_rele(crkpd->crkl_reg);
mutex_destroy(&crkpd->crkl_lock);
kmem_free(crkpd, sizeof (*crkpd));
}
--- 672,688 ----
}
void
crklpd_hold(credklpd_t *crkpd)
{
! atomic_inc_32(&crkpd->crkl_ref);
}
void
crklpd_rele(credklpd_t *crkpd)
{
! if (atomic_dec_32_nv(&crkpd->crkl_ref) == 0) {
if (crkpd->crkl_reg != NULL)
klpd_rele(crkpd->crkl_reg);
mutex_destroy(&crkpd->crkl_lock);
kmem_free(crkpd, sizeof (*crkpd));
}