Skip to content

Commit 591e90a

Browse files
committed
WIN32 fixes:
I take out patch for this as a promise. This is client-build support of MS-VC6+. Fix for different getaddrinfo structure ordering on Win32 for IPv6. Hiroshi Saito
1 parent a7aa0b8 commit 591e90a

File tree

6 files changed

+56
-6
lines changed

6 files changed

+56
-6
lines changed

src/bin/pg_config/win32.mak

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ CLEAN :
4848
CPP_PROJ=/nologo $(OPT) /W3 /GX /D "WIN32" $(DEBUGDEF) /D "_CONSOLE" /D\
4949
"_MBCS" /Fp"$(INTDIR)\pg_config.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
5050
/I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
51-
/D "HAVE_STRDUP" /D "FRONTEND"
51+
/I ..\..\include\port\win32_msvc /D "HAVE_STRDUP" /D "FRONTEND"
5252

5353
CPP_OBJS=$(INTDIR)/
5454
CPP_SBRS=.
@@ -63,6 +63,7 @@ LINK32_OBJS= \
6363
"$(INTDIR)\pgstrcasecmp.obj" \
6464
"$(OUTDIR)\path.obj" \
6565
"$(INTDIR)\exec.obj" \
66+
"$(INTDIR)\snprintf.obj" \
6667
!IFDEF DEBUG
6768
"..\..\interfaces\libpq\Debug\libpqddll.lib"
6869
!ELSE
@@ -89,6 +90,11 @@ LINK32_OBJS= \
8990
$(CPP_PROJ) ..\..\port\exec.c
9091
<<
9192

93+
"$(INTDIR)\snprintf.obj" : ..\..\port\snprintf.c
94+
$(CPP) @<<
95+
$(CPP_PROJ) ..\..\port\snprintf.c
96+
<<
97+
9298
.c{$(CPP_OBJS)}.obj::
9399
$(CPP) @<<
94100
$(CPP_PROJ) $<

src/bin/pg_dump/win32.mak

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ REFDOCDIR= ../../../doc/src/sgml/ref
3030

3131
CPP_PROJ=/nologo $(OPT) /W3 /GX /D "WIN32" $(DEBUGDEF) /D "_CONSOLE" /D\
3232
"_MBCS" /Fp"$(INTDIR)\pg_dump.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c \
33-
/I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 /I ..\..\backend \
33+
/I ..\..\include /I ..\..\interfaces\libpq /I ..\..\include\port\win32 \
34+
/I ..\..\include\port\win32_msvc /I ..\..\backend \
3435
/D "HAVE_STRDUP" /D "FRONTEND"
3536

3637
CPP_OBJS=$(INTDIR)/
@@ -56,6 +57,7 @@ CLEAN :
5657
-@erase "$(INTDIR)\path.obj"
5758
-@erase "$(INTDIR)\pgstrcasecmp.obj"
5859
-@erase "$(INTDIR)\sprompt.obj"
60+
-@erase "$(INTDIR)\snprintf.obj"
5961
-@erase "$(INTDIR)\pg_dump.pch"
6062
-@erase "$(OUTDIR)\pg_dump.obj"
6163
-@erase "$(OUTDIR)\pg_dump.exe"
@@ -92,7 +94,8 @@ LINK32_OBJS= \
9294
"$(INTDIR)\getopt_long.obj" \
9395
"$(INTDIR)\path.obj" \
9496
"$(INTDIR)\pgstrcasecmp.obj" \
95-
"$(INTDIR)\sprompt.obj"
97+
"$(INTDIR)\sprompt.obj" \
98+
"$(INTDIR)\snprintf.obj"
9699

97100
LINK32_OBJS_DMP= \
98101
"$(INTDIR)\common.obj" \
@@ -173,6 +176,11 @@ LINK32_OBJS = $(LINK32_OBJS) "..\..\interfaces\libpq\Release\libpqdll.lib"
173176
$(CPP_PROJ) ..\..\port\sprompt.c
174177
<<
175178

179+
"$(INTDIR)\snprintf.obj" : "$(INTDIR)" ..\..\port\snprintf.c
180+
$(CPP) @<<
181+
$(CPP_PROJ) ..\..\port\snprintf.c
182+
<<
183+
176184
..\..\backend\parser\parse.h : ..\..\backend\parser\gram.y
177185
$(YACC) -y -d ..\..\backend\parser\gram.y
178186
$(MV) ..\..\backend\parser\y.tab.h ..\..\backend\parser\parse.h

src/include/getaddrinfo.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* Copyright (c) 2003-2006, PostgreSQL Global Development Group
1717
*
18-
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.20 2006/06/07 22:24:45 momjian Exp $
18+
* $PostgreSQL: pgsql/src/include/getaddrinfo.h,v 1.21 2006/07/06 02:12:32 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -41,7 +41,9 @@
4141
#define EAI_SYSTEM (-11)
4242
#else /* WIN32 */
4343
#ifdef WIN32_ONLY_COMPILER
44+
#ifndef WSA_NOT_ENOUGH_MEMORY
4445
#define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
46+
#endif
4547
#define WSATYPE_NOT_FOUND (WSABASEERR+109)
4648
#endif
4749
#define EAI_AGAIN WSATRY_AGAIN
@@ -89,6 +91,7 @@
8991

9092
#ifndef HAVE_STRUCT_ADDRINFO
9193

94+
#ifndef WIN32
9295
struct addrinfo
9396
{
9497
int ai_flags;
@@ -100,6 +103,24 @@ struct addrinfo
100103
char *ai_canonname;
101104
struct addrinfo *ai_next;
102105
};
106+
#else
107+
/*
108+
* The order of the structure elements on Win32 doesn't match the
109+
* order specified in the standard, but we have to match it for
110+
* IPv6 to work.
111+
*/
112+
struct addrinfo
113+
{
114+
int ai_flags;
115+
int ai_family;
116+
int ai_socktype;
117+
int ai_protocol;
118+
size_t ai_addrlen;
119+
char *ai_canonname;
120+
struct sockaddr *ai_addr;
121+
struct addrinfo *ai_next;
122+
};
123+
#endif
103124
#endif /* HAVE_STRUCT_ADDRINFO */
104125

105126

src/include/pg_config.h.win32

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,17 @@
247247

248248
/* Define to 1 if constants of type 'long long int' should have the suffix LL.
249249
*/
250+
#if (_MSC_VER > 1200)
250251
#define HAVE_LL_CONSTANTS 1
252+
#endif
251253

252254
/* Define to 1 if `long int' works and is 64 bits. */
253255
/* #undef HAVE_LONG_INT_64 */
254256

255257
/* Define to 1 if `long long int' works and is 64 bits. */
258+
#if (_MSC_VER > 1200)
256259
#define HAVE_LONG_LONG_INT_64
260+
#endif
257261

258262
/* Define to 1 if you have the `memmove' function. */
259263
#define HAVE_MEMMOVE 1
@@ -395,7 +399,9 @@
395399
/* #undef HAVE_STRTOUQ */
396400

397401
/* Define to 1 if the system has the type `struct addrinfo'. */
402+
#if (_MSC_VER > 1200)
398403
#define HAVE_STRUCT_ADDRINFO 1
404+
#endif
399405

400406
/* Define to 1 if the system has the type `struct cmsgcred'. */
401407
/* #undef HAVE_STRUCT_CMSGCRED */
@@ -410,10 +416,14 @@
410416
/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */
411417

412418
/* Define to 1 if the system has the type `struct sockaddr_storage'. */
419+
#if (_MSC_VER > 1200)
413420
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
421+
#endif
414422

415423
/* Define to 1 if `ss_family' is member of `struct sockaddr_storage'. */
424+
#if (_MSC_VER > 1200)
416425
#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1
426+
#endif
417427

418428
/* Define to 1 if `ss_len' is member of `struct sockaddr_storage'. */
419429
/* #undef HAVE_STRUCT_SOCKADDR_STORAGE_SS_LEN */

src/port/thread.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
99
*
10-
* $PostgreSQL: pgsql/src/port/thread.c,v 1.33 2006/06/07 22:24:46 momjian Exp $
10+
* $PostgreSQL: pgsql/src/port/thread.c,v 1.34 2006/07/06 02:12:32 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -16,8 +16,12 @@
1616

1717
#include <pwd.h>
1818
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY)
19+
#ifdef WIN32
20+
#include "pthread-win32.h"
21+
#else
1922
#include <pthread.h>
2023
#endif
24+
#endif
2125

2226

2327
/*

src/win32.mak

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/src/win32.mak,v 1.12 2006/03/03 23:11:48 momjian Exp $
1+
# $PostgreSQL: pgsql/src/win32.mak,v 1.13 2006/07/06 02:12:32 momjian Exp $
22

33
# Makefile for Microsoft Visual C++ 5.0 (or compat)
44
# Top-file makefile for Win32 parts of postgresql.
@@ -13,6 +13,7 @@ NULL=nul
1313
ALL:
1414
cd include
1515
if not exist pg_config.h copy pg_config.h.win32 pg_config.h
16+
if not exist pg_config_os.h copy port\win32.h pg_config_os.h
1617
cd ..
1718
cd interfaces\libpq
1819
nmake /f win32.mak $(MAKEMACRO)

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