Jul*_*ano 30
使用kill(2):
if (kill(pid, 0) == 0) {
/* process is running or a zombie */
} else if (errno == ESRCH) {
/* no such process with the given pid is running */
} else {
/* some other error... use perror("...") or strerror(errno) to report */
}
Run Code Online (Sandbox Code Playgroud)