207 |
mateuszvis |
1 |
/*!\file sys/cdefs.h
|
|
|
2 |
*
|
|
|
3 |
* C-compiler definitions.
|
|
|
4 |
*/
|
|
|
5 |
|
|
|
6 |
/*
|
|
|
7 |
* Copyright (c) 1991, 1993
|
|
|
8 |
* The Regents of the University of California. All rights reserved.
|
|
|
9 |
*
|
|
|
10 |
* This code is derived from software contributed to Berkeley by
|
|
|
11 |
* Berkeley Software Design, Inc.
|
|
|
12 |
*
|
|
|
13 |
* Redistribution and use in source and binary forms, with or without
|
|
|
14 |
* modification, are permitted provided that the following conditions
|
|
|
15 |
* are met:
|
|
|
16 |
* 1. Redistributions of source code must retain the above copyright
|
|
|
17 |
* notice, this list of conditions and the following disclaimer.
|
|
|
18 |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
19 |
* notice, this list of conditions and the following disclaimer in the
|
|
|
20 |
* documentation and/or other materials provided with the distribution.
|
|
|
21 |
* 3. All advertising materials mentioning features or use of this software
|
|
|
22 |
* must display the following acknowledgement:
|
|
|
23 |
* This product includes software developed by the University of
|
|
|
24 |
* California, Berkeley and its contributors.
|
|
|
25 |
* 4. Neither the name of the University nor the names of its contributors
|
|
|
26 |
* may be used to endorse or promote products derived from this software
|
|
|
27 |
* without specific prior written permission.
|
|
|
28 |
*
|
|
|
29 |
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
30 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
31 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
32 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
33 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
34 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
35 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
36 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
37 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
38 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
39 |
* SUCH DAMAGE.
|
|
|
40 |
*
|
|
|
41 |
* @(#)cdefs.h 8.7 (Berkeley) 1/21/94
|
|
|
42 |
*/
|
|
|
43 |
|
|
|
44 |
#ifndef __SYS_CDEFS_H
|
|
|
45 |
#define __SYS_CDEFS_H
|
|
|
46 |
|
|
|
47 |
#if defined(__DJGPP__) && !defined(djgpp_cdefs_incl)
|
|
|
48 |
#include "/dev/env/DJDIR/include/sys/cdefs.h"
|
|
|
49 |
#define djgpp_cdefs_incl
|
|
|
50 |
#endif
|
|
|
51 |
|
|
|
52 |
#ifdef __cplusplus
|
|
|
53 |
#define __BEGIN_DECLS extern "C" {
|
|
|
54 |
#define __END_DECLS }
|
|
|
55 |
#else
|
|
|
56 |
#define __BEGIN_DECLS
|
|
|
57 |
#define __END_DECLS
|
|
|
58 |
#endif
|
|
|
59 |
|
|
|
60 |
#ifndef W32_NAMESPACE
|
|
|
61 |
#define W32_NAMESPACE(x) _w32_ ## x
|
|
|
62 |
#endif
|
|
|
63 |
|
|
|
64 |
#if defined(__CCDL__)
|
|
|
65 |
#define cdecl _cdecl
|
|
|
66 |
|
|
|
67 |
#elif defined(__MINGW32__) && !defined(cdecl)
|
|
|
68 |
#define cdecl __attribute__((__cdecl__))
|
|
|
69 |
|
|
|
70 |
#elif defined(_MSC_VER) || defined(__POCC__)
|
|
|
71 |
#undef cdecl
|
|
|
72 |
#if (_MSC_VER <= 600)
|
|
|
73 |
#define cdecl _cdecl
|
|
|
74 |
#undef __STDC__
|
|
|
75 |
#define __STDC__ 1
|
|
|
76 |
#else
|
|
|
77 |
#define cdecl __cdecl
|
|
|
78 |
#endif
|
|
|
79 |
#define NO_ANSI_KEYWORDS
|
|
|
80 |
|
|
|
81 |
#elif defined(__DMC__)
|
|
|
82 |
#define NO_UNDERSCORE __syscall
|
|
|
83 |
/* e.g. int NO_UNDERSCORE foo (void); */
|
|
|
84 |
#endif
|
|
|
85 |
|
|
|
86 |
#ifndef cdecl
|
|
|
87 |
#define cdecl
|
|
|
88 |
#endif
|
|
|
89 |
|
|
|
90 |
#if defined(_MSC_VER) && !defined(WIN32) && !defined(_WIN32)
|
|
|
91 |
/*
|
|
|
92 |
* MS's Quick-C/Visual-C (for DOS) insists that signal-handlers, atexit
|
|
|
93 |
* functions and var-arg functions must be defined cdecl.
|
|
|
94 |
* This is only an issue if a program is using 'fastcall' globally
|
|
|
95 |
* (cl option /Gr).
|
|
|
96 |
* On Win32 this isn't an issue since WATT-32.DLL cannot be built
|
|
|
97 |
* as 'fastcall' anyway.
|
|
|
98 |
*/
|
|
|
99 |
#undef MS_CDECL
|
|
|
100 |
#define MS_CDECL cdecl
|
|
|
101 |
#else
|
|
|
102 |
#define MS_CDECL
|
|
|
103 |
#endif
|
|
|
104 |
|
|
|
105 |
|
|
|
106 |
struct mbuf {
|
|
|
107 |
struct mbuf *next; /* Links mbufs belonging to single packets */
|
|
|
108 |
struct mbuf *anext; /* Links packets on queues */
|
|
|
109 |
unsigned size; /* Size of associated data buffer */
|
|
|
110 |
int refcnt; /* Reference count */
|
|
|
111 |
struct mbuf *dup; /* Pointer to duplicated mbuf */
|
|
|
112 |
char *data; /* Active working pointers */
|
|
|
113 |
unsigned cnt;
|
|
|
114 |
};
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
/*
|
|
|
118 |
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
|
|
|
119 |
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
|
|
|
120 |
* The __CONCAT macro is a bit tricky -- make sure you don't put spaces
|
|
|
121 |
* in between its arguments. __CONCAT can also concatenate double-quoted
|
|
|
122 |
* strings produced by the __STRING macro, but this only works with ANSI C.
|
|
|
123 |
*/
|
|
|
124 |
#if (defined(__STDC__) && __STDC__) || defined(__cplusplus) || defined(__TURBOC__)
|
|
|
125 |
#undef __P
|
|
|
126 |
#define __P(protos) protos /* full-blown ANSI C */
|
|
|
127 |
#define __CONCAT(x,y) x ## y
|
|
|
128 |
#define __STRING(x) #x
|
|
|
129 |
|
|
|
130 |
#define __const const /* define reserved names to standard */
|
|
|
131 |
#define __signed signed
|
|
|
132 |
#define __volatile volatile
|
|
|
133 |
#if defined(__cplusplus)
|
|
|
134 |
#define __inline inline /* convert to C++ keyword */
|
|
|
135 |
#elif !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__WATCOMC__)
|
|
|
136 |
#define __inline /* delete GCC/MSC/Watcom keyword */
|
|
|
137 |
#endif
|
|
|
138 |
|
|
|
139 |
#else
|
|
|
140 |
#define __P(protos) () /* traditional C preprocessor */
|
|
|
141 |
#define __CONCAT(x,y) x/**/y
|
|
|
142 |
#define __STRING(x) "x"
|
|
|
143 |
|
|
|
144 |
#if !defined(__GNUC__) && !defined(_MSC_VER) && !defined(__WATCOMC__)
|
|
|
145 |
#define __inline
|
|
|
146 |
#endif
|
|
|
147 |
|
|
|
148 |
#if !defined(__GNUC__)
|
|
|
149 |
#define __const /* delete pseudo-ANSI C keywords */
|
|
|
150 |
#define __signed
|
|
|
151 |
#define __volatile
|
|
|
152 |
|
|
|
153 |
/*
|
|
|
154 |
* In non-ANSI C environments, new programs will want ANSI-only C keywords
|
|
|
155 |
* deleted from the program and old programs will want them left alone.
|
|
|
156 |
* When using a compiler other than gcc, programs using the ANSI C keywords
|
|
|
157 |
* const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
|
|
|
158 |
* When using "gcc -traditional", we assume that this is the intent; if
|
|
|
159 |
* __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
|
|
|
160 |
*/
|
|
|
161 |
#if !defined(NO_ANSI_KEYWORDS)
|
|
|
162 |
#define const /* delete ANSI C keywords */
|
|
|
163 |
#define inline
|
|
|
164 |
#define signed
|
|
|
165 |
#define volatile
|
|
|
166 |
#endif
|
|
|
167 |
#endif /* !__GNUC__ */
|
|
|
168 |
#endif /* !C++ */
|
|
|
169 |
|
|
|
170 |
/*
|
|
|
171 |
* GCC1 and some versions of GCC2 declare dead (non-returning) and
|
|
|
172 |
* pure (no side effects) functions using "volatile" and "const";
|
|
|
173 |
* unfortunately, these then cause warnings under "-ansi -pedantic".
|
|
|
174 |
* GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
|
|
|
175 |
* these work for GNU C++ (modulo a slight glitch in the C++ grammar
|
|
|
176 |
* in the distribution version of 2.5.5).
|
|
|
177 |
*/
|
|
|
178 |
#if !defined(__GNUC__) || (__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 5))
|
|
|
179 |
#undef __attribute__
|
|
|
180 |
#define __attribute__(x) /* delete __attribute__ if non-gcc or older than gcc 2.5 */
|
|
|
181 |
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
|
|
182 |
#undef __dead
|
|
|
183 |
#undef __pure
|
|
|
184 |
#define __dead __volatile
|
|
|
185 |
#define __pure __const
|
|
|
186 |
#undef __dead2
|
|
|
187 |
#define __dead2
|
|
|
188 |
#endif
|
|
|
189 |
#endif
|
|
|
190 |
|
|
|
191 |
/*
|
|
|
192 |
* Delete pseudo-keywords wherever they are not available or needed.
|
|
|
193 |
* This seems to break MingW in mysterious ways, so leave it,
|
|
|
194 |
*/
|
|
|
195 |
#ifndef __dead
|
|
|
196 |
#define __dead
|
|
|
197 |
#endif
|
|
|
198 |
|
|
|
199 |
#ifndef __dead2
|
|
|
200 |
#define __dead2
|
|
|
201 |
#endif
|
|
|
202 |
|
|
|
203 |
#ifndef __pure
|
|
|
204 |
#define __pure
|
|
|
205 |
#endif
|
|
|
206 |
|
|
|
207 |
/*
|
|
|
208 |
* min() & max() macros
|
|
|
209 |
*/
|
|
|
210 |
#if defined(__HIGHC__)
|
|
|
211 |
#undef min
|
|
|
212 |
#undef max
|
|
|
213 |
#define min(a,b) _min(a,b) /* intrinsic functions */
|
|
|
214 |
#define max(a,b) _max(a,b)
|
|
|
215 |
#endif
|
|
|
216 |
|
|
|
217 |
#ifndef min
|
|
|
218 |
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
|
|
219 |
#endif
|
|
|
220 |
|
|
|
221 |
#ifndef max
|
|
|
222 |
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
|
|
223 |
#endif
|
|
|
224 |
|
|
|
225 |
/*
|
|
|
226 |
* from NetBSD's <sys/cdefs_aout.h>
|
|
|
227 |
*
|
|
|
228 |
* Written by J.T. Conklin <jtc@wimsey.com> 01/17/95.
|
|
|
229 |
* Public domain.
|
|
|
230 |
*/
|
|
|
231 |
|
|
|
232 |
/* #define _C_LABEL(x) __CONCAT(_,x) */
|
|
|
233 |
|
|
|
234 |
#if defined(__GNUC__)
|
|
|
235 |
#define __indr_reference(sym,alias) \
|
|
|
236 |
__asm__(".stabs \"_" #alias "\",11,0,0,0");\
|
|
|
237 |
__asm__(".stabs \"_" #sym "\",1,0,0,0");
|
|
|
238 |
|
|
|
239 |
#define __warn_references(sym,msg) \
|
|
|
240 |
__asm__(".stabs \"" msg "\",30,0,0,0"); \
|
|
|
241 |
__asm__(".stabs \"_" #sym "\",1,0,0,0");
|
|
|
242 |
|
|
|
243 |
#define __IDSTRING(name,string) \
|
|
|
244 |
static const char name[] __attribute__((__unused__)) = string
|
|
|
245 |
#else
|
|
|
246 |
#define __indr_reference(sym,alias)
|
|
|
247 |
#define __warn_references(sym,msg)
|
|
|
248 |
#define __IDSTRING(name,string) static const char name[] = string
|
|
|
249 |
#endif
|
|
|
250 |
|
|
|
251 |
#define __RCSID(_s) __IDSTRING(rcsid,_s)
|
|
|
252 |
#define __COPYRIGHT(_s) __IDSTRING(copyright,_s)
|
|
|
253 |
|
|
|
254 |
#define __KERNEL_RCSID(_n,_s) __IDSTRING(__CONCAT(rcsid,_n),_s)
|
|
|
255 |
#define __KERNEL_COPYRIGHT(_n,_s) __IDSTRING(__CONCAT(copyright,_n),_s)
|
|
|
256 |
|
|
|
257 |
#endif
|