mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 10:21:15 +02:00
Currently, building on any platform that hasn't got getrusage()
requires manual editing of src/backend/port/getrusage.c, because its substitute version of getrusage is #if'd out. There is no good reason for that, because configure won't even include the file into the Makefile unless the platform hasn't got getrusage. Furthermore, we only have one working substitute version of getrusage --- the alleged HPUX syscall-based code doesn't work. (It causes a coredump because the syscall returns a struct rusage that's much larger than the stub struct defined in src/include/rusagestub.h.) The times()-based emulation works fine on HPUX, however. I propose, therefore, that getrusage.c should just unconditionally compile the times-based version, and rely on configure to include the file only if needed. This will be one less manual configuration step on all platforms that need this code. Patch attached. Tom Lane.
This commit is contained in:
parent
5aea4062d6
commit
976b3862ce
@ -1,16 +1,20 @@
|
|||||||
/* $Id: getrusage.c,v 1.8 1998/06/19 02:55:04 momjian Exp $ */
|
/* $Id: getrusage.c,v 1.9 1998/07/13 16:39:07 momjian Exp $ */
|
||||||
|
|
||||||
#include <math.h> /* for pow() prototype */
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "rusagestub.h"
|
#include "rusagestub.h"
|
||||||
|
|
||||||
#if 0 /* this is from univel port ... how does
|
/* This code works on:
|
||||||
* compiler define? */
|
* univel
|
||||||
/* same for solaris_i386 port ... how does compiler define? */
|
* solaris_i386
|
||||||
/* same for sco port ... how does compiler define? */
|
* sco
|
||||||
/* same for solaris_sparc port ... how does compiler define? */
|
* solaris_sparc
|
||||||
/* same for svr4 port ... how does compiler define? */
|
* svr4
|
||||||
|
* hpux 9.*
|
||||||
|
* which currently is all the supported platforms that don't have a
|
||||||
|
* native version of getrusage(). So, if configure decides to compile
|
||||||
|
* this file at all, we just use this version unconditionally.
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
getrusage(int who, struct rusage * rusage)
|
getrusage(int who, struct rusage * rusage)
|
||||||
{
|
{
|
||||||
@ -51,14 +55,3 @@ getrusage(int who, struct rusage * rusage)
|
|||||||
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
|
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0 /* this is for hpux port ... how does
|
|
||||||
* compiler define? */
|
|
||||||
getrusage(int who, struct rusage * ru)
|
|
||||||
{
|
|
||||||
return (syscall(SYS_GETRUSAGE, who, ru));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user