[Git][NTPsec/ntpsec][master] 2 commits: Bring ifdex-ignores up to date.

Eric S. Raymond gitlab at mg.gitlab.com
Mon Sep 12 17:36:25 UTC 2016


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
ec175570 by Eric S. Raymond at 2016-09-12T12:48:16-04:00
Bring ifdex-ignores up to date.

We still need to deal with HAVE_IO_COMPLETION_PORT.

- - - - -
950f8390 by Eric S. Raymond at 2016-09-12T13:17:55-04:00
Remove HAVE_IO_COMPLETION_PORT code.

In theory this general approach might have worked on. e.g., Solaris 10 and AIX.
In practice the handler code was Windows only, and there are good reasons
not to do it this way.

First, it's not clear asynchronous I/O is any win at all under modern
conditions. The disadvantage is that it's a complexity and defect
attractor; the advantage is reducing average latency and jitter due to
processing time in a synchronous I/O loop. In past times, with slower
processors, this was a serious issue.

But in 2016 we know from field experience that synchronous I/O produces
good NTP performance on Unix systems that don't do asynchronous
I/O.  Thus, it can be dropped.

If the standards for "good performance" rise to the point where we
want asynchronous I/O again, the right way to do it will not with
an OS-specific extension but with POSIX threads or some other
portable mechanism.

- - - - -


16 changed files:

- devel/TODO
- devel/ifdex-ignores
- include/ntp_io.h
- include/ntp_refclock.h
- include/ntp_worker.h
- include/ntpd.h
- include/recvbuff.h
- libntp/ntp_worker.c
- libntp/recvbuff.c
- ntpd/ntp_io.c
- ntpd/ntp_refclock.c
- ntpd/ntp_sandbox.c
- ntpd/ntp_timer.c
- ntpd/ntpd.c
- ntpd/refclock_generic.c
- wafhelpers/configure.py


Changes:

=====================================
devel/TODO
=====================================
--- a/devel/TODO
+++ b/devel/TODO
@@ -31,6 +31,9 @@
   adjtimex(2). We need to collect statistics on builds with and
   without the PLL to see if it's actually a win.
 
+* Hal points out that with signaled I/O gone, we can probably cut out
+  the buffer-pool code in tha daemon.
+
 === Testing ===
 
 * Unit testing.  "waf check" needs to run all the unit tests, not


=====================================
devel/ifdex-ignores
=====================================
--- a/devel/ifdex-ignores
+++ b/devel/ifdex-ignores
@@ -13,6 +13,7 @@
 # These are potential feature configuration symbols
 ENABLE_ASYMMETRIC	# Enable deep-space asymmetric mode in the protocol 
 ENABLE_ONCORE_SHMEM	# Should OnCore report via shmem?
+ENABLE_KILL_ON_TRAP	# Die on seccomp trap
 MSSNTP_PATH		# Set a default path for the MSSNTP feature.
 NTP_VAR			# Path to NTP statistics directory
 
@@ -62,7 +63,13 @@ ENABLE_LOCKCLOCK
 ENABLE_MDNS_REGISTRATION
 ENABLE_MSSNTP
 HAVE_LINUX_CAPABILITY
+HAVE_OPENSSL
+HAVE_SECCOMP
+HAVE_SECCOMP_H
 HAVE_SOLARIS_PRIVS
+ISC_PLATFORM_NORETURN_POST
+ISC_PLATFORM_NORETURN_PRE
+PLATFORM_OPENBSD
 WORDS_BIGENDIAN
 
 # libsodium
@@ -75,6 +82,7 @@ sodium_utils_H
 SYS_getrandom
 randombytes_H
 randombytes_sysrandom_H
+ULONG_LONG_MAX
 
 # Overrides
 OVERRIDE_BINTIME_CTLMSGBUF_SIZE
@@ -93,6 +101,11 @@ DAY_GPS_STARTS
 DAY_NTP_STARTS
 DSTMINUTES
 
