Index: src/backend/main/main.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/main/main.c,v retrieving revision 1.74 diff -c -r1.74 main.c *** src/backend/main/main.c 22 Feb 2004 21:26:55 -0000 1.74 --- src/backend/main/main.c 26 Feb 2004 08:03:41 -0000 *************** *** 91,97 **** #if defined(WIN32) { WSADATA wsaData; ! int err = WSAStartup(MAKEWORD(2,2), &wsaData); if (err != 0) { fprintf(stderr, "%s: WSAStartup failed: %d\n", --- 91,104 ---- #if defined(WIN32) { WSADATA wsaData; ! int err; ! ! /* Make output streams unbuffered by default */ ! setvbuf(stdout,NULL,_IONBF,0); ! setvbuf(stderr,NULL,_IONBF,0); ! ! /* Prepare Winsock */ ! err = WSAStartup(MAKEWORD(2,2), &wsaData); if (err != 0) { fprintf(stderr, "%s: WSAStartup failed: %d\n", *************** *** 99,104 **** --- 106,112 ---- exit(1); } + /* Start our win32 signal implementation */ pgwin32_signal_initialize(); } #endif Index: src/backend/port/dynloader/win32.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/port/dynloader/win32.h,v retrieving revision 1.1 diff -c -r1.1 win32.h *** src/backend/port/dynloader/win32.h 15 May 2003 16:35:29 -0000 1.1 --- src/backend/port/dynloader/win32.h 26 Feb 2004 08:03:41 -0000 *************** *** 8,11 **** --- 8,16 ---- #define pg_dlclose dlclose #define pg_dlerror dlerror + char* dlerror(void); + int dlclose(void *handle); + void* dlsym(void *handle, const char *symbol); + void* dlopen(const char *path, int mode); + #endif /* PORT_PROTOS_H */ Index: src/backend/postmaster/postmaster.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v retrieving revision 1.369 diff -c -r1.369 postmaster.c *** src/backend/postmaster/postmaster.c 25 Feb 2004 19:41:22 -0000 1.369 --- src/backend/postmaster/postmaster.c 26 Feb 2004 08:03:44 -0000 *************** *** 3525,3553 **** si.cb = sizeof(si); if (!CreateProcess(NULL,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi)) { ! elog(ERROR,"CreateProcess call failed (%d): %m",GetLastError()); return -1; } if (!IsUnderPostmaster) /* We are the Postmaster creating a child... */ win32_AddChild(pi.dwProcessId,pi.hProcess); ! if (!DuplicateHandle(GetCurrentProcess(), pi.hProcess, GetCurrentProcess(), &childHandleCopy, 0, FALSE, ! DUPLICATE_SAME_ACCESS)) ereport(FATAL, ! (errmsg_internal("failed to duplicate child handle: %i",GetLastError()))); waiterThread = CreateThread(NULL, 64*1024, win32_sigchld_waiter, (LPVOID)childHandleCopy, 0, NULL); if (!waiterThread) ereport(FATAL, ! (errmsg_internal("failed to create sigchld waiter thread: %i",GetLastError()))); ! CloseHandle(waiterThread); ! if (IsUnderPostmaster) CloseHandle(pi.hProcess); CloseHandle(pi.hThread); --- 3525,3553 ---- si.cb = sizeof(si); if (!CreateProcess(NULL,cmdLine,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi)) { ! elog(ERROR,"CreateProcess call failed (%i): %m",(int)GetLastError()); return -1; } if (!IsUnderPostmaster) /* We are the Postmaster creating a child... */ win32_AddChild(pi.dwProcessId,pi.hProcess); ! if (!DuplicateHandle(GetCurrentProcess(), pi.hProcess, GetCurrentProcess(), &childHandleCopy, 0, FALSE, ! DUPLICATE_SAME_ACCESS)) ereport(FATAL, ! (errmsg_internal("failed to duplicate child handle: %i",(int)GetLastError()))); waiterThread = CreateThread(NULL, 64*1024, win32_sigchld_waiter, (LPVOID)childHandleCopy, 0, NULL); if (!waiterThread) ereport(FATAL, ! (errmsg_internal("failed to create sigchld waiter thread: %i",(int)GetLastError()))); ! CloseHandle(waiterThread); ! if (IsUnderPostmaster) CloseHandle(pi.hProcess); CloseHandle(pi.hThread); *************** *** 3600,3613 **** /* Something stronger than WARNING here? */ ereport(WARNING, ! (errmsg_internal("unable to find child entry with pid %d", pid))); } static pid_t win32_waitpid(int *exitstatus) { Assert(win32_childPIDArray && win32_childHNDArray); ! elog(DEBUG3,"waiting on %d children",win32_numChildren); if (win32_numChildren > 0) { --- 3600,3613 ---- /* Something stronger than WARNING here? */ ereport(WARNING, ! (errmsg_internal("unable to find child entry with pid %lu", pid))); } static pid_t win32_waitpid(int *exitstatus) { Assert(win32_childPIDArray && win32_childHNDArray); ! elog(DEBUG3,"waiting on %lu children",win32_numChildren); if (win32_numChildren > 0) { *************** *** 3623,3630 **** { case WAIT_FAILED: ereport(ERROR, ! (errmsg_internal("failed to wait on %d children: %i", ! win32_numChildren,GetLastError()))); /* Fall through to WAIT_TIMEOUTs return */ case WAIT_TIMEOUT: --- 3623,3630 ---- { case WAIT_FAILED: ereport(ERROR, ! (errmsg_internal("failed to wait on %lu children: %i", ! win32_numChildren,(int)GetLastError()))); /* Fall through to WAIT_TIMEOUTs return */ case WAIT_TIMEOUT: *************** *** 3641,3647 **** * No choice other than to assume a catastrophic failure. */ ereport(FATAL, ! (errmsg_internal("failed to get exit code for child %d", win32_childPIDArray[index]))); *exitstatus = (int)exitCode; return win32_childPIDArray[index]; --- 3641,3647 ---- * No choice other than to assume a catastrophic failure. */ ereport(FATAL, ! (errmsg_internal("failed to get exit code for child %lu", win32_childPIDArray[index]))); *exitstatus = (int)exitCode; return win32_childPIDArray[index]; *************** *** 3661,3667 **** if (r == WAIT_OBJECT_0) pg_queue_signal(SIGCHLD); else ! fprintf(stderr,"ERROR: Failed to wait on child process handle: %i\n",GetLastError()); CloseHandle(procHandle); return 0; } --- 3661,3667 ---- if (r == WAIT_OBJECT_0) pg_queue_signal(SIGCHLD); else ! fprintf(stderr,"ERROR: Failed to wait on child process handle: %i\n",(int)GetLastError()); CloseHandle(procHandle); return 0; } Index: src/bin/pg_resetxlog/Makefile =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_resetxlog/Makefile,v retrieving revision 1.5 diff -c -r1.5 Makefile *** src/bin/pg_resetxlog/Makefile 10 Feb 2004 23:24:13 -0000 1.5 --- src/bin/pg_resetxlog/Makefile 26 Feb 2004 08:03:50 -0000 *************** *** 38,41 **** rm -f $(DESTDIR)$(bindir)/pg_resetxlog$(X) clean distclean maintainer-clean: ! rm -f pg_resetxlog$(X) pg_resetxlog.o pg_crc.o pg_crc.c dirmod.c --- 38,41 ---- rm -f $(DESTDIR)$(bindir)/pg_resetxlog$(X) clean distclean maintainer-clean: ! rm -f pg_resetxlog$(X) pg_crc.c dirmod.c $(OBJS)