Skip to content

Commit 76920de

Browse files
committed
Rename parameter "hostname" to "virtual_host". Seemed very ambiguous...
1 parent 85b762b commit 76920de

File tree

4 files changed

+48
-43
lines changed

4 files changed

+48
-43
lines changed

doc/src/sgml/runtime.sgml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.36 2000/11/14 19:13:26 petere Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/runtime.sgml,v 1.37 2000/11/15 18:36:03 petere Exp $
33
-->
44

55
<Chapter Id="runtime">
@@ -932,33 +932,6 @@ env PGOPTIONS='-c geqo=off' psql
932932
</listitem>
933933
</varlistentry>
934934

935-
<varlistentry>
936-
<term>HOSTNAME (<type>string</type>)</term>
937-
<listitem>
938-
<para>
939-
Specifies the TCP/IP hostname or address on which the
940-
<application>postmaster</application> is to listen for
941-
connections from client applications. Defaults to the value
942-
of the <envar>PGHOST</envar> environment variable, or if
943-
<envar>PGHOST</envar> is not set, it defaults to listening on
944-
all configured addresses (including localhost).
945-
</para>
946-
<para>
947-
If you use a hostname do not try to run multiple instances of
948-
<application>postmaster</application> on the same IP address
949-
but different ports. Doing so will result in them attempting
950-
(incorrectly) to use the same shared memory segments. Also,
951-
if you use a hostname, all of the host's IP addresses on which
952-
<application>postmaster</application> instances are listening
953-
must be distinct in the two last octets.
954-
</para>
955-
<para>
956-
If you do not use this option, then each instance must listen
957-
on a different port.
958-
</para>
959-
</listitem>
960-
</varlistentry>
961-
962935
<varlistentry>
963936
<term>KRB_SERVER_KEYFILE (<type>string</type>)</term>
964937
<listitem>
@@ -1151,6 +1124,33 @@ env PGOPTIONS='-c geqo=off' psql
11511124
</listitem>
11521125
</varlistentry>
11531126

1127+
<varlistentry>
1128+
<term>VIRTUAL_HOST (<type>string</type>)</term>
1129+
<listitem>
1130+
<para>
1131+
Specifies the TCP/IP hostname or address on which the
1132+
<application>postmaster</application> is to listen for
1133+
connections from client applications. Defaults to the value
1134+
of the <envar>PGHOST</envar> environment variable, or if
1135+
<envar>PGHOST</envar> is not set, it defaults to listening on
1136+
all configured addresses (including localhost).
1137+
</para>
1138+
<para>
1139+
If you use a hostname do not try to run multiple instances of
1140+
<application>postmaster</application> on the same IP address
1141+
but different ports. Doing so will result in them attempting
1142+
(incorrectly) to use the same shared memory segments. Also,
1143+
if you use a hostname, all of the host's IP addresses on which
1144+
<application>postmaster</application> instances are listening
1145+
must be distinct in the two last octets.
1146+
</para>
1147+
<para>
1148+
If you do not use this option, then each instance must listen
1149+
on a different port.
1150+
</para>
1151+
</listitem>
1152+
</varlistentry>
1153+
11541154
</variablelist>
11551155
</para>
11561156
</sect2>
@@ -1189,6 +1189,11 @@ env PGOPTIONS='-c geqo=off' psql
11891189
<entry>fsync = off</entry>
11901190
<entry></entry>
11911191
</row>
1192+
<row>
1193+
<entry>-h <replaceable>x</replaceable></entry>
1194+
<entry>virtual_host = <replaceable>x</replaceable></entry>
1195+
<entry></entry>
1196+
</row>
11921197
<row>
11931198
<entry>-i</entry>
11941199
<entry>tcpip_socket = on</entry>

src/backend/postmaster/postmaster.c

Lines changed: 11 additions & 11 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.187 2000/11/14 18:37:42 tgl Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.188 2000/11/15 18:36:04 petere Exp $
1515
*
1616
* NOTES
1717
*
@@ -115,7 +115,7 @@ static Dllist *PortList;
115115
/* The socket number we are listening for connections on */
116116
int PostPortNumber;
117117
char * UnixSocketName;
118-
char * HostName;
118+
char * Virtual_host;
119119

120120
/*
121121
* This is a sequence number that indicates how many times we've had to
@@ -453,7 +453,7 @@ PostmasterMain(int argc, char *argv[])
453453
enableFsync = false;
454454
break;
455455
case 'h':
456-
HostName = optarg;
456+
Virtual_host = optarg;
457457
break;
458458
case 'i':
459459
NetServer = true;
@@ -609,7 +609,7 @@ PostmasterMain(int argc, char *argv[])
609609

610610
if (NetServer)
611611
{
612-
status = StreamServerPort(AF_INET, HostName,
612+
status = StreamServerPort(AF_INET, Virtual_host,
613613
(unsigned short) PostPortNumber, UnixSocketName,
614614
&ServerSock_INET);
615615
if (status != STATUS_OK)
@@ -621,7 +621,7 @@ PostmasterMain(int argc, char *argv[])
621621
}
622622

623623
#ifdef HAVE_UNIX_SOCKETS
624-
status = StreamServerPort(AF_UNIX, HostName,
624+
status = StreamServerPort(AF_UNIX, Virtual_host,
625625
(unsigned short) PostPortNumber, UnixSocketName,
626626
&ServerSock_UNIX);
627627
if (status != STATUS_OK)
@@ -794,7 +794,7 @@ usage(const char *progname)
794794
printf(" -d 1-5 debugging level\n");
795795
printf(" -D DATADIR database directory\n");
796796
printf(" -F turn fsync off\n");
797-
printf(" -h HOSTNAME host name or IP address to listen to\n");
797+
printf(" -h HOSTNAME host name or IP address to listen on\n");
798798
printf(" -i enable TCP/IP connections\n");
799799
printf(" -k FILENAME Unix domain socket location\n");
800800
#ifdef USE_SSL
@@ -1311,7 +1311,7 @@ ConnFree(Port *conn)
13111311

13121312
/*
13131313
* get_host_port -- return a pseudo port number (16 bits)
1314-
* derived from the primary IP address of HostName.
1314+
* derived from the primary IP address of Virtual_host.
13151315
*/
13161316
static unsigned short
13171317
get_host_port(void)
@@ -1323,13 +1323,13 @@ get_host_port(void)
13231323
SockAddr saddr;
13241324
struct hostent *hp;
13251325

1326-
hp = gethostbyname(HostName);
1326+
hp = gethostbyname(Virtual_host);
13271327
if ((hp == NULL) || (hp->h_addrtype != AF_INET))
13281328
{
13291329
char msg[1024];
13301330
snprintf(msg, sizeof(msg),
13311331
"FATAL: get_host_port: gethostbyname(%s) failed\n",
1332-
HostName);
1332+
Virtual_host);
13331333
fputs(msg, stderr);
13341334
pqdebug("%s", msg);
13351335
exit(1);
@@ -1362,7 +1362,7 @@ reset_shared(unsigned short port)
13621362
* the -h option, or set PGHOST, to a value other than the internal
13631363
* default.
13641364
*
1365-
* If HostName is set, then we generate the IPC keys using the
1365+
* If Virtual_host is set, then we generate the IPC keys using the
13661366
* last two octets of the IP address instead of the port number.
13671367
* This algorithm assumes that no one will run multiple PostgreSQL
13681368
* instances on one host using two IP addresses that have the same two
@@ -1376,7 +1376,7 @@ reset_shared(unsigned short port)
13761376
* host.
13771377
*/
13781378

1379-
if (HostName[0] != '\0')
1379+
if (Virtual_host[0] != '\0')
13801380
port = get_host_port();
13811381

13821382
ipc_key = port * 1000 + shmem_seq * 100;

src/backend/utils/misc/guc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Support for grand unified configuration scheme, including SET
55
* command, configuration file, and command line options.
66
*
7-
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.20 2000/11/14 19:13:27 petere Exp $
7+
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.21 2000/11/15 18:36:05 petere Exp $
88
*
99
* Copyright 2000 by PostgreSQL Global Development Group
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
@@ -319,7 +319,7 @@ ConfigureNamesString[] =
319319
{"unixsocket", PGC_POSTMASTER, &UnixSocketName,
320320
"", NULL},
321321

322-
{"hostname", PGC_POSTMASTER, &HostName,
322+
{"virtual_host", PGC_POSTMASTER, &Virtual_host,
323323
"", NULL},
324324

325325
{NULL, 0, NULL, NULL, NULL}

src/include/libpq/pqcomm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Id: pqcomm.h,v 1.44 2000/11/13 15:18:14 momjian Exp $
12+
* $Id: pqcomm.h,v 1.45 2000/11/15 18:36:06 petere Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -180,6 +180,6 @@ extern int Unix_socket_permissions;
180180

181181
extern char * Unix_socket_group;
182182
extern char * UnixSocketName;
183-
extern char * HostName;
183+
extern char * Virtual_host;
184184

185185
#endif /* PQCOMM_H */

0 commit comments

Comments
 (0)