timer_settime doesn't fill siginfo_t
Patricia Lopez-Cueva
Patricia.Lopez-Cueva at scisys.co.uk
Tue Feb 27 16:33:25 UTC 2007
Hi all.
I'm programming an application that uses Posix timers in rtems. I have
to pass to the signal handler information so I have to use SA_SIGINFO
and put the information in the sigevent structure.
The problem is that when the handler is called and I access to the
siginfo_t parameter and in the si_value.sival_ptr the information I
store is not there.
Following it is included the code:
struct sigevent t_Evp;
struct sigaction t_SigAction;
/* Initialise signal handler */
sigemptyset(&t_SigAction.sa_mask);
t_SigAction.sa_flags = SA_SIGINFO;
t_SigAction.sa_sigaction = &SignalHandler;
if (0 != sigaction(SIGUSR1, &t_SigAction, NULL))
{
ERROR("Failed to install signal handler using
sigaction\n");
return G_STATUS_FAILURE;
}
/* Create timer */
DEBUG("Creating POSIX timer\n");
t_Evp.sigev_notify = SIGEV_SIGNAL;
t_Evp.sigev_signo = SIGUSR1;
t_Evp.sigev_value.sival_ptr = &pt_Timer;
if (0 != (i_Status = timer_create(CLOCK_REALTIME, &t_Evp,
&pt_Timer)))
{
ERROR("Failed to create timer using timer_create\n");
switch (errno)
{
case EAGAIN:
ERROR("EAGAIN: Lacked necessary
resources or too many timers\n");
break;
case EINVAL:
ERROR("EINVAL: Invalid attributes or
clock id\n");
break;
default:
ERROR1("Unknown error = %d\n", errno);
}
errno = 0;
return G_STATUS_FAILURE;
}
static void SignalHandler(
int i_Signo,
siginfo_t * pt_Info,
void * pv_Context);
Is there any error in the code? Someone knows why it happens?
Many thanks
Patricia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20070227/35bea03b/attachment.html>
More information about the users
mailing list