<para>
<screen>
-LOG: could not bind IPv4 socket: Address already in use
+LOG: could not bind IPv4 address "127.0.0.1": Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
-FATAL: could not create TCP/IP listen socket
+FATAL: could not create any TCP/IP sockets
</screen>
This usually means just what it suggests: you tried to start
another server on the same port where one is already running.
on a reserved port number might draw something like:
<screen>
$ <userinput>postgres -p 666</userinput>
-LOG: could not bind IPv4 socket: Permission denied
+LOG: could not bind IPv4 address "127.0.0.1": Permission denied
HINT: Is another postmaster already running on port 666? If not, wait a few seconds and retry.
-FATAL: could not create TCP/IP listen socket
+FATAL: could not create any TCP/IP sockets
</screen>
</para>
char portNumberStr[32];
const char *familyDesc;
char familyDescBuf[64];
+ const char *addrDesc;
+ char addrBuf[NI_MAXHOST];
char *service;
struct addrinfo *addrs = NULL,
*addr;
break;
}
- /* set up family name for possible error messages */
+ /* set up address family name for log messages */
switch (addr->ai_family)
{
case AF_INET:
break;
}
+ /* set up text form of address for log messages */
+#ifdef HAVE_UNIX_SOCKETS
+ if (addr->ai_family == AF_UNIX)
+ addrDesc = unixSocketPath;
+ else
+#endif
+ {
+ pg_getnameinfo_all((const struct sockaddr_storage *) addr->ai_addr,
+ addr->ai_addrlen,
+ addrBuf, sizeof(addrBuf),
+ NULL, 0,
+ NI_NUMERICHOST);
+ addrDesc = addrBuf;
+ }
+
if ((fd = socket(addr->ai_family, SOCK_STREAM, 0)) == PGINVALID_SOCKET)
{
ereport(LOG,
(errcode_for_socket_access(),
- /* translator: %s is IPv4, IPv6, or Unix */
- errmsg("could not create %s socket: %m",
- familyDesc)));
+ /* translator: first %s is IPv4, IPv6, or Unix */
+ errmsg("could not create %s socket for address \"%s\": %m",
+ familyDesc, addrDesc)));
continue;
}
{
ereport(LOG,
(errcode_for_socket_access(),
- errmsg("setsockopt(SO_REUSEADDR) failed: %m")));
+ /* translator: first %s is IPv4, IPv6, or Unix */
+ errmsg("setsockopt(SO_REUSEADDR) failed for %s address \"%s\": %m",
+ familyDesc, addrDesc)));
closesocket(fd);
continue;
}
{
ereport(LOG,
(errcode_for_socket_access(),
- errmsg("setsockopt(IPV6_V6ONLY) failed: %m")));
+ /* translator: first %s is IPv4, IPv6, or Unix */
+ errmsg("setsockopt(IPV6_V6ONLY) failed for %s address \"%s\": %m",
+ familyDesc, addrDesc)));
closesocket(fd);
continue;
}
{
ereport(LOG,
(errcode_for_socket_access(),
- /* translator: %s is IPv4, IPv6, or Unix */
- errmsg("could not bind %s socket: %m",
- familyDesc),
+ /* translator: first %s is IPv4, IPv6, or Unix */
+ errmsg("could not bind %s address \"%s\": %m",
+ familyDesc, addrDesc),
(IS_AF_UNIX(addr->ai_family)) ?
errhint("Is another postmaster already running on port %d?"
" If not, remove socket file \"%s\" and retry.",
{
ereport(LOG,
(errcode_for_socket_access(),
- /* translator: %s is IPv4, IPv6, or Unix */
- errmsg("could not listen on %s socket: %m",
- familyDesc)));
+ /* translator: first %s is IPv4, IPv6, or Unix */
+ errmsg("could not listen on %s address \"%s\": %m",
+ familyDesc, addrDesc)));
closesocket(fd);
continue;
}
+
+ ereport(LOG,
+ /* translator: first %s is IPv4, IPv6, or Unix */
+ (errmsg("listening on %s address \"%s\"",
+ familyDesc, addrDesc)));
+
ListenSocket[listen_index] = fd;
added++;
}