apr.h revision 289166
1119026Sume/* $FreeBSD: stable/10/usr.bin/svn/lib/libapr/apr.h 289166 2015-10-12 04:57:36Z peter $ */
266776Skris
355163Sshin/* Licensed to the Apache Software Foundation (ASF) under one or more
455163Sshin * contributor license agreements.  See the NOTICE file distributed with
555163Sshin * this work for additional information regarding copyright ownership.
662632Skris * The ASF licenses this file to You under the Apache License, Version 2.0
755163Sshin * (the "License"); you may not use this file except in compliance with
855163Sshin * the License.  You may obtain a copy of the License at
955163Sshin *
1055163Sshin *     http://www.apache.org/licenses/LICENSE-2.0
1155163Sshin *
1255163Sshin * Unless required by applicable law or agreed to in writing, software
1355163Sshin * distributed under the License is distributed on an "AS IS" BASIS,
1455163Sshin * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1555163Sshin * See the License for the specific language governing permissions and
1655163Sshin * limitations under the License.
1755163Sshin */
1862632Skris
1955163Sshin
2055163Sshin#ifndef APR_H
2155163Sshin#define APR_H
2255163Sshin
2355163Sshin/* GENERATED FILE WARNING!  DO NOT EDIT apr.h
2455163Sshin *
2555163Sshin * You must modify apr.h.in instead.
2655163Sshin *
2755163Sshin * And please, make an effort to stub apr.hw and apr.hnw in the process.
2855163Sshin */
2955163Sshin
3055163Sshin/**
3155163Sshin * @file apr.h
3255163Sshin * @brief APR Platform Definitions
3355163Sshin * @remark This is a generated header generated from include/apr.h.in by
3455163Sshin * ./configure, or copied from include/apr.hw or include/apr.hnw
35203387Sume * for Win32 or Netware by those build environments, respectively.
3662632Skris */
37118909Sume
3855163Sshin/**
3962632Skris * @defgroup APR Apache Portability Runtime library
4055163Sshin * @{
41203387Sume */
4255163Sshin/**
4355163Sshin * @defgroup apr_platform Platform Definitions
4455163Sshin * @{
45203387Sume * @warning
46222861Shrs * <strong><em>The actual values of macros and typedefs on this page<br>
4755163Sshin * are platform specific and should NOT be relied upon!</em></strong>
48203387Sume */
49203387Sume
5055163Sshin/* So that we can use inline on some critical functions, and use
5155163Sshin * GNUC attributes (such as to get -Wall warnings for printf-like
5255163Sshin * functions).  Only do this in gcc 2.7 or later ... it may work
5355163Sshin * on earlier stuff, but why chance it.
5455163Sshin *
5555163Sshin * We've since discovered that the gcc shipped with NeXT systems
56253970Shrs * as "cc" is completely broken.  It claims to be __GNUC__ and so
5755163Sshin * on, but it doesn't implement half of the things that __GNUC__
5855163Sshin * means.  In particular it's missing inline and the __attribute__
5955163Sshin * stuff.  So we hack around it.  PR#1613. -djg
6066776Skris */
61118916Sume#if !defined(__GNUC__) || __GNUC__ < 2 || \
62118916Sume    (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
63118916Sume    defined(NEXT)
64118664Sume#ifndef __attribute__
6555163Sshin#define __attribute__(__x)
6655163Sshin#endif
67222732Shrs#define APR_INLINE
68222732Shrs#define APR_HAS_INLINE           0
69222732Shrs#else
7055163Sshin#define APR_INLINE __inline__
71253970Shrs#define APR_HAS_INLINE           1
72118664Sume#endif
73118664Sume
74118664Sume#define APR_HAVE_ARPA_INET_H     1
75197141Shrs#define APR_HAVE_CONIO_H         0
7666776Skris#define APR_HAVE_CRYPT_H         0
7766776Skris#define APR_HAVE_CTYPE_H         1
78225520Shrs#define APR_HAVE_DIRENT_H        1
79118664Sume#define APR_HAVE_ERRNO_H         1
80222732Shrs#define APR_HAVE_FCNTL_H         1
81222732Shrs#define APR_HAVE_IO_H            0
8255163Sshin#define APR_HAVE_LIMITS_H        1
83147150Ssuz#define APR_HAVE_NETDB_H         1
8462632Skris#define APR_HAVE_NETINET_IN_H    1
8562632Skris#define APR_HAVE_NETINET_SCTP_H  1
8662632Skris#define APR_HAVE_NETINET_SCTP_UIO_H 1
8755163Sshin#define APR_HAVE_NETINET_TCP_H   1
88118664Sume#define APR_HAVE_PROCESS_H       0
89118910Sume#define APR_HAVE_PTHREAD_H       1
90118664Sume#define APR_HAVE_SEMAPHORE_H     1
91118664Sume#define APR_HAVE_SIGNAL_H        1
92118664Sume#define APR_HAVE_STDARG_H        1
9355163Sshin#define APR_HAVE_STDINT_H        1
9455163Sshin#define APR_HAVE_STDIO_H         1
9555163Sshin#define APR_HAVE_STDLIB_H        1
96222732Shrs#define APR_HAVE_STRING_H        1
97222732Shrs#define APR_HAVE_STRINGS_H       1
98124526Sume#define APR_HAVE_SYS_IOCTL_H     1
9955163Sshin#define APR_HAVE_SYS_SENDFILE_H  0
100222732Shrs#define APR_HAVE_SYS_SIGNAL_H    1
101124526Sume#define APR_HAVE_SYS_SOCKET_H    1
10255163Sshin#define APR_HAVE_SYS_SOCKIO_H    1
10362632Skris#define APR_HAVE_SYS_SYSLIMITS_H 1
104173412Skevlo#define APR_HAVE_SYS_TIME_H      1
10562632Skris#define APR_HAVE_SYS_TYPES_H     1
106222732Shrs#define APR_HAVE_SYS_UIO_H       1
107173412Skevlo#define APR_HAVE_SYS_UN_H        1
108253970Shrs#define APR_HAVE_SYS_WAIT_H      1
10955163Sshin#define APR_HAVE_TIME_H          1
110124526Sume#define APR_HAVE_UNISTD_H        1
111173412Skevlo#define APR_HAVE_WINDOWS_H       0
112124526Sume#define APR_HAVE_WINSOCK2_H      0
113222732Shrs
11455163Sshin/** @} */
11555163Sshin/** @} */
116124524Sume
11755163Sshin/* We don't include our conditional headers within the doxyblocks
118118909Sume * or the extern "C" namespace
119253970Shrs */
120204407Suqs
121118916Sume#if APR_HAVE_WINDOWS_H && defined(WIN32)
122118916Sume/* If windows.h was already included, our preferences don't matter.
123118916Sume * If not, include a restricted set of windows headers to our tastes.
124118909Sume */
125118909Sume#ifndef _WINDOWS_
126118909Sume
127118916Sume#ifndef WIN32_LEAN_AND_MEAN
128118909Sume#define WIN32_LEAN_AND_MEAN
129222848Shrs#endif
13055163Sshin
131222732Shrs#ifndef _WIN32_WINNT
132222732Shrs/* Restrict the server to a subset of Windows XP header files by default
133225520Shrs */
134222732Shrs#define _WIN32_WINNT 0x0501
135222732Shrs#endif
136225520Shrs
137222732Shrs#ifndef NOUSER
138222732Shrs#define NOUSER
139222732Shrs#endif
140222848Shrs#ifndef NOMCX
141222848Shrs#define NOMCX
14255163Sshin#endif
14366776Skris#ifndef NOIME
14466776Skris#define NOIME
14566776Skris#endif
14666776Skris
14766776Skris#include <windows.h>
148225520Shrs/*
14966776Skris * Add a _very_few_ declarations missing from the restricted set of headers
15066776Skris * (If this list becomes extensive, re-enable the required headers above!)
151225520Shrs * winsock headers were excluded by WIN32_LEAN_AND_MEAN, so include them now
15266776Skris */
15366776Skris#define SW_HIDE             0
15466776Skris#ifndef _WIN32_WCE
15566776Skris#include <winsock2.h>
156124525Sume#include <ws2tcpip.h>
157124525Sume#include <mswsock.h>
158124525Sume#else
15966776Skris#include <winsock.h>
16066776Skris#endif
16166776Skris
16266776Skris#endif /* ndef _WINDOWS_ */
16366776Skris#endif /* APR_HAVE_WINDOWS_H */
16466776Skris
165118661Sume#if APR_HAVE_SYS_TYPES_H
166118661Sume#include <sys/types.h>
167118661Sume#endif
168225520Shrs
169222732Shrs#if APR_HAVE_SYS_SOCKET_H
170222732Shrs#include <sys/socket.h>
171222732Shrs#endif
172222732Shrs
173222732Shrs#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS)
174225520Shrs/* C99 7.18.4 requires that stdint.h only exposes INT64_C
175225520Shrs * and UINT64_C for C++ implementations if this is defined: */
176225520Shrs#define __STDC_CONSTANT_MACROS
17766776Skris#endif
178222732Shrs
179222732Shrs#if APR_HAVE_STDINT_H
18055163Sshin#include <stdint.h>
18155163Sshin#endif
18255163Sshin
18355163Sshin#if APR_HAVE_SYS_WAIT_H
18466776Skris#include <sys/wait.h>
185119026Sume#endif
186222732Shrs
187222732Shrs#ifdef OS2
18866776Skris#define INCL_DOS
18955163Sshin#define INCL_DOSERRORS
190253970Shrs#include <os2.h>
191253995Shrs#endif
192253995Shrs
193253970Shrs/* header files for PATH_MAX, _POSIX_PATH_MAX */
19455163Sshin#if APR_HAVE_LIMITS_H
195225520Shrs#include <limits.h>
196225520Shrs#else
197225520Shrs#if APR_HAVE_SYS_SYSLIMITS_H
198225520Shrs#include <sys/syslimits.h>
199225520Shrs#endif
20055163Sshin#endif
201225520Shrs
20255163Sshin
20355163Sshin#ifdef __cplusplus
204118664Sumeextern "C" {
205222848Shrs#endif
20655163Sshin
207222848Shrs/**
20855163Sshin * @addtogroup apr_platform
20955163Sshin * @ingroup APR
21055163Sshin * @{
21155163Sshin */
21255163Sshin
21355163Sshin#define APR_HAVE_SHMEM_MMAP_TMP     1
21455163Sshin#define APR_HAVE_SHMEM_MMAP_SHM     1
215118661Sume#define APR_HAVE_SHMEM_MMAP_ZERO    1
216118661Sume#define APR_HAVE_SHMEM_SHMGET_ANON  1
217118661Sume#define APR_HAVE_SHMEM_SHMGET       1
218118661Sume#define APR_HAVE_SHMEM_MMAP_ANON    1
219222732Shrs#define APR_HAVE_SHMEM_BEOS         0
220222732Shrs
221222732Shrs#define APR_USE_SHMEM_MMAP_TMP     0
222222732Shrs#define APR_USE_SHMEM_MMAP_SHM     1
223222732Shrs#define APR_USE_SHMEM_MMAP_ZERO    0
224222732Shrs#define APR_USE_SHMEM_SHMGET_ANON  0
225222732Shrs#define APR_USE_SHMEM_SHMGET       0
226222732Shrs#define APR_USE_SHMEM_MMAP_ANON    1
22762632Skris#define APR_USE_SHMEM_BEOS         0
228118664Sume
22955163Sshin#define APR_USE_FLOCK_SERIALIZE           1
23062632Skris#define APR_USE_SYSVSEM_SERIALIZE         0
23155163Sshin#define APR_USE_POSIXSEM_SERIALIZE        0
232225520Shrs#define APR_USE_FCNTL_SERIALIZE           0
233124525Sume#define APR_USE_PROC_PTHREAD_SERIALIZE    0
234124525Sume#define APR_USE_PTHREAD_SERIALIZE         1
235124525Sume
236124525Sume#define APR_HAS_FLOCK_SERIALIZE           1
237124525Sume#define APR_HAS_SYSVSEM_SERIALIZE         1
238124525Sume#define APR_HAS_POSIXSEM_SERIALIZE        1
239124525Sume#define APR_HAS_FCNTL_SERIALIZE           1
240225520Shrs#define APR_HAS_PROC_PTHREAD_SERIALIZE    0
24155163Sshin
242124526Sume#define APR_PROCESS_LOCK_IS_GLOBAL        0
24355163Sshin
244118910Sume#define APR_HAVE_CORKABLE_TCP   1
245124526Sume#define APR_HAVE_GETRLIMIT      1
24655163Sshin#define APR_HAVE_IN_ADDR        1
247118914Sume#define APR_HAVE_INET_ADDR      1
248118914Sume#define APR_HAVE_INET_NETWORK   1
249118914Sume#define APR_HAVE_IPV6           1
25062632Skris#define APR_HAVE_MEMMOVE        1
25162632Skris#define APR_HAVE_SETRLIMIT      1
25262632Skris#define APR_HAVE_SIGACTION      1
25362632Skris#define APR_HAVE_SIGSUSPEND     1
25462632Skris#define APR_HAVE_SIGWAIT        1
25566776Skris#define APR_HAVE_SA_STORAGE     1
256118914Sume#define APR_HAVE_STRCASECMP     1
257118914Sume#define APR_HAVE_STRDUP         1
25866776Skris#define APR_HAVE_STRICMP        0
259118916Sume#define APR_HAVE_STRNCASECMP    1
260118916Sume#define APR_HAVE_STRNICMP       0
261118916Sume#define APR_HAVE_STRSTR         1
262118916Sume#define APR_HAVE_MEMCHR         1
26378064Sume#define APR_HAVE_STRUCT_RLIMIT  1
264118916Sume#define APR_HAVE_UNION_SEMUN    1
265118916Sume#define APR_HAVE_SCTP           1
266118916Sume#define APR_HAVE_IOVEC          1
267118916Sume
268118916Sume/*  APR Feature Macros */
269118916Sume#define APR_HAS_SHARED_MEMORY     1
27078064Sume#define APR_HAS_THREADS           1
271118914Sume#define APR_HAS_SENDFILE          1
272118914Sume#define APR_HAS_MMAP              1
27378064Sume#define APR_HAS_FORK              1
274118916Sume#define APR_HAS_RANDOM            1
275118916Sume#define APR_HAS_OTHER_CHILD       1
276118916Sume#define APR_HAS_DSO               0
277118916Sume#define APR_HAS_SO_ACCEPTFILTER   1
27878064Sume#define APR_HAS_UNICODE_FS        0
27978064Sume#define APR_HAS_PROC_INVOKED      0
280118916Sume#define APR_HAS_USER              1
28162632Skris#define APR_HAS_LARGE_FILES       0
282118916Sume#define APR_HAS_XTHREAD_FILES     0
283118909Sume#define APR_HAS_OS_UUID           1
284118909Sume
285222732Shrs#define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD 0
286222732Shrs
287118909Sume/* APR sets APR_FILES_AS_SOCKETS to 1 on systems where it is possible
288118909Sume * to poll on files/pipes.
289222732Shrs */
290222732Shrs#define APR_FILES_AS_SOCKETS      1
291118909Sume
292118916Sume/* This macro indicates whether or not EBCDIC is the native character set.
293118909Sume */
29455163Sshin#define APR_CHARSET_EBCDIC        0
29566776Skris
296118914Sume/* If we have a TCP implementation that can be "corked", what flag
297147161Ssuz * do we use?
298118914Sume */
29966776Skris#define APR_TCP_NOPUSH_FLAG       TCP_NOPUSH
300119026Sume
301119026Sume/* Is the TCP_NODELAY socket option inherited from listening sockets?
302119026Sume*/
30366776Skris#define APR_TCP_NODELAY_INHERITED 1
304118914Sume
305118914Sume/* Is the O_NONBLOCK flag inherited from listening sockets?
306118914Sume*/
30766776Skris#define APR_O_NONBLOCK_INHERITED 1
30855163Sshin
30955163Sshin/* Typedefs that APR needs. */
31055163Sshin
31155163Sshintypedef  unsigned char           apr_byte_t;
31266776Skris
313118914Sumetypedef  short           apr_int16_t;
314118914Sumetypedef  unsigned short  apr_uint16_t;
315118914Sume
31666776Skristypedef  int             apr_int32_t;
31766776Skristypedef  unsigned int    apr_uint32_t;
31855163Sshin
31955163Sshin#include <sys/_types.h>
32055163Sshin#ifdef __LP64__
32155163Sshin#define APR_SIZEOF_VOIDP 8
32255163Sshin#else
32355163Sshin#define APR_SIZEOF_VOIDP 4
32455163Sshin#endif
325118660Sume
326118664Sume/*
327118664Sume * Darwin 10's default compiler (gcc42) builds for both 64 and
32855163Sshin * 32 bit architectures unless specifically told not to.
32955163Sshin * In those cases, we need to override types depending on how
33055163Sshin * we're being built at compile time.
33155163Sshin * NOTE: This is an ugly work-around for Darwin's
33255163Sshin * concept of universal binaries, a single package
333118916Sume * (executable, lib, etc...) which contains both 32
334118909Sume * and 64 bit versions. The issue is that if APR is
335118909Sume * built universally, if something else is compiled
336118909Sume * against it, some bit sizes will depend on whether
337118916Sume * it is 32 or 64 bit. This is determined by the __LP64__
33855163Sshin * flag. Since we need to support both, we have to
33955163Sshin * handle OS X unqiuely.
34055163Sshin */
341118916Sume#ifdef DARWIN_10
342118909Sume#undef APR_SIZEOF_VOIDP
343118916Sume#undef INT64_C
344118909Sume#undef UINT64_C
345124526Sume#ifdef __LP64__
34655163Sshin typedef  long            apr_int64_t;
34755163Sshin typedef  unsigned long   apr_uint64_t;
34855163Sshin #define APR_SIZEOF_VOIDP     8
34955163Sshin #define INT64_C(v)   (v ## L)
350124526Sume #define UINT64_C(v)  (v ## UL)
351118664Sume#else
35255163Sshin typedef  long long            apr_int64_t;
35355163Sshin typedef  unsigned long long   apr_uint64_t;
35455163Sshin #define APR_SIZEOF_VOIDP     4
35555163Sshin #define INT64_C(v)   (v ## LL)
35655163Sshin #define UINT64_C(v)  (v ## ULL)
35755163Sshin#endif
35855163Sshin#else
35955163Sshin typedef  __int64_t            apr_int64_t;
36055163Sshin typedef  __uint64_t           apr_uint64_t;
36155163Sshin#endif
362222732Shrs
36355163Sshintypedef  size_t          apr_size_t;
36455163Sshintypedef  ssize_t         apr_ssize_t;
36555163Sshintypedef  off_t           apr_off_t;
36655163Sshintypedef  socklen_t       apr_socklen_t;
36755163Sshintypedef  unsigned int           apr_ino_t;
36855163Sshin
369118916Sume#if APR_SIZEOF_VOIDP == 8
370253970Shrstypedef  apr_uint64_t            apr_uintptr_t;
371118916Sume#else
372118909Sumetypedef  apr_uint32_t            apr_uintptr_t;
373118916Sume#endif
37478064Sume
37555163Sshin/* Are we big endian? */
376118660Sume#if _BYTE_ORDER == _LITTLE_ENDIAN
377118664Sume#define APR_IS_BIGENDIAN	0
37855163Sshin#elif _BYTE_ORDER == _BIG_ENDIAN
37955163Sshin#define APR_IS_BIGENDIAN	1
38055163Sshin#else
38155163Sshin#error Unknown byte order.
38255163Sshin#endif
383118916Sume
384118916Sume/* Mechanisms to properly type numeric literals */
385118916Sume#define APR_INT64_C(val) INT64_C(val)
386118909Sume#define APR_UINT64_C(val) UINT64_C(val)
387118916Sume
38878064Sume#ifdef INT16_MIN
389118916Sume#define APR_INT16_MIN   INT16_MIN
390118916Sume#else
391118916Sume#define APR_INT16_MIN   (-0x7fff - 1)
392118909Sume#endif
393118916Sume
39455163Sshin#ifdef INT16_MAX
39555163Sshin#define APR_INT16_MAX  INT16_MAX
39655163Sshin#else
39755163Sshin#define APR_INT16_MAX   (0x7fff)
398222732Shrs#endif
39955163Sshin
40055163Sshin#ifdef UINT16_MAX
401119026Sume#define APR_UINT16_MAX  UINT16_MAX
40255163Sshin#else
40355163Sshin#define APR_UINT16_MAX  (0xffff)
404222732Shrs#endif
40555163Sshin
40655163Sshin#ifdef INT32_MIN
40755163Sshin#define APR_INT32_MIN   INT32_MIN
40855163Sshin#else
409118660Sume#define APR_INT32_MIN   (-0x7fffffff - 1)
410118664Sume#endif
411222732Shrs
41255163Sshin#ifdef INT32_MAX
41355163Sshin#define APR_INT32_MAX  INT32_MAX
414118660Sume#else
415118664Sume#define APR_INT32_MAX  0x7fffffff
41662632Skris#endif
417222732Shrs
41855163Sshin#ifdef UINT32_MAX
41955163Sshin#define APR_UINT32_MAX  UINT32_MAX
420225520Shrs#else
421225520Shrs#define APR_UINT32_MAX  (0xffffffffU)
422225520Shrs#endif
423225520Shrs
424225520Shrs#ifdef INT64_MIN
425225520Shrs#define APR_INT64_MIN   INT64_MIN
426225520Shrs#else
427225520Shrs#define APR_INT64_MIN   (APR_INT64_C(-0x7fffffffffffffff) - 1)
428225520Shrs#endif
429225520Shrs
430225520Shrs#ifdef INT64_MAX
431225520Shrs#define APR_INT64_MAX   INT64_MAX
432225520Shrs#else
433225520Shrs#define APR_INT64_MAX   APR_INT64_C(0x7fffffffffffffff)
434225520Shrs#endif
435225520Shrs
436225520Shrs#ifdef UINT64_MAX
437225520Shrs#define APR_UINT64_MAX  UINT64_MAX
438225520Shrs#else
439225520Shrs#define APR_UINT64_MAX  APR_UINT64_C(0xffffffffffffffff)
440225520Shrs#endif
441225520Shrs
442225520Shrs#define APR_SIZE_MAX    (~((apr_size_t)0))
443225520Shrs
444225520Shrs
445225520Shrs/* Definitions that APR programs need to work properly. */
446222732Shrs
447118660Sume/**
44862632Skris * APR public API wrap for C++ compilers.
449222732Shrs */
45055163Sshin#ifdef __cplusplus
451222732Shrs#define APR_BEGIN_DECLS     extern "C" {
452222732Shrs#define APR_END_DECLS       }
453222861Shrs#else
454222861Shrs#define APR_BEGIN_DECLS
455222861Shrs#define APR_END_DECLS
456222732Shrs#endif
45755163Sshin
45855163Sshin/**
459222732Shrs * Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
46055163Sshin * so that they follow the platform's calling convention.
46155163Sshin * <PRE>
462119026Sume *
463119026Sume * void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
464222732Shrs *
465119026Sume * </PRE>
466119026Sume */
467119026Sume#define APR_THREAD_FUNC
468222732Shrs
469119026Sume#if defined(DOXYGEN) || !defined(WIN32)
470119026Sume
47155163Sshin/**
47255163Sshin * The public APR functions are declared with APR_DECLARE(), so they may
47355163Sshin * use the most appropriate calling convention.  Public APR functions with
47455163Sshin * variable arguments must use APR_DECLARE_NONSTD().
475222732Shrs *
476222732Shrs * @remark Both the declaration and implementations must use the same macro.
477222732Shrs *
47855163Sshin * <PRE>
47955163Sshin * APR_DECLARE(rettype) apr_func(args)
48055163Sshin * </PRE>
48155163Sshin * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
482222732Shrs * @remark Note that when APR compiles the library itself, it passes the
48355163Sshin * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32)
48455163Sshin * to export public symbols from the dynamic library build.\n
48555163Sshin * The user must define the APR_DECLARE_STATIC when compiling to target
486222732Shrs * the static APR library on some platforms (e.g. Win32.)  The public symbols
48755163Sshin * are neither exported nor imported when APR_DECLARE_STATIC is defined.\n
488222732Shrs * By default, compiling an application and including the APR public
48955163Sshin * headers, without defining APR_DECLARE_STATIC, will prepare the code to be
490222732Shrs * linked to the dynamic library.
49155163Sshin */
492222732Shrs#define APR_DECLARE(type)            type
49355163Sshin
494222732Shrs/**
49555163Sshin * The public APR functions using variable arguments are declared with
496222732Shrs * APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
497222732Shrs * @see APR_DECLARE @see APR_DECLARE_DATA
49855163Sshin * @remark Both the declaration and implementations must use the same macro.
499118664Sume * <PRE>
500222732Shrs *
501222732Shrs * APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
502222732Shrs *
50355163Sshin * </PRE>
50455163Sshin */
505119026Sume#define APR_DECLARE_NONSTD(type)     type
506124524Sume
507119026Sume/**
508222732Shrs * The public APR variables are declared with AP_MODULE_DECLARE_DATA.
509119026Sume * This assures the appropriate indirection is invoked at compile time.
510222732Shrs * @see APR_DECLARE @see APR_DECLARE_NONSTD
511222732Shrs * @remark Note that the declaration and implementations use different forms,
512222732Shrs * but both must include the macro.
513119026Sume *
514222732Shrs * <PRE>
515119026Sume *
516119026Sume * extern APR_DECLARE_DATA type apr_variable;\n
517119026Sume * APR_DECLARE_DATA type apr_variable = value;
518119026Sume *
519119026Sume * </PRE>
52062632Skris */
52162632Skris#define APR_DECLARE_DATA
52262632Skris
52362632Skris#elif defined(APR_DECLARE_STATIC)
52462632Skris#define APR_DECLARE(type)            type __stdcall
52562632Skris#define APR_DECLARE_NONSTD(type)     type __cdecl
52662632Skris#define APR_DECLARE_DATA
52762632Skris#elif defined(APR_DECLARE_EXPORT)
528222732Shrs#define APR_DECLARE(type)            __declspec(dllexport) type __stdcall
52962632Skris#define APR_DECLARE_NONSTD(type)     __declspec(dllexport) type __cdecl
53062632Skris#define APR_DECLARE_DATA             __declspec(dllexport)
53162632Skris#else
53262632Skris#define APR_DECLARE(type)            __declspec(dllimport) type __stdcall
53362632Skris#define APR_DECLARE_NONSTD(type)     __declspec(dllimport) type __cdecl
53462632Skris#define APR_DECLARE_DATA             __declspec(dllimport)
53562632Skris#endif
53662632Skris
53762632Skris/* Define APR_SSIZE_T_FMT.
53862632Skris * If ssize_t is an integer we define it to be "d",
53962632Skris * if ssize_t is a long int we define it to be "ld",
54062632Skris * if ssize_t is neither we declare an error here.
54162632Skris * I looked for a better way to define this here, but couldn't find one, so
542222732Shrs * to find the logic for this definition search for "ssize_t_fmt" in
543222732Shrs * configure.in.
54462632Skris */
54562632Skris
54662632Skris#ifdef __LP64__
547222861Shrs#define APR_SSIZE_T_FMT "ld"
548222861Shrs
549222861Shrs/* And APR_SIZE_T_FMT */
550222861Shrs#define APR_SIZE_T_FMT "lu"
551222861Shrs
552222861Shrs/* And APR_OFF_T_FMT */
553222861Shrs#define APR_OFF_T_FMT "ld"
554222861Shrs
555222861Shrs/* And APR_PID_T_FMT */
556222861Shrs#define APR_PID_T_FMT "d"
557222861Shrs
558222861Shrs/* And APR_INT64_T_FMT */
559222861Shrs#define APR_INT64_T_FMT "ld"
56055163Sshin
56155163Sshin/* And APR_UINT64_T_FMT */
56255163Sshin#define APR_UINT64_T_FMT "lu"
56355163Sshin
56455163Sshin/* And APR_UINT64_T_HEX_FMT */
565222732Shrs#define APR_UINT64_T_HEX_FMT "lx"
56655163Sshin#else
567222732Shrs#define APR_SSIZE_T_FMT "d"
568222732Shrs#define APR_SIZE_T_FMT "u"
569222732Shrs#define APR_OFF_T_FMT APR_INT64_T_FMT
57055163Sshin#define APR_PID_T_FMT "d"
57155163Sshin#define APR_INT64_T_FMT "lld"
57255163Sshin#define APR_UINT64_T_FMT "llu"
573222732Shrs#define APR_UINT64_T_HEX_FMT "llx"
57455163Sshin#endif
575118664Sume
576118664Sume/*
57755163Sshin * Ensure we work with universal binaries on Darwin
57855163Sshin */
579222732Shrs#ifdef DARWIN_10
580118660Sume
581118664Sume#undef APR_HAS_LARGE_FILES
582222732Shrs#undef APR_SIZEOF_VOIDP
58355163Sshin#undef APR_INT64_T_FMT
58455163Sshin#undef APR_UINT64_T_FMT
585222732Shrs#undef APR_UINT64_T_HEX_FMT
58655163Sshin
58755163Sshin#ifdef __LP64__
58855163Sshin #define APR_HAS_LARGE_FILES  0
589118660Sume #define APR_SIZEOF_VOIDP     8
590222732Shrs #define APR_INT64_T_FMT      "ld"
591222732Shrs #define APR_UINT64_T_FMT     "lu"
59255163Sshin #define APR_UINT64_T_HEX_FMT "lx"
593222732Shrs#else
59455163Sshin #define APR_HAS_LARGE_FILES  1
59555163Sshin #define APR_SIZEOF_VOIDP     4
59655163Sshin #define APR_INT64_T_FMT      "lld"
59755163Sshin #define APR_UINT64_T_FMT     "llu"
59855163Sshin #define APR_UINT64_T_HEX_FMT "llx"
59955163Sshin#endif
60055163Sshin
60155163Sshin#undef APR_IS_BIGENDIAN
60255163Sshin#ifdef __BIG_ENDIAN__
60355163Sshin #define APR_IS_BIGENDIAN	1
60455163Sshin#else
605222732Shrs #define APR_IS_BIGENDIAN	0
60655163Sshin#endif
607222732Shrs
60855163Sshin#undef APR_OFF_T_FMT
60955163Sshin#define APR_OFF_T_FMT "lld"
610253970Shrs
611124524Sume#endif /* DARWIN_10 */
61255163Sshin
613253970Shrs/* Does the proc mutex lock threads too */
614253970Shrs#define APR_PROC_MUTEX_IS_GLOBAL      0
615222732Shrs
616222861Shrs/* Local machine definition for console and log output. */
617222732Shrs#define APR_EOL_STR              "\n"
61855163Sshin
61955163Sshin#if APR_HAVE_SYS_WAIT_H
620253970Shrs#ifdef WEXITSTATUS
62155163Sshin#define apr_wait_t       int
62255163Sshin#else
62355163Sshin#define apr_wait_t       union wait
624222732Shrs#define WEXITSTATUS(status)    (int)((status).w_retcode)
625253970Shrs#define WTERMSIG(status)       (int)((status).w_termsig)
626222861Shrs#endif /* !WEXITSTATUS */
627222861Shrs#elif defined(__MINGW32__)
62855163Sshintypedef int apr_wait_t;
629222861Shrs#endif /* HAVE_SYS_WAIT_H */
630222861Shrs
631222861Shrs#if defined(PATH_MAX)
632222861Shrs#define APR_PATH_MAX       PATH_MAX
633222861Shrs#elif defined(_POSIX_PATH_MAX)
634222861Shrs#define APR_PATH_MAX       _POSIX_PATH_MAX
635222861Shrs#else
636222861Shrs#error no decision has been made on APR_PATH_MAX for your platform
637222861Shrs#endif
638222861Shrs
639222861Shrs#define APR_DSOPATH "LD_LIBRARY_PATH"
640222861Shrs
641222732Shrs/** @} */
642222732Shrs
64355163Sshin/* Definitions that only Win32 programs need to compile properly. */
64455163Sshin
64555163Sshin/* XXX These simply don't belong here, perhaps in apr_portable.h
646222732Shrs * based on some APR_HAVE_PID/GID/UID?
64755163Sshin */
648222732Shrs#ifdef __MINGW32__
64955163Sshin#ifndef __GNUC__
650222732Shrstypedef  int         pid_t;
65155163Sshin#endif
652222732Shrstypedef  int         uid_t;
65355163Sshintypedef  int         gid_t;
65455163Sshin#endif
65555163Sshin
656222732Shrs#ifdef __cplusplus
65755163Sshin}
65855163Sshin#endif
659222732Shrs
66055163Sshin#endif /* APR_H */
661222732Shrs