My application create child process using fork(). I have a signal handler in parent process. In signal handler i have to do different logic for parent and child. ie in signal handler
case SIGSEGV:
if (parent)
{
cout<<"signal from parent";
}
else
{
cout <<"signal from child";
}
Is it possible? or i have to keep two different signal handlers?
Check the usage of signalfd
( man signalfd ) with select
and read
as this last will give you signalfd_siginfo
structure, which has
uint32_t ssi_pid; /* PID of sender */
Maybe this will help 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.