[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

timer_settime doesn't fill siginfo_t



Marek Prochazka wrote:
> It seems to me that RTEMS implementation of POSIX timers just does not
> pass the sigev_value data structure at all. It saves the value in the
> timer_create():
>
> ptimer1.c: 
>         if ( evp != NULL ) {
>            timer_struct[timer_pos].inf.sigev_notify = evp->sigev_notify;
>            timer_struct[timer_pos].inf.sigev_signo  = evp->sigev_signo;
>            timer_struct[timer_pos].inf.sigev_value  = evp->sigev_value;
>         }
>
> But in FIRE_TIMER_S(), which is the function called when a timer
> expires, pthread_kill() is used and this obviously only passes signal
> number and not other values which should be passed (e.g. si_code ==
> SI_TIMER, and also the sigev_value).
>
> A question for RTEMS experts is whether this could be fixed somehow.
>
>   
I completely reimplemented this between 4.6 and 4.7 but the call to 
pthread_kill
is still at the middle. 

With me teaching the class this week, I don't have much time to even 
make a suggestin

but I think I have one.  Please try to convert the call to pthread_kill 
to a call to
boolean _POSIX_signals_Unblock_thread(
  Thread_Control  *the_thread,
  int              signo,
  siginfo_t       *info
)

Does that look like it will help?

Can you try to remedy it in your source and submit a patch along with a 
test case?

--joel

--joel

> Marek
>
>
>   
>> -----Original Message-----
>> From: 
>> rtems-users-bounces+marek.prochazka=scisys.co.uk at rtems.org 
>> [mailto:rtems-users-bounces+marek.prochazka=scisys.co.uk at rtems
>> .org] On Behalf Of Patricia Lopez-Cueva
>> Sent: 27 February 2007 16:33
>> To: rtems-users at rtems.org
>> Subject: timer_settime doesn't fill siginfo_t
>>
>> 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
>>
>>  
>>
>>  
>>
>>
>>     
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>