Date: Thu, 08 Oct 1998 12:21:42 -0500 From: Glenn Johnson <gjohnson@nola.srrc.usda.gov> To: hackers@FreeBSD.ORG Subject: incomplete type errors Message-ID: <199810081721.MAA00871@symbion.srrc.usda.gov>
next in thread | raw e-mail | index | archive | help
I am trying to compile the code below:
#include <sys/types.h>
#ifdef _TIMES
#include <sys/time.h>
#include <sys/times.h>
#include <limits.h>
#else
#include <time.h>
#endif
#include <sys/resource.h>
#include "libU77.h"
real etime_(real t[2])
{
#ifdef _TIMES
struct tms tm;
times(&tm);
t[0] = (real) (tm.tms_utime + tm.tms_cutime) / (real) CLOCKS_PER_SEC;
t[1] = (real) (tm.tms_stime + tm.tms_cstime) / (real) CLOCKS_PER_SEC;
#else
struct rusage tm;
float meg = 1000000.0;
getrusage(RUSAGE_SELF, &tm);
t[0] = (real) (tm.ru_utime.tv_sec + (tm.ru_utime.tv_usec) / meg);
t[1] = (real) (tm.ru_stime.tv_sec + (tm.ru_stime.tv_usec) / meg);
#endif
return (real) (t[0]+t[1]);
}
I get the following error upon compilation:
In file included from etime.c:56:
/usr/include/sys/resource.h:58: field `ru_utime' has incomplete type
/usr/include/sys/resource.h:59: field `ru_stime' has incomplete type
*** Error code 1
Stop.
The /usr/include/sys/resource.h contains the following:
/*
* Resource utilization information.
*/
#define RUSAGE_SELF 0
#define RUSAGE_CHILDREN -1
struct rusage {
struct timeval ru_utime; /* user time used */
struct timeval ru_stime; /* system time used */
long ru_maxrss; /* max resident set size */
What do I need to do to the code to make it right?
Thanks in advance.
--
Glenn Johnson
Technician
USDA, ARS, SRRC
New Orleans, LA
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810081721.MAA00871>
