diff -up ntp-4.2.4p8/html/ntpd.html.mlock ntp-4.2.4p8/html/ntpd.html --- ntp-4.2.4p8/html/ntpd.html.mlock 2009-12-08 17:56:35.000000000 +0100 +++ ntp-4.2.4p8/html/ntpd.html 2009-12-08 17:56:35.000000000 +0100 @@ -34,7 +34,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 which sets and maintains the system time of day in synchronism with Internet standard time servers. 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. ntpd does most computations in 64-bit floating point arithmetic and does relatively clumsy 64-bit fixed point operations only when necessary to preserve the ultimate precision, about 232 picoseconds. While the ultimate precision is not achievable with ordinary workstations and networks of today, it may be required with future gigahertz CPU clocks and gigabit LANs.

How NTP Operates

@@ -96,6 +96,8 @@
Specify the name and path of the log file. The default is the system log file. This is the same operation as the logfile logfile configuration command.
-L
Do not listen to virtual IPs. The default is to listen. +
-m +
Lock memory.
-n
Don't fork.
-N diff -up ntp-4.2.4p8/ntpd/ntpd-opts.c.mlock ntp-4.2.4p8/ntpd/ntpd-opts.c --- ntp-4.2.4p8/ntpd/ntpd-opts.c.mlock 2009-12-08 14:13:09.000000000 +0100 +++ ntp-4.2.4p8/ntpd/ntpd-opts.c 2009-12-08 17:56:35.000000000 +0100 @@ -264,6 +264,15 @@ tSCC zNice_Name[] = "ni #define NICE_FLAGS (OPTST_DISABLED) /* + * Mlock option description: + */ +tSCC zMlockText[] = + "Lock memory"; +tSCC zMlock_NAME[] = "MLOCK"; +tSCC zMlock_Name[] = "mlock"; +#define MLOCK_FLAGS (OPTST_DISABLED) + +/* * Pidfile option description: */ tSCC zPidfileText[] = @@ -789,6 +798,18 @@ static tOptDesc optDesc[ OPTION_CT ] = { OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT #endif + { /* entry idx, value */ 29, VALUE_OPT_MLOCK, + /* equiv idx, value */ 29, 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, @@ -881,7 +902,7 @@ tOptions ntpdOptions = { NO_EQUIVALENT /* index of '-#' option */, NO_EQUIVALENT /* index of default opt */ }, - 32 /* full option count */, 29 /* user option count */ + 33 /* full option count */, 30 /* user option count */ }; /* diff -up ntp-4.2.4p8/ntpd/ntpd-opts.h.mlock ntp-4.2.4p8/ntpd/ntpd-opts.h --- ntp-4.2.4p8/ntpd/ntpd-opts.h.mlock 2009-12-08 14:13:09.000000000 +0100 +++ ntp-4.2.4p8/ntpd/ntpd-opts.h 2009-12-08 17:56:35.000000000 +0100 @@ -81,12 +81,13 @@ typedef enum { INDEX_OPT_VAR = 26, INDEX_OPT_DVAR = 27, INDEX_OPT_SLEW = 28, - INDEX_OPT_VERSION = 29, - INDEX_OPT_HELP = 30, - INDEX_OPT_MORE_HELP = 31 + INDEX_OPT_MLOCK = 29, + INDEX_OPT_VERSION = 30, + INDEX_OPT_HELP = 31, + INDEX_OPT_MORE_HELP = 32 } teOptIndex; -#define OPTION_CT 32 +#define OPTION_CT 33 #define NTPD_VERSION "4.2.4p8" #define NTPD_FULL_VERSION "ntpd - NTP daemon program - Ver. 4.2.4p8" @@ -179,6 +180,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 @@ -248,6 +253,7 @@ typedef enum { # undef LOGFILE # undef NOVIRTUALIPS # undef MODIFYMMTIMER +# undef MLOCK # undef NOFORK # undef NICE # undef PIDFILE @@ -290,6 +296,7 @@ typedef enum { #ifdef SYS_WINNT #define VALUE_OPT_MODIFYMMTIMER 'M' #endif /* SYS_WINNT */ +#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.4p8/ntpd/ntpd.c.mlock ntp-4.2.4p8/ntpd/ntpd.c --- ntp-4.2.4p8/ntpd/ntpd.c.mlock 2009-12-08 17:56:35.000000000 +0100 +++ ntp-4.2.4p8/ntpd/ntpd.c 2009-12-08 17:56:35.000000000 +0100 @@ -691,7 +691,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 @@ -717,7 +718,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"); } @@ -729,6 +730,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