[英]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.