* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: main.c,v 1.119.2.3.2.15 2004/07/01 02:01:34 marka Exp $ */
+/* $Id: main.c,v 1.119.2.3.2.16 2004/09/01 07:16:35 marka Exp $ */
#include <config.h>
#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.
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;
}
} while (result != ISC_R_SUCCESS);
+#ifdef HAVE_LIBSCF
+ scf_cleanup();
+#endif
+
cleanup();
if (want_stats) {
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
#
-# $Id: configure,v 1.284.2.19.2.25 2004/08/28 06:27:23 marka Exp $
+# $Id: configure,v 1.284.2.19.2.26 2004/09/01 07:18:30 marka Exp $
#
# Portions Copyright (C) 1996-2001 Nominum, Inc.
#
# 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.294.2.23.2.29 .
+# From configure.in Revision: 1.294.2.23.2.30 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
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
;;
*-*-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=$?
# 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
-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
-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
-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
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
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
-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
-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
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
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
-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
-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
-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
-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
-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
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
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