Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59b9f3d

Browse files
committed
Replace use of the long-deprecated Bonjour API DNSServiceRegistrationCreate
with the not-so-deprecated DNSServiceRegister. This patch shouldn't changeany 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.
1 parent4d3456e commit59b9f3d

File tree

3 files changed

+82
-66
lines changed

3 files changed

+82
-66
lines changed

‎configure

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -13439,26 +13439,26 @@ done
1343913439
fi
1344013440

1344113441
if test "$with_bonjour" = yes ; then
13442-
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
13443-
{ $as_echo "$as_me:$LINENO: checking forDNSServiceDiscovery/DNSServiceDiscovery.h" >&5
13444-
$as_echo_n "checking forDNSServiceDiscovery/DNSServiceDiscovery.h... " >&6; }
13445-
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
13442+
if test "${ac_cv_header_dns_sd_h+set}" = set; then
13443+
{ $as_echo "$as_me:$LINENO: checking fordns_sd.h" >&5
13444+
$as_echo_n "checking fordns_sd.h... " >&6; }
13445+
if test "${ac_cv_header_dns_sd_h+set}" = set; then
1344613446
$as_echo_n "(cached) " >&6
1344713447
fi
13448-
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5
13449-
$as_echo "$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6; }
13448+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_dns_sd_h" >&5
13449+
$as_echo "$ac_cv_header_dns_sd_h" >&6; }
1345013450
else
1345113451
# Is the header compilable?
13452-
{ $as_echo "$as_me:$LINENO: checkingDNSServiceDiscovery/DNSServiceDiscovery.h usability" >&5
13453-
$as_echo_n "checkingDNSServiceDiscovery/DNSServiceDiscovery.h usability... " >&6; }
13452+
{ $as_echo "$as_me:$LINENO: checkingdns_sd.h usability" >&5
13453+
$as_echo_n "checkingdns_sd.h usability... " >&6; }
1345413454
cat >conftest.$ac_ext <<_ACEOF
1345513455
/* confdefs.h. */
1345613456
_ACEOF
1345713457
cat confdefs.h >>conftest.$ac_ext
1345813458
cat >>conftest.$ac_ext <<_ACEOF
1345913459
/* end confdefs.h. */
1346013460
$ac_includes_default
13461-
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
13461+
#include <dns_sd.h>
1346213462
_ACEOF
1346313463
rm -f conftest.$ac_objext
1346413464
if { (ac_try="$ac_compile"
@@ -13491,15 +13491,15 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
1349113491
$as_echo "$ac_header_compiler" >&6; }
1349213492

1349313493
# Is the header present?
13494-
{ $as_echo "$as_me:$LINENO: checkingDNSServiceDiscovery/DNSServiceDiscovery.h presence" >&5
13495-
$as_echo_n "checkingDNSServiceDiscovery/DNSServiceDiscovery.h presence... " >&6; }
13494+
{ $as_echo "$as_me:$LINENO: checkingdns_sd.h presence" >&5
13495+
$as_echo_n "checkingdns_sd.h presence... " >&6; }
1349613496
cat >conftest.$ac_ext <<_ACEOF
1349713497
/* confdefs.h. */
1349813498
_ACEOF
1349913499
cat confdefs.h >>conftest.$ac_ext
1350013500
cat >>conftest.$ac_ext <<_ACEOF
1350113501
/* end confdefs.h. */
13502-
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
13502+
#include <dns_sd.h>
1350313503
_ACEOF
1350413504
if { (ac_try="$ac_cpp conftest.$ac_ext"
1350513505
case "(($ac_try" in
@@ -13533,25 +13533,25 @@ $as_echo "$ac_header_preproc" >&6; }
1353313533
# So? What about this header?
1353413534
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
1353513535
yes:no: )
13536-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&5
13537-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
13538-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the compiler's result" >&5
13539-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the compiler's result" >&2;}
13536+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: accepted by the compiler, rejected by the preprocessor!" >&5
13537+
$as_echo "$as_me: WARNING:dns_sd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
13538+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: proceeding with the compiler's result" >&5
13539+
$as_echo "$as_me: WARNING:dns_sd.h: proceeding with the compiler's result" >&2;}
1354013540
ac_header_preproc=yes
1354113541
;;
1354213542
no:yes:* )
13543-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&5
13544-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&2;}
13545-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&5
13546-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&2;}
13547-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: see the Autoconf documentation" >&5
13548-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: see the Autoconf documentation" >&2;}
13549-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: section \"Present But Cannot Be Compiled\"" >&5
13550-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: section \"Present But Cannot Be Compiled\"" >&2;}
13551-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&5
13552-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&2;}
13553-
{ $as_echo "$as_me:$LINENO: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: in the future, the compiler will take precedence" >&5
13554-
$as_echo "$as_me: WARNING:DNSServiceDiscovery/DNSServiceDiscovery.h: in the future, the compiler will take precedence" >&2;}
13543+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: present but cannot be compiled" >&5
13544+
$as_echo "$as_me: WARNING:dns_sd.h: present but cannot be compiled" >&2;}
13545+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: check for missing prerequisite headers?" >&5
13546+
$as_echo "$as_me: WARNING:dns_sd.h: check for missing prerequisite headers?" >&2;}
13547+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: see the Autoconf documentation" >&5
13548+
$as_echo "$as_me: WARNING:dns_sd.h: see the Autoconf documentation" >&2;}
13549+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: section \"Present But Cannot Be Compiled\"" >&5
13550+
$as_echo "$as_me: WARNING:dns_sd.h: section \"Present But Cannot Be Compiled\"" >&2;}
13551+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: proceeding with the preprocessor's result" >&5
13552+
$as_echo "$as_me: WARNING:dns_sd.h: proceeding with the preprocessor's result" >&2;}
13553+
{ $as_echo "$as_me:$LINENO: WARNING:dns_sd.h: in the future, the compiler will take precedence" >&5
13554+
$as_echo "$as_me: WARNING:dns_sd.h: in the future, the compiler will take precedence" >&2;}
1355513555
( cat <<\_ASBOX
1355613556
## ---------------------------------------- ##
1355713557
## Report this to pgsql-bugs@postgresql.org ##
@@ -13560,22 +13560,22 @@ _ASBOX
1356013560
) | sed "s/^/$as_me: WARNING: /" >&2
1356113561
;;
1356213562
esac
13563-
{ $as_echo "$as_me:$LINENO: checking forDNSServiceDiscovery/DNSServiceDiscovery.h" >&5
13564-
$as_echo_n "checking forDNSServiceDiscovery/DNSServiceDiscovery.h... " >&6; }
13565-
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
13563+
{ $as_echo "$as_me:$LINENO: checking fordns_sd.h" >&5
13564+
$as_echo_n "checking fordns_sd.h... " >&6; }
13565+
if test "${ac_cv_header_dns_sd_h+set}" = set; then
1356613566
$as_echo_n "(cached) " >&6
1356713567
else
13568-
ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h=$ac_header_preproc
13568+
ac_cv_header_dns_sd_h=$ac_header_preproc
1356913569
fi
13570-
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5
13571-
$as_echo "$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6; }
13570+
{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_dns_sd_h" >&5
13571+
$as_echo "$ac_cv_header_dns_sd_h" >&6; }
1357213572

