From 31c8e94b34a4c9b6bde7fc4e8962954c42978a96 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 14 Feb 1997 04:19:07 +0000 Subject: [PATCH] Remove WIN32 defines. They never worked. --- src/backend/libpq/pqcomm.c | 33 +---------- src/backend/libpq/pqpacket.c | 6 +- src/backend/optimizer/path/costsize.c | 22 +++---- src/backend/optimizer/path/xfunc.c | 7 +-- src/backend/parser/parser.c | 4 +- src/backend/parser/scan.l | 4 +- src/backend/postmaster/postmaster.c | 84 +-------------------------- src/backend/storage/file/fd.c | 15 +---- src/backend/storage/ipc/s_lock.c | 30 +--------- src/backend/storage/lmgr/proc.c | 14 +---- src/backend/storage/smgr/md.c | 9 +-- src/backend/tcop/postgres.c | 48 ++------------- src/backend/utils/adt/date.c | 10 +--- src/backend/utils/adt/filename.c | 8 +-- src/backend/utils/adt/float.c | 9 +-- src/backend/utils/error/elog.c | 11 +--- src/backend/utils/fmgr/dfmgr.c | 14 +---- src/backend/utils/init/findbe.c | 23 +------- src/backend/utils/init/miscinit.c | 15 +---- src/backend/utils/init/postinit.c | 9 +-- src/include/c.h | 12 +--- src/include/libpq/libpq-fs.h | 8 +-- src/include/storage/fd.h | 7 +-- src/include/storage/proc.h | 9 +-- src/include/utils/dynamic_loader.h | 7 +-- src/utils/version.c | 7 +-- 26 files changed, 39 insertions(+), 386 deletions(-) diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index cb65472386..928bc281b8 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.10 1996/12/26 22:07:03 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/pqcomm.c,v 1.11 1997/02/14 04:15:29 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -39,16 +39,12 @@ #include #include #include -#ifndef WIN32 #include /* for ttyname() */ #include #include #include #include #include -#else -#include -#endif /* WIN32 */ #if defined(linux) #ifndef SOMAXCONN @@ -77,17 +73,8 @@ int PQAsyncNotifyWaiting; /* for async. notification */ void pq_init(int fd) { -#ifdef WIN32 - int in, out; - - in = _open_osfhandle(fd, _O_RDONLY); - out = _open_osfhandle(fd, _O_APPEND); - Pfin = fdopen(in, "rb"); - Pfout = fdopen(out, "wb"); -#else Pfin = fdopen(fd, "r"); Pfout = fdopen(dup(fd), "w"); -#endif /* WIN32 */ if (!Pfin || !Pfout) elog(FATAL, "pq_init: Couldn't initialize socket connection"); PQnotifies_init(); @@ -487,10 +474,6 @@ pq_getinserv(struct sockaddr_in *sin, char *host, char *serv) void pq_regoob(void (*fptr)()) { -#ifdef WIN32 - /* Who knows what to do here? */ - return; -#else int fd = fileno(Pfout); #if defined(hpux) ioctl(fd, FIOSSAIOOWN, getpid()); @@ -498,15 +481,12 @@ pq_regoob(void (*fptr)()) fcntl(fd, F_SETOWN, getpid()); #endif /* hpux */ (void) pqsignal(SIGURG,fptr); -#endif /* WIN32 */ } void pq_unregoob() { -#ifndef WIN32 pqsignal(SIGURG,SIG_DFL); -#endif /* WIN32 */ } @@ -554,15 +534,6 @@ StreamServerPort(char *hostName, short portName, int *fdP) int fd; int one = 1; -#ifdef WIN32 - /* This is necessary to make it possible for a backend to use - ** stdio to read from the socket. - */ - int optionvalue = SO_SYNCHRONOUS_NONALERT; - - setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&optionvalue, - sizeof(optionvalue)); -#endif /* WIN32 */ if (! hostName) hostName = "localhost"; @@ -648,10 +619,8 @@ StreamConnection(int server_fd, Port *port) port->mask = 1 << port->sock; -#ifndef WIN32 /* reset to non-blocking */ fcntl(port->sock, F_SETFL, 1); -#endif /* WIN32 */ return(STATUS_OK); } diff --git a/src/backend/libpq/pqpacket.c b/src/backend/libpq/pqpacket.c index eddeb97040..5190ec5d88 100644 --- a/src/backend/libpq/pqpacket.c +++ b/src/backend/libpq/pqpacket.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.3 1997/02/13 08:06:36 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/pqpacket.c,v 1.4 1997/02/14 04:15:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -38,13 +38,9 @@ */ #include #include -#ifndef WIN32 #include #include #include -#else -#include -#endif /*WIN32 */ #include #include diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 82553ccf99..779756f795 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.12 1997/01/26 16:06:42 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.13 1997/02/14 04:15:35 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -16,21 +16,15 @@ #include "config.h" #include -#ifdef WIN32 -# include +#ifdef HAVE_LIMITS_H # include -# define MAXINT INT_MAX +# ifndef MAXINT +# define MAXINT INT_MAX +# endif #else -# ifdef HAVE_LIMITS_H -# include -# ifndef MAXINT -# define MAXINT INT_MAX -# endif -# else -# ifdef HAVE_VALUES_H -# include -# endif -# endif +# ifdef HAVE_VALUES_H +# include +# endif #endif #include diff --git a/src/backend/optimizer/path/xfunc.c b/src/backend/optimizer/path/xfunc.c index 8401e538a7..3e3ee650f9 100644 --- a/src/backend/optimizer/path/xfunc.c +++ b/src/backend/optimizer/path/xfunc.c @@ -9,16 +9,11 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.2 1996/10/23 07:14:43 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.3 1997/02/14 04:15:39 momjian Exp $ * *------------------------------------------------------------------------- */ -#ifndef WIN32 #include /* for MAXFLOAT on most systems */ -#else -#include -#define MAXFLOAT DBL_MAX -#endif /* WIN32 */ #include /* for MAXFLOAT on SunOS */ #include diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c index 1babdb7e03..66d6624f59 100644 --- a/src/backend/parser/parser.c +++ b/src/backend/parser/parser.c @@ -6,15 +6,13 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.17 1997/01/22 01:43:26 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.18 1997/02/14 04:15:49 momjian Exp $ * *------------------------------------------------------------------------- */ #include #include -#ifndef WIN32 #include -#endif /*WIN32 */ #include /* for MAXPATHLEN */ #include "postgres.h" diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l index 8e77d749f2..605d940dc9 100644 --- a/src/backend/parser/scan.l +++ b/src/backend/parser/scan.l @@ -8,14 +8,12 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.8 1996/12/04 14:23:11 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.9 1997/02/14 04:15:59 momjian Exp $ * *------------------------------------------------------------------------- */ #include -#ifndef WIN32 #include -#endif /* WIN32 */ #ifndef __linux__ #include #else diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 5168162d2a..1cb91dcaa7 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.39 1997/02/13 08:31:09 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.40 1997/02/14 04:16:12 momjian Exp $ * * NOTES * @@ -198,11 +198,7 @@ checkDataDir(const char *DataDir, bool *DataDirOK) fclose(fp); -#ifndef WIN32 ValidatePgVersion(DataDir, &reason); -#else - reason = NULL; -#endif /* WIN32 */ if (reason) { fprintf(stderr, "Database system in directory %s " @@ -231,9 +227,6 @@ PostmasterMain(int argc, char *argv[]) int silentflag = 0; char hostbuf[MAXHOSTNAMELEN]; bool DataDirOK; /* We have a usable PGDATA value */ -#if defined(WIN32) - WSADATA WSAData; -#endif /* WIN32 */ progname = argv[0]; @@ -363,18 +356,6 @@ PostmasterMain(int argc, char *argv[]) } -#if defined(WIN32) - if ((status = WSAStartup(MAKEWORD(1,1), &WSAData)) == 0) - (void) printf("%s\nInitializing WinSock: %s\n", WSAData.szDescription, WSAData.szSystemStatus); - else - { - fprintf(stderr, "Error initializing WinSock: %d is the err", status); - exit(1); - } - _nt_init(); - _nt_attach(); -#endif /* WIN32 */ - status = StreamServerPort(hostName, PostPortName, &ServerSock); if (status != STATUS_OK) { fprintf(stderr, "%s: cannot create stream port\n", @@ -397,15 +378,12 @@ PostmasterMain(int argc, char *argv[]) pmdaemonize(); pqsignal(SIGINT, pmdie); -#ifndef WIN32 pqsignal(SIGCHLD, reaper); pqsignal(SIGTTIN, SIG_IGN); pqsignal(SIGTTOU, SIG_IGN); pqsignal(SIGHUP, pmdie); pqsignal(SIGTERM, pmdie); pqsignal(SIGCONT, dumpstatus); -#endif /* WIN32 */ - status = ServerLoop(); @@ -845,7 +823,6 @@ reaper(SIGNAL_ARGS) if (DebugLvl) fprintf(stderr, "%s: reaping dead processes...\n", progname); -#ifndef WIN32 #ifdef HAVE_WAITPID while((pid = waitpid(-1, &status, WNOHANG)) > 0) CleanupProc(pid, status); @@ -853,7 +830,6 @@ reaper(SIGNAL_ARGS) while((pid = wait3(&statusp, WNOHANG, NULL)) > 0) CleanupProc(pid, statusp.w_status); #endif -#endif /* WIN32 */ } /* @@ -914,7 +890,6 @@ CleanupProc(int pid, * collect core dumps from all backends by hand. * ----------------- */ -#ifndef WIN32 sig = (SendStop) ? SIGSTOP : SIGUSR1; if (bp->pid != pid) { if (DebugLvl) @@ -925,7 +900,6 @@ CleanupProc(int pid, bp->pid); (void) kill(bp->pid, sig); } -#endif /* WIN32 */ ProcRemove(bp->pid); prev = DLGetPred(curr); @@ -1006,7 +980,6 @@ BackendStartup(StartupInfo *packet, /* client's startup packet */ fprintf(stderr, "-----------------------------------------\n"); } -#ifndef WIN32 if ((pid = FORK()) == 0) { /* child */ if (DoExec(packet, port->sock)) fprintf(stderr, "%s child[%d]: BackendStartup: execv failed\n", @@ -1021,14 +994,6 @@ BackendStartup(StartupInfo *packet, /* client's startup packet */ progname); return(STATUS_ERROR); } -#else - pid = DoExec(packet, port->sock); - if (pid == FALSE) { - fprintf(stderr, "%s: BackendStartup: CreateProcess failed\n", - progname); - return(STATUS_ERROR); - } -#endif /* WIN32 */ if (DebugLvl) fprintf(stderr, "%s: BackendStartup: pid %d user %s db %s socket %d\n", @@ -1119,12 +1084,6 @@ DoExec(StartupInfo *packet, int portFd) char dbbuf[ARGV_SIZE + 1]; int ac = 0; int i; -#if defined(WIN32) - char win32_args[(2 * ARGV_SIZE) + 1]; - PROCESS_INFORMATION piProcInfo; - STARTUPINFO siStartInfo; - BOOL fSuccess; -#endif /* WIN32 */ (void) strncpy(execbuf, Execfile, MAXPATHLEN); execbuf[MAXPATHLEN - 1] = '\0'; @@ -1152,16 +1111,7 @@ DoExec(StartupInfo *packet, int portFd) if (packet->tty[0]) { (void) strncpy(ttybuf, packet->tty, ARGV_SIZE); av[ac++] = "-o"; -#if defined(WIN32) - /* BIG HACK - The front end is passing "/dev/null" here which - ** causes new backends to fail. So, as a very special case, - ** use a real NT filename. - */ - av[ac++] = "CON"; -#else av[ac++] = ttybuf; -#endif /* WIN32 */ - } /* tell the backend we're using European dates */ @@ -1200,39 +1150,7 @@ DoExec(StartupInfo *packet, int portFd) fprintf(stderr, ")\n"); } -#ifndef WIN32 return(execv(av[0], av)); -#else - - /* Copy all the arguments into one char array */ - win32_args[0] = '\0'; - for (i = 0; i < ac; i++) - { - strcat(win32_args, av[i]); - strcat(win32_args, " "); - } - - siStartInfo.cb = sizeof(STARTUPINFO); - siStartInfo.lpReserved = NULL; - siStartInfo.lpDesktop = NULL; - siStartInfo.lpTitle = NULL; - siStartInfo.lpReserved2 = NULL; - siStartInfo.cbReserved2 = 0; - siStartInfo.dwFlags = 0; - - - fSuccess = CreateProcess(progname, win32_args, NULL, NULL, - TRUE, 0, NULL, NULL, &siStartInfo, &piProcInfo); - if (fSuccess) - { - /* The parent process doesn't need the handles */ - CloseHandle(piProcInfo.hThread); - CloseHandle(piProcInfo.hProcess); - return (piProcInfo.dwProcessId); - } - else - return (FALSE); -#endif /* WIN32 */ } /* diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index c06f89f884..7026837c34 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -6,7 +6,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Id: fd.c,v 1.14 1997/01/27 00:09:43 scrappy Exp $ + * $Id: fd.c,v 1.15 1997/02/14 04:16:26 momjian Exp $ * * NOTES: * @@ -134,13 +134,8 @@ static int nfile = 0; * that we can open it and find out if we really have any descriptors * available or not. */ -#ifndef WIN32 static char *Nulldev = "/dev/null"; static char Sep_char = '/'; -#else -static char *Nulldev = "NUL"; -static char Sep_char = '\\'; -#endif /* WIN32 */ /* * Private Routines @@ -471,12 +466,7 @@ filepath(char *filename) char basename[16]; int len; -#ifndef WIN32 if (*filename != Sep_char) { -#else - if (!(filename[1] == ':' && filename[2] == Sep_char)) { -#endif /* WIN32 */ - /* Either /base/ or \base\ */ sprintf(basename, "%cbase%c", Sep_char, Sep_char); @@ -576,9 +566,6 @@ fileNameOpenFile(FileName fileName, close(tmpfd); } -#ifdef WIN32 - fileFlags |= _O_BINARY; -#endif /* WIN32 */ vfdP->fd = open(fileName,fileFlags,fileMode); vfdP->fdstate = 0x0; diff --git a/src/backend/storage/ipc/s_lock.c b/src/backend/storage/ipc/s_lock.c index 1da6817017..079aaaf39f 100644 --- a/src/backend/storage/ipc/s_lock.c +++ b/src/backend/storage/ipc/s_lock.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.10 1997/01/26 20:15:00 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/ipc/Attic/s_lock.c,v 1.11 1997/02/14 04:16:43 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -37,10 +37,6 @@ * manual for POWER in any case. * */ -#ifdef WIN32 -#include -#endif /* WIN32 */ - #include "postgres.h" #include "storage/ipc.h" @@ -414,27 +410,3 @@ S_INIT_LOCK(slock_t *lock) #endif /* HAS_TEST_AND_SET */ - - -#ifdef WIN32 -void -S_LOCK(HANDLE *lock) -{ - int x = 0; - x = x / x; -} - -void -S_UNLOCK(HANDLE *lock) -{ - int x = 0; - x = x / x; -} - -void -S_INIT_LOCK(HANDLE *lock) -{ - int x = 0; - x = x / x; -} -#endif /*WIN32*/ diff --git a/src/backend/storage/lmgr/proc.c b/src/backend/storage/lmgr/proc.c index 135dbc9fd4..db3b4e636b 100644 --- a/src/backend/storage/lmgr/proc.c +++ b/src/backend/storage/lmgr/proc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.16 1997/02/13 15:55:01 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.17 1997/02/14 04:16:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -46,12 +46,10 @@ * This is so that we can support more backends. (system-wide semaphore * sets run out pretty fast.) -ay 4/95 * - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.16 1997/02/13 15:55:01 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.17 1997/02/14 04:16:56 momjian Exp $ */ #include -#ifndef WIN32 #include -#endif /* WIN32 */ #include #include #include @@ -157,9 +155,7 @@ InitProcess(IPCKey key) * Routine called if deadlock timer goes off. See ProcSleep() * ------------------ */ -#ifndef WIN32 pqsignal(SIGALRM, HandleDeadLock); -#endif /* WIN32 we'll have to figure out how to handle this later */ SpinAcquire(ProcStructLock); @@ -456,9 +452,7 @@ ProcSleep(PROC_QUEUE *queue, { int i; PROC *proc; -#ifndef WIN32 /* figure this out later */ struct itimerval timeval, dummy; -#endif /* WIN32 */ proc = (PROC *) MAKE_PTR(queue->links.prev); for (i=0;isize;i++) @@ -501,13 +495,11 @@ ProcSleep(PROC_QUEUE *queue, * to 0. * -------------- */ -#ifndef WIN32 memset(&timeval, 0, sizeof(struct itimerval)); timeval.it_value.tv_sec = DEADLOCK_TIMEOUT; if (setitimer(ITIMER_REAL, &timeval, &dummy)) elog(FATAL, "ProcSleep: Unable to set timer for process wakeup"); -#endif /* WIN32 */ /* -------------- * if someone wakes us between SpinRelease and IpcSemaphoreLock, @@ -521,13 +513,11 @@ ProcSleep(PROC_QUEUE *queue, * We were awoken before a timeout - now disable the timer * --------------- */ -#ifndef WIN32 timeval.it_value.tv_sec = 0; if (setitimer(ITIMER_REAL, &timeval, &dummy)) elog(FATAL, "ProcSleep: Unable to diable timer for process wakeup"); -#endif /* WIN32 */ /* ---------------- * We were assumed to be in a critical section when we went diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index 3bab0bbc68..fdcefb78ad 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.10 1996/11/27 07:24:02 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.11 1997/02/14 04:17:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -154,10 +154,6 @@ mdunlink(Relation reln) /* On Windows NT you can't unlink a file if it is open so we have ** to do this. */ -#ifdef WIN32 - (void) mdclose(reln); -#endif /* WIN32 */ - memset(fname,0, NAMEDATALEN); strncpy(fname, RelationGetRelationName(reln)->data, NAMEDATALEN); @@ -167,9 +163,6 @@ mdunlink(Relation reln) /* unlink all the overflow files for large relations */ for (i = 1; ; i++) { -#ifdef WIN32 - (void) mdclose(reln); -#endif /* WIN32 */ sprintf(tname, "%s.%d", fname, i); if (FileNameUnlink(tname) < 0) break; diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c index a0b51ef327..da904ac4f7 100644 --- a/src/backend/tcop/postgres.c +++ b/src/backend/tcop/postgres.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.30 1997/02/12 05:24:22 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.31 1997/02/14 04:17:21 momjian Exp $ * * NOTES * this is the "main" module of the postgres backend and @@ -105,13 +105,13 @@ static bool IsEmptyQuery = false; char relname[80]; /* current relation name */ -#if defined(WIN32) || defined(nextstep) +#if defined(nextstep) jmp_buf Warn_restart; #define sigsetjmp(x,y) setjmp(x) #define siglongjmp longjmp #else sigjmp_buf Warn_restart; -#endif /*defined(WIN32) || defined(nextstep) */ +#endif /* defined(nextstep) */ int InWarn; extern int NBuffers; @@ -816,10 +816,6 @@ PostgresMain(int argc, char *argv[]) Dlelem *curr; int status; -#ifdef WIN32 - WSADATA WSAData; -#endif /* WIN32 */ - extern int optind; extern char *optarg; extern short DebugLvl; @@ -830,14 +826,12 @@ PostgresMain(int argc, char *argv[]) */ pqsignal(SIGINT, die); -#ifndef WIN32 pqsignal(SIGHUP, die); pqsignal(SIGTERM, die); pqsignal(SIGPIPE, die); pqsignal(SIGUSR1, quickdie); pqsignal(SIGUSR2, Async_NotifyHandler); pqsignal(SIGFPE, FloatExceptionHandler); -#endif /* WIN32 */ /* -------------------- * initialize globals @@ -988,13 +982,6 @@ PostgresMain(int argc, char *argv[]) */ multiplexedBackend = true; serverPortnum = atoi(optarg); -#ifdef WIN32 - /* There was no postmaster started so the shared memory - ** for the shared memory table hasn't been allocated so - ** do it now. - */ - _nt_init(); -#endif /* WIN32 */ break; case 'M': exit(PostmasterMain(argc, argv)); @@ -1196,15 +1183,6 @@ PostgresMain(int argc, char *argv[]) pq_init(Portfd); } -#ifdef WIN32 - if ((status = WSAStartup(MAKEWORD(1,1), &WSAData)) == 0) - (void) printf("%s\nInitializing WinSock: %s\n", WSAData.szDescription, WSAData.szSystemStatus); - else { - fprintf(stderr, "Error initializing WinSock: %d is the err", status); - exit(1); - } -#endif /* WIN32 */ - if (multiplexedBackend) { if (serverPortnum == 0 || StreamServerPort(hostName, serverPortnum, &serverSock) != STATUS_OK) @@ -1256,10 +1234,6 @@ PostgresMain(int argc, char *argv[]) puts("\tInitPostgres().."); } -#if WIN32 - _nt_attach(); -#endif /* WIN32 */ - InitPostgres(DBName); /* ---------------- @@ -1274,13 +1248,9 @@ PostgresMain(int argc, char *argv[]) * ---------------- */ -#ifndef WIN32 pqsignal(SIGHUP, handle_warn); if (sigsetjmp(Warn_restart, 1) != 0) { -#else - if (setjmp(Warn_restart) != 0) { -#endif /* WIN32 */ InWarn = 1; time(&tim); @@ -1300,7 +1270,7 @@ PostgresMain(int argc, char *argv[]) */ if (IsUnderPostmaster == false) { puts("\nPOSTGRES backend interactive interface"); - puts("$Revision: 1.30 $ $Date: 1997/02/12 05:24:22 $"); + puts("$Revision: 1.31 $ $Date: 1997/02/14 04:17:21 $"); } /* ---------------- @@ -1497,7 +1467,6 @@ PostgresMain(int argc, char *argv[]) return 1; } -#ifndef WIN32 #ifdef HAVE_RUSAGE #include "rusagestub.h" #else /* HAVE_RUSAGE */ @@ -1597,12 +1566,3 @@ ShowUsage(void) PrintBufferUsage(StatFp); /* DisplayTupleCount(StatFp); */ } -#else -void -ShowUsage() -{} - -void -ResetUsage() -{} -#endif /* WIN32 */ diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 80dbae8dd0..506b3fbfc9 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.4 1996/11/10 03:03:05 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.5 1997/02/14 04:17:35 momjian Exp $ * * NOTES * This code is actually (almost) unused. @@ -855,16 +855,13 @@ text * timeofday(void) { -#ifndef WIN32 struct timeval tp; struct timezone tpz; -#endif /* WIN32 */ char templ[500]; char buf[500]; text *tm; int len = 0; -#ifndef WIN32 gettimeofday(&tp, &tpz); (void) strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%d %Y %Z", localtime((time_t *) &tp.tv_sec)); @@ -875,9 +872,4 @@ timeofday(void) VARSIZE(tm) = len; strncpy(VARDATA(tm), buf, strlen(buf)); return tm; -#else - len = len / len; - return tm; -#endif /* WIN32 */ - } diff --git a/src/backend/utils/adt/filename.c b/src/backend/utils/adt/filename.c index 7b5a1b8a19..fe4e78c3f9 100644 --- a/src/backend/utils/adt/filename.c +++ b/src/backend/utils/adt/filename.c @@ -7,16 +7,14 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.5 1996/11/08 05:59:43 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.6 1997/02/14 04:17:47 momjian Exp $ * *------------------------------------------------------------------------- */ #include #include -#ifndef WIN32 #include -#endif /* WIN32 */ #include @@ -35,7 +33,6 @@ filename_in(char *file) * should let the shell do expansions (shexpand) */ -#ifndef WIN32 str = (char *) palloc(MAXPATHLEN * sizeof(*str)); str[0] = '\0'; if (file[0] == '~') { @@ -103,9 +100,6 @@ filename_in(char *file) } strcat(str, file+ind); return(str); -#else - return(NULL); -#endif /* WIN32 */ } char * diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 6dce9642c5..3c934003d1 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.10 1997/01/24 18:17:06 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/float.c,v 1.11 1997/02/14 04:17:52 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -220,17 +220,10 @@ char *float8out(float64 num) if (!num) return strcpy(ascii, "(null)"); -#ifndef WIN32 if (isnan(*num)) return strcpy(ascii, "NaN"); if (isinf(*num)) return strcpy(ascii, "Infinity"); -#else - if (_isnan(*num)) - return strcpy(ascii, "NaN"); - if (!_finite(*num)) - return strcpy(ascii, "Infinity"); -#endif sprintf(ascii, "%.*g", DBL_DIG, *num); return(ascii); diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index ae4aea90f6..992fd7cb0f 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.11 1996/11/14 10:24:22 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.12 1997/02/14 04:17:57 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -34,9 +34,6 @@ static int Err_file = -1; static int ElogDebugIndentLevel = 0; extern char OutputFileName[]; -#ifdef WIN32 -extern jmp_buf Warn_restart; -#endif /* * elog -- @@ -160,12 +157,8 @@ elog(int lev, const char *fmt, ... ) extern int InWarn; ProcReleaseSpins(NULL); /* get rid of spinlocks we hold */ if (!InWarn) { -#ifndef WIN32 kill(getpid(), 1); /* abort to traffic cop */ pause(); -#else - longjmp(Warn_restart, 1); -#endif /* WIN32 */ } /* * The pause(3) is just to avoid race conditions where the @@ -227,7 +220,6 @@ DebugFileOpen(void) Err_file = Debugfile = fileno(stderr); return(Debugfile); } -#ifndef WIN32 /* If no filename was specified, send debugging output to stderr. * If stderr has been hosed, try to open a file. */ @@ -237,7 +229,6 @@ DebugFileOpen(void) DataDir, (int)getpid()); fd = open(OutputFileName, O_CREAT|O_APPEND|O_WRONLY, 0666); } -#endif /* WIN32 */ if (fd < 0) elog(FATAL, "DebugFileOpen: could not open debugging file"); diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 76b00525cf..9db2d49a9f 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.5 1997/02/13 09:54:04 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.6 1997/02/14 04:18:02 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -118,11 +118,7 @@ handle_load(char *filename, char *funcname) DynamicFileList *file_scanner = (DynamicFileList *) NULL; func_ptr retval = (func_ptr) NULL; char *load_error; -#ifdef WIN32 - struct _stat stat_buf; -#else struct stat stat_buf; -#endif /* WIN32 */ /* * Do this because loading files may screw up the dynamic function @@ -180,10 +176,8 @@ handle_load(char *filename, char *funcname) memset((char *) file_scanner, 0, sizeof(DynamicFileList)); (void) strcpy(file_scanner->filename, filename); -#ifndef WIN32 file_scanner->device = stat_buf.st_dev; file_scanner->inode = stat_buf.st_ino; -#endif /* WIN32 */ file_scanner->next = (DynamicFileList *) NULL; file_scanner->handle = pg_dlopen(filename); @@ -232,11 +226,7 @@ void load_file(char *filename) { DynamicFileList *file_scanner, *p; -#ifdef WIN32 - struct _stat stat_buf; -#else - struct stat stat_buf; -#endif /* WIN32 */ + struct stat stat_buf; int done = 0; diff --git a/src/backend/utils/init/findbe.c b/src/backend/utils/init/findbe.c index b20e6541e1..b44d58e9f8 100644 --- a/src/backend/utils/init/findbe.c +++ b/src/backend/utils/init/findbe.c @@ -6,16 +6,12 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.2 1996/11/06 10:31:52 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/Attic/findbe.c,v 1.3 1997/02/14 04:18:08 momjian Exp $ * *------------------------------------------------------------------------- */ #include -#ifndef WIN32 #include -#else -#include -#endif /* WIN32 */ #include #include #include @@ -47,7 +43,6 @@ int ValidateBackend(char *path) { -#ifndef WIN32 struct stat buf; uid_t euid; struct group *gp; @@ -56,9 +51,6 @@ ValidateBackend(char *path) int is_r = 0; int is_x = 0; int in_grp = 0; -#else - DWORD file_attributes; -#endif /* WIN32 */ /* * Ensure that the file exists and is a regular file. @@ -73,7 +65,6 @@ ValidateBackend(char *path) return(-1); } -#ifndef WIN32 if (stat(path, &buf) < 0) { if (DebugLvl > 1) fprintf(stderr, "ValidateBackend: can't stat \"%s\"\n", @@ -139,13 +130,6 @@ ValidateBackend(char *path) fprintf(stderr, "ValidateBackend: \"%s\" is not other read/execute\n", path); return(is_x ? (is_r ? 0 : -2) : -1); -#else - file_attributes = GetFileAttributes(path); - if(file_attributes != 0xFFFFFFFF) - return(0); - else - return(-1); -#endif /* WIN32 */ } /* @@ -163,11 +147,6 @@ FindBackend(char *backend, char *argv0) char *path, *startp, *endp; int pathlen; -#ifdef WIN32 - strcpy(backend, argv0); - return(0); -#endif /* WIN32 */ - /* * for the postmaster: * First try: use the backend that's located in the same directory diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index a9639d7a74..f24a8567fa 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.3 1996/11/14 10:24:41 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/miscinit.c,v 1.4 1997/02/14 04:18:17 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -18,10 +18,8 @@ #include #include #include -#ifndef WIN32 #include /* for getgrgid */ #include /* for getpwuid */ -#endif /* WIN32 */ #include "postgres.h" @@ -58,9 +56,7 @@ extern char *DatabasePath; * Define USE_ENVIRONMENT to get PGDATA, etc. from environment variables. * This is the default on UNIX platforms. */ -#ifndef WIN32 #define USE_ENVIRONMENT -#endif /* ---------------------------------------------------------------- * some of the 19 ways to leave postgres @@ -294,15 +290,6 @@ SetPgUserName() UserName = malloc(strlen(p)+1); strcpy(UserName, p); #endif /* NO_SECURITY */ - -#ifdef WIN32 - /* XXX We'll figure out how to get the user name later */ - if (UserName) - free(UserName); - UserName = malloc(strlen(p)+1); - strcpy(UserName, "postgres"); -#endif /* WIN32 */ - } /* ---------------------------------------------------------------- diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index 178d45ff83..9dbfcd6f11 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.7 1997/01/08 08:33:07 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.8 1997/02/14 04:18:20 momjian Exp $ * * NOTES * InitPostgres() is the function called from PostgresMain @@ -135,9 +135,6 @@ InitMyDatabaseId() dbfname = (char *) palloc(strlen(DataDir) + strlen("pg_database") + 2); sprintf(dbfname, "%s%cpg_database", DataDir, SEP_CHAR); fileflags = O_RDONLY; -#ifdef WIN32 - fileflags |= _O_BINARY; -#endif /* WIN32 */ if ((dbfd = open(dbfname, O_RDONLY, 0666)) < 0) elog(FATAL, "Cannot open %s", dbfname); @@ -259,11 +256,7 @@ static void DoChdirAndInitDatabaseNameAndPath(char *name) { char *reason; /* Failure reason returned by some function. NULL if no failure */ -#ifndef WIN32 struct stat statbuf; -#else - struct _stat statbuf; -#endif char errormsg[1000]; if (stat(DataDir, &statbuf) < 0) diff --git a/src/include/c.h b/src/include/c.h index 51851fd408..877603f00d 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: c.h,v 1.8 1997/02/09 04:50:25 scrappy Exp $ + * $Id: c.h,v 1.9 1997/02/14 04:18:27 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -742,19 +742,9 @@ extern char *form(char *fmt, ...); #endif /* These are for things that are one way on Unix and another on NT */ -#ifndef WIN32 #define NULL_DEV "/dev/null" #define COPY_CMD "cp" #define SEP_CHAR '/' -#else -#define NULL_DEV "NUL" -#define COPY_CMD "copy" -#define SEP_CHAR '\\' -#endif /* WIN32 */ - -#if defined(WIN32) -#include "port/win32/nt.h" -#endif /* WIN32 */ /* ---------------- * end of c.h diff --git a/src/include/libpq/libpq-fs.h b/src/include/libpq/libpq-fs.h index a48203858c..4bb37e7149 100644 --- a/src/include/libpq/libpq-fs.h +++ b/src/include/libpq/libpq-fs.h @@ -6,19 +6,13 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: libpq-fs.h,v 1.2 1996/11/06 10:30:02 scrappy Exp $ + * $Id: libpq-fs.h,v 1.3 1997/02/14 04:18:33 momjian Exp $ * *------------------------------------------------------------------------- */ #ifndef LIBPQ_FS_H #define LIBPQ_FS_H - -#ifndef WIN32 -#endif /* WIN32 */ -#ifndef SEEK_SET -#endif /* SEEK_SET */ - /* UNIX compatibility junk. This should be in all systems' include files, but this is not always the case. */ diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h index 74fb018783..011c8efb5b 100644 --- a/src/include/storage/fd.h +++ b/src/include/storage/fd.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: fd.h,v 1.5 1996/11/08 06:02:12 momjian Exp $ + * $Id: fd.h,v 1.6 1997/02/14 04:18:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -43,11 +43,6 @@ /* * FileSeek uses the standard UNIX lseek(2) flags. */ -#ifndef WIN32 -#else -#ifndef SEEK_SET -#endif /* SEEK_SET */ -#endif /* WIN32 */ typedef char *FileName; diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index db713d6524..d920894916 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: proc.h,v 1.3 1996/11/05 06:11:03 scrappy Exp $ + * $Id: proc.h,v 1.4 1997/02/14 04:18:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -15,13 +15,6 @@ #include -#ifndef WIN32 -#else -/* This is because WIN32 already defines PROC */ -#define PROC PGL_PROC -#endif /* WIN32 */ - - typedef struct { int sleeplock; int semNum; diff --git a/src/include/utils/dynamic_loader.h b/src/include/utils/dynamic_loader.h index a2e8fa4027..dd346a85df 100644 --- a/src/include/utils/dynamic_loader.h +++ b/src/include/utils/dynamic_loader.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: dynamic_loader.h,v 1.4 1996/12/28 02:12:51 momjian Exp $ + * $Id: dynamic_loader.h,v 1.5 1997/02/14 04:18:56 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,13 +29,8 @@ typedef struct df_files { char filename[MAXPATHLEN]; /* Full pathname of file */ -#ifdef WIN32 - _dev_t device; /* Device file is on */ - _ino_t inode; /* Inode number of file */ -#else dev_t device; /* Device file is on */ ino_t inode; /* Inode number of file */ -#endif /* WIN32 */ void *handle; /* a handle for pg_dl* functions */ struct df_files *next; } DynamicFileList; diff --git a/src/utils/version.c b/src/utils/version.c index 84fcd34a89..47ef5684f6 100644 --- a/src/utils/version.c +++ b/src/utils/version.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.3 1996/11/26 01:17:56 bryanh Exp $ + * $Header: /cvsroot/pgsql/src/utils/Attic/version.c,v 1.4 1997/02/14 04:19:07 momjian Exp $ * * NOTES * XXX eventually, should be able to handle version identifiers @@ -63,11 +63,8 @@ ValidatePgVersion(const char *path, char **reason_p) { int fd; char version[4]; char full_path[MAXPGPATH+1]; -#ifndef WIN32 struct stat statbuf; -#else - struct _stat statbuf; -#endif + PathSetVersionFilePath(path, full_path); if (stat(full_path, &statbuf) < 0) { -- 2.40.0