summaryrefslogtreecommitdiff
path: root/usr/src/lib/libscf
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
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')
-rw-r--r--usr/src/lib/libscf/common/lowlevel.c29
-rw-r--r--usr/src/lib/libscf/common/scf_type.c15
2 files changed, 26 insertions, 18 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)) {
diff --git a/usr/src/lib/libscf/common/scf_type.c b/usr/src/lib/libscf/common/scf_type.c
index 02067f2571..a8aed09f5a 100644
--- a/usr/src/lib/libscf/common/scf_type.c
+++ b/usr/src/lib/libscf/common/scf_type.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -19,16 +18,20 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
+#ifndef NATIVE_BUILD
+#include "c_synonyms.h"
+#endif
+
#include <repcache_protocol.h>
#include "scf_type.h"
-
#include <errno.h>
#include <libgen.h>
#include <libscf_priv.h>
@@ -195,7 +198,7 @@ valid_uri(const char *str)
return (0);
if (regex(exp, str, uri[URI_SCHEME], uri[URI_AUTHORITY], uri[URI_PATH],
- uri[URI_QUERY], uri[URI_FRAGMENT]) == NULL) {
+ uri[URI_QUERY], uri[URI_FRAGMENT]) == NULL) {
return (0);
}
/*