00001 /* -*- mode:C++; c-basic-offset:4 -*- 00002 Shore-MT -- Multi-threaded port of the SHORE storage manager 00003 00004 Copyright (c) 2007-2009 00005 Data Intensive Applications and Systems Labaratory (DIAS) 00006 Ecole Polytechnique Federale de Lausanne 00007 00008 All Rights Reserved. 00009 00010 Permission to use, copy, modify and distribute this software and 00011 its documentation is hereby granted, provided that both the 00012 copyright notice and this permission notice appear in all copies of 00013 the software, derivative works or modified versions, and any 00014 portions thereof, and that both notices appear in supporting 00015 documentation. 00016 00017 This code is distributed in the hope that it will be useful, but 00018 WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS 00020 DISCLAIM ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER 00021 RESULTING FROM THE USE OF THIS SOFTWARE. 00022 */ 00023 00024 /*<std-header orig-src='shore' incl-file-exclusion='W_DEFINES_H' no-defines='true'> 00025 00026 $Id: w_defines.h,v 1.8 2010/12/08 17:37:37 nhall Exp $ 00027 00028 SHORE -- Scalable Heterogeneous Object REpository 00029 00030 Copyright (c) 1994-99 Computer Sciences Department, University of 00031 Wisconsin -- Madison 00032 All Rights Reserved. 00033 00034 Permission to use, copy, modify and distribute this software and its 00035 documentation is hereby granted, provided that both the copyright 00036 notice and this permission notice appear in all copies of the 00037 software, derivative works or modified versions, and any portions 00038 thereof, and that both notices appear in supporting documentation. 00039 00040 THE AUTHORS AND THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY 00041 OF WISCONSIN - MADISON ALLOW FREE USE OF THIS SOFTWARE IN ITS 00042 "AS IS" CONDITION, AND THEY DISCLAIM ANY LIABILITY OF ANY KIND 00043 FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 00044 00045 This software was developed with support by the Advanced Research 00046 Project Agency, ARPA order number 018 (formerly 8230), monitored by 00047 the U.S. Army Research Laboratory under contract DAAB07-91-C-Q518. 00048 Further funding for this work was provided by DARPA through 00049 Rome Research Laboratory Contract No. F30602-97-2-0247. 00050 00051 */ 00052 00053 #ifndef W_DEFINES_H 00054 #define W_DEFINES_H 00055 00056 /* -- do not edit anything above this line -- </std-header>*/ 00057 00058 /* shore-config.h does not have duplicate-include protection, but 00059 this file does, and we don't include shore-config.h anywhere else 00060 00061 Before including it, erase the existing autoconf #defines (if any) 00062 to avoid warnings about redefining macros. 00063 */ 00064 #ifdef PACKAGE 00065 #undef PACKAGE 00066 #endif 00067 #ifdef PACKAGE_NAME 00068 #undef PACKAGE_NAME 00069 #endif 00070 #ifdef PACKAGE_STRING 00071 #undef PACKAGE_STRING 00072 #endif 00073 #ifdef PACKAGE_BUGREPORT 00074 #undef PACKAGE_BUGREPORT 00075 #endif 00076 #ifdef PACKAGE_TARNAME 00077 #undef PACKAGE_TARNAME 00078 #endif 00079 #ifdef PACKAGE_VERSION 00080 #undef PACKAGE_VERSION 00081 #endif 00082 #ifdef VERSION 00083 #undef VERSION 00084 #endif 00085 #include "shore-config.h" 00086 #include "shore.def" 00087 00088 /* 00089 * Valgrind/Purify support 00090 * note: ZERO_INIT makes data structures clear out or 00091 * otherwise initialize their contents on 00092 * init so that you don't get certain benign uninit read/write errors 00093 */ 00094 #if defined(HAVE_PURIFY_H) || defined(PURIFY) 00095 #include <purify.h> 00096 #define ZERO_INIT 1 /* for purify */ 00097 #endif 00098 00099 #ifdef HAVE_VALGRIND_H 00100 #define USING_VALGRIND 1 00101 #include <valgrind.h> 00102 #define ZERO_INIT 1 /* for valgrind */ 00103 #elif defined(HAVE_VALGRIND_VALGRIND_H) 00104 #define USING_VALGRIND 1 00105 #include <valgrind/valgrind.h> 00106 #define ZERO_INIT 1 /* for valgrind */ 00107 #endif 00108 00109 #ifdef USING_VALGRIND 00110 #include "valgrind_help.h" 00111 #endif 00112 00113 #ifdef __SUNPRO_CC 00114 #include <errno.h> 00115 #include <stddef.h> 00116 #include <stdlib.h> 00117 #include <limits.h> 00118 #else 00119 #include <cerrno> 00120 #include <cstddef> 00121 #include <cstdlib> 00122 #include <climits> 00123 #endif 00124 00125 #include <unistd.h> 00126 00127 /* the following cannot be "verbatim" included in shore-config.def, 00128 * unfortunately. The #undef ARCH_LP64 gets mangled 00129 * by autoconf. 00130 */ 00131 #ifdef ARCH_LP64 00132 /* enabled LP64 - let's make sure the environment can handle it */ 00133 #if defined(_SC_V6_LP64_OFF64) || _XBS5_LP64_OFF64 || _SC_V6_LPBIG_OFFBIG || _XBS5_LPBIG_OFFBIG 00134 #else 00135 #warning Turning off ARCH_LP64 00136 #undef ARCH_LP64 00137 #endif 00138 /* ARCH_LP64 was defined (might no longer be) */ 00139 #endif 00140 00141 /* Issue warning if we don't have large file offsets with ILP32 */ 00142 #ifndef ARCH_LP64 00143 00144 #if _SC_V6_ILP32_OFFBIG || _XBS5_ILP32_OFFBIG 00145 #else 00146 #warning large file off_t support seems to be missing accoring to sysconf ! 00147 #endif 00148 00149 /* ARCH_LP64 not defined */ 00150 #endif 00151 00152 00153 #if SM_PAGESIZE > 32768 00154 #error SM does not support pages this large. 00155 #endif 00156 00157 00158 #include <sys/types.h> 00159 using namespace std; 00160 00161 // avoid nasty bus errors... 00162 template<class T> 00163 static inline T* aligned_cast(char const* ptr) 00164 { 00165 // bump the pointer up to the next proper alignment (always a power of 2) 00166 size_t val = (size_t) ptr; 00167 val += __alignof__(T) - 1; 00168 val &= -__alignof__(T); 00169 return (T*) val; 00170 } 00171 00172 00173 /** \brief constructs a blob of N bytes. 00174 * 00175 * When instantiated on the stack, allocates enough 00176 * bytes on the stack to hold an object of size N, aligned. 00177 * Specialize this to handle arbitrary sizes (sizeof(a)+sizeof(b), etc). 00178 */ 00179 template<int N> 00180 class allocaN { 00181 char _buf[N+__alignof__(double)]; 00182 public: 00183 operator void*() { return aligned_cast<double>(_buf); } 00184 // no destructor because we don't know what's going on... 00185 }; 00186 00187 /*<std-footer incl-file-exclusion='W_DEFINES_H'> -- do not edit anything below this line -- */ 00188 00189 #endif /*</std-footer>*/