* thread.cc (pthread_mutex::is_good_initializer_or_bad_object): Delete.
(pthread_cond::is_good_initializer_or_bad_object): Delete. (pthread_rwlock::is_good_initializer_or_bad_object): Delete. (pthread_cond::init): Remove disabled code. Guard assignment to object to initialize against access violation. (pthread_rwlock::init): Ditto. (pthread_mutex::init): Ditto.
This commit is contained in:
parent
81010d21e6
commit
f352ebca02
@ -1,3 +1,13 @@
|
|||||||
|
2006-03-22 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* thread.cc (pthread_mutex::is_good_initializer_or_bad_object): Delete.
|
||||||
|
(pthread_cond::is_good_initializer_or_bad_object): Delete.
|
||||||
|
(pthread_rwlock::is_good_initializer_or_bad_object): Delete.
|
||||||
|
(pthread_cond::init): Remove disabled code. Guard assignment to
|
||||||
|
object to initialize against access violation.
|
||||||
|
(pthread_rwlock::init): Ditto.
|
||||||
|
(pthread_mutex::init): Ditto.
|
||||||
|
|
||||||
2006-03-22 Eric Blake <ebb9@byu.net>
|
2006-03-22 Eric Blake <ebb9@byu.net>
|
||||||
|
|
||||||
* fhandler.cc (fcntl): Print flags in hex.
|
* fhandler.cc (fcntl): Print flags in hex.
|
||||||
|
@ -194,17 +194,6 @@ pthread_mutex::is_good_initializer_or_object (pthread_mutex_t const *mutex)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
|
||||||
pthread_mutex::is_good_initializer_or_bad_object (pthread_mutex_t const *mutex)
|
|
||||||
{
|
|
||||||
if (verifyable_object_isvalid (mutex, PTHREAD_MUTEX_MAGIC,
|
|
||||||
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
|
|
||||||
PTHREAD_NORMAL_MUTEX_INITIALIZER_NP,
|
|
||||||
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP) == VALID_OBJECT)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
pthread_mutex::can_be_unlocked (pthread_mutex_t const *mutex)
|
pthread_mutex::can_be_unlocked (pthread_mutex_t const *mutex)
|
||||||
{
|
{
|
||||||
@ -260,14 +249,6 @@ pthread_cond::is_good_initializer_or_object (pthread_cond_t const *cond)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
|
||||||
pthread_cond::is_good_initializer_or_bad_object (pthread_cond_t const *cond)
|
|
||||||
{
|
|
||||||
if (verifyable_object_isvalid (cond, PTHREAD_COND_MAGIC, PTHREAD_COND_INITIALIZER) == VALID_OBJECT)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* RW locks */
|
/* RW locks */
|
||||||
inline bool
|
inline bool
|
||||||
pthread_rwlock::is_good_object (pthread_rwlock_t const *rwlock)
|
pthread_rwlock::is_good_object (pthread_rwlock_t const *rwlock)
|
||||||
@ -293,14 +274,6 @@ pthread_rwlock::is_good_initializer_or_object (pthread_rwlock_t const *rwlock)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
|
||||||
pthread_rwlock::is_good_initializer_or_bad_object (pthread_rwlock_t const *rwlock)
|
|
||||||
{
|
|
||||||
if (verifyable_object_isvalid (rwlock, PTHREAD_RWLOCK_MAGIC, PTHREAD_RWLOCK_INITIALIZER) == VALID_OBJECT)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
semaphore::is_good_object (sem_t const * sem)
|
semaphore::is_good_object (sem_t const * sem)
|
||||||
{
|
{
|
||||||
@ -2543,22 +2516,13 @@ pthread_cond_destroy (pthread_cond_t *cond)
|
|||||||
int
|
int
|
||||||
pthread_cond::init (pthread_cond_t *cond, const pthread_condattr_t *attr)
|
pthread_cond::init (pthread_cond_t *cond, const pthread_condattr_t *attr)
|
||||||
{
|
{
|
||||||
|
|
||||||
pthread_cond_t new_cond;
|
pthread_cond_t new_cond;
|
||||||
|
|
||||||
if (attr && !pthread_condattr::is_good_object (attr))
|
if (attr && !pthread_condattr::is_good_object (attr))
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
cond_initialization_lock.lock ();
|
cond_initialization_lock.lock ();
|
||||||
#if 0
|
|
||||||
/* Disabled since recognition of a valid object doesn't work reliably
|
|
||||||
if the object is uninitialized. */
|
|
||||||
if (!is_good_initializer_or_bad_object (cond))
|
|
||||||
{
|
|
||||||
cond_initialization_lock.unlock ();
|
|
||||||
return EBUSY;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
new_cond = new pthread_cond (attr ? (*attr) : NULL);
|
new_cond = new pthread_cond (attr ? (*attr) : NULL);
|
||||||
if (!is_good_object (&new_cond))
|
if (!is_good_object (&new_cond))
|
||||||
{
|
{
|
||||||
@ -2567,6 +2531,14 @@ pthread_cond::init (pthread_cond_t *cond, const pthread_condattr_t *attr)
|
|||||||
return EAGAIN;
|
return EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myfault efault;
|
||||||
|
if (efault.faulted ())
|
||||||
|
{
|
||||||
|
delete new_cond;
|
||||||
|
cond_initialization_lock.unlock ();
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
*cond = new_cond;
|
*cond = new_cond;
|
||||||
cond_initialization_lock.unlock ();
|
cond_initialization_lock.unlock ();
|
||||||
|
|
||||||
@ -2733,15 +2705,7 @@ pthread_rwlock::init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
rwlock_initialization_lock.lock ();
|
rwlock_initialization_lock.lock ();
|
||||||
#if 0
|
|
||||||
/* Disabled since recognition of a valid object doesn't work reliably
|
|
||||||
if the object is uninitialized. */
|
|
||||||
if (!is_good_initializer_or_bad_object (rwlock))
|
|
||||||
{
|
|
||||||
rwlock_initialization_lock.unlock ();
|
|
||||||
return EBUSY;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
new_rwlock = new pthread_rwlock (attr ? (*attr) : NULL);
|
new_rwlock = new pthread_rwlock (attr ? (*attr) : NULL);
|
||||||
if (!is_good_object (&new_rwlock))
|
if (!is_good_object (&new_rwlock))
|
||||||
{
|
{
|
||||||
@ -2750,6 +2714,14 @@ pthread_rwlock::init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr
|
|||||||
return EAGAIN;
|
return EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myfault efault;
|
||||||
|
if (efault.faulted ())
|
||||||
|
{
|
||||||
|
delete new_rwlock;
|
||||||
|
rwlock_initialization_lock.unlock ();
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
*rwlock = new_rwlock;
|
*rwlock = new_rwlock;
|
||||||
rwlock_initialization_lock.unlock ();
|
rwlock_initialization_lock.unlock ();
|
||||||
|
|
||||||
@ -2913,15 +2885,7 @@ pthread_mutex::init (pthread_mutex_t *mutex,
|
|||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
mutex_initialization_lock.lock ();
|
mutex_initialization_lock.lock ();
|
||||||
#if 0
|
|
||||||
/* Disabled since recognition of a valid object doesn't work reliably
|
|
||||||
if the object is uninitialized. */
|
|
||||||
if (!is_good_initializer_or_bad_object (mutex))
|
|
||||||
{
|
|
||||||
mutex_initialization_lock.unlock ();
|
|
||||||
return EBUSY;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
new_mutex = new pthread_mutex (attr ? (*attr) : NULL);
|
new_mutex = new pthread_mutex (attr ? (*attr) : NULL);
|
||||||
if (!is_good_object (&new_mutex))
|
if (!is_good_object (&new_mutex))
|
||||||
{
|
{
|
||||||
@ -2940,6 +2904,14 @@ pthread_mutex::init (pthread_mutex_t *mutex,
|
|||||||
new_mutex->type = PTHREAD_MUTEX_ERRORCHECK;
|
new_mutex->type = PTHREAD_MUTEX_ERRORCHECK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myfault efault;
|
||||||
|
if (efault.faulted ())
|
||||||
|
{
|
||||||
|
delete new_mutex;
|
||||||
|
mutex_initialization_lock.unlock ();
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
*mutex = new_mutex;
|
*mutex = new_mutex;
|
||||||
mutex_initialization_lock.unlock ();
|
mutex_initialization_lock.unlock ();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user