mirror of https://github.com/postgres/postgres
<sys/resource.h> is in SUSv2 and is on all targeted Unix systems. We have a replacement for getrusage() on Windows, so let's just move its declarations into src/include/port/win32/sys/resource.h so that we can use a standard-looking #include. Also remove an obsolete reference to CLK_TCK. Also rename src/port/getrusage.c to win32getrusage.c, following the convention for Windows-only fallback code. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKG%2BL_3brvh%3D8e0BW_VfX9h7MtwgN%3DnFHP5o7X2oZucY9dg%40mail.gmail.compull/102/head
parent
37a65d1db1
commit
36b3d52459
@ -0,0 +1,20 @@ |
||||
/*
|
||||
* Replacement for <sys/resource.h> for Windows. |
||||
*/ |
||||
#ifndef WIN32_SYS_RESOURCE_H |
||||
#define WIN32_SYS_RESOURCE_H |
||||
|
||||
#include <sys/time.h> /* for struct timeval */ |
||||
|
||||
#define RUSAGE_SELF 0 |
||||
#define RUSAGE_CHILDREN (-1) |
||||
|
||||
struct rusage |
||||
{ |
||||
struct timeval ru_utime; /* user time used */ |
||||
struct timeval ru_stime; /* system time used */ |
||||
}; |
||||
|
||||
extern int getrusage(int who, struct rusage *rusage); |
||||
|
||||
#endif /* WIN32_SYS_RESOURCE_H */ |
||||
@ -1,31 +0,0 @@ |
||||
/*-------------------------------------------------------------------------
|
||||
* |
||||
* rusagestub.h |
||||
* Stubs for getrusage(3). |
||||
* |
||||
* |
||||
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group |
||||
* Portions Copyright (c) 1994, Regents of the University of California |
||||
* |
||||
* src/include/rusagestub.h |
||||
* |
||||
*------------------------------------------------------------------------- |
||||
*/ |
||||
#ifndef RUSAGESTUB_H |
||||
#define RUSAGESTUB_H |
||||
|
||||
#include <sys/time.h> /* for struct timeval */ |
||||
#include <limits.h> /* for CLK_TCK */ |
||||
|
||||
#define RUSAGE_SELF 0 |
||||
#define RUSAGE_CHILDREN (-1) |
||||
|
||||
struct rusage |
||||
{ |
||||
struct timeval ru_utime; /* user time used */ |
||||
struct timeval ru_stime; /* system time used */ |
||||
}; |
||||
|
||||
extern int getrusage(int who, struct rusage *rusage); |
||||
|
||||
#endif /* RUSAGESTUB_H */ |
||||
Loading…
Reference in new issue