Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 65fb311

Browse files
committed
Add Rendezvous support to postmaster, from Chris Campbell
1 parent 1ca0b6d commit 65fb311

File tree

5 files changed

+213
-5
lines changed

5 files changed

+213
-5
lines changed

configure

+155
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ Optional Packages:
866866
--with-krb5[=DIR] build with Kerberos 5 support [/usr/athena]
867867
--with-krb-srvnam=NAME name of the service principal in Kerberos postgres
868868
--with-pam build with PAM support
869+
--with-rendezvous build with Rendezvous support
869870
--with-openssl[=DIR] build with OpenSSL support [/usr/local/ssl]
870871
--without-readline do not use Readline
871872
--without-zlib do not use Zlib
@@ -3360,6 +3361,46 @@ echo "${ECHO_T}$with_pam" >&6
33603361
33613362
33623363
3364+
#
3365+
# Rendezvous
3366+
#
3367+
echo "$as_me:$LINENO: checking whether to build with Rendezvous support" >&5
3368+
echo $ECHO_N "checking whether to build with Rendezvous support... $ECHO_C" >&6
3369+
3370+
3371+
3372+
# Check whether --with-rendezvous or --without-rendezvous was given.
3373+
if test "${with_rendezvous+set}" = set; then
3374+
withval="$with_rendezvous"
3375+
3376+
case $withval in
3377+
yes)
3378+
3379+
cat >>confdefs.h <<\_ACEOF
3380+
#define USE_RENDEZVOUS 1
3381+
_ACEOF
3382+
3383+
;;
3384+
no)
3385+
:
3386+
;;
3387+
*)
3388+
{ { echo "$as_me:$LINENO: error: no argument expected for --with-rendezvous option" >&5
3389+
echo "$as_me: error: no argument expected for --with-rendezvous option" >&2;}
3390+
{ (exit 1); exit 1; }; }
3391+
;;
3392+
esac
3393+
3394+
else
3395+
with_rendezvous=no
3396+
3397+
fi;
3398+
3399+
echo "$as_me:$LINENO: result: $with_rendezvous" >&5
3400+
echo "${ECHO_T}$with_rendezvous" >&6
3401+
3402+
3403+
33633404
#
33643405
# OpenSSL
33653406
#
@@ -9038,6 +9079,119 @@ fi
90389079
90399080
done
90409081
9082+
fi
9083+
9084+
if test "$with_rendezvous" = yes ; then
9085+
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
9086+
echo "$as_me:$LINENO: checking for DNSServiceDiscovery/DNSServiceDiscovery.h" >&5
9087+
echo $ECHO_N "checking for DNSServiceDiscovery/DNSServiceDiscovery.h... $ECHO_C" >&6
9088+
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
9089+
echo $ECHO_N "(cached) $ECHO_C" >&6
9090+
fi
9091+
echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5
9092+
echo "${ECHO_T}$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6
9093+
else
9094+
# Is the header compilable?
9095+
echo "$as_me:$LINENO: checking DNSServiceDiscovery/DNSServiceDiscovery.h usability" >&5
9096+
echo $ECHO_N "checking DNSServiceDiscovery/DNSServiceDiscovery.h usability... $ECHO_C" >&6
9097+
cat >conftest.$ac_ext <<_ACEOF
9098+
#line $LINENO "configure"
9099+
#include "confdefs.h"
9100+
$ac_includes_default
9101+
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
9102+
_ACEOF
9103+
rm -f conftest.$ac_objext
9104+
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
9105+
(eval $ac_compile) 2>&5
9106+
ac_status=$?
9107+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
9108+
(exit $ac_status); } &&
9109+
{ ac_try='test -s conftest.$ac_objext'
9110+
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
9111+
(eval $ac_try) 2>&5
9112+
ac_status=$?
9113+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
9114+
(exit $ac_status); }; }; then
9115+
ac_header_compiler=yes
9116+
else
9117+
echo "$as_me: failed program was:" >&5
9118+
cat conftest.$ac_ext >&5
9119+
ac_header_compiler=no
9120+
fi
9121+
rm -f conftest.$ac_objext conftest.$ac_ext
9122+
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
9123+
echo "${ECHO_T}$ac_header_compiler" >&6
9124+
9125+
# Is the header present?
9126+
echo "$as_me:$LINENO: checking DNSServiceDiscovery/DNSServiceDiscovery.h presence" >&5
9127+
echo $ECHO_N "checking DNSServiceDiscovery/DNSServiceDiscovery.h presence... $ECHO_C" >&6
9128+
cat >conftest.$ac_ext <<_ACEOF
9129+
#line $LINENO "configure"
9130+
#include "confdefs.h"
9131+
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
9132+
_ACEOF
9133+
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
9134+
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
9135+
ac_status=$?
9136+
egrep -v '^ *\+' conftest.er1 >conftest.err
9137+
rm -f conftest.er1
9138+
cat conftest.err >&5
9139+
echo "$as_me:$LINENO: \$? = $ac_status" >&5
9140+
(exit $ac_status); } >/dev/null; then
9141+
if test -s conftest.err; then
9142+
ac_cpp_err=$ac_c_preproc_warn_flag
9143+
else
9144+
ac_cpp_err=
9145+
fi
9146+
else
9147+
ac_cpp_err=yes
9148+
fi
9149+
if test -z "$ac_cpp_err"; then
9150+
ac_header_preproc=yes
9151+
else
9152+
echo "$as_me: failed program was:" >&5
9153+
cat conftest.$ac_ext >&5
9154+
ac_header_preproc=no
9155+
fi
9156+
rm -f conftest.err conftest.$ac_ext
9157+
echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
9158+
echo "${ECHO_T}$ac_header_preproc" >&6
9159+
9160+
# So? What about this header?
9161+
case $ac_header_compiler:$ac_header_preproc in
9162+
yes:no )
9163+
{ echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&5
9164+
echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
9165+
{ echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&5
9166+
echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&2;};;
9167+
no:yes )
9168+
{ echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&5
9169+
echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: present but cannot be compiled" >&2;}
9170+
{ echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&5
9171+
echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: check for missing prerequisite headers?" >&2;}
9172+
{ echo "$as_me:$LINENO: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&5
9173+
echo "$as_me: WARNING: DNSServiceDiscovery/DNSServiceDiscovery.h: proceeding with the preprocessor's result" >&2;};;
9174+
esac
9175+
echo "$as_me:$LINENO: checking for DNSServiceDiscovery/DNSServiceDiscovery.h" >&5
9176+
echo $ECHO_N "checking for DNSServiceDiscovery/DNSServiceDiscovery.h... $ECHO_C" >&6
9177+
if test "${ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h+set}" = set; then
9178+
echo $ECHO_N "(cached) $ECHO_C" >&6
9179+
else
9180+
ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h=$ac_header_preproc
9181+
fi
9182+
echo "$as_me:$LINENO: result: $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&5
9183+
echo "${ECHO_T}$ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h" >&6
9184+
9185+
fi
9186+
if test $ac_cv_header_DNSServiceDiscovery_DNSServiceDiscovery_h = yes; then
9187+
:
9188+
else
9189+
{ { echo "$as_me:$LINENO: error: header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Rendezvous" >&5
9190+
echo "$as_me: error: header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Rendezvous" >&2;}
9191+
{ (exit 1); exit 1; }; }
9192+
fi
9193+
9194+
90419195
fi
90429196
90439197
@@ -17327,6 +17481,7 @@ s,@with_krb4@,$with_krb4,;t t
1732717481
s,@with_krb5@,$with_krb5,;t t
1732817482
s,@krb_srvtab@,$krb_srvtab,;t t
1732917483
s,@with_pam@,$with_pam,;t t
17484+
s,@with_rendezvous@,$with_rendezvous,;t t
1733017485
s,@with_openssl@,$with_openssl,;t t
1733117486
s,@ELF_SYS@,$ELF_SYS,;t t
1733217487
s,@THREAD_LIBS@,$THREAD_LIBS,;t t

configure.in

+16-1
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 $Header: /cvsroot/pgsql/configure.in,v 1.257 2003/06/09 03:41:46 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.258 2003/06/11 06:56:06 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -471,6 +471,17 @@ AC_MSG_RESULT([$with_pam])
471471
AC_SUBST(with_pam)
472472

473473

474+
#
475+
# Rendezvous
476+
#
477+
AC_MSG_CHECKING([whether to build with Rendezvous support])
478+
PGAC_ARG_BOOL(with, rendezvous, no,
479+
[ --with-rendezvous build with Rendezvous support],
480+
[AC_DEFINE([USE_RENDEZVOUS], 1, [Define to 1 to build with Rendezvous support. (--with-rendezvous)])])
481+
AC_MSG_RESULT([$with_rendezvous])
482+
AC_SUBST(with_rendezvous)
483+
484+
474485
#
475486
# OpenSSL
476487
#
@@ -759,6 +770,10 @@ if test "$with_pam" = yes ; then
759770
[AC_MSG_ERROR([header file <security/pam_appl.h> or <pam/pam_appl.h> is required for PAM.])])])
760771
fi
761772

