Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I detect if a pid exists?

detect exists PID
0
Posted

How do I detect if a pid exists?

0

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

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.