svn commit: r233953 - stable/8/usr.bin/procstat

Mikolaj Golub trociny at FreeBSD.org
Fri Apr 6 16:32:30 UTC 2012


Author: trociny
Date: Fri Apr  6 16:32:29 2012
New Revision: 233953
URL: http://svn.freebsd.org/changeset/base/233953

Log:
  MFC r233390:
  
  When displaying binary information show also osreldate.
  
  Suggested by:	kib

Modified:
  stable/8/usr.bin/procstat/procstat.1
  stable/8/usr.bin/procstat/procstat_bin.c
Directory Properties:
  stable/8/usr.bin/procstat/   (props changed)

Modified: stable/8/usr.bin/procstat/procstat.1
==============================================================================
--- stable/8/usr.bin/procstat/procstat.1	Fri Apr  6 16:31:29 2012	(r233952)
+++ stable/8/usr.bin/procstat/procstat.1	Fri Apr  6 16:32:29 2012	(r233953)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 7, 2010
+.Dd March 23, 2012
 .Dt PROCSTAT 1
 .Os
 .Sh NAME
@@ -98,6 +98,8 @@ Display the process ID, command, and pat
 process ID
 .It COMM
 command
+.It OSREL
+osreldate for process binary
 .It PATH
 path to process binary (if available)
 .El

Modified: stable/8/usr.bin/procstat/procstat_bin.c
==============================================================================
--- stable/8/usr.bin/procstat/procstat_bin.c	Fri Apr  6 16:31:29 2012	(r233952)
+++ stable/8/usr.bin/procstat/procstat_bin.c	Fri Apr  6 16:32:29 2012	(r233953)
@@ -42,11 +42,11 @@ void
 procstat_bin(pid_t pid, 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;
@@ -64,7 +64,19 @@ procstat_bin(pid_t pid, struct kinfo_pro
 	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", pid);
+		return;
+	}
+	if (error < 0)
+		return;
+
 	printf("%5d ", pid);
 	printf("%-16s ", kipp->ki_comm);
+	printf("%8d ", osrel);
 	printf("%s\n", pathname);
 }


More information about the svn-src-stable-8 mailing list