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 _NETBSD_SOURCE 1 /* NetBSD */
12 #define _SVID_SOURCE 1
13 #define _XOPEN_SOURCE 1000
14 #define _XOPEN_SOURCE_EXTENDED 1
15 #define _LARGEFILE64_SOURCE 1
16 #define _FILE_OFFSET_BITS 64
18 #include <unistd.h>
19 #include <string.h>
20 #include <stdlib.h>
21 #include <stdarg.h>
22 #include <fcntl.h>
23 #include <assert.h>
24 #include <setjmp.h>
25 #include <stddef.h>
26 #include <utf.h>
27 #include <fmt.h>
28 #include <math.h>
29 #include <ctype.h> /* for tolower */
31 /*
32 * OS-specific crap
33 */
34 #define _NEEDUCHAR 1
35 #define _NEEDUSHORT 1
36 #define _NEEDUINT 1
37 #define _NEEDULONG 1
39 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
41 #if defined(__linux__)
42 # include <sys/types.h>
43 # if defined(__Linux26__)
44 # include <pthread.h>
45 # define PLAN9PORT_USING_PTHREADS 1
46 # endif
47 # if defined(__USE_MISC)
48 # undef _NEEDUSHORT
49 # undef _NEEDUINT
50 # undef _NEEDULONG
51 # endif
52 #elif defined(__sun__)
53 # include <sys/types.h>
54 # include <pthread.h>
55 # define PLAN9PORT_USING_PTHREADS 1
56 # undef _NEEDUSHORT
57 # undef _NEEDUINT
58 # undef _NEEDULONG
59 # define nil 0 /* no cast to void* */
60 #elif defined(__FreeBSD__)
61 # include <sys/types.h>
62 # include <osreldate.h>
63 # if __FreeBSD_version >= 500000
64 # define PLAN9PORT_USING_PTHREADS 1
65 # include <pthread.h>
66 # endif
67 # if !defined(_POSIX_SOURCE)
68 # undef _NEEDUSHORT
69 # undef _NEEDUINT
70 # endif
71 #elif defined(__APPLE__)
72 # include <sys/types.h>
73 # include <pthread.h>
74 # define PLAN9PORT_USING_PTHREADS 1
75 # undef _NEEDUSHORT
76 # undef _NEEDUINT
77 # define _NEEDLL 1
78 #elif defined(__NetBSD__)
79 # include <sched.h>
80 # include <sys/types.h>
81 # undef _NEEDUSHORT
82 # undef _NEEDUINT
83 # undef _NEEDULONG
84 #elif defined(__OpenBSD__)
85 # undef _NEEDUSHORT
86 # undef _NEEDUINT
87 # undef _NEEDULONG
88 #else
89 /* No idea what system this is -- try some defaults */
90 # include <pthread.h>
91 # define PLAN9PORT_USING_PTHREADS 1
92 #endif
94 #ifndef O_DIRECT
95 #define O_DIRECT 0
96 #endif
98 typedef signed char schar;
99 typedef unsigned int u32int;
100 typedef int s32int;
102 #ifdef _NEEDUCHAR
103 typedef unsigned char uchar;
104 #endif
105 #ifdef _NEEDUSHORT
106 typedef unsigned short ushort;
107 #endif
108 #ifdef _NEEDUINT
109 typedef unsigned int uint;
110 #endif
111 #ifdef _NEEDULONG
112 typedef unsigned long ulong;
113 #endif
114 typedef unsigned long long uvlong;
115 typedef long long vlong;
116 typedef uvlong u64int;
117 typedef vlong s64int;
118 typedef uchar u8int;
119 typedef schar s8int;
120 typedef ushort u16int;
121 typedef short s16int;
123 #undef _NEEDUCHAR
124 #undef _NEEDUSHORT
125 #undef _NEEDUINT
126 #undef _NEEDULONG
128 /*
129 * Funny-named symbols to tip off 9l to autolink.
130 */
131 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
133 /*
134 * Gcc 3 is too smart for its own good.
135 */
136 #if defined(__GNUC__) && !defined(__APPLE_CC__)
137 # if __GNUC__ >= 3
138 # undef AUTOLIB
139 # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
140 # endif
141 #endif
143 #if defined(__cplusplus)
145 #endif
146 #endif