?? ptt_glibc-2.4.patch
字號:
diff -Naur ori_glibc/config.h.in new_glibc/config.h.in--- ori_glibc/config.h.in 2006-04-04 15:11:06.000000000 +0200+++ new_glibc/config.h.in 2006-04-04 16:16:54.000000000 +0200@@ -206,6 +206,13 @@ /* Define if __stack_chk_guard canary should be randomized at program startup. */ #undef ENABLE_STACKGUARD_RANDOMIZE +/* Define if PTT (NPTL trace tool) is available */+#undef PTT_LIBPTHREAD+#undef PTT_NEW_FILES++/* Define if PTT (NPTL trace tool) is available with --with-ptt-trace-info */+#undef PTT_TRACE_INFO+ /* */ diff -Naur ori_glibc/config.make.in new_glibc/config.make.in--- ori_glibc/config.make.in 2006-04-04 15:11:09.000000000 +0200+++ new_glibc/config.make.in 2006-04-04 16:17:18.000000000 +0200@@ -126,5 +126,6 @@ # Additional libraries. LIBGD = @LIBGD@+LIBPTHREAD_PTT = @useptt@ # More variables may be inserted below by configure.diff -Naur ori_glibc/configure new_glibc/configure--- ori_glibc/configure 2006-04-04 15:11:19.000000000 +0200+++ new_glibc/configure 2006-04-04 16:18:27.000000000 +0200@@ -313,7 +313,7 @@ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS'+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS with_fp with_cvs enable_check_abi oldest_abi useptt bindnow force_install all_warnings build build_cpu build_vendor build_os host host_cpu host_vendor host_os subdirs add_ons add_on_subdirs base_machine submachine sysnames sysdeps_add_ons INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT BUILD_CC cross_compiling CPP CXX CXXFLAGS ac_ct_CXX AR OBJDUMP RANLIB ac_ct_RANLIB MIG AS LD PWD_P MAKE MSGFMT MAKEINFO SED AUTOCONF SYSINCLUDES CXX_SYSINCLUDES libc_cv_gcc_static_libgcc BASH libc_cv_have_bash2 KSH libc_cv_have_ksh AWK PERL INSTALL_INFO BISON VERSIONING libc_cv_asm_protected_directive libc_cv_cc_with_libunwind libc_cv_z_nodelete libc_cv_z_nodlopen libc_cv_z_initfirst libc_cv_z_relro libc_cv_Bgroup libc_cv_libgcc_s_suffix libc_cv_as_needed ASFLAGS_config libc_cv_z_combreloc libc_cv_z_execstack libc_cv_fpie fno_unit_at_a_time libc_cv_ssp libc_cv_have_initfini no_whole_archive exceptions LIBGD have_libaudit have_selinux EGREP sizeof_long_double libc_cv_gcc_unwind_find_fde uname_sysname uname_release uname_version old_glibc_headers libc_cv_slibdir libc_cv_localedir libc_cv_sysconfdir libc_cv_rootsbindir libc_cv_forced_unwind use_ldconfig ldd_rewrite_script elf xcoff static shared pic_default profile omitfp bounded static_nss nopic_initfini DEFINES mach_interface_list VERSION RELEASE LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options.@@ -904,6 +904,9 @@ /usr/src/linux/include) [default=compiler default] --with-tls enable support for TLS+ --with-ptt build libpthread.so to trace NPTL+ --with-ptt-trace-info compute information about PTT trace mechanism.+ should be useful only for PTT developers --without-__thread do not use TLS features even when supporting them --with-cpu=CPU select code for CPU variant @@ -1616,6 +1619,46 @@ fi; +# Check whether --with-ptt or --without-ptt was given.+if test "${with_ptt+set}" = set; then+ withval="$with_ptt"+ useptt=$withval+else+ useptt=no+fi;+if test "$useptt" = yes; then+ cat >>confdefs.h <<\_ACEOF+#define PTT_NEW_FILES 1+_ACEOF++ cat >>confdefs.h <<\_ACEOF+#define PTT_LIBPTHREAD 1+_ACEOF++fi++++# Check whether --with-ptt-trace-info or --without-ptt-trace-info was given.+if test "${with_ptt_trace_info+set}" = set; then+ withval="$with_ptt_trace_info"+ useptt_info=$withval+else+ useptt_info=no+fi;+if test "$useptt_info" = yes; then+ if test "$useptt" != yes; then+ { { echo "$as_me:$LINENO: error: can't use --with-ptt-trace-info without --with-ptt" >&5+echo "$as_me: error: can't use --with-ptt-trace-info without --with-ptt" >&2;}+ { (exit 1); exit 1; }; }+ fi+ cat >>confdefs.h <<\_ACEOF+#define PTT_TRACE_INFO 1+_ACEOF++fi++ # Check whether --with-__thread or --without-__thread was given. if test "${with___thread+set}" = set; then withval="$with___thread"@@ -8344,6 +8387,7 @@ s,@with_cvs@,$with_cvs,;t t s,@enable_check_abi@,$enable_check_abi,;t t s,@oldest_abi@,$oldest_abi,;t t+s,@useptt@,$useptt,;t t s,@bindnow@,$bindnow,;t t s,@force_install@,$force_install,;t t s,@all_warnings@,$all_warnings,;t tdiff -Naur ori_glibc/configure.in new_glibc/configure.in--- ori_glibc/configure.in 2006-04-04 15:11:14.000000000 +0200+++ new_glibc/configure.in 2006-04-04 16:16:08.000000000 +0200@@ -185,6 +185,29 @@ [usetls=$withval], [usetls=yes]) +AC_ARG_WITH([ptt],+ AC_HELP_STRING([--with-ptt],+ [build libpthread.so to trace NPTL]),+ [useptt=$withval],+ [useptt=no])+if test "$useptt" = yes; then+ AC_DEFINE(PTT_NEW_FILES)+ AC_DEFINE(PTT_LIBPTHREAD)+fi+AC_SUBST(useptt)++AC_ARG_WITH([ptt-trace-info],+ AC_HELP_STRING([--with-ptt-trace-info],+ [compute information about PTT trace mechanism. should be useful only for PTT developers]),+ [useptt_info=$withval],+ [useptt_info=no])+if test "$useptt_info" = yes; then+ if test "$useptt" != yes; then+ AC_MSG_ERROR([can't use --with-ptt-trace-info without --with-ptt])+ fi+ AC_DEFINE(PTT_TRACE_INFO)+fi+ AC_ARG_WITH([__thread], AC_HELP_STRING([--without-__thread], [do not use TLS features even when supporting them]),diff -Naur ori_glibc/nptl/cancellation.c new_glibc/nptl/cancellation.c--- ori_glibc/nptl/cancellation.c 2006-04-04 15:03:37.000000000 +0200+++ new_glibc/nptl/cancellation.c 2006-04-04 15:03:37.000000000 +0200@@ -88,3 +88,71 @@ oldval = curval; } }++#ifdef PTT_LIBPTHREAD++int+attribute_hidden+__pthread_enable_synccancel (void)+{+ struct pthread *self = THREAD_SELF;+ int oldval = THREAD_GETMEM (self, cancelhandling);++ while (1)+ {+ int newval = oldval & ~CANCELTYPE_BITMASK;++ if (newval == oldval)+ break;++ int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,+ oldval);+ if (__builtin_expect (curval == oldval, 1))+ break;++ /* Prepare the next round. */+ oldval = curval;+ }+ return oldval;+}+++void+internal_function attribute_hidden+__pthread_disable_synccancel (int oldtype)+{+ /* If synchronous cancellation was enabled before we do not have+ anything to do. */+ if (!(oldtype & CANCELTYPE_BITMASK))+ return;++ struct pthread *self = THREAD_SELF;+ int oldval = THREAD_GETMEM (self, cancelhandling);++ while (1)+ {+ int newval = oldval | CANCELTYPE_BITMASK;++ if (newval == oldval)+ break;++ int curval = THREAD_ATOMIC_CMPXCHG_VAL (self, cancelhandling, newval,+ oldval);+ if (__builtin_expect (curval == oldval, 1))+ {+ if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))+ {+ THREAD_SETMEM (self, result, PTHREAD_CANCELED);+ __do_cancel ();+ }++ break;+ }++ /* Prepare the next round. */+ oldval = curval;+ }+}++#endif /* PTT_LIBPTHREAD */+diff -Naur ori_glibc/nptl/init.c new_glibc/nptl/init.c--- ori_glibc/nptl/init.c 2006-04-04 15:06:08.000000000 +0200+++ new_glibc/nptl/init.c 2006-04-11 09:03:41.000000000 +0200@@ -33,6 +33,9 @@ #include <shlib-compat.h> #include <smp.h> #include <lowlevellock.h>+#ifdef PTT_LIBPTHREAD+#include "ptt_module.h"+#endif /* PTT_LIBPTHREAD */ #ifndef __NR_set_tid_address@@ -227,6 +230,17 @@ to give libpthread its own TLS segment just for this. */ extern void **__libc_dl_error_tsd (void) __attribute__ ((const)); +#ifdef PTT_LIBPTHREAD+/* Fork handler */+static void+__fork_handler (void)+{+ extern pid_t ptt_trace_pid;+ ptt_trace_pid = getpid();+ PTT_TRACE (PTT_LEVEL_OTHER, TR_FORK, getppid());+ __reclaim_stacks();+}+#endif /* PTT_LIBPTHREAD */ void __pthread_initialize_minimal_internal (void)@@ -336,12 +350,21 @@ /* Make __rtld_lock_{,un}lock_recursive use pthread_mutex_{,un}lock, keep the lock count from the ld.so implementation. */+#ifdef PTT_LIBPTHREAD+ GL(dl_rtld_lock_recursive) = (void *) INTUSE (__pthread_mutex_lock_nt);+ GL(dl_rtld_unlock_recursive) = (void *) INTUSE (__pthread_mutex_unlock_nt);+ unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__data.__count;+ GL(dl_load_lock).mutex.__data.__count = 0;+ while (rtld_lock_count-- > 0)+ INTUSE (__pthread_mutex_lock_nt) (&GL(dl_load_lock).mutex);+#else /* ! defined(PTT_LIBPTHREAD) */ GL(dl_rtld_lock_recursive) = (void *) INTUSE (__pthread_mutex_lock); GL(dl_rtld_unlock_recursive) = (void *) INTUSE (__pthread_mutex_unlock); unsigned int rtld_lock_count = GL(dl_load_lock).mutex.__data.__count; GL(dl_load_lock).mutex.__data.__count = 0; while (rtld_lock_count-- > 0) INTUSE (__pthread_mutex_lock) (&GL(dl_load_lock).mutex);+#endif /* PTT_LIBPTHREAD */ GL(dl_make_stack_executable_hook) = &__make_stacks_executable; #endif@@ -352,8 +375,13 @@ #ifndef TLS_MULTIPLE_THREADS_IN_TCB __libc_multiple_threads_ptr = #endif+#ifdef PTT_LIBPTHREAD+ __libc_pthread_init (&__fork_generation, __fork_handler,+ ptr_pthread_functions);+#else /* ! defined(PTT_LIBPTHREAD) */ __libc_pthread_init (&__fork_generation, __reclaim_stacks, ptr_pthread_functions);+#endif /* PTT_LIBPTHREAD */ /* Determine whether the machine is SMP or not. */ __is_smp = is_smp_system ();diff -Naur ori_glibc/nptl/Makefile new_glibc/nptl/Makefile--- ori_glibc/nptl/Makefile 2006-04-04 15:06:15.000000000 +0200+++ new_glibc/nptl/Makefile 2006-04-11 09:06:20.000000000 +0200@@ -271,6 +271,13 @@ include ../Makeconfig +ifeq ($(LIBPTHREAD_PTT),yes)+gen-as-const-headers += ptt_point.sym+libpthread-routines += pthread_mutex_lock_nt pthread_mutex_unlock_nt \+ shm_open shm_unlink \+ ptt_module+endif+ ifeq ($(have-forced-unwind),yes) tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \ tst-cancelx6 tst-cancelx7 tst-cancelx8 tst-cancelx9 tst-cancelx10 \diff -Naur ori_glibc/nptl/pthread_barrier_destroy.c new_glibc/nptl/pthread_barrier_destroy.c--- ori_glibc/nptl/pthread_barrier_destroy.c 2006-04-04 15:03:37.000000000 +0200+++ new_glibc/nptl/pthread_barrier_destroy.c 2006-05-16 09:17:36.000000000 +0200@@ -31,14 +31,41 @@ ibarrier = (struct pthread_barrier *) barrier; +#ifdef PTT_LIBPTHREAD+ /* BARRIER_DESTROY_IN, BARRIER_LOCK_REQUIRE, THREAD_STATE_WAIT */+ PTT_TRACE (PTT_LEVEL_BARRIER_IO, TR_BARRIER_1, barrier, barrier,+ ibarrier->lock);+#endif /* PTT_LIBPTHREAD */+ lll_lock (ibarrier->lock);+#ifdef PTT_LIBPTHREAD+ /* THREAD_STATE_WAKE, BARRIER_LOCK_TAKEN */+ PTT_TRACE (PTT_LEVEL_BARRIER, TR_BARRIER_2, barrier, ibarrier->lock);+#endif /* PTT_LIBPTHREAD */ if (__builtin_expect (ibarrier->left == ibarrier->init_count, 1))+ { /* The barrier is not used anymore. */+#ifdef PTT_LIBPTHREAD+ /* TR_BARRIER_DESTROY */+ PTT_TRACE (PTT_LEVEL_BARRIER, TR_BARRIER_13, barrier);+#endif /* PTT_LIBPTHREAD */ result = 0;+ } else /* Still used, return with an error. */+ {+#ifdef PTT_LIBPTHREAD+ /* BARRIER_LOCK_FREE */+ PTT_TRACE (PTT_LEVEL_BARRIER, TR_BARRIER_3, barrier, ibarrier->lock);+#endif /* PTT_LIBPTHREAD */+ lll_unlock (ibarrier->lock);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -