diff -up ntp-4.2.6p3/html/ntpd.html.mlock ntp-4.2.6p3/html/ntpd.html --- ntp-4.2.6p3/html/ntpd.html.mlock 2011-01-05 17:51:36.242120783 +0100 +++ ntp-4.2.6p3/html/ntpd.html 2011-01-05 17:51:36.254121258 +0100 @@ -32,7 +32,7 @@

Synopsis

- ntpd [ -46aAbdDgLnNqx ] [ -c conffile ] [ -f driftfile ] [ -i jaildir ] [ -I iface ] [ -k keyfile ] [ -l logfile ] [ -p pidfile ] [ -P priority ] [ -r broadcastdelay ] [ -s statsdir ] [ -t key ] [ -u user[:group] ] [ -U interface_update_interval ] [ -v variable ] [ -V variable ] + ntpd [ -46aAbdDgLmnNqx ] [ -c conffile ] [ -f driftfile ] [ -i jaildir ] [ -I iface ] [ -k keyfile ] [ -l logfile ] [ -p pidfile ] [ -P priority ] [ -r broadcastdelay ] [ -s statsdir ] [ -t key ] [ -u user[:group] ] [ -U interface_update_interval ] [ -v variable ] [ -V variable ]

Description

The ntpd program is an operating system daemon that synchronises the system clock with remote NTP time servers or local reference clocks. It is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with version 3, as defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and RFC-1119, respectively. The program can operate in any of several modes, as described on the Association Management page, and with both symmetric key and public key cryptography, as described on the Authentication Options page.

The ntpd program ordinarily requires a configuration file as desccribe on the Configuration Commands and Options collection above. However a client can discover remote servers and configure them automatically. This makes it possible to deploy a fleet of workstations without specifying configuration details specific to the local environment. Further details are on the Automatic Server Discovery page.

