summaryrefslogtreecommitdiff
path: root/include/proc.h
blob: be737a6f60656e6073495fd0f2e8514a59c8b33a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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);