linuxgdbzombie-processwaitpid

Waitpid unknown return type in gdb


I try to remove zombie processes without killing the parent. I'm inside a debian 11 based container on a k8s instance. SIGCHLD on parent does not work and naturally SIGKILL, and SIGTERM not working on Zs.

My latest approach is to use the gdb. By attaching to the parent process and using the call waitpid (44,0,0) command I face the below error: 'waitpid' has unknown return type; cast the call to its declared return type

I understand the problem and tried to cast it to pid_t in various ways but I was not able to resolve the problem. How am I supposed to correctly cast the call for the gdb to accept it (I'm not interested in the return value, I just want to remove them)?


Solution

  • I understand the problem and tried to cast it to pid_t Try casting it in int.

    (gdb) call (int) waitpid(13685, 0,0)
    (gdb) detach