+# Conditionals for unit tests
+TEST_LIBNTP
+TEST_NTPD
+TEST_NTPDIG
+
 # Purely internal symbols
 CONFIG_H
 BITSPERCHAR		# Only used in the Arcron refclock
@@ -175,7 +188,7 @@ lifr_addrlen		# ISC interface-iterator code
 mac			# Avoid name conflict.
 ntohl			# In Windows port config
 realloc			# Internal to Unity
-sgi			# ISC interface-iterator code
+sem_timedwait		# In worker-thread code
 short			# In ntpd/ntp_parser.tab.c
 size_t			# In ntpd/ntp_parser.tab.c
 timercmp		# Only used in include/parse.h


=====================================
include/ntp_io.h
=====================================
--- a/include/ntp_io.h
+++ b/include/ntp_io.h
@@ -47,11 +47,7 @@ extern void	sau_from_netaddr(sockaddr_u *, const isc_netaddr_t *);
 extern void	add_nic_rule(nic_rule_match match_type,
 			     const char *if_name, int prefixlen,
 			     nic_rule_action action);
-#ifndef HAVE_IO_COMPLETION_PORT
 extern	void	maintain_activefds(int fd, int closing);
-#else
-#define		maintain_activefds(f, c)	do {} while (0)
-#endif
 
 /* hack to ignore GCC Unused Result */
 #define IGNORE(r) do{if(r){}}while(0)


=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -86,10 +86,6 @@ struct refclockio {
 	int	fd;		/* file descriptor */
 	u_long	recvcount;	/* count of receive completions */
 	bool	active;		/* true when in use */
-
-#ifdef HAVE_IO_COMPLETION_PORT
-	void *	device_context;	/* device-related data for i/o subsystem */
-#endif
 };
 
 /*
@@ -107,10 +103,6 @@ struct refclockbug {
 	l_fp	times[NCLKBUGTIMES]; /* real times */
 };
 
-#ifdef HAVE_IO_COMPLETION_PORT
-extern	HANDLE	WaitableIoEventHandle;
-#endif
-
 /*
  * Structure interface between the reference clock support
  * ntp_refclock.c and the driver utility routines


=====================================
include/ntp_worker.h
=====================================
--- a/include/ntp_worker.h
+++ b/include/ntp_worker.h
@@ -126,12 +126,10 @@ extern	int	worker_sleep(blocking_child *, time_t);
 extern	void	worker_idle_timer_fired(void);
 extern	void	interrupt_worker_sleep(void);
 extern	int	req_child_exit(blocking_child *);
-#ifndef HAVE_IO_COMPLETION_PORT
 extern	int	pipe_socketpair(int fds[2], bool *is_pipe);
 extern	void	close_all_beyond(int);
 extern	void	close_all_except(int);
 extern	void	kill_asyncio	(int);
-#endif
 
 # ifdef USE_WORK_PIPE
 typedef	void	(*addremove_io_fd_func)(int, int, int);


=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -109,9 +109,7 @@ extern	endpt *	findbcastinter		(sockaddr_u *);
 extern	void	enable_broadcast	(endpt *, sockaddr_u *);
 extern	void	enable_multicast_if	(endpt *, sockaddr_u *);
 extern	void	interface_update	(interface_receiver_t, void *);
-#ifndef HAVE_IO_COMPLETION_PORT
 extern  void    io_handler              (void);
-#endif
 extern	void	init_io 	(void);
 extern  SOCKET	open_socket	(sockaddr_u *, bool, bool, endpt *);
 extern	void	io_open_sockets	(void);


=====================================
include/recvbuff.h
=====================================
--- a/include/recvbuff.h
+++ b/include/recvbuff.h
@@ -13,25 +13,12 @@
 #define RECV_INC	5	/* get 5 more at a time */
 #define RECV_TOOMANY	40	/* this is way too many buffers */
 
