]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use uv_os_sock_t instead of uv_os_fd_t for sockets
authorOndřej Surý <ondrej@isc.org>
Mon, 5 Oct 2020 10:25:19 +0000 (12:25 +0200)
committerOndřej Surý <ondrej@sury.org>
Mon, 5 Oct 2020 13:18:28 +0000 (15:18 +0200)
On POSIX based systems both uv_os_sock_t and uv_os_fd_t are both typedef
to int.  That's not true on Windows, where uv_os_sock_t is SOCKET and
uv_os_fd_t is HANDLE and they differ in level of indirection.

lib/isc/netmgr/netmgr-int.h
lib/isc/netmgr/netmgr.c
lib/isc/netmgr/tcp.c

index 72c76a5afd121252198fe841da19fc8fa6d898d0..1ea281e251f750b18613fdcefe52341232360dfe 100644 (file)
@@ -834,25 +834,25 @@ isc__nm_decstats(isc_nm_t *mgr, isc_statscounter_t counterid);
  */
 
 isc_result_t
-isc__nm_socket_freebind(uv_os_fd_t fd, sa_family_t sa_family);
+isc__nm_socket_freebind(uv_os_sock_t fd, sa_family_t sa_family);
 /*%<
  * Set the IP_FREEBIND (or equivalent) socket option on the uv_handle
  */
 
 isc_result_t
-isc__nm_socket_reuseport(uv_os_fd_t fd);
+isc__nm_socket_reuseport(uv_os_sock_t fd);
 /*%<
  * Set the SO_REUSEPORT (or equivalent) socket option on the fd
  */
 
 isc_result_t
-isc__nm_socket_incoming_cpu(uv_os_fd_t fd);
+isc__nm_socket_incoming_cpu(uv_os_sock_t fd);
 /*%<
  * Set the SO_INCOMING_CPU socket option on the fd if available
  */
 
 isc_result_t
-isc__nm_socket_dontfrag(uv_os_fd_t fd, sa_family_t sa_family);
+isc__nm_socket_dontfrag(uv_os_sock_t fd, sa_family_t sa_family);
 /*%<
  * Set the SO_IP_DONTFRAG (or equivalent) socket option of the fd if available
  */
index 02ad0b2c5491a0e0a57015b0d7e14892b1abfa63..7567ee30ffcdcc3ae4a3146c8d04ef4c8899548d 100644 (file)
@@ -1584,7 +1584,7 @@ isc__nm_decstats(isc_nm_t *mgr, isc_statscounter_t counterid) {
        setsockopt(socket, level, name, &(int){ 1 }, sizeof(int))
 
 isc_result_t
-isc__nm_socket_freebind(uv_os_fd_t fd, sa_family_t sa_family) {
+isc__nm_socket_freebind(uv_os_sock_t fd, sa_family_t sa_family) {
        /*
         * Set the IP_FREEBIND (or equivalent option) on the uv_handle.
         */
@@ -1625,7 +1625,7 @@ isc__nm_socket_freebind(uv_os_fd_t fd, sa_family_t sa_family) {
 }
 
 isc_result_t
-isc__nm_socket_reuseport(uv_os_fd_t fd) {
+isc__nm_socket_reuseport(uv_os_sock_t fd) {
        /*
         * This is SO_REUSE**** hell:
         *
@@ -1668,7 +1668,7 @@ isc__nm_socket_reuseport(uv_os_fd_t fd) {
 }
 
 isc_result_t
-isc__nm_socket_incoming_cpu(uv_os_fd_t fd) {
+isc__nm_socket_incoming_cpu(uv_os_sock_t fd) {
 #ifdef SO_INCOMING_CPU
        if (setsockopt_on(fd, SOL_SOCKET, SO_INCOMING_CPU) == -1) {
                return (ISC_R_FAILURE);
@@ -1682,7 +1682,7 @@ isc__nm_socket_incoming_cpu(uv_os_fd_t fd) {
 }
 
 isc_result_t
-isc__nm_socket_dontfrag(uv_os_fd_t fd, sa_family_t sa_family) {
+isc__nm_socket_dontfrag(uv_os_sock_t fd, sa_family_t sa_family) {
        /*
         * Set the Don't Fragment flag on IP packets
         */
index 254008370250c2a63c2c454a267076c736adf8d6..5f731ddfee83bfbb76543008e28094d484487414 100644 (file)
@@ -319,7 +319,7 @@ isc__nm_async_tcplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
        struct sockaddr_storage sname;
        int r, flags = 0, snamelen = sizeof(sname);
        sa_family_t sa_family;
-       uv_os_fd_t fd;
+       uv_os_sock_t fd;
 
        REQUIRE(isc__nm_in_netthread());
        REQUIRE(sock->type == isc_nm_tcplistener);
@@ -344,7 +344,7 @@ isc__nm_async_tcplisten(isc__networker_t *worker, isc__netievent_t *ev0) {
        r = uv_tcp_bind(&sock->uv_handle.tcp, &sock->iface->addr.type.sa,
                        flags);
        if (r == UV_EADDRNOTAVAIL &&
-           uv_fileno(&sock->uv_handle.handle, &fd) == 0 &&
+           uv_fileno(&sock->uv_handle.handle, (uv_os_fd_t *)&fd) == 0 &&
            isc__nm_socket_freebind(fd, sa_family) == ISC_R_SUCCESS)
        {
                /*