Skip to content

Commit 422d481

Browse files
committed
Corrects issues recently posted by Dann Corbit, allowing libpq/psql to
be built under VC++. Moves a pgstat win32 #def to port.h Claudio Natoli
1 parent 823ac7c commit 422d481

File tree

6 files changed

+32
-19
lines changed

6 files changed

+32
-19
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright (c) 2001-2003, PostgreSQL Global Development Group
1515
*
16-
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.64 2004/03/27 17:59:35 momjian Exp $
16+
* $PostgreSQL: pgsql/src/backend/postmaster/pgstat.c,v 1.65 2004/04/05 03:16:21 momjian Exp $
1717
* ----------
1818
*/
1919
#include "postgres.h"
@@ -143,19 +143,6 @@ static void pgstat_recv_tabpurge(PgStat_MsgTabpurge *msg, int len);
143143
static void pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len);
144144
static void pgstat_recv_resetcounter(PgStat_MsgResetcounter *msg, int len);
145145

146-
/*
147-
* WIN32 doesn't allow descriptors returned by pipe() to be used in select(),
148-
* so for that platform we use socket() instead of pipe().
149-
*/
150-
#ifndef WIN32
151-
#define pgpipe(a) pipe(a)
152-
#define piperead(a,b,c) read(a,b,c)
153-
#define pipewrite(a,b,c) write(a,b,c)
154-
#else
155-
extern int pgpipe(int handles[2]); /* pgpipe() is in /src/port */
156-
#define piperead(a,b,c) recv(a,b,c,0)
157-
#define pipewrite(a,b,c) send(a,b,c,0)
158-
#endif
159146

160147
/* ------------------------------------------------------------
161148
* Public functions called from postmaster follow

src/bin/psql/win32.mak

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ CLEAN :
3232
-@erase "$(INTDIR)\large_obj.obj"
3333
-@erase "$(INTDIR)\print.obj"
3434
-@erase "$(INTDIR)\describe.obj"
35+
-@erase "$(INTDIR)\psqlscan.obj"
3536
-@erase "$(INTDIR)\tab-complete.obj"
3637
-@erase "$(INTDIR)\sprompt.obj"
3738
-@erase "$(INTDIR)\getopt.obj"
@@ -70,6 +71,7 @@ LINK32_OBJS= \
7071
"$(INTDIR)\large_obj.obj" \
7172
"$(INTDIR)\print.obj" \
7273
"$(INTDIR)\describe.obj" \
74+
"$(INTDIR)\psqlscan.obj" \
7375
"$(INTDIR)\tab-complete.obj" \
7476
"$(INTDIR)\sprompt.obj" \
7577
"$(INTDIR)\getopt.obj" \
@@ -115,4 +117,3 @@ LINK32_OBJS= \
115117

116118
sql_help.h: create_help.pl
117119
$(PERL) create_help.pl $(REFDOCDIR) $@
118-

src/include/libpq/libpq-be.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
1212
* Portions Copyright (c) 1994, Regents of the University of California
1313
*
14-
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.43 2004/03/19 02:23:59 tgl Exp $
14+
* $PostgreSQL: pgsql/src/include/libpq/libpq-be.h,v 1.44 2004/04/05 03:16:21 momjian Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
1818
#ifndef LIBPQ_BE_H
1919
#define LIBPQ_BE_H
2020

21+
#ifndef _MSC_VER
2122
#include <sys/time.h>
23+
#endif
2224
#ifdef USE_SSL
2325
#include <openssl/ssl.h>
2426
#include <openssl/err.h>

src/include/port.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.23 2004/03/24 03:54:16 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.24 2004/04/05 03:16:21 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -38,22 +38,37 @@ extern int fseeko(FILE *stream, off_t offset, int whence);
3838
extern off_t ftello(FILE *stream);
3939
#endif
4040

41-
#if defined(WIN32) || defined(__CYGWIN__)
41+
/*
42+
* WIN32 doesn't allow descriptors returned by pipe() to be used in select(),
43+
* so for that platform we use socket() instead of pipe().
44+
*/
45+
#ifndef WIN32
46+
#define pgpipe(a) pipe(a)
47+
#define piperead(a,b,c) read(a,b,c)
48+
#define pipewrite(a,b,c) write(a,b,c)
49+
#else
50+
extern int pgpipe(int handles[2]);
51+
#define piperead(a,b,c) recv(a,b,c,0)
52+
#define pipewrite(a,b,c) send(a,b,c,0)
53+
#endif
54+
55+
#if defined(__MINGW32__) || defined(__CYGWIN__)
4256
/*
4357
* Win32 doesn't have reliable rename/unlink during concurrent access
4458
*/
4559
extern int pgrename(const char *from, const char *to);
4660
extern int pgunlink(const char *path);
47-
4861
#define rename(from, to) pgrename(from, to)
4962
#define unlink(path) pgunlink(path)
5063
#endif
5164

5265
#ifdef WIN32
5366

5467
/* open() replacement to allow delete of held files */
68+
#ifndef _MSC_VER
5569
extern int win32_open(const char*,int,...);
5670
#define open(a,b,...) win32_open(a,b,##__VA_ARGS__)
71+
#endif
5772

5873
extern int copydir(char *fromdir, char *todir);
5974

src/interfaces/libpq/libpqdll.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,4 @@ EXPORTS
113113
PQfformat @ 109
114114
PQexecPrepared @ 110
115115
PQsendQueryPrepared @ 111
116+
PQdsplen @ 112

src/interfaces/libpq/win32.mak

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ CLEAN :
4848
-@erase "$(INTDIR)\thread.obj"
4949
-@erase "$(INTDIR)\inet_aton.obj"
5050
-@erase "$(INTDIR)\crypt.obj"
51+
-@erase "$(INTDIR)\noblock.obj"
5152
-@erase "$(INTDIR)\path.obj"
5253
-@erase "$(INTDIR)\dllist.obj"
5354
-@erase "$(INTDIR)\md5.obj"
@@ -96,6 +97,7 @@ LIB32_OBJS= \
9697
"$(INTDIR)\thread.obj" \
9798
"$(INTDIR)\inet_aton.obj" \
9899
"$(INTDIR)\crypt.obj" \
100+
"$(INTDIR)\noblock.obj" \
99101
"$(INTDIR)\path.obj" \
100102
"$(INTDIR)\dllist.obj" \
101103
"$(INTDIR)\md5.obj" \
@@ -161,6 +163,11 @@ LINK32_OBJS= \
161163
$(CPP_PROJ) ..\..\port\crypt.c
162164
<<
163165

166+
"$(INTDIR)\noblock.obj" : ..\..\port\noblock.c
167+
$(CPP) @<<
168+
$(CPP_PROJ) ..\..\port\noblock.c
169+
<<
170+
164171
"$(INTDIR)\path.obj" : ..\..\port\path.c
165172
$(CPP) @<<
166173
$(CPP_PROJ) ..\..\port\path.c

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy