From owner-freebsd-bugs Wed May 9 6:31:47 2001 Delivered-To: freebsd-bugs@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 555FD37B424; Wed, 9 May 2001 06:31:43 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id XAA14730; Wed, 9 May 2001 23:31:39 +1000 Date: Wed, 9 May 2001 23:30:09 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: dwmalone@FreeBSD.ORG Cc: freebsd-bugs@FreeBSD.ORG, des@FreeBSD.ORG Subject: Re: kern/27215: when cat'ing /compat/linux/proc/stat, we have negative numbers In-Reply-To: <200105091018.f49AI4X55752@freefall.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Wed, 9 May 2001 dwmalone@FreeBSD.ORG wrote: > Synopsis: when cat'ing /compat/linux/proc/stat, we have negative numbers > > Responsible-Changed-From-To: freebsd-bugs->des > Responsible-Changed-By: dwmalone > Responsible-Changed-When: Wed May 9 03:16:06 PDT 2001 > Responsible-Changed-Why: > Linprocfs is DES's. The patch looks straightforward though. It mainly obscures the bug, by moving obvious overflow after LONG_MAX/100 statclock ticks to unobvious overflow after ULONG_MAX/100 statclock ticks. Overflow thresholds for some cases: i386, stathz = 128: before: 1.94 days; after : 3.88 days alpha, stathz = 1024: before: 2.85 million years; after: 5.71 million years BTW, cp_time[x] has a stupid type. We use uint64_t to count ticks for individual processes (p_[uis]ticks in struct proc) but we still use "long" for cp_time[x]. Thus the tick counters for system times may overflow after 194 days on i386's with the default stathz, but the tick counters for individual processes don't overflow for 571 million years on the same system. However, calcru() doesn't actually work for 64-bit tick counters, so getrusage(2) breaks down for processes that have run for more than about 388 days. This overflow has actually been reported. See PR17482. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message