timer_create problem

Joel Sherrill joel.sherrill at oarcorp.com
Wed Jun 13 19:13:24 UTC 2007


Aitor.Viana.Sanchez at esa.int wrote:
>
> Hi all,
>
> i am having a look to the CANFestival v3.0 trying to port it to RTEMS. 
> I get the code already running over RTEMS but I have a problem with 
> the timer_create POSIX function.
>
> The main.c source code gets inside the RTEMS configuration which 
> includes:
>
> ...
> #define CONFIGURE_MAXIMUM_TIMERS            10
> ...
>
> /** RTEMS Configuration */
> #define CONFIGURE_MAXIMUM_RTEMS_TIMERS CONFIGURE_MAXIMUM_TIMERS
> ...
>
> /** POSIX Configuration */
> #define CONFIGURE_MAXIMUM_POSIX_TIMERS          CONFIGURE_MAXIMUM_TIMERS
> ...
>
> When I try to create a timer calling the timer_create routine:
>         ....
>
>         memset (&sigev, 0, sizeof (struct sigevent));
>         sigev.sigev_value.sival_int = 0;
>         sigev.sigev_notify = SIGEV_THREAD;
>         sigev.sigev_notify_attributes = NULL;
>         sigev.sigev_notify_function = timer_notify;
>
>         status = timer_create (CLOCK_REALTIME, &sigev, &timer);
>         if (status != 0)
>                            MSG_ERR(errno, strerror(errno), status);
>
>         .....
>
> i got an error which is quite weird. I got the errno = 22 which is 
> "invalid argument", that means that the specified clockid 
> (CLOCK_REALTIME) is not defined. Nevertheless, i tried to call the 
> function clock_gettime, which also needs the clockid (CLOCK_REALTIME) 
> as a parameter, and i got no problem at all.
>
> I am using RTEMS 4.6.5.
>
> Do you have any idea that could help me to solve this problem ?
>
Looking in cpukit/posix/src/ptimer1.c, I see other reasons for EINVAL:

  if (evp != NULL) {
    /* The structure has data */
    if ( ( evp->sigev_notify != SIGEV_NONE ) &&
         ( evp->sigev_notify != SIGEV_SIGNAL ) ) {
       /* The value of the field sigev_notify is not valid */
       rtems_set_errno_and_return_minus_one( EINVAL );
     }

     if ( !evp->sigev_signo )
       rtems_set_errno_and_return_minus_one( EINVAL );

     if ( !is_valid_signo(evp->sigev_signo) )
       rtems_set_errno_and_return_minus_one( EINVAL );
  }


It looks like SIGEV_THREAD is not currently supported. 

If you need it, I would be happy to give you an estimate on
implementing it for you.

Thanks.

--joel
> Cheers
>
>
>
> -----------------------------
> Aitor Viana Sánchez
>
> ESA - European Space Technology Centre (ESTEC)
> TEC-EDD - Data Handling and Computing Section
> ESA/ESTEC P.O. Box 299 / 2200AG Noordwijk ZH, The Netherlands
> Tel (+31) 71 565 6727
> Email: aitor.viana.sanchez at esa.int
> ------------------------------------------------------------------------
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>   




More information about the users mailing list