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 8ad51794 2004-03-25 devnull # if defined(__USE_MISC)
43 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
44 8ad51794 2004-03-25 devnull # undef _NEEDUINT
45 8ad51794 2004-03-25 devnull # undef _NEEDULONG
46 8ad51794 2004-03-25 devnull # endif
47 c6687d45 2004-09-21 devnull # if defined(__Linux26__)
48 39b3054a 2004-12-25 devnull # define PLAN9PORT_USING_PTHREADS 1
49 c6687d45 2004-09-21 devnull # endif
50 39b3054a 2004-12-25 devnull #elif defined(__sun__)
51 8ad51794 2004-03-25 devnull # include <sys/types.h>
52 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
53 8ad51794 2004-03-25 devnull # undef _NEEDUINT
54 8ad51794 2004-03-25 devnull # undef _NEEDULONG
55 39b3054a 2004-12-25 devnull # define PLAN9PORT_USING_PTHREADS 1
56 39b3054a 2004-12-25 devnull #elif defined(__FreeBSD__)
57 8ad51794 2004-03-25 devnull # include <sys/types.h>
58 7ee1ac96 2004-12-29 devnull # include <osreldate.h>
59 8ad51794 2004-03-25 devnull # if !defined(_POSIX_SOURCE)
60 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
61 8ad51794 2004-03-25 devnull # undef _NEEDUINT
62 8ad51794 2004-03-25 devnull # endif
63 7ee1ac96 2004-12-29 devnull # if __FreeBSD_version >= 500000
64 39b3054a 2004-12-25 devnull # define PLAN9PORT_USING_PTHREADS 1
65 39b3054a 2004-12-25 devnull # endif
66 39b3054a 2004-12-25 devnull #elif defined(__APPLE__)
67 8ad51794 2004-03-25 devnull # include <sys/types.h>
68 8ad51794 2004-03-25 devnull # undef _NEEDUSHORT
69 8ad51794 2004-03-25 devnull # undef _NEEDUINT
70 8ad51794 2004-03-25 devnull # define _NEEDLL 1
71 39b3054a 2004-12-25 devnull # define PLAN9PORT_USING_PTHREADS 1
72 39b3054a 2004-12-25 devnull #else
73 39b3054a 2004-12-25 devnull /* No idea what system this is -- try some defaults */
74 39b3054a 2004-12-25 devnull # define PLAN9PORT_USING_PTHREADS 1
75 8ad51794 2004-03-25 devnull #endif
76 8ad51794 2004-03-25 devnull
77 39b3054a 2004-12-25 devnull #ifndef O_DIRECT
78 39b3054a 2004-12-25 devnull #define O_DIRECT 0
79 39b3054a 2004-12-25 devnull #endif
80 06bb4ed2 2004-09-17 devnull
81 39b3054a 2004-12-25 devnull #ifdef PLAN9PORT_USING_PTHREADS
82 39b3054a 2004-12-25 devnull #include <pthread.h>
83 39b3054a 2004-12-25 devnull #endif
84 39b3054a 2004-12-25 devnull
85 8ad51794 2004-03-25 devnull typedef signed char schar;
86 8ad51794 2004-03-25 devnull typedef unsigned int u32int;
87 785a7364 2004-04-19 devnull typedef int s32int;
88 785a7364 2004-04-19 devnull
89 8ad51794 2004-03-25 devnull #ifdef _NEEDUCHAR
90 8ad51794 2004-03-25 devnull typedef unsigned char uchar;
91 8ad51794 2004-03-25 devnull #endif
92 8ad51794 2004-03-25 devnull #ifdef _NEEDUSHORT
93 8ad51794 2004-03-25 devnull typedef unsigned short ushort;
94 8ad51794 2004-03-25 devnull #endif
95 8ad51794 2004-03-25 devnull #ifdef _NEEDUINT
96 8ad51794 2004-03-25 devnull typedef unsigned int uint;
97 8ad51794 2004-03-25 devnull #endif
98 8ad51794 2004-03-25 devnull #ifdef _NEEDULONG
99 8ad51794 2004-03-25 devnull typedef unsigned long ulong;
100 8ad51794 2004-03-25 devnull #endif
101 8ad51794 2004-03-25 devnull typedef unsigned long long uvlong;
102 8ad51794 2004-03-25 devnull typedef long long vlong;
103 8ad51794 2004-03-25 devnull typedef uvlong u64int;
104 785a7364 2004-04-19 devnull typedef vlong s64int;
105 8ad51794 2004-03-25 devnull typedef uchar u8int;
106 785a7364 2004-04-19 devnull typedef schar s8int;
107 8ad51794 2004-03-25 devnull typedef ushort u16int;
108 785a7364 2004-04-19 devnull typedef short s16int;
109 8ad51794 2004-03-25 devnull
110 8ad51794 2004-03-25 devnull #undef _NEEDUCHAR
111 8ad51794 2004-03-25 devnull #undef _NEEDUSHORT
112 8ad51794 2004-03-25 devnull #undef _NEEDUINT
113 8ad51794 2004-03-25 devnull #undef _NEEDULONG
114 8ad51794 2004-03-25 devnull
115 1a0954ab 2005-01-04 devnull /*
116 1a0954ab 2005-01-04 devnull * Funny-named symbols to tip off 9l to autolink.
117 1a0954ab 2005-01-04 devnull */
118 1a0954ab 2005-01-04 devnull #define AUTOLIB(x) static int __p9l_autolib_ ## x = 1;
119 1a0954ab 2005-01-04 devnull
120 9b4de09d 2005-01-06 devnull /*
121 9b4de09d 2005-01-06 devnull * Gcc 3 is too smart for its own good.
122 9b4de09d 2005-01-06 devnull */
123 b8f742db 2005-01-11 devnull #if defined(__GNUC__) && !defined(__APPLE_CC__)
124 9b4de09d 2005-01-06 devnull # if __GNUC__ >= 3
125 9b4de09d 2005-01-06 devnull # undef AUTOLIB
126 9b4de09d 2005-01-06 devnull # define AUTOLIB(x) int __p9l_autolib_ ## x __attribute__ ((weak));
127 9b4de09d 2005-01-06 devnull # endif
128 9b4de09d 2005-01-06 devnull #endif
129 9b4de09d 2005-01-06 devnull
130 8ad51794 2004-03-25 devnull #if defined(__cplusplus)
131 8ad51794 2004-03-25 devnull }
132 8ad51794 2004-03-25 devnull #endif
133 8ad51794 2004-03-25 devnull #endif