=================================================================== RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/machdep/unistd-i386-linux-1.0.h,v retrieving revision 1.1 diff -r1.1 unistd-i386-linux-1.0.h 56a57,61 > #define R_OK 4 /* Test for read permission. */ > #define W_OK 2 /* Test for write permission. */ > #define X_OK 1 /* Test for execute permission. */ > #define F_OK 0 /* Test for existence. */ > =================================================================== RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/cond.c,v retrieving revision 1.50.2.3 diff -r1.50.2.3 cond.c 74,76d73 < if (cond->c_flags & COND_FLAGS_INITED) { < return(EBUSY); < } 80a78 > =================================================================== RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/fd_kern.c,v retrieving revision 1.50.2.2.2.1 diff -r1.50.2.2.2.1 fd_kern.c 511a512,514 > > #undef creat > =================================================================== RCS file: /afs/sipb.mit.edu/project/pthreads/src/CVS/pthreads/pthreads/mutex.c,v retrieving revision 1.50.2.1 diff -r1.50.2.1 mutex.c 56a57,74 > * mutex_is_debug() > */ > int debug_mutex_count = 0; > static pthread_mutex_t ** debug_mutex_ptrs = NULL; > > static inline mutex_is_debug(pthread_mutex_t * mutex) > { > int i; > > for (i = 0; i < debug_mutex_count; i++) { > if (debug_mutex_ptrs[i] == mutex) { > return(i); > } > } > return(NOTOK); > } > > /* ========================================================================== 74,77d91 < if (mutex->m_flags & MUTEX_FLAGS_INITED) { < return(EBUSY); < } < mutex->m_type = mutex_attr->m_type; 82,86d95 < lock = &(mutex->m_lock); < while (SEMAPHORE_TEST_AND_SET(lock)) { < pthread_yield(); < } < 89d97 < SEMAPHORE_RESET(lock); 95,96c103,113 < if (mutex->m_flags & MUTEX_FLAGS_INITED) { < SEMAPHORE_RESET(lock); --- > if (mutex_is_debug(mutex) == NOTOK) { > pthread_mutex_t ** new; > > if ((new = (pthread_mutex_t **)realloc(debug_mutex_ptrs, > (debug_mutex_count + 1) * (sizeof(pthread_mutex_t *)))) == NULL) { > SET_ERRNO(ENOMEM); > return(ENOMEM); > } > debug_mutex_ptrs = new; > debug_mutex_ptrs[debug_mutex_count++] = mutex; > } else { 101d117 < SEMAPHORE_RESET(lock); 111a128 > lock = &(mutex->m_lock); 121a139 > int i; 137c155 < if (!(mutex->m_flags & MUTEX_FLAGS_INITED)) { --- > if ((i = mutex_is_debug(mutex)) == NOTOK) { 144a163,166 > > /* Remove the mutex from the list of debug mutexes */ > debug_mutex_ptrs[i] = debug_mutex_ptrs[--debug_mutex_count]; > debug_mutex_ptrs[debug_mutex_count] = NULL; 188c210 < if (mutex->m_flags & MUTEX_FLAGS_INITED) { --- > if (mutex_is_debug(mutex) != NOTOK) { 242c264 < if (mutex->m_flags & MUTEX_FLAGS_INITED) { --- > if (mutex_is_debug(mutex) != NOTOK) { 314,318c336,350 < if (mutex->m_owner == pthread_run) { < if (pthread = pthread_queue_get(&mutex->m_queue)) { < plock = &(pthread->lock); < while (SEMAPHORE_TEST_AND_SET(plock)) { < pthread_yield(); --- > if (mutex_is_debug(mutex) != NOTOK) { > if (mutex->m_owner == pthread_run) { > if (pthread = pthread_queue_get(&mutex->m_queue)) { > plock = &(pthread->lock); > while (SEMAPHORE_TEST_AND_SET(plock)) { > pthread_yield(); > } > mutex->m_owner = pthread; > > /* Reset pthread state */ > pthread_queue_deq(&mutex->m_queue); > pthread->state = PS_RUNNING; > SEMAPHORE_RESET(plock); > } else { > mutex->m_owner = NULL; 320,325c352 < mutex->m_owner = pthread; < < /* Reset pthread state */ < pthread_queue_deq(&mutex->m_queue); < pthread->state = PS_RUNNING; < SEMAPHORE_RESET(plock); --- > rval = OK; 327c354 < mutex->m_owner = NULL; --- > rval = EPERM; 329d355 < rval = OK; 331c357 < rval = EPERM; --- > rval = EINVAL;