This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.15-1057-g1755728


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  17557282082870c7168d4bd9f386523c8c60d729 (commit)
       via  5acf7263d52992ce4144e0a3b3644985b9e792b4 (commit)
       via  8422c9a560e6e3c854739c8a13ecb1c6714f930f (commit)
       via  3a097cc7a18309c864186c1b864b90889d2a45e9 (commit)
      from  21708942c9b115a91dc03318a5f9e14328c5a71e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=17557282082870c7168d4bd9f386523c8c60d729

commit 17557282082870c7168d4bd9f386523c8c60d729
Author: Rayson Ho <rho@redhat.com>
Date:   Wed Feb 23 11:30:55 2011 -0800

    i386 port of the pthread SystemTap probes

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 9b63c53..a488ccb 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,4 +1,17 @@
 2012-05-25  Rayson Ho  <rho@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/lowlevellock.h: Low-level SystemTap
+	probes for i386.
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
+
+2012-05-25  Rayson Ho  <rho@redhat.com>
 	    Roland McGrath  <roland@hack.frob.com>
 
 	* DESIGN-systemtap-probes.txt: New file.
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index fe6d4b6..7c3212c 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004,2006,2007,2009,2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -21,6 +21,8 @@
 #include <kernel-features.h>
 #include <lowlevellock.h>
 
+#include <stap-probe.h>
+
 	.text
 
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -90,7 +92,8 @@ __lll_lock_wait_private:
 	cmpl	%edx, %eax	/* NB:	 %edx == 2 */
 	jne 2f
 
-1:	movl	$SYS_futex, %eax
+1:	LIBC_PROBE (lll_lock_wait_private, 1, %ebx)
+	movl	$SYS_futex, %eax
 	ENTER_KERNEL
 
 2:	movl	%edx, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
index 71a6686..99f9bc9 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2006,2007,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,6 +23,7 @@
 #include <kernel-features.h>
 #include <pthread-pi-defines.h>
 #include <pthread-errnos.h>
+#include <stap-probe.h>
 
 	.text
 
@@ -48,6 +49,8 @@ __pthread_cond_broadcast:
 
 	movl	20(%esp), %ebx
 
+	LIBC_PROBE (cond_broadcast, 1, %edx)
+
 	/* Get internal lock.  */
 	movl	$1, %edx
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
index 2af611a..e204805 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2005,2007,2009,2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,7 +23,7 @@
 #include <kernel-features.h>
 #include <pthread-pi-defines.h>
 #include <pthread-errnos.h>
-
+#include <stap-probe.h>
 
 	.text
 
@@ -44,6 +44,8 @@ __pthread_cond_signal:
 
 	movl	12(%esp), %edi
 
+	LIBC_PROBE (cond_signal, 1, %edi)
+
 	/* Get internal lock.  */
 	movl	$1, %edx
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index ff3da37..8170ab3 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004,2006-2007,2009,2010 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,7 +23,7 @@
 #include <pthread-errnos.h>
 #include <pthread-pi-defines.h>
 #include <kernel-features.h>
-
+#include <stap-probe.h>
 
 	.text
 
@@ -60,6 +60,8 @@ __pthread_cond_timedwait:
 	movl	20(%esp), %ebx
 	movl	28(%esp), %ebp
 
+	LIBC_PROBE (cond_timedwait, 3, %ebx, 24(%esp), %ebp)
+
 	cmpl	$1000000000, 4(%ebp)
 	movl	$EINVAL, %eax
 	jae	18f
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index 1d7e751..2ae7af2 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002-2004,2006-2007,2009,2010,2012
-   Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -25,6 +24,7 @@
 #include <pthread-errnos.h>
 #include <pthread-pi-defines.h>
 #include <kernel-features.h>
+#include <stap-probe.h>
 
 
 	.text
@@ -61,6 +61,8 @@ __pthread_cond_wait:
 	xorl	%esi, %esi
 	movl	20(%esp), %ebx
 
+	LIBC_PROBE (cond_wait, 2, 24(%esp), %ebx)
+
 	/* Get internal lock.  */
 	movl	$1, %edx
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
index 156fce8..ebbe809 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -22,6 +22,7 @@
 #include <pthread-errnos.h>
 #include <kernel-features.h>
 
+#include <stap-probe.h>
 
 	.text
 
@@ -40,6 +41,8 @@ __pthread_rwlock_rdlock:
 	xorl	%esi, %esi
 	movl	12(%esp), %ebx
 
+	LIBC_PROBE (rdlock_entry, 1, %ebx)
+
 	/* Get the lock.  */
 	movl	$1, %edx
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
index 3994b06..d30e93a 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -22,6 +22,7 @@
 #include <pthread-errnos.h>
 #include <kernel-features.h>
 
+#include <stap-probe.h>
 
 	.text
 
@@ -40,6 +41,8 @@ __pthread_rwlock_wrlock:
 	xorl	%esi, %esi
 	movl	12(%esp), %ebx
 
+	LIBC_PROBE (wrlock_entry, 1, %ebx)
+
 	/* Get the lock.  */
 	movl	$1, %edx
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
index 497d473..3d805ff 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2004, 2006-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -19,6 +19,8 @@
 #ifndef _LOWLEVELLOCK_H
 #define _LOWLEVELLOCK_H	1
 
+#include <stap-probe.h>
+
 #ifndef __ASSEMBLER__
 # include <time.h>
 # include <sys/param.h>
