All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] timer_create( ) invalid argument
@ 2015-08-27 21:40 Konstantinos Chalas
  2015-08-27 23:49 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantinos Chalas @ 2015-08-27 21:40 UTC (permalink / raw)
  To: xenomai

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;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai] timer_create( ) invalid argument
  2015-08-27 21:40 [Xenomai] timer_create( ) invalid argument Konstantinos Chalas
@ 2015-08-27 23:49 ` Gilles Chanteperdrix
  2015-08-28  6:34   ` Philippe Gerum
  0 siblings, 1 reply; 3+ messages in thread
From: Gilles Chanteperdrix @ 2015-08-27 23:49 UTC (permalink / raw)
  To: Konstantinos Chalas; +Cc: xenomai

On Thu, Aug 27, 2015 at 11:40:48PM +0200, Konstantinos Chalas wrote:
> 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;
> }

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

-- 
					    Gilles.
https://click-hack.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xenomai] timer_create( ) invalid argument
  2015-08-27 23:49 ` Gilles Chanteperdrix
@ 2015-08-28  6:34   ` Philippe Gerum
  0 siblings, 0 replies; 3+ messages in thread
From: Philippe Gerum @ 2015-08-28  6:34 UTC (permalink / raw)
  To: Gilles Chanteperdrix, Konstantinos Chalas; +Cc: xenomai

On 08/28/2015 01:49 AM, Gilles Chanteperdrix wrote:
> On Thu, Aug 27, 2015 at 11:40:48PM +0200, Konstantinos Chalas wrote:
>> 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;
>> }
> 
> 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.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-28  6:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27 21:40 [Xenomai] timer_create( ) invalid argument Konstantinos Chalas
2015-08-27 23:49 ` Gilles Chanteperdrix
2015-08-28  6:34   ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.