aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/procstat/procstat_bin.c
diff options
context:
space:
mode:
authorMikolaj Golub <trociny@FreeBSD.org>2012-03-23 20:09:21 +0000
committerMikolaj Golub <trociny@FreeBSD.org>2012-03-23 20:09:21 +0000
commitca263e0080172ad13faf56be0527ec30e5de3c55 (patch)
tree2656e8d6a1dc54387f75d14a4e928a553875017d /usr.bin/procstat/procstat_bin.c
parent903712c99c7c08a14211942fbd8c31808bcc7414 (diff)
downloadsrc-ca263e0080172ad13faf56be0527ec30e5de3c55.tar.gz
src-ca263e0080172ad13faf56be0527ec30e5de3c55.zip
Notes
Diffstat (limited to 'usr.bin/procstat/procstat_bin.c')
-rw-r--r--usr.bin/procstat/procstat_bin.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/usr.bin/procstat/procstat_bin.c b/usr.bin/procstat/procstat_bin.c
index cf4ca5b4644c..718103dd69cc 100644
--- a/usr.bin/procstat/procstat_bin.c
+++ b/usr.bin/procstat/procstat_bin.c
@@ -43,11 +43,11 @@ void
procstat_bin(struct kinfo_proc *kipp)
{
char pathname[PATH_MAX];
- int error, name[4];
+ int error, osrel, name[4];
size_t len;
if (!hflag)
- printf("%5s %-16s %-53s\n", "PID", "COMM", "PATH");
+ printf("%5s %-16s %8s %s\n", "PID", "COMM", "OSREL", "PATH");
name[0] = CTL_KERN;
name[1] = KERN_PROC;
@@ -65,7 +65,19 @@ procstat_bin(struct kinfo_proc *kipp)
if (len == 0 || strlen(pathname) == 0)
strcpy(pathname, "-");
+ name[2] = KERN_PROC_OSREL;
+
+ len = sizeof(osrel);
+ error = sysctl(name, 4, &osrel, &len, NULL, 0);
+ if (error < 0 && errno != ESRCH) {
+ warn("sysctl: kern.proc.osrel: %d", kipp->ki_pid);
+ return;
+ }
+ if (error < 0)
+ return;
+
printf("%5d ", kipp->ki_pid);
printf("%-16s ", kipp->ki_comm);
+ printf("%8d ", osrel);
printf("%s\n", pathname);
}