diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2016-03-24 16:03:40 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2016-03-24 17:55:25 +0300 |
commit | b1b46d458091646187775f594e6f4fa733fb7094 (patch) | |
tree | 257b686b5e3893798b9cfe270af1358d6f7b295e | |
parent | db5bfdbd8ab2729a95c95638fbcc1db8cbfef162 (diff) |
Drop usage of old-age BSD types in generically used Cygwin headers
u_char, u_short, u_int, u_long are BSD-only types. Remove them from
Cygwin headers which are supposed to be used in a non-BSD scenario.
Drop special Cygwin handling of those types in sys/types.h.
newlib:
* libc/include/sys/types.h (u_char,u_short,u_int,u_long): Drop
Cygwin exception.
cygwin:
* fhandler_socket.cc (fhandler_socket::ioctl): Accommodate change
in include/asm/socket.h. Continue using u_long since that's the
MS type here.
* include/asm/socket.h: Since the type given in _IOR/_IOW macros
is only used for its sizeof, replace u_long with equivalent long.
* netdb.h (getnetbyaddr): Fix prototype.
* netinet/ip.h: Replace old BSD-only types with generically defined
old BSD types (u_char -> u_int8_t, etc).
* netinet/tcp.h: Ditto.
* netinet/udp.h: Ditto.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r-- | newlib/libc/include/sys/types.h | 3 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 4 | ||||
-rw-r--r-- | winsup/cygwin/include/asm/socket.h | 18 | ||||
-rw-r--r-- | winsup/cygwin/include/netdb.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/include/netinet/ip.h | 38 | ||||
-rw-r--r-- | winsup/cygwin/include/netinet/tcp.h | 24 | ||||
-rw-r--r-- | winsup/cygwin/include/netinet/udp.h | 8 |
7 files changed, 48 insertions, 49 deletions
diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index ebed1c010..f8808308e 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -87,8 +87,7 @@ typedef quad_t * qaddr_t; # define quad quad_t #endif -/* These types are required by netinet/ *.h on Cygwin */ -#if __MISC_VISIBLE || defined(__CYGWIN__) +#if __MISC_VISIBLE #ifndef _BSDTYPES_DEFINED /* also defined in mingw/gmon.h and in w32api/winsock[2].h */ #ifndef __u_char_defined diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index e71954321..27c2989cc 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -2248,7 +2248,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p) use a type of the expected size. Hopefully. */ case FIOASYNC: #ifdef __x86_64__ - case _IOW('f', 125, unsigned long): + case _IOW('f', 125, u_long): #endif res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, *(int *) p ? ASYNC_MASK : 0); @@ -2261,7 +2261,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p) break; case FIONREAD: #ifdef __x86_64__ - case _IOR('f', 127, unsigned long): + case _IOR('f', 127, u_long): #endif res = ioctlsocket (get_socket (), FIONREAD, (u_long *) p); if (res == SOCKET_ERROR) diff --git a/winsup/cygwin/include/asm/socket.h b/winsup/cygwin/include/asm/socket.h index d5d91f495..b632a1b35 100644 --- a/winsup/cygwin/include/asm/socket.h +++ b/winsup/cygwin/include/asm/socket.h @@ -22,15 +22,15 @@ details. */ #define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) #define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y) -#define SIOCATMARK _IOR('s', 7, u_long) /* at oob mark? */ -#define FIONREAD _IOR('f', 127, u_long) /* get # bytes to read */ +#define SIOCATMARK _IOR('s', 7, long) /* at oob mark? */ +#define FIONREAD _IOR('f', 127, long) /* get # bytes to read */ #define FIONBIO 0x8004667e /* To be compatible with termiost version */ -#define REAL_FIONBIO _IOW('f', 126, u_long) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, u_long) /* set/clear async i/o */ -#define SIOCSHIWAT _IOW('s', 0, u_long) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, u_long) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, u_long) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, u_long) /* get low watermark */ +#define REAL_FIONBIO _IOW('f', 126, long) /* set/clear non-blocking i/o */ +#define FIOASYNC _IOW('f', 125, long) /* set/clear async i/o */ +#define SIOCSHIWAT _IOW('s', 0, long) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, long) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, long) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, long) /* get low watermark */ /* Needed for if queries */ #define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */ @@ -57,7 +57,7 @@ details. */ #define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ #define SO_LINGER 0x0080 /* linger on close if data present */ #define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ -#define SO_DONTLINGER (u_int)(~SO_LINGER) +#define SO_DONTLINGER (unsigned int)(~SO_LINGER) #define SO_PEERCRED 0x0200 /* same as getpeereid */ /* diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h index 863c19348..596fb33d2 100644 --- a/winsup/cygwin/include/netdb.h +++ b/winsup/cygwin/include/netdb.h @@ -218,7 +218,7 @@ struct hostent *gethostbyaddr (const char *, int, int); struct hostent *gethostbyname (const char *); struct hostent *gethostbyname2 (const char *, int); struct hostent *gethostent (void); -struct netent *getnetbyaddr (long, int); /* u_long? */ +struct netent *getnetbyaddr (uint32_t, int); struct netent *getnetbyname (const char *); struct netent *getnetent (void); struct protoent *getprotobyname (const char *); diff --git a/winsup/cygwin/include/netinet/ip.h b/winsup/cygwin/include/netinet/ip.h index 4d355423b..b952d5324 100644 --- a/winsup/cygwin/include/netinet/ip.h +++ b/winsup/cygwin/include/netinet/ip.h @@ -52,28 +52,28 @@ */ struct ip { #ifdef _IP_VHL - u_char ip_vhl; /* version << 4 | header length >> 2 */ + u_int8_t ip_vhl; /* version << 4 | header length >> 2 */ #else #if __BYTE_ORDER == __LITTLE_ENDIAN - u_int ip_hl:4, /* header length */ - ip_v:4; /* version */ + unsigned int ip_hl:4, /* header length */ + ip_v:4; /* version */ #endif #if __BYTE_ORDER == __BIG_ENDIAN - u_int ip_v:4, /* version */ - ip_hl:4; /* header length */ + unsigned int ip_v:4, /* version */ + ip_hl:4; /* header length */ #endif #endif /* not _IP_VHL */ - u_char ip_tos; /* type of service */ - u_short ip_len; /* total length */ - u_short ip_id; /* identification */ - u_short ip_off; /* fragment offset field */ + u_int_8 ip_tos; /* type of service */ + u_int16_t ip_len; /* total length */ + u_int16_t ip_id; /* identification */ + u_int16_t ip_off; /* fragment offset field */ #define IP_RF 0x8000 /* reserved fragment flag */ #define IP_DF 0x4000 /* dont fragment flag */ #define IP_MF 0x2000 /* more fragments flag */ #define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ + u_int8_t ip_ttl; /* time to live */ + u_int8_t ip_p; /* protocol */ + u_int16_t ip_sum; /* checksum */ struct in_addr ip_src,ip_dst; /* source and dest address */ }; @@ -208,16 +208,16 @@ struct ip { * Time stamp option structure. */ struct ip_timestamp { - u_char ipt_code; /* IPOPT_TS */ - u_char ipt_len; /* size of structure (variable) */ - u_char ipt_ptr; /* index of current entry */ + u_int8_t ipt_code; /* IPOPT_TS */ + u_int8_t ipt_len; /* size of structure (variable) */ + u_int8_t ipt_ptr; /* index of current entry */ #if __BYTE_ORDER == __LITTLE_ENDIAN - u_int ipt_flg:4, /* flags, see below */ - ipt_oflw:4; /* overflow counter */ + unsigned int ipt_flg:4, /* flags, see below */ + ipt_oflw:4; /* overflow counter */ #endif #if __BYTE_ORDER == __BIG_ENDIAN - u_int ipt_oflw:4, /* overflow counter */ - ipt_flg:4; /* flags, see below */ + unsigned int ipt_oflw:4, /* overflow counter */ + ipt_flg:4; /* flags, see below */ #endif union ipt_timestamp { n_long ipt_time[1]; diff --git a/winsup/cygwin/include/netinet/tcp.h b/winsup/cygwin/include/netinet/tcp.h index 8a6994326..becbec54f 100644 --- a/winsup/cygwin/include/netinet/tcp.h +++ b/winsup/cygwin/include/netinet/tcp.h @@ -50,19 +50,19 @@ typedef u_int32_t tcp_cc; /* connection count per rfc1644 */ * Per RFC 793, September, 1981. */ struct tcphdr { - u_short th_sport; /* source port */ - u_short th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ + u_int16_t th_sport; /* source port */ + u_int16_t th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ #if __BYTE_ORDER == __LITTLE_ENDIAN - u_int th_x2:4, /* (unused) */ - th_off:4; /* data offset */ + unsigned int th_x2:4, /* (unused) */ + th_off:4; /* data offset */ #endif #if __BYTE_ORDER == __BIG_ENDIAN - u_int th_off:4, /* data offset */ - th_x2:4; /* (unused) */ + unsigned int th_off:4, /* data offset */ + th_x2:4; /* (unused) */ #endif - u_char th_flags; + u_int8_t th_flags; #define TH_FIN 0x01 #define TH_SYN 0x02 #define TH_RST 0x04 @@ -71,9 +71,9 @@ struct tcphdr { #define TH_URG 0x20 #define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) - u_short th_win; /* window */ - u_short th_sum; /* checksum */ - u_short th_urp; /* urgent pointer */ + u_int16_t th_win; /* window */ + u_int16_t th_sum; /* checksum */ + u_int16_t th_urp; /* urgent pointer */ }; #define TCPOPT_EOL 0 diff --git a/winsup/cygwin/include/netinet/udp.h b/winsup/cygwin/include/netinet/udp.h index 61932720b..21fbc01cd 100644 --- a/winsup/cygwin/include/netinet/udp.h +++ b/winsup/cygwin/include/netinet/udp.h @@ -42,10 +42,10 @@ * Per RFC 768, September, 1981. */ struct udphdr { - u_short uh_sport; /* source port */ - u_short uh_dport; /* destination port */ - u_short uh_ulen; /* udp length */ - u_short uh_sum; /* udp checksum */ + u_int16_t uh_sport; /* source port */ + u_int16_t uh_dport; /* destination port */ + u_int16_t uh_ulen; /* udp length */ + u_int16_t uh_sum; /* udp checksum */ }; #endif |