aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2022-07-24 09:21:57 +1200
committerThomas Munro <tmunro@postgresql.org>2022-07-24 09:29:48 +1200
commit86e5eb4f58a276870fbd29e3711b36e4a4280979 (patch)
tree1be63aedf830585e9385e60a5a6e3e854da676b7 /src/backend/tcop/postgres.c
parentb431dc5c3d7207ffb56b6045eb04265a53f63a03 (diff)
downloadpostgresql-86e5eb4f58a276870fbd29e3711b36e4a4280979.tar.gz
postgresql-86e5eb4f58a276870fbd29e3711b36e4a4280979.zip
Remove dead getrusage replacement code.
getrusage() is in SUSv2 and all targeted Unix systems have it. Note that POSIX only covers ru_utime and ru_stime and we rely on many more fields without any kind of configure probe, but that predates this commit. The only supported system we need replacement code for now is Windows, and that can be done without a configure probe. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Greg Stark <stark@mit.edu> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Discussion: https://postgr.es/m/CA+hUKGJ3LHeP9w5Fgzdr4G8AnEtJ=z=p6hGDEm4qYGEUX5B6fQ@mail.gmail.com
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 8ba1c170f02..bdb11f430fd 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -32,7 +32,7 @@
#include <sys/resource.h>
#endif
-#ifndef HAVE_GETRUSAGE
+#ifdef WIN32
#include "rusagestub.h"
#endif
@@ -4860,7 +4860,14 @@ ShowUsage(const char *title)
(long) user.tv_usec,
(long) sys.tv_sec,
(long) sys.tv_usec);
-#if defined(HAVE_GETRUSAGE)
+#ifndef WIN32
+
+ /*
+ * The following rusage fields are not defined by POSIX, but they're
+ * present on all current Unix-like systems so we use them without any
+ * special checks. Some of these could be provided in our Windows
+ * emulation in src/port/getrusage.c with more work.
+ */
appendStringInfo(&str,
"!\t%ld kB max resident size\n",
#if defined(__darwin__)
@@ -4896,7 +4903,7 @@ ShowUsage(const char *title)
r.ru_nvcsw - Save_r.ru_nvcsw,
r.ru_nivcsw - Save_r.ru_nivcsw,
r.ru_nvcsw, r.ru_nivcsw);
-#endif /* HAVE_GETRUSAGE */
+#endif /* !WIN32 */
/* remove trailing newline */
if (str.data[str.len - 1] == '\n')