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 
00019 
00020 
00021 
00022 
00023 
00024 #ifndef _ink_defs_h
00025 #define _ink_defs_h
00026 
00027 
00028 #include "ink_config.h"
00029 #include <stddef.h>
00030 
00031 #ifdef HAVE_STDINT_H
00032 # include <stdint.h>
00033 #else
00034 
00035 #endif
00036 
00037 #ifdef HAVE_INTTYPES_H
00038 # include <inttypes.h>
00039 #else
00040 
00041 #endif
00042 
00043 #ifndef INT64_MIN
00044 #define INT64_MAX (9223372036854775807LL)
00045 #define INT64_MIN (-INT64_MAX -1LL)
00046 #define INT32_MAX (2147483647)
00047 #define INT32_MIN (-2147483647-1)
00048 #endif
00049 
00050 #define POSIX_THREAD
00051 #define POSIX_THREAD_10031c
00052 
00053 #ifndef ETIME
00054 #ifdef ETIMEDOUT
00055 #define ETIME ETIMEDOUT
00056 #endif
00057 #endif
00058 
00059 #ifndef ENOTSUP
00060 #ifdef EOPNOTSUPP
00061 #define ENOTSUP EOPNOTSUPP
00062 #endif
00063 #endif
00064 
00065 #if defined(darwin)
00066 #define RENTRENT_GETHOSTBYNAME
00067 #define RENTRENT_GETHOSTBYADDR
00068 #endif
00069 
00070 #define NUL '\0'
00071 
00072 
00073 
00074 
00075 #define NULL_PTR static_cast<void*>(0)
00076 
00077 
00078 #ifdef __cplusplus
00079 template<typename T, unsigned N>
00080 static inline unsigned
00081 countof(const T (&)[N]) {
00082   return N;
00083 }
00084 #else
00085 #  define countof(x) ((unsigned)(sizeof(x)/sizeof((x)[0])))
00086 #endif
00087 
00088 #define SOCKOPT_ON ((char*)&on)
00089 #define SOCKOPT_OFF ((char*)&off)
00090 
00091 #ifndef ABS
00092 #define ABS(x) (((x) < 0) ? ( - (x)) : (x))
00093 #endif
00094 
00095 #ifndef MAX
00096 #define MAX(x,y) (((x) >= (y)) ? (x) : (y))
00097 #endif
00098 
00099 #ifndef MIN
00100 #define MIN(x,y) (((x) <= (y)) ? (x) : (y))
00101 #endif
00102 
00103 #define ATS_UNUSED __attribute__ ((unused))
00104 #define ATS_WARN_IF_UNUSED __attribute__ ((warn_unused_result))
00105 #define ATS_UNUSED_RETURN(x)    if (x) {}
00106 
00107 #ifndef likely
00108 #define likely(x)       __builtin_expect (!!(x), 1)
00109 #endif
00110 #ifndef unlikely
00111 #define unlikely(x)     __builtin_expect (!!(x), 0)
00112 #endif
00113 
00114 
00115 #if TS_USE_HWLOC
00116 #  include <hwloc.h>
00117 #endif
00118 
00119 #ifndef ROUNDUP
00120 #define ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
00121 #endif
00122 
00123 
00124 
00125 typedef void *(*VPVP_PFN) (void *);
00126 typedef void (*VVP_PFN) (void *);
00127 typedef void (*VV_PFN) (void);
00128 typedef void (*VI_PFN) (int);
00129 
00130 
00131 
00132 extern int debug_level;
00133 extern int off;
00134 extern int on;
00135 
00136 
00137 
00138 int ink_sys_name_release(char *name, int namelen, char *release, int releaselen);
00139 int ink_number_of_processors();
00140 
00141 #if TS_USE_HWLOC
00142 
00143 hwloc_topology_t ink_get_topology();
00144 #endif
00145 
00146 
00147 
00148 #ifdef __cplusplus
00149 namespace ts {
00150   static const int NO_FD = -1; 
00151 }
00152 #endif
00153 
00154 #endif