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 /* NOT USING #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(__Linux26__)
43 # include <pthread.h>
44 # define PLAN9PORT_USING_PTHREADS 1
45 # endif
46 # if defined(__USE_MISC)
47 # undef _NEEDUSHORT
48 # undef _NEEDUINT
49 # undef _NEEDULONG
50 # endif
51 #elif defined(__sun__)
52 # include <sys/types.h>
53 # include <pthread.h>
54 # define PLAN9PORT_USING_PTHREADS 1
55 # undef _NEEDUSHORT
56 # undef _NEEDUINT
57 # undef _NEEDULONG
58 # define nil 0 /* no cast to void* */
59 #elif defined(__FreeBSD__)
60 # include <sys/types.h>
61 # include <osreldate.h>
62 # if __FreeBSD_version >= 500000
63 # define PLAN9PORT_USING_PTHREADS 1
64 # include <pthread.h>
65 # endif
66 # if !defined(_POSIX_SOURCE)
67 # undef _NEEDUSHORT
68 # undef _NEEDUINT
69 # endif
70 #elif defined(__APPLE__)
71 # include <sys/types.h>
72 # include <pthread.h>
73 # define PLAN9PORT_USING_PTHREADS 1
74 # undef _NEEDUSHORT
75 # undef _NEEDUINT
76 # define _NEEDLL 1
77 #else
78 /* No idea what system this is -- try some defaults */
79 # include <pthread.h>
80 # define PLAN9PORT_USING_PTHREADS 1
81 #endif
83 #ifndef O_DIRECT
84 #define O_DIRECT 0
85 #endif
87 typedef signed char schar;
88 typedef unsigned int u32int;
89 typedef int s32int;
91 #ifdef _NEEDUCHAR
92 typedef unsigned char uchar;
93 #endif
94 #ifdef _NEEDUSHORT
95 typedef unsigned short ushort;
96 #endif
97 #ifdef _NEEDUINT
98 typedef unsigned int uint;
99 #endif
100 #ifdef _NEEDULONG
101 typedef unsigned long ulong;
102 #endif
103 typedef unsigned long long uvlong;
104 typedef long long vlong;
105 typedef uvlong u64int;
106 typedef vlong s64int;
107 typedef uchar u8int;
108 typedef schar s8int;
109 typedef ushort u16int;
110 typedef short s16int;
112 #undef _NEEDUCHAR
113 #undef _NEEDUSHORT
114 #undef _NEEDUINT
115 #undef _NEEDULONG
117 /*
118 * Funny-named symbols to tip off 9l to autolink.
119 */
120 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
122 /*
123 * Gcc 3 is too smart for its own good.
124 */
125 #if defined(__GNUC__) && !defined(__APPLE_CC__)
126 # if __GNUC__ >= 3
127 # undef AUTOLIB
128 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
129 # endif
130 #endif
132 #if defined(__cplusplus)
134 #endif
135 #endif