summaryrefslogtreecommitdiff
path: root/include/proc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/proc.h')
-rw-r--r--include/proc.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/include/proc.h b/include/proc.h
new file mode 100644
index 0000000..be737a6
--- /dev/null
+++ b/include/proc.h
@@ -0,0 +1,49 @@
+#pragma once
+
+// /proc/PID/status
+struct proc_status {
+ char name[17];
+ char state;
+ pid_t pid;
+ pid_t tgid;
+ pid_t ppid;
+ pid_t tracer_pid;
+ uid_t uid;
+ uid_t euid;
+ uid_t ssuid;
+ uid_t fsuid;
+ gid_t gid;
+ gid_t egid;
+ gid_t ssgid;
+ gid_t fsgid;
+ unsigned int fdsize;
+ unsigned int threads;
+ unsigned long cap_inh;
+ unsigned long cap_prm;
+ unsigned long cap_eff;
+ unsigned long cap_bnd;
+ unsigned long cap_amb;
+ int no_new_privs;
+ int seccomp;
+};
+
+// /proc/PID/stat
+struct proc_stat {
+ char state;
+ unsigned long starttime;
+ unsigned long utime; // user time
+ unsigned long stime; // kernel time
+ long priority;
+ long nice;
+ unsigned long vsize;
+ long rss;
+ int tty_nr;
+};
+
+char *proc_cwd(pid_t);
+char *proc_environ(pid_t);
+char *proc_exe_path(pid_t);
+char *proc_get_exe_path(pid_t);
+char *proc_get_cmdline(pid_t);
+struct proc_stat proc_parse_stat(pid_t);
+struct proc_status proc_get_status(pid_t);