Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > cd0f440b578c03b7706d19492362a305 > files > 16

ntp-4.2.6p5-24.7.mga5.src.rpm

diff -up ntp-4.2.6p4/html/ntpd.html.mlock ntp-4.2.6p4/html/ntpd.html
--- ntp-4.2.6p4/html/ntpd.html.mlock	2011-10-06 13:08:50.897274352 +0200
+++ ntp-4.2.6p4/html/ntpd.html	2011-10-06 13:08:50.909274362 +0200
@@ -32,7 +32,7 @@
 		</ul>
 		<hr>
 		<h4 id="synop">Synopsis</h4>
-		<tt>ntpd [ -46aAbdDgLnNqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -i <i>jaildir</i> ] [ -I <i>iface</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -P <i>priority</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -u <i>user</i>[:<i>group</i>] ] [ -U <i>interface_update_interval</i> ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
+		<tt>ntpd [ -46aAbdDgLmnNqx ] [ -c <i>conffile</i> ] [ -f <i>driftfile</i> ] [ -i <i>jaildir</i> ] [ -I <i>iface</i> ] [ -k <i>keyfile</i> ] [ -l <i>logfile</i> ] [ -p <i>pidfile</i> ] [ -P <i>priority</i> ] [ -r <i>broadcastdelay</i> ] [ -s <i>statsdir</i> ] [ -t <i>key</i> ] [ -u <i>user</i>[:<i>group</i>] ] [ -U <i>interface_update_interval</i> ] [ -v <i>variable</i> ] [ -V <i>variable</i> ]</tt>
 		<h4 id="descr">Description</h4>
 		<p>The <tt>ntpd</tt> program is an operating system daemon that synchronises the system clock with remote NTP&nbsp;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 <a href="assoc.html">Association Management</a> page, and with both symmetric key and public key cryptography, as described on the <a href="manyopt.html">Authentication Options</a> page.</p>
 		<p>The <tt>ntpd</tt> 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 <a href="manyopt.html">Automatic Server Discovery</a> page.</p>
@@ -123,6 +123,8 @@
 			<dd>Do not listen to virtual interfaces, defined as those with names containing a colon. This option is deprecated. Please consider using the configuration file <a href="miscopt.html#interface">interface</a> command, which is more versatile.</dd>
 			<dt><tt>-M</tt></dt>
 			<dd>Raise scheduler precision to its maximum (1 msec) using timeBeginPeriod. (Windows only)</dd>
+			<dt><tt>-m</tt>
+			<dd>Lock memory.
 			<dt><tt>-n</tt></dt>
 			<dd>Don't fork.</dd>
 			<dt><tt>-N</tt></dt>
diff -up ntp-4.2.6p4/ntpd/ntpd-opts.c.mlock ntp-4.2.6p4/ntpd/ntpd-opts.c
--- ntp-4.2.6p4/ntpd/ntpd-opts.c.mlock	2011-09-23 05:36:04.000000000 +0200
+++ ntp-4.2.6p4/ntpd/ntpd-opts.c	2011-10-06 13:10:54.082360146 +0200
@@ -276,6 +276,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[] =
@@ -903,6 +912,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,
@@ -1018,7 +1039,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, ntpd_packager_info
diff -up ntp-4.2.6p4/ntpd/ntpd-opts.h.mlock ntp-4.2.6p4/ntpd/ntpd-opts.h
--- ntp-4.2.6p4/ntpd/ntpd-opts.h.mlock	2011-09-23 05:36:04.000000000 +0200
+++ ntp-4.2.6p4/ntpd/ntpd-opts.h	2011-10-06 13:08:50.910274363 +0200
@@ -81,6 +81,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
@@ -187,6 +188,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
@@ -268,6 +273,7 @@ typedef enum {
 # undef LOGFILE
 # undef NOVIRTUALIPS
 # undef MODIFYMMTIMER
+# undef MLOCK
 # undef NOFORK
 # undef NICE
 # undef PIDFILE
@@ -306,6 +312,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.6p4/ntpd/ntpd.c.mlock ntp-4.2.6p4/ntpd/ntpd.c
--- ntp-4.2.6p4/ntpd/ntpd.c.mlock	2011-10-06 13:08:50.869274334 +0200
+++ ntp-4.2.6p4/ntpd/ntpd.c	2011-10-06 13:08:50.911274363 +0200
@@ -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