3 #if defined(__cplusplus)
7 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
9 # define __EXTENSIONS__ 1 /* SunOS */
10 # if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__) || defined(__SunOS5_9__) || defined(__SunOS5_10__)
11 /* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
14 # define __MAKECONTEXT_V2_SOURCE 1
18 #define _NETBSD_SOURCE 1 /* NetBSD */
19 #define _SVID_SOURCE 1
20 #if !defined(__APPLE__) && !defined(__OpenBSD__)
21 # define _XOPEN_SOURCE 1000
22 # define _XOPEN_SOURCE_EXTENDED 1
24 #if defined(__FreeBSD__)
25 # include <sys/cdefs.h>
27 # undef __ISO_C_VISIBLE
28 # define __ISO_C_VISIBLE 1999
29 # undef __LONG_LONG_SUPPORTED
30 # define __LONG_LONG_SUPPORTED
32 #define _LARGEFILE64_SOURCE 1
33 #define _FILE_OFFSET_BITS 64
46 #include <ctype.h> /* for tolower */
56 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
58 #if defined(__linux__)
59 # include <sys/types.h>
60 # if defined(__Linux26__)
62 # define PLAN9PORT_USING_PTHREADS 1
64 # if defined(__USE_MISC)
69 #elif defined(__sun__)
70 # include <sys/types.h>
72 # define PLAN9PORT_USING_PTHREADS 1
76 # define nil 0 /* no cast to void* */
77 #elif defined(__FreeBSD__)
78 # include <sys/types.h>
79 # include <osreldate.h>
80 # if __FreeBSD_version >= 500000
81 # define PLAN9PORT_USING_PTHREADS 1
84 # if !defined(_POSIX_SOURCE)
88 #elif defined(__APPLE__)
89 # include <sys/types.h>
91 # define PLAN9PORT_USING_PTHREADS 1
97 # undef _POSIX_C_SOURCE
103 #elif defined(__NetBSD__)
105 # include <sys/types.h>
109 #elif defined(__OpenBSD__)
110 # include <sys/types.h>
115 /* No idea what system this is -- try some defaults */
116 # include <pthread.h>
117 # define PLAN9PORT_USING_PTHREADS 1
124 typedef signed char schar;
127 typedef unsigned char uchar;
130 typedef unsigned short ushort;
133 typedef unsigned int uint;
136 typedef unsigned long ulong;
138 typedef unsigned long long uvlong;
139 typedef long long vlong;
141 typedef uint64_t u64int;
142 typedef int64_t s64int;
143 typedef uint8_t u8int;
144 typedef int8_t s8int;
145 typedef uint16_t u16int;
146 typedef int16_t s16int;
147 typedef uintptr_t uintptr;
148 typedef intptr_t intptr;
149 typedef uint32_t u32int;
150 typedef int32_t s32int;
158 * Funny-named symbols to tip off 9l to autolink.
160 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
161 #define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x = 1;
164 * Gcc is too smart for its own good.
166 #if defined(__GNUC__)
167 # undef strcmp /* causes way too many warnings */
168 # if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
170 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
171 # undef AUTOFRAMEWORK
172 # define AUTOFRAMEWORK(x) int __p9l_autoframework_ ## x __attribute__ ((weak));
175 # define AUTOLIB(x) static int __p9l_autolib_ ## x __attribute__ ((unused));
176 # undef AUTOFRAMEWORK
177 # define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x __attribute__ ((unused));
181 #if defined(__cplusplus)