[PATCH 02/22] Introduce __socklen_t for BSD compatibility
Sebastian Huber
sebastian.huber@embedded-brains.de
Mon Apr 18 13:31:00 GMT 2016
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/include/sys/_types.h | 4 ++++
winsup/cygwin/include/cygwin/socket.h | 8 +++-----
winsup/cygwin/include/machine/_types.h | 4 ++++
3 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index 297b1ea..37154ff 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -188,6 +188,10 @@ typedef _CLOCKID_T_ __clockid_t;
#define _TIMER_T_ unsigned long
typedef _TIMER_T_ __timer_t;
+#ifndef __machine_socklen_t_defined
+typedef __uint32_t __socklen_t;
+#endif
+
typedef unsigned short __nlink_t;
typedef long __suseconds_t; /* microseconds (signed) */
typedef unsigned long __useconds_t; /* microseconds (unsigned) */
diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h
index b74ada7..b82b085 100644
--- a/winsup/cygwin/include/cygwin/socket.h
+++ b/winsup/cygwin/include/cygwin/socket.h
@@ -16,12 +16,11 @@ details. */
extern "C" {
#endif /* __cplusplus */
-#include <stdint.h>
+#include <sys/types.h>
-/* Not unsigned for backward compatibility. Keep #define for backward
- compatibility. */
+/* Keep #define socklen_t for backward compatibility. */
#ifndef socklen_t
-typedef int socklen_t;
+typedef __socklen_t socklen_t;
#define socklen_t socklen_t
#endif
@@ -51,7 +50,6 @@ struct sockaddr_storage {
#include <asm/socket.h> /* arch-dependent defines */
#include <cygwin/sockios.h> /* the SIOCxxx I/O controls */
#include <sys/uio.h> /* iovec support */
-#include <sys/types.h>
struct ucred {
pid_t pid;
diff --git a/winsup/cygwin/include/machine/_types.h b/winsup/cygwin/include/machine/_types.h
index 8a2c679..ee1a6c6 100644
--- a/winsup/cygwin/include/machine/_types.h
+++ b/winsup/cygwin/include/machine/_types.h
@@ -42,4 +42,8 @@ typedef __uint64_t __ino_t;
#define __machine_key_t_defined
typedef long long __key_t;
+/* Not unsigned for backward compatibility. */
+#define __machine_socklen_t_defined
+typedef int __socklen_t;
+
#endif /* _MACHINE__TYPES_H */
--
1.8.4.5
More information about the Newlib
mailing list