diff options
author | netblue30 <netblue30@yahoo.com> | 2015-08-08 19:12:30 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2015-08-08 19:12:30 -0400 |
commit | 1379851360349d6617ad32944a25ee5e2bb74fc2 (patch) | |
tree | f69b48e90708bfa3c2723d5a27ed3e024c827b43 /src/include/pid.h | |
parent | delete files (diff) | |
download | firejail-1379851360349d6617ad32944a25ee5e2bb74fc2.tar.gz firejail-1379851360349d6617ad32944a25ee5e2bb74fc2.tar.zst firejail-1379851360349d6617ad32944a25ee5e2bb74fc2.zip |
Baseline firejail 0.9.28
Diffstat (limited to 'src/include/pid.h')
-rw-r--r-- | src/include/pid.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/include/pid.h b/src/include/pid.h new file mode 100644 index 000000000..aaadaa542 --- /dev/null +++ b/src/include/pid.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014, 2015 netblue30 (netblue30@yahoo.com) | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | #ifndef PID_H | ||
21 | #define PID_H | ||
22 | extern int max_pids; | ||
23 | |||
24 | |||
25 | #define _GNU_SOURCE | ||
26 | #include <stdio.h> | ||
27 | #include <sys/types.h> | ||
28 | #include <unistd.h> | ||
29 | typedef struct { | ||
30 | short level; // -1 not a firejail process, 0 not investigated yet, 1 firejail process, > 1 firejail child | ||
31 | unsigned char zombie; | ||
32 | pid_t parent; | ||
33 | uid_t uid; | ||
34 | char *user; | ||
35 | char *cmd; | ||
36 | unsigned utime; | ||
37 | unsigned stime; | ||
38 | unsigned long long rx; // network rx, bytes | ||
39 | unsigned long long tx; // networking tx, bytes | ||
40 | unsigned rx_delta; | ||
41 | unsigned tx_delta; | ||
42 | } Process; | ||
43 | //extern Process pids[max_pids]; | ||
44 | extern Process *pids; | ||
45 | |||
46 | // pid functions | ||
47 | void pid_getmem(unsigned pid, unsigned *rss, unsigned *shared); | ||
48 | void pid_get_cpu_time(unsigned pid, unsigned *utime, unsigned *stime); | ||
49 | unsigned long long pid_get_start_time(unsigned pid); | ||
50 | uid_t pid_get_uid(pid_t pid); | ||
51 | char *pid_get_user_name(uid_t uid); | ||
52 | // print functions | ||
53 | void pid_print_tree(unsigned index, unsigned parent, int nowrap); | ||
54 | void pid_print_list(unsigned index, int nowrap); | ||
55 | void pid_store_cpu(unsigned index, unsigned parent, unsigned *utime, unsigned *stime); | ||
56 | void pid_read(pid_t mon_pid); | ||
57 | |||
58 | #endif | ||