@@ -225,6 +227,7 @@ LLL_STUB_UNWIND_INFO_END
   do {									      \
     int __ignore;							      \
     register __typeof (nr) _nr asm ("edx") = (nr);			      \
+    LIBC_PROBE (lll_futex_wake, 3, futex, nr, private);                       \
     __asm __volatile (LLL_EBX_LOAD					      \
 		      LLL_ENTER_KERNEL					      \
 		      LLL_EBX_LOAD					      \

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=5acf7263d52992ce4144e0a3b3644985b9e792b4

commit 5acf7263d52992ce4144e0a3b3644985b9e792b4
Author: Roland McGrath <roland@hack.frob.com>
Date:   Fri May 25 13:35:08 2012 -0700

    Add systemtap static probe points in generic and x86_64 pthread code.

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index ade0b18..9b63c53 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,32 @@
+2012-05-25  Rayson Ho  <rho@redhat.com>
+	    Roland McGrath  <roland@hack.frob.com>
+
+	* DESIGN-systemtap-probes.txt: New file.
+	* pthread_cond_broadcast.c: SystemTap probes.
+	* pthread_cond_init.c: Likewise.
+	* pthread_cond_signal.c: Likewise.
+	* pthread_cond_wait.c: Likewise.
+	* pthread_cond_destroy.c: Likewise.
+	* pthread_create.c: Likewise.
+	* pthread_join.c: Likewise.
+	* pthread_mutex_destroy.c: Likewise.
+	* pthread_mutex_init.c: Likewise.
+	* pthread_mutex_lock.c: Likewise.
+	* pthread_mutex_timedlock.c: Likewise.
+	* pthread_mutex_unlock.c: Likewise.
+	* pthread_rwlock_destroy.c: Likewise.
+	* pthread_rwlock_rdlock.c: Likewise.
+	* pthread_rwlock_unlock.c: Likewise.
+	* pthread_rwlock_wrlock.c: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S: Likewise.
+
 2012-05-24  Roland McGrath  <roland@hack.frob.com>
 
 	* pthread_create.c (start_thread): Define pthread_start LIBC_PROBE.
diff --git a/nptl/DESIGN-systemtap-probes.txt b/nptl/DESIGN-systemtap-probes.txt
new file mode 100644
index 0000000..16d7c45
--- /dev/null
+++ b/nptl/DESIGN-systemtap-probes.txt
@@ -0,0 +1,89 @@
+Systemtap is a dynamic tracing/instrumenting tool available on Linux. Probes
+that are not fired at run time have close to zero overhead.
+
+The following probes are available for NPTL:
+
+Thread creation & Join Probes
+=============================
+pthread_create - probe for pthread_create
+               arg1 = pointer (pthread_t*) to thread
+               arg2 = pointer (pthread_attr_t*) to attr
+               arg3 = pointer (void *) to start_routine
+               arg4 = arguments to start_routine
+pthread_start - probe for actual thread creation
+              arg1 = struct pthread (members include thread ID, process ID)
+              arg2 = address of start_routine
+              arg3 = pointer to the list of arguments
+pthread_join - probe for pthread_join
+             arg1 = thread ID
+pthread_join_ret - probe for pthread_join return
+                 arg1 = thread ID
+                 arg2 = return value
+
+Lock-related Probes
+===================
+mutex_init    - probe for pthread_mutex_init
+              arg1 = address of mutex lock
+mutex_acquired - probe for succ. return of pthread_mutex_lock
+               arg1 = address of mutex lock
+mutex_timedlock_acquired - probe for succ. return of pthread_mutex_timedlock
+                         arg1 = address of mutex lock
+mutex_entry   - probe for entry to the pthread_mutex_lock function
+              arg1 = address of mutex lock
+mutex_timedlock_entry - probe for entry to the pthread_mutex_timedlock function
+                      arg1 = address of mutex lock, arg2 = address of timespec
+mutex_release - probe for pthread_mutex_unlock after the successful release of a
+                mutex lock
+              arg1 = address of mutex lock
+mutex_destroy - probe for pthread_mutex_destroy
+              arg1 = address of mutex lock
+
+wrlock_entry - probe for entry to the pthread_rwlock_wrlock function
+             arg1 = address of rw lock
+rdlock_entry - probe for entry to the pthread_rwlock_rdlock function
+             arg1 = address of rw lock
+
+rwlock_destroy - probe for pthread_rwlock_destroy
+               arg1 = address of rw lock
+wrlock_acquire_write - probe for pthread_rwlock_wrlock (after getting the lock)
+                     arg1 = address of rw lock
+rdlock_acquire_read - probe for pthread_rwlock_rdlock after successfully getting
+                      the lock
+                    arg1 = address of rw lock
+rwlock_unlock - probe for pthread_rwlock_unlock
+              arg1 = address of rw lock
+
+lll_lock_wait - probe in low-level (assembly language) locking code, only fired
+                when futex/FUTEX_WAIT is called (i.e. when trying to acquire a
+                contented lock)
+              arg1 = pointer to futex
+              arg2 = flags passed to the futex system call
+lll_lock_wait_private - probe in low-level (assembly language) locking code,
+                        only fired when futex/FUTEX_WAIT is called (i.e. when
+                        trying to acquire a contented lock)
+                      arg1 = pointer to futex
+
+lll_futex_wake - probe in low-level (assembly language) locking code, only fired
+                 when futex (FUTEX_WAKE) is called
+               arg1 = pointer to futex
+               arg2 = number of processes to wake
+               arg3 = additional flags
+
+Condition variable Probes
+=========================
+cond_init - probe for pthread_cond_init
+          arg1 = condition
+          arg2 = attr
+cond_destroy - probe for pthread_cond_destroy
+             arg1 = cond
+cond_wait - probe for pthread_cond_wait
+          arg1 = condition
+          arg2 = mutex lock
+cond_timedwait - probe for pthread_cond_timedwait
+               arg1 = condition
+               arg2 = mutex lock
+               arg3 = timespec
+cond_signal - probe for pthread_cond_signal
+            arg1 = condition
+cond_broadcast - probe for pthread_cond_broadcast
+               arg1 = condition
diff --git a/nptl/pthread_cond_broadcast.c b/nptl/pthread_cond_broadcast.c
index 9b67f75..7bc76ac 100644
--- a/nptl/pthread_cond_broadcast.c
+++ b/nptl/pthread_cond_broadcast.c
@@ -22,6 +22,7 @@
 #include <lowlevellock.h>
 #include <pthread.h>
 #include <pthreadP.h>
+#include <stap-probe.h>
 
 #include <shlib-compat.h>
 #include <kernel-features.h>
@@ -31,6 +32,8 @@ int
 __pthread_cond_broadcast (cond)
      pthread_cond_t *cond;
 {
+  LIBC_PROBE (cond_broadcast, 1, cond);
+
   int pshared = (cond->__data.__mutex == (void *) ~0l)
 		? LLL_SHARED : LLL_PRIVATE;
   /* Make sure we are alone.  */
diff --git a/nptl/pthread_cond_destroy.c b/nptl/pthread_cond_destroy.c
index 0f03b29..5f57b56 100644
--- a/nptl/pthread_cond_destroy.c
+++ b/nptl/pthread_cond_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -19,6 +19,7 @@
 #include <errno.h>
 #include <shlib-compat.h>
 #include "pthreadP.h"
+#include <stap-probe.h>
 
 
 int
@@ -28,6 +29,8 @@ __pthread_cond_destroy (cond)
   int pshared = (cond->__data.__mutex == (void *) ~0l)
 		? LLL_SHARED : LLL_PRIVATE;
 
+  LIBC_PROBE (cond_destroy, 1, cond);
+
   /* Make sure we are alone.  */
   lll_lock (cond->__data.__lock, pshared);
 
@@ -50,13 +53,13 @@ __pthread_cond_destroy (cond)
   if (nwaiters >= (1 << COND_NWAITERS_SHIFT))
     {
       /* Wake everybody on the associated mutex in case there are
-         threads that have been requeued to it.
-         Without this, pthread_cond_destroy could block potentially
-         for a long time or forever, as it would depend on other
-         thread's using the mutex.
-         When all threads waiting on the mutex are woken up, pthread_cond_wait
-         only waits for threads to acquire and release the internal
-         condvar lock.  */
+	 threads that have been requeued to it.
+	 Without this, pthread_cond_destroy could block potentially
+	 for a long time or forever, as it would depend on other
+	 thread's using the mutex.
+	 When all threads waiting on the mutex are woken up, pthread_cond_wait
+	 only waits for threads to acquire and release the internal
+	 condvar lock.  */
       if (cond->__data.__mutex != NULL
 	  && cond->__data.__mutex != (void *) ~0l)
 	{
diff --git a/nptl/pthread_cond_init.c b/nptl/pthread_cond_init.c
index dcc6b3c..554fe6f 100644
--- a/nptl/pthread_cond_init.c
+++ b/nptl/pthread_cond_init.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008
-   Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -19,6 +18,7 @@
 
 #include <shlib-compat.h>
 #include "pthreadP.h"
+#include <stap-probe.h>
 
 
 int
@@ -41,6 +41,8 @@ __pthread_cond_init (cond, cond_attr)
 			  ? NULL : (void *) ~0l);
   cond->__data.__broadcast_seq = 0;
 
+  LIBC_PROBE (cond_init, 2, cond, cond_attr);
+
   return 0;
 }
 versioned_symbol (libpthread, __pthread_cond_init,
diff --git a/nptl/pthread_cond_signal.c b/nptl/pthread_cond_signal.c
index e4716f2..063dcbc 100644
--- a/nptl/pthread_cond_signal.c
+++ b/nptl/pthread_cond_signal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -25,6 +25,7 @@
 
 #include <shlib-compat.h>
 #include <kernel-features.h>
+#include <stap-probe.h>
 
 
 int
@@ -34,6 +35,8 @@ __pthread_cond_signal (cond)
   int pshared = (cond->__data.__mutex == (void *) ~0l)
 		? LLL_SHARED : LLL_PRIVATE;
 
+  LIBC_PROBE (cond_signal, 1, cond);
+
   /* Make sure we are alone.  */
   lll_lock (cond->__data.__lock, pshared);
 
diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c
index c05d06c..35505d9 100644
--- a/nptl/pthread_cond_wait.c
+++ b/nptl/pthread_cond_wait.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004,2006,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -24,6 +24,7 @@
 #include <pthreadP.h>
 
 #include <shlib-compat.h>
+#include <stap-probe.h>
 
 
 struct _condvar_cleanup_buffer
@@ -43,7 +44,7 @@ __condvar_cleanup (void *arg)
     (struct _condvar_cleanup_buffer *) arg;
   unsigned int destroying;
   int pshared = (cbuffer->cond->__data.__mutex == (void *) ~0l)
-  		? LLL_SHARED : LLL_PRIVATE;
+		? LLL_SHARED : LLL_PRIVATE;
 
   /* We are going to modify shared data.  */
   lll_lock (cbuffer->cond->__data.__lock, pshared);
@@ -98,7 +99,9 @@ __pthread_cond_wait (cond, mutex)
   struct _condvar_cleanup_buffer cbuffer;
   int err;
   int pshared = (cond->__data.__mutex == (void *) ~0l)
-  		? LLL_SHARED : LLL_PRIVATE;
+		? LLL_SHARED : LLL_PRIVATE;
+
+  LIBC_PROBE (cond_wait, 2, cond, mutex);
 
   /* Make sure we are alone.  */
   lll_lock (cond->__data.__lock, pshared);
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index c52ae11..97d8325 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007,2008,2009,2010,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -560,6 +560,8 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
   /* Pass the descriptor to the caller.  */
   *newthread = (pthread_t) pd;
 
+  LIBC_PROBE (pthread_create, 4, newthread, attr, start_routine, arg);
+
   /* Start the thread.  */
   return create_thread (pd, iattr, STACK_VARIABLES_ARGS);
 }
diff --git a/nptl/pthread_join.c b/nptl/pthread_join.c
index b8834cc..bf1a01d 100644
--- a/nptl/pthread_join.c
+++ b/nptl/pthread_join.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -22,6 +22,8 @@
 #include <atomic.h>
 #include "pthreadP.h"
 
+#include <stap-probe.h>
+
 
 static void
 cleanup (void *arg)
@@ -54,6 +56,8 @@ pthread_join (threadid, thread_return)
   struct pthread *self = THREAD_SELF;
   int result = 0;
 
+  LIBC_PROBE (pthread_join, 1, threadid);
+
   /* During the wait we change to asynchronous cancellation.  If we
      are canceled the thread we are waiting for must be marked as
      un-wait-ed for again.  */
@@ -109,5 +113,7 @@ pthread_join (threadid, thread_return)
       __free_tcb (pd);
     }
 
+  LIBC_PROBE (pthread_join_ret, 3, threadid, result, pd->result);
+
   return result;
 }
diff --git a/nptl/pthread_mutex_destroy.c b/nptl/pthread_mutex_destroy.c
index 408b16a..107ec8e 100644
--- a/nptl/pthread_mutex_destroy.c
+++ b/nptl/pthread_mutex_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -19,11 +19,15 @@
 #include <errno.h>
 #include "pthreadP.h"
 
+#include <stap-probe.h>
+
 
 int
 __pthread_mutex_destroy (mutex)
      pthread_mutex_t *mutex;
 {
+  LIBC_PROBE (mutex_destroy, 1, mutex);
+
   if ((mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP) == 0
       && mutex->__data.__nusers != 0)
     return EBUSY;
diff --git a/nptl/pthread_mutex_init.c b/nptl/pthread_mutex_init.c
index 0596e07..6536e44 100644
--- a/nptl/pthread_mutex_init.c
+++ b/nptl/pthread_mutex_init.c
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007
-   Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,6 +22,8 @@
 #include <kernel-features.h>
 #include "pthreadP.h"
 
+#include <stap-probe.h>
+
 static const struct pthread_mutexattr default_attr =
   {
     /* Default is a normal mutex, not shared between processes.  */
@@ -134,6 +135,8 @@ __pthread_mutex_init (mutex, mutexattr)
   // mutex->__spins = 0;	already done by memset
   // mutex->__next = NULL;	already done by memset
 
+  LIBC_PROBE (mutex_init, 1, mutex);
+
   return 0;
 }
 strong_alias (__pthread_mutex_init, pthread_mutex_init)
diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c
index c747355..2b30bad 100644
--- a/nptl/pthread_mutex_lock.c
+++ b/nptl/pthread_mutex_lock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,6 +23,7 @@
 #include <not-cancel.h>
 #include "pthreadP.h"
 #include <lowlevellock.h>
+#include <stap-probe.h>
 
 
 #ifndef LLL_MUTEX_LOCK
@@ -47,6 +48,9 @@ __pthread_mutex_lock (mutex)
   assert (sizeof (mutex->__size) >= sizeof (mutex->__data));
 
   unsigned int type = PTHREAD_MUTEX_TYPE (mutex);
+
+  LIBC_PROBE (mutex_entry, 1, mutex);
+
   if (__builtin_expect (type & ~PTHREAD_MUTEX_KIND_MASK_NP, 0))
     return __pthread_mutex_lock_full (mutex);
 
@@ -126,6 +130,8 @@ __pthread_mutex_lock (mutex)
   ++mutex->__data.__nusers;
 #endif
 
+  LIBC_PROBE (mutex_acquired, 1, mutex);
+
   return 0;
 }
 
@@ -466,6 +472,8 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex)
   ++mutex->__data.__nusers;
 #endif
 
+  LIBC_PROBE (mutex_acquired, 1, mutex);
+
   return 0;
 }
 #ifndef __pthread_mutex_lock
diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c
index b7f34d4..52fa74c 100644
--- a/nptl/pthread_mutex_timedlock.c
+++ b/nptl/pthread_mutex_timedlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,6 +23,8 @@
 #include <lowlevellock.h>
 #include <not-cancel.h>
 
+#include <stap-probe.h>
+
 
 int
 pthread_mutex_timedlock (mutex, abstime)
@@ -33,6 +35,8 @@ pthread_mutex_timedlock (mutex, abstime)
   pid_t id = THREAD_GETMEM (THREAD_SELF, tid);
   int result = 0;
 
+  LIBC_PROBE (mutex_timedlock_entry, 2, mutex, abstime);
+
   /* We must not check ABSTIME here.  If the thread does not block
      abstime must not be checked for a valid value.  */
 
@@ -171,6 +175,8 @@ pthread_mutex_timedlock (mutex, abstime)
 
 		  ++mutex->__data.__count;
 
+		  LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
+
 		  return 0;
 		}
 	    }
@@ -241,6 +247,8 @@ pthread_mutex_timedlock (mutex, abstime)
 
 		++mutex->__data.__count;
 
+		LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
+
 		return 0;
 	      }
 	  }
