📄 ptt_glibc-2.3.5.patch
字号:
+ {+#ifdef PTT_LIBPTHREAD+ /* BARRIER_LOCK_FREE */+ PTT_TRACE (PTT_LEVEL_BARRIER, TR_BARRIER_3, barrier, ibarrier->lock);+#endif /* PTT_LIBPTHREAD */+ lll_unlock (ibarrier->lock);+ } +#ifdef PTT_LIBPTHREAD+ /* BARRIER_DESTROY_OUT */+ PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_4, barrier, result);+#endif /* PTT_LIBPTHREAD */ return result; }diff -Naur ori_glibc/nptl/pthread_barrier_init.c new_glibc/nptl/pthread_barrier_init.c--- ori_glibc/nptl/pthread_barrier_init.c 2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_barrier_init.c 2006-05-16 09:11:52.000000000 +0200@@ -30,8 +30,19 @@ { struct pthread_barrier *ibarrier; +#ifdef PTT_LIBPTHREAD+ /* BARRIER_INIT_IN */+ PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_5, barrier, attr, count); +#endif /* PTT_LIBPTHREAD */+ if (__builtin_expect (count == 0, 0))+ {+#ifdef PTT_LIBPTHREAD+ /* BARRIER_INIT_OUT */+ PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_6, barrier, EINVAL);+#endif /* PTT_LIBPTHREAD */ return EINVAL;+ } if (attr != NULL) {@@ -41,8 +52,14 @@ if (iattr->pshared != PTHREAD_PROCESS_PRIVATE && __builtin_expect (iattr->pshared != PTHREAD_PROCESS_SHARED, 0))+ { /* Invalid attribute. */+#ifdef PTT_LIBPTHREAD+ /* BARRIER_INIT_OUT */+ PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_6, barrier, EINVAL);+#endif /* PTT_LIBPTHREAD */ return EINVAL;+ } } ibarrier = (struct pthread_barrier *) barrier;@@ -53,5 +70,10 @@ ibarrier->init_count = count; ibarrier->curr_event = 0; +#ifdef PTT_LIBPTHREAD+ /* BARRIER_INIT BARRIER_INIT_OUT */+ PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_7, ibarrier, count, barrier, 0);+#endif /* PTT_LIBPTHREAD */+ return 0; }diff -Naur ori_glibc/nptl/pthread_cancel.c new_glibc/nptl/pthread_cancel.c--- ori_glibc/nptl/pthread_cancel.c 2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_cancel.c 2006-03-31 10:28:32.000000000 +0200@@ -30,11 +30,22 @@ pthread_t th; { volatile struct pthread *pd = (volatile struct pthread *) th;+ +#ifdef PTT_LIBPTHREAD+ /* THREAD_CANCEL_IN */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_4, th);+#endif /* PTT_LIBPTHREAD */ /* Make sure the descriptor is valid. */ if (INVALID_TD_P (pd))+ { /* Not a valid thread handle. */+#ifdef PTT_LIBPTHREAD+ /* THREAD_CANCEL_OUT */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_5, ESRCH);+#endif /* PTT_LIBPTHREAD */ return ESRCH;+ } #ifdef SHARED pthread_cancel_init ();@@ -61,6 +72,14 @@ /* Mark the cancellation as "in progress". */ atomic_bit_set (&pd->cancelhandling, CANCELING_BIT); + /* If we put a trace point here...+ thread can be killed... to check */++#ifdef PTT_LIBPTHREAD+ /* THREAD_CANCEL_PROG */+ PTT_TRACE (PTT_LEVEL_THREAD, TR_THREAD_6, th);+#endif /* PTT_LIBPTHREAD */+ /* The cancellation handler will take care of marking the thread as canceled. */ INTERNAL_SYSCALL_DECL (err);@@ -98,6 +117,11 @@ while (atomic_compare_and_exchange_bool_acq (&pd->cancelhandling, newval, oldval)); +#ifdef PTT_LIBPTHREAD+ /* THREAD_STATE_CANCEL, THREAD_CANCEL_OUT */ + PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_7, th, result);+#endif /* PTT_LIBPTHREAD */+ return result; } diff -Naur ori_glibc/nptl/pthread_cond_destroy.c new_glibc/nptl/pthread_cond_destroy.c--- ori_glibc/nptl/pthread_cond_destroy.c 2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_cond_destroy.c 2006-05-16 09:50:48.000000000 +0200@@ -26,19 +26,42 @@ __pthread_cond_destroy (cond) pthread_cond_t *cond; {+#ifdef PTT_LIBPTHREAD+ /* COND_DESTROY_IN, COND_LOCK_REQUIRE, THREAD_STATE_WAIT */+ PTT_TRACE (PTT_LEVEL_COND_IO, TR_COND_1, cond, cond, cond->__data.__lock);+#endif /* PTT_LIBPTHREAD */+ /* Make sure we are alone. */ lll_mutex_lock (cond->__data.__lock);+ +#ifdef PTT_LIBPTHREAD+ /* THREAD_STATE_WAKE, COND_LOCK_TAKEN */+ PTT_TRACE (PTT_LEVEL_COND, TR_COND_2, cond, cond->__data.__lock);+#endif /* PTT_LIBPTHREAD */ if (cond->__data.__total_seq > cond->__data.__wakeup_seq) { /* If there are still some waiters which have not been woken up, this is an application bug. */+#ifdef PTT_LIBPTHREAD+ /* COND_LOCK_FREE */+ PTT_TRACE (PTT_LEVEL_COND, TR_COND_3, cond, cond->__data.__lock); +#endif /* PTT_LIBPTHREAD */ lll_mutex_unlock (cond->__data.__lock);+#ifdef PTT_LIBPTHREAD+ /* COND_DESTROY_OUT */+ PTT_TRACE (PTT_LEVEL_COND_IO, TR_COND_4, cond, EBUSY);+#endif /* PTT_LIBPTHREAD */ return EBUSY; } /* Tell pthread_cond_*wait that this condvar is being destroyed. */ cond->__data.__total_seq = -1ULL;+ +#ifdef PTT_LIBPTHREAD+ /* COND_TOTAL_SEQ_SET */+ PTT_TRACE (PTT_LEVEL_COND, TR_COND_5, cond, (unsigned long long)-1ULL);+#endif /* PTT_LIBPTHREAD */ /* If there are waiters which have been already signalled or broadcasted, but still are using the pthread_cond_t structure,@@ -46,15 +69,37 @@ unsigned int nwaiters = cond->__data.__nwaiters; while (nwaiters >= (1 << COND_CLOCK_BITS)) {+#ifdef PTT_LIBPTHREAD+ /* COND_LOCK_FREE */+ PTT_TRACE (PTT_LEVEL_COND, TR_COND_3, cond, cond->__data.__lock);+#endif /* PTT_LIBPTHREAD */ lll_mutex_unlock (cond->__data.__lock); +#ifdef PTT_LIBPTHREAD+ /* THREAD_STATE_WAIT */+ PTT_TRACE (PTT_LEVEL_COND, TR_THREAD_2);+#endif /* PTT_LIBPTHREAD */ lll_futex_wait (&cond->__data.__nwaiters, nwaiters); +#ifdef PTT_LIBPTHREAD+ /* THREAD_STATE_WAKE, COND_LOCK_REQUIRE */+ PTT_TRACE (PTT_LEVEL_COND, TR_COND_6, cond, cond->__data.__lock);+#endif /* PTT_LIBPTHREAD */+ lll_mutex_lock (cond->__data.__lock); +#ifdef PTT_LIBPTHREAD+ /* COND_LOCK_TAKEN */+ PTT_TRACE (PTT_LEVEL_COND, TR_COND_7, cond, cond->__data.__lock);+#endif /* PTT_LIBPTHREAD */+ nwaiters = cond->__data.__nwaiters; } +#ifdef PTT_LIBPTHREAD+ /* COND_DESTROY, COND_DESTROY_OUT */+ PTT_TRACE (PTT_LEVEL_COND_IO, TR_COND_8, cond, cond, 0);+#endif /* PTT_LIBPTHREAD */ return 0; } versioned_symbol (libpthread, __pthread_cond_destroy,diff -Naur ori_glibc/nptl/pthread_cond_init.c new_glibc/nptl/pthread_cond_init.c--- ori_glibc/nptl/pthread_cond_init.c 2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_cond_init.c 2006-05-16 09:41:37.000000000 +0200@@ -30,6 +30,11 @@ Conditional variables are always usable in multiple processes. */ struct pthread_condattr *icond_attr = (struct pthread_condattr *) cond_attr; +#ifdef PTT_LIBPTHREAD+ /* COND_INIT_IN */+ PTT_TRACE (PTT_LEVEL_COND_IO, TR_COND_9, cond, cond_attr);+#endif /* PTT_LIBPTHREAD */+ cond->__data.__lock = LLL_MUTEX_LOCK_INITIALIZER; cond->__data.__futex = 0; cond->__data.__nwaiters = (icond_attr != NULL@@ -42,6 +47,11 @@ ? NULL : (void *) ~0l); cond->__data.__broadcast_seq = 0; +#ifdef PTT_LIBPTHREAD+ /* COND_INIT, COND_INIT_OUT */+ PTT_TRACE (PTT_LEVEL_COND_IO, TR_COND_10, cond, cond->__data.__mutex,+ (unsigned long long)0, (unsigned int)0, cond, 0);+#endif /* PTT_LIBPTHREAD */ return 0; } versioned_symbol (libpthread, __pthread_cond_init,diff -Naur ori_glibc/nptl/pthread_create.c new_glibc/nptl/pthread_create.c--- ori_glibc/nptl/pthread_create.c 2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_create.c 2006-03-31 10:28:32.000000000 +0200@@ -270,6 +270,11 @@ /* Clean up any state libc stored in thread-local variables. */ __libc_thread_freeres (); +#ifdef PTT_LIBPTHREAD+ /* THREAD_STATE_DEAD */+ PTT_TRACE (PTT_LEVEL_THREAD, TR_THREAD_1);+#endif /* PTT_LIBPTHREAD */+ /* If this is the last thread we terminate the process now. We do not notify the debugger, it might just irritate it if there is no thread left. */@@ -352,6 +357,13 @@ int err; iattr = (struct pthread_attr *) attr;+ +#ifdef PTT_LIBPTHREAD+ /* THREAD_CREATE_IN */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_8, newthread, attr, start_routine,+ arg);+#endif /* PTT_LIBPTHREAD */+ if (iattr == NULL) /* Is this the best idea? On NUMA machines this could mean accessing far-away memory. */@@ -359,10 +371,17 @@ err = ALLOCATE_STACK (iattr, &pd); if (__builtin_expect (err != 0, 0))+ { /* Something went wrong. Maybe a parameter of the attributes is invalid or we could not allocate memory. */+ +#ifdef PTT_LIBPTHREAD+ /* THREAD_CREATE_OUT */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_9, err);+#endif /* PTT_LIBPTHREAD */ return err; + } /* Initialize the TCB. All initializations with zero should be performed in 'get_cached_stack'. This way we avoid doing this if@@ -441,6 +460,11 @@ /* Pass the descriptor to the caller. */ *newthread = (pthread_t) pd;+ +#ifdef PTT_LIBPTHREAD+ /* THREAD_SET_PD */+ PTT_TRACE (PTT_LEVEL_THREAD, TR_THREAD_10, pd);+#endif /* PTT_LIBPTHREAD */ /* Remember whether the thread is detached or not. In case of an error we have to free the stacks of non-detached stillborn@@ -457,9 +481,28 @@ errout: __deallocate_stack (pd); }+ +#ifdef PTT_LIBPTHREAD+ /* THREAD_CREATE_OUT */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_9, err);+#endif /* PTT_LIBPTHREAD */+ return err; } +#ifdef PTT_LIBPTHREAD+ if (is_detached)+ {+ /* THREAD_INIT, THREAD_DETACH, THREAD_CREATE_OUT */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_11, pd, pd->joinid, 0);+ }+ else+ { + /* THREAD_INIT, THREAD_CREATE_OUT */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_12, pd, 0);+ }+#endif /* PTT_LIBPTHREAD */+ return 0; } versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);diff -Naur ori_glibc/nptl/pthread_join.c new_glibc/nptl/pthread_join.c--- ori_glibc/nptl/pthread_join.c 2006-03-31 10:28:23.000000000 +0200+++ new_glibc/nptl/pthread_join.c 2006-03-31 10:28:32.000000000 +0200@@ -39,15 +39,32 @@ struct pthread *self; struct pthread *pd = (struct pthread *) threadid; +#ifdef PTT_LIBPTHREAD+ /* THREAD_JOIN_IN */+ PTT_TRACE (PTT_LEVEL_THREAD_IO, TR_THREAD_13, pd, thread_return);+#endif /* PTT_LIBPTHREAD */+ /* Make sure the descriptor is valid. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -