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 _BSD_SOURCE 1
10 #define _SVID_SOURCE 1
11 #define _XOPEN_SOURCE 1000
12 #define _XOPEN_SOURCE_EXTENDED 1
13 #define _LARGEFILE64_SOURCE 1
14 #define _FILE_OFFSET_BITS 64
16 #include <unistd.h>
17 #include <string.h>
18 #include <stdlib.h>
19 #include <stdarg.h>
20 #include <fcntl.h>
21 #include <assert.h>
22 #include <setjmp.h>
23 #include <stddef.h>
24 #include <utf.h>
25 #include <fmt.h>
26 #include <math.h>
27 #include <ctype.h> /* for tolower */
29 /*
30 * OS-specific crap
31 */
32 #define _NEEDUCHAR 1
33 #define _NEEDUSHORT 1
34 #define _NEEDUINT 1
35 #define _NEEDULONG 1
37 typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
39 #if defined(__linux__)
40 # include <sys/types.h>
41 # if defined(__USE_MISC)
42 # undef _NEEDUSHORT
43 # undef _NEEDUINT
44 # undef _NEEDULONG
45 # endif
46 # if defined(__Linux26__)
47 # define PLAN9PORT_USING_PTHREADS 1
48 # endif
49 #elif defined(__sun__)
50 # include <sys/types.h>
51 # undef _NEEDUSHORT
52 # undef _NEEDUINT
53 # undef _NEEDULONG
54 # define PLAN9PORT_USING_PTHREADS 1
55 #elif defined(__FreeBSD__)
56 # include <sys/types.h>
57 # include <osreldate.h>
58 # if !defined(_POSIX_SOURCE)
59 # undef _NEEDUSHORT
60 # undef _NEEDUINT
61 # endif
62 # if __FreeBSD_version >= 500000
63 # define PLAN9PORT_USING_PTHREADS 1
64 # endif
65 #elif defined(__APPLE__)
66 # include <sys/types.h>
67 # undef _NEEDUSHORT
68 # undef _NEEDUINT
69 # define _NEEDLL 1
70 # define PLAN9PORT_USING_PTHREADS 1
71 #else
72 /* No idea what system this is -- try some defaults */
73 # define PLAN9PORT_USING_PTHREADS 1
74 #endif
76 #ifndef O_DIRECT
77 #define O_DIRECT 0
78 #endif
80 #ifdef PLAN9PORT_USING_PTHREADS
81 #include <pthread.h>
82 #endif
84 typedef signed char schar;
85 typedef unsigned int u32int;
86 typedef int s32int;
88 #ifdef _NEEDUCHAR
89 typedef unsigned char uchar;
90 #endif
91 #ifdef _NEEDUSHORT
92 typedef unsigned short ushort;
93 #endif
94 #ifdef _NEEDUINT
95 typedef unsigned int uint;
96 #endif
97 #ifdef _NEEDULONG
98 typedef unsigned long ulong;
99 #endif
100 typedef unsigned long long uvlong;
101 typedef long long vlong;
102 typedef uvlong u64int;
103 typedef vlong s64int;
104 typedef uchar u8int;
105 typedef schar s8int;
106 typedef ushort u16int;
107 typedef short s16int;
109 #undef _NEEDUCHAR
110 #undef _NEEDUSHORT
111 #undef _NEEDUINT
112 #undef _NEEDULONG
114 /*
115 * Funny-named symbols to tip off 9l to autolink.
116 */
117 #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
119 #if defined(__cplusplus)
121 #endif
122 #endif