mirror of https://github.com/getdnsapi/getdns.git
Merge branch 'features/mingw-win10' into features/mingw-win10-warnings
This commit is contained in:
commit
4b5303e6fb
|
@ -50,6 +50,7 @@
|
|||
#include "gldns/keyraw.h"
|
||||
#include "general.h"
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
|
||||
/* get key usage out of its extension, returns 0 if no key_usage extension */
|
||||
static unsigned long
|
||||
|
|
|
@ -80,6 +80,7 @@ typedef unsigned short in_port_t;
|
|||
#include "context.h"
|
||||
#include "types-internal.h"
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
#include "dnssec.h"
|
||||
#include "stub.h"
|
||||
#include "list.h"
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
@ -406,7 +407,7 @@ poll_eventloop_run_once(getdns_eventloop *loop, int blocking)
|
|||
Sleep(poll_timeout);
|
||||
} else
|
||||
#endif
|
||||
if (poll(poll_loop->pfds, poll_loop->fd_events_free, poll_timeout) < 0) {
|
||||
if (_getdns_poll(poll_loop->pfds, poll_loop->fd_events_free, poll_timeout) < 0) {
|
||||
perror("poll() failed");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gldns/pkthdr.h"
|
||||
#include "gldns/rrdef.h"
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
#include "mdns.h"
|
||||
|
||||
#ifdef HAVE_MDNS_SUPPORT
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "getdns/getdns.h"
|
||||
#include "types-internal.h"
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
#include "util/lruhash.h"
|
||||
#include "config.h"
|
||||
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
*
|
||||
* /brief general functions with platform-dependent implementations
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2017, NLnet Labs, Sinodun
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the names of the copyright holders nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_H
|
||||
#define PLATFORM_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
typedef u_short sa_family_t;
|
||||
#define _getdns_EAGAIN (WSATRY_AGAIN)
|
||||
#define _getdns_EWOULDBLOCK (WSAEWOULDBLOCK)
|
||||
#define _getdns_EINPROGRESS (WSAEINPROGRESS)
|
||||
#define _getdns_EMFILE (WSAEMFILE)
|
||||
#define _getdns_ECONNRESET (WSAECONNRESET)
|
||||
|
||||
#define _getdns_closesocket(fd) closesocket(fd)
|
||||
#define _getdns_poll(fdarray, nsockets, timer) WSAPoll(fdarray, nsockets, timer)
|
||||
#define _getdns_socketerror() (WSAGetLastError())
|
||||
|
||||
#else /* USE_WINSOCK */
|
||||
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#else
|
||||
# include <poll.h>
|
||||
#endif
|
||||
|
||||
#define _getdns_EAGAIN (EAGAIN)
|
||||
#define _getdns_EWOULDBLOCK (EWOULDBLOCK)
|
||||
#define _getdns_EINPROGRESS (EINPROGRESS)
|
||||
#define _getdns_EMFILE (EMFILE)
|
||||
#define _getdns_ECONNRESET (ECONNRESET)
|
||||
|
||||
#define SOCKADDR struct sockaddr
|
||||
#define SOCKADDR_IN struct sockaddr_in
|
||||
#define SOCKADDR_IN6 struct sockaddr_in6
|
||||
#define SOCKADDR_STORAGE struct sockaddr_storage
|
||||
#define SOCKET int
|
||||
|
||||
#define IP_MREQ struct ip_mreq
|
||||
#define IPV6_MREQ struct ipv6_mreq
|
||||
#define BOOL int
|
||||
#define TRUE 1
|
||||
|
||||
#define _getdns_closesocket(fd) close(fd)
|
||||
#define _getdns_poll(fdarray, nsockets, timer) poll(fdarray, nsockets, timer)
|
||||
#define _getdns_socketerror() (errno)
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -40,6 +40,7 @@
|
|||
#include "debug.h"
|
||||
#include "util/rbtree.h"
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
#include "server.h"
|
||||
|
||||
#define DNS_REQUEST_SZ 4096
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "rr-iter.h"
|
||||
#include "context.h"
|
||||
#include "util-internal.h"
|
||||
#include "platform.h"
|
||||
#include "general.h"
|
||||
#include "pubkey-pinning.h"
|
||||
|
||||
|
|
|
@ -218,46 +218,5 @@ INLINE uint64_t _getdns_ms_until_expiry2(uint64_t expires, uint64_t *now_ms)
|
|||
return *now_ms >= expires ? 0 : expires - *now_ms;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
typedef u_short sa_family_t;
|
||||
#define _getdns_EAGAIN (WSATRY_AGAIN)
|
||||
#define _getdns_EWOULDBLOCK (WSAEWOULDBLOCK)
|
||||
#define _getdns_EINPROGRESS (WSAEINPROGRESS)
|
||||
#define _getdns_EMFILE (WSAEMFILE)
|
||||
#define _getdns_ECONNRESET (WSAECONNRESET)
|
||||
|
||||
#define _getdns_closesocket(fd) closesocket(fd)
|
||||
#define _getdns_poll(fdarray, nsockets, timer) WSAPoll(fdarray, nsockets, timer)
|
||||
#define _getdns_socketerror() (WSAGetLastError())
|
||||
#else
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
# include <sys/poll.h>
|
||||
#else
|
||||
# include <poll.h>
|
||||
#endif
|
||||
|
||||
#define _getdns_EAGAIN (EAGAIN)
|
||||
#define _getdns_EWOULDBLOCK (EWOULDBLOCK)
|
||||
#define _getdns_EINPROGRESS (EINPROGRESS)
|
||||
#define _getdns_EMFILE (EMFILE)
|
||||
#define _getdns_ECONNRESET (ECONNRESET)
|
||||
|
||||
#define SOCKADDR struct sockaddr
|
||||
#define SOCKADDR_IN struct sockaddr_in
|
||||
#define SOCKADDR_IN6 struct sockaddr_in6
|
||||
#define SOCKADDR_STORAGE struct sockaddr_storage
|
||||
#define SOCKET int
|
||||
|
||||
#define IP_MREQ struct ip_mreq
|
||||
#define IPV6_MREQ struct ipv6_mreq
|
||||
#define BOOL int
|
||||
#define TRUE 1
|
||||
|
||||
#define _getdns_closesocket(fd) close(fd)
|
||||
#define _getdns_poll(fdarray, nsockets, timer) poll(fdarray, nsockets, timer)
|
||||
#define _getdns_socketerror() (errno)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* util-internal.h */
|
||||
|
|
Loading…
Reference in New Issue