summaryrefslogtreecommitdiff
path: root/usr/src/lib/libscf/common/lowlevel.c
diff options
context:
space:
mode:
authorraf <none@none>2008-01-23 12:00:31 -0800
committerraf <none@none>2008-01-23 12:00:31 -0800
commita574db851cdc636fc3939b68e80d79fe7fbd57f2 (patch)
tree7a28122042d1d24d9c4df92ba257e2d34d111e2e /usr/src/lib/libscf/common/lowlevel.c
parent4a7ceb24cfcc0a97f96d86cfe5852ae445b50e57 (diff)
downloadillumos-joyent-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/libscf/common/lowlevel.c')
-rw-r--r--usr/src/lib/libscf/common/lowlevel.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/usr/src/lib/libscf/common/lowlevel.c b/usr/src/lib/libscf/common/lowlevel.c
index ce40d0e74f..a9265f9c1c 100644
--- a/usr/src/lib/libscf/common/lowlevel.c
+++ b/usr/src/lib/libscf/common/lowlevel.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -76,14 +77,6 @@ struct _lwp_mutex;
extern int _mutex_held(struct _lwp_mutex *);
#define MUTEX_HELD(m) _mutex_held((struct _lwp_mutex *)(m))
-/*
- * no cancellation, please
- */
-struct _lwp_cond;
-extern int _cond_wait(struct _lwp_cond *, struct _lwp_mutex *);
-#define PTHREAD_COND_WAIT(cv, mx) \
- _cond_wait((struct _lwp_cond *)(cv), (struct _lwp_mutex *)(mx))
-
#ifdef lint
#define assert_nolint(x) (void)0
#else
@@ -108,8 +101,14 @@ handle_hold_subhandles(scf_handle_t *h, int mask)
assert(mask != 0 && (mask & ~RH_HOLD_ALL) == 0);
(void) pthread_mutex_lock(&h->rh_lock);
- while (h->rh_hold_flags != 0 && h->rh_holder != pthread_self())
- (void) PTHREAD_COND_WAIT(&h->rh_cv, &h->rh_lock);
+ while (h->rh_hold_flags != 0 && h->rh_holder != pthread_self()) {
+ int cancel_state;
+
+ (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
+ &cancel_state);
+ (void) pthread_cond_wait(&h->rh_cv, &h->rh_lock);
+ (void) pthread_setcancelstate(cancel_state, NULL);
+ }
if (h->rh_hold_flags == 0)
h->rh_holder = pthread_self();
assert(!(h->rh_hold_flags & mask));
@@ -1029,8 +1028,14 @@ scf_handle_bind(scf_handle_t *handle)
}
/* wait until any active fd users have cleared out */
- while (handle->rh_fd_users > 0)
- (void) PTHREAD_COND_WAIT(&handle->rh_cv, &handle->rh_lock);
+ while (handle->rh_fd_users > 0) {
+ int cancel_state;
+
+ (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,
+ &cancel_state);
+ (void) pthread_cond_wait(&handle->rh_cv, &handle->rh_lock);
+ (void) pthread_setcancelstate(cancel_state, NULL);
+ }
/* check again, since we had to drop the lock */
if (handle_is_bound(handle)) {