YAMB: times(2) is broken in large model

Jay Maynard jay at splut.UUCP
Sun Apr 3 23:04:54 AEST 1988


I spent about 4 hours last night trying to figure out where I was going
wrong with my use of the times(2) function. I wrote the test program
below, and it would work fine; then I used it in a much larger system
(the KA9Q TCP/IP package - the supplied timer routine only ticks once a
second), and it would break. I didn't discover the problem until I
compiled the test program with -Ml - then it, too, was broken.

times(2) is documented to return, besides the cpu times in the structure
that is passed as its parameter, a monotonically increasing number that
is the elapsed real time in 60ths of a second since the machine was
booted. In small model, it does this just fine; in large model, it
always returns -1. (argh!!)

Guess I'll have to go hack something up...

Here's the test program. It will work fine (print the times(2) return
value each time you hit enter) in small model, but will always print -1
if compiled with -Ml.

-----------8<----------cut here-----------8<------------------
#include <stdio.h>
#include <sys/types.h>
#include <sys/times.h>

main()
{
	long thistime, times();
	int c;
	struct tms *timesbuf;
	
	for (; c != EOF; (c = getchar())) {
		thistime = times(timesbuf);
		printf(" %ld\n", thistime);
	}
}


-- 
Jay Maynard, EMT-P, K5ZC...>splut!< | GEnie: JAYMAYNARD  CI$: 71036,1603
uucp: {uunet!nuchat,hoptoad!academ!uhnix1,{ihnp4,bellcore}!tness1}!splut!jay
Never ascribe to malice that which can adequately be explained by stupidity.
The opinions herein are shared by none of my cats, much less anyone else.



More information about the Comp.unix.microport mailing list