1 // See ../src/lib9/LICENSE
5 #if defined(__cplusplus)
9 #define HAS_SYS_TERMIOS 1
11 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
13 # define __EXTENSIONS__ 1 /* SunOS */
14 # if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__) || defined(__SunOS5_9__) || defined(__SunOS5_10__)
15 /* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
18 # define __MAKECONTEXT_V2_SOURCE 1
22 #define _NETBSD_SOURCE 1 /* NetBSD */
23 #define _SVID_SOURCE 1
24 #define _DEFAULT_SOURCE 1
25 #if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__AIX__)
26 # define _XOPEN_SOURCE 1000
27 # define _XOPEN_SOURCE_EXTENDED 1
29 #if defined(__FreeBSD__)
30 # include <sys/cdefs.h>
32 # undef __ISO_C_VISIBLE
33 # define __ISO_C_VISIBLE 1999
34 # undef __LONG_LONG_SUPPORTED
35 # define __LONG_LONG_SUPPORTED
39 # undef HAS_SYS_TERMIOS
41 #define _LARGEFILE64_SOURCE 1
42 #define _FILE_OFFSET_BITS 64
55 #include <ctype.h> /* for tolower */
65 typedef long p9jmp_buf[sizeof(sigjmp_buf)/(sizeof(long))];
67 #if defined(__linux__)
68 # include <sys/types.h>
70 # if defined(__USE_MISC)
75 #elif defined(__sun__)
76 # include <sys/types.h>
81 # define nil 0 /* no cast to void* */
82 #elif defined(__FreeBSD__)
83 # include <sys/types.h>
84 # include <osreldate.h>
86 # if !defined(_POSIX_SOURCE)
90 #elif defined(__APPLE__)
91 # include <sys/types.h>
98 # undef _POSIX_C_SOURCE
104 #elif defined(__NetBSD__)
106 # include <sys/types.h>
107 # include <pthread.h>
111 #elif defined(__OpenBSD__)
112 # include <sys/types.h>
113 # include <pthread.h>
118 /* No idea what system this is -- try some defaults */
119 # include <pthread.h>
126 typedef signed char schar;
129 typedef unsigned char uchar;
132 typedef unsigned short ushort;
135 typedef unsigned int uint;
138 typedef unsigned long ulong;
140 typedef unsigned long long uvlong;
141 typedef long long vlong;
143 typedef uvlong u64int;
144 typedef vlong s64int;
145 typedef uint8_t u8int;
146 typedef int8_t s8int;
147 typedef uint16_t u16int;
148 typedef int16_t s16int;
149 typedef uintptr_t uintptr;
150 typedef intptr_t intptr;
154 typedef u32int uint32;
155 typedef s32int int32;
156 typedef u16int uint16;
157 typedef s16int int16;
158 typedef u64int uint64;
159 typedef s64int int64;
169 * Funny-named symbols to tip off 9l to autolink.
171 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
172 #define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x = 1;
175 * Gcc is too smart for its own good.
177 #if defined(__GNUC__)
178 # undef strcmp /* causes way too many warnings */
179 # if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
181 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
182 # undef AUTOFRAMEWORK
183 # define AUTOFRAMEWORK(x) int __p9l_autoframework_ ## x __attribute__ ((weak));
186 # define AUTOLIB(x) static int __p9l_autolib_ ## x __attribute__ ((unused));
187 # undef AUTOFRAMEWORK
188 # define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x __attribute__ ((unused));
192 #if defined(__cplusplus)