Print this page
5042 stop using deprecated atomic functions

*** 21,32 **** /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ - #pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/errno.h> #include <sys/systm.h> #include <sys/atomic.h> #include <sys/kmem.h> --- 21,30 ----
*** 79,109 **** if (((uintptr_t)nv) & 0x3) return ((int)set_errno(EINVAL)); } /* * Allocate proc space for saving the addresses to these user ! * trap handlers, which must later be freed. Use casptr to * do this atomically. */ if (p->p_utraps == NULL) { pv = sv = kmem_zalloc((UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *), KM_SLEEP); ! tmp = casptr(&p->p_utraps, NULL, sv); if (tmp != NULL) { kmem_free(pv, (UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *)); } } ASSERT(p->p_utraps != NULL); /* ! * Use casptr to atomically install the handler. */ ov = p->p_utraps[idx]; if (new_handler != (utrap_handler_t)UTRAP_UTH_NOCHANGE) { for (;;) { ! tmp = casptr(&p->p_utraps[idx], ov, nv); if (ov == tmp) break; ov = tmp; } } --- 77,107 ---- if (((uintptr_t)nv) & 0x3) return ((int)set_errno(EINVAL)); } /* * Allocate proc space for saving the addresses to these user ! * trap handlers, which must later be freed. Use atomic_cas_ptr to * do this atomically. */ if (p->p_utraps == NULL) { pv = sv = kmem_zalloc((UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *), KM_SLEEP); ! tmp = atomic_cas_ptr(&p->p_utraps, NULL, sv); if (tmp != NULL) { kmem_free(pv, (UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *)); } } ASSERT(p->p_utraps != NULL); /* ! * Use atomic_cas_ptr to atomically install the handler. */ ov = p->p_utraps[idx]; if (new_handler != (utrap_handler_t)UTRAP_UTH_NOCHANGE) { for (;;) { ! tmp = atomic_cas_ptr(&p->p_utraps[idx], ov, nv); if (ov == tmp) break; ov = tmp; } }
*** 223,253 **** return ((int)set_errno(EINVAL)); } /* * Allocate proc space for saving the addresses to these user ! * trap handlers, which must later be freed. Use casptr to * do this atomically. */ if (p->p_utraps == NULL) { pv = sv = kmem_zalloc((UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *), KM_SLEEP); ! tmp = casptr(&p->p_utraps, NULL, sv); if (tmp != NULL) { kmem_free(pv, (UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *)); } } ASSERT(p->p_utraps != NULL); /* ! * Use casptr to atomically install the handlers. */ ov = p->p_utraps[idx]; if (new_precise != (utrap_handler_t)UTH_NOCHANGE) { for (;;) { ! tmp = casptr(&p->p_utraps[idx], ov, nvp); if (ov == tmp) break; ov = tmp; } } --- 221,251 ---- return ((int)set_errno(EINVAL)); } /* * Allocate proc space for saving the addresses to these user ! * trap handlers, which must later be freed. Use atomic_cas_ptr to * do this atomically. */ if (p->p_utraps == NULL) { pv = sv = kmem_zalloc((UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *), KM_SLEEP); ! tmp = atomic_cas_ptr(&p->p_utraps, NULL, sv); if (tmp != NULL) { kmem_free(pv, (UT_PRECISE_MAXTRAPS+1) * sizeof (utrap_handler_t *)); } } ASSERT(p->p_utraps != NULL); /* ! * Use atomic_cas_ptr to atomically install the handlers. */ ov = p->p_utraps[idx]; if (new_precise != (utrap_handler_t)UTH_NOCHANGE) { for (;;) { ! tmp = atomic_cas_ptr(&p->p_utraps[idx], ov, nvp); if (ov == tmp) break; ov = tmp; } }