File tree 16 files changed +42
-89
lines changed
16 files changed +42
-89
lines changed Original file line number Diff line number Diff line change @@ -13874,7 +13874,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
13874
13874
fi
13875
13875
13876
13876
13877
- 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
13877
+ 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
13878
13878
do :
13879
13879
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
13880
13880
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@@ -16734,12 +16734,6 @@ done
16734
16734
;;
16735
16735
esac
16736
16736
16737
- case " $LIBOBJS " in
16738
- *" getrusage.$ac_objext "* ) ;;
16739
- *) LIBOBJS="$LIBOBJS getrusage.$ac_objext"
16740
- ;;
16741
- esac
16742
-
16743
16737
case " $LIBOBJS " in
16744
16738
*" kill.$ac_objext "* ) ;;
16745
16739
*) LIBOBJS="$LIBOBJS kill.$ac_objext"
@@ -16782,6 +16776,12 @@ esac
16782
16776
;;
16783
16777
esac
16784
16778
16779
+ case " $LIBOBJS " in
16780
+ *" win32getrusage.$ac_objext "* ) ;;
16781
+ *) LIBOBJS="$LIBOBJS win32getrusage.$ac_objext"
16782
+ ;;
16783
+ esac
16784
+
16785
16785
case " $LIBOBJS " in
16786
16786
*" win32link.$ac_objext "* ) ;;
16787
16787
*) LIBOBJS="$LIBOBJS win32link.$ac_objext"
Original file line number Diff line number Diff line change @@ -1459,7 +1459,6 @@ AC_CHECK_HEADERS(m4_normalize([
1459
1459
sys/personality.h
1460
1460
sys/prctl.h
1461
1461
sys/procctl.h
1462
- sys/resource.h
1463
1462
sys/signalfd.h
1464
1463
sys/sockio.h
1465
1464
sys/ucred.h
@@ -1897,14 +1896,14 @@ fi
1897
1896
if test "$PORTNAME" = "win32"; then
1898
1897
AC_CHECK_FUNCS ( _configthreadlocale )
1899
1898
AC_LIBOBJ ( dirmod )
1900
- AC_LIBOBJ ( getrusage )
1901
1899
AC_LIBOBJ ( kill )
1902
1900
AC_LIBOBJ ( open )
1903
1901
AC_LIBOBJ ( system )
1904
1902
AC_LIBOBJ ( win32dlopen )
1905
1903
AC_LIBOBJ ( win32env )
1906
1904
AC_LIBOBJ ( win32error )
1907
1905
AC_LIBOBJ ( win32fdatasync )
1906
+ AC_LIBOBJ ( win32getrusage )
1908
1907
AC_LIBOBJ ( win32link )
1909
1908
AC_LIBOBJ ( win32ntdll )
1910
1909
AC_LIBOBJ ( win32pread )
Original file line number Diff line number Diff line change 75
75
#include <dirent.h>
76
76
#include <sys/file.h>
77
77
#include <sys/param.h>
78
+ #include <sys/resource.h> /* for getrlimit */
78
79
#include <sys/stat.h>
79
80
#include <sys/types.h>
80
81
#ifndef WIN32
83
84
#include <limits.h>
84
85
#include <unistd.h>
85
86
#include <fcntl.h>
86
- #ifdef HAVE_SYS_RESOURCE_H
87
- #include <sys/resource.h> /* for getrlimit */
88
- #endif
89
87
90
88
#include "access/xact.h"
91
89
#include "access/xlog.h"
Original file line number Diff line number Diff line change 23
23
#include <limits.h>
24
24
#include <signal.h>
25
25
#include <unistd.h>
26
+ #include <sys/resource.h>
26
27
#include <sys/select.h>
27
28
#include <sys/socket.h>
28
- #ifdef HAVE_SYS_RESOURCE_H
29
29
#include <sys/time.h>
30
- #include <sys/resource.h>
31
- #endif
32
-
33
- #ifdef WIN32
34
- #include "rusagestub.h"
35
- #endif
36
30
37
31
#include "access/parallel.h"
38
32
#include "access/printtup.h"
@@ -4860,7 +4854,7 @@ ShowUsage(const char *title)
4860
4854
* The following rusage fields are not defined by POSIX, but they're
4861
4855
* present on all current Unix-like systems so we use them without any
4862
4856
* special checks. Some of these could be provided in our Windows
4863
- * emulation in src/port/getrusage .c with more work.
4857
+ * emulation in src/port/win32getrusage .c with more work.
4864
4858
*/
4865
4859
appendStringInfo (& str ,
4866
4860
"!\t%ld kB max resident size\n" ,
Original file line number Diff line number Diff line change 14
14
#include <fcntl.h>
15
15
#include <signal.h>
16
16
#include <time.h>
17
+ #include <sys/resource.h>
17
18
#include <sys/stat.h>
19
+ #include <sys/time.h>
18
20
#include <sys/wait.h>
19
21
#include <unistd.h>
20
22
21
- #ifdef HAVE_SYS_RESOURCE_H
22
- #include <sys/time.h>
23
- #include <sys/resource.h>
24
- #endif
25
23
26
24
#include "catalog/pg_control.h"
27
25
#include "common/controldata_utils.h"
Original file line number Diff line number Diff line change 40
40
#include <signal.h>
41
41
#include <time.h>
42
42
#include <sys/time.h>
43
- #ifdef HAVE_SYS_RESOURCE_H
44
43
#include <sys/resource.h> /* for getrlimit */
45
- #endif
46
44
47
45
/* For testing, PGBENCH_USE_SELECT can be defined to force use of that code */
48
46
#if defined(HAVE_PPOLL ) && !defined(PGBENCH_USE_SELECT )
Original file line number Diff line number Diff line change 505
505
/* Define to 1 if you have the <sys/procctl.h> header file. */
506
506
#undef HAVE_SYS_PROCCTL_H
507
507
508
- /* Define to 1 if you have the <sys/resource.h> header file. */
509
- #undef HAVE_SYS_RESOURCE_H
510
-
511
508
/* Define to 1 if you have the <sys/signalfd.h> header file. */
512
509
#undef HAVE_SYS_SIGNALFD_H
513
510
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Replacement for <sys/resource.h> for Windows.
3
+ */
4
+ #ifndef WIN32_SYS_RESOURCE_H
5
+ #define WIN32_SYS_RESOURCE_H
6
+
7
+ #include <sys/time.h> /* for struct timeval */
8
+
9
+ #define RUSAGE_SELF 0
10
+ #define RUSAGE_CHILDREN (-1)
11
+
12
+ struct rusage
13
+ {
14
+ struct timeval ru_utime ; /* user time used */
15
+ struct timeval ru_stime ; /* system time used */
16
+ };
17
+
18
+ extern int getrusage (int who , struct rusage * rusage );
19
+
20
+ #endif /* WIN32_SYS_RESOURCE_H */
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 14
14
#ifndef PG_RUSAGE_H
15
15
#define PG_RUSAGE_H
16
16
17
- #include <sys/time.h>
18
-
19
- #ifdef HAVE_SYS_RESOURCE_H
20
17
#include <sys/resource.h>
21
- #else
22
- #include "rusagestub.h"
23
- #endif
18
+ #include <sys/time.h>
24
19
25
20
26
21
/* State structure for pg_rusage_init/pg_rusage_show */
Original file line number Diff line number Diff line change 1
1
/*-------------------------------------------------------------------------
2
2
*
3
- * getrusage .c
3
+ * win32getrusage .c
4
4
* get information about resource utilisation
5
5
*
6
6
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
7
7
* Portions Copyright (c) 1994, Regents of the University of California
8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * src/port/getrusage .c
11
+ * src/port/win32getrusage .c
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
15
15
16
16
#include "c.h"
17
17
18
- #include "rusagestub.h"
19
-
20
- /*
21
- * This code works on Windows, which is the only supported platform without a
22
- * native version of getrusage().
23
- */
18
+ #include <sys/resource.h>
24
19
25
20
int
26
21
getrusage (int who , struct rusage * rusage )
Original file line number Diff line number Diff line change 19
19
#include "postgres_fe.h"
20
20
21
21
#include <ctype.h>
22
+ #include <sys/resource.h>
22
23
#include <sys/stat.h>
24
+ #include <sys/time.h>
23
25
#include <sys/wait.h>
24
26
#include <signal.h>
25
27
#include <unistd.h>
26
28
27
- #ifdef HAVE_SYS_RESOURCE_H
28
- #include <sys/time.h>
29
- #include <sys/resource.h>
30
- #endif
31
-
32
29
#include "common/logging.h"
33
30
#include "common/restricted_token.h"
34
31
#include "common/string.h"
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ sub mkvcbuild
100
100
101
101
our @pgportfiles = qw(
102
102
chklocale.c explicit_bzero.c
103
- getpeereid.c getrusage.c inet_aton.c
103
+ getpeereid.c inet_aton.c
104
104
getaddrinfo.c inet_net_ntop.c kill.c open.c
105
105
snprintf.c strlcat.c strlcpy.c dirmod.c noblock.c path.c
106
106
dirent.c getopt.c getopt_long.c
@@ -111,6 +111,7 @@ sub mkvcbuild
111
111
win32dlopen.c
112
112
win32env.c win32error.c
113
113
win32fdatasync.c
114
+ win32getrusage.c
114
115
win32gettimeofday.c
115
116
win32link.c
116
117
win32pread.c
Original file line number Diff line number Diff line change @@ -364,7 +364,6 @@ sub GenerateFiles
364
364
HAVE_SYS_PERSONALITY_H => undef ,
365
365
HAVE_SYS_PRCTL_H => undef ,
366
366
HAVE_SYS_PROCCTL_H => undef ,
367
- HAVE_SYS_RESOURCE_H => undef ,
368
367
HAVE_SYS_SIGNALFD_H => undef ,
369
368
HAVE_SYS_SOCKIO_H => undef ,
370
369
HAVE_SYS_STAT_H => 1,
Original file line number Diff line number Diff line change 71
71
72
72
# Additional Windows-specific headers.
73
73
test " $f " = src/include/port/win32_port.h && continue
74
+ test " $f " = src/include/port/win32/sys/resource.h && continue
74
75
test " $f " = src/include/port/win32/sys/socket.h && continue
75
76
test " $f " = src/include/port/win32_msvc/dirent.h && continue
76
77
test " $f " = src/include/port/win32_msvc/utime.h && continue
90
91
test " $f " = src/include/port/atomics/generic-msvc.h && continue
91
92
test " $f " = src/include/port/atomics/generic-sunpro.h && continue
92
93
93
- # rusagestub.h is also platform-specific, and will be included
94
- # by utils/pg_rusage.h if necessary.
95
- test " $f " = src/include/rusagestub.h && continue
96
-
97
94
# sepgsql.h depends on headers that aren't there on most platforms.
98
95
test " $f " = contrib/sepgsql/sepgsql.h && continue
99
96
Original file line number Diff line number Diff line change 86
86
test " $f " = src/include/port/atomics/generic-msvc.h && continue
87
87
test " $f " = src/include/port/atomics/generic-sunpro.h && continue
88
88
89
- # rusagestub.h is also platform-specific, and will be included
90
- # by utils/pg_rusage.h if necessary.
91
- test " $f " = src/include/rusagestub.h && continue
92
-
93
89
# sepgsql.h depends on headers that aren't there on most platforms.
94
90
test " $f " = contrib/sepgsql/sepgsql.h && continue
95
91
You can’t perform that action at this time.
0 commit comments