3 #if defined(__cplusplus)
7 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
8 #define __EXTENSIONS__ 1 /* SunOS */
9 /* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
11 #define _NETBSD_SOURCE 1 /* NetBSD */
12 #define _SVID_SOURCE 1
13 #if !defined(__APPLE__) && !defined(__OpenBSD__)
14 # define _XOPEN_SOURCE 1000
15 # define _XOPEN_SOURCE_EXTENDED 1
17 #define _LARGEFILE64_SOURCE 1
18 #define _FILE_OFFSET_BITS 64
33 #include <ctype.h> /* for tolower */
43 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
45 #if defined(__linux__)
46 # include <sys/types.h>
47 # if defined(__Linux26__)
49 # define PLAN9PORT_USING_PTHREADS 1
51 # if defined(__USE_MISC)
56 #elif defined(__sun__)
57 # include <sys/types.h>
59 # define PLAN9PORT_USING_PTHREADS 1
63 # define nil 0 /* no cast to void* */
64 #elif defined(__FreeBSD__)
65 # include <sys/types.h>
66 # include <osreldate.h>
67 # if __FreeBSD_version >= 500000
68 # define PLAN9PORT_USING_PTHREADS 1
71 # if !defined(_POSIX_SOURCE)
75 #elif defined(__APPLE__)
76 # include <sys/types.h>
78 # define PLAN9PORT_USING_PTHREADS 1
84 # undef _POSIX_C_SOURCE
90 #elif defined(__NetBSD__)
92 # include <sys/types.h>
96 #elif defined(__OpenBSD__)
97 # include <sys/types.h>
102 /* No idea what system this is -- try some defaults */
103 # include <pthread.h>
104 # define PLAN9PORT_USING_PTHREADS 1
111 typedef signed char schar;
114 typedef unsigned char uchar;
117 typedef unsigned short ushort;
120 typedef unsigned int uint;
123 typedef unsigned long ulong;
125 typedef unsigned long long uvlong;
126 typedef long long vlong;
128 typedef uint64_t u64int;
129 typedef int64_t s64int;
130 typedef uint8_t u8int;
131 typedef int8_t s8int;
132 typedef uint16_t u16int;
133 typedef int16_t s16int;
134 typedef uintptr_t uintptr;
135 typedef uint32_t u32int;
136 typedef int32_t s32int;
144 * Funny-named symbols to tip off 9l to autolink.
146 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
149 * Gcc is too smart for its own good.
151 #if defined(__GNUC__)
152 # if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
154 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
157 # define AUTOLIB(x) static int __p9l_autolib_ ## x __attribute__ ((unused));
161 #if defined(__cplusplus)