From nobody@FreeBSD.org  Fri Apr 25 09:31:33 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B60F1106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 25 Apr 2008 09:31:33 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 8F3528FC18
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 25 Apr 2008 09:31:33 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m3P9V53v060214
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 25 Apr 2008 09:31:05 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m3P9V554060213;
	Fri, 25 Apr 2008 09:31:05 GMT
	(envelope-from nobody)
Message-Id: <200804250931.m3P9V554060213@www.freebsd.org>
Date: Fri, 25 Apr 2008 09:31:05 GMT
From: Vladimir Kozbin <wawaka@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: invalid value of 'elapsed' field in ps output if process is swapped out
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         123069
>Category:       bin
>Synopsis:       [patch] ps(1): invalid value of 'elapsed' field in ps output if process is swapped out
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 25 09:40:01 UTC 2008
>Closed-Date:    Sun Jan 03 13:28:45 UTC 2010
>Last-Modified:  Sun Jan 03 13:28:45 UTC 2010
>Originator:     Vladimir Kozbin
>Release:        7.0-RELEASE
>Organization:
>Environment:
FreeBSD titan.lan 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Mar  2 20:16:34 UTC 2008     root@titan:/usr/obj/usr/src/sys/TITAN  amd64
>Description:
The problem is described here: http://lists.freebsd.org/pipermail/freebsd-stable/2008-April/042154.html
And the explanation is here: http://lists.freebsd.org/pipermail/freebsd-stable/2008-April/042157.html
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- print.c.orig	2007-09-17 09:27:18.000000000 +0400
+++ print.c	2008-04-25 13:11:06.994706727 +0400
@@ -559,6 +559,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;


>Release-Note:
>Audit-Trail:

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org, wawaka@gmail.com
Cc:  
Subject: Re: bin/123069: [patch] ps(1): invalid value of 'elapsed' field in
	ps output if process is swapped out
Date: Sat, 4 Apr 2009 20:43:48 +0200

 This patch looks sensible (the same thing started and lstarted do), and
 would get rid of an annoyance with the etime keyword.
 
 -- 
 Jilles Tjoelker

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/123069: commit references a PR
Date: Sun, 24 May 2009 15:32:48 +0000 (UTC)

 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;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: jilles 
State-Changed-When: Sun May 24 15:56:31 UTC 2009 
State-Changed-Why:  
Mark patched pending MFC. 


Responsible-Changed-From-To: freebsd-bugs->jilles 
Responsible-Changed-By: jilles 
Responsible-Changed-When: Sun May 24 15:56:31 UTC 2009 
Responsible-Changed-Why:  
Track. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123069 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/123069: commit references a PR
Date: Sun, 14 Jun 2009 17:06:05 +0000 (UTC)

 Author: jilles
 Date: Sun Jun 14 17:05:54 2009
 New Revision: 194200
 URL: http://svn.freebsd.org/changeset/base/194200
 
 Log:
   MFC r192688: fix nonsense in ps etime field for swapped out processes
   
   PR:		bin/123069
   Submitted by:	Vladimir Kozbin
   Approved by:	ed (mentor)
 
 Modified:
   stable/7/bin/ps/   (props changed)
   stable/7/bin/ps/print.c
 
 Modified: stable/7/bin/ps/print.c
 ==============================================================================
 --- stable/7/bin/ps/print.c	Sun Jun 14 17:03:59 2009	(r194199)
 +++ stable/7/bin/ps/print.c	Sun Jun 14 17:05:54 2009	(r194200)
 @@ -572,6 +572,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;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
Responsible-Changed-From-To: jilles->freebsd-bugs 
Responsible-Changed-By: jilles 
Responsible-Changed-When: Sat Jun 20 13:08:36 UTC 2009 
Responsible-Changed-Why:  
I'm not interested in 6.x. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123069 
State-Changed-From-To: patched->closed 
State-Changed-By: gavin 
State-Changed-When: Sun Jan 3 13:28:14 UTC 2010 
State-Changed-Why:  
I think this can be closed, it's fixed in HEAD, 8.x and 7.x. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=123069 
>Unformatted:
