Enabling Signals in kernel

Haojian Zhuang haojian.zhuang at gmail.com
Tue Apr 12 21:01:00 EDT 2011

On Wed, Apr 13, 2011 at 12:06 AM, Vijay Ram Chitrapu
<chitrapu.vijayram at gmail.com> wrote:
> Hi experts,
> I am using MVL6.0 in my project and have customized the kernel as per
> the requirement. However, i am facing a problem where the Ctrl+C
> signal doesn't get caught (or not sure if it is even generated) on the
> target platform. I have tried using the "trap" at the shell to capture
> the signal but the signal just doesn't get caught. Below is what i
> have done to try the trap way
> trap " " INT
It means that ignore INT signal.

> echo "Catching Ctrl+C signal"
> trap INT
> sleep 5

You can try this to capture "Ctrl+C" signal.

trap 'echo "Catching Ctrl+C signal"' 2

> Putting this piece of code into a script doesn't catch the signal
> SIGINT (ctrl+c). To understand if it was a problem with the shell, i
> wrote a C code to register my own signal handler for SIGINT signal. To
> verify the correctness of the code, i executed the C code on the HOST
> server and it works well there (signal handler gets invoked when
> ctrl+c is pressed). Whereas, the same C code doesn't catch the Ctr+C
> signal in the target platform.
> Can someone tell me if there is any specific way to identify is there
> a way or rather is there a need to enable the signals explicitly while
> creating the config file for the kernel? Below is the output of "stty
> -a" command at the shell where i need to catch the Ctrl+C signal.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> / # stty -a
> speed 115200 baud; rows 24; columns 80;
> intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;
> eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;
> werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;
> -parenb -parodd cs8 hupcl -cstopb cread clocal crtscts
> -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
> -iuclc -ixany -imaxbel
> opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
> isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
> echoctl echoke
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Regards,
> Vijay
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

More information about the Kernelnewbies mailing list