Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 May 2009 15:32:34 +0000 (UTC)
From:      Jilles Tjoelker <jilles@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192688 - head/bin/ps
Message-ID:  <200905241532.n4OFWYHt093446@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jilles
Date: Sun May 24 15:32:34 2009
New Revision: 192688
URL: http://svn.freebsd.org/changeset/base/192688

Log:
  Fix elapsed (etime) field for swapped out processes in ps:
  show '-' instead of time since the Epoch.
  
  PR:		bin/123069
  Submitted by:	Vladimir Kozbin
  Approved by:	ed (mentor)
  MFC after:	3 weeks

Modified:
  head/bin/ps/print.c

Modified: head/bin/ps/print.c
==============================================================================
--- head/bin/ps/print.c	Sun May 24 15:27:25 2009	(r192687)
+++ head/bin/ps/print.c	Sun May 24 15:32:34 2009	(r192688)
@@ -596,6 +596,10 @@ elapsed(KINFO *k, VARENT *ve)
 	char obuff[128];
 
 	v = ve->var;
+	if (!k->ki_valid) {
+		(void)printf("%-*s", v->width, "-");
+		return;
+	}
 	val = now - k->ki_p->ki_start.tv_sec;
 	days = val / (24 * 60 * 60);
 	val %= 24 * 60 * 60;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905241532.n4OFWYHt093446>