POSIX timer_create

Joel Sherrill <joel@OARcorp.com> joel.sherrill at OARcorp.com
Fri Jun 4 15:04:48 UTC 2004

Richard M. Barry wrote:
> When I call timer_create in my code, I get a errno=EINVAL.  According to the timer_create man page, this means the timerid I used was invalid, but I used CLOCK_REALTIME, so it should be fine.  Earlier in the code I set the clock, and it gives me the correct time when I red back the time, so I'm assuming the clock works.  What am I missing? The call to timer_create is below:
> status = timer_create ( CLOCK_REALTIME, &Procs.event, &Procs.timer_id );
> if( status == -1 )
> {
>   syslog( LOG_INFO, "Could not create a timer);
>         switch (errno) {
>            case EAGAIN : printf("errno=EAGAIN\n");break;
>            case EINVAL : printf("errno=EINVAL\n");break;
>            case ENOSYS : printf("errno=ENOSYS\n");break;
>            default : printf("Unknown error\n");
>    }
> }

Is the event structure properly initialized?  Look at
cpukit/posix/src/ptimer1.c and you can ee what is being

Did you configure timers?

And there is a bug in confdefs.h so configure RTEMS timers NOT
POSIX timers.

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

More information about the users mailing list