hello,
I'm a student and we are working on FreeBSD.
My problem is i don't understand how to use SA_SIGINFO and siginfo_t.
The following code caught my SIGUSR1 with a "kill -30 my_server_pid"
from my shell.
but siginfo_t is empty when i'm debugging my program with gdb.
my output is :
> pid 0
and in gdb i have :
{
si_signo = 30,
si_errno = 0,
si_code = 0,
si_pid = 0,
si_uid = 0,
si_status = 0,
si_addr = 0x2,
si_value = {sigval_int = 0,sigval_ptr = 0x0},
si_band = 0,
__spare__ = {0, 0, 0, 0, 0, 0, 0}
}

anyone have an idea why my siginfo_t is empty please ?
Here is my code:

#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>

static void     addtrue(int sig, siginfo_t *info,  void *ctx) 
{ 
        printf("pid %i\n", info->si_pid); 
}
 
static void     init_server() 
{ 
        struct sigaction test; 
        memset(&test, 0, sizeof(test)); 
        test.sa_flags = SA_SIGINFO; 
        test.sa_sigaction = addtrue; 
        sigaction(SIGUSR1, &test, NULL); 
        getchar();
}

int     main() 
{
        printf("my pid: %i\n", getpid());
        init_server(); 
        return (0); 
}



_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to