@@ -376,6 +384,8 @@ pthread_mutex_timedlock (mutex, abstime)
 
 		++mutex->__data.__count;
 
+		LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
+
 		return 0;
 	      }
 	  }
@@ -476,6 +486,8 @@ pthread_mutex_timedlock (mutex, abstime)
       /* Record the ownership.  */
       mutex->__data.__owner = id;
       ++mutex->__data.__nusers;
+
+      LIBC_PROBE (mutex_timedlock_acquired, 1, mutex);
     }
 
  out:
diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c
index 0f35f62..aa8ecbd 100644
--- a/nptl/pthread_mutex_unlock.c
+++ b/nptl/pthread_mutex_unlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include "pthreadP.h"
 #include <lowlevellock.h>
+#include <stap-probe.h>
 
 static int
 internal_function
@@ -49,6 +50,9 @@ __pthread_mutex_unlock_usercnt (mutex, decr)
 
       /* Unlock.  */
       lll_unlock (mutex->__data.__lock, PTHREAD_MUTEX_PSHARED (mutex));
+
+      LIBC_PROBE (mutex_release, 1, mutex);
+
       return 0;
     }
   else if (__builtin_expect (type == PTHREAD_MUTEX_RECURSIVE_NP, 1))
@@ -271,6 +275,9 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
 			PTHREAD_MUTEX_PSHARED (mutex));
 
       int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT;
+
+      LIBC_PROBE (mutex_release, 1, mutex);
+
       return __pthread_tpp_change_priority (oldprio, -1);
 
     default:
@@ -278,6 +285,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr)
       return EINVAL;
     }
 
+  LIBC_PROBE (mutex_release, 1, mutex);
   return 0;
 }
 
diff --git a/nptl/pthread_rwlock_destroy.c b/nptl/pthread_rwlock_destroy.c
index 606833a..78abe5e 100644
--- a/nptl/pthread_rwlock_destroy.c
+++ b/nptl/pthread_rwlock_destroy.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -17,12 +17,15 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include "pthreadP.h"
+#include <stap-probe.h>
 
 
 int
 __pthread_rwlock_destroy (rwlock)
      pthread_rwlock_t *rwlock;
 {
+  LIBC_PROBE (rwlock_destroy, 1, rwlock);
+
   /* Nothing to be done.  For now.  */
   return 0;
 }
diff --git a/nptl/pthread_rwlock_rdlock.c b/nptl/pthread_rwlock_rdlock.c
index 4aa1c5b..14688e2 100644
--- a/nptl/pthread_rwlock_rdlock.c
+++ b/nptl/pthread_rwlock_rdlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2004,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -21,6 +21,7 @@
 #include <lowlevellock.h>
 #include <pthread.h>
 #include <pthreadP.h>
+#include <stap-probe.h>
 
 
 /* Acquire read lock for RWLOCK.  */
@@ -30,6 +31,8 @@ __pthread_rwlock_rdlock (rwlock)
 {
   int result = 0;
 
+  LIBC_PROBE (rdlock_entry, 1, rwlock);
+
   /* Make sure we are alone.  */
   lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
 
@@ -48,6 +51,8 @@ __pthread_rwlock_rdlock (rwlock)
 	      --rwlock->__data.__nr_readers;
 	      result = EAGAIN;
 	    }
+	  else
+	    LIBC_PROBE (rdlock_acquire_read, 1, rwlock);
 
 	  break;
 	}
diff --git a/nptl/pthread_rwlock_unlock.c b/nptl/pthread_rwlock_unlock.c
index 15418c8..a727d89 100644
--- a/nptl/pthread_rwlock_unlock.c
+++ b/nptl/pthread_rwlock_unlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -21,11 +21,14 @@
 #include <lowlevellock.h>
 #include <pthread.h>
 #include <pthreadP.h>
