Re: [COMMITTERS] pgsql: Add include needed for new - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [COMMITTERS] pgsql: Add include needed for new
Date
Msg-id 200610081814.k98IE3f21047@momjian.us
Whole thread Raw
In response to Re: [COMMITTERS] pgsql: Add include needed for new getrusage() call.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [COMMITTERS] pgsql: Add include needed for new getrusage() call.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> momjian@postgresql.org (Bruce Momjian) writes:
> > Add include needed for new getrusage() call.
> 
> If that's actually needed, how did the code build before?  It's always
> included sys/resource.h, except possibly on machines without getrusage
> ... are there any?  I was thinking rusagestub was dead code, myself.

Uh, all I know is that it started failing yesterday.  The failure I got
was:
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline-fno-strict-aliasing -O1 -Wall
-Wmissing-prototypes-Wmissing-declarations-Wpointer-arith -Wcast-align-I../../../src/include
-I/usr/local/include/readline-I/usr/contrib/include-DWIN32_STACK_RLIMIT=4194304  -c -o postgres.opostgres.cIn file
includedfrom postgres.c:31:/usr/include/sys/resource.h:63: field `ru_utime' has incomplete
type/usr/include/sys/resource.h:64:field `ru_stime' has incomplete typegmake: *** [postgres.o] Error 1
 

and resource.h has:
struct  rusage {    struct timeval ru_utime;    /* user time used */    struct timeval ru_stime;    /* system time used
*/

so it is timeval it wanted. But I have:
#define HAVE_GETRUSAGE 1

For me, 'struct timeval' is coming in via #include "libpq/libpq.h", but
of course that is _after_ the inclusion of resource.h.  Not sure where
you see that sys/resource.h was always there.  Looking at the CVS diffs
I see it added only in the past day.

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: The improvement for psql of 8.2beta1 not
Next
From: Tom Lane
Date:
Subject: Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c