Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package forkstat for openSUSE:Factory checked in at 2023-03-19 00:31:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/forkstat (Old) and /work/SRC/openSUSE:Factory/.forkstat.new.31432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "forkstat" Sun Mar 19 00:31:01 2023 rev:17 rq:1072735 version:0.03.01 Changes: -------- --- /work/SRC/openSUSE:Factory/forkstat/forkstat.changes 2023-01-23 18:32:03.496099502 +0100 +++ /work/SRC/openSUSE:Factory/.forkstat.new.31432/forkstat.changes 2023-03-19 00:31:02.832224701 +0100 @@ -1,0 +2,11 @@ +Fri Mar 17 17:02:58 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 0.03.01: + * Makefile: bump version + * debian/control: update standards version to 4.6.2 + * Manual: update copyright + * forkstat: add -p process group id filtering option + * forkstat: handle empty arg in argv[], replace with ' ' + * forkstat: make cmdline buffer 64K, allocate on heap + +------------------------------------------------------------------- Old: ---- forkstat-0.03.00.tar.gz New: ---- forkstat-0.03.01.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ forkstat.spec ++++++ --- /var/tmp/diff_new_pack.e9Fv0B/_old 2023-03-19 00:31:03.236226618 +0100 +++ /var/tmp/diff_new_pack.e9Fv0B/_new 2023-03-19 00:31:03.240226637 +0100 @@ -18,7 +18,7 @@ Name: forkstat -Version: 0.03.00 +Version: 0.03.01 Release: 0 Summary: Process fork/exec/exit monitoring tool License: GPL-2.0-or-later ++++++ forkstat-0.03.00.tar.gz -> forkstat-0.03.01.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.03.00/Makefile new/forkstat-0.03.01/Makefile --- old/forkstat-0.03.00/Makefile 2022-12-06 13:12:32.000000000 +0100 +++ new/forkstat-0.03.01/Makefile 2023-02-08 16:50:34.000000000 +0100 @@ -1,6 +1,6 @@ # # Copyright (C) 2014-2021 Canonical, Ltd. -# Copyright (C) 2021-2022 Colin Ian King +# Copyright (C) 2021-2023 Colin Ian King # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -17,7 +17,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.03.00 +VERSION=0.03.01 # # Version "Perspicacious Process Peeker" # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.03.00/debian/changelog new/forkstat-0.03.01/debian/changelog --- old/forkstat-0.03.00/debian/changelog 2022-12-06 13:12:32.000000000 +0100 +++ new/forkstat-0.03.01/debian/changelog 2023-02-08 16:50:34.000000000 +0100 @@ -1,3 +1,15 @@ +forkstat (0.03.01-1) unstable; urgency=medium + + * Makefile: bump version + * debian/control: update standards version to 4.6.2 + * Manual: update copyright + * forkstat: add -p process group id filtering option + * forkstat: handle empty arg in argv[], replace with ' ' + * forkstat: make cmdline buffer 64K, allocate on heap + * Update copyright year + + -- Colin Ian King <colin.i.k...@gmail.com> Wed, 8 Feb 2023 15:50:57 +0000 + forkstat (0.03.00-1) unstable; urgency=medium * Makefile: bump version to 0.03.00 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.03.00/debian/control new/forkstat-0.03.01/debian/control --- old/forkstat-0.03.00/debian/control 2022-12-06 13:12:32.000000000 +0100 +++ new/forkstat-0.03.01/debian/control 2023-02-08 16:50:34.000000000 +0100 @@ -3,7 +3,7 @@ Section: admin Priority: optional Maintainer: Colin Ian King <colin.i.k...@gmail.com> -Standards-Version: 4.6.1 +Standards-Version: 4.6.2 Build-Depends: debhelper (>= 13), debhelper-compat (=13) Homepage: https://github.com/ColinIanKing/forkstat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.03.00/forkstat.8 new/forkstat-0.03.01/forkstat.8 --- old/forkstat-0.03.00/forkstat.8 2022-12-06 13:12:32.000000000 +0100 +++ new/forkstat-0.03.01/forkstat.8 2023-02-08 16:50:34.000000000 +0100 @@ -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 "15 November 2021" +.TH FORKSTAT 8 "8 February 2023" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -21,20 +21,7 @@ .SH SYNOPSIS .B forkstat -.RI [ \-c ] -.RI [ \-d ] -.RI [ \-D ] -.RI [ \-e ] -.RI [ \-E ] -.RI [ \-g ] -.RI [ \-h ] -.RI [ \-l ] -.RI [ \-r ] -.RI [ \-s ] -.RI [ \-S ] -.RI [ \-q ] -.RI [ \-x ] -.RI [ \-X ] +.RI [ options ] .br .SH DESCRIPTION @@ -106,6 +93,9 @@ .B \-l set stdout to line-buffered mode. .TP +.B \-p pgrpid +only show processes that match the process group id pgrpid +.TP .B \-r run with real time FIFO scheduling with maximum priority to keep up with high volumes of process events. @@ -160,7 +150,7 @@ This manual page was written by Colin Ian King <colin.i.k...@gmail.com>, for the Ubuntu project (but may be used by others). .SH COPYRIGHT -Copyright \(co 2014-2021 Canonical Ltd, Copyright \(co 2021-2022 Colin Ian King. +Copyright \(co 2014-2021 Canonical Ltd, Copyright \(co 2021-2023 Colin Ian King. .br This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/forkstat-0.03.00/forkstat.c new/forkstat-0.03.01/forkstat.c --- old/forkstat-0.03.00/forkstat.c 2022-12-06 13:12:32.000000000 +0100 +++ new/forkstat-0.03.01/forkstat.c 2023-02-08 16:50:34.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright (C) 2014-2021 Canonical Ltd. - * Copyright (C) 2021-2022 Colin Ian King. + * Copyright (C) 2021-2023 Colin Ian King. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -190,6 +190,7 @@ static unsigned int opt_flags = OPT_CMD_LONG; /* Default option */ static int row = 0; /* tty row number */ static long int opt_duration = -1; /* duration, < 0 means run forever */ +static pid_t opt_pgrp = -1; static char unknown[] = "<unknown>"; @@ -1149,8 +1150,9 @@ static char *proc_cmdline(const pid_t pid) { int fd; + const size_t buffer_sz = 65536; ssize_t ret; - char buffer[4096]; + char *buffer, *tmp; if (pid == 0) return proc_comm_dup("[swapper]"); @@ -1158,12 +1160,19 @@ if (opt_flags & OPT_COMM) return proc_comm(pid); - (void)snprintf(buffer, sizeof(buffer), "/proc/%d/cmdline", pid); - if ((fd = open(buffer, O_RDONLY)) < 0) + buffer = malloc(buffer_sz); + if (!buffer) return proc_comm(pid); - (void)memset(buffer, 0, sizeof(buffer)); - if ((ret = read(fd, buffer, sizeof(buffer) - 1)) <= 0) { + (void)snprintf(buffer, buffer_sz, "/proc/%d/cmdline", pid); + if ((fd = open(buffer, O_RDONLY)) < 0) { + free(buffer); + return proc_comm(pid); + } + + (void)memset(buffer, 0, buffer_sz); + if ((ret = read(fd, buffer, buffer_sz - 1)) <= 0) { + free(buffer); (void)close(fd); return proc_comm(pid); } @@ -1178,19 +1187,21 @@ for (ptr = buffer; ptr < buffer + ret; ptr++) { if (*ptr == '\0') { - if (*(ptr + 1) == '\0') - break; *ptr = ' '; } } + *ptr = '\0'; } proc_name_clean(buffer, ret); - if (opt_flags & OPT_CMD_DIRNAME_STRIP) - return proc_comm_dup(basename(buffer)); - - return proc_comm_dup(buffer); + if (opt_flags & OPT_CMD_DIRNAME_STRIP) { + tmp = proc_comm_dup(basename(buffer)); + } else { + tmp = proc_comm_dup(buffer); + } + free(buffer); + return tmp; } /* @@ -1560,7 +1571,7 @@ char when[10]; time_t now; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) - pid_t pid, ppid; + pid_t pid, ppid, pgrp; bool is_thread; #endif @@ -1601,6 +1612,9 @@ case PROC_EVENT_FORK: ppid = get_parent_pid(proc_ev->event_data.fork.child_pid, &is_thread); pid = proc_ev->event_data.fork.child_pid; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; proc_stats_account(proc_ev->event_data.fork.parent_pid, is_thread ? STAT_CLNE : STAT_FORK); if (gettimeofday(&tv, NULL) < 0) @@ -1642,6 +1656,9 @@ case PROC_EVENT_EXEC: proc_stats_account(proc_ev->event_data.exec.process_pid, STAT_EXEC); pid = proc_ev->event_data.exec.process_pid; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; info1 = proc_info_update(pid); if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_EXEC)) { row_increment(); @@ -1660,6 +1677,9 @@ 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; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; info1 = proc_info_get(pid); if (info1->start.tv_sec) { double d1, d2; @@ -1693,6 +1713,9 @@ if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_UID)) { row_increment(); pid = proc_ev->event_data.exec.process_pid; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; if (proc_ev->what == PROC_EVENT_UID) { (void)printf("%s uid %*d %s%s%6s %8s %s%s%s\n", when, @@ -1723,6 +1746,9 @@ if (!(opt_flags & OPT_QUIET) && (opt_flags & OPT_EV_UID)) { row_increment(); pid = proc_ev->event_data.exec.process_pid; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; (void)printf("%s sid %*d %s%s%6d %8s %s%s%s\n", when, pid_size, pid, @@ -1741,6 +1767,9 @@ 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; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; info1 = proc_info_get(pid); row_increment(); (void)printf("%s core %*d %s%s %8s %s%s%s\n", @@ -1767,6 +1796,9 @@ #else pid = proc_ev->event_data.ptrace.process_pid; #endif + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; info1 = proc_info_get(pid); row_increment(); (void)printf("%s ptrce %*d %s%s%6s %8s %s%s%s\n", @@ -1787,6 +1819,9 @@ 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; + pgrp = getpgid(pid); + if ((opt_pgrp >= 0) && (opt_pgrp != pgrp)) + break; info1 = proc_info_get(pid); comm = proc_cmdline(pid); row_increment(); @@ -1876,7 +1911,8 @@ struct sigaction new_action; for (;;) { - const int c = getopt(argc, argv, "cdD:e:EghlrsSqxX"); + const int c = getopt(argc, argv, "cdD:e:EghlrsSp:qxX"); + if (c == -1) break; switch (c) { @@ -1889,7 +1925,7 @@ case 'D': opt_duration = strtol(optarg, NULL, 10); if (opt_duration <= 0) { - (void)fprintf(stderr, "Illegal duration.\n"); + (void)fprintf(stderr, "Illegal duration '%s'.\n", optarg); exit(EXIT_FAILURE); } break; @@ -1916,6 +1952,13 @@ case 'S': opt_flags |= OPT_STATS; break; + case 'p': + opt_pgrp = strtol(optarg, NULL, 10); + if (opt_pgrp < 0) { + (void)fprintf(stderr, "Illegal pgroup '%s'.\n", optarg); + exit(EXIT_FAILURE); + } + break; case 'q': opt_flags |= OPT_QUIET; break;