+#include <stap-probe.h>
 
 /* Unlock RWLOCK.  */
 int
 __pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
 {
+  LIBC_PROBE (rwlock_unlock, 1, rwlock);
+
   lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
   if (rwlock->__data.__writer)
     rwlock->__data.__writer = 0;
diff --git a/nptl/pthread_rwlock_wrlock.c b/nptl/pthread_rwlock_wrlock.c
index a645487..6d8fb93 100644
--- a/nptl/pthread_rwlock_wrlock.c
+++ b/nptl/pthread_rwlock_wrlock.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003,2007,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>, 2003.
 
@@ -21,6 +21,7 @@
 #include <lowlevellock.h>
 #include <pthread.h>
 #include <pthreadP.h>
+#include <stap-probe.h>
 
 
 /* Acquire write lock for RWLOCK.  */
@@ -30,6 +31,8 @@ __pthread_rwlock_wrlock (rwlock)
 {
   int result = 0;
 
+  LIBC_PROBE (wrlock_entry, 1, rwlock);
+
   /* Make sure we are alone.  */
   lll_lock (rwlock->__data.__lock, rwlock->__data.__shared);
 
@@ -40,6 +43,8 @@ __pthread_rwlock_wrlock (rwlock)
 	{
 	  /* Mark self as writer.  */
 	  rwlock->__data.__writer = THREAD_GETMEM (THREAD_SELF, tid);
+
+	  LIBC_PROBE (wrlock_acquire_write, 1, rwlock);
 	  break;
 	}
 
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index b7bfc37..dc95421 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -21,6 +21,8 @@
 #include <kernel-features.h>
 #include <lowlevellock.h>
 
+#include <stap-probe.h>
+
 	.text
 
 #ifdef __ASSUME_PRIVATE_FUTEX
@@ -86,7 +88,8 @@ __lll_lock_wait_private:
 	cmpl	%edx, %eax	/* NB:	 %edx == 2 */
 	jne	2f
 
-1:	movl	$SYS_futex, %eax
+1:	LIBC_PROBE (lll_lock_wait_private, 1, %rdi)
+	movl	$SYS_futex, %eax
 	syscall
 
 2:	movl	%edx, %eax
@@ -125,7 +128,8 @@ __lll_lock_wait:
 	cmpl	%edx, %eax	/* NB:	 %edx == 2 */
 	jne	2f
 
-1:	movl	$SYS_futex, %eax
+1:	LIBC_PROBE (lll_lock_wait, 2, %rdi, %rsi)
+	movl	$SYS_futex, %eax
 	syscall
 
 2:	movl	%edx, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
index ad14185..3686970 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002-2004, 2006-2008, 2009, 2012
-   Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -20,6 +19,8 @@
 #ifndef _LOWLEVELLOCK_H
 #define _LOWLEVELLOCK_H	1
 
+#include <stap-probe.h>
+
 #ifndef __ASSEMBLER__
 # include <time.h>
 # include <sys/param.h>
@@ -227,6 +228,7 @@ LLL_STUB_UNWIND_INFO_END
   do {									      \
     int __ignore;							      \
     register __typeof (nr) _nr __asm ("edx") = (nr);			      \
+    LIBC_PROBE (lll_futex_wake, 3, futex, nr, private);                       \
     __asm __volatile ("syscall"						      \
 		      : "=a" (__ignore)					      \
 		      : "0" (SYS_futex), "D" (futex),			      \
@@ -286,7 +288,7 @@ LLL_STUB_UNWIND_INFO_END
 			      "je 0f\n\t"				      \
 			      "lock; cmpxchgl %4, %2\n\t"		      \
 			      "jnz 1f\n\t"				      \
-		  	      "jmp 24f\n"				      \
+			      "jmp 24f\n"				      \
 			      "0:\tcmpxchgl %4, %2\n\t"			      \
 			      "jnz 1f\n\t"
 #endif
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
index 7b0eec1..67ff5fc 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
@@ -1,5 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2009
-   Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -24,7 +23,7 @@
 #include <kernel-features.h>
 #include <pthread-pi-defines.h>
 #include <pthread-errnos.h>
-
+#include <stap-probe.h>
 
 	.text
 
@@ -34,6 +33,8 @@
 	.align	16
 __pthread_cond_broadcast:
 
+	LIBC_PROBE (cond_broadcast, 1, %rdi)
+
 	/* Get internal lock.  */
 	movl	$1, %esi
 	xorl	%eax, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
index a77b7d5..3bff19b 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,6 +23,7 @@
 #include <pthread-pi-defines.h>
 #include <kernel-features.h>
 #include <pthread-errnos.h>
+#include <stap-probe.h>
 
 
 	.text
@@ -33,6 +34,8 @@
 	.align	16
 __pthread_cond_signal:
 
+	LIBC_PROBE (cond_signal, 1, %rdi)
+
 	/* Get internal lock.  */
 	movq	%rdi, %r8
 	movl	$1, %esi
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index 79bfecd..50e1ffd 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2005,2007,2009,2010,2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -22,6 +22,7 @@
 #include <lowlevelcond.h>
 #include <pthread-pi-defines.h>
 #include <pthread-errnos.h>
+#include <stap-probe.h>
 
 #include <kernel-features.h>
 
@@ -67,6 +68,8 @@ __pthread_cond_timedwait:
 	cfi_adjust_cfa_offset(FRAME_SIZE)
 	cfi_remember_state
 
+	LIBC_PROBE (cond_timedwait, 3, %rdi, %rsi, %rdx)
+
 	cmpq	$1000000000, 8(%rdx)
 	movl	$EINVAL, %eax
 	jae	48f
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 6c1031e..6194852 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2007, 2009, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -23,6 +23,7 @@
 #include <tcb-offsets.h>
 #include <pthread-pi-defines.h>
 #include <pthread-errnos.h>
+#include <stap-probe.h>
 
 #include <kernel-features.h>
 
@@ -54,20 +55,22 @@ __pthread_cond_wait:
 	   rsp + 32
 		    +--------------------------+
 	   rsp + 24 | old wake_seq value       |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp + 16 | mutex pointer            |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp +  8 | condvar pointer          |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp +  4 | old broadcast_seq value  |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp +  0 | old cancellation mode    |
-	            +--------------------------+
+		    +--------------------------+
 	*/
 
+	LIBC_PROBE (cond_wait, 2, %rdi, %rsi)
+
 	LP_OP(cmp) $-1, dep_mutex(%rdi)
 
-		/* Prepare structure passed to cancellation handler.  */
+	/* Prepare structure passed to cancellation handler.  */
 	movq	%rdi, 8(%rsp)
 	movq	%rsi, 16(%rsp)
 
@@ -406,15 +409,15 @@ __condvar_cleanup1:
 	   rsp + 32
 		    +--------------------------+
 	   rsp + 24 | unused                   |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp + 16 | mutex pointer            |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp +  8 | condvar pointer          |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp +  4 | old broadcast_seq value  |
-	            +--------------------------+
+		    +--------------------------+
 	   rsp +  0 | old cancellation mode    |
-	            +--------------------------+
+		    +--------------------------+
 	*/
 
 	movq	%rax, 24(%rsp)
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
index c076185..abb3057 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -21,7 +21,7 @@
 #include <lowlevelrwlock.h>
 #include <pthread-errnos.h>
 #include <kernel-features.h>
-
+#include <stap-probe.h>
 
 	.text
 
@@ -30,6 +30,9 @@
 	.align	16
 __pthread_rwlock_rdlock:
 	cfi_startproc
+
+	LIBC_PROBE (rdlock_entry, 1, %rdi)
+
 	xorq	%r10, %r10
 
 	/* Get the lock.  */
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
index b349554..f6a6bff 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -21,7 +21,7 @@
 #include <lowlevelrwlock.h>
 #include <pthread-errnos.h>
 #include <kernel-features.h>
-
+#include <stap-probe.h>
 
 	.text
 
@@ -30,6 +30,9 @@
 	.align	16
 __pthread_rwlock_wrlock:
 	cfi_startproc
+
+	LIBC_PROBE (wrlock_entry, 1, %rdi)
+
 	xorq	%r10, %r10
 
 	/* Get the lock.  */

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8422c9a560e6e3c854739c8a13ecb1c6714f930f

commit 8422c9a560e6e3c854739c8a13ecb1c6714f930f
Author: Roland McGrath <roland@hack.frob.com>
Date:   Fri May 25 13:31:57 2012 -0700

    Add systemtap static probe points in setjmp/longjmp on x86.

diff --git a/ChangeLog b/ChangeLog
index e89af6f..e1a0834 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2012-05-25  Roland McGrath  <roland@hack.frob.com>
 
+	* sysdeps/x86_64/__longjmp.S: Add a static probe here.
+	* sysdeps/x86_64/setjmp.S: Likewise.
+	* sysdeps/i386/bsd-setjmp.S: Likewise.
+	* sysdeps/i386/bsd-_setjmp.S: Likewise.
+	* sysdeps/i386/setjmp.S: Likewise.
+	* sysdeps/i386/__longjmp.S: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S: Likewise.
+	* sysdeps/unix/sysv/linux/i386/____longjmp_chk.S: Likewise.
+
 	* include/stap-probe.h: New file.
 	* configure.in: Handle --enable-systemtap.
 	* configure: Regenerated.
diff --git a/sysdeps/i386/__longjmp.S b/sysdeps/i386/__longjmp.S
index 264eb7e..74c8347 100644
--- a/sysdeps/i386/__longjmp.S
+++ b/sysdeps/i386/__longjmp.S
@@ -1,6 +1,5 @@
 /* longjmp for i386.
-   Copyright (C) 1995-1998,2000,2002,2005,2006,2009
-   Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -20,6 +19,7 @@
 #include <sysdep.h>
 #include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
+#include <stap-probe.h>
 
 	.text
 ENTRY (__longjmp)
@@ -32,6 +32,7 @@ ENTRY (__longjmp)
 	movl (JB_SP*4)(%eax), %ecx
 	PTR_DEMANGLE (%edx)
 	PTR_DEMANGLE (%ecx)
+	LIBC_PROBE (longjmp, 3, 4@%eax, -4@8(%esp), 4@%edx)
 	cfi_def_cfa(%eax, 0)
 	cfi_register(%eip, %edx)
 	cfi_register(%esp, %ecx)
@@ -49,6 +50,7 @@ ENTRY (__longjmp)
 	cfi_restore(%edi)
 	cfi_restore(%ebp)
 
+	LIBC_PROBE (longjmp_target, 3, 4@%eax, -4@8(%esp), 4@%edx)
 	movl 8(%esp), %eax	/* Second argument is return value.  */
 	movl %ecx, %esp
 #else
@@ -56,12 +58,14 @@ ENTRY (__longjmp)
 	movl 8(%esp), %eax	/* Second argument is return value.  */
 	/* Save the return address now.  */
 	movl (JB_PC*4)(%ecx), %edx
+	LIBC_PROBE (longjmp, 3, 4@%ecx, -4@%eax, 4@%edx)
      	/* Restore registers.  */
 	movl (JB_BX*4)(%ecx), %ebx
 	movl (JB_SI*4)(%ecx), %esi
 	movl (JB_DI*4)(%ecx), %edi
 	movl (JB_BP*4)(%ecx), %ebp
 	movl (JB_SP*4)(%ecx), %esp
+	LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%ecx, 4@%edx)
 #endif
 	/* Jump to saved PC.  */
      	jmp *%edx
diff --git a/sysdeps/i386/bsd-_setjmp.S b/sysdeps/i386/bsd-_setjmp.S
index 549aefa..8a5d0d8 100644
--- a/sysdeps/i386/bsd-_setjmp.S
+++ b/sysdeps/i386/bsd-_setjmp.S
@@ -1,5 +1,5 @@
 /* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  i386 version.
-   Copyright (C) 1994-1997,2000-2002,2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
 #include <jmpbuf-offsets.h>
 #include "bp-sym.h"
 #include "bp-asm.h"
+#include <stap-probe.h>
 
 #define PARMS	LINKAGE		/* no space for saved regs */
 #define JMPBUF	PARMS
@@ -46,6 +47,7 @@ ENTRY (BP_SYM (_setjmp))
 #endif
      	movl %ecx, (JB_SP*4)(%edx)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
+	LIBC_PROBE (setjmp, 3, 4@%edx, -4@$0, 4@%ecx)
 #ifdef PTR_MANGLE
 	PTR_MANGLE (%ecx)
 #endif
diff --git a/sysdeps/i386/bsd-setjmp.S b/sysdeps/i386/bsd-setjmp.S
index 447fd7d..d3a284e 100644
--- a/sysdeps/i386/bsd-setjmp.S
+++ b/sysdeps/i386/bsd-setjmp.S
@@ -1,5 +1,5 @@
 /* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  i386 version.
-   Copyright (C) 1994-1997,2000,2001,2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1994-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -24,6 +24,7 @@
 #include <jmpbuf-offsets.h>
 #include "bp-sym.h"
 #include "bp-asm.h"
+#include <stap-probe.h>
 
 #define PARMS  LINKAGE		/* no space for saved regs */
 #define JMPBUF PARMS
@@ -48,6 +49,7 @@ ENTRY (BP_SYM (setjmp))
 #endif
      	movl %ecx, (JB_SP*4)(%eax)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
+	LIBC_PROBE (setjmp, 3, 4@%eax, -4@$1, 4@%ecx)
 #ifdef PTR_MANGLE
 	PTR_MANGLE (%ecx)
 #endif
diff --git a/sysdeps/i386/setjmp.S b/sysdeps/i386/setjmp.S
index 7416744..bf47f66 100644
--- a/sysdeps/i386/setjmp.S
+++ b/sysdeps/i386/setjmp.S
@@ -1,6 +1,5 @@
 /* setjmp for i386.
-   Copyright (C) 1995,1996,1997,2000,2001,2005,2006
-	Free Software Foundation, Inc.
+   Copyright (C) 1995-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -22,6 +21,7 @@
 #include <asm-syntax.h>
 #include "bp-sym.h"
 #include "bp-asm.h"
+#include <stap-probe.h>
 
 #define PARMS	LINKAGE		/* no space for saved regs */
 #define JMPBUF	PARMS
@@ -43,6 +43,7 @@ ENTRY (BP_SYM (__sigsetjmp))
 #endif
      	movl %ecx, (JB_SP*4)(%eax)
 	movl PCOFF(%esp), %ecx	/* Save PC we are returning to now.  */
+	LIBC_PROBE (setjmp, 3, 4@%eax, -4@SIGMSK(%esp), 4@%ecx)
 #ifdef PTR_MANGLE
 	PTR_MANGLE (%ecx)
 #endif
diff --git a/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S b/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
index b2cc368..e135076 100644
--- a/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/i386/____longjmp_chk.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,2004,2005,2006,2009 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -18,6 +18,7 @@
 #include <sysdep.h>
 #include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
+#include <stap-probe.h>
 
 
 	.section .rodata.str1.1,"aMS",@progbits,1
@@ -78,7 +79,9 @@ ENTRY (____longjmp_chk)
 	cfi_adjust_cfa_offset(-12)
 	movl	4(%esp), %ecx
 
-.Lok:	/* We add unwind information for the target here.  */
+.Lok:
+	LIBC_PROBE (longjmp, 3, 4@%ecx, -4@8(%esp), 4@%edx)
+	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%ecx, 0)
 	cfi_register(%eip, %edx)
 	cfi_register(%esp, %edi)
@@ -101,5 +104,6 @@ ENTRY (____longjmp_chk)
 	cfi_restore(%ebp)
 
 	/* Jump to saved PC.  */
+	LIBC_PROBE (longjmp_target, 3, 4@%ecx, -4@%eax, 4@%edx)
 	jmp	*%edx
 END (____longjmp_chk)
diff --git a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
index c392820..d9bdb67 100644
--- a/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S
@@ -18,6 +18,7 @@
 #include <sysdep.h>
 #include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
+#include <stap-probe.h>
 
 #include <sigaltstack-offsets.h>
 
@@ -103,7 +104,9 @@ ENTRY(____longjmp_chk)
 	movl	%ebx, %esi
 	cfi_restore (%rsi)
 
-.Lok:	/* We add unwind information for the target here.  */
+.Lok:
+	LIBC_PROBE (longjmp, 3, LP_SIZE@%RDI_LP, -4@%esi, LP_SIZE@%RDX_LP)
+	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
 	cfi_register(%rsp,%r8)
 	cfi_register(%rbp,%r9)
@@ -122,5 +125,7 @@ ENTRY(____longjmp_chk)
 	movl	%esi, %eax
 	mov	%R8_LP, %RSP_LP
 	movq	%r9,%rbp
+	LIBC_PROBE (longjmp_target, 3,
+		    LP_SIZE@%RDI_LP, -4@%eax, LP_SIZE@%RDX_LP)
 	jmpq	*%rdx
 END (____longjmp_chk)
diff --git a/sysdeps/x86_64/__longjmp.S b/sysdeps/x86_64/__longjmp.S
index c0c15dc..ef1147a 100644
--- a/sysdeps/x86_64/__longjmp.S
+++ b/sysdeps/x86_64/__longjmp.S
@@ -18,6 +18,7 @@
 #include <sysdep.h>
 #include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
+#include <stap-probe.h>
 
 /* Jump to the position specified by ENV, causing the
    setjmp call there to return VAL, or 1 if VAL is 0.
@@ -41,6 +42,7 @@ ENTRY(__longjmp)
 	orq %rax, %r9
 # endif
 #endif
+	LIBC_PROBE (longjmp, 3, LP_SIZE@%RDI_LP, -4@%esi, LP_SIZE@%RDX_LP)
 	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
 	cfi_register(%rsp,%r8)
@@ -60,5 +62,7 @@ ENTRY(__longjmp)
 	mov %esi, %eax
 	mov %R8_LP,%RSP_LP
 	movq %r9,%rbp
+	LIBC_PROBE (longjmp_target, 3,
+		    LP_SIZE@%RDI_LP, -4@%eax, LP_SIZE@%RDX_LP)
 	jmpq *%rdx
 END (__longjmp)
diff --git a/sysdeps/x86_64/setjmp.S b/sysdeps/x86_64/setjmp.S
index 5639292..82ac731 100644
--- a/sysdeps/x86_64/setjmp.S
+++ b/sysdeps/x86_64/setjmp.S
@@ -19,6 +19,7 @@
 #include <sysdep.h>
 #include <jmpbuf-offsets.h>
 #include <asm-syntax.h>
+#include <stap-probe.h>
 
 ENTRY (__sigsetjmp)
 	/* Save registers.  */
@@ -47,6 +48,7 @@ ENTRY (__sigsetjmp)
 #endif
 	movq %rdx, (JB_RSP*8)(%rdi)
 	mov (%rsp), %RAX_LP	/* Save PC we are returning to now.  */
+	LIBC_PROBE (setjmp, 3, LP_SIZE@%RDI_LP, -4@%esi, LP_SIZE@%RAX_LP)
 #ifdef PTR_MANGLE
 	PTR_MANGLE (%RAX_LP)
 #endif

http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=3a097cc7a18309c864186c1b864b90889d2a45e9

commit 3a097cc7a18309c864186c1b864b90889d2a45e9
Author: Roland McGrath <roland@hack.frob.com>
Date:   Fri May 25 13:40:20 2012 -0700

    Add --enable-systemtap configuration to define static probe points.

diff --git a/ChangeLog b/ChangeLog
index 8ddc57e..e89af6f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-05-25  Roland McGrath  <roland@hack.frob.com>
+
+	* include/stap-probe.h: New file.
+	* configure.in: Handle --enable-systemtap.
+	* configure: Regenerated.
+	* config.h.in (USE_STAP_PROBE): New #undef.
+	* extra-lib.mk (CPPFLAGS-$(lib)): Add -DIN_LIB=$(lib).
+	* elf/Makefile (CPPFLAGS-.os): Add -DIN_LIB=rtld.
+	* elf/rtld-Rules (rtld-CPPFLAGS): Likewise.
+
 2012-05-25  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #13717]
diff --git a/config.h.in b/config.h.in
index 5495260..dd184b0 100644
--- a/config.h.in
+++ b/config.h.in
@@ -181,6 +181,10 @@
 /* Define if obsolete RPC code should be made available for user-level code
    to link against.  */
 #undef LINK_OBSOLETE_RPC
+
+/* Define if Systemtap <sys/sdt.h> probes should be defined.  */
+#undef USE_STAP_PROBE
+
 /*
  */
 
diff --git a/configure b/configure
index 09a0637..d730427 100755
--- a/configure
+++ b/configure
@@ -784,6 +784,7 @@ enable_all_warnings
 enable_multi_arch
 enable_nss_crypt
 enable_obsolete_rpc
+enable_systemtap
 with_cpu
 '
       ac_precious_vars='build_alias
@@ -1441,6 +1442,7 @@ Optional Features:
   --enable-nss-crypt      enable libcrypt to use nss
   --enable-obsolete-rpc   build and install the obsolete RPC code for
                           link-time usage
+  --enable-systemtap      enable systemtap static probe points [default=no]
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -3753,6 +3755,7 @@ else
 fi
 
 
+
 # Check whether --enable-obsolete-rpc was given.
 if test "${enable_obsolete_rpc+set}" = set; then :
   enableval=$enable_obsolete_rpc; link_obsolete_rpc=$enableval
@@ -3767,6 +3770,51 @@ if test "$link_obsolete_rpc" = yes; then
 
 fi
 
+# Check whether --enable-systemtap was given.
+if test "${enable_systemtap+set}" = set; then :
+  enableval=$enable_systemtap; systemtap=$enableval
+else
+  systemtap=no
+fi
+
+if test "x$systemtap" != xno; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for systemtap static probe support" >&5
+$as_echo_n "checking for systemtap static probe support... " >&6; }
+if ${libc_cv_sdt+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+    old_CFLAGS="$CFLAGS"
+  CFLAGS="-std=gnu99 $CFLAGS"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/sdt.h>
+void foo (int i, void *p)
+{
+  asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
+       :: STAP_PROBE_ASM_OPERANDS (2, i, p));
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_cv_sdt=yes
+else
+  libc_cv_sdt=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$old_CFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_sdt" >&5
+$as_echo "$libc_cv_sdt" >&6; }
+  if test $libc_cv_sdt = yes; then
+    $as_echo "#define USE_STAP_PROBE 1" >>confdefs.h
+
+  elif test "x$systemtap" != xauto; then
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "systemtap support needs sys/sdt.h with asm support
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
+fi
+
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
diff --git a/configure.in b/configure.in
index 38b55a6..1ae9ca4 100644
--- a/configure.in
+++ b/configure.in
@@ -252,6 +252,7 @@ else
 fi
 AC_SUBST(libc_cv_nss_crypt)
 
+
 AC_ARG_ENABLE([obsolete-rpc],
               AC_HELP_STRING([--enable-obsolete-rpc],
                              [build and install the obsolete RPC code for link-time usage]),
@@ -263,6 +264,29 @@ if test "$link_obsolete_rpc" = yes; then
   AC_DEFINE(LINK_OBSOLETE_RPC)
 fi
 
+AC_ARG_ENABLE([systemtap],
+              [AS_HELP_STRING([--enable-systemtap],
+	       [enable systemtap static probe points @<:@default=no@:>@])],
+              [systemtap=$enableval],
+	      [systemtap=no])
+if test "x$systemtap" != xno; then
+  AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
+  old_CFLAGS="$CFLAGS"
+  CFLAGS="-std=gnu99 $CFLAGS"
+  AC_COMPILE_IFELSE([#include <sys/sdt.h>
+void foo (int i, void *p)
+{
+  asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
+       :: STAP_PROBE_ASM_OPERANDS (2, i, p));
+}], [libc_cv_sdt=yes], [libc_cv_sdt=no])
+  CFLAGS="$old_CFLAGS"])
+  if test $libc_cv_sdt = yes; then
+    AC_DEFINE([USE_STAP_PROBE])
+  elif test "x$systemtap" != xauto; then
+    AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
+  fi
+fi
+
 # The way shlib-versions is used to generate soversions.mk uses a
 # fairly simplistic model for name recognition that can't distinguish
 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
