diff options
author | raf <none@none> | 2008-01-23 12:00:31 -0800 |
---|---|---|
committer | raf <none@none> | 2008-01-23 12:00:31 -0800 |
commit | a574db851cdc636fc3939b68e80d79fe7fbd57f2 (patch) | |
tree | 7a28122042d1d24d9c4df92ba257e2d34d111e2e /usr/src/lib/libumem/common/vmem.c | |
parent | 4a7ceb24cfcc0a97f96d86cfe5852ae445b50e57 (diff) | |
download | illumos-gate-a574db851cdc636fc3939b68e80d79fe7fbd57f2.tar.gz |
6598890 cancellation code abuses synonyms
--HG--
rename : usr/src/lib/libc/amd64/crt/cerror64.s => deleted_files/usr/src/lib/libc/amd64/crt/cerror64.s
rename : usr/src/lib/libc/port/gen/wait3.c => deleted_files/usr/src/lib/libc/port/gen/wait3.c
rename : usr/src/lib/libc/port/gen/wait4.c => deleted_files/usr/src/lib/libc/port/gen/wait4.c
rename : usr/src/lib/libc/port/sys/fsync.c => deleted_files/usr/src/lib/libc/port/sys/fsync.c
rename : usr/src/lib/libc/sparc/sys/syssun.s => deleted_files/usr/src/lib/libc/sparc/sys/syssun.s
rename : usr/src/lib/libc/common/sys/__fcntl.s => usr/src/lib/libc/common/sys/fcntl.s
rename : usr/src/lib/libc/common/sys/_rename.s => usr/src/lib/libc/common/sys/rename.s
rename : usr/src/lib/libc/port/gen/rename.c => usr/src/lib/libc/port/gen/remove.c
rename : usr/src/lib/libc/port/sys/fcntl.c => usr/src/lib/libc/port/sys/libc_fcntl.c
Diffstat (limited to 'usr/src/lib/libumem/common/vmem.c')
-rw-r--r-- | usr/src/lib/libumem/common/vmem.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/usr/src/lib/libumem/common/vmem.c b/usr/src/lib/libumem/common/vmem.c index 452e4d084f..76b9b5b30d 100644 --- a/usr/src/lib/libumem/common/vmem.c +++ b/usr/src/lib/libumem/common/vmem.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -219,12 +219,6 @@ uint32_t vmem_mtbf; /* mean time between failures [default: off] */ size_t vmem_seg_size = sizeof (vmem_seg_t); /* - * we use the _ version, since we don't want to be cancelled. - * Actually, this is automatically taken care of by including "mtlib.h". - */ -extern int _cond_wait(cond_t *cv, mutex_t *mutex); - -/* * Insert/delete from arena list (type 'a') or next-of-kin list (type 'k'). */ #define VMEM_INSERT(vprev, vsp, type) \ @@ -763,6 +757,8 @@ vmem_nextfit_alloc(vmem_t *vmp, size_t size, int vmflag) break; vsp = vsp->vs_anext; if (vsp == rotor) { + int cancel_state; + /* * We've come full circle. One possibility is that the * there's actually enough space, but the rotor itself @@ -787,7 +783,10 @@ vmem_nextfit_alloc(vmem_t *vmp, size_t size, int vmflag) 0, 0, NULL, NULL, vmflag & VM_UMFLAGS)); } vmp->vm_kstat.vk_wait++; - (void) _cond_wait(&vmp->vm_cv, &vmp->vm_lock); + (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, + &cancel_state); + (void) cond_wait(&vmp->vm_cv, &vmp->vm_lock); + (void) pthread_setcancelstate(cancel_state, NULL); vsp = rotor->vs_anext; } } @@ -855,6 +854,8 @@ vmem_xalloc(vmem_t *vmp, size_t size, size_t align, size_t phase, (void) mutex_lock(&vmp->vm_lock); for (;;) { + int cancel_state; + if (vmp->vm_nsegfree < VMEM_MINFREE && !vmem_populate(vmp, vmflag)) break; @@ -974,7 +975,10 @@ vmem_xalloc(vmem_t *vmp, size_t size, size_t align, size_t phase, if (vmflag & VM_NOSLEEP) break; vmp->vm_kstat.vk_wait++; - (void) _cond_wait(&vmp->vm_cv, &vmp->vm_lock); + (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, + &cancel_state); + (void) cond_wait(&vmp->vm_cv, &vmp->vm_lock); + (void) pthread_setcancelstate(cancel_state, NULL); } if (vbest != NULL) { ASSERT(vbest->vs_type == VMEM_FREE); |