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