commit forkstat for openSUSE:Factory
Hello community, here is the log from the commit of package forkstat for openSUSE:Factory checked in at 2018-07-22 23:05:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/forkstat (Old) and /work/SRC/openSUSE:Factory/.forkstat.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "forkstat" Sun Jul 22 23:05:09 2018 rev:9 rq:624404 version:0.02.05 Changes: -------- --- /work/SRC/openSUSE:Factory/forkstat/forkstat.changes 2018-07-12 09:21:41.382630408 +0200 +++ /work/SRC/openSUSE:Factory/.forkstat.new/forkstat.changes 2018-07-22 23:05:19.916906223 +0200 @@ -1,0 +2,16 @@ +Fri Jul 13 18:19:50 UTC 2018 - mardnh@gmx.de + +- Update to version 0.02.05 + * Makefile: bump version + * Manual, change -e all to -E in example to show alternate form + * Reformat some lines, comments and overly wide scanf + * Minor code clean ups + * Ensure all fields in no_info are initialized + * Manual: Fix process table information formatting + * Voidify function returns + * Add more constifications + * Add -E (enable all events) option + * PROC_EVENT_COREDUMP has been introduced in kernel version 3.10 + * Replace curved corner glyph with square corner + +------------------------------------------------------------------- Old: ---- forkstat-0.02.04.tar.xz New: ---- forkstat-0.02.05.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ forkstat.spec ++++++ --- /var/tmp/diff_new_pack.sDTw10/_old 2018-07-22 23:05:20.460906021 +0200 +++ /var/tmp/diff_new_pack.sDTw10/_new 2018-07-22 23:05:20.464906020 +0200 @@ -18,7 +18,7 @@ Name: forkstat -Version: 0.02.04 +Version: 0.02.05 Release: 0 Summary: Process fork/exec/exit monitoring tool License: GPL-2.0-or-later ++++++ forkstat-0.02.04.tar.xz -> forkstat-0.02.05.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.02.04/Makefile new/forkstat-0.02.05/Makefile --- old/forkstat-0.02.04/Makefile 2018-07-10 14:36:39.000000000 +0200 +++ new/forkstat-0.02.05/Makefile 2018-07-13 08:50:32.000000000 +0200 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.02.04 +VERSION=0.02.05 # # Version "Perspicacious Process Peeker" # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.02.04/forkstat.8 new/forkstat-0.02.05/forkstat.8 --- old/forkstat-0.02.04/forkstat.8 2018-07-10 14:36:39.000000000 +0200 +++ new/forkstat-0.02.05/forkstat.8 2018-07-13 08:50:32.000000000 +0200 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH FORKSTAT 8 "8 June, 2018" +.TH FORKSTAT 8 "13 July, 2018" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -24,6 +24,7 @@ .RI [ \-d ] .RI [ \-D ] .RI [ \-e ] +.RI [ \-E ] .RI [ \-g ] .RI [ \-h ] .RI [ \-l ] @@ -54,7 +55,9 @@ Info Parent or child if a fork, or process exit(2) value. Duration T{ On exit, the duration the command ran for in seconds. -Process The process name. The name will be in [ ] brackets if it is a kernel thread. +T} +Process T{ +The process name. The name will be in [ ] brackets if it is a kernel thread. T} .TE .SH OPTIONS @@ -84,6 +87,9 @@ all all the events above .TE .TP +.B \-E +enable all events, equivalent to \-e all +.TP .B \-g show glyph annotations of events, useful for easier identification of different events. @@ -128,7 +134,7 @@ .LP Trace all events for 10 minutes: .RS 8 -forkstat \-e all \-D 600 +forkstat \-E \-D 600 .RE .LP Trace clones for 1 minute: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.02.04/forkstat.c new/forkstat-0.02.05/forkstat.c --- old/forkstat-0.02.04/forkstat.c 2018-07-10 14:36:39.000000000 +0200 +++ new/forkstat-0.02.05/forkstat.c 2018-07-13 08:50:32.000000000 +0200 @@ -137,9 +137,9 @@ /* scaling factor */ typedef struct { - const char ch; /* Scaling suffix */ - const uint32_t base; /* Base of part following . point */ - const uint64_t scale; /* Amount to scale by */ + const char ch; /* Scaling suffix */ + const uint32_t base; /* Base of part following . point */ + const uint64_t scale; /* Amount to scale by */ } time_scale_t; /* Mapping of event names to option flags and event_t types */ @@ -171,6 +171,8 @@ static proc_info_t no_info = { .pid = NULL_PID, .uid = NULL_UID, + .gid = NULL_GID, + .tty = NULL_TTY, .cmdline = "<unknown>", .kernel_thread = false, .start = { 0, 0 }, @@ -263,7 +265,8 @@ s /= second_scales[i].scale; s += 0.0005; /* Round up */ fract = (s * second_scales[i].base) - (double)((int)s * second_scales[i].base); - snprintf(buf, sizeof(buf), "%3u.%3.3u%c", (int)s, (int)fract, second_scales[i].ch); + (void)snprintf(buf, sizeof(buf), "%3u.%3.3u%c", + (int)s, (int)fract, second_scales[i].ch); return buf; } @@ -280,7 +283,7 @@ if (pwd) return pwd->pw_name; - snprintf(buf, sizeof(buf), "%d", uid); + (void)snprintf(buf, sizeof(buf), "%d", uid); return buf; } @@ -307,12 +310,14 @@ if (dirent->d_name[0] == '.') continue; - snprintf(path, sizeof(path), "/dev/pts/%s", dirent->d_name); + (void)snprintf(path, sizeof(path), "/dev/pts/%s", + dirent->d_name); if (stat(path, &buf) < 0) continue; if (buf.st_rdev == dev) { - snprintf(tty, sizeof(tty), "pts/%-11.11s", dirent->d_name); + (void)snprintf(tty, sizeof(tty), "pts/%-11.11s", + dirent->d_name); break; } } @@ -328,7 +333,7 @@ * note that this does not cater of changes * because of use of an effective ID. */ -static void get_extra(const pid_t pid, proc_info_t *info) +static void get_extra(const pid_t pid, proc_info_t * const info) { ssize_t ret; long dev; @@ -344,7 +349,7 @@ if (!(opt_flags & OPT_EXTRA)) return; - snprintf(path, sizeof(path), "/proc/%u/stat", pid); + (void)snprintf(path, sizeof(path), "/proc/%u/stat", pid); fd = open(path, O_RDONLY); if (fd < 0) return; @@ -404,7 +409,7 @@ * get parent pid and set is_thread to true if process * not forked but a newly created thread */ -static pid_t get_parent_pid(const pid_t pid, bool *is_thread) +static pid_t get_parent_pid(const pid_t pid, bool * const is_thread) { FILE *fp; pid_t tgid = 0, ppid = 0; @@ -413,7 +418,7 @@ char buffer[4096]; *is_thread = false; - snprintf(path, sizeof(path), "/proc/%u/status", pid); + (void)snprintf(path, sizeof(path), "/proc/%u/status", pid); fp = fopen(path, "r"); if (!fp) return 0; @@ -428,11 +433,10 @@ } } if (!strncmp(buffer, "PPid:", 5)) { - if (sscanf(buffer + 5, "%u", &ppid) == 1) { + if (sscanf(buffer + 5, "%u", &ppid) == 1) got |= GOT_PPID; - } else { + else ppid = 0; - } } } (void)fclose(fp); @@ -501,7 +505,7 @@ * pid_a_kernel_thread * is a process a kernel thread? */ -static bool pid_a_kernel_thread(const char *task, const pid_t id) +static bool pid_a_kernel_thread(const char * const task, const pid_t id) { if (sane_procs) { return getpgid(id) == 0; @@ -587,7 +591,7 @@ pid_size = pid_max_digits(); - printf("Time Event %*.*s %s%sInfo Duration Process\n", + (void)printf("Time Event %*.*s %s%sInfo Duration Process\n", pid_size, pid_size, "PID", (opt_flags & OPT_EXTRA) ? " UID TTY " : "", (opt_flags & OPT_GLYPH) ? " " : ""); @@ -612,7 +616,7 @@ * timeval_to_double() * convert timeval to seconds as a double */ -static inline double timeval_to_double(const struct timeval *tv) +static inline double timeval_to_double(const struct timeval * const tv) { return (double)tv->tv_sec + ((double)tv->tv_usec / 1000000.0); } @@ -690,8 +694,8 @@ */ static int stats_cmp(const void *v1, const void *v2) { - proc_stats_t *const *s1 = (proc_stats_t *const *)v1; - proc_stats_t *const *s2 = (proc_stats_t *const *)v2; + const proc_stats_t *const *s1 = (const proc_stats_t *const *)v1; + const proc_stats_t *const *s2 = (const proc_stats_t *const *)v2; if ((*s2)->total == (*s1)->total) return 0; @@ -716,18 +720,18 @@ n++; if (!n) { - printf("\nNo statistics gathered.\n"); + (void)printf("\nNo statistics gathered.\n"); return; } printf("\n"); for (i = 0; i < STAT_LAST; i++) - printf("%8s ", ev_map[i].label); - printf(" Total Process\n"); + (void)printf("%8s ", ev_map[i].label); + (void)printf(" Total Process\n"); sorted = calloc(n, sizeof(proc_stats_t *)); if (!sorted) { - fprintf(stderr, "Cannot sort statistics, out of memory.\n"); + (void)fprintf(stderr, "Cannot sort statistics, out of memory.\n"); return; } @@ -738,11 +742,12 @@ qsort(sorted, n, sizeof(proc_stats_t *), stats_cmp); for (i = 0; i < n; i++) { int j; + stats = sorted[i]; for (j = 0; j < STAT_LAST; j++) - printf("%8" PRIu64 " ", stats->count[j]); - printf("%8" PRIu64 " %s\n", stats->total, stats->name); + (void)printf("%8" PRIu64 " ", stats->count[j]); + (void)printf("%8" PRIu64 " %s\n", stats->total, stats->name); } free(sorted); } @@ -779,10 +784,9 @@ ssize_t ret; char buffer[4096]; - snprintf(buffer, sizeof(buffer), "/proc/%d/comm", pid); - if ((fd = open(buffer, O_RDONLY)) < 0) { + (void)snprintf(buffer, sizeof(buffer), "/proc/%d/comm", pid); + if ((fd = open(buffer, O_RDONLY)) < 0) return NULL; - } if ((ret = read(fd, buffer, sizeof(buffer) - 1)) <= 0) { (void)close(fd); return NULL; @@ -803,10 +807,9 @@ ssize_t ret; char buffer[4096]; - snprintf(buffer, sizeof(buffer), "/proc/%d/cmdline", pid); - if ((fd = open(buffer, O_RDONLY)) < 0) { + (void)snprintf(buffer, sizeof(buffer), "/proc/%d/cmdline", pid); + if ((fd = open(buffer, O_RDONLY)) < 0) return proc_comm(pid); - } (void)memset(buffer, 0, sizeof(buffer)); if ((ret = read(fd, buffer, sizeof(buffer) - 1)) <= 0) { @@ -911,7 +914,7 @@ */ static proc_info_t const *proc_info_update(const pid_t pid) { - proc_info_t *info = proc_info_get(pid); + proc_info_t * const info = proc_info_get(pid); char *newcmd; if (info == &no_info) @@ -930,7 +933,7 @@ * proc_info_get_timeval() * get time when process started */ -static void proc_info_get_timeval(const pid_t pid, struct timeval *tv) +static void proc_info_get_timeval(const pid_t pid, struct timeval * const tv) { int fd; unsigned long long starttime; @@ -967,7 +970,8 @@ return; } (void)close(fd); - n = sscanf(buffer, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %*u %*u %*u %*u %*d %*d %*d %*d %llu", &starttime); + n = sscanf(buffer, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u " + "%*u %*u %*u %*u %*u %*d %*d %*d %*d %llu", &starttime); if (n != 1) return; @@ -991,7 +995,7 @@ * proc_info_add() * add processes info of a given pid to the hash table */ -static proc_info_t *proc_info_add(const pid_t pid, struct timeval *tv) +static proc_info_t *proc_info_add(const pid_t pid, const struct timeval * const tv) { const size_t i = proc_info_hash(pid); proc_info_t *info; @@ -1012,7 +1016,7 @@ if (!info) { info = calloc(1, sizeof(proc_info_t)); if (!info) { - fprintf(stderr, "Cannot allocate all proc info\n"); + (void)fprintf(stderr, "Cannot allocate all proc info\n"); free(cmdline); return NULL; } @@ -1038,7 +1042,7 @@ struct dirent *dirent; char path[PATH_MAX]; - snprintf(path, sizeof(path), "/proc/%i/task", pid); + (void)snprintf(path, sizeof(path), "/proc/%i/task", pid); dir = opendir(path); if (!dir) @@ -1104,9 +1108,10 @@ const proc_info_t *info = proc_info_get(uid); if (info && info->uid != NULL_UID) - snprintf(buf, sizeof(buf), "%6d %-6.6s ", info->uid, get_tty(info->tty)); + (void)snprintf(buf, sizeof(buf), "%6d %-6.6s ", + info->uid, get_tty(info->tty)); else - snprintf(buf, sizeof(buf), "%14s", ""); + (void)snprintf(buf, sizeof(buf), "%14s", ""); } return buf; @@ -1135,7 +1140,7 @@ if ((sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR)) < 0) { if (errno == EPROTONOSUPPORT) return -EPROTONOSUPPORT; - fprintf(stderr, "socket failed: errno=%d (%s)\n", + (void)fprintf(stderr, "socket failed: errno=%d (%s)\n", errno, strerror(errno)); return -1; } @@ -1146,7 +1151,7 @@ addr.nl_groups = CN_IDX_PROC; if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - fprintf(stderr, "bind failed: errno=%d (%s)\n", + (void)fprintf(stderr, "bind failed: errno=%d (%s)\n", errno, strerror(errno)); (void)close(sock); return -1; @@ -1202,9 +1207,9 @@ ssize_t len; char __attribute__ ((aligned(NLMSG_ALIGNTO)))buf[4096]; - if ((len = recv(sock, buf, sizeof(buf), 0)) == 0) { + if ((len = recv(sock, buf, sizeof(buf), 0)) == 0) return 0; - } + if (len == -1) { const int err = errno; @@ -1217,12 +1222,12 @@ now = time(NULL); if (now == ((time_t) -1)) { - printf("--:--:-- recv ----- " + (void)printf("--:--:-- recv ----- " "nobufs %8.8s (%s)\n", "", strerror(err)); } else { (void)localtime_r(&now, &tm); - printf("%2.2d:%2.2d:%2.2d recv ----- " + (void)printf("%2.2d:%2.2d:%2.2d recv ----- " "nobufs %8.8s (%s)\n", tm.tm_hour, tm.tm_min, tm.tm_sec, "", strerror(err)); @@ -1230,7 +1235,7 @@ break; } default: - fprintf(stderr,"recv failed: errno=%d (%s)\n", + (void)fprintf(stderr,"recv failed: errno=%d (%s)\n", err, strerror(err)); return -1; } @@ -1273,10 +1278,10 @@ now = time(NULL); if (now == ((time_t) -1)) { - snprintf(when, sizeof(when), "--:--:--"); + (void)snprintf(when, sizeof(when), "--:--:--"); } else { (void)localtime_r(&now, &tm); - snprintf(when, sizeof(when), "%2.2d:%2.2d:%2.2d", + (void)snprintf(when, sizeof(when), "%2.2d:%2.2d:%2.2d", tm.tm_hour, tm.tm_min, tm.tm_sec); } @@ -1287,19 +1292,18 @@ pid = proc_ev->event_data.fork.child_pid; proc_stats_account(proc_ev->event_data.fork.parent_pid, is_thread ? STAT_CLNE : STAT_FORK); - if (gettimeofday(&tv, NULL) < 0) { + if (gettimeofday(&tv, NULL) < 0) (void)memset(&tv, 0, sizeof tv); - } info1 = proc_info_get(ppid); info2 = proc_info_add(pid, &tv); if (!(opt_flags & OPT_QUIET) && (((opt_flags & OPT_EV_FORK) && !is_thread) || ((opt_flags & OPT_EV_CLNE) && is_thread))) { if (info1 != NULL && info2 != NULL) { - char *type = is_thread ? "clone" : "fork"; + const char * const type = is_thread ? "clone" : "fork"; row_increment(); - printf("%s %-5.5s %*d %s%sparent %8s %s%s%s\n", + (void)printf("%s %-5.5s %*d %s%sparent %8s %s%s%s\n", when, type, pid_size, ppid, @@ -1310,12 +1314,12 @@ info1->cmdline, info1->kernel_thread ? "]" : ""); row_increment(); - printf("%s %-5.5s %*d %s%s%6.6s %8s %s%s%s\n", + (void)printf("%s %-5.5s %*d %s%s%6.6s %8s %s%s%s\n", when, type, pid_size, pid, extra_info(pid), - (opt_flags & OPT_GLYPH) ? "\u2570" : "", + (opt_flags & OPT_GLYPH) ? "\u2514" : "", is_thread ? "thread" : "child ", "", info1->kernel_thread ? "[" : "", @@ -1330,7 +1334,7 @@ info1 = proc_info_update(pid); if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_EXEC)) { row_increment(); - printf("%s exec %*d %s%s %8s %s%s%s\n", + (void)printf("%s exec %*d %s%s %8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1344,7 +1348,6 @@ case PROC_EVENT_EXIT: proc_stats_account(proc_ev->event_data.exit.process_pid, STAT_EXIT); if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_EXIT)) { - pid = proc_ev->event_data.exit.process_pid; info1 = proc_info_get(pid); if (info1->start.tv_sec) { @@ -1355,12 +1358,12 @@ } d1 = timeval_to_double(&info1->start); d2 = timeval_to_double(&tv); - snprintf(duration, sizeof(duration), "%8s", secs_to_str(d2 - d1)); + (void)snprintf(duration, sizeof(duration), "%8s", secs_to_str(d2 - d1)); } else { - snprintf(duration, sizeof(duration), "unknown"); + (void)snprintf(duration, sizeof(duration), "unknown"); } row_increment(); - printf("%s exit %*d %s%s%6d %8s %s%s%s\n", + (void)printf("%s exit %*d %s%s%6d %8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1380,7 +1383,7 @@ row_increment(); pid = proc_ev->event_data.exec.process_pid; if (proc_ev->what == PROC_EVENT_UID) { - printf("%s uid %*d %s%s%6s %8s %s%s%s\n", + (void)printf("%s uid %*d %s%s%6s %8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1391,7 +1394,7 @@ info1->cmdline, info1->kernel_thread ? "]" : ""); } else { - printf("%s gid %*d %6s %s%8s %s%s%s\n", + (void)printf("%s gid %*d %6s %s%8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1409,7 +1412,7 @@ if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_UID)) { row_increment(); pid = proc_ev->event_data.exec.process_pid; - printf("%s sid %*d %s%s%6d %8s %s%s%s\n", + (void)printf("%s sid %*d %s%s%6d %8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1422,15 +1425,14 @@ } break; #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) case PROC_EVENT_COREDUMP: proc_stats_account(proc_ev->event_data.coredump.process_pid, STAT_CORE); if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_CORE)) { - pid = proc_ev->event_data.coredump.process_pid; info1 = proc_info_get(pid); row_increment(); - printf("%s core %*d %s%s %8s %s%s%s\n", + (void)printf("%s core %*d %s%s %8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1456,7 +1458,7 @@ #endif info1 = proc_info_get(pid); row_increment(); - printf("%s ptrce %*d %s%s%6s %8s %s%s%s\n", + (void)printf("%s ptrce %*d %s%s%6s %8s %s%s%s\n", when, pid_size, pid, extra_info(pid), @@ -1473,7 +1475,6 @@ case PROC_EVENT_COMM: proc_stats_account(proc_ev->event_data.comm.process_pid, STAT_COMM); if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_COMM)) { - pid = proc_ev->event_data.comm.process_pid; info1 = proc_info_get(pid); comm = proc_comm(pid); @@ -1481,7 +1482,7 @@ break; row_increment(); - printf("%s comm %*d %s%s%s %8s %s%s%s -> %s\n", + (void)printf("%s comm %*d %s%s%s %8s %s%s%s -> %s\n", when, pid_size, pid, extra_info(pid), @@ -1510,11 +1511,12 @@ */ static void show_help(char *const argv[]) { - printf("%s, version %s\n\n", APP_NAME, VERSION); - printf("usage: %s [-d|-D|-e|-h|-l|-s|-S|-q]\n", argv[0]); - printf("-d\tstrip off directory path from process name.\n" + (void)printf("%s, version %s\n\n", APP_NAME, VERSION); + (void)printf("usage: %s [-d|-D|-e|-E|-g|-h|-l|-s|-S|-q]\n", argv[0]); + (void)printf("-d\tstrip off directory path from process name.\n" "-D\tspecify run duration in seconds.\n" "-e\tselect which events to monitor.\n" + "-E\tequivalent to -e all.\n" "-g\tshow glyphs for event types.\n" "-h\tshow this help.\n" "-l\tforce stdout line buffering.\n" @@ -1529,7 +1531,7 @@ * parse_ev() * parse event strings, turn into flag mask */ -static int parse_ev(char *arg) +static int parse_ev(char * const arg) { char *str, *token; @@ -1544,10 +1546,10 @@ } } if (!found) { - fprintf(stderr, "Unknown event '%s'. Allowed events:", token); + (void)fprintf(stderr, "Unknown event '%s'. Allowed events:", token); for (i = 0; ev_map[i].event; i++) - printf(" %s", ev_map[i].event); - printf("\n"); + (void)printf(" %s", ev_map[i].event); + (void)printf("\n"); return -1; } } @@ -1561,7 +1563,7 @@ struct sigaction new_action; for (;;) { - const int c = getopt(argc, argv, "dD:e:ghlrsSqx"); + const int c = getopt(argc, argv, "dD:e:EghlrsSqx"); if (c == -1) break; switch (c) { @@ -1571,7 +1573,7 @@ case 'D': opt_duration = strtol(optarg, NULL, 10); if (opt_duration <= 0) { - fprintf(stderr, "Illegal duration.\n"); + (void)fprintf(stderr, "Illegal duration.\n"); exit(EXIT_FAILURE); } break; @@ -1579,6 +1581,9 @@ if (parse_ev(optarg) < 0) exit(EXIT_FAILURE); break; + case 'E': + opt_flags |= OPT_EV_ALL; + break; case 'g': opt_flags |= OPT_GLYPH; break; @@ -1600,7 +1605,7 @@ break; case 'l': if (setvbuf(stdout, NULL, _IOLBF, 0) != 0) { - fprintf(stderr, "Error setting line buffering.\n"); + (void)fprintf(stderr, "Error setting line buffering.\n"); exit(EXIT_FAILURE); } break; @@ -1617,7 +1622,7 @@ opt_flags |= (OPT_EV_FORK | OPT_EV_EXEC | OPT_EV_EXIT | OPT_EV_CLNE | OPT_EV_PTRC); if (geteuid() != 0) { - fprintf(stderr, "Need to run with root access.\n"); + (void)fprintf(stderr, "Need to run with root access.\n"); goto abort_sock; } @@ -1628,7 +1633,7 @@ new_action.sa_flags = 0; if (sigaction(signals[i], &new_action, NULL) < 0) { - fprintf(stderr, "sigaction failed: errno=%d (%s)\n", + (void)fprintf(stderr, "sigaction failed: errno=%d (%s)\n", errno, strerror(errno)); goto abort_sock; } @@ -1637,7 +1642,7 @@ sane_procs = sane_proc_pid_info(); if (proc_info_load() < 0) { - fprintf(stderr, "Cannot load process cache. Is /proc mounted?\n"); + (void)fprintf(stderr, "Cannot load process cache. Is /proc mounted?\n"); goto abort_sock; } @@ -1648,7 +1653,7 @@ max_prio = sched_get_priority_max(policy); if (max_prio < 0) { - fprintf(stderr, "sched_get_priority_max failed: errno=%d (%s)\n", + (void)fprintf(stderr, "sched_get_priority_max failed: errno=%d (%s)\n", errno, strerror(errno)); goto abort_sock; } @@ -1656,7 +1661,7 @@ (void)memset(¶m, 0, sizeof(param)); param.sched_priority = max_prio; if (sched_setscheduler(getpid(), policy, ¶m) < 0) { - fprintf(stderr, "sched_setscheduler failed: errno=%d (%s)\n", + (void)fprintf(stderr, "sched_setscheduler failed: errno=%d (%s)\n", errno, strerror(errno)); goto abort_sock; } @@ -1664,7 +1669,7 @@ sock = netlink_connect(); if (sock == -EPROTONOSUPPORT) { - fprintf(stderr, "Cannot show process activity with this kernel, netlink required.\n"); + (void)fprintf(stderr, "Cannot show process activity with this kernel, netlink required.\n"); goto abort_sock; } /* Handle other failures */ @@ -1672,13 +1677,13 @@ goto abort_sock; if (netlink_listen(sock) < 0) { - fprintf(stderr, "netlink listen failed: errno=%d (%s)\n", + (void)fprintf(stderr, "netlink listen failed: errno=%d (%s)\n", errno, strerror(errno)); goto close_abort; } if (opt_duration > 0) - alarm(opt_duration); + (void)alarm(opt_duration); if (monitor(sock) == 0) { ret = EXIT_SUCCESS;
participants (1)
-
root