In terms of network related functionality, rely on Winsock definitions

as much as possible:
	* dtable.cc: Drop including sys/socket.h.
	* fhandler_procnet.cc: Change includes accordingly.
	* fhandler_socket.cc: Ditto.
	(fhandler_socket::listen): Avoid gcc error message initializing sin6.
	(LPFN_WSARECVMSG): Only define when building against w32api headers.
	* net.cc: Change includes accordingly.  Define USE_SYS_TYPES_FD_SET
	and __WSA_ERR_MACROS_DEFINED.  Define _INC_NETIOAPI temporarily and
	explain why.
	(struct _IP_ADAPTER_UNICAST_ADDRESS_LH): Only define when building
	against w32api headers.
	(struct _IP_ADAPTER_ADDRESSES_LH): Ditto.
	(SIO_GET_INTERFACE_LIST): Ditto.
	(ws_freeaddrinfo): Rename from freeaddrinfo so as not to collide with
	Winsock declaration.  Change througout.
	(ws_getaddrinfo): Ditto.
	(ws_getnameinfo): Ditto.
	* select.cc: Include netdb.h after defining USE_SYS_TYPES_FD_SET.
	* syslog.cc: Drop including netinet/in.h.  Define USE_SYS_TYPES_FD_SET
	and include ws2tcpip.h.
	* include/netdb.h (struct addrinfo): Don't define when building Cygwin.
	* include/cygwin/if.h: Don't declare if_xxx functions when building
	Cygwin.
	* include/cygwin/in.h: Disable most definitions when building Cygwin.
	* include/cygwin/socket.h: Disable sockaddr and sockaddr_storage
	definitions when building Cygwin.  Same for MCAST_INCLUDE/MCAST_EXCLUDE.
	* libc/inet_addr.c: Don't define __INSIDE_CYGWIN__ nor
	__INSIDE_CYGWIN_NET__.
	* libc/inet_network.c: Ditto.
	* libc/minires.h: Drop redundant inclusion of netdb.h.  Define
	__INSIDE_CYGWIN_NET__ only before including netdb.h and resolver
	headers.
This commit is contained in:
Corinna Vinschen
2012-07-06 13:52:19 +00:00
parent dc45bfa0bf
commit db80f635c1
13 changed files with 70 additions and 37 deletions

View File

@ -26,6 +26,7 @@ typedef int socklen_t;
typedef uint16_t sa_family_t;
#ifndef __INSIDE_CYGWIN_NET__
struct sockaddr {
sa_family_t sa_family; /* address family, AF_xxx */
char sa_data[14]; /* 14 bytes of protocol address */
@ -44,6 +45,7 @@ struct sockaddr_storage {
int64_t __ss_align;
char _ss_pad2[_SS_PAD2SIZE];
};
#endif
#include <asm/socket.h> /* arch-dependent defines */
#include <cygwin/sockios.h> /* the SIOCxxx I/O controls */
@ -269,8 +271,10 @@ struct OLD_msghdr
#define MCAST_JOIN_SOURCE_GROUP 45
#define MCAST_LEAVE_SOURCE_GROUP 46
#ifndef __INSIDE_CYGWIN_NET__
#define MCAST_INCLUDE 0
#define MCAST_EXCLUDE 1
#endif
/* Old WinSock1 values, needed internally */
#ifdef __INSIDE_CYGWIN__