Blob


1 #ifndef _U_H_
2 #define _U_H_ 1
3 #if defined(__cplusplus)
4 extern "C" {
5 #endif
7 #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
8 #define __EXTENSIONS__ 1 /* SunOS */
9 #define __MAKECONTEXT_V2_SOURCE 1 /* SunOS */
10 #define _BSD_SOURCE 1
11 #define _SVID_SOURCE 1
12 #define _XOPEN_SOURCE 1000
13 #define _XOPEN_SOURCE_EXTENDED 1
14 #define _LARGEFILE64_SOURCE 1
15 #define _FILE_OFFSET_BITS 64
17 #include <unistd.h>
18 #include <string.h>
19 #include <stdlib.h>
20 #include <stdarg.h>
21 #include <fcntl.h>
22 #include <assert.h>
23 #include <setjmp.h>
24 #include <stddef.h>
25 #include <utf.h>
26 #include <fmt.h>
27 #include <math.h>
28 #include <ctype.h> /* for tolower */
30 /*
31 * OS-specific crap
32 */
33 #define _NEEDUCHAR 1
34 #define _NEEDUSHORT 1
35 #define _NEEDUINT 1
36 #define _NEEDULONG 1
38 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
40 #if defined(__linux__)
41 # include <sys/types.h>
42 # if defined(__USE_MISC)
43 # undef _NEEDUSHORT
44 # undef _NEEDUINT
45 # undef _NEEDULONG
46 # endif
47 # if defined(__Linux26__)
48 # define PLAN9PORT_USING_PTHREADS 1
49 # endif
50 #elif defined(__sun__)
51 # include <sys/types.h>
52 # undef _NEEDUSHORT
53 # undef _NEEDUINT
54 # undef _NEEDULONG
55 # define PLAN9PORT_USING_PTHREADS 1
56 #elif defined(__FreeBSD__)
57 # include <sys/types.h>
58 # include <osreldate.h>
59 # if !defined(_POSIX_SOURCE)
60 # undef _NEEDUSHORT
61 # undef _NEEDUINT
62 # endif
63 # if __FreeBSD_version >= 500000
64 # define PLAN9PORT_USING_PTHREADS 1
65 # endif
66 #elif defined(__APPLE__)
67 # include <sys/types.h>
68 # undef _NEEDUSHORT
69 # undef _NEEDUINT
70 # define _NEEDLL 1
71 # define PLAN9PORT_USING_PTHREADS 1
72 #else
73 /* No idea what system this is -- try some defaults */
74 # define PLAN9PORT_USING_PTHREADS 1
75 #endif
77 #ifndef O_DIRECT
78 #define O_DIRECT 0
79 #endif
81 #ifdef PLAN9PORT_USING_PTHREADS
82 #include <pthread.h>
83 #endif
85 typedef signed char schar;
86 typedef unsigned int u32int;
87 typedef int s32int;
89 #ifdef _NEEDUCHAR
90 typedef unsigned char uchar;
91 #endif
92 #ifdef _NEEDUSHORT
93 typedef unsigned short ushort;
94 #endif
95 #ifdef _NEEDUINT
96 typedef unsigned int uint;
97 #endif
98 #ifdef _NEEDULONG
99 typedef unsigned long ulong;
100 #endif
101 typedef unsigned long long uvlong;
102 typedef long long vlong;
103 typedef uvlong u64int;
104 typedef vlong s64int;
105 typedef uchar u8int;
106 typedef schar s8int;
107 typedef ushort u16int;
108 typedef short s16int;
110 #undef _NEEDUCHAR
111 #undef _NEEDUSHORT
112 #undef _NEEDUINT
113 #undef _NEEDULONG
115 /*
116 * Funny-named symbols to tip off 9l to autolink.
117 */
118 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
120 /*
121 * Gcc 3 is too smart for its own good.
122 */
123 #if defined(__GNUC__)
124 # if __GNUC__ >= 3
125 # undef AUTOLIB
126 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
127 # endif
128 #endif
130 #if defined(__cplusplus)
132 #endif
133 #endif