Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 Jun 1999 14:46:49 -0400 (EDT)
From:      k.stevenson@louisville.edu
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/12452: Missing #include <sys/time.h> in <sys/resource.h>  (Patch included)
Message-ID:  <19990629184649.0885818605@osaka.louisville.edu>

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

>Number:         12452
>Category:       bin
>Synopsis:       /usr/include/sys/resource.h doesn't include <sys/time.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 29 11:50:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Keith Stevenson
>Release:        FreeBSD 3.2-STABLE i386
>Organization:
University of Louisville
>Environment:

FreeBSD-STABLE build on June 1, 1999

>Description:

/usr/include/sys/resource.h uses 'struct timeval' in the definition of
struct rusage.  struct timeval is defined in /usr/include/sys/time.h, 
but <sys/time.h> is not included in the <sys/resource.h> header file.

The log message from version 1.8 of /usr/include/sys/resource.h mentions
that <sys/time.h> is a prerequisite, but that doesn't seem to be documented
elsewhere.

>How-To-Repeat:

Compile a program that includes <sys/resource.h> without previously
including <sys/time.h>.  Compiler generates lots of errors:

In file included from loadavg.c:6:
/usr/include/sys/resource.h:58: field `ru_utime' has incomplete type
/usr/include/sys/resource.h:59: field `ru_stime' has incomplete type
/usr/include/sys/resource.h:96: parse error before `int32_t'
/usr/include/sys/resource.h:96: warning: no semicolon at end of struct or union
/usr/include/sys/resource.h:97: warning: data definition has no type or storage class
/usr/include/sys/resource.h:101: parse error before `rlim_t'
/usr/include/sys/resource.h:101: warning: no semicolon at end of struct or union
/usr/include/sys/resource.h:102: warning: data definition has no type or storage class
/usr/include/sys/resource.h:107: parse error before `fixpt_t'
/usr/include/sys/resource.h:107: warning: no semicolon at end of struct or union
/usr/include/sys/resource.h:109: parse error before `}'


>Fix:
	
Either work around the problem by including <sys/time.h> _before_
<sys/resource.h> or apply the following patch to <sys/resource.h>


Index: resource.h
===================================================================
RCS file: /opt/ncvs/src/sys/sys/resource.h,v
retrieving revision 1.9
diff -u -r1.9 resource.h
--- resource.h	1999/04/30 13:04:19	1.9
+++ resource.h	1999/06/29 14:26:11
@@ -37,6 +37,8 @@
 #ifndef _SYS_RESOURCE_H_
 #define	_SYS_RESOURCE_H_
 
+#include <sys/time.h>
+
 /*
  * Process priority specifications to get/setpriority.
  */


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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