[ntp:bk-ntp-dev-send] BitKeeper diffs

Harlan Stenn stenn at whimsy.udel.edu
Wed Jun 27 07:23:20 UTC 2007


#### ChangeSet ####
2007-06-22 12:52:24-04:00, utterback at pogo.udel.edu 
  [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris

==== ChangeLog ====
2007-06-22 12:52:20-04:00, utterback at pogo.udel.edu +1 -0
  [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris

--- 1.73.1.2/ChangeLog	2007-06-22 02:11:16 -04:00
+++ 1.73.1.3/ChangeLog	2007-06-22 12:52:20 -04:00
@@ -1,3 +1,4 @@
+* [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris
 * Start using 'design by contract' assertions.
 * Allow null driftfile.
 * leap second infrastructure fixes from Dave Mills.

==== configure.ac ====
2007-06-22 12:52:20-04:00, utterback at pogo.udel.edu +7 -1
  [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris

--- 1.406/configure.ac	2007-05-05 14:16:16 -04:00
+++ 1.407/configure.ac	2007-06-22 12:52:20 -04:00
@@ -201,7 +201,13 @@ case "$ac_linuxcaps$ac_cv_header_sys_cap
     LIBS="$LIBS -lcap"
     ;;
 esac
-
+AC_CHECK_HEADERS(libscf.h)
+case "$ac_cv_header_libscf_h" in
+ yes)
+    AC_SUBST(LSCF, [-lscf])
+    ;;
+esac
+AC_CHECK_FUNC(setppriv,AC_DEFINE(HAVE_SOLARIS_PRIVS, ,[Are Solaris privileges available?]), )
 case "$build" in
  $host)
     ;;

==== ntpd/Makefile.am ====
2007-06-22 12:52:21-04:00, utterback at pogo.udel.edu +2 -2
  [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris

--- 1.62/ntpd/Makefile.am	2007-06-17 01:22:00 -04:00
+++ 1.63/ntpd/Makefile.am	2007-06-22 12:52:21 -04:00
@@ -23,8 +23,8 @@ man_MANS=	ntpd.1
 # sqrt                                ntp_control.o
 # floor                               refclock_wwv.o
 # which are (usually) provided by -lm.
-ntpd_LDADD = $(LDADD) -lm @LCRYPTO@ $(LIBOPTS_LDADD) ../libntp/libntp.a
-ntpdsim_LDADD = $(LDADD) -lm @LCRYPTO@ $(LIBOPTS_LDADD) ../libntp/libntpsim.a
+ntpd_LDADD = $(LDADD) -lm @LCRYPTO@ @LSCF@ $(LIBOPTS_LDADD) ../libntp/libntp.a
+ntpdsim_LDADD = $(LDADD) -lm @LCRYPTO@ @LSCF@ $(LIBOPTS_LDADD) ../libntp/libntpsim.a
 ntpdsim_CFLAGS = $(CFLAGS) -DSIM
 check_y2k_LDADD = $(LDADD) ../libntp/libntp.a
 DISTCLEANFILES = .version version.c

==== ntpd/ntp_proto.c ====
2007-06-22 12:52:21-04:00, utterback at pogo.udel.edu +19 -0
  [Bug 864] Place ntpd service in maintenance mode if using SMF on Solaris

--- 1.255/ntpd/ntp_proto.c	2007-06-22 01:25:05 -04:00
+++ 1.256/ntpd/ntp_proto.c	2007-06-22 12:52:21 -04:00
@@ -15,6 +15,9 @@
 #include "ntp_string.h"
 
 #include <stdio.h>
+#ifdef HAVE_LIBSCF_H
+#include <libscf.h>
+#endif
 
 #if defined(VMS) && defined(VMS_LOCALUNIT)	/*wjm*/
 #include "ntp_refclock.h"
@@ -1265,6 +1268,9 @@ clock_update(void)
 	u_char	ostratum;
 	double	dtemp;
 	l_fp	now;
+#ifdef HAVE_LIBSCF_H
+       char *fmri;
+#endif
 
 	/*
 	 * There must be a system peer at this point. If we just changed
@@ -1293,6 +1299,19 @@ clock_update(void)
 	 */
 	case -1:
 		report_event(EVNT_SYSFAULT, NULL);
+#ifdef HAVE_LIBSCF_H
+               /* enter the maintenance mode */
+               if ((fmri = getenv("SMF_FMRI")) != NULL) {
+                       if (smf_maintain_instance(fmri, 0) < 0) {
+                               printf("smf_maintain_instance:%s\n",
+                                   scf_strerror(scf_error()));
+                               exit(1);
+                       }
+                       /* sleep until SMF kills us */
+                       for (;;)
+                               pause();
+               }
+#endif
 		exit (-1);
 		/* not reached */
 


More information about the bk-ntp-dev-send mailing list