-#if defined HAVE_IO_COMPLETION_PORT
-# include "ntp_iocompletionport.h"
-# include "ntp_timer.h"
-
-# define RECV_BLOCK_IO()	EnterCriticalSection(&RecvCritSection)
-# define RECV_UNBLOCK_IO()	LeaveCriticalSection(&RecvCritSection)
-
-/*  Return the event which is set when items are added to the full list
- */
-extern HANDLE	get_recv_buff_event(void);
-#else
-# define RECV_BLOCK_IO()	
-# define RECV_UNBLOCK_IO()	
-#endif
-
-
 /*
- * Format of a recvbuf.  These are used by the asynchronous receive
- * routine to store incoming packets and related information.
+ * Format of a recvbuf.  Back when this code did true asynchronous
+ * I/O, these were used by the asynchronous receive routine to store
+ * incoming packets and related information. Now, with faster processor
+ * and lower latency in the synchronous I/O loop, that complexity
+ * has been dropped.
  */
 
 /*
@@ -54,11 +41,7 @@ struct recvbuf {
 	} X_from_where;
 #define recv_srcadr		X_from_where.X_recv_srcadr
 #define recv_peer		X_from_where.X_recv_peer
-#ifndef HAVE_IO_COMPLETION_PORT
 	sockaddr_u	srcadr;		/* where packet came from */
-#else
-	int		recv_srcadr_len;/* filled in on completion */
-#endif
 	endpt *		dstadr;		/* address pkt arrived on */
 	SOCKET		fd;		/* fd on which it was received */
 	int		cast_flags;	/* unicast/broadcast/manycast mode */


=====================================
libntp/ntp_worker.c
=====================================
--- a/libntp/ntp_worker.c
+++ b/libntp/ntp_worker.c
@@ -28,7 +28,6 @@ int			worker_per_query;	/* boolean */
 int			intres_req_pending;
 
 
-#ifndef HAVE_IO_COMPLETION_PORT
 /*
  * pipe_socketpair()
  *
@@ -118,8 +117,6 @@ close_all_beyond(
 		close(fd);
 # endif	/* !HAVE_CLOSEFROM && !F_CLOSEM */
 }
-#endif	/* HAVE_IO_COMPLETION_PORT */
-
 
 u_int
 available_blocking_child_slot(void)


=====================================
libntp/recvbuff.c
=====================================
--- a/libntp/recvbuff.c
+++ b/libntp/recvbuff.c
@@ -178,23 +178,6 @@ get_free_recv_buffer(void)
 }
 
 