1357313573
fi
13574-
if test "x$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" = x""yes; then
13574+
if test "x$ac_cv_header_dns_sd_h" = x""yes; then
1357513575
:
1357613576
else
13577-
{ { $as_echo "$as_me:$LINENO: error: header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour" >&5
13578-
$as_echo "$as_me: error: header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour" >&2;}
13577+
{ { $as_echo "$as_me:$LINENO: error: header file <dns_sd.h> is required for Bonjour" >&5
13578+
$as_echo "$as_me: error: header file <dns_sd.h> is required for Bonjour" >&2;}
1357913579
{ (exit 1); exit 1; }; }
1358013580
fi
1358113581

‎configure.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.609 2009/08/26 22:24:42 petere Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.610 2009/09/08 16:08:26 tgl Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1066,7 +1066,7 @@ if test "$with_ldap" = yes ; then
10661066
fi
10671067

10681068
if test "$with_bonjour" = yes ; then
1069-
AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour])])
1069+
AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
10701070
fi
10711071

10721072
# for contrib/uuid-ossp

‎src/backend/postmaster/postmaster.c

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.594 2009/08/31 19:41:00 tgl Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.595 2009/09/08 16:08:26 tgl Exp $
4141
*
4242
* NOTES
4343
*
@@ -89,7 +89,7 @@
8989
#endif
9090

