简体   繁体   English

Linux:如何查看生活过程是否设置了信号处理程序?

[英]Linux: how to see if a living process has signal handlers set?

There is a process happy running and I wonder if it has set some signal handlers. 有一个快乐的过程,我想知道它是否设置了一些信号处理程序。 I recall I have once read something about this somewhere but could not find such information. 我记得我曾经在某处读过一些关于此的内容,但却找不到这样的信息。 Is it possible? 可能吗?

Thanks 谢谢

gotta love that - presumably these are actually the signal sets... 得爱 - 可能这些实际上是信号集......

cat /proc/self/status | cat / proc / self / status | grep -i '^Sig' grep -i'^ Sig'

SigQ:   0/31404
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000803
SigCgt: 0000000180014664

would seem could make a utility to print those out - unless anyone know of one already? 似乎可以制作一个实用程序来打印出来 - 除非有人知道一个已经?

hmmm - time to read some kernel code for procfs 嗯 - 时间读取procfs的一些内核代码

from this excellent article: 从这篇优秀的文章:

http://kernel.org/doc/Documentation/filesystems/proc.txt http://kernel.org/doc/Documentation/filesystems/proc.txt

SigQ                        number of signals queued/max. number for queue
SigPnd                      bitmap of pending signals for the thread
ShdPnd                      bitmap of shared pending signals for the process
SigBlk                      bitmap of blocked signals
SigIgn                      bitmap of ignored signals
SigCgt                      bitmap of catched signals

you can detect this while checking the /proc/PID/status file. 检查/proc/PID/status文件时可以检测到这一点。

The SigCgt mask display the caught signals by your application. SigCgt掩码显示应用程序捕获的信号。 (see man 7 signal for sigmask explanations) (参见man 7 signal进行sigmask解释)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM