From: Kurt Roeckx <[EMAIL PROTECTED]> To: Kenji Sugita <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Date: Wed, 2 Jul 2003 19:20:11 +0200
;;; What system are you running on, and does it have a getaddrinfo() ;;; or not? Red Hat Linux and Mac OS X 10.2.6. Both nm libc display getaddrinfo as follows: $ nm /lib/libc.so.6 | grep getaddrinfo 0009fe3c T getaddrinfo $ $ nm /usr/lib/libc.dylib | grep getaddrinfo /usr/lib/libc.dylib(getaddrinfo.o): 90037dc0 T _getaddrinfo U _getaddrinfo $ ;;; If I tell getaddrinfo() it should return a SOCK_DGRAM, it can ;;; only mean that getaddrinfo() is broken. What value shuld be passed to a following socket call with addr->ai_socktype? ==== pgstats.c ==== if ((pgStatSock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol)) < 0) { elog(LOG, "PGSTAT: socket() failed: %m"); goto startup_failed; } From: Kurt Roeckx <[EMAIL PROTECTED]> Subject: Re: [HACKERS] PostgreSQL 7.4devel - LOG: PGSTAT: socket() failed: Invalid argument Date: Wed, 2 Jul 2003 20:52:00 +0200 ;;; On Wed, Jul 02, 2003 at 08:35:00PM +0200, Kurt Roeckx wrote: ;;; > On Wed, Jul 02, 2003 at 03:49:19PM +0900, Kenji Sugita wrote: ;;; > > It seems that a value of addr->ai_socktype returned by getaddrinfo in ;;; > > pg_stat.c is not SOCK_DGRAM. ;;; > ;;; > What do you base this on? Red Hat Linux 6.2 base. $ uname -rs Linux 2.2.18-0ph1smp $ For Mac OS X it produces LOG: PGSTAT: socket() failed: Protocol not supported. ;;; > My guess is that it returns an ipv6 address while you do not have ;;; > IPv6 support in the kernel. If that is the case, the attached ;;; > patch should fix it. ;;; > ;;; ;;; Oops typo, fixed in new attachment. I tried it for current build. Index: postmaster/pgstat.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/postmaster/pgstat.c,v retrieving revision 1.37 diff -u -r1.37 pgstat.c --- postmaster/pgstat.c 12 Jun 2003 07:36:51 -0000 1.37 +++ postmaster/pgstat.c 3 Jul 2003 01:19:05 -0000 @@ -179,7 +179,7 @@ /* * Create the UDP socket for sending and receiving statistic messages */ - hints.ai_flags = AI_PASSIVE; + hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = 0; $ And then: $ postmaster (on Red Hat) ... 2003-07-03 10:19:38 [29761] LOG: XX000: PGSTAT: getaddrinfo2() failed: Name or service not known LOCATION: pgstat_init, pgstat.c:193 ... Kenji Sugita ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings