Skip to contentSkip to conversation

timer_create( ) invalid argument

Xenomai Konstantinos Chalas 3 participants 3 messages Aug 27, 2015 – Aug 28, 2015

lore
Share & tools
lore
#0 lore raw

Hello,

I have been trying to port some code from the Linux Kernel to the Cobalt Kernel, with no success.

When trying to call timer_create( ), i am getting the error timer_create: Invalid argument

I made the code snippet as small as possible.

#include <time.h>
#include <signal.h>
#include <stdio.h>

void timerfunction(union sigval handler)

{
        printf("timerfunction hello\n");
}

int main(int argc, char** argv)

{
        timer_t t;

        struct sigevent se;

        se.sigev_value.sival_ptr = 0;
        se.sigev_signo = 0;
        se.sigev_notify =  SIGEV_THREAD_ID;

        se.sigev_notify_attributes = 0;
        se.sigev_notify_function = timerfunction;

        if (timer_create(CLOCK_REALTIME, &se, &t) != 0) {
                perror("timer_create");
        }
        return 0;
}
#1 lore raw
Quoted 29 lines · Konstantinos Chalas

Hello,

I have been trying to port some code from the Linux Kernel to the Cobalt Kernel, with no success.

When trying to call timer_create( ), i am getting the error timer_create:
Invalid argument

I made the code snippet as small as possible.

#include <time.h>
#include <signal.h>
#include <stdio.h>

void timerfunction(union sigval handler)

{
        printf("timerfunction hello\n");
}

int main(int argc, char** argv)

{
        timer_t t;

        struct sigevent se;

        se.sigev_value.sival_ptr = 0;
        se.sigev_signo = 0;
        se.sigev_notify =  SIGEV_THREAD_ID;
Quoted 8 lines
        se.sigev_notify_attributes = 0;
        se.sigev_notify_function = timerfunction;

        if (timer_create(CLOCK_REALTIME, &se, &t) != 0) {
                perror("timer_create");
        }
        return 0;
}

I never tried using SIGEV_THREAD_ID with Xenomai, but I would expect a valid thread id to be required when doing this.

Signature · 2 lines
					    Gilles.
https://click-hack.org
#2 lore raw
Quoted 33 lines · Gilles Chanteperdrix
Quoted 32 lines · Konstantinos Chalas

Hello,

I have been trying to port some code from the Linux Kernel to the Cobalt Kernel, with no success.

When trying to call timer_create( ), i am getting the error timer_create:
Invalid argument

I made the code snippet as small as possible.

#include <time.h>
#include <signal.h>
#include <stdio.h>

void timerfunction(union sigval handler)

{
        printf("timerfunction hello\n");
}

int main(int argc, char** argv)

{
        timer_t t;

        struct sigevent se;

        se.sigev_value.sival_ptr = 0;
        se.sigev_signo = 0;
        se.sigev_notify =  SIGEV_THREAD_ID;

        se.sigev_notify_attributes = 0;
        se.sigev_notify_function = timerfunction;
Quoted 9 lines
Quoted 5 lines
        if (timer_create(CLOCK_REALTIME, &se, &t) != 0) {
                perror("timer_create");
        }
        return 0;
}

I never tried using SIGEV_THREAD_ID with Xenomai, but I would expect a valid thread id to be required when doing this.

Definitely. sigev_notify_thread_id is missing.

Signature · 1 line
Philippe.