summaryrefslogtreecommitdiff
path: root/proc.h
AgeCommit message (Collapse)AuthorFilesLines
2017-05-23proc.h: add missing headersBaruch Siach1-0/+1
ino_t and pid_t require stat.h and types.h, respectively. Fixes the following build failure with musl libc: In file included from cpp.c:7:0: proc.h:11:31: error: unknown type name =E2=80=98ino_t=E2=80=99 extern int proc_find_by_inode(ino_t ino, char *cmdline, size_t len, pid_t = *pid); ^ proc.h:11:69: error: unknown type name =E2=80=98pid_t=E2=80=99 extern int proc_find_by_inode(ino_t ino, char *cmdline, size_t len, pid_t = *pid); ^ proc.h:12:25: error: unknown type name =E2=80=98pid_t=E2=80=99 extern bool proc_exists(pid_t pid); ^ Signed-off-by: Baruch Siach <baruch@tkos.co.il> [tk: complementary fix to commit a9f4431e0a20] Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-05-03proc: include headers to get definitions for ino_t and pid_tTobias Klauser1-0/+2
Include <unistd.h> and <sys/types.h> in the header already as the declarations for proc_find_by_inode(...) and proc_exists(...) use ino_t and pid_t, respectively. Fixes: 1edfb2409d15 ("flowtop: Move & refactor walk_processes() to proc.c") Fixes: 1df0f481922a ("flowtop: Add process UI tab entry") Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2017-01-25flowtop: Add process UI tab entryVadim Kochan1-1/+2
Add process UI tab entry to show flows statistics per pid. Also changed flow_entry which now has pointer to new struct proc_entry object which contains process related info. On each 1 second refresh proc_entry is checked if it exists by checking /proc/<pid> path, and is deleted if there is no any flows related to it (flows_count is 0), if the process exists then dst & src rates info is zeroed and summed from the all related flows which are in the proc_entry->flows list. The bytes & pkts amount info is collected during all the time process exists. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2016-12-19flowtop: Move & refactor walk_processes() to proc.cVadim Kochan1-0/+1
Add proc_find_by_inode() in proc.c which finds pid by inode & gets processe's command line and use it in the flowtop.c instead of walk_processes(). Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-12-17proc: Add function to execute process with argv listVadim Kochan1-0/+1
Add proc_exec function which executes given process with argv list via fork + execvp. It allows to replace 'system' call approach which is used for invoking cpp and securely extend it with additional options like -D. Signed-off-by: Vadim Kochan <vadim4j@gmail.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2015-07-17flowtop, netsniff-ng: Move process name extraction to own functionTobias Klauser1-0/+3
flowtop and the netsniff-ng's netlink message dissector both need to get the process name for a pid from /proc/<pid>/exe, thus move that functionality to an own function. Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2013-06-04proc: move out process specific management functionsDaniel Borkmann1-0/+8
Move them out of xutils, so that we can maintain them separately. Also simplify things a bit. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>