initial openbsd port

This commit is contained in:
Sears Russell 2009-11-29 06:57:16 +00:00
parent 2ff421bff0
commit 85c8e9f82c
3 changed files with 19 additions and 4 deletions

View file

@ -62,6 +62,8 @@ INCLUDE(CheckCSourceCompiles)
CHECK_FUNCTION_EXISTS(sync_file_range HAVE_SYNC_FILE_RANGE) CHECK_FUNCTION_EXISTS(sync_file_range HAVE_SYNC_FILE_RANGE)
CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC) CHECK_FUNCTION_EXISTS(fdatasync HAVE_FDATASYNC)
CHECK_FUNCTION_EXISTS(tdestroy HAVE_TDESTROY) CHECK_FUNCTION_EXISTS(tdestroy HAVE_TDESTROY)
SET(CMAKE_REQUIRED_FLAGS "-lm")
CHECK_FUNCTION_EXISTS(powl HAVE_POWL)
CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE CHECK_C_SOURCE_COMPILES("#define _GNU_SOURCE
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -127,23 +129,31 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/build
LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis) LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/src/stasis)
IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" ) IF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
SET(COMMON_LIBRARIES stasis m pthread) SET(COMMON_LIBRARIES stasis m pthread stdc++)
SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-variadic-macros -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-variadic-macros -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" ) ELSEIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "SunPro" )
SET(COMMON_LIBRARIES stasis m pthread Crun Cstd) SET(COMMON_LIBRARIES stasis m pthread Crun Cstd)
SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-g -xc99=all -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "-g -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ENDIF () ELSE( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
# TODO: how to detect compilers correctly on old cmake??? This is a huge hack; it uses old gcc
# options, since cmake is old...
SET(COMMON_LIBRARIES stasis m pthread stdc++)
SET(CMAKE_C_FLAGS "-g -Wall -pedantic -std=gnu99 -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "-g -Wall -Wno-long-long -pedantic -DPBL_COMPAT -D_FILE_OFFSET_BITS=64 ${CMAKE_CXX_FLAGS}")
ENDIF ( "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/stasis INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/stasis
DESTINATION include/ DESTINATION include/
FILES_MATCHING PATTERN "*.h" #FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE PATTERN ".svn" EXCLUDE
PATTERN ".deps" EXCLUDE) PATTERN ".deps" EXCLUDE)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stasis INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/stasis
DESTINATION include/ DESTINATION include/
FILES_MATCHING PATTERN "*.h" #FILES_MATCHING
PATTERN "*.h"
PATTERN ".svn" EXCLUDE PATTERN ".svn" EXCLUDE
PATTERN ".deps" EXCLUDE) PATTERN ".deps" EXCLUDE)

View file

@ -6,6 +6,7 @@
#cmakedefine HAVE_PTHREAD_STACK_MIN #cmakedefine HAVE_PTHREAD_STACK_MIN
#cmakedefine HAVE_ALLOCA_H #cmakedefine HAVE_ALLOCA_H
#cmakedefine HAVE_TDESTROY #cmakedefine HAVE_TDESTROY
#cmakedefine HAVE_POWL
#ifndef HAVE_PTHREAD_STACK_MIN #ifndef HAVE_PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 32768 // wild guess. #define PTHREAD_STACK_MIN 32768 // wild guess.

View file

@ -207,7 +207,11 @@ compensated_function int TarrayListExtend(int xid, recordid rid, int slots) {
try_ret(compensation_error()) { try_ret(compensation_error()) {
for(pageid_t i = lastCurrentBlock+1; i <= lastNewBlock; i++) { for(pageid_t i = lastCurrentBlock+1; i <= lastNewBlock; i++) {
/* Alloc block i */ /* Alloc block i */
#ifdef HAVE_POWL
pageid_t blockSize = alp.initialSize * powl(alp.multiplier, i); pageid_t blockSize = alp.initialSize * powl(alp.multiplier, i);
#else
pageid_t blockSize = alp.initialSize * powf(alp.multiplier, i);
#endif
pageid_t newFirstPage = TpageAllocMany(xid, blockSize); pageid_t newFirstPage = TpageAllocMany(xid, blockSize);
DEBUG("block %d\n", i); DEBUG("block %d\n", i);
tmp.slot = i + FIRST_DATA_PAGE_OFFSET; tmp.slot = i + FIRST_DATA_PAGE_OFFSET;