A
Achint Mehta
Hi,
I am running purify on my program (on linux with gcc ver. 3.4.6)
I have installed a signal handler (for timer) using sigaction.
I am passing a pointer (data) into the sival_ptr which I intend to
access later in the signal handler.
timer_event.sigev_notify = SIGEV_SIGNAL;
timer_event.sigev_signo = SIGRTMIN;
timer_event.sigev_value.sival_ptr = data;
sigfillset (&timer_action.sa_mask);
timer_action.sa_flags = SA_SIGINFO ; /* realtime signal */
timer_action.sa_sigaction = handle_download_retry;
sigaction (SIGRTMIN, &timer_action, NULL);
....
timer_create(...)
...
timer_settime(...)
When I access this pointer in the signal handler purify gives me
Memory Segment error (which means that I am accessing memory from some
other segment)
I was accessing the pointer as
void handle_download_retry (int sigval, siginfo_t *extra, void *what)
{
. . .
p_msgData->data = (void *)(extra->si_value.sival_ptr); /* MSE :
Memory segment error */
}
However, even if I change the
p_msgData->data = (void *)(extra->si_value.sival_ptr);
to
p_msgData->data = (void *)(extra);
even then I get the error which means that purify doesn't like "extra"
being accessed.
Although the program does not dump core (with or without purify) but
can somebody tell me whether the signal handler code is correct ?
Thanks in advance.
Regards,
Achint
I am running purify on my program (on linux with gcc ver. 3.4.6)
I have installed a signal handler (for timer) using sigaction.
I am passing a pointer (data) into the sival_ptr which I intend to
access later in the signal handler.
timer_event.sigev_notify = SIGEV_SIGNAL;
timer_event.sigev_signo = SIGRTMIN;
timer_event.sigev_value.sival_ptr = data;
sigfillset (&timer_action.sa_mask);
timer_action.sa_flags = SA_SIGINFO ; /* realtime signal */
timer_action.sa_sigaction = handle_download_retry;
sigaction (SIGRTMIN, &timer_action, NULL);
....
timer_create(...)
...
timer_settime(...)
When I access this pointer in the signal handler purify gives me
Memory Segment error (which means that I am accessing memory from some
other segment)
I was accessing the pointer as
void handle_download_retry (int sigval, siginfo_t *extra, void *what)
{
. . .
p_msgData->data = (void *)(extra->si_value.sival_ptr); /* MSE :
Memory segment error */
}
However, even if I change the
p_msgData->data = (void *)(extra->si_value.sival_ptr);
to
p_msgData->data = (void *)(extra);
even then I get the error which means that purify doesn't like "extra"
being accessed.
Although the program does not dump core (with or without purify) but
can somebody tell me whether the signal handler code is correct ?
Thanks in advance.
Regards,
Achint