Cygwin: cleanup header including within network-releated files

* Rearrange includes and drop unneccessary ones.

* Don't pull in cygwin/socket.h into sys/un.h just to get
  sa_family_t.  Include sys/types.h and use __sa_family_t instead.

* start including Windows headers using the w32api/ path prefix

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2018-02-28 18:56:13 +01:00
parent d02f3a1238
commit 25ea6af172
8 changed files with 43 additions and 116 deletions

View File

@ -16,21 +16,15 @@ details. */
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif #endif
#include <ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <iphlpapi.h> #include <w32api/iphlpapi.h>
#include <asm/byteorder.h>
#include <stdio.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "fhandler_virtual.h" #include "fhandler_virtual.h"
#include "dtable.h" #include "dtable.h"
#include "cygheap.h"
#include <asm/byteorder.h>
#define _COMPILING_NEWLIB
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
bool get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa0, ULONG family); bool get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa0, ULONG family);

View File

@ -6,48 +6,18 @@
Cygwin license. Please consult the file "CYGWIN_LICENSE" for Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */ details. */
#define __INSIDE_CYGWIN_NET__
#define USE_SYS_TYPES_FD_SET
#include "winsup.h" #include "winsup.h"
#ifdef __x86_64__ #include <sys/socket.h>
/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte)
because a redefinition for LP64 systems is missing. This leads to a wrong
definition and size of sockaddr_in6 when building with winsock headers.
This definition is also required to use the right u_long type in subsequent
function calls. */
#undef u_long
#define u_long __ms_u_long
#endif
#include <ntsecapi.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#include <iphlpapi.h>
#include "cygerrno.h"
#include "security.h"
#include "path.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "cygwin/version.h"
#include "perprocess.h"
#include "shared_info.h"
#include "sigproc.h"
#include "wininfo.h"
#include <unistd.h> #include <unistd.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <cygwin/acl.h> #include <cygwin/acl.h>
#include "cygtls.h" #include "cygerrno.h"
#include <sys/un.h> #include "path.h"
#include "ntdll.h" #include "fhandler.h"
#include "miscfuncs.h"
#include "tls_pbuf.h" #include "tls_pbuf.h"
#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT)
#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE)
extern "C" { extern "C" {
int sscanf (const char *, const char *, ...); int sscanf (const char *, const char *, ...);
} /* End of "C" section */ } /* End of "C" section */

View File

@ -21,31 +21,21 @@
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif #endif
#include <ntsecapi.h> #include <w32api/ws2tcpip.h>
#include <ws2tcpip.h> #include <w32api/mswsock.h>
#include <mswsock.h> #include <unistd.h>
#include <iphlpapi.h> #include <asm/byteorder.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/statvfs.h>
#include <cygwin/acl.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"
#include "cygheap.h" #include "cygheap.h"
#include <asm/byteorder.h>
#include "cygwin/version.h"
#include "perprocess.h"
#include "shared_info.h" #include "shared_info.h"
#include "sigproc.h"
#include "wininfo.h" #include "wininfo.h"
#include <unistd.h>
#include <sys/param.h>
#include <sys/statvfs.h>
#include <cygwin/acl.h>
#include "cygtls.h"
#include <sys/un.h>
#include "ntdll.h"
#include "miscfuncs.h"
#include "tls_pbuf.h"
#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) #define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT)
#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) #define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE)

View File