diff --git a/elf/Makefile b/elf/Makefile
index f6c6fb4..0c26ce5 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -422,7 +422,8 @@ CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
 CFLAGS-cache.c = $(SYSCONF-FLAGS)
 CFLAGS-rtld.c = $(SYSCONF-FLAGS)
 
-CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
+CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
+		     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld)
 
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
diff --git a/elf/rtld-Rules b/elf/rtld-Rules
index 6526aec..1e03332 100644
--- a/elf/rtld-Rules
+++ b/elf/rtld-Rules
@@ -1,7 +1,6 @@
 # Subroutine makefile for compiling libc modules linked into dynamic linker.
 
-# Copyright (C) 2002,2003,2005,2006,2008,2010,2011
-#   Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -130,6 +129,6 @@ ifdef rtld-depfiles
 endif
 
 # This here is the whole point of all the shenanigans.
-rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1
+rtld-CPPFLAGS := -DNOT_IN_libc=1 -DIS_IN_rtld=1 -DIN_LIB=rtld
 
 endif
diff --git a/extra-lib.mk b/extra-lib.mk
index f2a19b0..a2293c5 100644
--- a/extra-lib.mk
+++ b/extra-lib.mk
@@ -101,4 +101,4 @@ ifneq (,$(cpp-srcs-left))
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 endif
 
-CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1
+CPPFLAGS-$(lib) := -DNOT_IN_libc=1 -DIS_IN_$(lib)=1 -DIN_LIB=$(lib)
diff --git a/include/stap-probe.h b/include/stap-probe.h
new file mode 100644
index 0000000..1051ad1
--- /dev/null
+++ b/include/stap-probe.h
@@ -0,0 +1,80 @@
+/* Macros for defining Systemtap <sys/sdt.h> static probe points.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#ifndef _STAP_PROBE_H
+#define _STAP_PROBE_H 1
+
+#ifdef USE_STAP_PROBE
+
+# include <sys/sdt.h>
+
+/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
+
+   Without USE_STAP_PROBE, that does nothing but evaluates all
+   its arguments (to prevent bit rot, unlike e.g. assert).
+
+   Systemtap's header defines the macros STAP_PROBE (provider, name) and
+   STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
+   in the IN_LIB name (libc, libpthread, etc.) automagically.  */
+
+# ifndef NOT_IN_libc
+#  define IN_LIB	libc
+# elif !defined IN_LIB
+/* This is intentionally defined with extra unquoted commas in it so
+   that macro substitution will bomb out when it is used.  We don't
+   just use #error here, so that this header can be included by
+   other headers that use LIBC_PROBE inside their own macros.  We
+   only want such headers to fail to compile if those macros are
+   actually used in a context where IN_LIB has not been defined.  */
+#  define IN_LIB	,,,missing -DIN_LIB=... -- not extra-lib.mk?,,,
+# endif
+
+# define LIBC_PROBE(name, n, ...)	\
+  LIBC_PROBE_1 (IN_LIB, name, n, ## __VA_ARGS__)
+
+# define LIBC_PROBE_1(lib, name, n, ...) \
+  STAP_PROBE##n (lib, name, ## __VA_ARGS__)
+
+# define STAP_PROBE0		STAP_PROBE
+
+# define LIBC_PROBE_ASM(name, template) \
+  STAP_PROBE_ASM (IN_LIB, name, template)
+
+# define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
+
+#else  /* Not USE_STAP_PROBE.  */
+
+# ifndef __ASSEMBLER__
+/* Evaluate all the arguments and verify that N matches their number.  */
+#  define LIBC_PROBE(name, n, ...)					      \
+  do {									      \
+    _Bool __libc_probe_args[] = { 0, ## __VA_ARGS__ };			      \
+    _Bool __libc_probe_verify_n[(sizeof __libc_probe_args / sizeof (_Bool))   \
+                                == n + 1 ? 1 : -1];			      \
+    (void) __libc_probe_verify_n;					      \
+  } while (0)
+# else
+#  define LIBC_PROBE(name, n, ...)		/* Nothing.  */
+# endif
+
+# define LIBC_PROBE_ASM(name, template)		/* Nothing.  */
+# define LIBC_PROBE_ASM_OPERANDS(n, ...)	/* Nothing.  */
+
+#endif	/* USE_STAP_PROBE.  */
+
+#endif	/* stap-probe.h */
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index efeebca..ade0b18 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-24  Roland McGrath  <roland@hack.frob.com>
+
+	* pthread_create.c (start_thread): Define pthread_start LIBC_PROBE.
+
 2012-05-17  Andreas Jaeger  <aj@suse.de>
 
 	* sysdeps/unix/sysv/linux/i386/i686/dl-sysdep.h
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 3c1e479..c52ae11 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -31,6 +31,8 @@
 
 #include <shlib-compat.h>
 
+#include <stap-probe.h>
+
 
 /* Local function to start thread and handle cleanup.  */
 static int start_thread (void *arg);
@@ -299,6 +301,8 @@ start_thread (void *arg)
 	  CANCEL_RESET (oldtype);
 	}
 
+      LIBC_PROBE (pthread_start, 3, (pthread_t) pd, pd->start_routine, pd->arg);
+
       /* Run the code the user provided.  */
 #ifdef CALL_THREAD_FCT
       THREAD_SETMEM (pd, result, CALL_THREAD_FCT (pd));

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   19 ++++
 config.h.in                                        |    4 +
 configure                                          |   48 +++++++++++
 configure.in                                       |   24 +++++
 elf/Makefile                                       |    3 +-
 elf/rtld-Rules                                     |    5 +-
 extra-lib.mk                                       |    2 +-
 include/stap-probe.h                               |   80 ++++++++++++++++++
 nptl/ChangeLog                                     |   46 ++++++++++
 nptl/DESIGN-systemtap-probes.txt                   |   89 ++++++++++++++++++++
 nptl/pthread_cond_broadcast.c                      |    3 +
 nptl/pthread_cond_destroy.c                        |   19 +++--
 nptl/pthread_cond_init.c                           |    6 +-
 nptl/pthread_cond_signal.c                         |    5 +-
 nptl/pthread_cond_wait.c                           |    9 ++-
 nptl/pthread_create.c                              |    8 ++-
 nptl/pthread_join.c                                |    8 ++-
 nptl/pthread_mutex_destroy.c                       |    6 +-
 nptl/pthread_mutex_init.c                          |    7 +-
 nptl/pthread_mutex_lock.c                          |   10 ++-
 nptl/pthread_mutex_timedlock.c                     |   14 +++-
 nptl/pthread_mutex_unlock.c                        |   10 ++-
 nptl/pthread_rwlock_destroy.c                      |    5 +-
 nptl/pthread_rwlock_rdlock.c                       |    7 ++-
 nptl/pthread_rwlock_unlock.c                       |    5 +-
 nptl/pthread_rwlock_wrlock.c                       |    7 ++-
 .../unix/sysv/linux/i386/i486/lowlevellock.S       |    7 +-
 .../sysv/linux/i386/i486/pthread_cond_broadcast.S  |    5 +-
 .../sysv/linux/i386/i486/pthread_cond_signal.S     |    6 +-
 .../sysv/linux/i386/i486/pthread_cond_timedwait.S  |    6 +-
 .../unix/sysv/linux/i386/i486/pthread_cond_wait.S  |    6 +-
 .../sysv/linux/i386/i486/pthread_rwlock_rdlock.S   |    5 +-
 .../sysv/linux/i386/i486/pthread_rwlock_wrlock.S   |    5 +-
 nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h   |    5 +-
 nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S |   10 ++-
 nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h |    8 +-
 .../sysv/linux/x86_64/pthread_cond_broadcast.S     |    7 +-
 .../unix/sysv/linux/x86_64/pthread_cond_signal.S   |    5 +-
 .../sysv/linux/x86_64/pthread_cond_timedwait.S     |    5 +-
 .../unix/sysv/linux/x86_64/pthread_cond_wait.S     |   27 ++++---
 .../unix/sysv/linux/x86_64/pthread_rwlock_rdlock.S |    7 +-
 .../unix/sysv/linux/x86_64/pthread_rwlock_wrlock.S |    7 +-
 sysdeps/i386/__longjmp.S                           |    8 ++-
 sysdeps/i386/bsd-_setjmp.S                         |    4 +-
 sysdeps/i386/bsd-setjmp.S                          |    4 +-
 sysdeps/i386/setjmp.S                              |    5 +-
 sysdeps/unix/sysv/linux/i386/____longjmp_chk.S     |    8 ++-
 sysdeps/unix/sysv/linux/x86_64/____longjmp_chk.S   |    7 ++-
 sysdeps/x86_64/__longjmp.S                         |    4 +
 sysdeps/x86_64/setjmp.S                            |    2 +
 50 files changed, 533 insertions(+), 79 deletions(-)
 create mode 100644 include/stap-probe.h
 create mode 100644 nptl/DESIGN-systemtap-probes.txt


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]