Thread: Re: [COMMITTERS] pgsql: Add include needed for new getrusage() call.
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. regards, tom lane
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. +
Bruce Momjian <bruce@momjian.us> writes: > For me, 'struct timeval' is coming in via #include "libpq/libpq.h", but > of course that is _after_ the inclusion of resource.h. Ah, that explains it. > 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. It was further down before. There's still something pretty strange here, though, because AFAICS configure should have rejected sys/resource.h if it needs sys/time.h. regards, tom lane
Tom Lane wrote: > Bruce Momjian <bruce@momjian.us> writes: > > For me, 'struct timeval' is coming in via #include "libpq/libpq.h", but > > of course that is _after_ the inclusion of resource.h. > > Ah, that explains it. > > > 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. > > It was further down before. > > There's still something pretty strange here, though, because AFAICS > configure should have rejected sys/resource.h if it needs sys/time.h. I did some research and it turns out the configure test for includes uses the following source file, which includes <sys/stat.h>, which itself includes <sys/time.h> on my BSD/OS machine, so that is why configure has no problem finding resource.h usable. --------------------------------------------------------------------------- /* confdefs.h. */ #define PACKAGE_NAME "PostgreSQL" #define PACKAGE_TARNAME "postgresql" #define PACKAGE_VERSION "8.2beta1" #define PACKAGE_STRING "PostgreSQL 8.2beta1" #define PACKAGE_BUGREPORT "pgsql-bugs@postgresql.org" #define PG_VERSION "8.2beta1" #define ENABLE_NLS 1 #define DEF_PGPORT 5432 #define DEF_PGPORT_STR "5432" #define PG_VERSION_STR "PostgreSQL 8.2beta1 on i386-pc-bsdi4.3.1, compiled by GCC 2.95.3" #define ENABLE_THREAD_SAFETY 1 #define PG_KRB_SRVNAM "postgres" #define USE_SSL 1 #define PG_VERSION_NUM 80200 #define HAVE_LIBREADLINE 1 #define HAVE_LIBZ 1 #define HAVE_SPINLOCKS 1 #define HAVE_LIBCRYPTO 1 #define HAVE_LIBSSL 1 #define STDC_HEADERS 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRING_H 1 #define HAVE_MEMORY_H 1 #define HAVE_STRINGS_H 1 #define HAVE_UNISTD_H 1 #define HAVE_GETOPT_H 1 #define HAVE_IEEEFP_H 1 #define HAVE_PWD_H 1 #define HAVE_SYS_IPC_H 1 /* end confdefs.h. */ #include <stdio.h> #if HAVE_SYS_TYPES_H # include <sys/types.h> #endif #if HAVE_SYS_STAT_H # include <sys/stat.h> #endif #if STDC_HEADERS # include <stdlib.h> # include <stddef.h> #else # if HAVE_STDLIB_H # include <stdlib.h> # endif #endif #if HAVE_STRING_H # if !STDC_HEADERS && HAVE_MEMORY_H # include <memory.h> # endif # include <string.h> #endif #if HAVE_STRINGS_H # include <strings.h> #endif #if HAVE_INTTYPES_H # include <inttypes.h> #else # if HAVE_STDINT_H # include <stdint.h> # endif #endif #if HAVE_UNISTD_H # include <unistd.h> #endif #include <sys/resource.h> -- Bruce Momjian bruce@momjian.us EnterpriseDB http://www.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +
Tom Lane wrote: > There's still something pretty strange here, though, because AFAICS > configure should have rejected sys/resource.h if it needs sys/time.h. I think it only gives you a warning. -- Peter Eisentraut http://developer.postgresql.org/~petere/