Blame


1 8ad51794 2004-03-25 devnull #ifndef _U_H_
2 8ad51794 2004-03-25 devnull #define _U_H_ 1
3 8ad51794 2004-03-25 devnull #if defined(__cplusplus)
4 8ad51794 2004-03-25 devnull extern "C" {
5 8ad51794 2004-03-25 devnull #endif
6 8ad51794 2004-03-25 devnull
7 39b3054a 2004-12-25 devnull #define __BSD_VISIBLE 1 /* FreeBSD 5.x */
8 d08f4066 2005-07-27 devnull #if defined(__sun__)
9 d08f4066 2005-07-27 devnull # define __EXTENSIONS__ 1 /* SunOS */
10 f12ab349 2008-07-20 devnull # if defined(__SunOS5_6__) || defined(__SunOS5_7__) || defined(__SunOS5_8__) || defined(__SunOS5_9__) || defined(__SunOS5_10__)
11 d08f4066 2005-07-27 devnull /* NOT USING #define __MAKECONTEXT_V2_SOURCE 1 / * SunOS */
12 d08f4066 2005-07-27 devnull # else
13 f12ab349 2008-07-20 devnull /* What's left? */
14 d08f4066 2005-07-27 devnull # define __MAKECONTEXT_V2_SOURCE 1
15 d08f4066 2005-07-27 devnull # endif
16 d08f4066 2005-07-27 devnull #endif
17 8ad51794 2004-03-25 devnull #define _BSD_SOURCE 1
18 5ba33c04 2005-03-28 devnull #define _NETBSD_SOURCE 1 /* NetBSD */
19 8ad51794 2004-03-25 devnull #define _SVID_SOURCE 1
20 20e8b903 2005-07-20 devnull #if !defined(__APPLE__) && !defined(__OpenBSD__)
21 a8ec4910 2005-07-13 devnull # define _XOPEN_SOURCE 1000
22 a8ec4910 2005-07-13 devnull # define _XOPEN_SOURCE_EXTENDED 1
23 a8ec4910 2005-07-13 devnull #endif
24 838874f0 2006-04-04 devnull #if defined(__FreeBSD__)
25 838874f0 2006-04-04 devnull # include <sys/cdefs.h>
26 838874f0 2006-04-04 devnull /* for strtoll */
27 838874f0 2006-04-04 devnull # undef __ISO_C_VISIBLE
28 838874f0 2006-04-04 devnull # define __ISO_C_VISIBLE 1999
29 838874f0 2006-04-04 devnull # undef __LONG_LONG_SUPPORTED
30 838874f0 2006-04-04 devnull # define __LONG_LONG_SUPPORTED
31 838874f0 2006-04-04 devnull #endif
32 8ad51794 2004-03-25 devnull #define _LARGEFILE64_SOURCE 1
33 8ad51794 2004-03-25 devnull #define _FILE_OFFSET_BITS 64
34 8ad51794 2004-03-25 devnull
35 20e8b903 2005-07-20 devnull #include <inttypes.h>
36 76e02e9b 2005-07-19 devnull
37 8ad51794 2004-03-25 devnull #include <unistd.h>
38 8ad51794 2004-03-25 devnull #include <string.h>
39 8ad51794 2004-03-25 devnull #include <stdlib.h>
40 8ad51794 2004-03-25 devnull #include <stdarg.h>
41 8ad51794 2004-03-25 devnull #include <fcntl.h>
42 8ad51794 2004-03-25 devnull #include <assert.h>
43 8ad51794 2004-03-25 devnull #include <setjmp.h>
44 8ad51794 2004-03-25 devnull #include <stddef.h>
45 8ad51794 2004-03-25 devnull #include <math.h>
46 c8af1ab1 2004-04-19 devnull #include <ctype.h> /* for tolower */
47 8ad51794 2004-03-25 devnull
48 8ad51794 2004-03-25 devnull /*
49 8ad51794 2004-03-25 devnull * OS-specific crap
50 8ad51794 2004-03-25 devnull */
51 8ad51794 2004-03-25 devnull #define _NEEDUCHAR 1
52 8ad51794 2004-03-25 devnull #define _NEEDUSHORT 1
53 8ad51794 2004-03-25 devnull #define _NEEDUINT 1
54 8ad51794 2004-03-25 devnull #define _NEEDULONG 1
55 8ad51794 2004-03-25 devnull
56 8ad51794 2004-03-25 devnull typedef long p9jmp_buf[sizeof(sigjmp_buf)/sizeof(long)];
57 8ad51794 2004-03-25 devnull
58 8ad51794 2004-03-25 devnull #if defined(__linux__)
59 8ad51794 2004-03-25 devnull # include <sys/types.h>
60 aaa502d3 2005-03-15 devnull # if defined(__Linux26__)
61 aaa502d3 2005-03-15 devnull # include <pthread.h>
62 aaa502d3 2005-03-15 devnull # define PLAN9PORT_USING_PTHREADS 1
63 aaa502d3 2005-03-15 devnull # endif
64 8ad51794 2004-03-25 devnull # if defined(__USE_MISC)
65 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
66 8ad51794 2004-03-25 devnull # undef _NEEDUINT
67 8ad51794 2004-03-25 devnull # undef _NEEDULONG
68 8ad51794 2004-03-25 devnull # endif
69 39b3054a 2004-12-25 devnull #elif defined(__sun__)
70 8ad51794 2004-03-25 devnull # include <sys/types.h>
71 aaa502d3 2005-03-15 devnull # include <pthread.h>
72 aaa502d3 2005-03-15 devnull # define PLAN9PORT_USING_PTHREADS 1
73 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
74 8ad51794 2004-03-25 devnull # undef _NEEDUINT
75 8ad51794 2004-03-25 devnull # undef _NEEDULONG
76 aaa502d3 2005-03-15 devnull # define nil 0 /* no cast to void* */
77 39b3054a 2004-12-25 devnull #elif defined(__FreeBSD__)
78 8ad51794 2004-03-25 devnull # include <sys/types.h>
79 7ee1ac96 2004-12-29 devnull # include <osreldate.h>
80 aaa502d3 2005-03-15 devnull # if __FreeBSD_version >= 500000
81 aaa502d3 2005-03-15 devnull # define PLAN9PORT_USING_PTHREADS 1
82 aaa502d3 2005-03-15 devnull # include <pthread.h>
83 aaa502d3 2005-03-15 devnull # endif
84 8ad51794 2004-03-25 devnull # if !defined(_POSIX_SOURCE)
85 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
86 8ad51794 2004-03-25 devnull # undef _NEEDUINT
87 8ad51794 2004-03-25 devnull # endif
88 39b3054a 2004-12-25 devnull #elif defined(__APPLE__)
89 8ad51794 2004-03-25 devnull # include <sys/types.h>
90 aaa502d3 2005-03-15 devnull # include <pthread.h>
91 aaa502d3 2005-03-15 devnull # define PLAN9PORT_USING_PTHREADS 1
92 bc7da029 2005-05-07 devnull # if __GNUC__ < 4
93 bc7da029 2005-05-07 devnull # undef _NEEDUSHORT
94 bc7da029 2005-05-07 devnull # undef _NEEDUINT
95 bc7da029 2005-05-07 devnull # endif
96 bc7da029 2005-05-07 devnull # undef _ANSI_SOURCE
97 bc7da029 2005-05-07 devnull # undef _POSIX_C_SOURCE
98 a8ec4910 2005-07-13 devnull # undef _XOPEN_SOURCE
99 bc7da029 2005-05-07 devnull # if !defined(NSIG)
100 bc7da029 2005-05-07 devnull # define NSIG 32
101 bc7da029 2005-05-07 devnull # endif
102 8ad51794 2004-03-25 devnull # define _NEEDLL 1
103 5ba33c04 2005-03-28 devnull #elif defined(__NetBSD__)
104 5ba33c04 2005-03-28 devnull # include <sched.h>
105 5ba33c04 2005-03-28 devnull # include <sys/types.h>
106 5ba33c04 2005-03-28 devnull # undef _NEEDUSHORT
107 5ba33c04 2005-03-28 devnull # undef _NEEDUINT
108 5ba33c04 2005-03-28 devnull # undef _NEEDULONG
109 52e61644 2005-05-01 devnull #elif defined(__OpenBSD__)
110 ceb21b8a 2005-07-19 devnull # include <sys/types.h>
111 52e61644 2005-05-01 devnull # undef _NEEDUSHORT
112 52e61644 2005-05-01 devnull # undef _NEEDUINT
113 52e61644 2005-05-01 devnull # undef _NEEDULONG
114 39b3054a 2004-12-25 devnull #else
115 39b3054a 2004-12-25 devnull /* No idea what system this is -- try some defaults */
116 aaa502d3 2005-03-15 devnull # include <pthread.h>
117 39b3054a 2004-12-25 devnull # define PLAN9PORT_USING_PTHREADS 1
118 8ad51794 2004-03-25 devnull #endif
119 8ad51794 2004-03-25 devnull
120 39b3054a 2004-12-25 devnull #ifndef O_DIRECT
121 39b3054a 2004-12-25 devnull #define O_DIRECT 0
122 39b3054a 2004-12-25 devnull #endif
123 06bb4ed2 2004-09-17 devnull
124 8ad51794 2004-03-25 devnull typedef signed char schar;
125 785a7364 2004-04-19 devnull
126 8ad51794 2004-03-25 devnull #ifdef _NEEDUCHAR
127 8ad51794 2004-03-25 devnull typedef unsigned char uchar;
128 8ad51794 2004-03-25 devnull #endif
129 8ad51794 2004-03-25 devnull #ifdef _NEEDUSHORT
130 8ad51794 2004-03-25 devnull typedef unsigned short ushort;
131 8ad51794 2004-03-25 devnull #endif
132 8ad51794 2004-03-25 devnull #ifdef _NEEDUINT
133 8ad51794 2004-03-25 devnull typedef unsigned int uint;
134 8ad51794 2004-03-25 devnull #endif
135 8ad51794 2004-03-25 devnull #ifdef _NEEDULONG
136 8ad51794 2004-03-25 devnull typedef unsigned long ulong;
137 8ad51794 2004-03-25 devnull #endif
138 8ad51794 2004-03-25 devnull typedef unsigned long long uvlong;
139 8ad51794 2004-03-25 devnull typedef long long vlong;
140 8ad51794 2004-03-25 devnull
141 76e02e9b 2005-07-19 devnull typedef uint64_t u64int;
142 76e02e9b 2005-07-19 devnull typedef int64_t s64int;
143 76e02e9b 2005-07-19 devnull typedef uint8_t u8int;
144 76e02e9b 2005-07-19 devnull typedef int8_t s8int;
145 76e02e9b 2005-07-19 devnull typedef uint16_t u16int;
146 76e02e9b 2005-07-19 devnull typedef int16_t s16int;
147 76e02e9b 2005-07-19 devnull typedef uintptr_t uintptr;
148 949b59cd 2008-03-06 rsc typedef intptr_t intptr;
149 76e02e9b 2005-07-19 devnull typedef uint32_t u32int;
150 76e02e9b 2005-07-19 devnull typedef int32_t s32int;
151 76e02e9b 2005-07-19 devnull
152 8ad51794 2004-03-25 devnull #undef _NEEDUCHAR
153 8ad51794 2004-03-25 devnull #undef _NEEDUSHORT
154 8ad51794 2004-03-25 devnull #undef _NEEDUINT
155 8ad51794 2004-03-25 devnull #undef _NEEDULONG
156 8ad51794 2004-03-25 devnull
157 1a0954ab 2005-01-04 devnull /*
158 1a0954ab 2005-01-04 devnull * Funny-named symbols to tip off 9l to autolink.
159 1a0954ab 2005-01-04 devnull */
160 1a0954ab 2005-01-04 devnull #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
161 58c52409 2005-10-29 devnull #define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x = 1;
162 1a0954ab 2005-01-04 devnull
163 9b4de09d 2005-01-06 devnull /*
164 bc7da029 2005-05-07 devnull * Gcc is too smart for its own good.
165 9b4de09d 2005-01-06 devnull */
166 bc7da029 2005-05-07 devnull #if defined(__GNUC__)
167 c54b8b69 2006-01-27 devnull # undef strcmp /* causes way too many warnings */
168 bc7da029 2005-05-07 devnull # if __GNUC__ >= 4 || (__GNUC__==3 && !defined(__APPLE_CC__))
169 9b4de09d 2005-01-06 devnull # undef AUTOLIB
170 9b4de09d 2005-01-06 devnull # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
171 58c52409 2005-10-29 devnull # undef AUTOFRAMEWORK
172 58c52409 2005-10-29 devnull # define AUTOFRAMEWORK(x) int __p9l_autoframework_ ## x __attribute__ ((weak));
173 9d7a2e6e 2005-05-02 devnull # else
174 9d7a2e6e 2005-05-02 devnull # undef AUTOLIB
175 9d7a2e6e 2005-05-02 devnull # define AUTOLIB(x) static int __p9l_autolib_ ## x __attribute__ ((unused));
176 58c52409 2005-10-29 devnull # undef AUTOFRAMEWORK
177 58c52409 2005-10-29 devnull # define AUTOFRAMEWORK(x) static int __p9l_autoframework_ ## x __attribute__ ((unused));
178 9b4de09d 2005-01-06 devnull # endif
179 9b4de09d 2005-01-06 devnull #endif
180 9b4de09d 2005-01-06 devnull
181 8ad51794 2004-03-25 devnull #if defined(__cplusplus)
182 8ad51794 2004-03-25 devnull }
183 8ad51794 2004-03-25 devnull #endif
184 8ad51794 2004-03-25 devnull #endif