@ -377,7 +377,9 @@ static void InitPostmasterDeathWatchHandle(void);
# ifdef EXEC_BACKEND
# ifdef WIN32
static pid_t win32_waitpid ( int * exitstatus ) ;
# define WNOHANG 0 /* ignored, so any integer value will do */
static pid_t waitpid ( pid_t pid , int * exitstatus , int options ) ;
static void WINAPI pgwin32_deadchild_callback ( PVOID lpParameter , BOOLEAN TimerOrWaitFired ) ;
static HANDLE win32ChildQueue ;
@ -388,7 +390,7 @@ typedef struct
HANDLE procHandle ;
DWORD procId ;
} win32_deadchild_waitinfo ;
# endif
# endif /* WIN32 */
static pid_t backend_forkexec ( Port * port ) ;
static pid_t internal_forkexec ( int argc , char * argv [ ] , Port * port ) ;
@ -2268,33 +2270,13 @@ 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 ( ) )
while ( ( pid = waitpid ( - 1 , & exitstatus , WNOHANG ) ) > 0 )
{
LOOPHEADER ( ) ;
/*
* Check if this child was a startup process .
*/
@ -5045,8 +5027,12 @@ ShmemBackendArrayRemove(Backend *bn)
# ifdef WIN32
/*
* Subset implementation of waitpid ( ) for Windows . We assume pid is - 1
* ( that is , check all child processes ) and options is WNOHANG ( don ' t wait ) .
*/
static pid_t
win32_waitpid ( int * exitstatus )
waitpid ( pid_t pid , int * exitstatus , int option s )
{
DWORD dwd ;
ULONG_PTR key ;