*** a/configure
--- b/configure
***************
*** 19255,19261 **** fi
  
  
  
! for ac_func in cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l
  do
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
  { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
--- 19255,19261 ----
  
  
  
! for ac_func in cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes wcstombs wcstombs_l
  do
  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
  { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
*** a/configure.in
--- b/configure.in
***************
*** 1207,1213 **** PGAC_VAR_INT_TIMEZONE
  AC_FUNC_ACCEPT_ARGTYPES
  PGAC_FUNC_GETTIMEOFDAY_1ARG
  
! AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l])
  
  AC_REPLACE_FUNCS(fseeko)
  case $host_os in
--- 1207,1213 ----
  AC_FUNC_ACCEPT_ARGTYPES
  PGAC_FUNC_GETTIMEOFDAY_1ARG
  
! AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes wcstombs wcstombs_l])
  
  AC_REPLACE_FUNCS(fseeko)
  case $host_os in
*** a/src/backend/postmaster/postmaster.c
--- b/src/backend/postmaster/postmaster.c
***************
*** 377,383 **** static void InitPostmasterDeathWatchHandle(void);
  #ifdef EXEC_BACKEND
  
  #ifdef WIN32
! static pid_t win32_waitpid(int *exitstatus);
  static void WINAPI pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired);
  
  static HANDLE win32ChildQueue;
--- 377,384 ----
  #ifdef EXEC_BACKEND
  
  #ifdef WIN32
! #define waitpid(pid, exitstatus, options) pgwin32_waitpid(pid, exitstatus, options)
! static pid_t pgwin32_waitpid(pid_t pid, int *exitstatus, int options);
  static void WINAPI pgwin32_deadchild_callback(PVOID lpParameter, BOOLEAN TimerOrWaitFired);
  
  static HANDLE win32ChildQueue;
***************
*** 2268,2300 **** reaper(SIGNAL_ARGS)
  	int			pid;			/* process id of dead child process */
  	int			exitstatus;		/* its exit status */
  
- 	/* These macros hide platform variations in getting child status */
- #ifdef HAVE_WAITPID
- 	int			status;			/* child exit status */
- 
- #define LOOPTEST()		((pid = waitpid(-1, &status, WNOHANG)) > 0)
- #define LOOPHEADER()	(exitstatus = status)
- #else							/* !HAVE_WAITPID */
- #ifndef WIN32
- 	union wait	status;			/* child exit status */
- 
- #define LOOPTEST()		((pid = wait3(&status, WNOHANG, NULL)) > 0)
- #define LOOPHEADER()	(exitstatus = status.w_status)
- #else							/* WIN32 */
- #define LOOPTEST()		((pid = win32_waitpid(&exitstatus)) > 0)
- #define LOOPHEADER()
- #endif   /* WIN32 */
- #endif   /* HAVE_WAITPID */
- 
  	PG_SETMASK(&BlockSig);
  
  	ereport(DEBUG4,
  			(errmsg_internal("reaping dead processes")));
  
! 	while (LOOPTEST())
  	{
- 		LOOPHEADER();
- 
  		/*
  		 * Check if this child was a startup process.
  		 */
--- 2269,2281 ----
  	int			pid;			/* process id of dead child process */
  	int			exitstatus;		/* its exit status */
  
  	PG_SETMASK(&BlockSig);
  
  	ereport(DEBUG4,
  			(errmsg_internal("reaping dead processes")));
  
! 	while ((pid = waitpid(-1, &exitstatus, WNOHANG)) > 0)
  	{
  		/*
  		 * Check if this child was a startup process.
  		 */
***************
*** 5046,5052 **** ShmemBackendArrayRemove(Backend *bn)
  #ifdef WIN32
  
  static pid_t
! win32_waitpid(int *exitstatus)
  {
  	DWORD		dwd;
  	ULONG_PTR	key;
--- 5027,5033 ----
  #ifdef WIN32
  
  static pid_t
! pgwin32_waitpid(pid_t pid, int *exitstatus, int options)
  {
  	DWORD		dwd;
  	ULONG_PTR	key;
*** a/src/include/pg_config.h.in
--- b/src/include/pg_config.h.in
***************
*** 614,622 ****
  /* Define to 1 if you have the `vsnprintf' function. */
  #undef HAVE_VSNPRINTF
  
- /* Define to 1 if you have the `waitpid' function. */
- #undef HAVE_WAITPID
- 
  /* Define to 1 if you have the <wchar.h> header file. */
  #undef HAVE_WCHAR_H
  
--- 614,619 ----
*** a/src/include/pg_config.h.win32
--- b/src/include/pg_config.h.win32
***************
*** 505,513 ****
  /* Define to 1 if you have the `vsnprintf' function. */
  #define HAVE_VSNPRINTF 1
  
- /* Define to 1 if you have the `waitpid' function. */
- /* #undef HAVE_WAITPID */
- 
  /* Define to 1 if you have the <wchar.h> header file. */
  #define HAVE_WCHAR_H 1
  
--- 505,510 ----