SIGINT Issues with Zeus Migration


Aashik Aswin
 

Hello Developers,

I recently migrated all my platform Recipes from Thud (Linux 4.19) to Zeus (5.4). I understand there might be compatibility issues and was able to fix most of them.

However one issue I am facing is that in the newly migrated Zeus Image is that I am not able to send SIGINT to commands such as Ping, tail etc. I am only able to run them in non-interactive mode. I have to reboot the box if I executed those above commands in interactive mode. 

Can anyone suggest which recipe/config can be a good starting point?

Please let me know your suggestions.

Thanks,
Aashik


Zoran
 

...that I am not able to send SIGINT to commands such as Ping, tail etc.
Please, do the following: issue in zeus xterm the command: man signal
and read it.

Then execute the following code (ad-hoc from the top of my head):

#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

typedef void (*sighandler_t)(int);
sighandler_t signal_handler;
sighandler_t signal(int signum, sighandler_t handler);

int main() {
signal_handler = signal(SIGINT, SIG_DFL);
printf ("Old signal handler is 0x%x\n", signal_handler);
}

Where the following is also known:
#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */

This program serves the double purpose:
[1] Gives you the address of the old SIGINT handler which was executed
prior execution of this code;
[2] After execution, repeat the routine (ping) and see if <ctrl c>
terminates the ping process.

All other comments are obvious (testing the Zeus SIGINT signal, yada
yada yada... ;-)

Zoran
_______

On Fri, Sep 25, 2020 at 6:48 AM Aashik Aswin <thisisaash9698@...> wrote:

Hello Developers,

I recently migrated all my platform Recipes from Thud (Linux 4.19) to Zeus (5.4). I understand there might be compatibility issues and was able to fix most of them.

However one issue I am facing is that in the newly migrated Zeus Image is that I am not able to send SIGINT to commands such as Ping, tail etc. I am only able to run them in non-interactive mode. I have to reboot the box if I executed those above commands in interactive mode.

Can anyone suggest which recipe/config can be a good starting point?

Please let me know your suggestions.

Thanks,
Aashik



Leon Woestenberg
 

Hi Aashik, Zoran,


On Fri, Sep 25, 2020 at 10:02 AM Zoran <zoran.stojsavljevic@...> wrote:

...that I am not able to send SIGINT to commands such as Ping, tail etc.\
Aashik, how are you sending the signal? Using CTRL-C or using the
"kill" command?


Please, do the following: issue in zeus xterm the command: man signal
and read it.
That reads to use sigaction() instead of signal() I would assume.

Then execute the following code (ad-hoc from the top of my head):
<...>
This program serves the double purpose:
[1] Gives you the address of the old SIGINT handler which was executed
prior execution of this code;
[2] After execution, repeat the routine (ping) and see if <ctrl c>
terminates the ping process.
Zoran, are you suggesting that program will change the signal handler
to default even after it has exited, and for the subsequent ping
command?

Regards,

Leon.


Zoran
 

Hello Leon,

Aashik, how are you sending the signal? Using CTRL-C or
using the "kill" command?
This is a good suggestion for the test. To open another terminal and
issue: kill -SIGINT <ping PID>.

I should add that this MUST work: kill -SIGKILL <ping PID>, since
SIGKILL handler is un-preemptable.

If it does not, something is very wrong... I suggest, Aashik, you
write YOCTO bugzilla for Zeus.

Zoran, are you suggesting that the program will change the signal
handler to default even after it has exited, and for the subsequent
ping command?
Yes, I do. Then, the ping command should be issued again, and my best
guess is, it should terminate the ping process.

Leon, you should try to write another C f-n and to install other
SIGINT handler (replacing SIG_DFL), then test it with my original C:

void myhandler(int signum) {
if (SIGINT == signum)
printf("\nHey, I got SIGINT: %d\n\n",signum);
}

Zoran
_______

On Fri, Sep 25, 2020 at 10:54 AM Leon Woestenberg <leon@...> wrote:

Hi Aashik, Zoran,


On Fri, Sep 25, 2020 at 10:02 AM Zoran <zoran.stojsavljevic@...> wrote:

...that I am not able to send SIGINT to commands such as Ping, tail etc.\
Aashik, how are you sending the signal? Using CTRL-C or using the
"kill" command?


Please, do the following: issue in zeus xterm the command: man signal
and read it.
That reads to use sigaction() instead of signal() I would assume.

Then execute the following code (ad-hoc from the top of my head):
<...>
This program serves the double purpose:
[1] Gives you the address of the old SIGINT handler which was executed
prior execution of this code;
[2] After execution, repeat the routine (ping) and see if <ctrl c>
terminates the ping process.
Zoran, are you suggesting that program will change the signal handler
to default even after it has exited, and for the subsequent ping
command?

Regards,

Leon.


Aashik Aswin
 

Hi Leon, Zoran

I am using Ctrl+C to kill the Ping command.


Thanks.

