problem getting correct SA_SIGINFO data with Solaris thread library

problem getting correct SA_SIGINFO data with Solaris thread library

Post by PBuchth » Wed, 14 Aug 1996 04:00:00

I am using Solaris2.4 on Sparc and X86 with all of the patches and when
I link in the thread library.  I am no longer able to get pid (SIGINFO)
in my signal handlers.  It works great if I don't link in the thread

I have tried kill and sigqueue with no luck.

Any thoughts?

Peter Buchthal


1. Problem between signal handlers and thread library on Solaris 2.4

I've encountered a problem setting up signal handlers whenever I
use the Solaris 2.4 thread library (-lthread). A very blatant example
of this occurs in the case of SIGTSTP. Consider the following program:

#include <signal.h>

void sigHandler(int sig, siginfo_t *info, void *arg)
        printf ("sig %d caught\n", sig);

        struct sigaction new;

        new.sa_handler = sigHandler;
        new.sa_flags = 0;
        if (sigaction (SIGTSTP, &new, (struct sigaction*)0) < 0)
         { perror ("sigaction");
        while (1)
         { sleep(1);

If I compile and load this using

% cc -o test test.c

then everything works fine: whenever the program receives a SIGSTP the
handler gets called and its message is printed. But if I compile using

% cc -D_REENTRANT -o systest systest.c -lthread

the SIGSTP is ignored.

I'm new to working with threads and so of course I may have missed
some crucial detail, but a couple of passes through the manuals haven't
turned up anything. By poking around with debuggers I have figured
out the when you link in -lthread the program automatically starts
up an invisible LWP, and a couple of threads, and *these* appear
to take over the signal handling for the program. And in fact the signal
*is* received by the internal LWP. However, for some reason it is not
being passed on the main program.

Any information would be greatly appreciated.


John Lloyd                                  Tel: (604) 822-5109 (office)
Department of Computer Science              Msg: (604) 822-6281 (LCI office)
201 - 2366 Main Mall                        Fax: (604) 822-5485

Vancouver, B.C.  V6T 1Z4                    Office: CICSR 129

2. "Merge on" fill plotting

3. getting multi-thread CPU time in Solaris 2.6

4. Introduction to the mims-iris font archive

5. linking into thread library on Solaris

6. How can I control Pocket Internet Explorer via COM-interfaces?

7. threading library on solaris 7 and freebsd 4.2

8. Thread-private static data with Solaris ?

9. Solaris vs POSIX thread library

10. Solaris 2.4 Threads in a shared library

11. Newbie. DCE threads library for Solaris?

12. POSIX vs Solaris threads on Solaris 2.6