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