On Fri, Sep 25, 2020 at 3:56 PM Zoran Stojsavljevic <zoran.stojsavljevic@...> wrote:
Hello Leon,

> Aashik, how are you sending the signal? Using CTRL-C or
> using the "kill" command?

This is a good suggestion for the test. To open another terminal and
issue: kill -SIGINT <ping PID>.

I should add that this MUST work: kill -SIGKILL <ping PID>, since
SIGKILL handler is un-preemptable.

If it does not, something is very wrong... I suggest, Aashik, you
write YOCTO bugzilla for Zeus.

> Zoran, are you suggesting that the program will change the signal
> handler to default even after it has exited, and for the subsequent
> ping command?

Yes, I do. Then, the ping command should be issued again, and my best
guess is, it should terminate the ping process.

Leon, you should try to write another C f-n and to install other
SIGINT handler (replacing SIG_DFL), then test it with my original C:

void  myhandler(int signum) {
        if (SIGINT == signum)
                printf("\nHey, I got SIGINT: %d\n\n",signum);
}

Zoran
_______

On Fri, Sep 25, 2020 at 10:54 AM Leon Woestenberg <leon@...> wrote:
>
> Hi Aashik, Zoran,
>
>
> On Fri, Sep 25, 2020 at 10:02 AM Zoran <zoran.stojsavljevic@...> wrote:
> >
> > > ...that I am not able to send SIGINT to commands such as Ping, tail etc.\
>
> Aashik, how are you sending the signal? Using CTRL-C or using the
> "kill" command?
>
> >
> > Please, do the following: issue in zeus xterm the command: man signal
> > and read it.
> >
> That reads to use sigaction() instead of signal() I would assume.
>
> > Then execute the following code (ad-hoc from the top of my head):
> > <...>
> > This program serves the double purpose:
> > [1] Gives you the address of the old SIGINT handler which was executed
> > prior execution of this code;
> > [2] After execution, repeat the routine (ping) and see if <ctrl c>
> > terminates the ping process.
> >
>
> Zoran, are you suggesting that program will change the signal handler
> to default even after it has exited, and for the subsequent ping
> command?
>
> Regards,
>
> Leon.


Leon Woestenberg
 

Hello Aashik,

I recognize the issue that CTRL-C does not pass from the console, but only with *very* minimal configurations.

How does your local.conf look like, or better yet how can we reproduce your case?

Regards, Leon

On Fri, 25 Sep 2020 at 12:46, Aashik Aswin <thisisaash9698@...> wrote:
Hi Leon, Zoran

I am using Ctrl+C to kill the Ping command.


Thanks.

On Fri, Sep 25, 2020 at 3:56 PM Zoran Stojsavljevic <zoran.stojsavljevic@...> wrote:
Hello Leon,





> Aashik, how are you sending the signal? Using CTRL-C or


> using the "kill" command?





This is a good suggestion for the test. To open another terminal and


issue: kill -SIGINT <ping PID>.





I should add that this MUST work: kill -SIGKILL <ping PID>, since


SIGKILL handler is un-preemptable.





If it does not, something is very wrong... I suggest, Aashik, you


write YOCTO bugzilla for Zeus.





> Zoran, are you suggesting that the program will change the signal


> handler to default even after it has exited, and for the subsequent


> ping command?





Yes, I do. Then, the ping command should be issued again, and my best


guess is, it should terminate the ping process.





Leon, you should try to write another C f-n and to install other


SIGINT handler (replacing SIG_DFL), then test it with my original C:





void  myhandler(int signum) {


        if (SIGINT == signum)


                printf("\nHey, I got SIGINT: %d\n\n",signum);


}





Zoran


_______





On Fri, Sep 25, 2020 at 10:54 AM Leon Woestenberg <leon@...> wrote:


>


> Hi Aashik, Zoran,


>


>


> On Fri, Sep 25, 2020 at 10:02 AM Zoran <zoran.stojsavljevic@...> wrote:


> >


> > > ...that I am not able to send SIGINT to commands such as Ping, tail etc.\


>


> Aashik, how are you sending the signal? Using CTRL-C or using the


> "kill" command?


>


> >


> > Please, do the following: issue in zeus xterm the command: man signal


> > and read it.


> >


> That reads to use sigaction() instead of signal() I would assume.


>


> > Then execute the following code (ad-hoc from the top of my head):


> > <...>


> > This program serves the double purpose:


> > [1] Gives you the address of the old SIGINT handler which was executed


> > prior execution of this code;


> > [2] After execution, repeat the routine (ping) and see if <ctrl c>


> > terminates the ping process.


> >


>


> Zoran, are you suggesting that program will change the signal handler


> to default even after it has exited, and for the subsequent ping


> command?


>


> Regards,


>


> Leon.




--
-- 
Leon Woestenberg
leon@...
T: +31 40 711 42 76
M: +31 6 472 30 372

Sidebranch Embedded Systems
Eindhoven, The Netherlands
http://www.sidebranch.com