diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b01ee6075..39c4b26035 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,12 +52,14 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) endif() endif() +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + if(COMDB2_BBCMAKE) include(${COMDB2_BBCMAKE}) - add_definitions(-DCOMDB2_BBCMAKE) else() -configure_file(bbinc/plhash.in bbinc/plhash.h COPYONLY) -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/cmake) + configure_file(bbinc/plhash.in bbinc/plhash.h COPYONLY) +endif() + find_package(LZ4 REQUIRED) find_package(OpenSSL REQUIRED) set(PROTOBUF_C_MIN_VERSION 1.1.0) @@ -83,8 +85,6 @@ if(WITH_QKAFKA) add_definitions(-DWITH_QKAFKA) endif() -endif(COMDB2_BBCMAKE) - option(COMDB2_LEGACY_DEFAULTS "Legacy defaults without lrl override" OFF) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) diff --git a/bbinc/plhash_glue.h b/bbinc/plhash_glue.h index c785994ec7..62f2f12522 100644 --- a/bbinc/plhash_glue.h +++ b/bbinc/plhash_glue.h @@ -1,6 +1,7 @@ #ifndef INCLUDED_PLHASH_GLUE_H #define INCLUDED_PLHASH_GLUE_H #include + /* Following are not available in sysutil */ hash_t *hash_init_ptr(void); /* hash of pointers (addresses) */ hash_t *hash_init_strcase(int keyoff); /* string starts at keyoff (case-insensitive) */ diff --git a/bbinc/tunables.h b/bbinc/tunables.h index ffd9dd1cfa..eb3b26cd21 100644 --- a/bbinc/tunables.h +++ b/bbinc/tunables.h @@ -17,7 +17,7 @@ #ifndef _TUNABLES_H #define _TUNABLES_H -#include "plhash.h" +#include typedef enum { /* diff --git a/bdb/CMakeLists.txt b/bdb/CMakeLists.txt index 864de1f771..96449c169e 100644 --- a/bdb/CMakeLists.txt +++ b/bdb/CMakeLists.txt @@ -111,7 +111,6 @@ include_directories( ${PROTOBUF-C_INCLUDE_DIR} ) if (COMDB2_BBCMAKE) - target_link_libraries(bdb PUBLIC db lz4) - configure_bb_target(bdb V2 NO_BUILDID NO_PLINKSTRINGS HEADER_DIRS) + comdb2_lib_target(bdb) endif() add_dependencies(bdb db mem proto) diff --git a/bdb/bdb_int.h b/bdb/bdb_int.h index d0822ba571..510d9c6746 100644 --- a/bdb/bdb_int.h +++ b/bdb/bdb_int.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include "bdb_cursor.h" diff --git a/bdb/cursor.c b/bdb/cursor.c index f7ca1cbcac..48b942a555 100644 --- a/bdb/cursor.c +++ b/bdb/cursor.c @@ -90,7 +90,7 @@ as long as there was a successful move in the past #include "bdb_osqltrn.h" #include #include -#include +#include #include "logmsg.h" #include "util.h" #include "tohex.h" diff --git a/bdb/genid.c b/bdb/genid.c index 7408b8d373..d1205328bc 100644 --- a/bdb/genid.c +++ b/bdb/genid.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include diff --git a/bdb/rowlocks.c b/bdb/rowlocks.c index f4a753c46a..2611ec9aea 100644 --- a/bdb/rowlocks.c +++ b/bdb/rowlocks.c @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include diff --git a/bdb/temptable.c b/bdb/temptable.c index be2673b2ab..3b8d394713 100644 --- a/bdb/temptable.c +++ b/bdb/temptable.c @@ -31,7 +31,7 @@ #include #include "bdb_int.h" #include -#include +#include #include #ifdef _LINUX_SOURCE diff --git a/berkdb/CMakeLists.txt b/berkdb/CMakeLists.txt index 4c695f1de1..a1462f7b7b 100644 --- a/berkdb/CMakeLists.txt +++ b/berkdb/CMakeLists.txt @@ -290,8 +290,7 @@ elseif(${CMAKE_C_COMPILER_ID} STREQUAL Clang OR ${CMAKE_C_COMPILER_ID} STREQUAL endif() if (COMDB2_BBCMAKE) - target_link_libraries(db PUBLIC lz4 openssl) - comdb2_bb_target(db) + comdb2_lib_target(db) endif() option(PAGELIST_DEBUG "Enable debug logic for pagelist dumping and loading" OFF) diff --git a/berkdb/build/db.h b/berkdb/build/db.h index a3850a1d09..5debb40a8f 100644 --- a/berkdb/build/db.h +++ b/berkdb/build/db.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include diff --git a/berkdb/db/db_dispatch.c b/berkdb/db/db_dispatch.c index ee068d9fb1..b8a5281456 100644 --- a/berkdb/db/db_dispatch.c +++ b/berkdb/db/db_dispatch.c @@ -51,7 +51,7 @@ static const char revid[] = "$Id: db_dispatch.c,v 11.145 2003/09/10 20:31:18 ube #include #endif -#include +#include #include "db_int.h" #include "dbinc/db_page.h" #include "dbinc/db_shash.h" diff --git a/berkdb/db/trigger_subscription.c b/berkdb/db/trigger_subscription.c index 20620a68c6..bf8d5d448a 100644 --- a/berkdb/db/trigger_subscription.c +++ b/berkdb/db/trigger_subscription.c @@ -1,6 +1,6 @@ #include #include -#include +#include #include "dbinc/trigger_subscription.h" #include diff --git a/berkdb/dbinc/db_dispatch.h b/berkdb/dbinc/db_dispatch.h index 8bc25dcf6f..077178f03f 100644 --- a/berkdb/dbinc/db_dispatch.h +++ b/berkdb/dbinc/db_dispatch.h @@ -38,7 +38,7 @@ #ifndef _DB_DISPATCH_H_ #define _DB_DISPATCH_H_ -#include +#include /* * Declarations and typedefs for the list of transaction IDs used during * recovery. This is a generic list used to pass along whatever information diff --git a/berkdb/env/env_open.c b/berkdb/env/env_open.c index cea7ca583b..13403586d4 100644 --- a/berkdb/env/env_open.c +++ b/berkdb/env/env_open.c @@ -24,7 +24,7 @@ static const char revid[] = "$Id: env_open.c,v 11.144 2003/09/13 18:39:34 bostic #include #include -#include +#include #include "db_int.h" #include "dbinc/crypto.h" #include "dbinc/db_page.h" diff --git a/berkdb/log/log.c b/berkdb/log/log.c index 57b132a009..fa54d3824c 100644 --- a/berkdb/log/log.c +++ b/berkdb/log/log.c @@ -27,7 +27,7 @@ static const char revid[] = "$Id: log.c,v 11.133 2003/09/13 19:20:37 bostic Exp #include "dbinc/txn.h" #include -#include +#include static int __log_init __P((DB_ENV *, DB_LOG *)); static int __log_recover __P((DB_LOG *)); diff --git a/berkdb/rep/rep_record.c b/berkdb/rep/rep_record.c index 9af16858a7..0470474600 100644 --- a/berkdb/rep/rep_record.c +++ b/berkdb/rep/rep_record.c @@ -4209,7 +4209,7 @@ logical_record_file_affinity(int rectype) int gbl_processor_thd_poll; -#include +#include struct fuid_integer { u_int8_t fuid[DB_FILE_ID_LEN]; diff --git a/cdb2api/CMakeLists.txt b/cdb2api/CMakeLists.txt index b0eff8825d..e96b4e2f99 100644 --- a/cdb2api/CMakeLists.txt +++ b/cdb2api/CMakeLists.txt @@ -16,6 +16,7 @@ set_source_files_properties( ) include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/bbinc ${PROJECT_SOURCE_DIR}/util ${PROJECT_BINARY_DIR}/protobuf @@ -23,22 +24,16 @@ include_directories( ${OPENSSL_INCLUDE_DIR} ) -if (EXTRA_PLUGINS) - include(${EXTRA_PLUGINS}/cdb2api/CMakeLists.txt) -endif() - # common obj files for .so/.dylib and .a add_definitions(-DDISABLE_HOSTADDR_CACHE) add_definitions(-DSBUF2_SERVER=0) if (COMDB2_BBCMAKE) + include(${EXTRA_PLUGINS}/cdb2api/cdb2api.cmake) add_library(opencdb2api STATIC ${src}) - add_dependencies(opencdb2api proto) - target_link_libraries(opencdb2api PUBLIC protobuf-c) - if(${CMAKE_SYSTEM_NAME} STREQUAL Linux) - target_link_libraries(opencdb2api PUBLIC libunwind) - endif() - comdb2_bb_target(opencdb2api) + add_dependencies(opencdb2api proto) + target_link_libraries(opencdb2api PUBLIC cdb2api) + comdb2_lib_target(opencdb2api) else() add_library(cdb2api STATIC ${src}) diff --git a/datetime/CMakeLists.txt b/datetime/CMakeLists.txt index 73c35f3f55..a1ea427b9a 100644 --- a/datetime/CMakeLists.txt +++ b/datetime/CMakeLists.txt @@ -16,5 +16,5 @@ include_directories( ) add_dependencies(tz mem) if (COMDB2_BBCMAKE) - comdb2_bb_target(tz) + comdb2_lib_target(tz) endif() diff --git a/datetime/localtimedb.c b/datetime/localtimedb.c index a6ae71e377..cca3c65c1f 100644 --- a/datetime/localtimedb.c +++ b/datetime/localtimedb.c @@ -2172,7 +2172,7 @@ static void db_settzname(void) } } -#include +#include #define NAME_KEY_MAX 40 diff --git a/db/CMakeLists.txt b/db/CMakeLists.txt index eca864d42f..c58e677604 100644 --- a/db/CMakeLists.txt +++ b/db/CMakeLists.txt @@ -224,24 +224,23 @@ add_definitions( add_executable(comdb2 ${src}) add_dependencies(comdb2 mem proto sqlite db bdb) target_link_libraries(comdb2 PRIVATE - ${PLUGIN_LIBRARIES} - schemachange bdb - util - crc32c comdb2rle + crc32c csc2 cson db dfpal + dlmalloc lua mem - dlmalloc net + schemachange sockpool sqlite - util tz + util + ${PLUGIN_LIBRARIES} ${LibArchive_LIBRARIES} ${LZ4_LIBRARY} ${RDKAFKA_LIBRARY} @@ -254,8 +253,8 @@ target_link_libraries(comdb2 PRIVATE ) if (COMDB2_BBCMAKE) - target_link_libraries(comdb2 PRIVATE opencdb2api uuid event_core_static event_pthreads_static) - comdb2_bb_target(comdb2) + target_link_libraries(comdb2 PRIVATE opencdb2api) + comdb2_bin_target(comdb2) else() target_link_libraries(comdb2 PRIVATE cdb2api m ${CMAKE_DL_LIBS}) endif() diff --git a/db/api_history.c b/db/api_history.c index 209a44b13a..730759b2ba 100644 --- a/db/api_history.c +++ b/db/api_history.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include #include diff --git a/db/appsock_handler.c b/db/appsock_handler.c index 08113a65ea..31a54b6e2b 100644 --- a/db/appsock_handler.c +++ b/db/appsock_handler.c @@ -27,7 +27,7 @@ #include "comdb2.h" #include "comdb2_plugin.h" #include "comdb2_appsock.h" -#include "plhash.h" +#include #include "comdb2_atomic.h" #include "perf.h" diff --git a/db/comdb2.c b/db/comdb2.c index e44f9d2734..b57886eeca 100644 --- a/db/comdb2.c +++ b/db/comdb2.c @@ -86,7 +86,7 @@ void berk_memp_sync_alarm_ms(int); #include "tag.h" #include "types.h" #include "timer.h" -#include +#include #include "verify.h" #include "ssl_bend.h" #include "switches.h" diff --git a/db/disttxn.c b/db/disttxn.c index 46cca2f9a1..caeb47a7d4 100644 --- a/db/disttxn.c +++ b/db/disttxn.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/db/eventlog.c b/db/eventlog.c index 738743b2a1..80f5783a35 100644 --- a/db/eventlog.c +++ b/db/eventlog.c @@ -34,7 +34,7 @@ #include "eventlog.h" #include "util.h" #include "tohex.h" -#include "plhash.h" +#include #include "logmsg.h" #include "thread_stats.h" #include "dbinc/locker_info.h" diff --git a/db/fdb_access.c b/db/fdb_access.c index 1ecd572d03..63f32e3c4d 100644 --- a/db/fdb_access.c +++ b/db/fdb_access.c @@ -19,7 +19,7 @@ * */ -#include "plhash.h" +#include #include "list.h" #include "comdb2.h" diff --git a/db/fdb_bend.c b/db/fdb_bend.c index c9062e5090..3379d4a702 100644 --- a/db/fdb_bend.c +++ b/db/fdb_bend.c @@ -50,7 +50,7 @@ #include #include -#include +#include #include "debug_switches.h" #include "util.h" diff --git a/db/lrucache.c b/db/lrucache.c index 517f477c46..f8b04762ca 100644 --- a/db/lrucache.c +++ b/db/lrucache.c @@ -23,7 +23,7 @@ #include #include "list.h" -#include "plhash.h" +#include #include "lrucache.h" #include diff --git a/db/lrucache.h b/db/lrucache.h index 95cbccdf04..46ad6385e0 100644 --- a/db/lrucache.h +++ b/db/lrucache.h @@ -17,7 +17,7 @@ #ifndef INCLUDED_LRUCACHE_H #define INCLUDED_LRUCACHE_H -#include "plhash.h" +#include #include "list.h" struct lrucache { diff --git a/db/machcache.c b/db/machcache.c index 3e6cfdba76..ba6fe9b51f 100644 --- a/db/machcache.c +++ b/db/machcache.c @@ -15,7 +15,7 @@ */ #include -#include +#include #include #include #include diff --git a/db/memdebug.c b/db/memdebug.c index 00ee38df8b..f9f6bc83ca 100644 --- a/db/memdebug.c +++ b/db/memdebug.c @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include #include diff --git a/db/osqlblkseq.c b/db/osqlblkseq.c index 6d9a7acfbc..8f52f78138 100644 --- a/db/osqlblkseq.c +++ b/db/osqlblkseq.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include "comdb2.h" #include "osqlblkseq.h" diff --git a/db/osqlblockproc.c b/db/osqlblockproc.c index 41dfa99581..24a9b394a5 100644 --- a/db/osqlblockproc.c +++ b/db/osqlblockproc.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/db/osqlcheckboard.c b/db/osqlcheckboard.c index 80f3cb8285..716cbc0833 100644 --- a/db/osqlcheckboard.c +++ b/db/osqlcheckboard.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include "comdb2.h" #include "osqlcheckboard.h" diff --git a/db/osqlshadtbl.c b/db/osqlshadtbl.c index cb31f3e83f..f398c7b35e 100644 --- a/db/osqlshadtbl.c +++ b/db/osqlshadtbl.c @@ -23,7 +23,7 @@ #include "bdb_osqlcur.h" #include #include -#include +#include #include #include diff --git a/db/printlog.c b/db/printlog.c index 496b6b558b..417e822ff1 100644 --- a/db/printlog.c +++ b/db/printlog.c @@ -41,7 +41,7 @@ #include "bdb_int.h" -#include "plhash.h" +#include #include "endian_core.h" #include "comdb2.h" diff --git a/db/repl_wait.c b/db/repl_wait.c index c5110f8669..b1eef875bd 100644 --- a/db/repl_wait.c +++ b/db/repl_wait.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include "lockmacros.h" #include "repl_wait.h" diff --git a/db/reqlog.c b/db/reqlog.c index b4ba5766f2..d3d379f556 100644 --- a/db/reqlog.c +++ b/db/reqlog.c @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include diff --git a/db/sltdbt.c b/db/sltdbt.c index 73ad998b68..9e275b8896 100644 --- a/db/sltdbt.c +++ b/db/sltdbt.c @@ -34,7 +34,7 @@ #include "osqlblkseq.h" #include "logmsg.h" #include "reqlog.h" -#include "plhash.h" +#include #include "comdb2_plugin.h" #include "comdb2_opcode.h" #include "sc_util.h" diff --git a/db/socket_interfaces.c b/db/socket_interfaces.c index 6035fb4754..d6ff04eaff 100644 --- a/db/socket_interfaces.c +++ b/db/socket_interfaces.c @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/db/socket_interfaces.h b/db/socket_interfaces.h index f0e9161842..69ea826d09 100644 --- a/db/socket_interfaces.h +++ b/db/socket_interfaces.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/db/sql_stmt_cache.h b/db/sql_stmt_cache.h index 2c15be87cd..309fdc66cd 100644 --- a/db/sql_stmt_cache.h +++ b/db/sql_stmt_cache.h @@ -22,7 +22,7 @@ */ #include -#include +#include #define MAX_HASH_SQL_LENGTH 8192 #define HINT_LEN 127 diff --git a/db/sqlglue.c b/db/sqlglue.c index 539a916bd6..6ec8fd230c 100644 --- a/db/sqlglue.c +++ b/db/sqlglue.c @@ -51,7 +51,7 @@ #include -#include +#include #include #include #include diff --git a/db/sqlinterfaces.c b/db/sqlinterfaces.c index d5bf135ea2..a80d46af38 100644 --- a/db/sqlinterfaces.c +++ b/db/sqlinterfaces.c @@ -38,7 +38,7 @@ #include -#include +#include #include #include diff --git a/db/sqlinterfaces.h b/db/sqlinterfaces.h index aea28d2221..5b2445846c 100644 --- a/db/sqlinterfaces.h +++ b/db/sqlinterfaces.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include diff --git a/db/sqloffload.c b/db/sqloffload.c index b310c2f9f3..f54b3ce35d 100644 --- a/db/sqloffload.c +++ b/db/sqloffload.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include #include diff --git a/db/tag.c b/db/tag.c index efec440c71..3c8f5adc12 100644 --- a/db/tag.c +++ b/db/tag.c @@ -42,7 +42,7 @@ #include #include "util.h" #include "tohex.h" -#include +#include #include "tag.h" #include "types.h" #include "comdb2.h" diff --git a/db/toblob.c b/db/toblob.c index d4c1da36c7..e39ea84f4d 100644 --- a/db/toblob.c +++ b/db/toblob.c @@ -49,7 +49,7 @@ #include #include -#include +#include #include #include diff --git a/db/toblock.c b/db/toblock.c index 13ebd25907..a7b82fa627 100644 --- a/db/toblock.c +++ b/db/toblock.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/db/trans.c b/db/trans.c index 95e6330bd2..e8400d17d7 100644 --- a/db/trans.c +++ b/db/trans.c @@ -27,7 +27,7 @@ #include "comdb2.h" #include "comdb2_trn_intrl.h" #include "timer.h" -#include +#include static int check_trn_purge(void *trnarg, void *purgebuf) { diff --git a/lua/CMakeLists.txt b/lua/CMakeLists.txt index f30e00de89..c8ef9ff88e 100644 --- a/lua/CMakeLists.txt +++ b/lua/CMakeLists.txt @@ -119,7 +119,6 @@ if(WITH_RDKAFKA) endif() ) if (COMDB2_BBCMAKE) - target_link_libraries(lua PUBLIC protobuf-c openssl) - comdb2_bb_target(lua) + comdb2_lib_target(lua) endif() add_dependencies(lua mem proto sqlite) diff --git a/mem/CMakeLists.txt b/mem/CMakeLists.txt index af9186a2aa..beee238539 100644 --- a/mem/CMakeLists.txt +++ b/mem/CMakeLists.txt @@ -5,3 +5,4 @@ include_directories( ${PROJECT_SOURCE_DIR}/bbinc ${PROJECT_SOURCE_DIR}/dlmalloc ) +target_link_libraries(mem dlmalloc) diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt index 7b5e429a1f..ecb2dafd89 100644 --- a/net/CMakeLists.txt +++ b/net/CMakeLists.txt @@ -43,6 +43,5 @@ include_directories( add_dependencies(net mem proto) if (COMDB2_BBCMAKE) - include_directories(${LIBEVENT_INCLUDE_DIRS}) - comdb2_bb_target(net) + comdb2_lib_target(net) endif() diff --git a/net/net_evbuffer.c b/net/net_evbuffer.c index 2215599eb0..aa29895f7c 100644 --- a/net/net_evbuffer.c +++ b/net/net_evbuffer.c @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/plugins/dbqueuedb/CMakeLists.txt b/plugins/dbqueuedb/CMakeLists.txt index f80c7a405a..70ad6a46c3 100644 --- a/plugins/dbqueuedb/CMakeLists.txt +++ b/plugins/dbqueuedb/CMakeLists.txt @@ -31,5 +31,5 @@ INCLUDE_DIRECTORIES( add_plugin(dbqueuedb STATIC dbqueuedb.c) add_dependencies(dbqueuedb sqlite) # Wait for parse.h if (COMDB2_BBCMAKE) - comdb2_bb_target(dbqueuedb) + comdb2_lib_target(dbqueuedb) endif() diff --git a/plugins/logdelete/CMakeLists.txt b/plugins/logdelete/CMakeLists.txt index 460207faf4..3b2c37da1a 100644 --- a/plugins/logdelete/CMakeLists.txt +++ b/plugins/logdelete/CMakeLists.txt @@ -28,7 +28,7 @@ include_directories( add_plugin(logdelete STATIC logdelete.c) if (COMDB2_BBCMAKE) - comdb2_bb_target(logdelete) + comdb2_lib_target(logdelete) endif() add_dependencies(logdelete proto) diff --git a/plugins/newsql/CMakeLists.txt b/plugins/newsql/CMakeLists.txt index f3498a6cd5..0a5c3f3ebd 100644 --- a/plugins/newsql/CMakeLists.txt +++ b/plugins/newsql/CMakeLists.txt @@ -34,7 +34,7 @@ include_directories( set(NEWSQL_SRCS newsql.c newsql_evbuffer.c) add_plugin(newsql STATIC "${NEWSQL_SRCS}") add_dependencies(newsql sqlite) # Wait for parse.h +target_link_libraries(newsql PUBLIC net) if (COMDB2_BBCMAKE) - target_link_libraries(newsql PUBLIC protobuf-c) - comdb2_bb_target(newsql) + comdb2_lib_target(newsql) endif() diff --git a/plugins/remsql/CMakeLists.txt b/plugins/remsql/CMakeLists.txt index 4a6f0674d6..96206338b2 100644 --- a/plugins/remsql/CMakeLists.txt +++ b/plugins/remsql/CMakeLists.txt @@ -36,6 +36,5 @@ set(SOURCES remsql.c fdb_comm.c) add_plugin(remsql STATIC "${SOURCES}") add_dependencies(remsql sqlite) # Wait for parse.h if (COMDB2_BBCMAKE) - target_link_libraries(remsql PUBLIC protobuf-c) - comdb2_bb_target(remsql) + comdb2_lib_target(remsql) endif() diff --git a/plugins/repopnewlrl/CMakeLists.txt b/plugins/repopnewlrl/CMakeLists.txt index af6dc17343..d15081e910 100644 --- a/plugins/repopnewlrl/CMakeLists.txt +++ b/plugins/repopnewlrl/CMakeLists.txt @@ -27,7 +27,7 @@ include_directories( add_plugin(repopnewlrl STATIC repopnewlrl.c) if (COMDB2_BBCMAKE) - comdb2_bb_target(repopnewlrl) + comdb2_lib_target(repopnewlrl) endif() add_dependencies(repopnewlrl proto) diff --git a/plugins/reversesql/CMakeLists.txt b/plugins/reversesql/CMakeLists.txt index 6b209f76db..5b0888a2db 100644 --- a/plugins/reversesql/CMakeLists.txt +++ b/plugins/reversesql/CMakeLists.txt @@ -38,5 +38,5 @@ set(REVERSESQL_SRCS reversesql.c) add_plugin(reversesql STATIC "${REVERSESQL_SRCS}") add_dependencies(reversesql mem bdb) if (COMDB2_BBCMAKE) - comdb2_bb_target(reversesql) + comdb2_lib_target(reversesql) endif() diff --git a/plugins/sockbplog/CMakeLists.txt b/plugins/sockbplog/CMakeLists.txt index 4ffff5816e..176ca3f7f1 100644 --- a/plugins/sockbplog/CMakeLists.txt +++ b/plugins/sockbplog/CMakeLists.txt @@ -36,6 +36,5 @@ set(SOURCES sockbplog.c) add_plugin(sockbplog STATIC "${SOURCES}") add_dependencies(sockbplog sqlite) # Wait for parse.h if (COMDB2_BBCMAKE) - target_link_libraries(sockbplog PUBLIC protobuf-c) - comdb2_bb_target(sockbplog) + comdb2_lib_target(sockbplog) endif() diff --git a/schemachange/CMakeLists.txt b/schemachange/CMakeLists.txt index 9c458e1711..301b519dd9 100644 --- a/schemachange/CMakeLists.txt +++ b/schemachange/CMakeLists.txt @@ -59,6 +59,7 @@ include_directories( ${OPENSSL_INCLUDE_DIR} ) add_dependencies(schemachange mem proto bdb) +target_link_libraries(schemachange PUBLIC bdb) if (COMDB2_BBCMAKE) - comdb2_bb_target(schemachange) + comdb2_lib_target(schemachange) endif() diff --git a/schemachange/sc_global.c b/schemachange/sc_global.c index 2e0640a3ae..cd7303846e 100644 --- a/schemachange/sc_global.c +++ b/schemachange/sc_global.c @@ -25,7 +25,7 @@ #include "comdb2_atomic.h" #include -#include +#include pthread_mutex_t schema_change_in_progress_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t fastinit_in_progress_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/sockpool/CMakeLists.txt b/sockpool/CMakeLists.txt index c1b33540e1..2d655e0482 100644 --- a/sockpool/CMakeLists.txt +++ b/sockpool/CMakeLists.txt @@ -7,5 +7,5 @@ include_directories( ) if (COMDB2_BBCMAKE) - comdb2_bb_target(sockpool) + comdb2_lib_target(sockpool) endif() diff --git a/sockpool/sockpool.c b/sockpool/sockpool.c index 5d0af446a0..65c043386d 100644 --- a/sockpool/sockpool.c +++ b/sockpool/sockpool.c @@ -44,7 +44,7 @@ #include #include -#include +#include #include #include #include diff --git a/sqlite/CMakeLists.txt b/sqlite/CMakeLists.txt index dd9623a467..ff1f11c379 100644 --- a/sqlite/CMakeLists.txt +++ b/sqlite/CMakeLists.txt @@ -241,11 +241,9 @@ include_directories( ${OPENSSL_INCLUDE_DIR} ${PROTOBUF-C_INCLUDE_DIR} ) -add_dependencies(sqlite mem proto bdb) +add_dependencies(sqlite mem proto bdb) +target_link_libraries(sqlite PRIVATE cdb2archive) if (COMDB2_BBCMAKE) - target_link_libraries(sqlite PRIVATE cdb2archive protobuf-c uuid) - configure_bb_target(sqlite V2 NO_BUILDID NO_PLINKSTRINGS HEADER_DIRS) -else() - target_link_libraries(sqlite PRIVATE cdb2archive) + comdb2_lib_target(sqlite) endif() diff --git a/sqlite/ext/comdb2/appsock_handlers.c b/sqlite/ext/comdb2/appsock_handlers.c index 46b1dafadc..8aa21729aa 100644 --- a/sqlite/ext/comdb2/appsock_handlers.c +++ b/sqlite/ext/comdb2/appsock_handlers.c @@ -31,7 +31,7 @@ typedef struct sbuf2 SBUF2; #include "comdb2systbl.h" #include "comdb2systblInt.h" #include "comdb2_appsock.h" -#include "plhash.h" +#include extern hash_t *gbl_appsock_hash; diff --git a/sqlite/ext/comdb2/fingerprints.c b/sqlite/ext/comdb2/fingerprints.c index 5839adb004..989ee8f599 100644 --- a/sqlite/ext/comdb2/fingerprints.c +++ b/sqlite/ext/comdb2/fingerprints.c @@ -20,7 +20,7 @@ #include #include #include "sql.h" -#include "plhash.h" +#include #include "tohex.h" struct fingerprint_track_systbl { diff --git a/sqlite/ext/comdb2/opcode_handlers.c b/sqlite/ext/comdb2/opcode_handlers.c index e25aa8bbec..9fabc9fd24 100644 --- a/sqlite/ext/comdb2/opcode_handlers.c +++ b/sqlite/ext/comdb2/opcode_handlers.c @@ -32,7 +32,7 @@ struct ireq; #include "comdb2systbl.h" #include "comdb2systblInt.h" #include "comdb2_opcode.h" -#include "plhash.h" +#include extern hash_t *gbl_opcode_hash; diff --git a/sqlite/ext/comdb2/permissions.c b/sqlite/ext/comdb2/permissions.c index 1e6d10b371..735183f1b1 100644 --- a/sqlite/ext/comdb2/permissions.c +++ b/sqlite/ext/comdb2/permissions.c @@ -24,7 +24,7 @@ #include #include #include "sql.h" -#include "plhash.h" +#include #include "timepart_systable.h" #include "sqliteInt.h" diff --git a/sqlite/ext/comdb2/query_plans.c b/sqlite/ext/comdb2/query_plans.c index e6356eaeb7..f816d53f72 100644 --- a/sqlite/ext/comdb2/query_plans.c +++ b/sqlite/ext/comdb2/query_plans.c @@ -21,7 +21,7 @@ #include "ezsystables.h" #include "sql.h" #include "string_ref.h" -#include "plhash.h" +#include #include "tohex.h" extern hash_t *gbl_fingerprint_hash; diff --git a/sqlite/ext/comdb2/sample_queries.c b/sqlite/ext/comdb2/sample_queries.c index ac575f6555..fadead587a 100644 --- a/sqlite/ext/comdb2/sample_queries.c +++ b/sqlite/ext/comdb2/sample_queries.c @@ -21,7 +21,7 @@ #include "ezsystables.h" #include "sql.h" #include "string_ref.h" -#include "plhash.h" +#include #include "tohex.h" extern hash_t *gbl_sample_queries_hash; diff --git a/sqlite/ext/comdb2/trancommit.c b/sqlite/ext/comdb2/trancommit.c index 98c8a6566e..4ea3f74893 100644 --- a/sqlite/ext/comdb2/trancommit.c +++ b/sqlite/ext/comdb2/trancommit.c @@ -16,7 +16,7 @@ #include #include -#include +#include #include #include "comdb2.h" diff --git a/sqlite/ext/comdb2/views.c b/sqlite/ext/comdb2/views.c index 0e5f608088..326dd684ca 100644 --- a/sqlite/ext/comdb2/views.c +++ b/sqlite/ext/comdb2/views.c @@ -24,7 +24,7 @@ #include #include #include "sql.h" -#include "plhash.h" +#include sqlite3_module systblViewsModule = { .access_flag = CDB2_ALLOW_USER, diff --git a/tools/cdb2_printlog/comdb2_dbprintlog.c b/tools/cdb2_printlog/comdb2_dbprintlog.c index 389556a1ea..90c20692f9 100644 --- a/tools/cdb2_printlog/comdb2_dbprintlog.c +++ b/tools/cdb2_printlog/comdb2_dbprintlog.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/cdb2sockpool/cdb2sockpool.c b/tools/cdb2sockpool/cdb2sockpool.c index e91510f33f..c2e9691c6e 100644 --- a/tools/cdb2sockpool/cdb2sockpool.c +++ b/tools/cdb2sockpool/cdb2sockpool.c @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include "cdb2sockpool.h" diff --git a/tools/cdb2sockpool/cdb2sockpool.h b/tools/cdb2sockpool/cdb2sockpool.h index 29ac9e1205..d5aedf1249 100644 --- a/tools/cdb2sockpool/cdb2sockpool.h +++ b/tools/cdb2sockpool/cdb2sockpool.h @@ -20,7 +20,7 @@ #ifndef INC__SQLPROXY_H #define INC__SQLPROXY_H -#include +#include #include #define BOOL_SETTING(var, dfl, descr) SETTING_MACRO(var, dfl, descr, BOOL) diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 52a5897c9c..e89811b0e2 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -92,9 +92,5 @@ include_directories( ) add_dependencies(util mem) if (COMDB2_BBCMAKE) - if(${CMAKE_SYSTEM_NAME} STREQUAL Linux) - target_link_libraries(util PUBLIC libunwind) - endif() - target_link_libraries(util PUBLIC openssl) - configure_bb_target(util V2 NO_BUILDID NO_PLINKSTRINGS HEADER_DIRS) + comdb2_lib_target(util) endif() diff --git a/util/comdb2file.c b/util/comdb2file.c index e47602a604..be4545ae74 100644 --- a/util/comdb2file.c +++ b/util/comdb2file.c @@ -22,7 +22,7 @@ #include "str_util.h" /* QUOTE */ #include "util.h" -#include "plhash.h" +#include #include "mem_util.h" #include "mem_override.h" diff --git a/util/hostname_support.c b/util/hostname_support.c index eab28b2213..2e426c15fb 100644 --- a/util/hostname_support.c +++ b/util/hostname_support.c @@ -39,7 +39,7 @@ static int get_hostname_by_addr(struct sockaddr_in *addr, char *host, socklen_t #include #include #include -#include +#include static hash_t *hs; static pthread_mutex_t lk = PTHREAD_MUTEX_INITIALIZER; diff --git a/util/intern_strings.c b/util/intern_strings.c index 1fe0d3fea0..e735a68655 100644 --- a/util/intern_strings.c +++ b/util/intern_strings.c @@ -19,7 +19,7 @@ #include #include -#include "plhash.h" +#include #include "intern_strings.h" #include "mem_util.h" diff --git a/util/object_pool.c b/util/object_pool.c index 1e582ca9e5..8b1d4528ea 100644 --- a/util/object_pool.c +++ b/util/object_pool.c @@ -25,7 +25,7 @@ #include #include -#include "plhash.h" +#include #include "object_pool.h" #include "logmsg.h" #include "sys_wrap.h" diff --git a/util/portmuxusr.c b/util/portmuxusr.c index 3d31879a03..7cbf1239f6 100644 --- a/util/portmuxusr.c +++ b/util/portmuxusr.c @@ -1864,446 +1864,3 @@ void portmux_register_reconnect_callback(int (*callback)(void *), void *arg) reconnect_callback = callback; reconnect_callback_arg = arg; } - -#ifdef PORTMUXUSR_TESTSUITE -/* here's makefile -# MAKEFILE FOR portmuxusr_test.tsk generated by pcomp - -TASK=portmuxusr_test.tsk -IS_CMAIN=true -IS_PTHREAD=true -IS_GCC_WARNINGS_CLEAN=yes - -USER_CFLAGS+=-I. -DPORTMUXUSR_TESTSUITE -DDEBUG -OBJS= portmuxusr.o -LIBS=-ldbutil -lbbipc -lsysutil - -MKINCL?=/bbsrc/mkincludes/ -include ${MKINCL}machdep.newlink -include ${MKINCL}linktask.newlink - - */ -#include -static pthread_attr_t attr; -static char host[128] = "localhost"; - -static void client_thr(int fd) -{ - SBUF2 *sb; - char line[128]; - - struct sockaddr_in client_addr; - socklen_t len = sizeof(client_addr); - if (getpeername(fd, (struct sockaddr *)&client_addr, &len) == 0) { - unsigned char *cptr = (unsigned char *)&(client_addr.sin_addr.s_addr); - printf("server: accepted connection on fd# %d from %u.%u.%u.%u\n", fd, - cptr[0], cptr[1], cptr[2], cptr[3]); - } else { - printf("server: accepted connection on fd# %d (No client address " - "available)\n", - fd); - } - - sb = sbuf2open(fd, 0); - if (sb == NULL) { - fprintf(stderr, "sbuf2open: errno=[%d] %s\n", errno, strerror(errno)); - close(fd); - return; - } - - while (sbuf2gets(line, sizeof(line), sb) > 0) { - printf("server(fd#%d): %s", fd, line); - - /* I know, first client to say "exit" will shutdown server */ - if (!strncmp(line, "exit", 4)) { - exit(0); - } - } - - sbuf2close(sb); -} - -void server_accept_hndl(int fd, void *userdata) -{ - pthread_t tid; - int rc; - - // ok, spawn a client thread and go wait for somebody else - rc = pthread_create(&tid, &attr, (void *(*)(void *))client_thr, (void *)fd); - if (rc) { - fprintf(stderr, "accept_hndl:pthread_create(): errno=[%d] %s\n", rc, - strerror(rc)); - close(fd); // close fd - } -} - -static void server(char *server_name, int pure_one_port_mode) -{ - Pthread_attr_init(&attr); - Pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - char *app = server_name; - char *service = server_name; - char *instance = server_name; - char *idstr = NULL; - - if (strchr(server_name, '/') != NULL) { - idstr = strdup(server_name); - app = idstr; - char *pos = strchr(app, '/'); - *pos++ = '\0'; - service = pos; - if ((pos = strchr(service, '/')) != NULL) { - *pos++ = '\0'; - instance = pos; - } - } - - uint32_t options = pure_one_port_mode ? PORTMUX_PORT_SUPPRESS : 0; - printf("I am %s, ready to accept connections to %s/%s/%s\n", __func__, app, - service, instance); - - portmux_listen_options(app, service, instance, server_accept_hndl, NULL, - options); - fprintf(stderr, "portmux_listen: errno=[%d] %s\n", errno, strerror(errno)); - - exit(1); -} - -static void server_no_callback(char *server_name, int pure_one_port_mode) -{ - Pthread_attr_init(&attr); - Pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - char *app = server_name; - char *service = server_name; - char *instance = server_name; - char *idstr = NULL; - - if (strchr(server_name, '/') != NULL) { - idstr = strdup(server_name); - app = idstr; - char *pos = strchr(app, '/'); - *pos++ = '\0'; - service = pos; - if ((pos = strchr(service, '/')) != NULL) { - *pos++ = '\0'; - instance = pos; - } - } - - uint32_t options = pure_one_port_mode ? PORTMUX_PORT_SUPPRESS : 0; - - portmux_fd_t *pmux_hndl; - - pmux_hndl = portmux_listen_options_setup(app, service, instance, options); - if (pmux_hndl == NULL) { - fprintf(stderr, "portmux_listen_setup: errno=[%d] %s\n", errno, - strerror(errno)); - } else { - printf("I am %s, ready to accept connections to %s/%s/%s\n", __func__, - app, service, instance); - - while (true) { - int clientfd = portmux_accept(pmux_hndl, 0, NULL); - if (clientfd < 0) { - fprintf(stderr, "error in portmux_accept\n"); - break; - } - server_accept_hndl(clientfd, NULL); - } - portmux_close(pmux_hndl); - } - exit(1); -} - -static void client(char *server_name) -{ - int fd; - char line[128]; - int len; - int rc; - - char *app = server_name; - char *service = server_name; - char *instance = server_name; - char *idstr = NULL; - - if (strchr(server_name, '/') != NULL) { - idstr = strdup(server_name); - app = idstr; - char *pos = strchr(app, '/'); - *pos++ = '\0'; - service = pos; - if ((pos = strchr(service, '/')) != NULL) { - *pos++ = '\0'; - instance = pos; - } - } - - printf("Connecting to '%s:%s/%s/%s'\n", host, app, service, instance); - - fd = portmux_connect(host, app, service, instance); - - if (fd < 0) { - fprintf(stderr, "portmux_connect: errno=[%d] %s\n", errno, - strerror(errno)); - exit(1); - } - - printf("I am %s, ready to send.\n", __func__); - if (idstr != NULL) { - free(idstr); - } - while (fgets(line, sizeof(line), stdin)) { - printf("client: %s", line); - len = strlen(line); - rc = tcpwritemsg(fd, line, len, 0); - if (rc != len) { - fprintf(stderr, "tcpwritemsg: errno=[%d] %s\n", errno, - strerror(errno)); - exit(1); - } - - if (!strncmp(line, "exit", 4)) { - exit(0); - } - } - - close(fd); -} - -static void alt_client(char *server_name) -{ - int fd; - char line[128]; - int len; - int rc; - - char *app = server_name; - char *service = server_name; - char *instance = server_name; - char *idstr = NULL; - - if (strchr(server_name, '/') != NULL) { - idstr = strdup(server_name); - app = idstr; - char *pos = strchr(app, '/'); - *pos++ = '\0'; - service = pos; - if ((pos = strchr(service, '/')) != NULL) { - *pos++ = '\0'; - instance = pos; - } - } - printf("Connecting to '%s:%s/%s/%s'\n", host, app, service, instance); - - int port = portmux_get(host, app, service, instance); - if (port <= 0) { - fprintf(stderr, "portmux_get: errno=[%d] %s\n", errno, strerror(errno)); - exit(1); - } - - fd = tcpconnecth(host, port, 0); - if (fd < 0) { - fprintf(stderr, "tcpconnecth: errno=[%d] %s\n", errno, strerror(errno)); - exit(1); - } - - portmux_denagle(fd); - if (idstr != NULL) { - free(idstr); - } - - printf("I am %s, ready to send.\n", __func__); - while (fgets(line, sizeof(line), stdin)) { - printf("client: %s", line); - len = strlen(line); - rc = tcpwritemsg(fd, line, len, 0); - if (rc != len) { - fprintf(stderr, "tcpwritemsg: errno=[%d] %s\n", errno, - strerror(errno)); - exit(1); - } - - if (!strncmp(line, "exit", 4)) { - exit(0); - } - } - - close(fd); -} - -#define V_SIZE 10 -static portmux_fd_t *portmux_hndl[V_SIZE]; - -int server_accept_hndl_v(int which, int fd, void *userdata) -{ - pthread_t tid; - int rc; - - portmux_fd_t *fds = portmux_hndl[which]; - printf("I have accepted a connection on fd %d for portmux_hndl %d " - "(%s/%s/%s)\n", - fd, which, fds->app, fds->service, fds->instance); - // ok, spawn a client thread and go wait for somebody else - rc = pthread_create(&tid, &attr, (void *(*)(void *))client_thr, (void *)fd); - if (rc) { - fprintf(stderr, "accept_hndl:pthread_create(): errno=[%d] %s\n", rc, - strerror(rc)); - close(fd); // close fd - } - return 0; -} - -static void server_v(char *server_name, int timeoutms, int pure_one_port_mode) -{ - Pthread_attr_init(&attr); - Pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - uint32_t options; - - options = pure_one_port_mode ? PORTMUX_PORT_SUPPRESS : 0; - for (int ii = 0; ii < V_SIZE; ++ii) { - char instance[8]; - - snprintf(instance, sizeof(instance), "%d", ii); - portmux_hndl[ii] = portmux_listen_options_setup( - server_name, server_name, instance, options); - if (portmux_hndl[ii] == NULL) { - fprintf(stderr, "portmux_listen_options_setup returned NULL\n"); - exit(1); - } - } - - printf("I am %s, ready to accept for:\n", __func__); - for (int ii = 0; ii < V_SIZE; ++ii) { - printf("%s/%s/%s ", portmux_hndl[ii]->app, portmux_hndl[ii]->service, - portmux_hndl[ii]->instance); - if ((options & PORTMUX_PORT_SUPPRESS) == 0) { - printf("on TCP port %d\n", portmux_hndl[ii]->port); - } else { - printf("(no TCP port requested)\n"); - } - } - - if (timeoutms <= 0) { - timeoutms = -1; - } - - int result; - while ((result = portmux_acceptv(portmux_hndl, V_SIZE, timeoutms, - server_accept_hndl_v, NULL, NULL)) >= 0) { - if (result == 0 && errno == ETIMEDOUT) { - printf("portmux_acceptv timeout. Continuing\n"); - } else { - printf("portmux_acceptv returned %d. Continuing.\n", result); - } - } - fprintf(stderr, "portmux_listen: errno=[%d] %s\n", errno, strerror(errno)); - - exit(1); -} - -static const char *usage_text[] = { - "Usage: -[bh] -[sum] [-a r] ", "-h: help", - "-s: specify server mode.", "-u: don't request a TCP port number, use 1 " - "port mode for communication. (server only)", - "-m: listen on multiple instances. (server only)", - "-a: use deprecated API calls.", - "-r: specify to connect to. (client only)", "-t: specify timeoutms", - "\nTo use a specific app/service/instance give this as .", NULL}; - -static void usage(FILE *fh) -{ - int ii; - for (ii = 0; usage_text[ii]; ii++) { - fprintf(fh, "%s\n", usage_text[ii]); - } -} - -int main(int argc, char *argv[]) -{ - extern char *optarg; - extern int optind, optopt; - int server_mode = 0; - int alt_mode = 0; - int multi_mode = 0; - int pure_one_port_mode = 0; - int timeoutms = portmux_default_timeout; - - int c; - - while ((c = getopt(argc, argv, "ahsr:umt:")) != EOF) { - switch (c) { - case 'a': - alt_mode = 1; - break; - - case 'h': - usage(stdout); - exit(0); - break; - - case 'r': - if (strlen(optarg) >= sizeof(host)) { - fprintf(stderr, "Hostname too long: %s\n", optarg); - exit(2); - } - strnpy(host, optarg, sizeof(host)); - break; - - case 's': - server_mode = 1; - break; - - case 'u': - pure_one_port_mode = 1; - break; - - case 'm': - multi_mode = 1; - break; - - case 't': - timeoutms = atoi(optarg); - break; - - case '?': - fprintf(stderr, "Unrecognised option: -%c\n", optopt); - usage(stderr); - exit(2); - } - } - - argc -= optind; - argv += optind; - - if (argc < 1) { - usage(stdout); - exit(0); - } - - if (set_portmux_bind_path(NULL)) { - exit(1); - } - - if (server_mode) { - if (multi_mode) { - server_v(argv[0], timeoutms, pure_one_port_mode); - } else if (alt_mode) { - server_no_callback(argv[0], pure_one_port_mode); - } else { - server(argv[0], pure_one_port_mode); - } - } else { - printf("will try to connect to portmux@%s\n", host); - if (alt_mode) { - alt_client(argv[0]); - } else { - client(argv[0]); - } - } - return 0; -} - -#endif diff --git a/util/quantize.c b/util/quantize.c index 447ef380e8..e7f6f06fb8 100644 --- a/util/quantize.c +++ b/util/quantize.c @@ -203,7 +203,7 @@ int quantize_dump(struct quantize *q, FILE *ff) return 0; } -#include +#include struct qobj { int numvals; diff --git a/util/rtcpu.c b/util/rtcpu.c index acb33d3564..0ce32ca96e 100644 --- a/util/rtcpu.c +++ b/util/rtcpu.c @@ -34,7 +34,7 @@ #include "machclass.h" #include "logmsg.h" #include "sys_wrap.h" -#include +#include static int machine_is_up_default(const char *host, int *isdrtest); static int machine_status_init(void); diff --git a/util/sltpck.c b/util/sltpck.c index 69e95fba33..eaf5544f58 100644 --- a/util/sltpck.c +++ b/util/sltpck.c @@ -473,161 +473,3 @@ static void hdr_from_cpu(struct slt_hdr_t *hdr) hdr->sz = htons(hdr->sz); hdr->off = htons(hdr->off); } - -#ifdef SLTPCK_TESTSUITE -/* -# MAKEFILE FOR sltpck.tsk generated by pcomp -include /bb/bin/machdep.newlink - -USER_CFLAGS=-I. -DSLTPCK_TESTSUITE - -TASK=sltpck.tsk -OBJDIR= -OBJS= sltpck.o -LIBS=-ldbutil -lpeutil -lbbipc -lsysutil -IS_CMAIN=true -#IS_64BIT=yes - -include /bb/bin/linktask.newlink -*/ - -enum TAIL_SLOTS { - EMPTY = 0, - SLOT1 = 1, - SLOT2 = 2, - SLOT3 = 4, - SLOT4 = 8, - SLOT5 = 16 -}; - -struct slot5 { - char s[16]; - double d; - int i; -}; - -extern void fsnapf(FILE *fil, char *buf, int len); - -static size_t pckdrv(char *buffer, size_t bufsz, slt_dir_t dir); -static void unpckdrv(char *buffer, size_t bufsz, slt_dir_t dir); -static void errpck(int flag, int rc); - -int main(int ac, char **av) -{ - enum { BUFSZ = 1024, OFFSZ = 60 }; - char buffer[BUFSZ] = {0}; - char *off = buffer + OFFSZ; - size_t payload = OFFSZ; - - /* pack and check SLTPCK_FORWARD */ - payload += pckdrv(off, BUFSZ - OFFSZ, SLTPCK_FORWARD); - fsnapf(stdout, buffer, payload); - unpckdrv(buffer + OFFSZ, payload, SLTPCK_FORWARD); - - /* reset */ - memset(buffer, 0, sizeof(buffer)); - payload = OFFSZ; - - /* pack and check SLTPCK_BACKWARD */ - payload += pckdrv(off, BUFSZ - OFFSZ, SLTPCK_BACKWARD); - fsnapf(stdout, buffer, payload); - unpckdrv(buffer, payload, SLTPCK_BACKWARD); - - exit(0); -} - -static size_t pckdrv(char *buffer, size_t bufsz, slt_dir_t dir) -{ - char slt1[8] = "deadbeef"; - double slt2 = 234.75; - int slt3 = 42; - struct slot5 slt5 = {"deadbabe", 57.432, 24}; - struct slt_cur_t *cur; - int rc = 0; - - /* get a packing cursor */ - cur = slt_init(buffer, bufsz, dir); - if (!cur) { - return 0; - } - - /* pack elements */ - rc = slt_pck(cur, SLOT1, slt1, sizeof(slt1)); - if (rc) { - errpck(SLOT1, rc); - } - rc = slt_pck(cur, SLOT2, &slt2, sizeof(slt2)); - if (rc) { - errpck(SLOT2, rc); - } - rc = slt_pck(cur, SLOT3, &slt3, sizeof(slt3)); - if (rc) { - errpck(SLOT3, rc); - } - printf("expecting error ... "); - rc = slt_pck(cur, SLOT4, NULL, 0); - if (rc) { - errpck(SLOT4, rc); - } else { - printf("????\n"); - } - rc = slt_pck(cur, SLOT5, &slt5, sizeof(slt5)); - if (rc) { - errpck(SLOT5, rc); - } - - /* finalize data and get payload */ - return slt_stamp(cur); -} - -static void unpckdrv(char *buffer, size_t bufsz, slt_dir_t dir) -{ - char *slt; - size_t sltsz; - - printf("filtering SLOT2\n"); - slt_filt(SLOT2, buffer, bufsz, dir); - - slt = slt_unpck(SLOT1, buffer, bufsz, &sltsz, dir); - if (slt && (sltsz > 0)) { - - printf("SLOT1 -> %.*s\n", sltsz, (char *)slt); - } else { - printf("SLOT1 -> NOT FOUND\n"); - } - - slt = slt_unpck(SLOT2, buffer, bufsz, &sltsz, dir); - if (slt && (sltsz > 0)) { - printf("SLOT2 -> %lf\n", *((double *)slt)); - } else { - printf("SLOT2 -> NOT FOUND\n"); - } - - slt = slt_unpck(SLOT3, buffer, bufsz, &sltsz, dir); - if (slt && (sltsz > 0)) { - printf("SLOT3 -> %d\n", *((int *)slt)); - } else { - printf("SLOT3 -> NOT FOUND\n"); - } - - slt = slt_unpck(SLOT4, buffer, bufsz, &sltsz, dir); - if (slt && (sltsz > 0)) { - printf("SLOT4 -> %.*s\n", sltsz, (char *)slt); - } else { - printf("SLOT4 -> NOT FOUND\n"); - } - - slt = slt_unpck(SLOT5, buffer, bufsz, &sltsz, dir); - if (slt && (sltsz > 0)) { - printf("SLOT5 -> ('%s', %lf, %d)\n", ((struct slot5 *)slt)->s, - ((struct slot5 *)slt)->d, ((struct slot5 *)slt)->i); - } else { - printf("SLOT5 -> NOT FOUND\n"); - } -} - -static void errpck(int flag, int rc) -{ - printf("error packing flag #%d -> %d\n", flag, rc); -} -#endif diff --git a/util/stackutil.c b/util/stackutil.c index 9baaa0e640..6b2c800555 100644 --- a/util/stackutil.c +++ b/util/stackutil.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/util/thread_util.c b/util/thread_util.c index 4a2874836b..dff42f638c 100644 --- a/util/thread_util.c +++ b/util/thread_util.c @@ -25,7 +25,7 @@ #include -#include "plhash.h" +#include #include "list.h" #include "mem_util.h" #include "mem_override.h"