[Git][NTPsec/ntpsec][master] Clean up priprity-etting code to use only POSIX primitives.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Jul 18 16:41:35 UTC 2016


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


Commits:
c3eca716 by Eric S. Raymond at 2016-07-18T12:41:21-04:00
Clean up priprity-etting code to use only POSIX primitives.

The set_priority() call doesn't qualify.

- - - - -


1 changed file:

- ntpd/ntpd.c


Changes:

=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -550,14 +550,15 @@ set_process_priority(void)
 			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;
+		}
 	}
 #endif
-	if (!priority_ok) {
-		if (-1 == setpriority(PRIO_PROCESS, 0, NTPD_PRIO))
-			msyslog(LOG_ERR, "setpriority() error: %m");
-		else
-			priority_ok = true;
-	}
 	if (!priority_ok)
 		msyslog(LOG_ERR, "set_process_priority: No way found to improve our priority");
 }



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c3eca716d403bf5e43aba40b87f9aebd26d895ec
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160718/a7bb005d/attachment.html>


More information about the vc mailing list