简体   繁体   English

如何理解 SIGSTOP 交付?

[英]How to understand SIGSTOP is delivered?

My problem is handling SIGSTOP.我的问题是处理 SIGSTOP。 I know SIGSTOP cannot be catched, handled and blocked but in some place of code, if SIGSTOP signal is delivered, execution must continue.我知道 SIGSTOP 不能被捕获、处理和阻止,但是在代码的某个地方,如果传递了 SIGSTOP 信号,则必须继续执行。 I understand that I need to signal my process with SIGCONT but how can i understand SIGSTOP is delivered?我知道我需要用 SIGCONT 向我的进程发出信号,但我如何理解 SIGSTOP 已交付? Is there has to be another process that constantly sending SIGCONT?是否必须有另一个不断发送 SIGCONT 的进程? Is it must be external process?它必须是外部过程吗?

Your process cannot detect SIGSTOP any more than it can detect SIGKILL.您的进程无法检测到 SIGSTOP,就像它无法检测到 SIGKILL 一样。 The way that a process detects that it has received a signal is by receiving a notification via a signal handler (or equivalent, such as signalfd on Linux).进程检测到它已接收到信号的方式是通过信号处理程序(或等效的,例如 Linux 上的signalfd )接收通知。 Since SIGSTOP cannot be caught, your process cannot receive any notification of it.由于无法捕获 SIGSTOP,因此您的进程无法收到任何通知。

You can use an external process to send it SIGCONT if you like, but perhaps it's a good time to question why your process is receiving SIGSTOP when that is unwanted.如果愿意,您可以使用外部进程向其发送 SIGCONT,但也许现在是质疑您的进程为什么在不需要时收到 SIGSTOP 的好时机。 If this is purely precautionary, it's probably not worth worrying about unless your software is highly safety or security critical, in which case you may want to run it as a separate user to restrict who can signal it.如果这纯粹是预防性的,那么可能不值得担心,除非您的软件高度安全或安全至关重要,在这种情况下,您可能希望以单独的用户身份运行它以限制谁可以发出信号。

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

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