I am working on an embedded Linux system, which uses kernel-5.10.24.
It uses busybox as init, and has other utilities in rootfs, including adbd.
I can run adb shell
from PC to login to the embedded system, then I started a shell script to do something in a loop.
But I found that when I type ^C
to interrupt the script, it failed. I have to use ^Z
first, then kill -9 xxx
to stop the script running.
When the process is stopped by ^Z
, it read its /proc/pid_of_script/status
, I found followings,
SigPnd: 00000000000000000000000000000000
ShdPnd: 00000000000000000000000000020000
SigBlk: 00000000000000000000000000020000
SigIgn: 00000000000000000000000000001006
SigCgt: 00000000000000000000000000020000
The SigIgn masked the SIGINT (2). Then I checked its parent process and the grand-parent process (adbd), I found they all ignore SIGINT from their signal processing.
The adbd is started by /etc/init.d/rcS, which calls S50usb (S50usb also calls another script).
Then I changed to start S50usb in /etc/inittab after shell is running. But I got the same result as before.
I wonder if there is a way in run-time to adjust the script process's SigIgn, then SIGINT can stop its running?
rcS
possibly launchingadbd
in the background as inadbd &
? – LL3 Apr 26 '23 at 07:23adbd &
, so that is why SIGINT is ignored, since there is no controll terminal for it, right? – wangt13 Apr 26 '23 at 07:44