From cc8fed015c81126b9a3a8e89e2feff016ba1ea8b Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sat, 14 Aug 2010 19:01:55 +0300 Subject: [PATCH] main: Print warning if root priviledges are not available Without root priviledges, reading only the user's own processes is possible. Thus, the results usually don't contain all of the possible results. Signed-off-by: Timo Kokkonen --- main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.c b/main.c index 502e0c3..60efb67 100644 --- a/main.c +++ b/main.c @@ -3,6 +3,8 @@ #include #include #include +#include +#include #include "parse.h" #include "analyze.h" @@ -76,6 +78,11 @@ int main(int argc, char *argv[]) struct process *process_list = NULL; struct parse_opts opts; + if (getuid()) { + printf("WARNING: Running without root priviledges. " + "Results may be inaccurate\n"); + } + memset(&opts, 0, sizeof(opts)); read_args(argc, argv, &opts); -- 2.45.0