Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Apr 1997 17:49:20 +0300 (EEST)
From:      jari@apeli.tky.hut.fi
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/3241: bug with times(3) in 2.2-RELEASE
Message-ID:  <199704091449.RAA12395@apeli.tky.hut.fi>
Resent-Message-ID: <199704091520.IAA25136@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         3241
>Category:       bin
>Synopsis:       times(3) returns only stime
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr  9 08:20:00 PDT 1997
>Last-Modified:
>Originator:     Jari Kokko
>Organization:
La Societe du Billard d'Otaniemi (SBO)
>Release:        FreeBSD 2.2-RELEASE i386
>Environment:

FreeBSD apeli.tky.hut.fi 2.2-RELEASE FreeBSD 2.2-RELEASE #0: Sun Mar 30 19:40:43 EEST 1997     oku@apeli.tky.hut.fi:/usr/src/sys/compile/APELI  i386

>Description:

	the times(3) library function only returns tms_stime in
	struct tms.

>How-To-Repeat:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/times.h>

main()
{
    unsigned long int i=0;
    struct tms t;
    FILE *f;

    f=fopen("foo", "w");
    if (!f)
        perror("dghj");
    fclose(f);

    for (i=0; i < 100000; i++)
        sin(60);
        
    if ((i=times(&t)) < 0)
        perror("foo");    

    printf("utime %d, stime %d, cutime %d, cstime %d\n", 
           t.tms_utime,
           t.tms_stime,
           t.tms_cutime,
           t.tms_cstime);
    
    return 0;
}

$ uname -r; cc -o bar timestst.c -lm; ./bar
2.2-RELEASE
utime 0, stime 331, cutime 0, cstime 0

compare that with:

$ uname -r ; cc -o bar timestst.c -lm ; ./bar
2.1.5-RELEASE
utime 40, stime 2, cutime 0, cstime 0

>Fix:
	
No idea, I'm afraid
>Audit-Trail:
>Unformatted:



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