Add mlockall and SCHED_FIFO support

The attached patch adds support for mlockall() as well as the SCHED_FIFO
real-time scheduler. It should result in reduced (and more consistent)
latency. Usage is documented in all the documents.
This commit is contained in:
John Hasler
2009-02-10 17:59:57 +01:00
committed by Miroslav Lichvar
parent cdc22df903
commit 35e662d810
11 changed files with 258 additions and 2 deletions

36
conf.c
View File

@@ -93,6 +93,14 @@ static void parse_broadcast(const char *);
static void parse_linux_hz(const char *);
static void parse_linux_freq_scale(const char *);
#if defined(HAVE_SCHED_SETSCHEDULER)
static void parse_sched_priority(const char *);
#endif
#if defined(HAVE_MLOCKALL)
static void parse_lockall(const char *);
#endif
/* ================================================== */
/* Configuration variables */
@@ -209,6 +217,14 @@ static const Command commands[] = {
{"broadcast", 9, parse_broadcast},
{"linux_hz", 8, parse_linux_hz},
{"linux_freq_scale", 16, parse_linux_freq_scale}
#if defined(HAVE_SCHED_SETSCHEDULER)
,{"sched_priority", 14, parse_sched_priority}
#endif
#if defined(HAVE_MLOCKALL)
,{"lock_all", 8, parse_lockall}
#endif
};
static int n_commands = (sizeof(commands) / sizeof(commands[0]));
@@ -365,6 +381,26 @@ parse_source(const char *line, NTP_Source_Type type)
/* ================================================== */
#if defined(HAVE_SCHED_SETSCHEDULER)
static void
parse_sched_priority(const char *line)
{
if (SchedPriority == 0) { /* Command-line switch must have priority */
sscanf(line, "%d", &SchedPriority);
}
}
#endif
#if defined(HAVE_MLOCKALL)
static void
parse_lockall(const char *line)
{
LockAll = 1;
}
#endif
/* ================================================== */
static void
parse_server(const char *line)
{