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
33 # define _XOPEN_SOURCE 1
35 #define _LARGEFILE64_SOURCE 1
36 #define _FILE_OFFSET_BITS 64
49 #include <ctype.h> /* for tolower */
59 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
61 #if defined(__linux__)
62 # include <sys/types.h>
63 # if defined(__Linux26__)
65 # define PLAN9PORT_USING_PTHREADS 1
67 # if defined(__USE_MISC)
72 #elif defined(__sun__)
73 # include <sys/types.h>
75 # define PLAN9PORT_USING_PTHREADS 1
79 # define nil 0 /* no cast to void* */
80 #elif defined(__FreeBSD__)
81 # include <sys/types.h>
82 # include <osreldate.h>
83 # if __FreeBSD_version >= 500000
84 # define PLAN9PORT_USING_PTHREADS 1
87 # if !defined(_POSIX_SOURCE)
91 #elif defined(__APPLE__)
92 # include <sys/types.h>
94 # define PLAN9PORT_USING_PTHREADS 1
100 # undef _POSIX_C_SOURCE
101 # undef _XOPEN_SOURCE
106 #elif defined(__NetBSD__)
108 # include <sys/types.h>
112 #elif defined(__OpenBSD__)
113 # include <sys/types.h>
118 /* No idea what system this is -- try some defaults */
119 # include <pthread.h>
120 # define PLAN9PORT_USING_PTHREADS 1
127 typedef signed char schar;
130 typedef unsigned char uchar;
133 typedef unsigned short ushort;
136 typedef unsigned int uint;
139 typedef unsigned long ulong;
141 typedef unsigned long long uvlong;
142 typedef long long vlong;
144 typedef uint64_t u64int;
145 typedef int64_t s64int;
146 typedef uint8_t u8int;
147 typedef int8_t s8int;
148 typedef uint16_t u16int;
149 typedef int16_t s16int;
150 typedef uintptr_t uintptr;
151 typedef intptr_t intptr;
152 typedef uint32_t u32int;
153 typedef int32_t s32int;
161 * Funny-named symbols to tip off 9l to autolink.
163 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
164 #define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x = 1;
167 * Gcc is too smart for its own good.
169 #if defined(__GNUC__)
170 # undef strcmp /* causes way too many warnings */
171 # if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
173 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
174 # undef AUTOFRAMEWORK
175 # define AUTOFRAMEWORK(x) int __p9l_autoframework_ ## x __attribute__ ((weak));
178 # define AUTOLIB(x) static int __p9l_autolib_ ## x __attribute__ ((unused));
179 # undef AUTOFRAMEWORK
180 # define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x __attribute__ ((unused));
184 #if defined(__cplusplus)