Print this page
5042 stop using deprecated atomic functions
@@ -21,12 +21,10 @@
/*
* 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>
@@ -79,31 +77,31 @@
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
+ * 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 = casptr(&p->p_utraps, NULL, sv);
+ 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 casptr to atomically install the handler.
+ * 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 = casptr(&p->p_utraps[idx], ov, nv);
+ tmp = atomic_cas_ptr(&p->p_utraps[idx], ov, nv);
if (ov == tmp)
break;
ov = tmp;
}
}
@@ -223,31 +221,31 @@
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
+ * 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 = casptr(&p->p_utraps, NULL, sv);
+ 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 casptr to atomically install the handlers.
+ * Use atomic_cas_ptr 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);
+ tmp = atomic_cas_ptr(&p->p_utraps[idx], ov, nvp);
if (ov == tmp)
break;
ov = tmp;
}
}