Commit 23ac3060 authored by Mark Andrews's avatar Mark Andrews

1709. [port] solaris: add SMF support from Sun.

parent d6fe7ba9
1709. [placeholder] rt12404
1709. [port] solaris: add SMF support from Sun.
1708. [cleanup] Replaced dns_fullname_hash() with dns_name_fullhash()
for conformance to the name space convention. Binary
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: main.c,v 1.138 2004/07/01 02:03:54 marka Exp $ */
/* $Id: main.c,v 1.139 2004/09/01 07:23:51 marka Exp $ */
#include <config.h>
......@@ -47,6 +47,10 @@
#include <dst/result.h>
#ifdef HAVE_LIBSCF
#include <libscf.h>
#endif
/*
* Defining NS_MAIN provides storage declarations (rather than extern)
* for variables in named/globals.h.
......@@ -684,6 +688,91 @@ ns_main_setmemstats(const char *filename) {
strcpy(memstats, filename);
}
#ifdef HAVE_LIBSCF
/*
* Get FMRI for the current named process
*/
static char *
scf_get_ins_name(void) {
scf_handle_t *h = NULL;
int namelen;
char *ins_name;
if ((h = scf_handle_create(SCF_VERSION)) == NULL) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_handle_create() failed: %s",
scf_strerror(scf_error()));
return (NULL);
}
if (scf_handle_bind(h) == -1) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_handle_bind() failed: %s",
scf_strerror(scf_error()));
scf_handle_destroy(h);
return (NULL);
}
if ((namelen = scf_myname(h, NULL, 0)) == -1) {
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN, ISC_LOG_INFO,
"scf_myname() failed: %s",
scf_strerror(scf_error()));
scf_handle_destroy(h);
return (NULL);
}
if ((ins_name = malloc(namelen + 1)) == NULL) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_get_ins_named() memory "
"allocation failed: %s",
isc_result_totext(ISC_R_NOMEMORY));
scf_handle_destroy(h);
return (NULL);
}
if (scf_myname(h, ins_name, namelen + 1) == -1) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"scf_myname() failed: %s",
scf_strerror(scf_error()));
scf_handle_destroy(h);
free(ins_name);
return (NULL);
}
scf_handle_destroy(h);
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_INFO, "instance name:%s", ins_name);
return (ins_name);
}
static void
scf_cleanup(void) {
char *s;
char *ins_name;
if ((ins_name = scf_get_ins_name()) != NULL) {
if ((s = smf_get_state(ins_name)) != NULL) {
if ((strcmp(SCF_STATE_STRING_ONLINE, s) == 0) ||
(strcmp(SCF_STATE_STRING_DEGRADED, s) == 0)) {
if (smf_disable_instance(ins_name, 0) != 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"smf_disable_instance() failed: %s",
scf_strerror(scf_error()));
}
}
free(s);
} else {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"smf_get_state() failed: %s",
scf_strerror(scf_error()));
}
free(ins_name);
}
}
#endif
int
main(int argc, char *argv[]) {
isc_result_t result;
......@@ -762,6 +851,10 @@ main(int argc, char *argv[]) {
}
} while (result != ISC_R_SUCCESS);
#ifdef HAVE_LIBSCF
scf_cleanup();
#endif
cleanup();
if (want_stats) {
......
......@@ -16,7 +16,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.h.in,v 1.61 2004/05/21 08:15:36 marka Exp $ */
/* $Id: config.h.in,v 1.62 2004/09/01 07:25:51 marka Exp $ */
/***
*** This file is not to be included by any public header files, because
......@@ -161,6 +161,9 @@ int sigwait(const unsigned int *set, int *sig);
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the `scf' library (-lscf). */
#undef HAVE_LIBSCF
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
......
......@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
# $Id: configure,v 1.345 2004/08/28 06:20:13 marka Exp $
# $Id: configure,v 1.347 2004/09/24 04:37:18 marka Exp $
#
# Portions Copyright (C) 1996-2001 Nominum, Inc.
#
......@@ -29,7 +29,7 @@
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# From configure.in Revision: 1.361 .
# From configure.in Revision: 1.362 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
......@@ -6632,6 +6632,84 @@ fi
ISC_THREAD_DIR=$thread_dir
#
# In solaris 10, SMF can manage named service
#
echo "$as_me:$LINENO: checking for smf_enable_instance in -lscf" >&5
echo $ECHO_N "checking for smf_enable_instance in -lscf... $ECHO_C" >&6
if test "${ac_cv_lib_scf_smf_enable_instance+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lscf $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char smf_enable_instance ();
int
main ()
{
smf_enable_instance ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_lib_scf_smf_enable_instance=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_scf_smf_enable_instance=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_scf_smf_enable_instance" >&5
echo "${ECHO_T}$ac_cv_lib_scf_smf_enable_instance" >&6
if test $ac_cv_lib_scf_smf_enable_instance = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSCF 1
_ACEOF
LIBS="-lscf $LIBS"
fi
#
# flockfile is usually provided by pthreads, but we may want to use it
# even if compiled with --disable-threads. getc_unlocked might also not
......@@ -7842,7 +7920,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 7845 "configure"' > conftest.$ac_ext
echo '#line 7923 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
......@@ -8832,7 +8910,7 @@ fi
# Provide some information about the compiler.
echo "$as_me:8835:" \
echo "$as_me:8913:" \
"checking for Fortran 77 compiler version" >&5
ac_compiler=`set X $ac_compile; echo $2`
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
......@@ -9870,11 +9948,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:9873: $lt_compile\"" >&5)
(eval echo "\"\$as_me:9951: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:9877: \$? = $ac_status" >&5
echo "$as_me:9955: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
......@@ -10103,11 +10181,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10106: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10184: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:10110: \$? = $ac_status" >&5
echo "$as_me:10188: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
......@@ -10163,11 +10241,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:10166: $lt_compile\"" >&5)
(eval echo "\"\$as_me:10244: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:10170: \$? = $ac_status" >&5
echo "$as_me:10248: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -12347,7 +12425,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 12350 "configure"
#line 12428 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -12445,7 +12523,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 12448 "configure"
#line 12526 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -14628,11 +14706,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14631: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14709: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:14635: \$? = $ac_status" >&5
echo "$as_me:14713: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
......@@ -14688,11 +14766,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:14691: $lt_compile\"" >&5)
(eval echo "\"\$as_me:14769: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:14695: \$? = $ac_status" >&5
echo "$as_me:14773: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -16049,7 +16127,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 16052 "configure"
#line 16130 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -16147,7 +16225,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 16150 "configure"
#line 16228 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -16974,11 +17052,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:16977: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17055: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:16981: \$? = $ac_status" >&5
echo "$as_me:17059: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
......@@ -17034,11 +17112,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:17037: $lt_compile\"" >&5)
(eval echo "\"\$as_me:17115: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:17041: \$? = $ac_status" >&5
echo "$as_me:17119: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -19072,11 +19150,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19075: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19153: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:19079: \$? = $ac_status" >&5
echo "$as_me:19157: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
......@@ -19305,11 +19383,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19308: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19386: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:19312: \$? = $ac_status" >&5
echo "$as_me:19390: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings
......@@ -19365,11 +19443,11 @@ else
-e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:19368: $lt_compile\"" >&5)
(eval echo "\"\$as_me:19446: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:19372: \$? = $ac_status" >&5
echo "$as_me:19450: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
......@@ -21549,7 +21627,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 21552 "configure"
#line 21630 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -21647,7 +21725,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
#line 21650 "configure"
#line 21728 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......
......@@ -18,7 +18,7 @@ AC_DIVERT_PUSH(1)dnl
esyscmd([sed "s/^/# /" COPYRIGHT])dnl
AC_DIVERT_POP()dnl
AC_REVISION($Revision: 1.361 $)
AC_REVISION($Revision: 1.362 $)
AC_INIT(lib/dns/name.c)
AC_PREREQ(2.13)
......@@ -856,6 +856,11 @@ AC_SUBST(ISC_PLATFORM_USETHREADS)
ISC_THREAD_DIR=$thread_dir
AC_SUBST(ISC_THREAD_DIR)
#
# In solaris 10, SMF can manage named service
#
AC_CHECK_LIB(scf, smf_enable_instance)
#
# flockfile is usually provided by pthreads, but we may want to use it
# even if compiled with --disable-threads. getc_unlocked might also not
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment