1*0afa8e06SEd Maste /*
2*0afa8e06SEd Maste  * Public domain
3*0afa8e06SEd Maste  * sys/types.h compatibility shim
4*0afa8e06SEd Maste  */
5*0afa8e06SEd Maste 
6*0afa8e06SEd Maste #ifdef _MSC_VER
7*0afa8e06SEd Maste #if _MSC_VER >= 1900
8*0afa8e06SEd Maste #include <../ucrt/sys/types.h>
9*0afa8e06SEd Maste #else
10*0afa8e06SEd Maste #include <../include/sys/types.h>
11*0afa8e06SEd Maste #endif
12*0afa8e06SEd Maste #endif
13*0afa8e06SEd Maste 
14*0afa8e06SEd Maste #ifndef _COMPAT_TYPES_H
15*0afa8e06SEd Maste #define _COMPAT_TYPES_H
16*0afa8e06SEd Maste 
17*0afa8e06SEd Maste #include <stdint.h>
18*0afa8e06SEd Maste 
19*0afa8e06SEd Maste #ifdef __MINGW32__
20*0afa8e06SEd Maste #include <_bsd_types.h>
21*0afa8e06SEd Maste typedef uint32_t        in_addr_t;
22*0afa8e06SEd Maste typedef uint32_t        uid_t;
23*0afa8e06SEd Maste #endif
24*0afa8e06SEd Maste 
25*0afa8e06SEd Maste #ifdef _MSC_VER
26*0afa8e06SEd Maste typedef unsigned char   u_char;
27*0afa8e06SEd Maste typedef unsigned short  u_short;
28*0afa8e06SEd Maste typedef unsigned int    u_int;
29*0afa8e06SEd Maste typedef unsigned long   u_long;
30*0afa8e06SEd Maste 
31*0afa8e06SEd Maste #include <basetsd.h>
32*0afa8e06SEd Maste typedef SSIZE_T ssize_t;
33*0afa8e06SEd Maste 
34*0afa8e06SEd Maste #ifndef SSIZE_MAX
35*0afa8e06SEd Maste #ifdef _WIN64
36*0afa8e06SEd Maste #define SSIZE_MAX _I64_MAX
37*0afa8e06SEd Maste #else
38*0afa8e06SEd Maste #define SSIZE_MAX INT_MAX
39*0afa8e06SEd Maste #endif
40*0afa8e06SEd Maste #endif
41*0afa8e06SEd Maste 
42*0afa8e06SEd Maste #endif
43*0afa8e06SEd Maste 
44*0afa8e06SEd Maste #if !defined(HAVE_ATTRIBUTE__BOUNDED__) && !defined(__bounded__)
45*0afa8e06SEd Maste # define __bounded__(x, y, z)
46*0afa8e06SEd Maste #endif
47*0afa8e06SEd Maste 
48*0afa8e06SEd Maste #ifdef _WIN32
49*0afa8e06SEd Maste #define __warn_references(sym,msg)
50*0afa8e06SEd Maste #else
51*0afa8e06SEd Maste 
52*0afa8e06SEd Maste #ifndef __warn_references
53*0afa8e06SEd Maste 
54*0afa8e06SEd Maste #ifndef __STRING
55*0afa8e06SEd Maste #define __STRING(x) #x
56*0afa8e06SEd Maste #endif
57*0afa8e06SEd Maste 
58*0afa8e06SEd Maste #if defined(__GNUC__)  && defined (HAS_GNU_WARNING_LONG)
59*0afa8e06SEd Maste #define __warn_references(sym,msg)          \
60*0afa8e06SEd Maste   __asm__(".section .gnu.warning." __STRING(sym)  \
61*0afa8e06SEd Maste          "\n\t.ascii \"" msg "\"\n\t.text");
62*0afa8e06SEd Maste #else
63*0afa8e06SEd Maste #define __warn_references(sym,msg)
64*0afa8e06SEd Maste #endif
65*0afa8e06SEd Maste 
66*0afa8e06SEd Maste #endif /* __warn_references */
67*0afa8e06SEd Maste #endif /* _WIN32 */
68*0afa8e06SEd Maste 
69*0afa8e06SEd Maste #endif /* !_COMPAT_TYPES_H */
70