-#ifdef HAVE_IO_COMPLETION_PORT
-recvbuf_t *
-get_free_recv_buffer_alloc(void)
-{
-	recvbuf_t *buffer;
-	
-	buffer = get_free_recv_buffer();
-	if (NULL == buffer) {
-		create_buffers(RECV_INC);
-		buffer = get_free_recv_buffer();
-	}
-	NTP_ENSURE(buffer != NULL);
-	return (buffer);
-}
-#endif
-
-
 recvbuf_t *
 get_full_recv_buffer(void)
 {


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -231,7 +231,7 @@ struct vsock {
 
 vsock_t	*fd_list;
 
-#if !defined(HAVE_IO_COMPLETION_PORT) && defined(USE_ROUTING_SOCKET)
+#if defined(USE_ROUTING_SOCKET)
 /*
  * async notification processing (e. g. routing sockets)
  */
@@ -253,7 +253,7 @@ static struct asyncio_reader *new_asyncio_reader (void);
 static void add_asyncio_reader (struct asyncio_reader *, enum desc_type);
 static void remove_asyncio_reader (struct asyncio_reader *);
 
-#endif /* !defined(HAVE_IO_COMPLETION_PORT) && defined(USE_ROUTING_SOCKET) */
+#endif /* defined(USE_ROUTING_SOCKET) */
 
 static void init_async_notifications (void);
 
@@ -312,7 +312,6 @@ static int		cmp_addr_distance(const sockaddr_u *,
 /*
  * Routines to read the ntp packets
  */
-#if !defined(HAVE_IO_COMPLETION_PORT)
 static inline int	read_network_packet	(SOCKET, struct interface *, l_fp);
 static void		ntpd_addremove_io_fd	(int, int, int);
 typedef void (input_handler_t)(l_fp *);
@@ -320,11 +319,8 @@ static input_handler_t  input_handler;
 #ifdef REFCLOCK
 static inline int	read_refclock_packet	(SOCKET, struct refclockio *, l_fp);
 #endif
-#endif
-
 
 
-#ifndef HAVE_IO_COMPLETION_PORT
 void
 maintain_activefds(
 	int fd,
@@ -355,7 +351,6 @@ maintain_activefds(
 		}
 	}
 }
-#endif	/* !HAVE_IO_COMPLETION_PORT */
 
 
 #ifdef ENABLE_DEBUG_TIMING
@@ -555,7 +550,7 @@ print_interface(const endpt *iface, const char *pfx, const char *sfx)
 }
 #endif
 
-#if !defined(HAVE_IO_COMPLETION_PORT) && defined(USE_ROUTING_SOCKET)
+#if defined(USE_ROUTING_SOCKET)
 /*
  * create an asyncio_reader structure
  */
@@ -611,7 +606,7 @@ remove_asyncio_reader(
 
 	reader->fd = INVALID_SOCKET;
 }
-#endif /* !defined(HAVE_IO_COMPLETION_PORT) && defined(USE_ROUTING_SOCKET) */
+#endif /* defined(USE_ROUTING_SOCKET) */
 
 
 /* compare two sockaddr prefixes */
@@ -2022,13 +2017,8 @@ create_sockets(
 	u_short port
 	)
 {
-#ifndef HAVE_IO_COMPLETION_PORT
-	/*
-	 * I/O Completion Ports don't care about the select and FD_SET
-	 */
 	maxactivefd = 0;
 	FD_ZERO(&activefds);
-#endif
 
 	DPRINTF(2, ("create_sockets(%d)\n", port));
 
@@ -2961,15 +2951,6 @@ open_socket(
 	DPRINTF(4, ("flags for fd %d: 0x%x\n", fd, fcntl(fd, F_GETFL, 0)));
 #endif
 
-#if defined (HAVE_IO_COMPLETION_PORT)
-/*
- * Add the socket to the completion port
- */
-	if (io_completion_port_add_socket(fd, interf)) {
-		msyslog(LOG_ERR, "unable to set up io completion port: %m;  EXITING");
-		exit(1);
-	}
-#endif
 	return fd;
 }
 
@@ -3071,7 +3052,6 @@ sendpkt(
 }
 
 
-#if !defined(HAVE_IO_COMPLETION_PORT)
 /*
  * fdbits - generate ascii representation of fd_set (FAU debug support)
  * HFDF format - highest fd first.
@@ -3701,7 +3681,6 @@ input_handler(
     ih_return:
 	return;
 }
-#endif /* !HAVE_IO_COMPLETION_PORT */
 
 
 /*
@@ -4177,12 +4156,6 @@ io_addclock(
 	 */
 	rio->active = true;
 
-# if defined(HAVE_IO_COMPLETION_PORT)
-	if (io_completion_port_add_clock_io(rio)) {
-		return false;
-	}
-# endif
-
 	/*
 	 * enqueue
 	 */


=====================================
ntpd/ntp_refclock.c
=====================================
--- a/ntpd/ntp_refclock.c
+++ b/ntpd/ntp_refclock.c
@@ -681,30 +681,6 @@ indicate_refclock_packet(
  * is used. This is acting as a trampoline to make the
  * real calls to the refclock functions.
  */
-#ifdef HAVE_IO_COMPLETION_PORT
-void
-process_refclock_packet(
-	struct recvbuf * rb
-	)
-{
-	struct refclockio * rio;
-
-	/* get the refclockio structure from the receive buffer */
-	rio  = &rb->recv_peer->procptr->io;
-
-	/* call 'clock_recv' if either there is no input function or the
-	 * raw input function tells us to feed the packet to the
-	 * receiver.
-	 */
-	if (rio->io_input == NULL || (*rio->io_input)(rb) != 0) {
-		rio->recvcount++;
-		packets_received++;
-		handler_pkts++;		
-		(*rio->clock_recv)(rb);
-	}
-}
-#endif	/* HAVE_IO_COMPLETION_PORT */
-
 
 /*
  * refclock_open - open serial port for reference clock


=====================================
ntpd/ntp_sandbox.c
=====================================
--- a/ntpd/ntp_sandbox.c
+++ b/ntpd/ntp_sandbox.c
@@ -268,7 +268,7 @@ getgroup:
 // #if defined(HAVE_SECCOMP) && (defined(__x86_64__) || defined(__i386__))
 #if defined(HAVE_SECCOMP)
 
-#ifdef KILLonTRAP
+#ifdef ENABLE_KILL_ON_TRAP
   #define MY_SCMP_ACT SCMP_ACT_KILL
 #else
   #define MY_SCMP_ACT SCMP_ACT_TRAP


=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -10,11 +10,6 @@
 #include "ntp_leapsec.h"
 #include "ntp_intercept.h"
 
-#if defined(HAVE_IO_COMPLETION_PORT)
-# include "ntp_iocompletionport.h"
-# include "ntp_timer.h"
-#endif
-
 #include <stdio.h>
 #include <signal.h>
 #include <unistd.h>


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -931,15 +931,6 @@ static void mainloop(void)
 
 	init_timer();
 
-# ifdef HAVE_IO_COMPLETION_PORT
-	for (;;) {
-#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGTERM)
-		if (signalled)
-			finish_safe(signo);
-#endif
-		GetReceivedBuffers();
-# else /* normal I/O */
-
 	was_alarmed = false;
 
 	for (;;) {
@@ -973,8 +964,6 @@ static void mainloop(void)
 			was_alarmed = false;
 		}
 
-# endif		/* !HAVE_IO_COMPLETION_PORT */
-
 # ifdef ENABLE_DEBUG_TIMING
 		{
 			l_fp pts;


=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -1913,9 +1913,7 @@ local_input(
 						sizeof(parsetime_t));
 					buf->recv_length  = sizeof(parsetime_t);
 					buf->recv_time    = rbufp->recv_time;
-#ifndef HAVE_IO_COMPLETION_PORT
 					buf->srcadr       = rbufp->srcadr;
-#endif
 					buf->dstadr       = rbufp->dstadr;
 					buf->receiver     = rbufp->receiver;
 					buf->fd           = rbufp->fd;
@@ -1923,9 +1921,6 @@ local_input(
 					parse->generic->io.recvcount++;
 					packets_received++;
 					add_full_recv_buffer(buf);
-#ifdef HAVE_IO_COMPLETION_PORT
-					SetEvent(WaitableIoEventHandle);
-#endif
 				}
 				parse_iodone(&parse->parseio);
 			}


=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -290,6 +290,7 @@ def cmd_configure(ctx, config):
                 ('clock_settime', ["time.h"], "RT"),
                 ('EVP_MD_do_all_sorted', ["openssl/evp.h"], "CRYPTO"),
                 ('getclock', ["sys/timers.h"]),
+		('getdtablesize', ["unistd.h"]),
                 ('getpassphrase', ["stdlib.h"]),                # Sun systems
                 ('getrusage', ["sys/time.h", "sys/resource.h"]),
                 ('MD5Init', ["md5.h"], "CRYPTO"),
@@ -326,6 +327,8 @@ def cmd_configure(ctx, config):
         # Some of these are cruft from ancient big-iron systems and should
         # be removed.
         optional_headers = (
+		"alloca.h",
+		"arpa/nameser.h",
                 "dns_sd.h",             # NetBSD, Apple, mDNS
                 ("ifaddrs.h", ["sys/types.h"]),
                 "libscf.h",             # Solaris



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/b8f4989e9748a2b4893dc0c7cc0fdfd965ed9ee0...950f8390012de0b3711430aa180b1d84151b753e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160912/3d19b977/attachment.html>


More information about the vc mailing list