00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef _SYS_CDEFS_H_
00041 #define _SYS_CDEFS_H_
00042
00043 #if defined(__cplusplus)
00044 #define __BEGIN_DECLS extern "C" {
00045 #define __END_DECLS }
00046 #else
00047 #define __BEGIN_DECLS
00048 #define __END_DECLS
00049 #endif
00050
00051
00052
00053
00054 #ifdef __GNUC__
00055 #define __GNUC_PREREQ__(ma, mi) \
00056 (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
00057 #else
00058 #define __GNUC_PREREQ__(ma, mi) 0
00059 #endif
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #if defined(__STDC__) || defined(__cplusplus)
00074 #define __P(protos) protos
00075 #define __CONCAT1(x,y) x ## y
00076 #define __CONCAT(x,y) __CONCAT1(x,y)
00077 #define __STRING(x) #x
00078 #define __XSTRING(x) __STRING(x)
00079
00080 #define __const const
00081 #define __signed signed
00082 #define __volatile volatile
00083 #if defined(__cplusplus)
00084 #define __inline inline
00085 #else
00086 #ifndef __GNUC__
00087 #define __inline
00088 #endif
00089 #endif
00090
00091 #else
00092 #define __P(protos) ()
00093 #define __CONCAT(x,y) xy
00094 #define __STRING(x) "x"
00095
00096 #ifndef __GNUC__
00097 #define __const
00098 #define __inline
00099 #define __signed
00100 #define __volatile
00101
00102
00103
00104
00105
00106
00107
00108
00109 #ifndef NO_ANSI_KEYWORDS
00110 #define const
00111 #define inline
00112 #define signed
00113 #define volatile
00114 #endif
00115 #endif
00116 #endif
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127 #ifdef lint
00128 #define __dead2
00129 #define __pure2
00130 #define __unused
00131 #define __packed
00132 #define __aligned(x)
00133 #define __section(x)
00134 #else
00135 #if !__GNUC_PREREQ__(2, 5)
00136 #define __dead2
00137 #define __pure2
00138 #define __unused
00139 #endif
00140 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7
00141 #define __dead2 __attribute__((__noreturn__))
00142 #define __pure2 __attribute__((__const__))
00143 #define __unused
00144
00145 #endif
00146 #if __GNUC_PREREQ__(2, 7)
00147 #define __dead2 __attribute__((__noreturn__))
00148 #define __pure2 __attribute__((__const__))
00149 #define __unused __attribute__((__unused__))
00150 #define __packed __attribute__((__packed__))
00151 #define __aligned(x) __attribute__((__aligned__(x)))
00152 #define __section(x) __attribute__((__section__(x)))
00153 #endif
00154 #endif
00155
00156 #if __GNUC_PREREQ__(3, 1)
00157 #define __always_inline __attribute__((__always_inline__))
00158 #else
00159 #define __always_inline
00160 #endif
00161
00162 #if __GNUC_PREREQ__(3, 3)
00163 #define __nonnull(x) __attribute__((__nonnull__(x)))
00164 #else
00165 #define __nonnull(x)
00166 #endif
00167
00168
00169 #if !__GNUC_PREREQ__(2, 7)
00170 #define __func__ NULL
00171 #endif
00172
00173 #if __GNUC__ >= 2 && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
00174 #define __LONG_LONG_SUPPORTED
00175 #endif
00176
00177
00178
00179
00180
00181
00182
00183 #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
00184 #if __STDC_VERSION__ < 199901
00185 #define __restrict
00186 #else
00187 #define __restrict restrict
00188 #endif
00189 #endif
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 #if __GNUC_PREREQ__(2, 96)
00220 #define __predict_true(exp) __builtin_expect((exp), 1)
00221 #define __predict_false(exp) __builtin_expect((exp), 0)
00222 #else
00223 #define __predict_true(exp) (exp)
00224 #define __predict_false(exp) (exp)
00225 #endif
00226
00227
00228
00229
00230
00231 #define __offsetof(type, field) ((size_t)(&((type *)0)->field))
00232
00233
00234
00235
00236
00237
00238
00239 #if !__GNUC_PREREQ__(2, 7)
00240 #define __printflike(fmtarg, firstvararg)
00241 #define __scanflike(fmtarg, firstvararg)
00242 #else
00243 #define __printflike(fmtarg, firstvararg) \
00244 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
00245 #define __scanflike(fmtarg, firstvararg) \
00246 __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
00247 #endif
00248
00249
00250 #if __FreeBSD_cc_version >= 300001
00251 #define __printf0like(fmtarg, firstvararg) \
00252 __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
00253 #else
00254 #define __printf0like(fmtarg, firstvararg)
00255 #endif
00256
00257 #ifdef __GNUC__
00258 #define __strong_reference(sym,aliassym) \
00259 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)));
00260 #ifdef __STDC__
00261 #define __weak_reference(sym,alias) \
00262 __asm__(".weak " #alias); \
00263 __asm__(".equ " #alias ", " #sym)
00264 #define __warn_references(sym,msg) \
00265 __asm__(".section .gnu.warning." #sym); \
00266 __asm__(".asciz \"" msg "\""); \
00267 __asm__(".previous")
00268 #else
00269 #define __weak_reference(sym,alias) \
00270 __asm__(".weak alias"); \
00271 __asm__(".equ alias, sym")
00272 #define __warn_references(sym,msg) \
00273 __asm__(".section .gnu.warning.sym"); \
00274 __asm__(".asciz \"msg\""); \
00275 __asm__(".previous")
00276 #endif
00277 #endif
00278
00279 #ifdef __GNUC__
00280 #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
00281 #else
00282
00283
00284
00285
00286
00287
00288 #define __IDSTRING(name,string) static const char name[] __unused = string
00289 #endif
00290
00291
00292
00293
00294
00295
00296
00297 #ifndef __FBSDID
00298 #if !defined(lint) && !defined(STRIP_FBSDID)
00299 #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
00300 #else
00301 #define __FBSDID(s) struct __hack
00302 #endif
00303 #endif
00304
00305 #ifndef __RCSID
00306 #ifndef NO__RCSID
00307 #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
00308 #else
00309 #define __RCSID(s) struct __hack
00310 #endif
00311 #endif
00312
00313 #ifndef __RCSID_SOURCE
00314 #ifndef NO__RCSID_SOURCE
00315 #define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
00316 #else
00317 #define __RCSID_SOURCE(s) struct __hack
00318 #endif
00319 #endif
00320
00321 #ifndef __SCCSID
00322 #ifndef NO__SCCSID
00323 #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
00324 #else
00325 #define __SCCSID(s) struct __hack
00326 #endif
00327 #endif
00328
00329 #ifndef __COPYRIGHT
00330 #ifndef NO__COPYRIGHT
00331 #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
00332 #else
00333 #define __COPYRIGHT(s) struct __hack
00334 #endif
00335 #endif
00336
00337 #ifndef __DECONST
00338 #define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
00339 #endif
00340
00341 #ifndef __DEVOLATILE
00342 #define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
00343 #endif
00344
00345 #ifndef __DEQUALIFY
00346 #define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var))
00347 #endif
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372 #if _POSIX_C_SOURCE == 1
00373 #undef _POSIX_C_SOURCE
00374 #define _POSIX_C_SOURCE 199009
00375 #endif
00376
00377
00378 #if _POSIX_C_SOURCE == 2
00379 #undef _POSIX_C_SOURCE
00380 #define _POSIX_C_SOURCE 199209
00381 #endif
00382
00383
00384 #ifdef _XOPEN_SOURCE
00385 #if _XOPEN_SOURCE - 0 >= 600
00386 #define __XSI_VISIBLE 600
00387 #undef _POSIX_C_SOURCE
00388 #define _POSIX_C_SOURCE 200112
00389 #elif _XOPEN_SOURCE - 0 >= 500
00390 #define __XSI_VISIBLE 500
00391 #undef _POSIX_C_SOURCE
00392 #define _POSIX_C_SOURCE 199506
00393 #endif
00394 #endif
00395
00396
00397
00398
00399
00400 #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
00401 #define _POSIX_C_SOURCE 198808
00402 #endif
00403 #ifdef _POSIX_C_SOURCE
00404 #if _POSIX_C_SOURCE >= 200112
00405 #define __POSIX_VISIBLE 200112
00406 #define __ISO_C_VISIBLE 1999
00407 #elif _POSIX_C_SOURCE >= 199506
00408 #define __POSIX_VISIBLE 199506
00409 #define __ISO_C_VISIBLE 1990
00410 #elif _POSIX_C_SOURCE >= 199309
00411 #define __POSIX_VISIBLE 199309
00412 #define __ISO_C_VISIBLE 1990
00413 #elif _POSIX_C_SOURCE >= 199209
00414 #define __POSIX_VISIBLE 199209
00415 #define __ISO_C_VISIBLE 1990
00416 #elif _POSIX_C_SOURCE >= 199009
00417 #define __POSIX_VISIBLE 199009
00418 #define __ISO_C_VISIBLE 1990
00419 #else
00420 #define __POSIX_VISIBLE 198808
00421 #define __ISO_C_VISIBLE 0
00422 #endif
00423 #else
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436 #if defined(_ANSI_SOURCE)
00437 #define __POSIX_VISIBLE 0
00438 #define __XSI_VISIBLE 0
00439 #define __BSD_VISIBLE 0
00440 #define __ISO_C_VISIBLE 1990
00441 #elif defined(_C99_SOURCE)
00442 #define __POSIX_VISIBLE 0
00443 #define __XSI_VISIBLE 0
00444 #define __BSD_VISIBLE 0
00445 #define __ISO_C_VISIBLE 1999
00446 #else
00447 #define __POSIX_VISIBLE 200112
00448 #define __XSI_VISIBLE 600
00449 #define __BSD_VISIBLE 1
00450 #define __ISO_C_VISIBLE 1999
00451 #endif
00452 #endif
00453
00454 #endif