Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jun 2006 21:43:42 +0400 (MSD)
From:      Maxim Konovalov <maxim@macomnet.ru>
To:        Mikhail Teterin <mi+mx@aldan.algebra.com>
Cc:        threads@freebsd.org
Subject:   Re: SIGINFO and pthreads
Message-ID:  <20060608213618.O17062@mp2.macomnet.net>
In-Reply-To: <200606081218.17131.mi%2Bmx@aldan.algebra.com>
References:  <200606071906.25776.mi%2Bmx@aldan.algebra.com> <200606071916.38538.mi%2Bmx@aldan.algebra.com> <20060608081626.X6097@mp2.macomnet.net> <200606081218.17131.mi%2Bmx@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 8 Jun 2006, 12:18-0400, Mikhail Teterin wrote:

> ÞÅÔ×ÅÒ 08 ÞÅÒ×ÅÎØ 2006 00:17, Maxim Konovalov ÎÁÐÉÓÁ×:
> > Inline it if it's small. šMailman strips most attachments.
>
> Damn... Yes, it is small -- this is just a demo program. Compile it first as
>
> 	cc -o t t.c
>
> Then -- run and try various keyboard signals like Ctrl-C, Ctrl-Z,
> Ctrl-T (SIGINFO), or Ctrl-\. (It will not quit on its own, you'll
> have to kill it from another prompt.)
>
> They will all work. Then -- recompile as
>
> 	cc -o t -pthread t.c
>
> And run... This time around it will ignore the Ctrl-T, while
> continuing to respond to others.
>
> > libpthread uses SIGINFO for dumping thread information to a file but
> > looking over the code it seems it does allow to use SIGINFO to the
> > app.
>
> I'd like to be able to disable the debugging feature or, at least,
> force it to call my signal-handler AS EXPECTED AND DOCUMENTED, after
> it is done with its own dumping.

A funny thing your test program does work if you run it as

LIBPTHREAD_DEBUG=yes ./t

Try this patch:

Index: thread/thr_sigaction.c
===================================================================
RCS file: /home/ncvs/src/lib/libpthread/thread/thr_sigaction.c,v
retrieving revision 1.23
diff -u -p -r1.23 thr_sigaction.c
--- thread/thr_sigaction.c	13 Mar 2006 00:59:51 -0000	1.23
+++ thread/thr_sigaction.c	8 Jun 2006 17:30:31 -0000
@@ -75,7 +75,7 @@ _sigaction(int sig, const struct sigacti
 		 * Check if the kernel needs to be advised of a change
 		 * in signal action:
 		 */
-		if (act != NULL && sig != SIGINFO) {
+		if (act != NULL /* && sig != SIGINFO */) {

 			newact.sa_flags |= SA_SIGINFO;

%%%

For the first glance and quick test this check is not needed as we
dump threads in already installed for SIGINFO _thr_sig_handler().  Of
course we need our libpthreads experts review.

-- 
Maxim Konovalov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060608213618.O17062>