]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 2454] Need way to set file descriptor limit - cleanup
authorHarlan Stenn <stenn@ntp.org>
Thu, 8 Aug 2013 08:18:46 +0000 (04:18 -0400)
committerHarlan Stenn <stenn@ntp.org>
Thu, 8 Aug 2013 08:18:46 +0000 (04:18 -0400)
bk: 52035466riJ6I6h15MVUsK-FoKRLcw

ChangeLog
html/miscopt.html
include/ntp_config.h
ntpd/invoke-ntp.conf.texi
ntpd/ntp.conf.5man
ntpd/ntp.conf.5mdoc
ntpd/ntp.conf.def
ntpd/ntp.conf.man.in
ntpd/ntp.conf.mdoc.in
ntpd/ntp_config.c

index 1584357eb134609cb4334e906deba867730f307c..36be415934cedd451860525800b0bdff3893feb3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,11 @@
+* [Bug 2454] Need way to set file descriptor limit - cleanup.
 (4.2.7p381) 2013/08/07 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 2451] rlimit command is missing from the table of contents in
   miscopt.html .
 * [Bug 2452] provide io_handler/input_handler only on
   non HAVE_IO_COMPLETION_PORT platforms
-* [Bug 2453] Need a way to avoid calling mlockall. 
-* [Bug 2454] Need way to set file descriptor limit. 
+* [Bug 2453] Need a way to avoid calling mlockall.
+* [Bug 2454] Need way to set file descriptor limit.
 * [Bug 2458] AM_CONFIG_HEADER is obsolete.
 (4.2.7p380) 2013/08/03 Released by Harlan Stenn <stenn@ntp.org>
 * CID 984511: Some systems have different printf needs for sizeof.
 * Documentation nit cleanup.
 * Documentation updates from Dave Mills.
 (4.2.7p62) 2010/10/12 Released by Harlan Stenn <stenn@ntp.org>
-* [Bug 750] from 4.2.6p3-RC3: Non-existing device causes coredump with 
+* [Bug 750] from 4.2.6p3-RC3: Non-existing device causes coredump with
   RIPE-NCC driver.
 * [Bug 1567] from 4.2.6p3-RC3: Support Arbiter 1093C Satellite Clock on
   Windows.
 * [Bug 1581] from 4.2.6p3-RC3: printf format string mismatch leftover.
 * [Bug 1659] from 4.2.6p3-RC3: Support Truetime Satellite Clocks on
-  Windows. 
+  Windows.
 * [Bug 1660] from 4.2.6p3-RC3: On some systems, test is in /usr/bin, not
-  /bin. 
+  /bin.
 * [Bug 1661] from 4.2.6p3-RC3: Re-indent refclock_ripencc.c.
 * Lose peer_count from ntp_peer.c and ntp_proto.c (Dave Mills).
 * Documentation updates from Dave Mills.
 (4.2.7p25) 2010/04/20 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1528] from 4.2.6p2-RC2: Remove --with-arlib from br-flock.
 * [Bug 1503] [Bug 1504] [Bug 1518] [Bug 1522] from 4.2.6p2-RC2:
-  all of which were fixed in 4.2.7 previously. 
+  all of which were fixed in 4.2.7 previously.
 (4.2.7p24) 2010/04/13 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1390] Control PPS on the Oncore M12.
 * [Bug 1518] Windows ntpd should lock to one processor more
 * [Bug 1479] from 4.2.6p1-RC5: not finding readline headers.
 * [Bug 1484] from 4.2.6p1-RC5: ushort is not defined in QNX6.
 (4.2.7p18) 2010/02/07 Released by Harlan Stenn <stenn@ntp.org>
-* [Bug 1480] from 4.2.6p1-RC5: snprintf() cleanup caused 
+* [Bug 1480] from 4.2.6p1-RC5: snprintf() cleanup caused
   unterminated refclock IDs.
 * Stop using getaddrinfo() to convert numeric address strings to on-wire
   addresses in favor of is_ip_address() alone.
@@ -2273,7 +2274,7 @@ display both build and runtime OpenSSL versions when they differ.
 * add wildcard match class for interface/nic rules.
 * fix mistaken carryover of prefixlen from one rule to the next.
 * Ensure IPv6 localhost address ::1 is included in libisc's Windows IPv6
-  address enumeration, allowing ntpq and ntpdc's hardcoding to 127.0.0.1 
+  address enumeration, allowing ntpq and ntpdc's hardcoding to 127.0.0.1
   on Windows to end.
 (4.2.5p218) 2009/09/21 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1314] saveconfig emits -4 and -6 on when not given.
