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