How do I detect if a pid exists?
You can do that by using the kill() system call. If you use 0 in the signal field no signal will be sent, but error checking is still done. A return value of 0 indicates the process exists, and you could send a signal to it. A return value of -1 indicates that it does not exist or is a process you could not send a signal to, in that case use errno to find out what is the case. A value of ESRCH indicates the process does not exist. A value of EPERM indicates the process does exist, but you are not allowed to send a signal to it. See the kill(2) man page for more information. • Why do I get a SIGSEGV but no core dump? There are many possible reasons, I will try to list them all, but I could easily have forgotten some: • The core would have been larger than the current limit. Verify if there is a limit and try to disable it. In bash, sh and similar shells type ulimit -a to see the current limits and type ulimit -S -c unlimited to disable the limit, finally verify that it has been disabled