Replace use of the long-deprecated Bonjour API DNSServiceRegistrationCreate
with the not-so-deprecated DNSServiceRegister. This patch shouldn't change any user-visible behavior, it just gets rid of a deprecation warning in --with-bonjour builds. The new code will fail on OS X releases before 10.3, but it seems unlikely that anyone will want to run Postgres 8.5 on 10.2.
This commit is contained in:
parent
4d3456e85d
commit
59b9f3d36d
74
configure
vendored
74
configure
vendored
@ -13439,18 +13439,18 @@ done
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$with_bonjour" = yes ; then
|
if test "$with_bonjour" = yes ; then
|
||||||
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
|
if test "${ac_cv_header_dns_sd_h+set}" = set; then
|
||||||
{ $as_echo "$as_me:$LINENO: checking for DNSServiceDiscovery/DNSServiceDiscovery.h" >&5
|
{ $as_echo "$as_me:$LINENO: checking for dns_sd.h" >&5
|
||||||
$as_echo_n "checking for DNSServiceDiscovery/DNSServiceDiscovery.h... " >&6; }
|
$as_echo_n "checking for dns_sd.h... " >&6; }
|
||||||
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
|
if test "${ac_cv_header_dns_sd_h+set}" = set; then
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5
|
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_dns_sd_h" >&5
|
||||||
$as_echo "$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6; }
|
$as_echo "$ac_cv_header_dns_sd_h" >&6; }
|
||||||
else
|
else
|
||||||
# Is the header compilable?
|
# Is the header compilable?
|
||||||
{ $as_echo "$as_me:$LINENO: checking DNSServiceDiscovery/DNSServiceDiscovery.h usability" >&5
|
{ $as_echo "$as_me:$LINENO: checking dns_sd.h usability" >&5
|
||||||
$as_echo_n "checking DNSServiceDiscovery/DNSServiceDiscovery.h usability... " >&6; }
|
$as_echo_n "checking dns_sd.h usability... " >&6; }
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
/* confdefs.h. */
|
/* confdefs.h. */
|
||||||
_ACEOF
|
_ACEOF
|
||||||
@ -13458,7 +13458,7 @@ cat confdefs.h >>conftest.$ac_ext
|
|||||||
cat >>conftest.$ac_ext <<_ACEOF
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
$ac_includes_default
|
$ac_includes_default
|
||||||
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
|
#include <dns_sd.h>
|
||||||
_ACEOF
|
_ACEOF
|
||||||
rm -f conftest.$ac_objext
|
rm -f conftest.$ac_objext
|
||||||
if { (ac_try="$ac_compile"
|
if { (ac_try="$ac_compile"
|
||||||
@ -13491,15 +13491,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|||||||
$as_echo "$ac_header_compiler" >&6; }
|
$as_echo "$ac_header_compiler" >&6; }
|
||||||
|
|
||||||
# Is the header present?
|
# Is the header present?
|
||||||
{ $as_echo "$as_me:$LINENO: checking DNSServiceDiscovery/DNSServiceDiscovery.h presence" >&5
|
{ $as_echo "$as_me:$LINENO: checking dns_sd.h presence" >&5
|
||||||
$as_echo_n "checking DNSServiceDiscovery/DNSServiceDiscovery.h presence... " >&6; }
|
$as_echo_n "checking dns_sd.h presence... " >&6; }
|
||||||
cat >conftest.$ac_ext <<_ACEOF
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
/* confdefs.h. */
|
/* confdefs.h. */
|
||||||
_ACEOF
|
_ACEOF
|
||||||
cat confdefs.h >>conftest.$ac_ext
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
cat >>conftest.$ac_ext <<_ACEOF
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
/* end confdefs.h. */
|
/* end confdefs.h. */
|
||||||
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
|
#include <dns_sd.h>
|
||||||
_ACEOF
|
_ACEOF
|
||||||
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
if { (ac_try="$ac_cpp conftest.$ac_ext"
|
||||||
case "(($ac_try" in
|
case "(($ac_try" in
|
||||||
@ -13533,25 +13533,25 @@ $as_echo "$ac_header_preproc" >&6; }
|
|||||||
# So? What about this header?
|
# So? What about this header?
|
||||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
|
||||||
yes:no: )
|
yes:no: )
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the compiler's result" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: proceeding with the compiler's result" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the compiler's result" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: proceeding with the compiler's result" >&2;}
|
||||||
ac_header_preproc=yes
|
ac_header_preproc=yes
|
||||||
;;
|
;;
|
||||||
no:yes:* )
|
no:yes:* )
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: present but cannot be compiled" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: present but cannot be compiled" >&2;}
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: check for missing prerequisite headers?" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: check for missing prerequisite headers?" >&2;}
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: see the Autoconf documentation" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: see the Autoconf documentation" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: see the Autoconf documentation" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: see the Autoconf documentation" >&2;}
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: section \"Present But Cannot Be Compiled\"" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: section \"Present But Cannot Be Compiled\"" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: section \"Present But Cannot Be Compiled\"" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: proceeding with the preprocessor's result" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: proceeding with the preprocessor's result" >&2;}
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: in the future, the compiler will take precedence" >&5
|
{ $as_echo "$as_me:$LINENO: WARNING: dns_sd.h: in the future, the compiler will take precedence" >&5
|
||||||
$as_echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: in the future, the compiler will take precedence" >&2;}
|
$as_echo "$as_me: WARNING: dns_sd.h: in the future, the compiler will take precedence" >&2;}
|
||||||
( cat <<\_ASBOX
|
( cat <<\_ASBOX
|
||||||
## ---------------------------------------- ##
|
## ---------------------------------------- ##
|
||||||
## Report this to pgsql-bugs@postgresql.org ##
|
## Report this to pgsql-bugs@postgresql.org ##
|
||||||
@ -13560,22 +13560,22 @@ _ASBOX
|
|||||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
{ $as_echo "$as_me:$LINENO: checking for DNSServiceDiscovery/DNSServiceDiscovery.h" >&5
|
{ $as_echo "$as_me:$LINENO: checking for dns_sd.h" >&5
|
||||||
$as_echo_n "checking for DNSServiceDiscovery/DNSServiceDiscovery.h... " >&6; }
|
$as_echo_n "checking for dns_sd.h... " >&6; }
|
||||||
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
|
if test "${ac_cv_header_dns_sd_h+set}" = set; then
|
||||||
$as_echo_n "(cached) " >&6
|
$as_echo_n "(cached) " >&6
|
||||||
else
|
else
|
||||||
ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h=$ac_header_preproc
|
ac_cv_header_dns_sd_h=$ac_header_preproc
|
||||||
fi
|
fi
|
||||||
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5
|
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_dns_sd_h" >&5
|
||||||
$as_echo "$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6; }
|
$as_echo "$ac_cv_header_dns_sd_h" >&6; }
|
||||||
|
|
||||||
fi
|
fi
|
||||||
if test "x$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" = x""yes; then
|
if test "x$ac_cv_header_dns_sd_h" = x""yes; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
{ { $as_echo "$as_me:$LINENO: error: header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour" >&5
|
{ { $as_echo "$as_me:$LINENO: error: header file <dns_sd.h> is required for Bonjour" >&5
|
||||||
$as_echo "$as_me: error: header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour" >&2;}
|
$as_echo "$as_me: error: header file <dns_sd.h> is required for Bonjour" >&2;}
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl $PostgreSQL: pgsql/configure.in,v 1.609 2009/08/26 22:24:42 petere Exp $
|
dnl $PostgreSQL: pgsql/configure.in,v 1.610 2009/09/08 16:08:26 tgl Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -1066,7 +1066,7 @@ if test "$with_ldap" = yes ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$with_bonjour" = yes ; then
|
if test "$with_bonjour" = yes ; then
|
||||||
AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour])])
|
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# for contrib/uuid-ossp
|
# for contrib/uuid-ossp
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.594 2009/08/31 19:41:00 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.595 2009/09/08 16:08:26 tgl Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
*
|
*
|
||||||
@ -89,7 +89,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_BONJOUR
|
#ifdef USE_BONJOUR
|
||||||
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
|
#include <dns_sd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "access/transam.h"
|
#include "access/transam.h"
|
||||||
@ -309,16 +309,15 @@ extern int optind,
|
|||||||
extern int optreset; /* might not be declared by system headers */
|
extern int optreset; /* might not be declared by system headers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_BONJOUR
|
||||||
|
static DNSServiceRef bonjour_sdref = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* postmaster.c - function prototypes
|
* postmaster.c - function prototypes
|
||||||
*/
|
*/
|
||||||
static void getInstallationPaths(const char *argv0);
|
static void getInstallationPaths(const char *argv0);
|
||||||
static void checkDataDir(void);
|
static void checkDataDir(void);
|
||||||
|
|
||||||
#ifdef USE_BONJOUR
|
|
||||||
static void reg_reply(DNSServiceRegistrationReplyErrorType errorCode,
|
|
||||||
void *context);
|
|
||||||
#endif
|
|
||||||
static void pmdaemonize(void);
|
static void pmdaemonize(void);
|
||||||
static Port *ConnCreate(int serverFd);
|
static Port *ConnCreate(int serverFd);
|
||||||
static void ConnFree(Port *port);
|
static void ConnFree(Port *port);
|
||||||
@ -855,15 +854,38 @@ PostmasterMain(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef USE_BONJOUR
|
#ifdef USE_BONJOUR
|
||||||
/* Register for Bonjour only if we opened TCP socket(s) */
|
/* Register for Bonjour only if we opened TCP socket(s) */
|
||||||
if (ListenSocket[0] != -1 && bonjour_name != NULL)
|
if (ListenSocket[0] != -1)
|
||||||
{
|
{
|
||||||
DNSServiceRegistrationCreate(bonjour_name,
|
DNSServiceErrorType err;
|
||||||
"_postgresql._tcp.",
|
|
||||||
"",
|
/*
|
||||||
htons(PostPortNumber),
|
* We pass 0 for interface_index, which will result in registering on
|
||||||
"",
|
* all "applicable" interfaces. It's not entirely clear from the
|
||||||
(DNSServiceRegistrationReply) reg_reply,
|
* DNS-SD docs whether this would be appropriate if we have bound to
|
||||||
NULL);
|
* just a subset of the available network interfaces.
|
||||||
|
*/
|
||||||
|
err = DNSServiceRegister(&bonjour_sdref,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
bonjour_name,
|
||||||
|
"_postgresql._tcp.",
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
htons(PostPortNumber),
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL);
|
||||||
|
if (err != kDNSServiceErr_NoError)
|
||||||
|
elog(LOG, "DNSServiceRegister() failed: error code %ld",
|
||||||
|
(long) err);
|
||||||
|
/*
|
||||||
|
* We don't bother to read the mDNS daemon's reply, and we expect
|
||||||
|
* that it will automatically terminate our registration when the
|
||||||
|
* socket is closed at postmaster termination. So there's nothing
|
||||||
|
* more to be done here. However, the bonjour_sdref is kept around
|
||||||
|
* so that forked children can close their copies of the socket.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1192,18 +1214,6 @@ checkDataDir(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_BONJOUR
|
|
||||||
|
|
||||||
/*
|
|
||||||
* empty callback function for DNSServiceRegistrationCreate()
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
reg_reply(DNSServiceRegistrationReplyErrorType errorCode, void *context)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif /* USE_BONJOUR */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fork away from the controlling terminal (silent_mode option)
|
* Fork away from the controlling terminal (silent_mode option)
|
||||||
*
|
*
|
||||||
@ -2004,6 +2014,12 @@ ClosePostmasterPorts(bool am_syslogger)
|
|||||||
syslogPipe[0] = 0;
|
syslogPipe[0] = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_BONJOUR
|
||||||
|
/* If using Bonjour, close the connection to the mDNS daemon */
|
||||||
|
if (bonjour_sdref)
|
||||||
|
close(DNSServiceRefSockFD(bonjour_sdref));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user