fi
-for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h net/if.h netinet/tcp.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/resource.h sys/signalfd.h sys/sockio.h sys/ucred.h termios.h ucred.h
+for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h net/if.h netinet/tcp.h sys/epoll.h sys/event.h sys/personality.h sys/prctl.h sys/procctl.h sys/signalfd.h sys/sockio.h sys/ucred.h termios.h ucred.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
;;
esac
- case " $LIBOBJS " in
- *" getrusage.$ac_objext "* ) ;;
- *) LIBOBJS="$LIBOBJS getrusage.$ac_objext"
- ;;
-esac
-
case " $LIBOBJS " in
*" kill.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS kill.$ac_objext"
;;
esac
+ case " $LIBOBJS " in
+ *" win32getrusage.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS win32getrusage.$ac_objext"
+ ;;
+esac
+
case " $LIBOBJS " in
*" win32link.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS win32link.$ac_objext"
sys/personality.h
sys/prctl.h
sys/procctl.h
- sys/resource.h
sys/signalfd.h
sys/sockio.h
sys/ucred.h
if test "$PORTNAME" = "win32"; then
AC_CHECK_FUNCS(_configthreadlocale)
AC_LIBOBJ(dirmod)
- AC_LIBOBJ(getrusage)
AC_LIBOBJ(kill)
AC_LIBOBJ(open)
AC_LIBOBJ(system)
AC_LIBOBJ(win32env)
AC_LIBOBJ(win32error)
AC_LIBOBJ(win32fdatasync)
+ AC_LIBOBJ(win32getrusage)
AC_LIBOBJ(win32link)
AC_LIBOBJ(win32ntdll)
AC_LIBOBJ(win32pread)
#include <dirent.h>
#include <sys/file.h>
#include <sys/param.h>
+#include <sys/resource.h> /* for getrlimit */
#include <sys/stat.h>
#include <sys/types.h>
#ifndef WIN32
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h> /* for getrlimit */
-#endif
#include "access/xact.h"
#include "access/xlog.h"
#include <limits.h>
#include <signal.h>
#include <unistd.h>
+#include <sys/resource.h>
#include <sys/select.h>
#include <sys/socket.h>
-#ifdef HAVE_SYS_RESOURCE_H
#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-
-#ifdef WIN32
-#include "rusagestub.h"
-#endif
#include "access/parallel.h"
#include "access/printtup.h"
* 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.
+ * emulation in src/port/win32getrusage.c with more work.
*/
appendStringInfo(&str,
"!\t%ld kB max resident size\n",
#include <fcntl.h>
#include <signal.h>
#include <time.h>
+#include <sys/resource.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/wait.h>
#include <unistd.h>
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
#include "catalog/pg_control.h"
#include "common/controldata_utils.h"
#include <signal.h>
#include <time.h>
#include <sys/time.h>
-#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h> /* for getrlimit */
-#endif
/* For testing, PGBENCH_USE_SELECT can be defined to force use of that code */
#if defined(HAVE_PPOLL) && !defined(PGBENCH_USE_SELECT)
/* Define to 1 if you have the <sys/procctl.h> header file. */
#undef HAVE_SYS_PROCCTL_H
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
/* Define to 1 if you have the <sys/signalfd.h> header file. */
#undef HAVE_SYS_SIGNALFD_H
--- /dev/null
+/*
+ * 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 */
+++ /dev/null
-/*-------------------------------------------------------------------------
- *
- * 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 */
#ifndef PG_RUSAGE_H
#define PG_RUSAGE_H
-#include <sys/time.h>
-
-#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
-#else
-#include "rusagestub.h"
-#endif
+#include <sys/time.h>
/* State structure for pg_rusage_init/pg_rusage_show */
/*-------------------------------------------------------------------------
*
- * getrusage.c
+ * win32getrusage.c
* get information about resource utilisation
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
*
*
* IDENTIFICATION
- * src/port/getrusage.c
+ * src/port/win32getrusage.c
*
*-------------------------------------------------------------------------
*/
#include "c.h"
-#include "rusagestub.h"
-
-/*
- * This code works on Windows, which is the only supported platform without a
- * native version of getrusage().
- */
+#include <sys/resource.h>
int
getrusage(int who, struct rusage *rusage)
#include "postgres_fe.h"
#include <ctype.h>
+#include <sys/resource.h>
#include <sys/stat.h>
+#include <sys/time.h>
#include <sys/wait.h>
#include <signal.h>
#include <unistd.h>
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/time.h>
-#include <sys/resource.h>
-#endif
-
#include "common/logging.h"
#include "common/restricted_token.h"
#include "common/string.h"
our @pgportfiles = qw(
chklocale.c explicit_bzero.c
- getpeereid.c getrusage.c inet_aton.c
+ getpeereid.c inet_aton.c
getaddrinfo.c inet_net_ntop.c kill.c open.c
snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
dirent.c getopt.c getopt_long.c
win32dlopen.c
win32env.c win32error.c
win32fdatasync.c
+ win32getrusage.c
win32gettimeofday.c
win32link.c
win32pread.c
HAVE_SYS_PERSONALITY_H => undef,
HAVE_SYS_PRCTL_H => undef,
HAVE_SYS_PROCCTL_H => undef,
- HAVE_SYS_RESOURCE_H => undef,
HAVE_SYS_SIGNALFD_H => undef,
HAVE_SYS_SOCKIO_H => undef,
HAVE_SYS_STAT_H => 1,
# Additional Windows-specific headers.
test "$f" = src/include/port/win32_port.h && continue
+ test "$f" = src/include/port/win32/sys/resource.h && continue
test "$f" = src/include/port/win32/sys/socket.h && continue
test "$f" = src/include/port/win32_msvc/dirent.h && continue
test "$f" = src/include/port/win32_msvc/utime.h && continue
test "$f" = src/include/port/atomics/generic-msvc.h && continue
test "$f" = src/include/port/atomics/generic-sunpro.h && continue
- # rusagestub.h is also platform-specific, and will be included
- # by utils/pg_rusage.h if necessary.
- test "$f" = src/include/rusagestub.h && continue
-
# sepgsql.h depends on headers that aren't there on most platforms.
test "$f" = contrib/sepgsql/sepgsql.h && continue
test "$f" = src/include/port/atomics/generic-msvc.h && continue
test "$f" = src/include/port/atomics/generic-sunpro.h && continue
- # rusagestub.h is also platform-specific, and will be included
- # by utils/pg_rusage.h if necessary.
- test "$f" = src/include/rusagestub.h && continue
-
# sepgsql.h depends on headers that aren't there on most platforms.
test "$f" = contrib/sepgsql/sepgsql.h && continue