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

Problems Creating POSIX Timers SIGEV_THREAD notification



On 12/03/2010 03:24 AM, Sam Lost wrote:
> I am having some problems with POSIX Timers under RTEMS.
> I am currently evaluating the RTEMS Operating System to access it's 
> suitability.
> I have a module written to the POSIX API I have been able to compile 
> an run the code under Linux and under a number of COTS RTOS's.
> However I am unable to create a Timer using 
> the  timer_create() function when setting event.sigev_notify = 
> SIGEV_THREAD.
This looks like something that would have to be added to RTEMS.  It 
doesn't look
terribly difficult to implement but it would have to be implemented.


  AFAIK SIGEV_THREAD was not in the original 1003.1b-1996 and no one has 
asked
about it or needed it until you.  If you want it implemented, you could 
use OAR's
consulting services and we could implement it for you or you could 
implement
it yourself and submit it.  This is just the way of free software -- 
things are
added as users need them.

> The following document has been unable to help as the timer_create 
> information is limited
> http://www.rtems.com/onlinedocs/doc-current/share/rtems/pdf/posix_users.pdf
Yep.  With the opengroup spec online, there isn't that much to say.  We 
have permission
line NetBSD and Linux man pages to reuse the text from the standard.
> I notice from the following document:
> http://www.rtems.com/onlinedocs/doc-current/share/rtems/pdf/posix1003_1.pdf
> that the POSIX timer_create() function is implemented as opposed to a 
> partial implementation
That would be against the original 1003.1b-1996 document.  We have 
functionality
from newer revisions but an audit hasn't been done to update that.
> Below is the section of code that I am attempting to run
>
> {
>    ts_device_configuration *device_configuration  = 
> device_configuration_table;
>    tGDEF_UINT8                  loop_count                    = 0;
>    struct sigevent                event                            = {0};
>    int                                    
> status                           = EERROR;
>
>    event.sigev_notify = SIGEV_THREAD;
>    event.sigev_notify_attributes = NULL;
>    event.sigev_signo = SIGALRM;
>    event.sigev_notify_function = device_alarm_signal_handler;
>    event.sigev_value.sival_ptr = (void*)device_configuration;
>
>    for(loop_count = 0; loop_count < 
> DEVICE_TASK_NUMBER_OF_DEVICES_SUPPORTED; loop_count++, 
> device_configuration++)
>    {
>       /*lint --e(506) Constant value Boolean */
>       assert(device_configuration != NULL);
>
>       status = timer_create(CLOCK_REALTIME, &event, 
> &device_configuration->device_posix_timer_id);
>       if(status == EERROR)
>       {
>          (void)printf("Timer Create Error: %s\r\n",strerror(errno));
>       }
>
>       /*lint --e(792) void cast of void expression */
>       assert(status == EOK);
>    }
> }
>
> I receive a Invalid argument error number.
>
> I noticed the following within the timer_create function 
> (timercreate.c) which appear to suggest that RTMES does not support 
> SIGEV_THREAD notification.
>
> 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 );
>
> }
>
> Am I missing something or is SIGEV_THREAD notification from POSIX 
> timers not supported?
Doesn't look like it.  We would be happy to support them.
> Regards
> Sam


-- 
Joel Sherrill, Ph.D.             Director of Research&  Development
joel.sherrill at OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985