]> git.pld-linux.org Git - packages/ntp.git/blame - ntp-4.2.4p8-mlock.patch
- restore the background feature
[packages/ntp.git] / ntp-4.2.4p8-mlock.patch
CommitLineData
6fca7355
ER
1diff -up ntp-4.2.4p8/html/ntpd.html.mlock ntp-4.2.4p8/html/ntpd.html
2--- ntp-4.2.4p8/html/ntpd.html.mlock 2009-12-08 17:56:35.000000000 +0100
3+++ ntp-4.2.4p8/html/ntpd.html 2009-12-08 17:56:35.000000000 +0100
4@@ -34,7 +34,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 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. <tt>ntpd</tt> 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.</p>
12 <h4 id="op">How NTP Operates</h4>
13@@ -96,6 +96,8 @@
14 <dd>Specify the name and path of the log file. The default is the system log file. This is the same operation as the <tt>logfile <i>logfile</i></tt> configuration command.
15 <dt><tt>-L</tt>
16 <dd>Do not listen to virtual IPs. The default is to listen.
17+ <dt><tt>-m</tt>
18+ <dd>Lock memory.
19 <dt><tt>-n</tt>
20 <dd>Don't fork.
21 <dt><tt>-N</tt>
22diff -up ntp-4.2.4p8/ntpd/ntpd-opts.c.mlock ntp-4.2.4p8/ntpd/ntpd-opts.c
23--- ntp-4.2.4p8/ntpd/ntpd-opts.c.mlock 2009-12-08 14:13:09.000000000 +0100
24+++ ntp-4.2.4p8/ntpd/ntpd-opts.c 2009-12-08 17:56:35.000000000 +0100
25@@ -264,6 +264,15 @@ tSCC zNice_Name[] = "ni
26 #define NICE_FLAGS (OPTST_DISABLED)
27
28 /*
29+ * Mlock option description:
30+ */
31+tSCC zMlockText[] =
32+ "Lock memory";
33+tSCC zMlock_NAME[] = "MLOCK";
34+tSCC zMlock_Name[] = "mlock";
35+#define MLOCK_FLAGS (OPTST_DISABLED)
36+
37+/*
38 * Pidfile option description:
39 */
40 tSCC zPidfileText[] =
41@@ -789,6 +798,18 @@ static tOptDesc optDesc[ OPTION_CT ] = {
42 OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
43 #endif
44
45+ { /* entry idx, value */ 29, VALUE_OPT_MLOCK,
46+ /* equiv idx, value */ 29, 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@@ -881,7 +902,7 @@ tOptions ntpdOptions = {
61 NO_EQUIVALENT /* index of '-#' option */,
62 NO_EQUIVALENT /* index of default opt */
63 },
64- 32 /* full option count */, 29 /* user option count */
65+ 33 /* full option count */, 30 /* user option count */
66 };
67
68 /*
69diff -up ntp-4.2.4p8/ntpd/ntpd-opts.h.mlock ntp-4.2.4p8/ntpd/ntpd-opts.h
70--- ntp-4.2.4p8/ntpd/ntpd-opts.h.mlock 2009-12-08 14:13:09.000000000 +0100
71+++ ntp-4.2.4p8/ntpd/ntpd-opts.h 2009-12-08 17:56:35.000000000 +0100
72@@ -81,12 +81,13 @@ typedef enum {
73 INDEX_OPT_VAR = 26,
74 INDEX_OPT_DVAR = 27,
75 INDEX_OPT_SLEW = 28,
76- INDEX_OPT_VERSION = 29,
77- INDEX_OPT_HELP = 30,
78- INDEX_OPT_MORE_HELP = 31
79+ INDEX_OPT_MLOCK = 29,
80+ INDEX_OPT_VERSION = 30,
81+ INDEX_OPT_HELP = 31,
82+ INDEX_OPT_MORE_HELP = 32
83 } teOptIndex;
84
85-#define OPTION_CT 32
86+#define OPTION_CT 33
87 #define NTPD_VERSION "4.2.4p8"
88 #define NTPD_FULL_VERSION "ntpd - NTP daemon program - Ver. 4.2.4p8"
89
90@@ -179,6 +180,10 @@ typedef enum {
91 # warning undefining MODIFYMMTIMER due to option name conflict
92 # undef MODIFYMMTIMER
93 # endif
94+# ifdef MLOCK
95+# warning undefining MLOCK due to option name conflict
96+# undef MLOCK
97+# endif
98 # ifdef NOFORK
99 # warning undefining NOFORK due to option name conflict
100 # undef NOFORK
101@@ -248,6 +253,7 @@ typedef enum {
102 # undef LOGFILE
103 # undef NOVIRTUALIPS
104 # undef MODIFYMMTIMER
105+# undef MLOCK
106 # undef NOFORK
107 # undef NICE
108 # undef PIDFILE
109@@ -290,6 +296,7 @@ typedef enum {
110 #ifdef SYS_WINNT
111 #define VALUE_OPT_MODIFYMMTIMER 'M'
112 #endif /* SYS_WINNT */
113+#define VALUE_OPT_MLOCK 'm'
114 #define VALUE_OPT_NOFORK 'n'
115 #define VALUE_OPT_NICE 'N'
116 #define VALUE_OPT_PIDFILE 'p'
117diff -up ntp-4.2.4p8/ntpd/ntpd.c.mlock ntp-4.2.4p8/ntpd/ntpd.c
118--- ntp-4.2.4p8/ntpd/ntpd.c.mlock 2009-12-08 17:56:35.000000000 +0100
119+++ ntp-4.2.4p8/ntpd/ntpd.c 2009-12-08 17:56:35.000000000 +0100
120@@ -691,7 +691,8 @@ ntpdmain(
121 }
122 #endif
123
124-#if defined(HAVE_MLOCKALL) && defined(MCL_CURRENT) && defined(MCL_FUTURE)
125+#if defined(MCL_CURRENT) && defined(MCL_FUTURE)
126+ if (HAVE_OPT( MLOCK )) {
127 # ifdef HAVE_SETRLIMIT
128 /*
129 * Set the stack limit to something smaller, so that we don't lock a lot
130@@ -717,7 +718,7 @@ ntpdmain(
131 * fail if we drop root privlege. To be useful the value
132 * has to be larger than the largest ntpd resident set size.
133 */
134- rl.rlim_cur = rl.rlim_max = 32*1024*1024;
135+ rl.rlim_cur = rl.rlim_max = 64*1024*1024;
136 if (setrlimit(RLIMIT_MEMLOCK, &rl) == -1) {
137 msyslog(LOG_ERR, "Cannot set RLIMIT_MEMLOCK: %m");
138 }
139@@ -729,6 +730,7 @@ ntpdmain(
140 */
141 if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0)
142 msyslog(LOG_ERR, "mlockall(): %m");
143+ }
144 #else /* not (HAVE_MLOCKALL && MCL_CURRENT && MCL_FUTURE) */
145 # ifdef HAVE_PLOCK
146 # ifdef PROCLOCK
This page took 0.062879 seconds and 4 git commands to generate.