What does kill -0 PID do?
according to the man pages :
Quote:
The signals listed below may be available for use with kill. When known constant, numbers and default behavior are shown.
NameNum ActionDescription
0 0 n/aexit code indicates if a signal may be sent
So, it does nothing, but the exit code of your "kill -0 PID" command just returns 0 if you can send a signal to PID, and returns 1 if you can't (don't have access or invalid PID)
看到这里的话大家就应该知道kill -0有啥妙用了吧
------检测一个为pid的进程是否还活着
在shell下面你可以用ps来查找,那么用c语言呢,这个不失为一个比较好的办法(kill(pid,0))