From ktstev01@osaka.louisville.edu Tue Jun 29 11:46:53 1999
Return-Path: <ktstev01@osaka.louisville.edu>
Received: from osaka.louisville.edu (osaka.louisville.edu [136.165.1.114])
	by hub.freebsd.org (Postfix) with ESMTP id 0557314F95
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 Jun 1999 11:46:50 -0700 (PDT)
	(envelope-from ktstev01@osaka.louisville.edu)
Received: by osaka.louisville.edu (Postfix, from userid 15)
	id 0885818605; Tue, 29 Jun 1999 14:46:49 -0400 (EDT)
Message-Id: <19990629184649.0885818605@osaka.louisville.edu>
Date: Tue, 29 Jun 1999 14:46:49 -0400 (EDT)
From: k.stevenson@louisville.edu
Sender: ktstev01@osaka.louisville.edu
Reply-To: k.stevenson@louisville.edu
To: FreeBSD-gnats-submit@freebsd.org
Subject: Missing #include <sys/time.h> in <sys/resource.h>  (Patch included)
X-Send-Pr-Version: 3.2

>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:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 29 11:50:01 PDT 1999
>Closed-Date:    Tue Jun 29 14:10:54 PDT 1999
>Last-Modified:  Tue Jun 29 14:11:34 PDT 1999
>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:

From: Chris Piazza <cpiazza@home.net>
To: k.stevenson@louisville.edu
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/12452: Missing #include <sys/time.h> in <sys/resource.h>  (Patch included)
Date: Tue, 29 Jun 1999 13:23:22 -0700

 On Tue, Jun 29, 1999 at 02:46:49PM -0400, k.stevenson@louisville.edu wrote:
 > 
 > /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.
 
 man 2 getpriority:
 
 NAME
      getpriority, setpriority - get/set program scheduling priority
 
 SYNOPSIS
      #include <sys/time.h>
      #include <sys/resource.h>
 
      int
      getpriority(int which, int who)
 
 --
 looks documented to me.
 
 > 
 > Either work around the problem by including <sys/time.h> _before_
 
 This isn't a work around, it's what you're supposed to do.
 
 -Chris
 
 -- 
 cpiazza@home.net                   cpiazza@FreeBSD.org
 "Life is divided into the horrible and the miserable."
                                           -Woody Allen
 
State-Changed-From-To: open->closed 
State-Changed-By: cpiazza 
State-Changed-When: Tue Jun 29 14:10:54 PDT 1999 
State-Changed-Why:  
Submitter requests (in private email) that this PR be closed 
because he is satisfied with the explanation given. 
>Unformatted:
