*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
-#ifndef WIN32
#include <unistd.h> /* for ttyname() */
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#else
-#include <winsock.h>
-#endif /* WIN32 */
#if defined(linux)
#ifndef SOMAXCONN
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();
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());
fcntl(fd, F_SETOWN, getpid());
#endif /* hpux */
(void) pqsignal(SIGURG,fptr);
-#endif /* WIN32 */
}
void
pq_unregoob()
{
-#ifndef WIN32
pqsignal(SIGURG,SIG_DFL);
-#endif /* WIN32 */
}
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";
port->mask = 1 << port->sock;
-#ifndef WIN32
/* reset to non-blocking */
fcntl(port->sock, F_SETFL, 1);
-#endif /* WIN32 */
return(STATUS_OK);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
*/
#include <stdio.h>
#include <sys/types.h>
-#ifndef WIN32
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
-#else
-#include <winsock.h>
-#endif /*WIN32 */
#include <fcntl.h>
#include <errno.h>
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include "config.h"
#include <math.h>
-#ifdef WIN32
-# include <float.h>
+#ifdef HAVE_LIMITS_H
# include <limits.h>
-# define MAXINT INT_MAX
+# ifndef MAXINT
+# define MAXINT INT_MAX
+# endif
#else
-# ifdef HAVE_LIMITS_H
-# include <limits.h>
-# ifndef MAXINT
-# define MAXINT INT_MAX
-# endif
-# else
-# ifdef HAVE_VALUES_H
-# include <values.h>
-# endif
-# endif
+# ifdef HAVE_VALUES_H
+# include <values.h>
+# endif
#endif
#include <utils/lsyscache.h>
*
*
* 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 <math.h> /* for MAXFLOAT on most systems */
-#else
-#include <float.h>
-#define MAXFLOAT DBL_MAX
-#endif /* WIN32 */
#include <values.h> /* for MAXFLOAT on SunOS */
#include <string.h>
*
*
* 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 <string.h>
#include <stdio.h>
-#ifndef WIN32
#include <pwd.h>
-#endif /*WIN32 */
#include <sys/param.h> /* for MAXPATHLEN */
#include "postgres.h"
*
*
* 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 <ctype.h>
-#ifndef WIN32
#include <unistd.h>
-#endif /* WIN32 */
#ifndef __linux__
#include <math.h>
#else
*
*
* 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
*
fclose(fp);
-#ifndef WIN32
ValidatePgVersion(DataDir, &reason);
-#else
- reason = NULL;
-#endif /* WIN32 */
if (reason) {
fprintf(stderr,
"Database system in directory %s "
int silentflag = 0;
char hostbuf[MAXHOSTNAMELEN];
bool DataDirOK; /* We have a usable PGDATA value */
-#if defined(WIN32)
- WSADATA WSAData;
-#endif /* WIN32 */
progname = argv[0];
}
-#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",
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();
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);
while((pid = wait3(&statusp, WNOHANG, NULL)) > 0)
CleanupProc(pid, statusp.w_status);
#endif
-#endif /* WIN32 */
}
/*
* collect core dumps from all backends by hand.
* -----------------
*/
-#ifndef WIN32
sig = (SendStop) ? SIGSTOP : SIGUSR1;
if (bp->pid != pid) {
if (DebugLvl)
bp->pid);
(void) kill(bp->pid, sig);
}
-#endif /* WIN32 */
ProcRemove(bp->pid);
prev = DLGetPred(curr);
fprintf(stderr, "-----------------------------------------\n");
}
-#ifndef WIN32
if ((pid = FORK()) == 0) { /* child */
if (DoExec(packet, port->sock))
fprintf(stderr, "%s child[%d]: BackendStartup: execv failed\n",
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",
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';
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 */
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 */
}
/*
* 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:
*
* 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
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);
close(tmpfd);
}
-#ifdef WIN32
- fileFlags |= _O_BINARY;
-#endif /* WIN32 */
vfdP->fd = open(fileName,fileFlags,fileMode);
vfdP->fdstate = 0x0;
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* manual for POWER in any case.
*
*/
-#ifdef WIN32
-#include <windows.h>
-#endif /* WIN32 */
-
#include "postgres.h"
#include "storage/ipc.h"
#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*/
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
* 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 <sys/time.h>
-#ifndef WIN32
#include <unistd.h>
-#endif /* WIN32 */
#include <string.h>
#include <signal.h>
#include <sys/types.h>
* 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);
{
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;i<queue->size;i++)
* 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,
* 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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/* 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);
/* 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;
*
*
* 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
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;
Dlelem *curr;
int status;
-#ifdef WIN32
- WSADATA WSAData;
-#endif /* WIN32 */
-
extern int optind;
extern char *optarg;
extern short DebugLvl;
*/
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
*/
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));
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)
puts("\tInitPostgres()..");
}
-#if WIN32
- _nt_attach();
-#endif /* WIN32 */
-
InitPostgres(DBName);
/* ----------------
* ----------------
*/
-#ifndef WIN32
pqsignal(SIGHUP, handle_warn);
if (sigsetjmp(Warn_restart, 1) != 0) {
-#else
- if (setjmp(Warn_restart) != 0) {
-#endif /* WIN32 */
InWarn = 1;
time(&tim);
*/
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 $");
}
/* ----------------
return 1;
}
-#ifndef WIN32
#ifdef HAVE_RUSAGE
#include "rusagestub.h"
#else /* HAVE_RUSAGE */
PrintBufferUsage(StatFp);
/* DisplayTupleCount(StatFp); */
}
-#else
-void
-ShowUsage()
-{}
-
-void
-ResetUsage()
-{}
-#endif /* WIN32 */
*
*
* 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.
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));
VARSIZE(tm) = len;
strncpy(VARDATA(tm), buf, strlen(buf));
return tm;
-#else
- len = len / len;
- return tm;
-#endif /* WIN32 */
-
}
*
*
* 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 <string.h>
#include <stdio.h>
-#ifndef WIN32
#include <pwd.h>
-#endif /* WIN32 */
#include <sys/param.h>
* should let the shell do expansions (shexpand)
*/
-#ifndef WIN32
str = (char *) palloc(MAXPATHLEN * sizeof(*str));
str[0] = '\0';
if (file[0] == '~') {
}
strcat(str, file+ind);
return(str);
-#else
- return(NULL);
-#endif /* WIN32 */
}
char *
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
static int ElogDebugIndentLevel = 0;
extern char OutputFileName[];
-#ifdef WIN32
-extern jmp_buf Warn_restart;
-#endif
/*
* elog --
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
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.
*/
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");
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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
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);
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;
*
*
* 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 <stdio.h>
-#ifndef WIN32
#include <grp.h>
-#else
-#include <windows.h>
-#endif /* WIN32 */
#include <pwd.h>
#include <string.h>
#include <sys/stat.h>
int
ValidateBackend(char *path)
{
-#ifndef WIN32
struct stat buf;
uid_t euid;
struct group *gp;
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.
return(-1);
}
-#ifndef WIN32
if (stat(path, &buf) < 0) {
if (DebugLvl > 1)
fprintf(stderr, "ValidateBackend: can't stat \"%s\"\n",
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 */
}
/*
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
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include <sys/file.h>
#include <stdio.h>
#include <unistd.h>
-#ifndef WIN32
#include <grp.h> /* for getgrgid */
#include <pwd.h> /* for getpwuid */
-#endif /* WIN32 */
#include "postgres.h"
* 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
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 */
-
}
/* ----------------------------------------------------------------
*
*
* 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
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);
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)
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#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
*
* 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. */
*
* 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 $
*
*-------------------------------------------------------------------------
*/
/*
* FileSeek uses the standard UNIX lseek(2) flags.
*/
-#ifndef WIN32
-#else
-#ifndef SEEK_SET
-#endif /* SEEK_SET */
-#endif /* WIN32 */
typedef char *FileName;
*
* 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 $
*
*-------------------------------------------------------------------------
*/
#include <storage/lock.h>
-#ifndef WIN32
-#else
-/* This is because WIN32 already defines PROC */
-#define PROC PGL_PROC
-#endif /* WIN32 */
-
-
typedef struct {
int sleeplock;
int semNum;
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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;
*
*
* 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
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) {