diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2013-11-11 23:54:30 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2013-11-12 15:00:13 +0000 |
commit | ae5aa47370455123bf84e52dd8354d26c29efea8 (patch) | |
tree | 8f6dd70b24bf696ba8dac5c1ec09bcb761124756 | |
parent | a0e02f5d52e4e10d6e46522c7233dc4914d4010b (diff) | |
download | strace-ae5aa47370455123bf84e52dd8354d26c29efea8.tar.gz strace-ae5aa47370455123bf84e52dd8354d26c29efea8.tar.bz2 strace-ae5aa47370455123bf84e52dd8354d26c29efea8.tar.xz |
Make SIGEV_THREAD_ID decoding less glibc specific
SIGEV_THREAD_ID decoding requires access to an internal member of
struct sigevent. There seems to be no portable way to do it besides
adding a configure check.
* configure.ac (AC_CHECK_MEMBERS): Check for
struct sigevent._sigev_un._pad and struct sigevent.__pad.
* time.c (printsigevent): Use an appropriate struct sigevent member
to print thread id.
Reported by John Spencer.
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | time.c | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index a2cc89b..a60b25f 100644 --- a/configure.ac +++ b/configure.ac @@ -258,6 +258,9 @@ AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>]) AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>]) +AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad, + struct sigevent.__pad],,, [#include <signal.h>]) + AC_CHECK_DECLS([sys_errlist]) AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>]) AC_CHECK_DECLS(m4_normalize([ @@ -781,10 +781,17 @@ printsigevent(struct tcb *tcp, long arg) printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???"); tprints(", "); if (sev.sigev_notify == SIGEV_THREAD_ID) +#if defined(HAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD) /* _pad[0] is the _tid field which might not be present in the userlevel definition of the struct. */ tprintf("{%d}", sev._sigev_un._pad[0]); +#elif defined(HAVE_STRUCT_SIGEVENT___PAD) + tprintf("{%d}", sev.__pad[0]); +#else +# warning unfamiliar struct sigevent => incomplete SIGEV_THREAD_ID decoding + tprints("{...}"); +#endif else if (sev.sigev_notify == SIGEV_THREAD) tprintf("{%p, %p}", sev.sigev_notify_function, sev.sigev_notify_attributes); |