Given the pid of a Linux process, I want to check, from a C program, if the process is still running.
Use procfs.
#include [...] struct stat sts; if (stat("/proc/", &sts) == -1 && errno == ENOENT) { // process doesn't exist }
Easily portable to