9191
#ifdefUSE_BONJOUR
92-
#include<DNSServiceDiscovery/DNSServiceDiscovery.h>
92+
#include<dns_sd.h>
9393
#endif
9494

9595
#include"access/transam.h"
@@ -309,16 +309,15 @@ extern intoptind,
309309
externintoptreset;/* might not be declared by system headers */
310310
#endif
311311

312+
#ifdefUSE_BONJOUR
313+
staticDNSServiceRefbonjour_sdref=NULL;
314+
#endif
315+
312316
/*
313317
* postmaster.c - function prototypes
314318
*/
315319
staticvoidgetInstallationPaths(constchar*argv0);
316320
staticvoidcheckDataDir(void);
317-
318-
#ifdefUSE_BONJOUR
319-
staticvoidreg_reply(DNSServiceRegistrationReplyErrorTypeerrorCode,
320-
void*context);
321-
#endif
322321
staticvoidpmdaemonize(void);
323322
staticPort*ConnCreate(intserverFd);
324323
staticvoidConnFree(Port*port);
@@ -855,15 +854,38 @@ PostmasterMain(int argc, char *argv[])
855854

856855
#ifdefUSE_BONJOUR
857856
/* Register for Bonjour only if we opened TCP socket(s) */
858-
if (ListenSocket[0]!=-1&&bonjour_name!=NULL)
857+
if (ListenSocket[0]!=-1)
859858
{
860-
DNSServiceRegistrationCreate(bonjour_name,
861-
"_postgresql._tcp.",
862-
"",
863-
htons(PostPortNumber),
864-
"",
865-
(DNSServiceRegistrationReply)reg_reply,
866-
NULL);
859+
DNSServiceErrorTypeerr;
860+
861+
/*
862+
* We pass 0 for interface_index, which will result in registering on
863+
* all "applicable" interfaces. It's not entirely clear from the
864+
* DNS-SD docs whether this would be appropriate if we have bound to
865+
* just a subset of the available network interfaces.
866+
*/
867+
err=DNSServiceRegister(&bonjour_sdref,
868+
0,
869+
0,
870+
bonjour_name,
871+
"_postgresql._tcp.",
872+
NULL,
873+
NULL,
874+
htons(PostPortNumber),
875+
0,
876+
NULL,
877+
NULL,
878+
NULL);
879+
if (err!=kDNSServiceErr_NoError)
880+
elog(LOG,"DNSServiceRegister() failed: error code %ld",
881+
(long)err);
882+
/*
883+
* We don't bother to read the mDNS daemon's reply, and we expect
884+
* that it will automatically terminate our registration when the
885+
* socket is closed at postmaster termination. So there's nothing
886+
* more to be done here. However, the bonjour_sdref is kept around
887+
* so that forked children can close their copies of the socket.
888+
*/
867889
}
868890
#endif
869891

@@ -1192,18 +1214,6 @@ checkDataDir(void)
11921214
}
11931215

11941216

1195-
#ifdefUSE_BONJOUR
1196-
1197-
/*
1198-
* empty callback function for DNSServiceRegistrationCreate()
1199-
*/
1200-
staticvoid
1201-
reg_reply(DNSServiceRegistrationReplyErrorTypeerrorCode,void*context)
1202-
{
1203-
}
1204-
#endif/* USE_BONJOUR */
1205-
1206-
12071217
/*
12081218
* Fork away from the controlling terminal (silent_mode option)
12091219
*
@@ -2004,6 +2014,12 @@ ClosePostmasterPorts(bool am_syslogger)
20042014
syslogPipe[0]=0;
20052015
#endif
20062016
}
2017+
2018+
#ifdefUSE_BONJOUR
2019+
/* If using Bonjour, close the connection to the mDNS daemon */
2020+
if (bonjour_sdref)
2021+
close(DNSServiceRefSockFD(bonjour_sdref));
2022+
#endif
20072023
}
20082024

20092025

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp