简体   繁体   中英

Is it possible to catch other's process signal in Linux?

The question is simple- is it possible to write the program, that:

  • runs a subprogram (note- other program , like /bin/bash ; not a function), and waits until it ends

and

  • catches and handles SIGINT or SIGSEGV signals sent to the subprogram?

First is easy. Second is "maybe", depends on what do you want exactly. ptrace() system call may help. Using ptrace is not what most people want on daily bases, but it may suite you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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