VERSION 1.0
LANGUAGES CXX)
-option (Seastar_ALLOC_FAILURE_INJECTION
- "Enable failure injection into the Seastar allocator."
+# generic boolean values passed as string, potentially from configure.py
+set (True_STRING_VALUES "ON" "yes" "Yes" "YES" "true" "True" "TRUE")
+set (False_STRING_VALUES "OFF" "no" "No" "NO" "false" "False" "FALSE")
+set (Default_STRING_VALUES "DEFAULT" "default" "Default")
+
+set (Seastar_ALLOC_FAILURE_INJECTION
+ "DEFAULT"
+ CACHE
+ STRING
+ "Enable failure injection into the Seastar allocator. Can be ON, OFF or DEFAULT (which enables it for Dev mode)")
+
+option (Seastar_TASK_BACKTRACE
+ "Collect backtrace at deferring points."
OFF)
-option (Seastar_EXPERIMENTAL_COROUTINES_TS
- "Enable experimental support for Coroutines TS."
+option (Seastar_DEBUG_ALLOCATIONS
+ "For now just writes 0xab to newly allocated memory"
OFF)
+option (Seastar_SSTRING
+ "Use seastar's own string implementation"
+ ON)
+
set (Seastar_API_LEVEL
- "2"
+ "6"
CACHE
STRING
- "Seastar compatibility API level (2=server_socket::accept() returns accept_result)")
+ "Seastar compatibility API level (2=server_socket::accept() returns accept_result, 3=make_file_output_stream(), make_file_data_sink() returns future<...>, 4=when_all_succeed returns future<std::tuple<>>, 5=future<T>::get() returns T&&), 6=future is not variadic")
set_property (CACHE Seastar_API_LEVEL
PROPERTY
- STRINGS 1 2)
+ STRINGS 2 3 4 5 6)
#
# Add a dev build type.
"Only execute tests which run quickly."
OFF)
-option (Seastar_GCC6_CONCEPTS
- "Enable compilation with gcc version 6 concepts support."
- OFF)
-
option (Seastar_HWLOC
"Enable hwloc support."
ON)
"Enable NUMA support."
ON)
-option (Seastar_STD_OPTIONAL_VARIANT_STRINGVIEW
- "Use the non-experimental versions of `optional`, `variant`, and `string_view`. Requires C++17."
- OFF)
-
option (Seastar_TESTING
"Enable testing targets."
ON)
"Maximum allowed time for a test to run, in seconds.")
# We set the following environment variables
-# * ASAN_OPTIONS=disable_coredump=0:abort_on_error=1
+# * ASAN_OPTIONS=disable_coredump=0:abort_on_error=1:detect_stack_use_after_return=1
# By default asan disables core dumps because they used to be
# huge. This is no longer the case since the shadow memory is
# excluded, so it is safe to enable them.
# * BOOST_TEST_CATCH_SYSTEM_ERRORS=no
# Normally the boost test library handles SIGABRT and prevents core
# dumps from being produced.
+
+# This works great with clang and gcc 10.2, but unfortunately not any
+# previous gcc.
+set (Seastar_USE_AFTER_RETURN "")
+if ((NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")) OR
+ (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2))
+ set (Seastar_USE_AFTER_RETURN ":detect_stack_use_after_return=1")
+endif ()
+
set (Seastar_TEST_ENVIRONMENT
- "ASAN_OPTIONS=disable_coredump=0:abort_on_error=1;UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1;BOOST_TEST_CATCH_SYSTEM_ERRORS=no"
+ "ASAN_OPTIONS=disable_coredump=0:abort_on_error=1${Seastar_USE_AFTER_RETURN};UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1;BOOST_TEST_CATCH_SYSTEM_ERRORS=no"
CACHE
STRING
"Environment variables for running tests")
"Make [[nodiscard]] violations an error (instead of a warning)."
OFF)
+set (Seastar_STACK_GUARDS
+ "DEFAULT"
+ CACHE
+ STRING
+ "Enable stack guards. Can be ON, OFF or DEFAULT (which enables it for non release builds)")
+
+set (Seastar_SANITIZE
+ "DEFAULT"
+ CACHE
+ STRING
+ "Enable ASAN and UBSAN. Can be ON, OFF or DEFAULT (which enables it for Debug and Sanitize)")
+
+set (Seastar_DEBUG_SHARED_PTR
+ "DEFAULT"
+ CACHE
+ STRING
+ "Enable shared_ptr debugging. Can be ON, OFF or DEFAULT (which enables it for Debug and Sanitize)")
+
# When Seastar is embedded with `add_subdirectory`, disable the non-library targets.
if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
set (Seastar_APPS OFF)
#
include (SeastarDependencies)
-set (StdFilesystem_CXX_DIALECT ${Seastar_CXX_DIALECT})
seastar_find_dependencies ()
# Private build dependencies not visible to consumers
endfunction ()
function (seastar_generate_swagger)
- set (one_value_args TARGET VAR IN_FILE OUT_FILE)
+ set (one_value_args TARGET VAR IN_FILE OUT_DIR)
cmake_parse_arguments (args "" "${one_value_args}" "" ${ARGN})
- get_filename_component (out_dir ${args_OUT_FILE} DIRECTORY)
+ get_filename_component (in_file_name ${args_IN_FILE} NAME)
set (generator ${Seastar_SOURCE_DIR}/scripts/seastar-json2code.py)
+ set (header_out ${args_OUT_DIR}/${in_file_name}.hh)
+ set (source_out ${args_OUT_DIR}/${in_file_name}.cc)
add_custom_command (
DEPENDS
${args_IN_FILE}
${generator}
- OUTPUT ${args_OUT_FILE}
- COMMAND ${CMAKE_COMMAND} -E make_directory ${out_dir}
- COMMAND ${generator} -f ${args_IN_FILE} -o ${args_OUT_FILE})
+ OUTPUT ${header_out} ${source_out}
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${args_OUT_DIR}
+ COMMAND ${generator} --create-cc -f ${args_IN_FILE} -o ${header_out})
add_custom_target (${args_TARGET}
- DEPENDS ${args_OUT_FILE})
+ DEPENDS
+ ${header_out}
+ ${source_out})
- set (${args_VAR} ${args_OUT_FILE} PARENT_SCOPE)
+ set (${args_VAR} ${header_out} ${source_out} PARENT_SCOPE)
endfunction ()
#
include/seastar/core/gate.hh
include/seastar/core/iostream-impl.hh
include/seastar/core/iostream.hh
+ include/seastar/util/later.hh
+ include/seastar/core/layered_file.hh
include/seastar/core/linux-aio.hh
+ include/seastar/core/loop.hh
include/seastar/core/lowres_clock.hh
include/seastar/core/manual_clock.hh
+ include/seastar/core/map_reduce.hh
include/seastar/core/memory.hh
include/seastar/core/metrics.hh
include/seastar/core/metrics_api.hh
include/seastar/core/thread.hh
include/seastar/core/thread_cputime_clock.hh
include/seastar/core/thread_impl.hh
+ include/seastar/core/timed_out_error.hh
include/seastar/core/timer-set.hh
include/seastar/core/timer.hh
include/seastar/core/transfer.hh
include/seastar/core/units.hh
include/seastar/core/vector-data-sink.hh
include/seastar/core/weak_ptr.hh
+ include/seastar/core/when_all.hh
+ include/seastar/core/with_scheduling_group.hh
+ include/seastar/core/with_timeout.hh
include/seastar/http/api_docs.hh
include/seastar/http/common.hh
include/seastar/http/exception.hh
include/seastar/rpc/rpc_types.hh
include/seastar/util/alloc_failure_injector.hh
include/seastar/util/backtrace.hh
+ include/seastar/util/concepts.hh
include/seastar/util/bool_class.hh
include/seastar/util/conversions.hh
include/seastar/util/defer.hh
include/seastar/util/is_smart_ptr.hh
include/seastar/util/lazy.hh
include/seastar/util/log-cli.hh
+ include/seastar/util/log-impl.hh
include/seastar/util/log.hh
include/seastar/util/noncopyable_function.hh
include/seastar/util/optimized_optional.hh
src/core/exception_hacks.cc
src/core/execution_stage.cc
src/core/file-impl.hh
+ src/core/fsnotify.cc
src/core/fsqual.cc
src/core/fstream.cc
src/core/future.cc
src/core/linux-aio.cc
src/core/memory.cc
src/core/metrics.cc
+ src/core/on_internal_error.cc
src/core/posix.cc
src/core/prometheus.cc
src/core/reactor.cc
src/core/scollectd-impl.hh
src/core/systemwide_memory_barrier.cc
src/core/smp.cc
+ src/core/sstring.cc
src/core/thread.cc
src/core/uname.cc
src/core/vla.hh
src/core/io_queue.cc
+ src/core/semaphore.cc
+ src/core/condition-variable.cc
src/http/api_docs.cc
src/http/common.cc
src/http/file_handler.cc
src/util/alloc_failure_injector.cc
src/util/backtrace.cc
src/util/conversions.cc
+ src/util/exceptions.cc
+ src/util/file.cc
src/util/log.cc
src/util/program-options.cc
- src/util/read_first_line.cc)
+ src/util/read_first_line.cc
+ src/util/tmp_file.cc)
add_library (Seastar::seastar ALIAS seastar)
list (APPEND Seastar_PRIVATE_CXX_FLAGS -gz)
endif()
-if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Sanitize"))
- if (NOT Sanitizers_FOUND)
- message (FATAL_ERROR "Sanitizers are required for debug and sanitize modes!")
- endif ()
-endif ()
-
target_link_libraries (seastar
PUBLIC
Boost::boost
lz4::lz4
PRIVATE
${CMAKE_DL_LIBS}
- Boost::filesystem
GnuTLS::gnutls
StdAtomic::atomic
- StdFilesystem::filesystem
lksctp-tools::lksctp-tools
protobuf::libprotobuf
rt::rt
yaml-cpp::yaml-cpp
Threads::Threads)
-if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Sanitize"))
+set (Seastar_SANITIZE_MODES "Debug" "Sanitize")
+if ((Seastar_SANITIZE STREQUAL "ON") OR
+ ((Seastar_SANITIZE STREQUAL "DEFAULT") AND
+ (CMAKE_BUILD_TYPE IN_LIST Seastar_SANITIZE_MODES)))
+ if (NOT Sanitizers_FOUND)
+ message (FATAL_ERROR "Sanitizers not found!")
+ endif ()
set (Seastar_Sanitizers_OPTIONS ${Sanitizers_COMPILER_OPTIONS})
target_link_libraries (seastar
PUBLIC
Sanitizers::undefined_behavior)
endif ()
+# We only need valgrind to find uninitialized memory uses, so disable
+# the leak sanitizer.
+# To test with valgrind run "ctest -T memcheck"
+set( MEMORYCHECK_COMMAND_OPTIONS "--error-exitcode=1 --leak-check=no --trace-children=yes" )
+include (CTest)
+
#
# We want asserts enabled on all modes, but cmake defaults to passing
# -DNDEBUG in some modes. We add -UNDEBUG to our private options to
target_compile_options (seastar
PUBLIC
- -std=${Seastar_CXX_DIALECT}
+ $<$<COMPILE_LANGUAGE:CXX>:-std=${Seastar_CXX_DIALECT}>
-U_FORTIFY_SOURCE)
target_compile_definitions(seastar
-Wno-maybe-uninitialized)
endif ()
-if (Seastar_EXPERIMENTAL_COROUTINES_TS)
- target_compile_options (seastar PUBLIC -fcoroutines-ts -g)
- target_compile_definitions (seastar PUBLIC SEASTAR_COROUTINES_TS)
-endif ()
-
-if (Seastar_GCC6_CONCEPTS OR Concepts_FOUND)
- target_compile_definitions (seastar
- PUBLIC SEASTAR_HAVE_GCC6_CONCEPTS)
-
- target_link_libraries (seastar
- PUBLIC Concepts::concepts)
+if (Seastar_SSTRING)
+ target_compile_options (seastar PUBLIC -DSEASTAR_SSTRING)
endif ()
if (LinuxMembarrier_FOUND)
PRIVATE LinuxMembarrier::membarrier)
endif ()
-if (Seastar_ALLOC_FAILURE_INJECTION)
+set (Seastar_ALLOC_FAILURE_INJECTION_MODES "Dev")
+if ((Seastar_ALLOC_FAILURE_INJECTION IN_LIST True_STRING_VALUES) OR
+ ((Seastar_ALLOC_FAILURE_INJECTION STREQUAL "DEFAULT") AND
+ (CMAKE_BUILD_TYPE IN_LIST Seastar_ALLOC_FAILURE_INJECTION_MODES)))
target_compile_definitions (seastar
PUBLIC SEASTAR_ENABLE_ALLOC_FAILURE_INJECTION)
endif ()
-if (Seastar_STD_OPTIONAL_VARIANT_STRINGVIEW)
+if (Seastar_TASK_BACKTRACE)
+ target_compile_definitions (seastar
+ PUBLIC SEASTAR_TASK_BACKTRACE)
+endif ()
+
+if (Seastar_DEBUG_ALLOCATIONS)
target_compile_definitions (seastar
- PUBLIC SEASTAR_USE_STD_OPTIONAL_VARIANT_STRINGVIEW)
+ PRIVATE SEASTAR_DEBUG_ALLOCATIONS)
endif ()
if (Sanitizers_FIBER_SUPPORT)
PUBLIC
SEASTAR_DEBUG
SEASTAR_DEFAULT_ALLOCATOR
- SEASTAR_DEBUG_SHARED_PTR
SEASTAR_SHUFFLE_TASK_QUEUE)
endif ()
-if ((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Sanitize") OR (CMAKE_BUILD_TYPE STREQUAL "Dev"))
- target_compile_options (seastar
+set (Seastar_DEBUG_SHARED_PTR_MODES "Debug" "Sanitize")
+if (Seastar_DEBUG_SHARED_PTR IN_LIST True_STRING_VALUES OR
+ ((Seastar_DEBUG_SHARED_PTR IN_LIST Default_STRING_VALUES) AND
+ (CMAKE_BUILD_TYPE IN_LIST Seastar_DEBUG_SHARED_PTR_MODES)))
+ target_compile_definitions (seastar
PUBLIC
+ SEASTAR_DEBUG_SHARED_PTR)
+endif ()
+
+set (Seastar_STACK_GUARD_MODES "Debug" "Sanitize" "Dev")
+if ((Seastar_STACK_GUARDS STREQUAL "ON") OR
+ ((Seastar_STACK_GUARDS STREQUAL "DEFAULT") AND
+ (CMAKE_BUILD_TYPE IN_LIST Seastar_STACK_GUARD_MODES)))
+ seastar_supports_flag ("-fstack-clash-protection" StackClashProtection_FOUND)
+ if (StackClashProtection_FOUND)
+ target_compile_options (seastar
+ PUBLIC
-fstack-clash-protection)
+ endif ()
target_compile_definitions (seastar
PRIVATE
SEASTAR_THREAD_STACK_GUARDS)
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindProtobuf.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindSanitizers.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindStdAtomic.cmake
- ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindStdFilesystem.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findc-ares.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Findcryptopp.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Finddpdk.cmake