Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "asterisk/compiler.h"
00019
00020 #ifndef _COMPAT_H
00021 #define _COMPAT_H
00022
00023 #ifndef __STDC_VERSION__
00024
00025 #define __STDC_VERSION__ 0
00026 #endif
00027
00028 #ifdef HAVE_INTTYPES_H
00029 #include <inttypes.h>
00030 #endif
00031
00032 #ifdef HAVE_LIMITS_H
00033 #include <limits.h>
00034 #endif
00035
00036 #ifdef HAVE_UNISTD_H
00037 #include <unistd.h>
00038 #endif
00039
00040 #ifdef HAVE_STDDEF_H
00041 #include <stddef.h>
00042 #endif
00043
00044 #ifdef HAVE_STDINT_H
00045 #include <stdint.h>
00046 #endif
00047
00048 #ifdef HAVE_SYS_TYPES_H
00049 #include <sys/types.h>
00050 #endif
00051
00052 #include <stdarg.h>
00053
00054 #ifdef HAVE_STDLIB_H
00055 #include <stdlib.h>
00056 #endif
00057
00058 #ifdef HAVE_ALLOCA_H
00059 #include <alloca.h>
00060 #elif defined(HAVE_ALLOCA) && defined(__MINGW32__)
00061 #include <malloc.h>
00062 #endif
00063
00064 #include <stdio.h>
00065
00066 #ifdef HAVE_STRING_H
00067 #include <string.h>
00068 #endif
00069
00070 #ifndef AST_POLL_COMPAT
00071 #include <sys/poll.h>
00072 #else
00073 #include "asterisk/poll-compat.h"
00074 #endif
00075
00076 #if !defined(HAVE_ASPRINTF) && !defined(__AST_DEBUG_MALLOC)
00077 int __attribute__((format(printf, 2, 3))) asprintf(char **str, const char *fmt, ...);
00078 #endif
00079
00080 #ifndef HAVE_GETLOADAVG
00081 int getloadavg(double *list, int nelem);
00082 #endif
00083
00084 #ifndef HAVE_SETENV
00085 int setenv(const char *name, const char *value, int overwrite);
00086 #endif
00087
00088 #ifndef HAVE_STRCASESTR
00089 char *strcasestr(const char *, const char *);
00090 #endif
00091
00092 #if !defined(HAVE_STRNDUP) && !defined(__AST_DEBUG_MALLOC)
00093 char *strndup(const char *, size_t);
00094 #endif
00095
00096 #ifndef HAVE_STRNLEN
00097 size_t strnlen(const char *, size_t);
00098 #endif
00099
00100 #ifndef HAVE_STRSEP
00101 char* strsep(char** str, const char* delims);
00102 #endif
00103
00104 #ifndef HAVE_STRTOQ
00105 uint64_t strtoq(const char *nptr, char **endptr, int base);
00106 #endif
00107
00108 #ifndef HAVE_UNSETENV
00109 int unsetenv(const char *name);
00110 #endif
00111
00112 #if !defined(HAVE_VASPRINTF) && !defined(__AST_DEBUG_MALLOC)
00113 int __attribute__((format(printf, 2, 0))) vasprintf(char **strp, const char *fmt, va_list ap);
00114 #endif
00115
00116 #ifndef HAVE_TIMERSUB
00117 void timersub(struct timeval *tvend, struct timeval *tvstart, struct timeval *tvdiff);
00118 #endif
00119
00120 #ifndef HAVE_STRLCAT
00121 size_t strlcat(char *dst, const char *src, size_t siz);
00122 #endif
00123
00124 #ifndef HAVE_STRLCPY
00125 size_t strlcpy(char *dst, const char *src, size_t siz);
00126 #endif
00127
00128 #include <errno.h>
00129
00130 #ifdef SOLARIS
00131 #define __BEGIN_DECLS
00132 #define __END_DECLS
00133
00134 #ifndef __P
00135 #define __P(p) p
00136 #endif
00137
00138 #include <alloca.h>
00139 #include <strings.h>
00140 #include <string.h>
00141 #include <pthread.h>
00142 #include <sys/stat.h>
00143 #include <signal.h>
00144 #include <netinet/in.h>
00145 #include <sys/loadavg.h>
00146 #include <dat/dat_platform_specific.h>
00147
00148 #ifndef BYTE_ORDER
00149 #define LITTLE_ENDIAN 1234
00150 #define BIG_ENDIAN 4321
00151
00152 #ifdef __sparc__
00153 #define BYTE_ORDER BIG_ENDIAN
00154 #else
00155 #define BYTE_ORDER LITTLE_ENDIAN
00156 #endif
00157 #endif
00158
00159 #ifndef __BYTE_ORDER
00160 #define __LITTLE_ENDIAN LITTLE_ENDIAN
00161 #define __BIG_ENDIAN BIG_ENDIAN
00162 #define __BYTE_ORDER BYTE_ORDER
00163 #endif
00164
00165 #ifndef __BIT_TYPES_DEFINED__
00166 #define __BIT_TYPES_DEFINED__
00167 typedef unsigned char u_int8_t;
00168 typedef unsigned short u_int16_t;
00169 typedef unsigned int u_int32_t;
00170 typedef unsigned int uint;
00171 #endif
00172
00173 #endif
00174
00175 #ifdef __CYGWIN__
00176 #define _WIN32_WINNT 0x0500
00177 #ifndef INET_ADDRSTRLEN
00178 #define INET_ADDRSTRLEN 16
00179 #endif
00180 #ifndef INET6_ADDRSTRLEN
00181 #define INET6_ADDRSTRLEN 46
00182 #endif
00183 #endif
00184
00185 #ifdef __CYGWIN__
00186 typedef unsigned long long uint64_t;
00187 #endif
00188
00189
00190 #if defined(__Darwin__) || defined(__CYGWIN__)
00191 #define GLOB_ABORTED GLOB_ABEND
00192 #endif
00193 #include <glob.h>
00194 #ifdef SOLARIS
00195 #define MY_GLOB_FLAGS GLOB_NOCHECK
00196 #else
00197 #define MY_GLOB_FLAGS (GLOB_NOMAGIC|GLOB_BRACE)
00198 #endif
00199
00200 #endif