linux环境一个进程收到kill信号,能否知道是哪个进程发送的

pengxn 2014-12-11 10:26:02
rt linux环境一个进程收到kill信号,能否知道是哪个进程发送的
...全文
462 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
蓝兔先生 2014-12-12
  • 打赏
  • 举报
回复
楼上的英文一发, 都不敢回答了。。。。
  • 打赏
  • 举报
回复
from stackoverflow Two Linux-specific methods are SA_SIGINFO and signalfd(), which allows programs to receive very detailed information about signals sent, including the sender's PID. Call sigaction() and pass to it a struct sigaction which has the desired signal handler in sa_handler and the SA_SIGINFO flag in sa_flags set. With this flag, your signal handler will receive three arguments, one of which is a siginfo_t structure containing the sender's PID and UID. Call signalfd() and read signalfd_siginfo structures from it (usually in some kind of a select/poll loop). The contents will be similar to siginfo_t.

19,619

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