stabilize build system: depends, installer, boost/bdb fixes, cross targets groundwork
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
|
||||
// Copyright Oliver Kowalke 2014.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_CONTEXT_FIXEDSIZE_H
|
||||
#define BOOST_CONTEXT_FIXEDSIZE_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <new>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
#include <boost/context/stack_context.hpp>
|
||||
#include <boost/context/stack_traits.hpp>
|
||||
|
||||
#if defined(BOOST_USE_VALGRIND)
|
||||
#include <valgrind/valgrind.h>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace context {
|
||||
|
||||
template< typename traitsT >
|
||||
class basic_fixedsize_stack {
|
||||
private:
|
||||
std::size_t size_;
|
||||
|
||||
public:
|
||||
typedef traitsT traits_type;
|
||||
|
||||
basic_fixedsize_stack( std::size_t size = traits_type::default_size() ) BOOST_NOEXCEPT_OR_NOTHROW :
|
||||
size_( size) {
|
||||
}
|
||||
|
||||
stack_context allocate() {
|
||||
void * vp = std::malloc( size_);
|
||||
if ( ! vp) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
stack_context sctx;
|
||||
sctx.size = size_;
|
||||
sctx.sp = static_cast< char * >( vp) + sctx.size;
|
||||
#if defined(BOOST_USE_VALGRIND)
|
||||
sctx.valgrind_stack_id = VALGRIND_STACK_REGISTER( sctx.sp, vp);
|
||||
#endif
|
||||
return sctx;
|
||||
}
|
||||
|
||||
void deallocate( stack_context & sctx) BOOST_NOEXCEPT_OR_NOTHROW {
|
||||
BOOST_ASSERT( sctx.sp);
|
||||
|
||||
#if defined(BOOST_USE_VALGRIND)
|
||||
VALGRIND_STACK_DEREGISTER( sctx.valgrind_stack_id);
|
||||
#endif
|
||||
void * vp = static_cast< char * >( sctx.sp) - sctx.size;
|
||||
std::free( vp);
|
||||
}
|
||||
};
|
||||
|
||||
typedef basic_fixedsize_stack< stack_traits > fixedsize_stack;
|
||||
# if ! defined(BOOST_USE_SEGMENTED_STACKS)
|
||||
typedef fixedsize_stack default_stack;
|
||||
# endif
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONTEXT_FIXEDSIZE_H
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
|
||||
// Copyright Oliver Kowalke 2014.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_CONTEXT_PROTECTED_FIXEDSIZE_H
|
||||
#define BOOST_CONTEXT_PROTECTED_FIXEDSIZE_H
|
||||
|
||||
extern "C" {
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
}
|
||||
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
#include <boost/context/stack_context.hpp>
|
||||
#include <boost/context/stack_traits.hpp>
|
||||
|
||||
#if defined(BOOST_USE_VALGRIND)
|
||||
#include <valgrind/valgrind.h>
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace context {
|
||||
|
||||
template< typename traitsT >
|
||||
class basic_protected_fixedsize_stack {
|
||||
private:
|
||||
std::size_t size_;
|
||||
|
||||
public:
|
||||
typedef traitsT traits_type;
|
||||
|
||||
basic_protected_fixedsize_stack( std::size_t size = traits_type::default_size() ) BOOST_NOEXCEPT_OR_NOTHROW :
|
||||
size_( size) {
|
||||
}
|
||||
|
||||
stack_context allocate() {
|
||||
// page at bottom will be used as guard-page
|
||||
const std::size_t pages(
|
||||
static_cast< std::size_t >(
|
||||
std::floor(
|
||||
static_cast< float >( size_) / traits_type::page_size() ) ) );
|
||||
BOOST_ASSERT_MSG( 2 <= pages, "at least two pages must fit into stack (one page is guard-page)");
|
||||
const std::size_t size__( pages * traits_type::page_size() );
|
||||
BOOST_ASSERT( 0 != size_ && 0 != size__);
|
||||
BOOST_ASSERT( size__ <= size_);
|
||||
|
||||
// conform to POSIX.4 (POSIX.1b-1993, _POSIX_C_SOURCE=199309L)
|
||||
#if defined(MAP_ANON)
|
||||
void * vp = ::mmap( 0, size__, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
#else
|
||||
void * vp = ::mmap( 0, size__, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
#endif
|
||||
if ( MAP_FAILED == vp) throw std::bad_alloc();
|
||||
|
||||
// conforming to POSIX.1-2001
|
||||
#if defined(BOOST_DISABLE_ASSERTS)
|
||||
::mprotect( vp, traits_type::page_size(), PROT_NONE);
|
||||
#else
|
||||
const int result( ::mprotect( vp, traits_type::page_size(), PROT_NONE) );
|
||||
BOOST_ASSERT( 0 == result);
|
||||
#endif
|
||||
|
||||
stack_context sctx;
|
||||
sctx.size = size__;
|
||||
sctx.sp = static_cast< char * >( vp) + sctx.size;
|
||||
#if defined(BOOST_USE_VALGRIND)
|
||||
sctx.valgrind_stack_id = VALGRIND_STACK_REGISTER( sctx.sp, vp);
|
||||
#endif
|
||||
return sctx;
|
||||
}
|
||||
|
||||
void deallocate( stack_context & sctx) BOOST_NOEXCEPT_OR_NOTHROW {
|
||||
BOOST_ASSERT( sctx.sp);
|
||||
|
||||
#if defined(BOOST_USE_VALGRIND)
|
||||
VALGRIND_STACK_DEREGISTER( sctx.valgrind_stack_id);
|
||||
#endif
|
||||
|
||||
void * vp = static_cast< char * >( sctx.sp) - sctx.size;
|
||||
// conform to POSIX.4 (POSIX.1b-1993, _POSIX_C_SOURCE=199309L)
|
||||
::munmap( vp, sctx.size);
|
||||
}
|
||||
};
|
||||
|
||||
typedef basic_protected_fixedsize_stack< stack_traits > protected_fixedsize_stack;
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONTEXT_PROTECTED_FIXEDSIZE_H
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
// Copyright Oliver Kowalke 2014.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_CONTEXT_SEGMENTED_H
|
||||
#define BOOST_CONTEXT_SEGMENTED_H
|
||||
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/context/detail/config.hpp>
|
||||
#include <boost/context/stack_context.hpp>
|
||||
#include <boost/context/stack_traits.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_PREFIX
|
||||
#endif
|
||||
|
||||
// forward declaration for splitstack-functions defined in libgcc
|
||||
extern "C" {
|
||||
void *__splitstack_makecontext( std::size_t,
|
||||
void * [BOOST_CONTEXT_SEGMENTS],
|
||||
std::size_t *);
|
||||
|
||||
void __splitstack_releasecontext( void * [BOOST_CONTEXT_SEGMENTS]);
|
||||
|
||||
void __splitstack_resetcontext( void * [BOOST_CONTEXT_SEGMENTS]);
|
||||
|
||||
void __splitstack_block_signals_context( void * [BOOST_CONTEXT_SEGMENTS],
|
||||
int * new_value, int * old_value);
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
namespace context {
|
||||
|
||||
template< typename traitsT >
|
||||
class basic_segmented_stack {
|
||||
private:
|
||||
std::size_t size_;
|
||||
|
||||
public:
|
||||
typedef traitsT traits_type;
|
||||
|
||||
basic_segmented_stack( std::size_t size = traits_type::default_size() ) BOOST_NOEXCEPT_OR_NOTHROW :
|
||||
size_( size) {
|
||||
}
|
||||
|
||||
stack_context allocate() {
|
||||
stack_context sctx;
|
||||
void * vp = __splitstack_makecontext( size_, sctx.segments_ctx, & sctx.size);
|
||||
if ( ! vp) throw std::bad_alloc();
|
||||
|
||||
// sctx.size is already filled by __splitstack_makecontext
|
||||
sctx.sp = static_cast< char * >( vp) + sctx.size;
|
||||
|
||||
int off = 0;
|
||||
__splitstack_block_signals_context( sctx.segments_ctx, & off, 0);
|
||||
|
||||
return sctx;
|
||||
}
|
||||
|
||||
void deallocate( stack_context & sctx) BOOST_NOEXCEPT_OR_NOTHROW {
|
||||
__splitstack_releasecontext( sctx.segments_ctx);
|
||||
}
|
||||
};
|
||||
|
||||
typedef basic_segmented_stack< stack_traits > segmented_stack;
|
||||
# if defined(BOOST_USE_SEGMENTED_STACKS)
|
||||
typedef segmented_stack default_stack;
|
||||
# endif
|
||||
|
||||
}}
|
||||
|
||||
#ifdef BOOST_HAS_ABI_HEADERS
|
||||
# include BOOST_ABI_SUFFIX
|
||||
#endif
|
||||
|
||||
#endif // BOOST_CONTEXT_SEGMENTED_H
|
||||
Reference in New Issue
Block a user