apr.h revision 255696
150477Speter/* $FreeBSD: head/usr.bin/svn/lib/libapr/apr.h 255696 2013-09-19 06:31:03Z dim $ */ 238465Smsmith 3163893Smarcel/* Licensed to the Apache Software Foundation (ASF) under one or more 4114379Speter * contributor license agreements. See the NOTICE file distributed with 540834Smsmith * this work for additional information regarding copyright ownership. 639178Smsmith * The ASF licenses this file to You under the Apache License, Version 2.0 7136893Snyan * (the "License"); you may not use this file except in compliance with 8136895Sru * the License. You may obtain a copy of the License at 9136895Sru * 10136895Sru * http://www.apache.org/licenses/LICENSE-2.0 11136895Sru * 12209920Snwhitehorn * Unless required by applicable law or agreed to in writing, software 13134458Siedowse * distributed under the License is distributed on an "AS IS" BASIS, 14209920Snwhitehorn * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15209920Snwhitehorn * See the License for the specific language governing permissions and 16209920Snwhitehorn * limitations under the License. 17158467Sjhb */ 18134458Siedowse 19114379Speter 20114379Speter#ifndef APR_H 2168548Sbenno#define APR_H 2268548Sbenno 2368548Sbenno/* GENERATED FILE WARNING! DO NOT EDIT apr.h 2468548Sbenno * 25163893Smarcel * You must modify apr.h.in instead. 26163893Smarcel * 27163893Smarcel * And please, make an effort to stub apr.hw and apr.hnw in the process. 28163893Smarcel */ 29200460Smarcel 30200460Smarcel/** 31200460Smarcel * @file apr.h 32200460Smarcel * @brief APR Platform Definitions 33200460Smarcel * @remark This is a generated header generated from include/apr.h.in by 3439178Smsmith * ./configure, or copied from include/apr.hw or include/apr.hnw 35125561Sru * for Win32 or Netware by those build environments, respectively. 3639178Smsmith */ 3739178Smsmith 38125561Sru/** 3939178Smsmith * @defgroup APR Apache Portability Runtime library 4039178Smsmith * @{ 4140875Smsmith */ 4240875Smsmith/** 43125561Sru * @defgroup apr_platform Platform Definitions 4440875Smsmith * @{ 4574850Sru * @warning 4674850Sru * <strong><em>The actual values of macros and typedefs on this page<br> 4740875Smsmith * are platform specific and should NOT be relied upon!</em></strong> 4860704Sdcs */ 49199210Sattilio 50199210Sattilio/* So that we can use inline on some critical functions, and use 51199210Sattilio * GNUC attributes (such as to get -Wall warnings for printf-like 52199210Sattilio * functions). Only do this in gcc 2.7 or later ... it may work 5374850Sru * on earlier stuff, but why chance it. 54 * 55 * We've since discovered that the gcc shipped with NeXT systems 56 * as "cc" is completely broken. It claims to be __GNUC__ and so 57 * on, but it doesn't implement half of the things that __GNUC__ 58 * means. In particular it's missing inline and the __attribute__ 59 * stuff. So we hack around it. PR#1613. -djg 60 */ 61#if !defined(__GNUC__) || __GNUC__ < 2 || \ 62 (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\ 63 defined(NEXT) 64#ifndef __attribute__ 65#define __attribute__(__x) 66#endif 67#define APR_INLINE 68#define APR_HAS_INLINE 0 69#else 70#define APR_INLINE __inline__ 71#define APR_HAS_INLINE 1 72#endif 73 74#define APR_HAVE_ARPA_INET_H 1 75#define APR_HAVE_CONIO_H 0 76#define APR_HAVE_CRYPT_H 0 77#define APR_HAVE_CTYPE_H 1 78#define APR_HAVE_DIRENT_H 1 79#define APR_HAVE_ERRNO_H 1 80#define APR_HAVE_FCNTL_H 1 81#define APR_HAVE_IO_H 0 82#define APR_HAVE_LIMITS_H 1 83#define APR_HAVE_NETDB_H 1 84#define APR_HAVE_NETINET_IN_H 1 85#define APR_HAVE_NETINET_SCTP_H 1 86#define APR_HAVE_NETINET_SCTP_UIO_H 1 87#define APR_HAVE_NETINET_TCP_H 1 88#define APR_HAVE_PROCESS_H 0 89#define APR_HAVE_PTHREAD_H 1 90#define APR_HAVE_SEMAPHORE_H 1 91#define APR_HAVE_SIGNAL_H 1 92#define APR_HAVE_STDARG_H 1 93#define APR_HAVE_STDINT_H 1 94#define APR_HAVE_STDIO_H 1 95#define APR_HAVE_STDLIB_H 1 96#define APR_HAVE_STRING_H 1 97#define APR_HAVE_STRINGS_H 1 98#define APR_HAVE_SYS_IOCTL_H 1 99#define APR_HAVE_SYS_SENDFILE_H 0 100#define APR_HAVE_SYS_SIGNAL_H 1 101#define APR_HAVE_SYS_SOCKET_H 1 102#define APR_HAVE_SYS_SOCKIO_H 1 103#define APR_HAVE_SYS_SYSLIMITS_H 1 104#define APR_HAVE_SYS_TIME_H 1 105#define APR_HAVE_SYS_TYPES_H 1 106#define APR_HAVE_SYS_UIO_H 1 107#define APR_HAVE_SYS_UN_H 1 108#define APR_HAVE_SYS_WAIT_H 1 109#define APR_HAVE_TIME_H 1 110#define APR_HAVE_UNISTD_H 1 111#define APR_HAVE_WINDOWS_H 0 112#define APR_HAVE_WINSOCK2_H 0 113 114/** @} */ 115/** @} */ 116 117/* We don't include our conditional headers within the doxyblocks 118 * or the extern "C" namespace 119 */ 120 121#if APR_HAVE_WINDOWS_H 122/* If windows.h was already included, our preferences don't matter. 123 * If not, include a restricted set of windows headers to our tastes. 124 */ 125#ifndef _WINDOWS_ 126 127#ifndef WIN32_LEAN_AND_MEAN 128#define WIN32_LEAN_AND_MEAN 129#endif 130 131#ifndef _WIN32_WINNT 132/* Restrict the server to a subset of Windows XP header files by default 133 */ 134#define _WIN32_WINNT 0x0501 135#endif 136 137#ifndef NOUSER 138#define NOUSER 139#endif 140#ifndef NOMCX 141#define NOMCX 142#endif 143#ifndef NOIME 144#define NOIME 145#endif 146 147#include <windows.h> 148/* 149 * Add a _very_few_ declarations missing from the restricted set of headers 150 * (If this list becomes extensive, re-enable the required headers above!) 151 * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now 152 */ 153#define SW_HIDE 0 154#ifndef _WIN32_WCE 155#include <winsock2.h> 156#include <ws2tcpip.h> 157#include <mswsock.h> 158#else 159#include <winsock.h> 160#endif 161 162#endif /* ndef _WINDOWS_ */ 163#endif /* APR_HAVE_WINDOWS_H */ 164 165#if APR_HAVE_SYS_TYPES_H 166#include <sys/types.h> 167#endif 168 169#if APR_HAVE_SYS_SOCKET_H 170#include <sys/socket.h> 171#endif 172 173#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) 174/* C99 7.18.4 requires that stdint.h only exposes INT64_C 175 * and UINT64_C for C++ implementations if this is defined: */ 176#define __STDC_CONSTANT_MACROS 177#endif 178 179#if APR_HAVE_STDINT_H 180#include <stdint.h> 181#endif 182 183#if APR_HAVE_SYS_WAIT_H 184#include <sys/wait.h> 185#endif 186 187#ifdef OS2 188#define INCL_DOS 189#define INCL_DOSERRORS 190#include <os2.h> 191#endif 192 193/* header files for PATH_MAX, _POSIX_PATH_MAX */ 194#if APR_HAVE_LIMITS_H 195#include <limits.h> 196#else 197#if APR_HAVE_SYS_SYSLIMITS_H 198#include <sys/syslimits.h> 199#endif 200#endif 201 202 203#ifdef __cplusplus 204extern "C" { 205#endif 206 207/** 208 * @addtogroup apr_platform 209 * @ingroup APR 210 * @{ 211 */ 212 213#define APR_HAVE_SHMEM_MMAP_TMP 1 214#define APR_HAVE_SHMEM_MMAP_SHM 1 215#define APR_HAVE_SHMEM_MMAP_ZERO 1 216#define APR_HAVE_SHMEM_SHMGET_ANON 1 217#define APR_HAVE_SHMEM_SHMGET 1 218#define APR_HAVE_SHMEM_MMAP_ANON 1 219#define APR_HAVE_SHMEM_BEOS 0 220 221#define APR_USE_SHMEM_MMAP_TMP 0 222#define APR_USE_SHMEM_MMAP_SHM 0 223#define APR_USE_SHMEM_MMAP_ZERO 0 224#define APR_USE_SHMEM_SHMGET_ANON 0 225#define APR_USE_SHMEM_SHMGET 1 226#define APR_USE_SHMEM_MMAP_ANON 1 227#define APR_USE_SHMEM_BEOS 0 228 229#define APR_USE_FLOCK_SERIALIZE 1 230#define APR_USE_SYSVSEM_SERIALIZE 0 231#define APR_USE_POSIXSEM_SERIALIZE 0 232#define APR_USE_FCNTL_SERIALIZE 0 233#define APR_USE_PROC_PTHREAD_SERIALIZE 0 234#define APR_USE_PTHREAD_SERIALIZE 1 235 236#define APR_HAS_FLOCK_SERIALIZE 1 237#define APR_HAS_SYSVSEM_SERIALIZE 1 238#define APR_HAS_POSIXSEM_SERIALIZE 1 239#define APR_HAS_FCNTL_SERIALIZE 1 240#define APR_HAS_PROC_PTHREAD_SERIALIZE 0 241 242#define APR_PROCESS_LOCK_IS_GLOBAL 0 243 244#define APR_HAVE_CORKABLE_TCP 1 245#define APR_HAVE_GETRLIMIT 1 246#define APR_HAVE_IN_ADDR 1 247#define APR_HAVE_INET_ADDR 1 248#define APR_HAVE_INET_NETWORK 1 249#define APR_HAVE_IPV6 1 250#define APR_HAVE_MEMMOVE 1 251#define APR_HAVE_SETRLIMIT 1 252#define APR_HAVE_SIGACTION 1 253#define APR_HAVE_SIGSUSPEND 1 254#define APR_HAVE_SIGWAIT 1 255#define APR_HAVE_SA_STORAGE 1 256#define APR_HAVE_STRCASECMP 1 257#define APR_HAVE_STRDUP 1 258#define APR_HAVE_STRICMP 0 259#define APR_HAVE_STRNCASECMP 1 260#define APR_HAVE_STRNICMP 0 261#define APR_HAVE_STRSTR 1 262#define APR_HAVE_MEMCHR 1 263#define APR_HAVE_STRUCT_RLIMIT 1 264#define APR_HAVE_UNION_SEMUN 1 265#define APR_HAVE_SCTP 1 266#define APR_HAVE_IOVEC 1 267 268/* APR Feature Macros */ 269#define APR_HAS_SHARED_MEMORY 1 270#define APR_HAS_THREADS 1 271#define APR_HAS_SENDFILE 1 272#define APR_HAS_MMAP 1 273#define APR_HAS_FORK 1 274#define APR_HAS_RANDOM 1 275#define APR_HAS_OTHER_CHILD 1 276#define APR_HAS_DSO 0 277#define APR_HAS_SO_ACCEPTFILTER 1 278#define APR_HAS_UNICODE_FS 0 279#define APR_HAS_PROC_INVOKED 0 280#define APR_HAS_USER 1 281#define APR_HAS_LARGE_FILES 0 282#define APR_HAS_XTHREAD_FILES 0 283#define APR_HAS_OS_UUID 1 284 285#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0 286 287/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible 288 * to poll on files/pipes. 289 */ 290#define APR_FILES_AS_SOCKETS 1 291 292/* This macro indicates whether or not EBCDIC is the native character set. 293 */ 294#define APR_CHARSET_EBCDIC 0 295 296/* If we have a TCP implementation that can be "corked", what flag 297 * do we use? 298 */ 299#define APR_TCP_NOPUSH_FLAG TCP_NOPUSH 300 301/* Is the TCP_NODELAY socket option inherited from listening sockets? 302*/ 303#define APR_TCP_NODELAY_INHERITED 1 304 305/* Is the O_NONBLOCK flag inherited from listening sockets? 306*/ 307#define APR_O_NONBLOCK_INHERITED 1 308 309/* Typedefs that APR needs. */ 310 311typedef unsigned char apr_byte_t; 312 313typedef short apr_int16_t; 314typedef unsigned short apr_uint16_t; 315 316typedef int apr_int32_t; 317typedef unsigned int apr_uint32_t; 318 319#include <sys/_types.h> 320#ifdef __LP64__ 321#define APR_SIZEOF_VOIDP 8 322#else 323#define APR_SIZEOF_VOIDP 4 324#endif 325 326/* 327 * Darwin 10's default compiler (gcc42) builds for both 64 and 328 * 32 bit architectures unless specifically told not to. 329 * In those cases, we need to override types depending on how 330 * we're being built at compile time. 331 * NOTE: This is an ugly work-around for Darwin's 332 * concept of universal binaries, a single package 333 * (executable, lib, etc...) which contains both 32 334 * and 64 bit versions. The issue is that if APR is 335 * built universally, if something else is compiled 336 * against it, some bit sizes will depend on whether 337 * it is 32 or 64 bit. This is determined by the __LP64__ 338 * flag. Since we need to support both, we have to 339 * handle OS X unqiuely. 340 */ 341#ifdef DARWIN_10 342#undef APR_SIZEOF_VOIDP 343#undef INT64_C 344#undef UINT64_C 345#ifdef __LP64__ 346 typedef long apr_int64_t; 347 typedef unsigned long apr_uint64_t; 348 #define APR_SIZEOF_VOIDP 8 349 #define INT64_C(v) (v ## L) 350 #define UINT64_C(v) (v ## UL) 351#else 352 typedef long long apr_int64_t; 353 typedef unsigned long long apr_uint64_t; 354 #define APR_SIZEOF_VOIDP 4 355 #define INT64_C(v) (v ## LL) 356 #define UINT64_C(v) (v ## ULL) 357#endif 358#else 359 typedef __int64_t apr_int64_t; 360 typedef __uint64_t apr_uint64_t; 361#endif 362 363typedef size_t apr_size_t; 364typedef ssize_t apr_ssize_t; 365typedef off_t apr_off_t; 366typedef socklen_t apr_socklen_t; 367typedef unsigned int apr_ino_t; 368 369#if APR_SIZEOF_VOIDP == 8 370typedef apr_uint64_t apr_uintptr_t; 371#else 372typedef apr_uint32_t apr_uintptr_t; 373#endif 374 375/* Are we big endian? */ 376#if _BYTE_ORDER == _LITTLE_ENDIAN 377#define APR_IS_BIGENDIAN 0 378#elif _BYTE_ORDER == _BIG_ENDIAN 379#define APR_IS_BIGENDIAN 1 380#else 381#error Unknown byte order. 382#endif 383 384/* Mechanisms to properly type numeric literals */ 385#define APR_INT64_C(val) INT64_C(val) 386#define APR_UINT64_C(val) UINT64_C(val) 387 388#ifdef INT16_MIN 389#define APR_INT16_MIN INT16_MIN 390#else 391#define APR_INT16_MIN (-0x7fff - 1) 392#endif 393 394#ifdef INT16_MAX 395#define APR_INT16_MAX INT16_MAX 396#else 397#define APR_INT16_MAX (0x7fff) 398#endif 399 400#ifdef UINT16_MAX 401#define APR_UINT16_MAX UINT16_MAX 402#else 403#define APR_UINT16_MAX (0xffff) 404#endif 405 406#ifdef INT32_MIN 407#define APR_INT32_MIN INT32_MIN 408#else 409#define APR_INT32_MIN (-0x7fffffff - 1) 410#endif 411 412#ifdef INT32_MAX 413#define APR_INT32_MAX INT32_MAX 414#else 415#define APR_INT32_MAX 0x7fffffff 416#endif 417 418#ifdef UINT32_MAX 419#define APR_UINT32_MAX UINT32_MAX 420#else 421#define APR_UINT32_MAX (0xffffffffU) 422#endif 423 424#ifdef INT64_MIN 425#define APR_INT64_MIN INT64_MIN 426#else 427#define APR_INT64_MIN (APR_INT64_C(-0x7fffffffffffffff) - 1) 428#endif 429 430#ifdef INT64_MAX 431#define APR_INT64_MAX INT64_MAX 432#else 433#define APR_INT64_MAX APR_INT64_C(0x7fffffffffffffff) 434#endif 435 436#ifdef UINT64_MAX 437#define APR_UINT64_MAX UINT64_MAX 438#else 439#define APR_UINT64_MAX APR_UINT64_C(0xffffffffffffffff) 440#endif 441 442#define APR_SIZE_MAX (~((apr_size_t)0)) 443 444 445/* Definitions that APR programs need to work properly. */ 446 447/** 448 * APR public API wrap for C++ compilers. 449 */ 450#ifdef __cplusplus 451#define APR_BEGIN_DECLS extern "C" { 452#define APR_END_DECLS } 453#else 454#define APR_BEGIN_DECLS 455#define APR_END_DECLS 456#endif 457 458/** 459 * Thread callbacks from APR functions must be declared with APR_THREAD_FUNC, 460 * so that they follow the platform's calling convention. 461 * <PRE> 462 * 463 * void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data); 464 * 465 * </PRE> 466 */ 467#define APR_THREAD_FUNC 468 469/** 470 * The public APR functions are declared with APR_DECLARE(), so they may 471 * use the most appropriate calling convention. Public APR functions with 472 * variable arguments must use APR_DECLARE_NONSTD(). 473 * 474 * @remark Both the declaration and implementations must use the same macro. 475 * 476 * <PRE> 477 * APR_DECLARE(rettype) apr_func(args) 478 * </PRE> 479 * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA 480 * @remark Note that when APR compiles the library itself, it passes the 481 * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) 482 * to export public symbols from the dynamic library build.\n 483 * The user must define the APR_DECLARE_STATIC when compiling to target 484 * the static APR library on some platforms (e.g. Win32.) The public symbols 485 * are neither exported nor imported when APR_DECLARE_STATIC is defined.\n 486 * By default, compiling an application and including the APR public 487 * headers, without defining APR_DECLARE_STATIC, will prepare the code to be 488 * linked to the dynamic library. 489 */ 490#define APR_DECLARE(type) type 491 492/** 493 * The public APR functions using variable arguments are declared with 494 * APR_DECLARE_NONSTD(), as they must follow the C language calling convention. 495 * @see APR_DECLARE @see APR_DECLARE_DATA 496 * @remark Both the declaration and implementations must use the same macro. 497 * <PRE> 498 * 499 * APR_DECLARE_NONSTD(rettype) apr_func(args, ...); 500 * 501 * </PRE> 502 */ 503#define APR_DECLARE_NONSTD(type) type 504 505/** 506 * The public APR variables are declared with AP_MODULE_DECLARE_DATA. 507 * This assures the appropriate indirection is invoked at compile time. 508 * @see APR_DECLARE @see APR_DECLARE_NONSTD 509 * @remark Note that the declaration and implementations use different forms, 510 * but both must include the macro. 511 * 512 * <PRE> 513 * 514 * extern APR_DECLARE_DATA type apr_variable;\n 515 * APR_DECLARE_DATA type apr_variable = value; 516 * 517 * </PRE> 518 */ 519#define APR_DECLARE_DATA 520 521/* Define APR_SSIZE_T_FMT. 522 * If ssize_t is an integer we define it to be "d", 523 * if ssize_t is a long int we define it to be "ld", 524 * if ssize_t is neither we declare an error here. 525 * I looked for a better way to define this here, but couldn't find one, so 526 * to find the logic for this definition search for "ssize_t_fmt" in 527 * configure.in. 528 */ 529 530#ifdef __LP64__ 531#define APR_SSIZE_T_FMT "ld" 532 533/* And APR_SIZE_T_FMT */ 534#define APR_SIZE_T_FMT "lu" 535 536/* And APR_OFF_T_FMT */ 537#define APR_OFF_T_FMT "ld" 538 539/* And APR_PID_T_FMT */ 540#define APR_PID_T_FMT "d" 541 542/* And APR_INT64_T_FMT */ 543#define APR_INT64_T_FMT "ld" 544 545/* And APR_UINT64_T_FMT */ 546#define APR_UINT64_T_FMT "lu" 547 548/* And APR_UINT64_T_HEX_FMT */ 549#define APR_UINT64_T_HEX_FMT "lx" 550#else 551#define APR_SSIZE_T_FMT "d" 552#define APR_SIZE_T_FMT "u" 553#define APR_OFF_T_FMT APR_INT64_T_FMT 554#define APR_PID_T_FMT "d" 555#define APR_INT64_T_FMT "lld" 556#define APR_UINT64_T_FMT "llu" 557#define APR_UINT64_T_HEX_FMT "llx" 558#endif 559 560/* 561 * Ensure we work with universal binaries on Darwin 562 */ 563#ifdef DARWIN_10 564 565#undef APR_HAS_LARGE_FILES 566#undef APR_SIZEOF_VOIDP 567#undef APR_INT64_T_FMT 568#undef APR_UINT64_T_FMT 569#undef APR_UINT64_T_HEX_FMT 570 571#ifdef __LP64__ 572 #define APR_HAS_LARGE_FILES 0 573 #define APR_SIZEOF_VOIDP 8 574 #define APR_INT64_T_FMT "ld" 575 #define APR_UINT64_T_FMT "lu" 576 #define APR_UINT64_T_HEX_FMT "lx" 577#else 578 #define APR_HAS_LARGE_FILES 1 579 #define APR_SIZEOF_VOIDP 4 580 #define APR_INT64_T_FMT "lld" 581 #define APR_UINT64_T_FMT "llu" 582 #define APR_UINT64_T_HEX_FMT "llx" 583#endif 584 585#undef APR_IS_BIGENDIAN 586#ifdef __BIG_ENDIAN__ 587 #define APR_IS_BIGENDIAN 1 588#else 589 #define APR_IS_BIGENDIAN 0 590#endif 591 592#undef APR_OFF_T_FMT 593#define APR_OFF_T_FMT "lld" 594 595#endif /* DARWIN_10 */ 596 597/* Does the proc mutex lock threads too */ 598#define APR_PROC_MUTEX_IS_GLOBAL 0 599 600/* Local machine definition for console and log output. */ 601#define APR_EOL_STR "\n" 602 603#if APR_HAVE_SYS_WAIT_H 604#ifdef WEXITSTATUS 605#define apr_wait_t int 606#else 607#define apr_wait_t union wait 608#define WEXITSTATUS(status) (int)((status).w_retcode) 609#define WTERMSIG(status) (int)((status).w_termsig) 610#endif /* !WEXITSTATUS */ 611#elif defined(__MINGW32__) 612typedef int apr_wait_t; 613#endif /* HAVE_SYS_WAIT_H */ 614 615#if defined(PATH_MAX) 616#define APR_PATH_MAX PATH_MAX 617#elif defined(_POSIX_PATH_MAX) 618#define APR_PATH_MAX _POSIX_PATH_MAX 619#else 620#error no decision has been made on APR_PATH_MAX for your platform 621#endif 622 623#define APR_DSOPATH "LD_LIBRARY_PATH" 624 625/** @} */ 626 627/* Definitions that only Win32 programs need to compile properly. */ 628 629/* XXX These simply don't belong here, perhaps in apr_portable.h 630 * based on some APR_HAVE_PID/GID/UID? 631 */ 632#ifdef __MINGW32__ 633#ifndef __GNUC__ 634typedef int pid_t; 635#endif 636typedef int uid_t; 637typedef int gid_t; 638#endif 639 640#ifdef __cplusplus 641} 642#endif 643 644#endif /* APR_H */ 645