[Git][NTPsec/ntpsec][master] 2 commits: Thinko fix in shm example.

Eric S. Raymond gitlab at mg.gitlab.com
Tue Jul 19 10:30:41 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
2b964213 by Eric S. Raymond at 2016-07-18T22:14:11-04:00
Thinko fix in shm example.

- - - - -
0418cea4 by Eric S. Raymond at 2016-07-18T22:48:18-04:00
More priority-setting simplification.

- - - - -


2 changed files:

- docs/driver_shm.txt
- ntpd/ntpd.c


Changes:

=====================================
docs/driver_shm.txt
=====================================
--- a/docs/driver_shm.txt
+++ b/docs/driver_shm.txt
@@ -194,8 +194,8 @@ for the specific unit.
 The most common use of this driver is to get samples from a gpsd instance:
 
 ----------------------------------------------------------------------------
-refclock shm unit 0 prefer refid GPS
-refclock shm unit 1 refid PPS
+refclock shm unit 0 refid GPS
+refclock shm unit 1 prefer refid PPS
 ----------------------------------------------------------------------------
 
 == Public vs. Private SHM segments ==


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -60,12 +60,7 @@ DNSServiceRef mdns;
 
 #include <sodium.h>
 
-/*
- * Scheduling priority we run at
- */
-#define NTPD_PRIO	(-12)
-
-static bool priority_ok = true;
+static bool need_priority = false;
 static bool config_priority_override = false;
 static int config_priority;
 
@@ -335,7 +330,7 @@ parse_cmdline_opts(
 		nofork = true;
 		break;
 	    case 'N':
-		priority_ok = false;
+		need_priority = true;
 		break;
 	    case 'p':
 		pidfile = ntp_optarg;
@@ -343,7 +338,7 @@ parse_cmdline_opts(
 	    case 'P':
 		config_priority = atoi(ntp_optarg);
 		config_priority_override = true;
-		priority_ok = false;
+		need_priority = true;
 		break;
 	    case 'q':
 		mode_ntpdate = true;
@@ -522,13 +517,13 @@ set_process_priority(void)
 # ifdef DEBUG
 	if (debug > 1)
 		msyslog(LOG_DEBUG, "set_process_priority: %s",
-			((priority_ok)
+			((!need_priority)
 			 ? "Leave priority alone"
 			 : "Attempt to set priority"
 				));
 # endif /* DEBUG */
 #ifdef HAVE_SCHED_SETSCHEDULER
-	if (!priority_ok) {
+	if (need_priority) {
 		int pmax, pmin;
 		struct sched_param sched;
 
@@ -546,17 +541,10 @@ set_process_priority(void)
 		if ( sched_setscheduler(0, SCHED_FIFO, &sched) == -1 )
 			msyslog(LOG_ERR, "sched_setscheduler(): %m");
 		else
-			priority_ok = true;
-		if (!priority_ok) {
-			sched.sched_priority = NTPD_PRIO;
-			if ( sched_setscheduler(0, SCHED_OTHER, &sched) == -1 )
-				msyslog(LOG_ERR, "sched_setscheduler(): %m");
-			else
-				priority_ok = true;
-		}
+			need_priority = false;
 	}
 #endif
-	if (!priority_ok)
+	if (need_priority)
 		msyslog(LOG_ERR, "set_process_priority: No way found to improve our priority");
 }
 #endif	/* !SIM */



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/913b29f2c59743f42fbf9eeea686b43bbbf2dab3...0418cea4a83dbbc84f2c81cf3336bb16f48efac2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160719/dc837546/attachment.html>


More information about the vc mailing list