Skip to contentSkip to conversation

Printf stops working after receiving signal.

Xenomai-help Steve Deiters 2 participants 7 messages Sep 24, 2009 – Sep 25, 2009

lore
Share & tools
lore
#0 lore raw

I have a simple little test program, attached below. When I hit CTL-C to break the program, not all of the "finished" lines will print. If I remove either the rt_task_shadow call or the sigwait at the end, it will then print all of them. Adding a fflush(stdout) to the end does nothing to help it.

I'm not sure if there's some interaction with the Xenomai domain I am just missing which is causing the print statements to be dropped.

This is running on a PowerPC kernel 2.6.24 with Xenoami 2.4.9.

-----------------------------------------------------
#include <signal.h>
#include <stdio.h>
#include <native/task.h>

static volatile int signaled = 0;

static void catch(int x)
{
signaled = 1;
}

static RT_TASK rt_main;

int main(int argc, char **argv)
{
int sig;
struct sigaction act;
sigset_t set;
rt_task_shadow(&rt_main, NULL, 99, 0);

   act.sa_flags = 0;
   act.sa_handler = catch;
   sigemptyset(&act.sa_mask);
   sigaction(SIGINT,&act,NULL);

   printf("starting 1\n");
   printf("starting 2\n");
   printf("starting 3\n");
   printf("starting 4\n");
   printf("starting 5\n");

   while(!signaled)
   {
      sleep(1);
      printf(".");
      fflush(stdout);
   }

   printf("\nfinished 1\n");
   printf("finished 2\n");
   printf("finished 3\n");
   printf("finished 4\n");
   printf("finished 5\n");

   sigfillset(&set);
   sigwait(&set,&sig);

return 0;
}

#1 lore raw
Quoted 10 lines · Steve Deiters

I have a simple little test program, attached below. When I hit CTL-C to break the program, not all of the "finished" lines will print. If I remove either the rt_task_shadow call or the sigwait at the end, it will then print all of them. Adding a fflush(stdout) to the end does nothing to help it.

I'm not sure if there's some interaction with the Xenomai domain I am just missing which is causing the print statements to be dropped.

This is running on a PowerPC kernel 2.6.24 with Xenoami 2.4.9.

Do not know if this is related, but sigwait is only guaranteed to work if you wait for signals that are currently masked.

Signature · 1 line
					    Gilles.
#2 lore raw
In reply to Steve Deiters
Quoted 10 lines · Steve Deiters

I have a simple little test program, attached below. When I hit CTL-C to break the program, not all of the "finished" lines will print. If I remove either the rt_task_shadow call or the sigwait at the end, it will then print all of them. Adding a fflush(stdout) to the end does nothing to help it.

I'm not sure if there's some interaction with the Xenomai domain I am just missing which is causing the print statements to be dropped.

This is running on a PowerPC kernel 2.6.24 with Xenoami 2.4.9.

Xenomai 2.4.9 has no I-pipe patch for Linux 2.6.24 for PowerPC. And you should be using Xenomai 2.4.9.1 and one of the patches it contains. Earlier patches and earlier revisions are buggy.

Signature · 1 line
					    Gilles.
#3 lore raw

I upgraded to Xenomai 2.4.9.1 and get the same behavior. Any other ideas as to what may be causing this?

Thanks.

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]
Sent: Thursday, September 24, 2009 2:49 PM
To: Steve Deiters
Cc: [email protected]
Subject: Re: [Xenomai-help] Printf stops working after receiving signal.

Quoted 11 lines · Steve Deiters

I have a simple little test program, attached below. When I hit CTL-C

to break the program, not all of the "finished" lines will print. If I remove either the rt_task_shadow call or the sigwait at the end, it will then print all of them. Adding a fflush(stdout) to the end does nothing to help it.

I'm not sure if there's some interaction with the Xenomai domain I am just missing which is causing the print statements to be dropped.

This is running on a PowerPC kernel 2.6.24 with Xenoami 2.4.9.

Xenomai 2.4.9 has no I-pipe patch for Linux 2.6.24 for PowerPC. And you should be using Xenomai 2.4.9.1 and one of the patches it contains. Earlier patches and earlier revisions are buggy.

Signature · 1 line
					    Gilles.
#4 lore raw
Quoted 2 lines · Steve Deiters

I upgraded to Xenomai 2.4.9.1 and get the same behavior. Any other ideas as to what may be causing this?

With one of the I-pipe patches which comes with Xenomai 2.4.9.1 ?

Signature · 1 line
					    Gilles.
#5 lore raw

This is the name of the patch from the Xenomai source package it
installs: adeos-ipipe-2.6.24.6-powerpc-DENX-2.4-03.patch.

I checked the adeos download site
(http://download.gna.org/adeos/patches/v2.6/powerpc/older/) and there is no newer one listed for this version of the kernel.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gilles Chanteperdrix
Sent: Friday, September 25, 2009 2:26 AM
To: Steve Deiters
Cc: [email protected]
Subject: Re: [Xenomai-help] Printf stops working after receiving signal.

Quoted 2 lines · Steve Deiters

I upgraded to Xenomai 2.4.9.1 and get the same behavior. Any other ideas as to what may be causing this?

With one of the I-pipe patches which comes with Xenomai 2.4.9.1 ?

Signature · 6 lines
					    Gilles.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
#6 lore raw
Quoted 6 lines · Steve Deiters

This is the name of the patch from the Xenomai source package it
installs: adeos-ipipe-2.6.24.6-powerpc-DENX-2.4-03.patch.

I checked the adeos download site
(http://download.gna.org/adeos/patches/v2.6/powerpc/older/) and there is no newer one listed for this version of the kernel.

Ok. I did not know that a patch for this version of the kernel was included in xenomai 2.4.9.1. But it is seems to have the bug that was fixed in later releases. Anyway, I will let Philippe answer you from there.

Signature · 1 line
                                          Gilles