773+
if test "$with_rendezvous" = yes ; then
774+
AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Rendezvous])])
775+
fi
776+
762777

763778
##
764779
## Types, structures, compiler characteristics

doc/src/sgml/installation.sgml

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.132 2003/03/25 16:15:36 petere Exp $ -->
1+
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/installation.sgml,v 1.133 2003/06/11 06:56:06 momjian Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -270,8 +270,7 @@ JAVACMD=$JAVA_HOME/bin/java
270270
<listitem>
271271
<para>
272272
<application>Kerberos</>, <application>OpenSSL</>, or <application>PAM</>,
273-
if you want to support
274-
authentication using these services.
273+
if you want to support authentication using these services.
275274
</para>
276275
</listitem>
277276
</itemizedlist>
@@ -906,6 +905,15 @@ JAVACMD=$JAVA_HOME/bin/java
906905
</listitem>
907906
</varlistentry>
908907

908+
<varlistentry>
909+
<term><option>--with-rendezvous</option></term>
910+
<listitem>
911+
<para>
912+
Build with Rendezvous support.
913+
</para>
914+
</listitem>
915+
</varlistentry>
916+
909917
<varlistentry>
910918
<term><option>--without-zlib</option></term>
911919
<listitem>

src/backend/postmaster/postmaster.c