@@ -123,6 +123,8 @@
Do not listen to virtual interfaces, defined as those with names containing a colon. This option is deprecated. Please consider using the configuration file interface command, which is more versatile.
-M
Raise scheduler precision to its maximum (1 msec) using timeBeginPeriod. (Windows only)
+
-m +
Lock memory.
-n
Don't fork.
-N
diff -up ntp-4.2.6p3/ntpd/ntpd-opts.c.mlock ntp-4.2.6p3/ntpd/ntpd-opts.c --- ntp-4.2.6p3/ntpd/ntpd-opts.c.mlock 2011-01-04 03:15:35.000000000 +0100 +++ ntp-4.2.6p3/ntpd/ntpd-opts.c 2011-01-05 17:55:01.609260787 +0100 @@ -282,6 +282,15 @@ static char const zNice_Name[] #define NICE_FLAGS (OPTST_DISABLED) /* + * Mlock option description: + */ +static char const zMlockText[] = + "Lock memory"; +static char const zMlock_NAME[] = "MLOCK"; +static char const zMlock_Name[] = "mlock"; +#define MLOCK_FLAGS (OPTST_DISABLED) + +/* * Pidfile option description: */ static char const zPidfileText[] = @@ -909,6 +918,18 @@ static tOptDesc optDesc[ OPTION_CT ] = { /* desc, NAME, name */ zPccfreqText, zPccfreq_NAME, zPccfreq_Name, /* disablement strs */ NULL, NULL }, + { /* entry idx, value */ 32, VALUE_OPT_MLOCK, + /* equiv idx, value */ 32, VALUE_OPT_MLOCK, + /* equivalenced to */ NO_EQUIVALENT, + /* min, max, act ct */ 0, 1, 0, + /* opt state flags */ MLOCK_FLAGS, 0, + /* last opt argumnt */ { NULL }, + /* arg list/cookie */ NULL, + /* must/cannot opts */ NULL, NULL, + /* option proc */ NULL, + /* desc, NAME, name */ zMlockText, zMlock_NAME, zMlock_Name, + /* disablement strs */ NULL, NULL }, + { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION, /* equiv idx value */ NO_EQUIVALENT, 0, /* equivalenced to */ NO_EQUIVALENT, @@ -1008,7 +1029,7 @@ tOptions ntpdOptions = { NO_EQUIVALENT, /* '-#' option index */ NO_EQUIVALENT /* index of default opt */ }, - 35 /* full option count */, 32 /* user option count */, + 36 /* full option count */, 33 /* user option count */, ntpd_full_usage, ntpd_short_usage, NULL, NULL, PKGDATADIR diff -up ntp-4.2.6p3/ntpd/ntpd-opts.h.mlock ntp-4.2.6p3/ntpd/ntpd-opts.h --- ntp-4.2.6p3/ntpd/ntpd-opts.h.mlock 2011-01-04 03:15:35.000000000 +0100 +++ ntp-4.2.6p3/ntpd/ntpd-opts.h 2011-01-05 17:51:36.256121337 +0100 @@ -82,6 +82,7 @@ typedef enum { - INDEX_OPT_VERSION = 32, - INDEX_OPT_HELP = 33, - INDEX_OPT_MORE_HELP = 34 + INDEX_OPT_MLOCK = 32, + INDEX_OPT_VERSION = 33, + INDEX_OPT_HELP = 34, + INDEX_OPT_MORE_HELP = 35 } teOptIndex; -#define OPTION_CT 35 +#define OPTION_CT 36 @@ -189,6 +190,10 @@ typedef enum { # warning undefining MODIFYMMTIMER due to option name conflict # undef MODIFYMMTIMER # endif +# ifdef MLOCK +# warning undefining MLOCK due to option name conflict +# undef MLOCK +# endif # ifdef NOFORK # warning undefining NOFORK due to option name conflict # undef NOFORK @@ -270,6 +275,7 @@ typedef enum { # undef LOGFILE # undef NOVIRTUALIPS # undef MODIFYMMTIMER +# undef MLOCK # undef NOFORK # undef NICE # undef PIDFILE @@ -308,6 +314,7 @@ typedef enum { #define VALUE_OPT_LOGFILE 'l' #define VALUE_OPT_NOVIRTUALIPS 'L' #define VALUE_OPT_MODIFYMMTIMER 'M' +#define VALUE_OPT_MLOCK 'm' #define VALUE_OPT_NOFORK 'n' #define VALUE_OPT_NICE 'N' #define VALUE_OPT_PIDFILE 'p' diff -up ntp-4.2.6p3/ntpd/ntpd.c.mlock ntp-4.2.6p3/ntpd/ntpd.c --- ntp-4.2.6p3/ntpd/ntpd.c.mlock 2011-01-05 17:51:36.191118761 +0100 +++ ntp-4.2.6p3/ntpd/ntpd.c 2011-01-05 17:51:36.257121377 +0100 @@ -723,7 +723,8 @@ ntpdmain( } #endif -#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE) +#if defined(MCL_CURRENT) && defined(MCL_FUTURE) + if (HAVE_OPT( MLOCK )) { # ifdef HAVE_SETRLIMIT /* * Set the stack limit to something smaller, so that we don't lock a lot @@ -749,7 +750,7 @@ ntpdmain( * fail if we drop root privlege. To be useful the value * has to be larger than the largest ntpd resident set size. */ - rl.rlim_cur = rl.rlim_max = 32*1024*1024; + rl.rlim_cur = rl.rlim_max = 64*1024*1024; if (setrlimit(RLIMIT_MEMLOCK, &rl) == -1) { msyslog(LOG_ERR, "Cannot set RLIMIT_MEMLOCK: %m"); } @@ -761,6 +762,7 @@ ntpdmain( */ if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) msyslog(LOG_ERR, "mlockall(): %m"); + } #else /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */ # ifdef HAVE_PLOCK # ifdef PROCLOCK