@@ -2384,7 +2385,7 @@ display both build and runtime OpenSSL versions when they differ.
 (4.2.5p193) 2009/07/25 Released by Harlan Stenn <stenn@ntp.org>
 * [Bug 1261] CID 34: simulate_server() rbuf.msg_flags uninitialized.
 * [Bug 1262] CID 35: xpkt.mac uninitialized in simulate_server().
-* [Bug 1263] CID 37: CID 38: CID 40: CID 43: multiple refclocks 
+* [Bug 1263] CID 37: CID 38: CID 40: CID 43: multiple refclocks
   uninitialized tm_zone (arc, chronolog, dumbclock, pcf).
 * [Bug 1264] CID 64: gsoc_sntp on_wire() frees wrong ptr receiving KoD.
 * [Bug 1265] CID 65: CID 66: gsoc_sntp on_wire() leaks x_pkt, r_pkt.
@@ -2401,7 +2402,7 @@ display both build and runtime OpenSSL versions when they differ.
 * [Bug 1250] CID 53: kod_init_kod_db() overruns kod_db malloc'd buffer.
 * [Bug 1251] CID 68: search_entry() mishandles dst argument.
 * [Bug 1252] CID 32: Quiet Coverity warning with assertion.
-* [Bug 1253] CID 50: gsoc_sntp/crypto.c auth_init() always returns a 
+* [Bug 1253] CID 50: gsoc_sntp/crypto.c auth_init() always returns a
   list with one entry.
 * [Bug 1254] CID 56: tv_to_str() leaks a struct tm each call.
 * [Bug 1255] CID 55: pkt_output() leaks a copy of each packet.
@@ -2880,7 +2881,7 @@ display both build and runtime OpenSSL versions when they differ.
 ---
 (4.2.4p6) 2009/01/08 Released by Harlan Stenn <stenn@ntp.org>
 
-* [Bug 1113] Fixed build errors with recent versions of openSSL. 
+* [Bug 1113] Fixed build errors with recent versions of openSSL.
 * [Sec 1111] Fix incorrect check of EVP_VerifyFinal()'s return value.
 * Update the copyright year.
 
@@ -2949,9 +2950,9 @@ display both build and runtime OpenSSL versions when they differ.
 * Update bugreport URL.
 * Update -I documentation.
 * [Bug 713] Fix bug reporting information.
-* A bug in the application of the negative-sawtooth for 12 channel receivers. 
+* A bug in the application of the negative-sawtooth for 12 channel receivers.
 * The removal of unneeded startup code used for the original LinuxPPS, it now
-  conforms to the PPSAPI and does not need special code.  
+  conforms to the PPSAPI and does not need special code.
 * ntp-keygen.c: Coverity fixes [CID 33,47].
 * Volley cleanup from Dave Mills.
 * Fuzz cleanup from Dave Mills.
@@ -2959,7 +2960,7 @@ display both build and runtime OpenSSL versions when they differ.
 * ntpsim.c: add missing protypes and fix [CID 34], a nit.
 * Upgraded bison at UDel.
 * Update br-flock and flock-build machine lists.
-* [Bug 752] QoS: add parse/config handling code. 
+* [Bug 752] QoS: add parse/config handling code.
 * Fix the #include order in tickadj.c for picky machines.
 * [Bug 752] QoS: On some systems, netinet/ip.h needs netinet/ip_systm.h.
 * [Bug 752] Update the QoS tagging (code only - configuration to follow).
index 28fe2145c20c9c53079f26b0fe0b93a6c7320bb1..6e5fefb889283f5dde91a6402288d1cf04d6b972 100644 (file)
       <dd>Specifies the stepout threshold in seconds. The default without this command is 300 s. Since this option also affects the training and startup intervals, it should not be set less than the default. Further details are on the <a href="clock.html">Clock State Machine</a> page.</dd>
     </dl>
   </dd>
-  <dt id="rlimit"><tt>rlimit [memlock <i>Nmegabytes</i> | stacklimit <i>N4kPages</i>]</tt></dt>
+  <dt id="rlimit"><tt>rlimit [memlock <i>Nmegabytes</i> | stacksize <i>N4kPages</i> | filenum <i>Nfiledescriptors</i>]</tt></dt>
   <dd>This command alters certain process storage allocation limits, and is only available on some operating systems.  Options are are as follows:</dd>
   <dd>
     <dl>
       <dt><tt>memlock <i>Nmegabytes</i></tt></dt>
       <dd>Specify the number of megabytes of memory that can be allocated.  Probably only available under Linux, this option is useful when dropping root (the <tt>-i</tt> option).   The default is 32  megabytes. Setting this to zero will prevent any attemp to lock memory.</dd>
-      <dt><tt>stacklimit <i>N4kPages</i></tt></dt>
+      <dt><tt>stacksize <i>N4kPages</i></tt></dt>
       <dd>Specifies the maximum size of the process stack on systems with the <tt>mlockall()</tt> function. Defaults to 50 4k pages (200 4k pages in OpenBSD).</dd>
-      <dt><tt>filenum <i>N4kPages</i></tt></dt>
+      <dt><tt>filenum <i>Nfiledescriptors</i></tt></dt>
       <dd>Specifies the maximum number of file descriptors ntp may have open at the same time. Defaults to system default.</dd>
     </dl>
   </dd>
index 982594e4c6823627e7d58facebd9cf3f75b5d3f6..900688cef4eed39eca08befd31fec403dcc0c443 100644 (file)
@@ -315,7 +315,7 @@ int dump_config_tree(config_tree *ptree, FILE *df, int comment);
 int dump_all_config_trees(FILE *df, int comment);
 #endif
 
-#if defined(HAVE_MLOCKALL) && defined(HAVE_SETRLIMIT)
+#if defined(HAVE_SETRLIMIT)
 void ntp_rlimit(int, rlim_t, int, char *);
 #endif
 
index ebb1ba72215ba2dfda103d0b1898271fb9d1d487..47d395458ee09068877f98995b49f04f4352a955 100644 (file)
@@ -6,7 +6,7 @@
 #
 # EDIT THIS FILE WITH CAUTION  (invoke-ntp.conf.texi)
 #
-# It has been AutoGen-ed  August  7, 2013 at 11:41:56 AM by AutoGen 5.18.1pre3
+# It has been AutoGen-ed  August  8, 2013 at 04:15:35 AM by AutoGen 5.18.1pre3
 # From the definitions    ntp.conf.def
 # and the template file   agtexi-file.tpl
 @end ignore
@@ -2631,7 +2631,7 @@ be set to any positive number in seconds.
 If set to zero, the stepout
 pulses will not be suppressed.
 @end table
-@item @code{rlimit}Oo@code{memlock} @kbd{Nmegabytes} |@code{stacklimit} @kbd{N4kPages}@code{filenum} @kbd{Nfiledescriptors}Oc
+@item @code{rlimit}Oo@code{memlock} @kbd{Nmegabytes} |@code{stacksize} @kbd{N4kPages}@code{filenum} @kbd{Nfiledescriptors}Oc
 @table @asis
 
 @item @code{memlock} @kbd{Nmegabytes}
@@ -2641,7 +2641,7 @@ when dropping root (the
 @code{-i}
 option).
 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
-@item @code{stacklimit} @kbd{N4kPages}
+@item @code{stacksize} @kbd{N4kPages}
 Specifies the maximum size of the process stack on systems with the
 @item @code{filenum} @kbd{Nfiledescriptors}
 Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
index 6a5549bfbc35d4dc5562244c938b5f895405656f..8982e75f49468d260866962538e36438d914404a 100644 (file)
@@ -1,8 +1,8 @@
-.TH ntp.conf 5man "07 Aug 2013" "4.2.7p381" "File Formats"
+.TH ntp.conf 5man "08 Aug 2013" "4.2.7p381" "File Formats"
 .\"
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.man)
 .\"
-.\"  It has been AutoGen-ed  August  7, 2013 at 11:41:41 AM by AutoGen 5.18.1pre3
+.\"  It has been AutoGen-ed  August  8, 2013 at 04:15:29 AM by AutoGen 5.18.1pre3
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agman-cmd.tpl
 .\"
@@ -2824,7 +2824,7 @@ pulses will not be suppressed.
 .BR Xo Ic rlimit
 .Oo
 .Cm memlock Ar Nmegabytes |
-.Cm stacklimit Ar N4kPages
+.Cm stacksize Ar N4kPages
 .Cm filenum Ar Nfiledescriptors
 .Oc
 .Xc
@@ -2838,7 +2838,7 @@ when dropping root (the
 option).
 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
 .ti -4
-.IR Cm stacklimit Ar N4kPages
+.IR Cm stacksize Ar N4kPages
 Specifies the maximum size of the process stack on systems with the
 .ti -4
 .IR Cm filenum Ar Nfiledescriptors
index a1ab4b9274446357f7c8e0555cfbde7dbfc9a939..986ea79d5a9e554a21338482e72c6b4da49cfc6e 100644 (file)
@@ -1,9 +1,9 @@
-.Dd August 7 2013
+.Dd August 8 2013
 .Dt NTP_CONF 5mdoc File Formats
 .Os SunOS 5.10
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
 .\"
-.\"  It has been AutoGen-ed  August  7, 2013 at 11:42:01 AM by AutoGen 5.18.1pre3
+.\"  It has been AutoGen-ed  August  8, 2013 at 04:15:37 AM by AutoGen 5.18.1pre3
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -2660,7 +2660,7 @@ pulses will not be suppressed.
 .It Xo Ic rlimit
 .Oo
 .Cm memlock Ar Nmegabytes |
-.Cm stacklimit Ar N4kPages
+.Cm stacksize Ar N4kPages
 .Cm filenum Ar Nfiledescriptors
 .Oc
 .Xc
@@ -2672,7 +2672,7 @@ when dropping root (the
 .Fl i
 option).
 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
-.It Cm stacklimit Ar N4kPages
+.It Cm stacksize Ar N4kPages
 Specifies the maximum size of the process stack on systems with the
 .It Cm filenum Ar Nfiledescriptors
 Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
index 8fd3629ae6e339a35d7ad48d8f29f95e9a3ade6e..cd3d6a10fdf9759f8924c347681e92e40e76cf05 100644 (file)
@@ -2662,7 +2662,7 @@ pulses will not be suppressed.
 .It Xo Ic rlimit
 .Oo
 .Cm memlock Ar Nmegabytes |
-.Cm stacklimit Ar N4kPages
+.Cm stacksize Ar N4kPages
 .Cm filenum Ar Nfiledescriptors
 .Oc
 .Xc
@@ -2674,7 +2674,7 @@ when dropping root (the
 .Fl i
 option).
 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
-.It Cm stacklimit Ar N4kPages
+.It Cm stacksize Ar N4kPages
 Specifies the maximum size of the process stack on systems with the
 .It Cm filenum Ar Nfiledescriptors
 Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
index 63c009cd0e7f80c4aec731bb5c55326f4519e6bd..ce35762673898d97d16657a6145ead700f8ffa51 100644 (file)
@@ -1,8 +1,8 @@
-.TH ntp.conf 5 "07 Aug 2013" "4.2.7p381" "File Formats"
+.TH ntp.conf 5 "08 Aug 2013" "4.2.7p381" "File Formats"
 .\"
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.man)
 .\"
-.\"  It has been AutoGen-ed  August  7, 2013 at 11:41:41 AM by AutoGen 5.18.1pre3
+.\"  It has been AutoGen-ed  August  8, 2013 at 04:15:29 AM by AutoGen 5.18.1pre3
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agman-cmd.tpl
 .\"
@@ -2824,7 +2824,7 @@ pulses will not be suppressed.
 .BR Xo Ic rlimit
 .Oo
 .Cm memlock Ar Nmegabytes |
-.Cm stacklimit Ar N4kPages
+.Cm stacksize Ar N4kPages
 .Cm filenum Ar Nfiledescriptors
 .Oc
 .Xc
@@ -2838,7 +2838,7 @@ when dropping root (the
 option).
 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
 .ti -4
-.IR Cm stacklimit Ar N4kPages
+.IR Cm stacksize Ar N4kPages
 Specifies the maximum size of the process stack on systems with the
 .ti -4
 .IR Cm filenum Ar Nfiledescriptors
index d95fc82b0d69e725c3699a9a3ee57f4caf05647e..20c2e7d18c48a0e8cb476fed5540eacb6e0212e8 100644 (file)
@@ -1,9 +1,9 @@
-.Dd August 7 2013
+.Dd August 8 2013
 .Dt NTP_CONF 5 File Formats
 .Os SunOS 5.10
 .\"  EDIT THIS FILE WITH CAUTION  (ntp.mdoc)
 .\"
-.\"  It has been AutoGen-ed  August  7, 2013 at 11:42:01 AM by AutoGen 5.18.1pre3
+.\"  It has been AutoGen-ed  August  8, 2013 at 04:15:37 AM by AutoGen 5.18.1pre3
 .\"  From the definitions    ntp.conf.def
 .\"  and the template file   agmdoc-cmd.tpl
 .Sh NAME
@@ -2660,7 +2660,7 @@ pulses will not be suppressed.
 .It Xo Ic rlimit
 .Oo
 .Cm memlock Ar Nmegabytes |
-.Cm stacklimit Ar N4kPages
+.Cm stacksize Ar N4kPages
 .Cm filenum Ar Nfiledescriptors
 .Oc
 .Xc
@@ -2672,7 +2672,7 @@ when dropping root (the
 .Fl i
 option).
 The default is 32 megabytes. Setting this to zero will prevent any attemp to lock memory.
-.It Cm stacklimit Ar N4kPages
+.It Cm stacksize Ar N4kPages
 Specifies the maximum size of the process stack on systems with the
 .It Cm filenum Ar Nfiledescriptors
 Specifies the maximum number of file descriptors ntpd may have open at once. Defaults to the system default.
index 5cb6d2c222548df5f8b8b856c54b926ffb3c8b60..3ae71a9b423e6c829aa225b3a384796f81839d74 100644 (file)
@@ -2606,7 +2606,7 @@ config_rlimit(
 
                case T_Memlock:
                        if (rlimit_av->value.i != 0) {
-#if defined(HAVE_MLOCKALL) && defined(RLIMIT_MEMLOCK)
+#if defined(RLIMIT_MEMLOCK)
                                ntp_rlimit(RLIMIT_MEMLOCK,
                                           (rlim_t)(rlimit_av->value.i * 1024 * 1024),
                                           1024 * 1024,
@@ -2614,14 +2614,14 @@ config_rlimit(
 #else
                                /* STDERR as well would be fine... */
                                msyslog(LOG_WARNING, "'rlimit memlock' specified but is not available on this system.");
-#endif /* !(HAVE_MLOCKALL && RLIMIT_MEMLOCK) */
+#endif /* RLIMIT_MEMLOCK */
                        } else {
                                do_memlock = 0;
                        }
                        break;
 
                case T_Stacksize:
-#if defined(HAVE_MLOCKALL) && defined(RLIMIT_STACK)
+#if defined(RLIMIT_STACK)
                        ntp_rlimit(RLIMIT_STACK,
                                   (rlim_t)(rlimit_av->value.i * 4096),
                                   4096,
@@ -2629,7 +2629,7 @@ config_rlimit(
 #else
                        /* STDERR as well would be fine... */
                        msyslog(LOG_WARNING, "'rlimit stacksize' specified but is not available on this system.");
-#endif /* !(HAVE_MLOCKALL && RLIMIT_STACK) */
+#endif /* RLIMIT_STACK */
                        break;
 
                case T_Filenum:
@@ -2641,7 +2641,7 @@ config_rlimit(
 #else
                        /* STDERR as well would be fine... */
                        msyslog(LOG_WARNING, "'rlimit filenum' specified but is not available on this system.");
-#endif /* !(RLIMIT_NOFILE) */
+#endif /* RLIMIT_NOFILE */
                        break;
 
                }
@@ -4861,7 +4861,7 @@ getnetnum(
 }
 #endif /* !SIM */
 
-# if defined(HAVE_MLOCKALL) && defined(HAVE_SETRLIMIT)
+#if defined(HAVE_SETRLIMIT)
 void
 ntp_rlimit(
        int     rl_what,
@@ -4873,7 +4873,7 @@ ntp_rlimit(
        struct rlimit   rl;
 
        switch (rl_what) {
-#ifdef RLIMIT_MEMLOCK
+# ifdef RLIMIT_MEMLOCK
            case RLIMIT_MEMLOCK:
                /*
                 * The default RLIMIT_MEMLOCK is very low on Linux systems.
@@ -4887,9 +4887,9 @@ ntp_rlimit(
                if (setrlimit(RLIMIT_MEMLOCK, &rl) == -1)
                        msyslog(LOG_ERR, "Cannot set RLIMIT_MEMLOCK: %m");
                break;
-#endif /* RLIMIT_MEMLOCK */
+# endif /* RLIMIT_MEMLOCK */
 
-#ifdef RLIMIT_NOFILE
+# ifdef RLIMIT_NOFILE
            case RLIMIT_NOFILE:
                /*
                 * For large systems the default file descriptor limit may
@@ -4901,8 +4901,9 @@ ntp_rlimit(
                if (setrlimit(RLIMIT_NOFILE, &rl) == -1)
                        msyslog(LOG_ERR, "Cannot set RLIMIT_NOFILE: %m");
                break;
-#endif /* RLIMIT_NOFILE */
+# endif /* RLIMIT_NOFILE */
 
+# ifdef RLIMIT_STACK
            case RLIMIT_STACK:
                /*
                 * Provide a way to set the stack limit to something
@@ -4927,10 +4928,11 @@ ntp_rlimit(
                        }
                }
                break;
+# endif /* RLIMIT_STACK */
 
            default:
                INSIST(!"Unexpected setrlimit() case!");
                break;
        }
 }
-#  endif       /* ... && HAVE_SETRLIMIT */
+#endif /* HAVE_SETRLIMIT */