+28-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.331 2003/05/28 19:36:28 tgl Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.332 2003/06/11 06:56:06 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -85,6 +85,10 @@
8585
#include <getopt.h>
8686
#endif
8787

88+
#ifdef USE_RENDEZVOUS
89+
#include <DNSServiceDiscovery/DNSServiceDiscovery.h>
90+
#endif
91+
8892
#include "catalog/pg_database.h"
8993
#include "commands/async.h"
9094
#include "lib/dllist.h"
@@ -366,6 +370,17 @@ checkDataDir(const char *checkdir)
366370
}
367371

368372

373+
#ifdef USE_RENDEZVOUS
374+
375+
/* reg_reply -- empty callback function for DNSServiceRegistrationCreate() */
376+
static void
377+
reg_reply(DNSServiceRegistrationReplyErrorType errorCode, void *context)
378+
{
379+
380+
}
381+
382+
#endif
383+
369384
int
370385
PostmasterMain(int argc, char *argv[])
371386
{
@@ -723,6 +738,18 @@ PostmasterMain(int argc, char *argv[])
723738
else
724739
elog(LOG, "IPv4 socket created");
725740
}
741+
#endif
742+
#ifdef USE_RENDEZVOUS
743+
if (service_name != NULL)
744+
{
745+
DNSServiceRegistrationCreate(NULL, /* default to hostname */
746+
"_postgresql._tcp.",
747+
"",
748+
htonl(PostPortNumber),
749+
"",
750+
(DNSServiceRegistrationReply)reg_reply,
751+
NULL);
752+
}
726753
#endif
727754
}
728755

src/include/pg_config.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@
564564
/* Define to 1 to build with PAM support. (--with-pam) */
565565
#undef USE_PAM
566566

567+
/* Define to 1 to build with Rendezvous support. (--with-rendezvous) */
568+
#undef USE_RENDEZVOUS
569+
567570
/* Define to build with (Open)SSL support. (--with-openssl) */
568571
#undef USE_SSL
569572

0 commit comments

Comments
 (0)