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 # if !defined(_POSIX_SOURCE)
58 # undef _NEEDUSHORT
59 # undef _NEEDUINT
60 # endif
61 # if defined(__FreeBSD5__)
62 # define PLAN9PORT_USING_PTHREADS 1
63 # endif
64 #elif defined(__APPLE__)
65 # include <sys/types.h>
66 # undef _NEEDUSHORT
67 # undef _NEEDUINT
68 # define _NEEDLL 1
69 # define PLAN9PORT_USING_PTHREADS 1
70 #else
71 /* No idea what system this is -- try some defaults */
72 # define PLAN9PORT_USING_PTHREADS 1
73 #endif
75 #ifndef O_DIRECT
76 #define O_DIRECT 0
77 #endif
79 #ifdef PLAN9PORT_USING_PTHREADS
80 #include <pthread.h>
81 #endif
83 typedef signed char schar;
84 typedef unsigned int u32int;
85 typedef int s32int;
87 #ifdef _NEEDUCHAR
88 typedef unsigned char uchar;
89 #endif
90 #ifdef _NEEDUSHORT
91 typedef unsigned short ushort;
92 #endif
93 #ifdef _NEEDUINT
94 typedef unsigned int uint;
95 #endif
96 #ifdef _NEEDULONG
97 typedef unsigned long ulong;
98 #endif
99 typedef unsigned long long uvlong;
100 typedef long long vlong;
101 typedef uvlong u64int;
102 typedef vlong s64int;
103 typedef uchar u8int;
104 typedef schar s8int;
105 typedef ushort u16int;
106 typedef short s16int;
108 #undef _NEEDUCHAR
109 #undef _NEEDUSHORT
110 #undef _NEEDUINT
111 #undef _NEEDULONG
113 #if defined(__cplusplus)
115 #endif
116 #endif