Skip to content

Commit 9b3d66e

Browse files
committed
Introduce HAVE_UNIX_SOCKETS symbol to replace repeatedly listing all the
unsupported platforms.
1 parent 4b8f1bc commit 9b3d66e

File tree

4 files changed

+28
-21
lines changed

4 files changed

+28
-21
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.159 2000/08/07 00:51:30 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.160 2000/08/20 10:55:33 petere Exp $
1515
*
1616
* NOTES
1717
*
@@ -169,14 +169,12 @@ static volatile bool got_SIGHUP = false;
169169
*/
170170
static int ServerSock_INET = INVALID_SOCK; /* stream socket server */
171171

172-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
172+
#ifdef HAVE_UNIX_SOCKETS
173173
static int ServerSock_UNIX = INVALID_SOCK; /* stream socket server */
174-
175174
#endif
176175

177176
#ifdef USE_SSL
178177
static SSL_CTX *SSL_context = NULL; /* Global SSL context */
179-
180178
#endif
181179

182180
/*
@@ -589,7 +587,7 @@ PostmasterMain(int argc, char *argv[])
589587
}
590588
}
591589

592-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
590+
#ifdef HAVE_UNIX_SOCKETS
593591
status = StreamServerPort(AF_UNIX, (unsigned short)PostPortName, &ServerSock_UNIX);
594592
if (status != STATUS_OK)
595593
{
@@ -856,7 +854,7 @@ ServerLoop(void)
856854

857855
/* new connection pending on our well-known port's socket */
858856

859-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
857+
#ifdef HAVE_UNIX_SOCKETS
860858
if (ServerSock_UNIX != INVALID_SOCK &&
861859
FD_ISSET(ServerSock_UNIX, &rmask) &&
862860
(port = ConnCreate(ServerSock_UNIX)) != NULL)
@@ -1015,7 +1013,7 @@ initMasks(fd_set *rmask, fd_set *wmask)
10151013
FD_ZERO(rmask);
10161014
FD_ZERO(wmask);
10171015

1018-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
1016+
#ifdef HAVE_UNIX_SOCKETS
10191017
if (ServerSock_UNIX != INVALID_SOCK)
10201018
{
10211019
FD_SET(ServerSock_UNIX, rmask);
@@ -1832,7 +1830,7 @@ DoBackend(Port *port)
18321830
if (NetServer)
18331831
StreamClose(ServerSock_INET);
18341832
ServerSock_INET = INVALID_SOCK;
1835-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
1833+
#ifdef HAVE_UNIX_SOCKETS
18361834
StreamClose(ServerSock_UNIX);
18371835
ServerSock_UNIX = INVALID_SOCK;
18381836
#endif
@@ -1962,7 +1960,7 @@ ExitPostmaster(int status)
19621960
if (ServerSock_INET != INVALID_SOCK)
19631961
StreamClose(ServerSock_INET);
19641962
ServerSock_INET = INVALID_SOCK;
1965-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
1963+
#ifdef HAVE_UNIX_SOCKETS
19661964
if (ServerSock_UNIX != INVALID_SOCK)
19671965
StreamClose(ServerSock_UNIX);
19681966
ServerSock_UNIX = INVALID_SOCK;
@@ -2134,7 +2132,7 @@ SSDataBase(bool startup)
21342132
if (NetServer)
21352133
StreamClose(ServerSock_INET);
21362134
ServerSock_INET = INVALID_SOCK;
2137-
#if !defined(__CYGWIN32__) && !defined(__QNX__)
2135+
#ifdef HAVE_UNIX_SOCKETS
21382136
StreamClose(ServerSock_UNIX);
21392137
ServerSock_UNIX = INVALID_SOCK;
21402138
#endif

src/bin/psql/prompt.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.12 2000/04/12 17:16:23 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.13 2000/08/20 10:55:34 petere Exp $
77
*/
88
#include "postgres.h"
99
#include "prompt.h"
@@ -19,9 +19,9 @@
1919
#include <win32.h>
2020
#endif
2121

22-
#if !defined(WIN32) && !defined(__CYGWIN32__) && !defined(__QNX__)
23-
#include <unistd.h>
24-
#include <netdb.h>
22+
#ifdef HAVE_UNIX_SOCKETS
23+
# include <unistd.h>
24+
# include <netdb.h>
2525
#endif
2626

2727
/*--------------------------
@@ -64,7 +64,7 @@
6464
/*
6565
* We need hostname information, only if connection is via UNIX socket
6666
*/
67-
#if !defined(WIN32) && !defined(__CYGWIN32__) && !defined(__QNX__)
67+
#ifdef HAVE_UNIX_SOCKETS
6868

6969
#define DOMAINNAME 1
7070
#define HOSTNAME 2
@@ -104,7 +104,8 @@ localhost(int type, char *buf, int siz)
104104
return buf;
105105
}
106106

107-
#endif
107+
#endif /* HAVE_UNIX_SOCKETS */
108+
108109

109110
char *
110111
get_prompt(promptStatus_t status)
@@ -173,15 +174,15 @@ get_prompt(promptStatus_t status)
173174
buf[strcspn(buf, ".")] = '\0';
174175
}
175176
/* UNIX socket */
176-
#if !defined(WIN32) && !defined(__CYGWIN32__) && !defined(__QNX__)
177+
#ifdef HAVE_UNIX_SOCKETS
177178
else
178179
{
179180
if (*p == 'm')
180181
localhost(HOSTNAME, buf, MAX_PROMPT_SIZE);
181182
else
182183
localhost(DOMAINNAME, buf, MAX_PROMPT_SIZE);
183184
}
184-
#endif
185+
#endif /* HAVE_UNIX_SOCKETS */
185186
}
186187
break;
187188
/* DB server port number */

src/include/config.h.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* or in config.h afterwards. Of course, if you edit config.h, then your
99
* changes will be overwritten the next time you run configure.
1010
*
11-
* $Id: config.h.in,v 1.130 2000/08/07 20:15:44 tgl Exp $
11+
* $Id: config.h.in,v 1.131 2000/08/20 10:55:34 petere Exp $
1212
*/
1313

1414
#ifndef CONFIG_H
@@ -223,6 +223,14 @@
223223
*/
224224
#define BITSPERBYTE 8
225225

226+
/*
227+
* Define this is your operating system kernel supports AF_UNIX family
228+
* sockets.
229+
*/
230+
#if !defined(__CYGWIN32__) && !defined(__QNX__)
231+
# define HAVE_UNIX_SOCKETS 1
232+
#endif
233+
226234
/*
227235
*------------------------------------------------------------------------
228236
* These hand-configurable symbols are for enabling debugging code,

src/interfaces/libpq/fe-connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.131 2000/07/09 13:14:17 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.132 2000/08/20 10:55:35 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -738,7 +738,7 @@ connectDBStart(PGconn *conn)
738738
conn->raddr.in.sin_port = htons((unsigned short) (portno));
739739
conn->raddr_len = sizeof(struct sockaddr_in);
740740
}
741-
#if !defined(WIN32) && !defined(__CYGWIN32__)
741+
#ifdef HAVE_UNIX_SOCKETS
742742
else
743743
conn->raddr_len = UNIXSOCK_PATH(conn->raddr.un, portno);
744744
#endif

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