mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
* Most changes are to fix warnings issued when compiling win32
* removed a few redundant defines * get_user_name safe under win32 * rationalized pipe read EOF for win32 (UPDATED PATCH USED) * changed all backend instances of sleep() to pg_usleep - except for the SLEEP_ON_ASSERT in assert.c, as it would exceed a 32-bit long [Note to patcher: If a SLEEP_ON_ASSERT of 2000 seconds is acceptable, please replace with pg_usleep(2000000000L)] I added a comment to that part of the code: /* * It would be nice to use pg_usleep() here, but only does 2000 sec * or 33 minutes, which seems too short. */ sleep(1000000); Claudio Natoli
This commit is contained in:
parent
862b20b382
commit
31338352bd
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.138 2004/03/22 04:16:57 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.139 2004/04/19 17:42:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2830,7 +2830,7 @@ StartupXLOG(void)
|
||||
/* This is just to allow attaching to startup process with a debugger */
|
||||
#ifdef XLOG_REPLAY_DELAY
|
||||
if (ControlFile->state != DB_SHUTDOWNED)
|
||||
sleep(60);
|
||||
pg_usleep(60000000L);
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -3360,7 +3360,7 @@ CreateCheckPoint(bool shutdown, bool force)
|
||||
while (!LWLockConditionalAcquire(CheckpointLock, LW_EXCLUSIVE))
|
||||
{
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
sleep(1);
|
||||
pg_usleep(1000000L);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.131 2004/02/10 01:55:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.132 2004/04/19 17:42:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -64,7 +64,9 @@ createdb(const CreatedbStmt *stmt)
|
||||
char *alt_loc;
|
||||
char *target_dir;
|
||||
char src_loc[MAXPGPATH];
|
||||
#ifndef WIN32
|
||||
char buf[2 * MAXPGPATH + 100];
|
||||
#endif
|
||||
Oid src_dboid;
|
||||
AclId src_owner;
|
||||
int src_encoding;
|
||||
|
@ -14,7 +14,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/libpq/md5.c,v 1.23 2004/03/24 03:44:58 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/libpq/md5.c,v 1.24 2004/04/19 17:42:57 momjian Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -33,9 +33,7 @@
|
||||
|
||||
#ifdef FRONTEND
|
||||
#include "postgres_fe.h"
|
||||
#ifndef WIN32
|
||||
#include "libpq/crypt.h"
|
||||
#endif /* WIN32 */
|
||||
#endif /* FRONTEND */
|
||||
|
||||
#ifdef MD5_ODBC
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.76 2004/03/15 16:14:26 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/main/main.c,v 1.77 2004/04/19 17:42:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -50,7 +50,9 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int len;
|
||||
#ifndef WIN32
|
||||
struct passwd *pw;
|
||||
#endif
|
||||
char *pw_name_persist;
|
||||
|
||||
/*
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.32 2004/02/25 19:41:22 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/sysv_shmem.c,v 1.33 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -259,7 +259,7 @@ PGSharedMemoryCreate(uint32 size, bool makePrivate, int port)
|
||||
PGSharedMemoryDetach();
|
||||
UsedShmemSegAddr = origUsedShmemSegAddr;
|
||||
#endif
|
||||
elog(DEBUG3,"Attaching to %x",UsedShmemSegAddr);
|
||||
elog(DEBUG3,"Attaching to %p",UsedShmemSegAddr);
|
||||
hdr = PGSharedMemoryAttach((IpcMemoryKey) UsedShmemSegID, &shmid);
|
||||
if (hdr == NULL)
|
||||
elog(FATAL, "could not attach to proper memory at fixed address: shmget(key=%d, addr=%p) failed: %m",
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/win32/shmem.c,v 1.4 2004/02/12 20:37:34 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/win32/shmem.c,v 1.5 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -22,7 +22,7 @@ static DWORD s_segsize = 0;
|
||||
int
|
||||
shmdt(const void *shmaddr)
|
||||
{
|
||||
if (UnmapViewOfFile(shmaddr))
|
||||
if (UnmapViewOfFile((LPCVOID*)shmaddr))
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.1 2004/02/18 16:25:12 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/win32/timer.c,v 1.2 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -43,9 +43,9 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
|
||||
timerHandle = CreateWaitableTimer(NULL, TRUE, NULL);
|
||||
if (timerHandle == NULL)
|
||||
ereport(FATAL,
|
||||
(errmsg_internal("failed to create waitable timer: %i",GetLastError())));
|
||||
(errmsg_internal("failed to create waitable timer: %i",(int)GetLastError())));
|
||||
}
|
||||
|
||||
|
||||
if (value->it_value.tv_sec == 0 &&
|
||||
value->it_value.tv_usec == 0) {
|
||||
/* Turn timer off */
|
||||
@ -55,11 +55,11 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
|
||||
|
||||
/* Negative time to SetWaitableTimer means relative time */
|
||||
dueTime.QuadPart = -(value->it_value.tv_usec*10 + value->it_value.tv_sec*10000000L);
|
||||
|
||||
|
||||
/* Turn timer on, or change timer */
|
||||
if (!SetWaitableTimer(timerHandle, &dueTime, 0, timer_completion, NULL, FALSE))
|
||||
if (!SetWaitableTimer(timerHandle, &dueTime, 0, timer_completion, NULL, FALSE))
|
||||
ereport(FATAL,
|
||||
(errmsg_internal("failed to set waitable timer: %i",GetLastError())));
|
||||
(errmsg_internal("failed to set waitable timer: %i",(int)GetLastError())));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.66 2004/04/12 16:19:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.67 2004/04/19 17:42:58 momjian Exp $
|
||||
* ----------
|
||||
*/
|
||||
#include "postgres.h"
|
||||
@ -1730,13 +1730,6 @@ pgstat_mainChild(PGSTAT_FORK_ARGS)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
#ifdef WIN32
|
||||
if (WSAGetLastError() == WSAECONNRESET) /* EOF on the pipe! (win32 socket based implementation) */
|
||||
{
|
||||
pipeEOF = true;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
ereport(LOG,
|
||||
(errcode_for_socket_access(),
|
||||
errmsg("could not read from statistics collector pipe: %m")));
|
||||
|
@ -37,7 +37,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.380 2004/04/12 16:19:18 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.381 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
*
|
||||
@ -314,8 +314,6 @@ static unsigned long tmpBackendFileNum = 0;
|
||||
void read_backend_variables(unsigned long id, Port *port);
|
||||
static bool write_backend_variables(Port *port);
|
||||
|
||||
size_t ShmemBackendArraySize(void);
|
||||
void ShmemBackendArrayAllocation(void);
|
||||
static void ShmemBackendArrayAdd(Backend *bn);
|
||||
static void ShmemBackendArrayRemove(pid_t pid);
|
||||
#endif
|
||||
@ -2561,7 +2559,7 @@ BackendRun(Port *port)
|
||||
* PGOPTIONS, but it is not honored until after authentication.)
|
||||
*/
|
||||
if (PreAuthDelay > 0)
|
||||
sleep(PreAuthDelay);
|
||||
pg_usleep(PreAuthDelay*1000000L);
|
||||
|
||||
/* Will exit on failure */
|
||||
BackendInit(port);
|
||||
@ -3455,8 +3453,8 @@ static void ShmemBackendArrayAdd(Backend *bn)
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: [fork/exec] some sort of error */
|
||||
abort();
|
||||
ereport(FATAL,
|
||||
(errmsg_internal("unable to add backend entry")));
|
||||
}
|
||||
|
||||
static void ShmemBackendArrayRemove(pid_t pid)
|
||||
@ -3472,7 +3470,6 @@ static void ShmemBackendArrayRemove(pid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
/* Something stronger than WARNING here? */
|
||||
ereport(WARNING,
|
||||
(errmsg_internal("unable to find backend entry with pid %d",
|
||||
pid)));
|
||||
@ -3565,8 +3562,9 @@ static void win32_AddChild(pid_t pid, HANDLE handle)
|
||||
++win32_numChildren;
|
||||
}
|
||||
else
|
||||
/* FIXME: [fork/exec] some sort of error */
|
||||
abort();
|
||||
ereport(FATAL,
|
||||
(errmsg_internal("unable to add child entry with pid %lu",
|
||||
pid)));
|
||||
}
|
||||
|
||||
static void win32_RemoveChild(pid_t pid)
|
||||
@ -3588,7 +3586,6 @@ static void win32_RemoveChild(pid_t pid)
|
||||
}
|
||||
}
|
||||
|
||||
/* Something stronger than WARNING here? */
|
||||
ereport(WARNING,
|
||||
(errmsg_internal("unable to find child entry with pid %lu",
|
||||
pid)));
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.103 2004/02/11 22:55:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/smgr/md.c,v 1.104 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -607,7 +607,7 @@ mdsync(void)
|
||||
{
|
||||
sync();
|
||||
if (IsUnderPostmaster)
|
||||
sleep(2);
|
||||
pg_usleep(2000000L);
|
||||
sync();
|
||||
return true;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.399 2004/04/11 00:54:44 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.400 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -2456,7 +2456,7 @@ PostgresMain(int argc, char *argv[], const char *username)
|
||||
/*
|
||||
* wait N seconds to allow attach from a debugger
|
||||
*/
|
||||
sleep(atoi(optarg));
|
||||
pg_usleep(atoi(optarg)*1000000L);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/assert.c,v 1.25 2003/11/29 19:52:01 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/error/assert.c,v 1.26 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
* NOTE
|
||||
* This should eventually work with elog()
|
||||
@ -40,7 +40,11 @@ ExceptionalCondition(char *conditionName,
|
||||
}
|
||||
|
||||
#ifdef SLEEP_ON_ASSERT
|
||||
sleep(1000000);
|
||||
/*
|
||||
* It would be nice to use pg_usleep() here, but only does 2000 sec
|
||||
* or 33 minutes, which seems too short.
|
||||
*/
|
||||
sleep(1000000);
|
||||
#endif
|
||||
|
||||
abort();
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.50 2003/12/29 23:54:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.51 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -85,6 +85,7 @@ DynaHashAlloc(Size size)
|
||||
}
|
||||
|
||||
#define MEM_ALLOC DynaHashAlloc
|
||||
#undef MEM_FREE /* already in windows header files */
|
||||
#define MEM_FREE pfree
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.123 2004/02/10 01:55:26 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/init/miscinit.c,v 1.124 2004/04/19 17:42:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -213,11 +213,11 @@ SetDataDir(const char *dir)
|
||||
* generating funny-looking paths to individual files.
|
||||
*/
|
||||
newlen = strlen(new);
|
||||
if (newlen > 1 && new[newlen - 1] == '/'
|
||||
if (newlen > 1 && (new[newlen - 1] == '/'
|
||||
#ifdef WIN32
|
||||
|| new[newlen - 1] == '\\'
|
||||
#endif
|
||||
)
|
||||
))
|
||||
new[newlen - 1] = '\0';
|
||||
|
||||
if (DataDir)
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.34 2004/01/25 03:07:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/common.h,v 1.35 2004/04/19 17:42:58 momjian Exp $
|
||||
*/
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
@ -60,12 +60,6 @@ extern const char *session_username(void);
|
||||
*/
|
||||
extern char parse_char(char **buf);
|
||||
|
||||
/* Used for all Win32 popen/pclose calls */
|
||||
#ifdef WIN32
|
||||
#define popen(x,y) _popen(x,y)
|
||||
#define pclose(x) _pclose(x)
|
||||
#endif
|
||||
|
||||
extern char *expand_tilde(char **filename);
|
||||
|
||||
#endif /* COMMON_H */
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.44 2004/04/19 17:22:31 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/copy.c,v 1.45 2004/04/19 17:42:58 momjian Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "copy.h"
|
||||
@ -26,7 +26,7 @@
|
||||
#include "prompt.h"
|
||||
#include "stringutils.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) && (!defined(__MINGW32__))
|
||||
#define strcasecmp(x,y) stricmp(x,y)
|
||||
#define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
|
||||
#define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.87 2004/03/24 03:10:29 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.88 2004/04/19 17:42:58 momjian Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
|
||||
@ -573,8 +573,8 @@ process_psqlrc(void)
|
||||
char *psqlrc;
|
||||
char *home;
|
||||
|
||||
#ifdef WIN32
|
||||
#define R_OK 0
|
||||
#if defined(WIN32) && (!defined(__MINGW32__))
|
||||
#define R_OK 4
|
||||
#endif
|
||||
|
||||
/* Look for one in the home dir */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.6 2003/11/29 19:52:07 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.7 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -35,10 +35,15 @@ get_user_name(const char *progname)
|
||||
return pw->pw_name;
|
||||
#else
|
||||
static char username[128]; /* remains after function exit */
|
||||
DWORD len = sizeof(username)-1;
|
||||
|
||||
GetUserName(username, sizeof(username)-1);
|
||||
if (!GetUserName(username, &len))
|
||||
{
|
||||
perror(progname);
|
||||
exit(1);
|
||||
}
|
||||
return username;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.24 2004/04/05 03:16:21 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/port.h,v 1.25 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -48,7 +48,7 @@ extern off_t ftello(FILE *stream);
|
||||
#define pipewrite(a,b,c) write(a,b,c)
|
||||
#else
|
||||
extern int pgpipe(int handles[2]);
|
||||
#define piperead(a,b,c) recv(a,b,c,0)
|
||||
extern int piperead(int s, char* buf, int len);
|
||||
#define pipewrite(a,b,c) send(a,b,c,0)
|
||||
#endif
|
||||
|
||||
@ -70,6 +70,11 @@ extern int win32_open(const char*,int,...);
|
||||
#define open(a,b,...) win32_open(a,b,##__VA_ARGS__)
|
||||
#endif
|
||||
|
||||
#ifndef __BORLANDC__
|
||||
#define popen(a,b) _popen(a,b)
|
||||
#define pclose(a) _pclose(a)
|
||||
#endif
|
||||
|
||||
extern int copydir(char *fromdir, char *todir);
|
||||
|
||||
/* Missing rand functions */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.21 2004/04/12 16:19:18 momjian Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/include/port/win32.h,v 1.22 2004/04/19 17:42:59 momjian Exp $ */
|
||||
|
||||
/* undefine and redefine after #include */
|
||||
#undef mkdir
|
||||
@ -6,6 +6,7 @@
|
||||
#undef ERROR
|
||||
#include <windows.h>
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
#undef near
|
||||
|
||||
/* Must be here to avoid conflicting with prototype in windows.h */
|
||||
@ -192,14 +193,6 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
|
||||
*/
|
||||
#define lstat slat
|
||||
|
||||
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
|
||||
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
|
||||
|
||||
#define S_IRUSR _S_IREAD
|
||||
#define S_IWUSR _S_IWRITE
|
||||
#define S_IXUSR _S_IEXEC
|
||||
#define S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
|
||||
|
||||
/*
|
||||
* Supplement to <errno.h>.
|
||||
*/
|
||||
|
@ -11,7 +11,7 @@
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.65 2004/02/25 19:41:23 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/storage/ipc.h,v 1.66 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -32,4 +32,11 @@ extern void on_exit_reset(void);
|
||||
extern void CreateSharedMemoryAndSemaphores(bool makePrivate,
|
||||
int maxBackends,
|
||||
int port);
|
||||
|
||||
#ifdef EXEC_BACKEND
|
||||
/* postmaster.c */
|
||||
extern size_t ShmemBackendArraySize(void);
|
||||
extern void ShmemBackendArrayAllocation(void);
|
||||
#endif
|
||||
|
||||
#endif /* IPC_H */
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
# Copyright (c) 1994, Regents of the University of California
|
||||
#
|
||||
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.100 2004/03/24 03:54:16 momjian Exp $
|
||||
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.101 2004/04/19 17:42:59 momjian Exp $
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
@ -78,4 +78,4 @@ uninstall: uninstall-lib
|
||||
rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h
|
||||
|
||||
clean distclean maintainer-clean: clean-lib
|
||||
rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
|
||||
rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c snprintf.c strerror.c open.c path.c thread.c dllist.c md5.c ip.c encnames.c wchar.c
|
||||
|
@ -10,7 +10,7 @@
|
||||
* didn't really belong there.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.50 2004/01/09 02:02:43 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-print.c,v 1.51 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -183,11 +183,7 @@ PQprint(FILE *fout,
|
||||
- (po->header != 0) * 2 /* row count and newline */
|
||||
)))
|
||||
{
|
||||
#ifdef WIN32
|
||||
fout = _popen(pagerenv, "w");
|
||||
#else
|
||||
fout = popen(pagerenv, "w");
|
||||
#endif
|
||||
if (fout)
|
||||
{
|
||||
usePipe = 1;
|
||||
|
@ -309,14 +309,14 @@ winsock_strerror(int err, char *strerrbuf, size_t buflen)
|
||||
}
|
||||
|
||||
if (!success)
|
||||
sprintf(strerrbuf, "Unknown socket error (0x%08X/%lu)", err, err);
|
||||
sprintf(strerrbuf, "Unknown socket error (0x%08X/%i)", err, err);
|
||||
else
|
||||
{
|
||||
strerrbuf[buflen - 1] = '\0';
|
||||
offs = strlen(strerrbuf);
|
||||
if (offs > (int)buflen - 64)
|
||||
offs = buflen - 64;
|
||||
sprintf(strerrbuf + offs, " (0x%08X/%lu)", err, err);
|
||||
sprintf(strerrbuf + offs, " (0x%08X/%i)", err, err);
|
||||
}
|
||||
return strerrbuf;
|
||||
}
|
||||
|
@ -22,8 +22,6 @@
|
||||
#define write(a,b,c) _write(a,b,c)
|
||||
#endif
|
||||
|
||||
#define popen(a,b) _popen(a,b)
|
||||
#define pclose(a) _pclose(a)
|
||||
#define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d)
|
||||
#define snprintf _snprintf
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/port/open.c,v 1.1 2004/03/24 03:54:16 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/open.c,v 1.2 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -18,7 +18,8 @@
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
int openFlagsToCreateFileFlags(int openFlags)
|
||||
static int
|
||||
openFlagsToCreateFileFlags(int openFlags)
|
||||
{
|
||||
switch (openFlags & (O_CREAT|O_TRUNC|O_EXCL))
|
||||
{
|
||||
|
@ -10,7 +10,7 @@
|
||||
* must be replaced with recv/send.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/pipe.c,v 1.1 2004/01/09 04:58:09 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/port/pipe.c,v 1.2 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -53,3 +53,13 @@ pgpipe(int handles[2])
|
||||
closesocket(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int piperead(int s, char* buf, int len)
|
||||
{
|
||||
int ret = recv(s,buf,len,0);
|
||||
if (ret < 0 && WSAGetLastError() == WSAECONNRESET)
|
||||
/* EOF on the pipe! (win32 socket based implementation) */
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#include "c.h"
|
||||
|
||||
/*
|
||||
* Copyright (c) 1993 Martin Birgmeier
|
||||
@ -38,7 +39,7 @@ unsigned short _rand48_mult[3] = {
|
||||
};
|
||||
unsigned short _rand48_add = RAND48_ADD;
|
||||
|
||||
void
|
||||
static void
|
||||
_dorand48(unsigned short xseed[3])
|
||||
{
|
||||
unsigned long accu;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/port/sprompt.c,v 1.4 2003/11/29 19:52:13 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/port/sprompt.c,v 1.5 2004/04/19 17:42:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -54,8 +54,8 @@ simple_prompt(const char *prompt, int maxlen, bool echo)
|
||||
|
||||
#else
|
||||
#ifdef WIN32
|
||||
HANDLE t;
|
||||
LPDWORD t_orig;
|
||||
HANDLE t = NULL;
|
||||
LPDWORD t_orig = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user