You can set the SIGIGN disposition in any application using a little perl:
perl -e '$SIG{"USR1"} = "IGNORE"; exec(@ARGV)' realprogram realargs...
until the realprogram changes the signals, then it remains safe from them.
, , , fork(), exec() exec().
. bash, (GAH!), , .
:
natsu:~$ grep SigIgn /proc/$$/status
SigIgn: 0000000000384004
:
natsu:~$ trap '' USR1
natsu:~$ grep SigIgn /proc/$$/status
SigIgn: 0000000000384204
: (
natsu:~$ bash
natsu:~$ grep SigIgn /proc/$$/status
SigIgn: 0000000000384004
natsu:~$ kill -USR1 $$
User defined signal 1
perl:
natsu:~$ perl -e '$SIG{"USR1"} = "IGNORE"; exec(@_)' bash
natsu:~$ grep SigIgn /proc/$$/status
SigIgn: 0000000000384204
natsu:~$ kill -USR1 $$
natsu:~$