Date: Sat, 13 Jun 2026 01:03:59 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b7280eba6324 - stable/15 - procstat binary: do not skip pid if either path or osrel sysctls failed Message-ID: <6a2cac7f.20f5f.3bed70f1@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b7280eba6324c203b5aeb87827ffcf7e9da7e467 commit b7280eba6324c203b5aeb87827ffcf7e9da7e467 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-06-07 07:28:29 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-06-13 00:58:38 +0000 procstat binary: do not skip pid if either path or osrel sysctls failed PR: 295893 (cherry picked from commit 9f378397ee89044a4faec522916b50f0a164d62e) --- usr.bin/procstat/procstat_bin.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.bin/procstat/procstat_bin.c b/usr.bin/procstat/procstat_bin.c index 04482e5ee1ba..d3061c1ac420 100644 --- a/usr.bin/procstat/procstat_bin.c +++ b/usr.bin/procstat/procstat_bin.c @@ -35,6 +35,7 @@ #include <errno.h> #include <libprocstat.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <string.h> @@ -50,12 +51,13 @@ procstat_bin(struct procstat *prstat, struct kinfo_proc *kipp) xo_emit("{T:/%5s %-16s %8s %s}\n", "PID", "COMM", "OSREL", "PATH"); - if (procstat_getpathname(prstat, kipp, pathname, sizeof(pathname)) != 0) + if (kill(kipp->ki_pid, 0) == -1) return; - if (strlen(pathname) == 0) + if (procstat_getpathname(prstat, kipp, pathname, sizeof(pathname)) + != 0 || strlen(pathname) == 0) strcpy(pathname, "-"); if (procstat_getosrel(prstat, kipp, &osrel) != 0) - return; + osrel = -1; xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid); xo_emit("{:command/%-16s/%s} ", kipp->ki_comm);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a2cac7f.20f5f.3bed70f1>
