]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blob - ntp/patches/ntp-4.2.6p4-mlock.patch
Merge remote-tracking branch 'stevee/plymouth-update'
[people/ms/ipfire-3.x.git] / ntp / patches / ntp-4.2.6p4-mlock.patch
1 diff -up ntp-4.2.6p4/html/ntpd.html.mlock ntp-4.2.6p4/html/ntpd.html
2 --- ntp-4.2.6p4/html/ntpd.html.mlock 2011-10-06 13:08:50.897274352 +0200
3 +++ ntp-4.2.6p4/html/ntpd.html 2011-10-06 13:08:50.909274362 +0200
4 @@ -32,7 +32,7 @@
5 </ul>
6 <hr>
7 <h4 id="synop">Synopsis</h4>
8 - <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>
9 + <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>
10 <h4 id="descr">Description</h4>
11 <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>
12 <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>
13 @@ -123,6 +123,8 @@
14 <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>
15 <dt><tt>-M</tt></dt>
16 <dd>Raise scheduler precision to its maximum (1 msec) using timeBeginPeriod. (Windows only)</dd>
17 + <dt><tt>-m</tt>
18 + <dd>Lock memory.
19 <dt><tt>-n</tt></dt>
20 <dd>Don't fork.</dd>
21 <dt><tt>-N</tt></dt>
22 diff -up ntp-4.2.6p4/ntpd/ntpd-opts.c.mlock ntp-4.2.6p4/ntpd/ntpd-opts.c
23 --- ntp-4.2.6p4/ntpd/ntpd-opts.c.mlock 2011-09-23 05:36:04.000000000 +0200
24 +++ ntp-4.2.6p4/ntpd/ntpd-opts.c 2011-10-06 13:10:54.082360146 +0200
25 @@ -276,6 +276,15 @@ static char const zNice_Name[]
26 #define NICE_FLAGS (OPTST_DISABLED)
27
28 /*
29 + * Mlock option description:
30 + */
31 +static char const zMlockText[] =
32 + "Lock memory";
33 +static char const zMlock_NAME[] = "MLOCK";
34 +static char const zMlock_Name[] = "mlock";
35 +#define MLOCK_FLAGS (OPTST_DISABLED)
36 +
37 +/*
38 * Pidfile option description:
39 */
40 static char const zPidfileText[] =
41 @@ -903,6 +912,18 @@ static tOptDesc optDesc[OPTION_CT] = {
42 /* desc, NAME, name */ zPccfreqText, zPccfreq_NAME, zPccfreq_Name,
43 /* disablement strs */ NULL, NULL },
44
45 + { /* entry idx, value */ 32, VALUE_OPT_MLOCK,
46 + /* equiv idx, value */ 32, VALUE_OPT_MLOCK,
47 + /* equivalenced to */ NO_EQUIVALENT,
48 + /* min, max, act ct */ 0, 1, 0,
49 + /* opt state flags */ MLOCK_FLAGS, 0,
50 + /* last opt argumnt */ { NULL },
51 + /* arg list/cookie */ NULL,
52 + /* must/cannot opts */ NULL, NULL,
53 + /* option proc */ NULL,
54 + /* desc, NAME, name */ zMlockText, zMlock_NAME, zMlock_Name,
55 + /* disablement strs */ NULL, NULL },
56 +
57 { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
58 /* equiv idx value */ NO_EQUIVALENT, 0,
59 /* equivalenced to */ NO_EQUIVALENT,
60 @@ -1018,7 +1039,7 @@ tOptions ntpdOptions = {
61 NO_EQUIVALENT, /* '-#' option index */
62 NO_EQUIVALENT /* index of default opt */
63 },
64 - 35 /* full option count */, 32 /* user option count */,
65 + 36 /* full option count */, 33 /* user option count */,
66 ntpd_full_usage, ntpd_short_usage,
67 NULL, NULL,
68 PKGDATADIR, ntpd_packager_info
69 diff -up ntp-4.2.6p4/ntpd/ntpd-opts.h.mlock ntp-4.2.6p4/ntpd/ntpd-opts.h
70 --- ntp-4.2.6p4/ntpd/ntpd-opts.h.mlock 2011-09-23 05:36:04.000000000 +0200
71 +++ ntp-4.2.6p4/ntpd/ntpd-opts.h 2011-10-06 13:08:50.910274363 +0200
72 @@ -81,6 +81,7 @@ typedef enum {
73 - INDEX_OPT_VERSION = 32,
74 - INDEX_OPT_HELP = 33,
75 - INDEX_OPT_MORE_HELP = 34
76 + INDEX_OPT_MLOCK = 32,
77 + INDEX_OPT_VERSION = 33,
78 + INDEX_OPT_HELP = 34,
79 + INDEX_OPT_MORE_HELP = 35
80 } teOptIndex;
81
82 -#define OPTION_CT 35
83 +#define OPTION_CT 36
84 @@ -187,6 +188,10 @@ typedef enum {
85 # warning undefining MODIFYMMTIMER due to option name conflict
86 # undef MODIFYMMTIMER
87 # endif
88 +# ifdef MLOCK
89 +# warning undefining MLOCK due to option name conflict
90 +# undef MLOCK
91 +# endif
92 # ifdef NOFORK
93 # warning undefining NOFORK due to option name conflict
94 # undef NOFORK
95 @@ -268,6 +273,7 @@ typedef enum {
96 # undef LOGFILE
97 # undef NOVIRTUALIPS
98 # undef MODIFYMMTIMER
99 +# undef MLOCK
100 # undef NOFORK
101 # undef NICE
102 # undef PIDFILE
103 @@ -306,6 +312,7 @@ typedef enum {
104 #define VALUE_OPT_LOGFILE 'l'
105 #define VALUE_OPT_NOVIRTUALIPS 'L'
106 #define VALUE_OPT_MODIFYMMTIMER 'M'
107 +#define VALUE_OPT_MLOCK 'm'
108 #define VALUE_OPT_NOFORK 'n'
109 #define VALUE_OPT_NICE 'N'
110 #define VALUE_OPT_PIDFILE 'p'
111 diff -up ntp-4.2.6p4/ntpd/ntpd.c.mlock ntp-4.2.6p4/ntpd/ntpd.c
112 --- ntp-4.2.6p4/ntpd/ntpd.c.mlock 2011-10-06 13:08:50.869274334 +0200
113 +++ ntp-4.2.6p4/ntpd/ntpd.c 2011-10-06 13:08:50.911274363 +0200
114 @@ -723,7 +723,8 @@ ntpdmain(
115 }
116 #endif
117
118 -#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE)
119 +#if defined(MCL_CURRENT) && defined(MCL_FUTURE)
120 + if (HAVE_OPT( MLOCK )) {
121 # ifdef HAVE_SETRLIMIT
122 /*
123 * Set the stack limit to something smaller, so that we don't lock a lot
124 @@ -749,7 +750,7 @@ ntpdmain(
125 * fail if we drop root privlege. To be useful the value
126 * has to be larger than the largest ntpd resident set size.
127 */
128 - rl.rlim_cur = rl.rlim_max = 32*1024*1024;
129 + rl.rlim_cur = rl.rlim_max = 64*1024*1024;
130 if (setrlimit(RLIMIT_MEMLOCK, &rl) == -1) {
131 msyslog(LOG_ERR, "Cannot set RLIMIT_MEMLOCK: %m");
132 }
133 @@ -761,6 +762,7 @@ ntpdmain(
134 */
135 if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0)
136 msyslog(LOG_ERR, "mlockall(): %m");
137 + }
138 #else /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */
139 # ifdef HAVE_PLOCK
140 # ifdef PROCLOCK