Thu Mar 3 18:51:38 2022 UTC ()
Pullup ticket #6586 - requested by gutteridge
net/bind916: SunOS build fix

Revisions pulled up:
- net/bind916/distinfo                                          1.31
- net/bind916/patches/patch-lib_isc_unix_socket.c               1.7

---
   Module Name:    pkgsrc
   Committed By:   gutteridge
   Date:           Thu Feb 17 15:37:26 UTC 2022

   Modified Files:
           pkgsrc/net/bind916: distinfo
           pkgsrc/net/bind916/patches: patch-lib_isc_unix_socket.c

   Log Message:
   bind916: fix builds on Solaris derivates

   A patch fixing SunOS builds was lost during a recent update, restore
   it. (And s/SmartOS/SunOS/ in comment, this doesn't just affect SmartOS,
   reproduced and fixed on OmniOS. This package also fails to build on
   Linux, but that's another issue entirely.) Addresses PR pkg/56716 from
   Russell Hansen.


(bsiegert)
diff -r1.29 -r1.29.2.1 pkgsrc/net/bind916/distinfo
diff -r1.6 -r1.6.2.1 pkgsrc/net/bind916/patches/patch-lib_isc_unix_socket.c

cvs diff -r1.29 -r1.29.2.1 pkgsrc/net/bind916/distinfo (expand / switch to unified diff)

--- pkgsrc/net/bind916/distinfo 2021/12/15 14:18:32 1.29
+++ pkgsrc/net/bind916/distinfo 2022/03/03 18:51:38 1.29.2.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.29 2021/12/15 14:18:32 he Exp $ 1$NetBSD: distinfo,v 1.29.2.1 2022/03/03 18:51:38 bsiegert Exp $
2 2
3BLAKE2s (bind-9.16.24.tar.xz) = b8a19bfbbc8a4c0beafa6fa98f879fbcda800bfa7b10e8eb391e0d0d889cefad 3BLAKE2s (bind-9.16.24.tar.xz) = b8a19bfbbc8a4c0beafa6fa98f879fbcda800bfa7b10e8eb391e0d0d889cefad
4SHA512 (bind-9.16.24.tar.xz) = a982bcad8c517dbcb81e768486e1a8b92e495efcf45c4961170c3bc7fac837903605dcd05cfb9b9e1074599b90be1b9c3dbca4162ede0a32fe4c3405ad92816b 4SHA512 (bind-9.16.24.tar.xz) = a982bcad8c517dbcb81e768486e1a8b92e495efcf45c4961170c3bc7fac837903605dcd05cfb9b9e1074599b90be1b9c3dbca4162ede0a32fe4c3405ad92816b
5Size (bind-9.16.24.tar.xz) = 5070180 bytes 5Size (bind-9.16.24.tar.xz) = 5070180 bytes
6SHA1 (patch-bin_dig_dighost.c) = b1073911d80ecd519af98b6678968296ff8c0c98 6SHA1 (patch-bin_dig_dighost.c) = b1073911d80ecd519af98b6678968296ff8c0c98
7SHA1 (patch-bin_dig_include_dig_dig.h) = 10166f5bb98b208c7b10d63eb31e8253f704acc8 7SHA1 (patch-bin_dig_include_dig_dig.h) = 10166f5bb98b208c7b10d63eb31e8253f704acc8
8SHA1 (patch-bin_named_Makefile.in) = f1367da6a226ba44d0ee13acf00b8abeb5b1b7eb 8SHA1 (patch-bin_named_Makefile.in) = f1367da6a226ba44d0ee13acf00b8abeb5b1b7eb
9SHA1 (patch-bin_named_main.c) = f00842529ec2015e0969d0dba58a1e13a510f9eb 9SHA1 (patch-bin_named_main.c) = f00842529ec2015e0969d0dba58a1e13a510f9eb
10SHA1 (patch-bin_named_server.c) = 6e59d3f637ebb829eec2f76ba7c350fb5cf9be6d 10SHA1 (patch-bin_named_server.c) = 6e59d3f637ebb829eec2f76ba7c350fb5cf9be6d
11SHA1 (patch-bin_named_unix_os.c) = fe9cde1240107151c5b10ba325c8f994ef76852d 11SHA1 (patch-bin_named_unix_os.c) = fe9cde1240107151c5b10ba325c8f994ef76852d
12SHA1 (patch-bin_nsupdate_nsupdate.c) = 4ccd0e503a972cf16905e999bcc574f8ee0dd85d 12SHA1 (patch-bin_nsupdate_nsupdate.c) = 4ccd0e503a972cf16905e999bcc574f8ee0dd85d
13SHA1 (patch-bin_pkcs11_pkcs11-keygen.c) = d953bf48aadcdf7e95975d335167cc50f54ef91e 13SHA1 (patch-bin_pkcs11_pkcs11-keygen.c) = d953bf48aadcdf7e95975d335167cc50f54ef91e
14SHA1 (patch-bin_tools_nsec3hash.c) = 87c3891db62c45cd8ed2b484b17f7bf2e319bef3 14SHA1 (patch-bin_tools_nsec3hash.c) = 87c3891db62c45cd8ed2b484b17f7bf2e319bef3
@@ -38,24 +38,24 @@ SHA1 (patch-lib_dns_zone.c) = cd7bc1e76c @@ -38,24 +38,24 @@ SHA1 (patch-lib_dns_zone.c) = cd7bc1e76c
38SHA1 (patch-lib_isc_app.c) = 1c75ba0db1e7978b37e22742bf69a216ca9a23ef 38SHA1 (patch-lib_isc_app.c) = 1c75ba0db1e7978b37e22742bf69a216ca9a23ef
39SHA1 (patch-lib_isc_backtrace.c) = 1b6bca9b3de7f7298882c6c88274b0baf1dad507 39SHA1 (patch-lib_isc_backtrace.c) = 1b6bca9b3de7f7298882c6c88274b0baf1dad507
40SHA1 (patch-lib_isc_include_isc_netmgr.h) = 48ac44c6a9b81e6b442deba6c075653d3691464b 40SHA1 (patch-lib_isc_include_isc_netmgr.h) = 48ac44c6a9b81e6b442deba6c075653d3691464b
41SHA1 (patch-lib_isc_include_isc_socket.h) = 8da4ab9c12090199914aa6826e212b0aa861a4f1 41SHA1 (patch-lib_isc_include_isc_socket.h) = 8da4ab9c12090199914aa6826e212b0aa861a4f1
42SHA1 (patch-lib_isc_include_isc_types.h) = e5fcf15ee03d1d032a67f2e6d23b2e409042ab64 42SHA1 (patch-lib_isc_include_isc_types.h) = e5fcf15ee03d1d032a67f2e6d23b2e409042ab64
43SHA1 (patch-lib_isc_netmgr_netmgr-int.h) = 9f493b33e00f09f45c78b6a66ebf7bfd52083792 43SHA1 (patch-lib_isc_netmgr_netmgr-int.h) = 9f493b33e00f09f45c78b6a66ebf7bfd52083792
44SHA1 (patch-lib_isc_netmgr_netmgr.c) = 3df1d37061f6ceb37e309a0dc4f782fc35863146 44SHA1 (patch-lib_isc_netmgr_netmgr.c) = 3df1d37061f6ceb37e309a0dc4f782fc35863146
45SHA1 (patch-lib_isc_rwlock.c) = 1d114248ddee20db7a7429afab446f8b2f0dca82 45SHA1 (patch-lib_isc_rwlock.c) = 1d114248ddee20db7a7429afab446f8b2f0dca82
46SHA1 (patch-lib_isc_siphash.c) = 8999deb002e4fdb6b13e6f297298ef73c97042c3 46SHA1 (patch-lib_isc_siphash.c) = 8999deb002e4fdb6b13e6f297298ef73c97042c3
47SHA1 (patch-lib_isc_stats.c) = 8d962fa360740770588fccf1d303d7fe22ae724b 47SHA1 (patch-lib_isc_stats.c) = 8d962fa360740770588fccf1d303d7fe22ae724b
48SHA1 (patch-lib_isc_timer.c) = aea2019bbf3d84cad77af432a2bbdf0da8f2f893 48SHA1 (patch-lib_isc_timer.c) = aea2019bbf3d84cad77af432a2bbdf0da8f2f893
49SHA1 (patch-lib_isc_unix_include_isc_stdatomic.h) = b73b0224be47c1733f6346fce9243e97f54e1865 49SHA1 (patch-lib_isc_unix_include_isc_stdatomic.h) = b73b0224be47c1733f6346fce9243e97f54e1865
50SHA1 (patch-lib_isc_unix_net.c) = c654f60a1feefdba9bf980dcfa46ce37f46918aa 50SHA1 (patch-lib_isc_unix_net.c) = c654f60a1feefdba9bf980dcfa46ce37f46918aa
51SHA1 (patch-lib_isc_unix_socket.c) = 7d5b61124187009ce03f4fc963f8ad3c44d267d0 51SHA1 (patch-lib_isc_unix_socket.c) = c6d04164dfc2047493b39c174bbdf2c8aa59bc1d
52SHA1 (patch-lib_isc_unix_time.c) = fac9e66754e099f53ba8c499f5f179825a0b0fbd 52SHA1 (patch-lib_isc_unix_time.c) = fac9e66754e099f53ba8c499f5f179825a0b0fbd
53SHA1 (patch-lib_ns_Makefile.in) = 7375d0cb44c891492594dc7540f78826c141106a 53SHA1 (patch-lib_ns_Makefile.in) = 7375d0cb44c891492594dc7540f78826c141106a
54SHA1 (patch-lib_ns_client.c) = 099ca607278d064081a0cfc92d96f0b31d95a944 54SHA1 (patch-lib_ns_client.c) = 099ca607278d064081a0cfc92d96f0b31d95a944
55SHA1 (patch-lib_ns_include_ns_client.h) = 3ccd630aee77ea638fb3b954b85bad9c74b0c86e 55SHA1 (patch-lib_ns_include_ns_client.h) = 3ccd630aee77ea638fb3b954b85bad9c74b0c86e
56SHA1 (patch-lib_ns_include_ns_pfilter.h) = cc86752971b4f9f7492283c4ad3ff29bc1bae237 56SHA1 (patch-lib_ns_include_ns_pfilter.h) = cc86752971b4f9f7492283c4ad3ff29bc1bae237
57SHA1 (patch-lib_ns_pfilter.c) = 8f4a3b3a729360a131eb1962c42a9f9f985c7e7b 57SHA1 (patch-lib_ns_pfilter.c) = 8f4a3b3a729360a131eb1962c42a9f9f985c7e7b
58SHA1 (patch-lib_ns_query.c) = 0c3c4a20aa4b40c144c4f986599cda67db3e2491 58SHA1 (patch-lib_ns_query.c) = 0c3c4a20aa4b40c144c4f986599cda67db3e2491
59SHA1 (patch-lib_ns_update.c) = 2fb3457da333143508d28420490cbc1cb69ddb19 59SHA1 (patch-lib_ns_update.c) = 2fb3457da333143508d28420490cbc1cb69ddb19
60SHA1 (patch-lib_ns_xfrout.c) = 79d9e4add58ffd75ea9718f5501f1517e67416e3 60SHA1 (patch-lib_ns_xfrout.c) = 79d9e4add58ffd75ea9718f5501f1517e67416e3
61SHA1 (patch-make_rules.in) = 5fb3a44ff0066c93872c25596267fbabffc6da8f 61SHA1 (patch-make_rules.in) = 5fb3a44ff0066c93872c25596267fbabffc6da8f

cvs diff -r1.6 -r1.6.2.1 pkgsrc/net/bind916/patches/patch-lib_isc_unix_socket.c (expand / switch to unified diff)

--- pkgsrc/net/bind916/patches/patch-lib_isc_unix_socket.c 2021/10/24 06:40:28 1.6
+++ pkgsrc/net/bind916/patches/patch-lib_isc_unix_socket.c 2022/03/03 18:51:38 1.6.2.1
@@ -1,56 +1,72 @@ @@ -1,56 +1,72 @@
1$NetBSD: patch-lib_isc_unix_socket.c,v 1.6 2021/10/24 06:40:28 taca Exp $ 1$NetBSD: patch-lib_isc_unix_socket.c,v 1.6.2.1 2022/03/03 18:51:38 bsiegert Exp $
2 2
3* Apply fixes from NetBSD base system. 3* Apply fixes from NetBSD base system.
4* Fix build on SmartOS. In this special case, _XOPEN_SOURCE has to be only 4* Fix build on SunOS. In this special case, _XOPEN_SOURCE has to be only
5 defined on SmartOS. 5 defined on SunOS.
6 6
7--- lib/isc/unix/socket.c.orig 2021-09-07 09:37:05.000000000 +0000 7--- lib/isc/unix/socket.c.orig 2022-01-12 13:50:10.000000000 +0000
8+++ lib/isc/unix/socket.c 8+++ lib/isc/unix/socket.c
9@@ -360,6 +360,10 @@ struct isc_socket { 9@@ -13,6 +13,15 @@
 10
 11 /*! \file */
 12
 13+/* needed for CMSG_DATA */
 14+#if defined(__sun)
 15+#if (__STDC_VERSION__ - 0 < 199901L)
 16+#define _XOPEN_SOURCE 500
 17+#else
 18+#define _XOPEN_SOURCE 600
 19+#endif
 20+#endif
 21+
 22 #include <inttypes.h>
 23 #include <stdbool.h>
 24 #include <sys/param.h>
 25@@ -362,6 +371,10 @@ struct isc_socket {
10 unsigned char overflow; /* used for MSG_TRUNC fake */ 26 unsigned char overflow; /* used for MSG_TRUNC fake */
11 #endif /* ifdef ISC_PLATFORM_RECVOVERFLOW */ 27 #endif /* ifdef ISC_PLATFORM_RECVOVERFLOW */
12  28
13+ void *fdwatcharg; 29+ void *fdwatcharg;
14+ isc_sockfdwatch_t fdwatchcb; 30+ isc_sockfdwatch_t fdwatchcb;
15+ int fdwatchflags; 31+ int fdwatchflags;
16+ isc_task_t *fdwatchtask; 32+ isc_task_t *fdwatchtask;
17 unsigned int dscp; 33 unsigned int dscp;
18 }; 34 };
19  35
20@@ -469,6 +473,14 @@ static bool 36@@ -471,6 +484,14 @@ static bool
21 process_ctlfd(isc__socketthread_t *thread); 37 process_ctlfd(isc__socketthread_t *thread);
22 static void 38 static void
23 setdscp(isc_socket_t *sock, isc_dscp_t dscp); 39 setdscp(isc_socket_t *sock, isc_dscp_t dscp);
24+static void 40+static void
25+dispatch_recv(isc_socket_t *sock); 41+dispatch_recv(isc_socket_t *sock);
26+static void 42+static void
27+dispatch_send(isc_socket_t *sock); 43+dispatch_send(isc_socket_t *sock);
28+static void 44+static void
29+internal_fdwatch_read(isc_socket_t *sock); 45+internal_fdwatch_read(isc_socket_t *sock);
30+static void 46+static void
31+internal_fdwatch_write(isc_socket_t *sock); 47+internal_fdwatch_write(isc_socket_t *sock);
32  48
33 #define SELECT_POKE_SHUTDOWN (-1) 49 #define SELECT_POKE_SHUTDOWN (-1)
34 #define SELECT_POKE_NOTHING (-2) 50 #define SELECT_POKE_NOTHING (-2)
35@@ -1573,6 +1585,7 @@ doio_recv(isc_socket_t *sock, isc_socket 51@@ -1574,6 +1595,7 @@ doio_recv(isc_socket_t *sock, isc_socket
36 case isc_sockettype_udp: 52 case isc_sockettype_udp:
37 case isc_sockettype_raw: 53 case isc_sockettype_raw:
38 break; 54 break;
39+ case isc_sockettype_fdwatch: 55+ case isc_sockettype_fdwatch:
40 default: 56 default:
41 INSIST(0); 57 INSIST(0);
42 ISC_UNREACHABLE(); 58 ISC_UNREACHABLE();
43@@ -1781,9 +1794,26 @@ socketclose(isc__socketthread_t *thread, 59@@ -1782,9 +1804,26 @@ socketclose(isc__socketthread_t *thread,
44 */ 60 */
45 LOCK(&thread->fdlock[lockid]); 61 LOCK(&thread->fdlock[lockid]);
46 thread->fds[fd] = NULL; 62 thread->fds[fd] = NULL;
47+ if (sock->type == isc_sockettype_fdwatch) 63+ if (sock->type == isc_sockettype_fdwatch)
48+ thread->fdstate[fd] = CLOSED; 64+ thread->fdstate[fd] = CLOSED;
49+ else 65+ else
50 thread->fdstate[fd] = CLOSE_PENDING; 66 thread->fdstate[fd] = CLOSE_PENDING;
51 UNLOCK(&thread->fdlock[lockid]); 67 UNLOCK(&thread->fdlock[lockid]);
52- select_poke(thread->manager, thread->threadid, fd, SELECT_POKE_CLOSE); 68- select_poke(thread->manager, thread->threadid, fd, SELECT_POKE_CLOSE);
53+ if (sock->type == isc_sockettype_fdwatch) { 69+ if (sock->type == isc_sockettype_fdwatch) {
54+ /* 70+ /*
55+ * The caller may close the socket once this function returns, 71+ * The caller may close the socket once this function returns,
56+ * and `fd' may be reassigned for a new socket. So we do 72+ * and `fd' may be reassigned for a new socket. So we do
@@ -58,90 +74,90 @@ $NetBSD: patch-lib_isc_unix_socket.c,v 1 @@ -58,90 +74,90 @@ $NetBSD: patch-lib_isc_unix_socket.c,v 1
58+ * Note: this may complicate data protection among threads and 74+ * Note: this may complicate data protection among threads and
59+ * may reduce performance due to additional locks. One way to 75+ * may reduce performance due to additional locks. One way to
60+ * solve this would be to dup() the watched descriptor, but we 76+ * solve this would be to dup() the watched descriptor, but we
61+ * take a simpler approach at this moment. 77+ * take a simpler approach at this moment.
62+ */ 78+ */
63+ (void)unwatch_fd(thread, fd, SELECT_POKE_READ); 79+ (void)unwatch_fd(thread, fd, SELECT_POKE_READ);
64+ (void)unwatch_fd(thread, fd, SELECT_POKE_WRITE); 80+ (void)unwatch_fd(thread, fd, SELECT_POKE_WRITE);
65+ } else 81+ } else
66+ select_poke(thread->manager, thread->threadid, fd, 82+ select_poke(thread->manager, thread->threadid, fd,
67+ SELECT_POKE_CLOSE); 83+ SELECT_POKE_CLOSE);
68  84
69 inc_stats(thread->manager->stats, sock->statsindex[STATID_CLOSE]); 85 inc_stats(thread->manager->stats, sock->statsindex[STATID_CLOSE]);
70  86
71@@ -2190,6 +2220,13 @@ again: 87@@ -2191,6 +2230,13 @@ again:
72 } 88 }
73 #endif /* if defined(PF_ROUTE) */ 89 #endif /* if defined(PF_ROUTE) */
74 break; 90 break;
75+ case isc_sockettype_fdwatch: 91+ case isc_sockettype_fdwatch:
76+ /* 92+ /*
77+ * We should not be called for isc_sockettype_fdwatch 93+ * We should not be called for isc_sockettype_fdwatch
78+ * sockets. 94+ * sockets.
79+ */ 95+ */
80+ INSIST(0); 96+ INSIST(0);
81+ break; 97+ break;
82 } 98 }
83 } else { 99 } else {
84 sock->fd = dup(dup_socket->fd); 100 sock->fd = dup(dup_socket->fd);
85@@ -2439,6 +2476,7 @@ socket_create(isc_socketmgr_t *manager,  101@@ -2440,6 +2486,7 @@ socket_create(isc_socketmgr_t *manager,
86  102
87 REQUIRE(VALID_MANAGER(manager)); 103 REQUIRE(VALID_MANAGER(manager));
88 REQUIRE(socketp != NULL && *socketp == NULL); 104 REQUIRE(socketp != NULL && *socketp == NULL);
89+ REQUIRE(type != isc_sockettype_fdwatch); 105+ REQUIRE(type != isc_sockettype_fdwatch);
90  106
91 result = allocate_socket(manager, type, &sock); 107 result = allocate_socket(manager, type, &sock);
92 if (result != ISC_R_SUCCESS) { 108 if (result != ISC_R_SUCCESS) {
93@@ -2553,6 +2591,7 @@ isc_socket_open(isc_socket_t *sock) { 109@@ -2554,6 +2601,7 @@ isc_socket_open(isc_socket_t *sock) {
94 REQUIRE(isc_refcount_current(&sock->references) >= 1); 110 REQUIRE(isc_refcount_current(&sock->references) >= 1);
95 REQUIRE(sock->fd == -1); 111 REQUIRE(sock->fd == -1);
96 REQUIRE(sock->threadid == -1); 112 REQUIRE(sock->threadid == -1);
97+ REQUIRE(sock->type != isc_sockettype_fdwatch); 113+ REQUIRE(sock->type != isc_sockettype_fdwatch);
98  114
99 result = opensocket(sock->manager, sock, NULL); 115 result = opensocket(sock->manager, sock, NULL);
100  116
101@@ -2631,6 +2670,7 @@ isc_socket_close(isc_socket_t *sock) { 117@@ -2632,6 +2680,7 @@ isc_socket_close(isc_socket_t *sock) {
102  118
103 LOCK(&sock->lock); 119 LOCK(&sock->lock);
104  120
105+ REQUIRE(sock->type != isc_sockettype_fdwatch); 121+ REQUIRE(sock->type != isc_sockettype_fdwatch);
106 REQUIRE(sock->fd >= 0 && sock->fd < (int)sock->manager->maxsocks); 122 REQUIRE(sock->fd >= 0 && sock->fd < (int)sock->manager->maxsocks);
107  123
108 INSIST(!sock->connecting); 124 INSIST(!sock->connecting);
109@@ -2661,6 +2701,24 @@ isc_socket_close(isc_socket_t *sock) { 125@@ -2662,6 +2711,24 @@ isc_socket_close(isc_socket_t *sock) {
110 return (ISC_R_SUCCESS); 126 return (ISC_R_SUCCESS);
111 } 127 }
112  128
113+static void 129+static void
114+dispatch_recv(isc_socket_t *sock) { 130+dispatch_recv(isc_socket_t *sock) {
115+ if (sock->type != isc_sockettype_fdwatch) { 131+ if (sock->type != isc_sockettype_fdwatch) {
116+ internal_recv(sock); 132+ internal_recv(sock);
117+ } else { 133+ } else {
118+ internal_fdwatch_read(sock); 134+ internal_fdwatch_read(sock);
119+ } 135+ }
120+} 136+}
121+ 137+
122+static void 138+static void
123+dispatch_send(isc_socket_t *sock) { 139+dispatch_send(isc_socket_t *sock) {
124+ if (sock->type != isc_sockettype_fdwatch) { 140+ if (sock->type != isc_sockettype_fdwatch) {
125+ internal_send(sock); 141+ internal_send(sock);
126+ } else { 142+ } else {
127+ internal_fdwatch_write(sock); 143+ internal_fdwatch_write(sock);
128+ } 144+ }
129+} 145+}
130+ 146+
131 /* 147 /*
132 * Dequeue an item off the given socket's read queue, set the result code 148 * Dequeue an item off the given socket's read queue, set the result code
133 * in the done event to the one provided, and send it to the task it was 149 * in the done event to the one provided, and send it to the task it was
134@@ -3101,6 +3159,58 @@ finish: 150@@ -3102,6 +3169,58 @@ finish:
135 } 151 }
136 } 152 }
137  153
138+static void 154+static void
139+internal_fdwatch_write(isc_socket_t *sock) 155+internal_fdwatch_write(isc_socket_t *sock)
140+{ 156+{
141+ int more_data; 157+ int more_data;
142+ 158+
143+ INSIST(VALID_SOCKET(sock)); 159+ INSIST(VALID_SOCKET(sock));
144+ 160+
145+ isc_refcount_increment(&sock->references); 161+ isc_refcount_increment(&sock->references);
146+ UNLOCK(&sock->lock); 162+ UNLOCK(&sock->lock);
147+ 163+
@@ -180,72 +196,72 @@ $NetBSD: patch-lib_isc_unix_socket.c,v 1 @@ -180,72 +196,72 @@ $NetBSD: patch-lib_isc_unix_socket.c,v 1
180+ UNLOCK(&sock->lock); 196+ UNLOCK(&sock->lock);
181+ destroy(&sock); 197+ destroy(&sock);
182+ return; 198+ return;
183+ } 199+ }
184+ 200+
185+ if (more_data) 201+ if (more_data)
186+ select_poke(sock->manager, sock->threadid, sock->fd, 202+ select_poke(sock->manager, sock->threadid, sock->fd,
187+ SELECT_POKE_READ); 203+ SELECT_POKE_READ);
188+} 204+}
189+ 205+
190 /* 206 /*
191 * Process read/writes on each fd here. Avoid locking 207 * Process read/writes on each fd here. Avoid locking
192 * and unlocking twice if both reads and writes are possible. 208 * and unlocking twice if both reads and writes are possible.
193@@ -3148,7 +3258,7 @@ process_fd(isc__socketthread_t *thread,  209@@ -3149,7 +3268,7 @@ process_fd(isc__socketthread_t *thread,
194 if (sock->connecting) { 210 if (sock->connecting) {
195 internal_connect(sock); 211 internal_connect(sock);
196 } else { 212 } else {
197- internal_send(sock); 213- internal_send(sock);
198+ dispatch_send(sock); 214+ dispatch_send(sock);
199 } 215 }
200 } 216 }
201  217
202@@ -3156,7 +3266,7 @@ process_fd(isc__socketthread_t *thread,  218@@ -3157,7 +3276,7 @@ process_fd(isc__socketthread_t *thread,
203 if (sock->listener) { 219 if (sock->listener) {
204 internal_accept(sock); /* unlocks sock */ 220 internal_accept(sock); /* unlocks sock */
205 } else { 221 } else {
206- internal_recv(sock); 222- internal_recv(sock);
207+ dispatch_recv(sock); 223+ dispatch_recv(sock);
208 UNLOCK(&sock->lock); 224 UNLOCK(&sock->lock);
209 } 225 }
210 } else { 226 } else {
211@@ -3797,7 +3907,7 @@ isc_socketmgr_create2(isc_mem_t *mctx, i 227@@ -3798,7 +3917,7 @@ isc_socketmgr_create2(isc_mem_t *mctx, i
212 isc_thread_create(netthread, &manager->threads[i], 228 isc_thread_create(netthread, &manager->threads[i],
213 &manager->threads[i].thread); 229 &manager->threads[i].thread);
214 char tname[1024]; 230 char tname[1024];
215- sprintf(tname, "isc-socket-%d", i); 231- sprintf(tname, "isc-socket-%d", i);
216+ sprintf(tname, "socket-%d", i); 232+ sprintf(tname, "socket-%d", i);
217 isc_thread_setname(manager->threads[i].thread, tname); 233 isc_thread_setname(manager->threads[i].thread, tname);
218 } 234 }
219  235
220@@ -5218,7 +5328,7 @@ static isc_once_t hasreuseport_once = IS 236@@ -5219,7 +5338,7 @@ static isc_once_t hasreuseport_once = IS
221 static bool hasreuseport = false; 237 static bool hasreuseport = false;
222  238
223 static void 239 static void
224-init_hasreuseport() { 240-init_hasreuseport() {
225+init_hasreuseport(void) { 241+init_hasreuseport(void) {
226 /* 242 /*
227 * SO_REUSEPORT works very differently on *BSD and on Linux (because why not). 243 * SO_REUSEPORT works very differently on *BSD and on Linux (because why not).
228 * We only want to use it on Linux, if it's available. On BSD we want to dup() 244 * We only want to use it on Linux, if it's available. On BSD we want to dup()
229@@ -5272,6 +5382,8 @@ _socktype(isc_sockettype_t type) { 245@@ -5273,6 +5392,8 @@ _socktype(isc_sockettype_t type) {
230 return ("tcp"); 246 return ("tcp");
231 case isc_sockettype_unix: 247 case isc_sockettype_unix:
232 return ("unix"); 248 return ("unix");
233+ case isc_sockettype_fdwatch: 249+ case isc_sockettype_fdwatch:
234+ return ("fdwatch"); 250+ return ("fdwatch");
235 default: 251 default:
236 return ("not-initialized"); 252 return ("not-initialized");
237 } 253 }
238@@ -5502,3 +5614,113 @@ error: 254@@ -5503,3 +5624,113 @@ error:
239 return (result); 255 return (result);
240 } 256 }
241 #endif /* HAVE_JSON_C */ 257 #endif /* HAVE_JSON_C */
242+ 258+
243+/* 259+/*
244+ * Create a new 'type' socket managed by 'manager'. Events 260+ * Create a new 'type' socket managed by 'manager'. Events
245+ * will be posted to 'task' and when dispatched 'action' will be 261+ * will be posted to 'task' and when dispatched 'action' will be
246+ * called with 'arg' as the arg value. The new socket is returned 262+ * called with 'arg' as the arg value. The new socket is returned
247+ * in 'socketp'. 263+ * in 'socketp'.
248+ */ 264+ */
249+isc_result_t 265+isc_result_t
250+isc_socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags, 266+isc_socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags,
251+ isc_sockfdwatch_t callback, void *cbarg, 267+ isc_sockfdwatch_t callback, void *cbarg,