summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/proc.c b/proc.c
index c25396a..a0e6499 100644
--- a/proc.c
+++ b/proc.c
@@ -183,3 +183,14 @@ int proc_exec(const char *proc, char *const argv[])
return 0;
}
+
+bool proc_exists(pid_t pid)
+{
+ struct stat statbuf;
+ char path[1024];
+
+ if (snprintf(path, sizeof(path), "/proc/%u", pid) < 0)
+ return false;
+
+ return stat(path, &statbuf) == 0;
+}