[转载] waitpid 一问# Unix - 噫吁兮,危乎高哉
z*y
1 楼
【 以下文字转载自 Programming 讨论区 】
【 原文由 zyy 所发表 】
For programming experts, please check the following code.
pid = fork() ;
if (pid == 0) {
exec("error_prog") ;
}
else {
waitpid(pid, ....) ;
}
The child process executes "error_prog" which later generates SIGSEGV. The
signal can be caught by the parent. However, is it possible for the parent to
know the address of the instruction of the child program that generates the
fault? If so, how?
Thanks.
【 原文由 zyy 所发表 】
For programming experts, please check the following code.
pid = fork() ;
if (pid == 0) {
exec("error_prog") ;
}
else {
waitpid(pid, ....) ;
}
The child process executes "error_prog" which later generates SIGSEGV. The
signal can be caught by the parent. However, is it possible for the parent to
know the address of the instruction of the child program that generates the
fault? If so, how?
Thanks.