[英]Send a kill signal to self
I have a C++ code that runs a linux command, I want to simulate segfault ie SIGSEGV while executing that linux command from by C++ code. 所以我的代码看起来像这样
int main(){
string cmd = "some linux command that should throw seg fault";
execute_linux_comand(cmd); // Want to simulate segfault coming while executing this command
}
我应该在“cmd”中输入什么,以便它可以将SIGSEGV发送到通过调用此 function 创建的子进程?
可以通过输入此命令向自身发送终止信号
kill -9 $$
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.