Skip to content

Commit 976b386

Browse files
committed
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.
1 parent 5aea406 commit 976b386

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

src/backend/port/getrusage.c

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
/* $Id: getrusage.c,v 1.8 1998/06/19 02:55:04 momjian Exp $ */
2-
3-
#include <math.h> /* for pow() prototype */
1+
/* $Id: getrusage.c,v 1.9 1998/07/13 16:39:07 momjian Exp $ */
42

53
#include <errno.h>
64
#include "rusagestub.h"
75

8-
#if 0 /* this is from univel port ... how does
9-
* compiler define? */
10-
/* same for solaris_i386 port ... how does compiler define? */
11-
/* same for sco port ... how does compiler define? */
12-
/* same for solaris_sparc port ... how does compiler define? */
13-
/* same for svr4 port ... how does compiler define? */
6+
/* This code works on:
7+
* univel
8+
* solaris_i386
9+
* sco
10+
* solaris_sparc
11+
* svr4
12+
* hpux 9.*
13+
* which currently is all the supported platforms that don't have a
14+
* native version of getrusage(). So, if configure decides to compile
15+
* this file at all, we just use this version unconditionally.
16+
*/
17+
1418
int
1519
getrusage(int who, struct rusage * rusage)
1620
{
@@ -51,14 +55,3 @@ getrusage(int who, struct rusage * rusage)
5155
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
5256
return (0);
5357
}
54-
55-
#endif
56-
57-
#if 0 /* this is for hpux port ... how does
58-
* compiler define? */
59-
getrusage(int who, struct rusage * ru)
60-
{
61-
return (syscall(SYS_GETRUSAGE, who, ru));
62-
}
63-
64-
#endif

0 commit comments

Comments
 (0)