@ -21,31 +21,23 @@
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif #endif
#include <ntsecapi.h> #include <w32api/ntsecapi.h>
#include <ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <mswsock.h> #include <w32api/mswsock.h>
#include <iphlpapi.h> #include <unistd.h>
#include <asm/byteorder.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/param.h>
#include <sys/statvfs.h>
#include <cygwin/acl.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"
#include "cygheap.h" #include "cygheap.h"
#include <asm/byteorder.h>
#include "cygwin/version.h"
#include "perprocess.h"
#include "shared_info.h"
#include "sigproc.h"
#include "wininfo.h" #include "wininfo.h"
#include <unistd.h>
#include <sys/param.h>
#include <sys/statvfs.h>
#include <cygwin/acl.h>
#include "cygtls.h"
#include <sys/un.h>
#include "ntdll.h" #include "ntdll.h"
#include "miscfuncs.h"
#include "tls_pbuf.h"
extern "C" { extern "C" {
int sscanf (const char *, const char *, ...); int sscanf (const char *, const char *, ...);

View File

@ -9,25 +9,20 @@
details. */ details. */
#include "winsup.h" #include "winsup.h"
#include <ntsecapi.h> #include <w32api/winioctl.h>
#include "cygerrno.h"
#include "security.h"
#include "path.h"
#include "fhandler.h"
#include "dtable.h"
#include "cygheap.h"
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include "cygwin/version.h"
#include "perprocess.h"
#include "shared_info.h"
#include "sigproc.h"
#include "wininfo.h"
#include <unistd.h> #include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/statvfs.h> #include <sys/statvfs.h>
#include <cygwin/acl.h> #include <cygwin/acl.h>
#include "cygtls.h" #include "cygerrno.h"
#include <sys/un.h> #include "path.h"
#include "fhandler.h"
#include "dtable.h"
#include "hires.h"
#include "shared_info.h"
#include "ntdll.h" #include "ntdll.h"
#include "miscfuncs.h" #include "miscfuncs.h"
#include "tls_pbuf.h" #include "tls_pbuf.h"

View File

@ -9,14 +9,15 @@ details. */
#ifndef _SYS_UN_H #ifndef _SYS_UN_H
#define _SYS_UN_H #define _SYS_UN_H
#include <sys/types.h>
#include <string.h> /* for strlen */ #include <string.h> /* for strlen */
#include <cygwin/socket.h>
/* POSIX requires only at least 100 bytes */ /* POSIX requires only at least 100 bytes */
#define UNIX_PATH_MAX 108 #define UNIX_PATH_MAX 108
struct sockaddr_un { struct sockaddr_un {
sa_family_t sun_family; /* address family AF_LOCAL/AF_UNIX */ __sa_family_t sun_family; /* address family AF_LOCAL/AF_UNIX */
char sun_path[UNIX_PATH_MAX]; /* 108 bytes of socket address */ char sun_path[UNIX_PATH_MAX]; /* 108 bytes of socket address */
}; };

View File

@ -19,35 +19,21 @@ details. */
#undef u_long #undef u_long
#define u_long __ms_u_long #define u_long __ms_u_long
#endif #endif
#include <ws2tcpip.h> #include <w32api/ws2tcpip.h>
#include <mswsock.h> #include <w32api/mswsock.h>
#include <iphlpapi.h> #include <w32api/iphlpapi.h>
#include "miscfuncs.h"
#include <ctype.h>
#include <wchar.h>
#include <stdlib.h>
#define gethostname cygwin_gethostname #define gethostname cygwin_gethostname
#include <unistd.h> #include <unistd.h>
#undef gethostname #undef gethostname
#include <ifaddrs.h>
#include <netdb.h> #include <netdb.h>
#include <cygwin/in.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <assert.h>
#include "cygerrno.h"
#include "security.h"
#include "cygwin/version.h"
#include "shared_info.h" #include "shared_info.h"
#include "perprocess.h"
#include "path.h" #include "path.h"
#include "fhandler.h" #include "fhandler.h"
#include "dtable.h" #include "dtable.h"
#include "cygheap.h" #include "cygheap.h"
#include "sigproc.h"
#include "registry.h"
#include "cygtls.h"
#include "ifaddrs.h"
#include "tls_pbuf.h" #include "tls_pbuf.h"
#include "ntdll.h"
/* Unfortunately defined in Windows header files and arpa/nameser_compat.h. */ /* Unfortunately defined in Windows header files and arpa/nameser_compat.h. */
#undef NOERROR #undef NOERROR
@ -455,8 +441,6 @@ dup_ent (unionent *&dst, unionent *src, unionent::struct_type type)
dp += DWORD_round (src->h_len); dp += DWORD_round (src->h_len);
} }
} }
/* Sanity check that we did our bookkeeping correctly. */
assert ((dp - (char *) dst) == sz);
} }
debug_printf ("duped %sent \"%s\", %p", entnames[type], dst ? dst->name : "<null!>", dst); debug_printf ("duped %sent \"%s\", %p", entnames[type], dst ? dst->name : "<null!>", dst);
return dst; return dst;

View File

@ -15,6 +15,7 @@ details. */
#include <stdio.h> #include <stdio.h>
#include <syslog.h> #include <syslog.h>
#include <unistd.h> #include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include "cygerrno.h" #include "cygerrno.h"
#include "security.h" #include "security.h"