From owner-freebsd-bugs Sun Jan 28 18:50:06 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA20999 for bugs-outgoing; Sun, 28 Jan 1996 18:50:06 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA20985 Sun, 28 Jan 1996 18:50:03 -0800 (PST) Resent-Date: Sun, 28 Jan 1996 18:50:03 -0800 (PST) Resent-Message-Id: <199601290250.SAA20985@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, hsu Received: (from hsu@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id SAA20763 Sun, 28 Jan 1996 18:44:20 -0800 (PST) Message-Id: <199601290244.SAA20763@freefall.freebsd.org> Date: Sun, 28 Jan 1996 18:44:20 -0800 (PST) From: Jeffrey Hsu Reply-To: hsu To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/975: getrusage returns negative deltas Sender: owner-bugs@freebsd.org Precedence: bulk >Number: 975 >Category: kern >Synopsis: getrusage returns negative deltas >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 28 18:50:01 PST 1996 >Last-Modified: >Originator: Jeffrey & >Organization: >Release: FreeBSD 2.1-STABLE i386 and -current >Environment: >Description: Two calls to getrusage(). The second call indicates that the process has used less time resource then the first call. >How-To-Repeat: Run the following program a bunch of times. #include #include #include #include main() { struct rusage r, r2; getrusage(RUSAGE_SELF, &r); printf("user %d sec %d usec\n", r.ru_utime.tv_sec, r.ru_utime.tv_usec); printf("system %d sec %d usec\n", r.ru_stime.tv_sec, r.ru_stime.tv_usec); getrusage(RUSAGE_SELF, &r2); printf("user %d sec %d usec\n", r2.ru_utime.tv_sec, r2.ru_utime.tv_usec); printf("system %d sec %d usec\n", r2.ru_stime.tv_sec, r2.ru_stime.tv_usec); if (r2.ru_utime.tv_sec - r.ru_utime.tv_sec < 0) printf("user time negative\n"); if (r2.ru_utime.tv_usec - r.ru_utime.tv_usec < 0) printf("user time negative\n"); if (r2.ru_stime.tv_sec - r.ru_stime.tv_sec < 0) printf("system time negative\n"); if (r2.ru_stime.tv_usec - r.ru_stime.tv_usec < 0) printf("system time negative\n"); } >Fix: >Audit-Trail: >Unformatted: