嗯,kill -9能被捕捉吗?

17 views
Skip to first unread message

Hu.Ziming

unread,
Jul 30, 2012, 11:44:47 PM7/30/12
to linu...@googlegroups.com
signal handler中,能自己写东西处理酒杀吗?thx~

Wang Xu

unread,
Jul 30, 2012, 11:50:05 PM7/30/12
to linu...@googlegroups.com
这个不能吧

在 2012年7月31日星期二,Hu.Ziming 写道:
signal handler中,能自己写东西处理酒杀吗?thx~

--
To post to this group, send email to linu...@googlegroups.com
website: http://linuxfb.net
twitter: http://twitter.com/linuxfb
IRC: #linux...@irc.freenode.net
slideshare: http://www.slideshare.net/linuxfb


--
Wang Xu

Yang Bai

unread,
Jul 30, 2012, 11:57:30 PM7/30/12
to linu...@googlegroups.com
SIGKILL不能捕获或者忽略。
Keep It Simple,Stupid.
"""

Chinese Name: 白杨
Nick Name: Hamo
Homepage: http://hamobai.com/
GPG KEY ID: 0xA4691A33
Key fingerprint = 09D5 2D78 8E2B 0995 CF8E 4331 33C4 3D24 A469 1A33

张小鱼

unread,
Jul 30, 2012, 11:50:03 PM7/30/12
to linu...@googlegroups.com

不能。
这个信号的作用是给超级用户一个可靠的杀死进程的方法。如果你可以捕捉,你就可以不退出,那这个方法也就不再可靠了。
一般方法是尽量提高权限,只有root可以杀死进程,当然这么设计也是不好的。

Hu.Ziming

unread,
Jul 30, 2012, 11:59:45 PM7/30/12
to linu...@googlegroups.com
唔,好吧,知道了
那at_exit这种东西,能用来在被kill后打印出东西吗?还没试,想先问问有没有弄过的
thx~

Peng Tao

unread,
Aug 3, 2012, 2:25:22 AM8/3/12
to linu...@googlegroups.com
2012/7/31 Hu.Ziming <hzma...@gmail.com>:

> 唔,好吧,知道了
> 那at_exit这种东西,能用来在被kill后打印出东西吗?还没试,想先问问有没有弄过的
> thx~
>
man 3 atexit
Functions registered using atexit() (and on_exit()) are not
called if a process terminates abnormally because
of the delivery of a signal.

--
Thanks,
Tao

Reply all
Reply to author
Forward
0 new messages