[lkml]   [1998]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectsigaction SA_SIGINFO functionality

I can't get sigaction to work with SA_SIGINFO type of handler. I can see
that this is already in the kernel but does it work?

This is the program that doesn't work:

#include <stdio.h>
#include <asm/signal.h> /* ???! */
#include <setjmp.h>
jmp_buf main_loop;

void sigsegv_handler (int arg, struct siginfo *si, void *parg)
printf ("Signal SEGV! si = 0x%p\n", si);
longjmp (main_loop, 1);
main ()
char *f = NULL;
int retval;
struct sigaction sa;
sigaction (SIGSEGV, NULL, &sa);
sa.sa_sigaction = sigsegv_handler;
sa.sa_flags = SA_SIGINFO;
sigemptyset (&sa.sa_mask);
retval = sigaction (SIGSEGV, &sa, NULL);
if (retval < 0)
exit (10);
printf ("Entering the loop\n");

if (setjmp (main_loop))
printf ("Back at main_loop\n");
*f = 0;
return 0;

This results in the following output:
Signal SEGV! si = 0x(nil)
Back at main_loop
Signal SEGV! si = 0x(nil)
Back at main_loop

So, the si parameter (as well as parg) is NULL. The kernel didn't realize
that I have a siginfo type of handler, did it?

Is it something with the program or the kernel?

Thanks in advance,
| Josip Gracin
| Zagreb, Croatia

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:46    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean