[ntpsec commit] On NetBSD, <sys/timex.h> has <sys/time.h> as a prerequisite header.

Eric S. Raymond esr at ntpsec.org
Wed Sep 30 09:40:43 UTC 2015


Module:    ntpsec
Branch:    master
Commit:    1877648e9eb56f3e859296a9b2d22f0973e90828
Changeset: http://git.ntpsec.org/ntpsec/commit/?id=1877648e9eb56f3e859296a9b2d22f0973e90828

Author:    Eric S. Raymond <esr at thyrsus.com>
Date:      Wed Sep 30 05:39:48 2015 -0400

On NetBSD, <sys/timex.h> has <sys/time.h> as a prerequisite header.

---

 devel-docs/hacking.txt | 13 +++++++++----
 include/ntp_syscall.h  |  1 +
 libntp/socket.c        | 12 +++++++-----
 libntp/work_thread.c   |  4 +++-
 ntpd/ntp_io.c          | 12 ++++++------
 util/kern.c            |  1 +
 util/tickadj.c         |  1 +
 7 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/devel-docs/hacking.txt b/devel-docs/hacking.txt
index 1f02c0c..bbbd354 100644
--- a/devel-docs/hacking.txt
+++ b/devel-docs/hacking.txt
@@ -61,6 +61,10 @@ Parts of this code are a thicket of C preprocessor conditionals.
 In an attempt to make these halfway comprehensible, we use the
 following conventions to distinguish classes of macro names:
 
+ENABLE_*::
+	Gates the code for an optional feature.  Set by a switch on
+	the "waf configure" invocation.
+
 GUARD_*::
 	Symbols with thie GUARD_ prefix are idempotency guards - that is,
 	they're used to nullify inclusions of a header file
@@ -83,15 +87,16 @@ NEED_*::
 	function, but instead have to be probed for by some ad-hoc
 	test in waf configure.
 
+OVERRIDE_*::
+	Override a default for debugging purposes. These are values
+	(buffer lengths and the like) which waf is not expected to
+	normally override but which might need to be forced.
+
 USE_*::
 	Use symbols are set internally within other conditionals to
 	gate use of sections of code that must be conditionally
 	compiled deoending on *combinations* of HAVE and NEED symbols.
 
-FEATURE_*::
-	Gates the code for an optional feature.  Set by a switch on
-	the "waf configure" invocation.
-
 === Cross-platform portability ===
 
 Do not bake in any assumptions about 32-vs-64-bit word size.  It is OK
diff --git a/include/ntp_syscall.h b/include/ntp_syscall.h
index cfa038f..fd3d7c1 100644
--- a/include/ntp_syscall.h
+++ b/include/ntp_syscall.h
@@ -7,6 +7,7 @@
 #define GUARD_NTP_SYSCALL_H
 
 #ifdef HAVE_SYS_TIMEX_H
+# include <sys/time.h>	/* prerequisite on NetBSD */
 # include <sys/timex.h>
 #endif
 
diff --git a/libntp/socket.c b/libntp/socket.c
index 00e0819..f4b2981 100644
--- a/libntp/socket.c
+++ b/libntp/socket.c
@@ -54,12 +54,12 @@ move_fd(
 	)
 {
 #if !defined(SYS_WINNT) && defined(F_DUPFD)
-#ifndef FD_CHUNK
+#ifdef OVERRIDE_FD_CHUNK
+#define FD_CHUNK	OVERRIDE_FD_CHUNK
+#else
 #define FD_CHUNK	10
 #endif
-#ifndef FOPEN_MAX
-#define FOPEN_MAX	20
-#endif
+
 /*
  * number of fds we would like to have for
  * stdio FILE* available.
@@ -69,7 +69,9 @@ move_fd(
  * we don't keep the other FILE* open beyond the
  * scope of the function that opened it.
  */
-#ifndef FD_PREFERRED_SOCKBOUNDARY
+#ifdef OVERRIDE_FD_PREFERRED_SOCKBOUNDARY
+#define FD_PREFERRED_SOCKBOUNDARY OVERRIDE_FD_PREFERRED_SOCKBOUNDARY
+#else
 #define FD_PREFERRED_SOCKBOUNDARY 48
 #endif
 
diff --git a/libntp/work_thread.c b/libntp/work_thread.c
index a320781..109110d 100644
--- a/libntp/work_thread.c
+++ b/libntp/work_thread.c
@@ -28,7 +28,9 @@
 #define WORKITEMS_ALLOC_INC	16
 #define RESPONSES_ALLOC_INC	4
 
-#ifndef THREAD_MINSTACKSIZE
+#ifdef OVERRIDE_THREAD_MINSTACKSIZE
+#define THREAD_MINSTACKSIZE OVERRIDE_THREAD_MINSTACKSIZE
+#else
 #define THREAD_MINSTACKSIZE	(64U * 1024)
 #endif
 
diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c
index 38f41c1..0216ef9 100644
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -99,24 +99,24 @@ nic_rule *nic_rule_list;
 #if defined(SO_BINTIME) && defined(SCM_BINTIME) && defined(CMSG_FIRSTHDR)
 #  define USE_PACKET_TIMESTAMP
 #  define USE_SCM_BINTIME
-#  ifdef BINTIME_CTLMSGBUF_SIZE
-#   define CMSG_BUFSIZE BINTIME_CTLMSGBUF_SIZE
+#  ifdef OVERRIDE_BINTIME_CTLMSGBUF_SIZE
+#   define CMSG_BUFSIZE OVERRIDE_BINTIME_CTLMSGBUF_SIZE
 #  else
 #   define CMSG_BUFSIZE  1536 /* moderate default */
 #  endif
 #elif defined(SO_TIMESTAMPNS) && defined(SCM_TIMESTAMPNS) && defined(CMSG_FIRSTHDR)
 #  define USE_PACKET_TIMESTAMP
 #  define USE_SCM_TIMESTAMPNS
-#  ifdef TIMESTAMPNS_CTLMSGBUF_SIZE
-#   define CMSG_BUFSIZE TIMESTAMPNS_CTLMSGBUF_SIZE
+#  ifdef OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
+#   define CMSG_BUFSIZE OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
 #  else
 #   define CMSG_BUFSIZE  1536 /* moderate default */
 #  endif
 #elif defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP) && defined(CMSG_FIRSTHDR)
 #  define USE_PACKET_TIMESTAMP
 #  define USE_SCM_TIMESTAMP
-#  ifdef TIMESTAMP_CTLMSGBUF_SIZE
-#   define CMSG_BUFSIZE TIMESTAMP_CTLMSGBUF_SIZE
+#  ifdef OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
+#   define CMSG_BUFSIZE OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
 #  else
 #   define CMSG_BUFSIZE  1536 /* moderate default */
 #  endif
diff --git a/util/kern.c b/util/kern.c
index df7f9f6..5caa07a 100644
--- a/util/kern.c
+++ b/util/kern.c
@@ -12,6 +12,7 @@
 #include <sys/time.h>
 
 #ifdef HAVE_SYS_TIMEX_H
+# include <sys/time.h>	/* prerequisite on NetBSD */
 # include "sys/timex.h"
 #endif
 
diff --git a/util/tickadj.c b/util/tickadj.c
index 2df0b17..8547eb4 100644
--- a/util/tickadj.c
+++ b/util/tickadj.c
@@ -17,6 +17,7 @@
 #ifndef HAVE_ADJTIMEX
 #error This program requires the adjtimex(2) system call.
 #else
+# include <sys/time.h>	/* prerequisite on NetBSD */
 # include <sys/timex.h>
 
 static struct timex txc;



More information about the vc mailing list