fix build on win32

This commit is contained in:
gbeauche 2006-04-29 10:41:25 +00:00
parent 8ca74c4eac
commit f0d77218c8
3 changed files with 14 additions and 3 deletions

View File

@ -822,7 +822,7 @@ fd_nonblock(fd)
int fd;
{
#if defined USE_FIONBIO && defined FIONBIO
int opt = 1;
ioctlsockopt_t opt = 1;
ioctlsocket(fd, FIONBIO, &opt);
#else
@ -839,7 +839,7 @@ fd_block(fd)
int fd;
{
#if defined USE_FIONBIO && defined FIONBIO
int opt = 0;
ioctlsockopt_t opt = 0;
ioctlsocket(fd, FIONBIO, &opt);
#else

View File

@ -19,19 +19,29 @@ typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
typedef char *caddr_t;
typedef int socklen_t;
typedef unsigned long ioctlsockopt_t;
# include <windows.h>
# include <winsock2.h>
# include <sys/timeb.h>
# include <iphlpapi.h>
# define USE_FIONBIO 1
# define EWOULDBLOCK WSAEWOULDBLOCK
# define EINPROGRESS WSAEINPROGRESS
# define ENOTCONN WSAENOTCONN
# define EHOSTUNREACH WSAEHOSTUNREACH
# define ENETUNREACH WSAENETUNREACH
# define ECONNREFUSED WSAECONNREFUSED
/* Basilisk II Router defines those */
# define udp_read_completion slirp_udp_read_completion
# define write_udp slirp_write_udp
# define init_udp slirp_init_udp
# define final_udp slirp_final_udp
#else
typedef int ioctlsockopt_t;
# define ioctlsocket ioctl
# define closesocket(s) close(s)
# define O_BINARY 0

View File

@ -415,7 +415,8 @@ sorecvfrom(so)
udp_detach(so);
} else { /* A "normal" UDP packet */
struct mbuf *m;
int len, n;
int len;
ioctlsockopt_t n;
if (!(m = m_get())) return;
m->m_data += if_maxlinkhdr;