From c663d3ebb286acef6770610a552fb458bffd9873 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 5 Sep 2023 15:16:29 +0000 Subject: [PATCH 01/17] Moved InkAPI.cc to src/api;new libtsapicore.a;All targets built in automake --- iocore/net/Makefile.am | 2 +- {src/traffic_server => proxy}/HostStatus.cc | 0 proxy/Makefile.am | 3 ++ proxy/http/HttpSM.cc | 2 +- src/{traffic_server => api}/FetchSM.cc | 0 src/{traffic_server => api}/FetchSM.h | 0 src/{traffic_server => api}/InkAPI.cc | 9 +++++- .../InkContInternal.cc | 0 src/{traffic_server => api}/InkIOCoreAPI.cc | 0 src/api/Makefile.am | 28 +++++++++++++++++-- src/traffic_crashlog/Makefile.inc | 2 +- src/traffic_layout/Makefile.inc | 2 +- src/traffic_logcat/Makefile.inc | 2 +- src/traffic_logstats/Makefile.inc | 2 +- src/traffic_server/Makefile.inc | 7 +---- src/traffic_server/traffic_server.cc | 11 ++------ tools/benchmark/Makefile.am | 2 +- 17 files changed, 47 insertions(+), 25 deletions(-) rename {src/traffic_server => proxy}/HostStatus.cc (100%) rename src/{traffic_server => api}/FetchSM.cc (100%) rename src/{traffic_server => api}/FetchSM.h (100%) rename src/{traffic_server => api}/InkAPI.cc (99%) rename src/{traffic_server => api}/InkContInternal.cc (100%) rename src/{traffic_server => api}/InkIOCoreAPI.cc (100%) diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am index 2cb1c640a99..4ccbc1c6e31 100644 --- a/iocore/net/Makefile.am +++ b/iocore/net/Makefile.am @@ -29,7 +29,7 @@ AM_CPPFLAGS += \ -I$(abs_top_srcdir)/proxy/shared \ -I$(abs_top_srcdir)/proxy/http \ -I$(abs_top_srcdir)/proxy/http/remap \ - -I$(abs_top_srcdir)/src/traffic_server \ + -I$(abs_top_srcdir)/src/api \ $(TS_INCLUDES) \ @OPENSSL_INCLUDES@ \ @YAMLCPP_INCLUDES@ \ diff --git a/src/traffic_server/HostStatus.cc b/proxy/HostStatus.cc similarity index 100% rename from src/traffic_server/HostStatus.cc rename to proxy/HostStatus.cc diff --git a/proxy/Makefile.am b/proxy/Makefile.am index 4e3a16a2690..42132ceebe4 100644 --- a/proxy/Makefile.am +++ b/proxy/Makefile.am @@ -31,6 +31,7 @@ AM_CPPFLAGS += \ $(iocore_include_dirs) \ -I$(abs_top_srcdir)/include \ -I$(abs_top_srcdir)/lib \ + -I$(abs_top_srcdir)/mgmt \ -I$(abs_srcdir)/http \ -I$(abs_srcdir)/http2 \ -I$(abs_srcdir)/http3 \ @@ -52,6 +53,8 @@ libproxy_a_SOURCES = \ ControlBase.h \ ControlMatcher.cc \ ControlMatcher.h \ + HostStatus.cc \ + HostStatus.h \ IPAllow.cc \ IPAllow.h \ ParentConsistentHash.cc \ diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc index 6f4264e0095..de14655bf99 100644 --- a/proxy/http/HttpSM.cc +++ b/proxy/http/HttpSM.cc @@ -86,7 +86,7 @@ extern int cache_config_read_while_writer; -extern HttpBodyFactory *body_factory; +HttpBodyFactory *body_factory = nullptr; // We have a debugging list that can use to find stuck // state machines diff --git a/src/traffic_server/FetchSM.cc b/src/api/FetchSM.cc similarity index 100% rename from src/traffic_server/FetchSM.cc rename to src/api/FetchSM.cc diff --git a/src/traffic_server/FetchSM.h b/src/api/FetchSM.h similarity index 100% rename from src/traffic_server/FetchSM.h rename to src/api/FetchSM.h diff --git a/src/traffic_server/InkAPI.cc b/src/api/InkAPI.cc similarity index 99% rename from src/traffic_server/InkAPI.cc rename to src/api/InkAPI.cc index 987c7af6a9c..e52b3c445df 100644 --- a/src/traffic_server/InkAPI.cc +++ b/src/api/InkAPI.cc @@ -78,6 +78,7 @@ #include "I_Machine.h" #include "HttpProxyServerMain.h" #include "shared/overridable_txn_vars.h" +#include "config/FileManager.h" #include "rpc/jsonrpc/JsonRPC.h" #include @@ -7740,7 +7741,13 @@ tsapi::c::TSMatcherLineValue(TSMatcherLine ml, int element) return (((matcher_line *)ml)->line)[1][element]; } -extern void load_config_file_callback(const char *parent, const char *remap_file); +void load_config_file_callback(const char *parent, const char *remap_file); + +void +load_config_file_callback(const char *parent_file, const char *remap_file) +{ + FileManager::instance().configFileChild(parent_file, remap_file); +} /* Config file name setting */ TSReturnCode diff --git a/src/traffic_server/InkContInternal.cc b/src/api/InkContInternal.cc similarity index 100% rename from src/traffic_server/InkContInternal.cc rename to src/api/InkContInternal.cc diff --git a/src/traffic_server/InkIOCoreAPI.cc b/src/api/InkIOCoreAPI.cc similarity index 100% rename from src/traffic_server/InkIOCoreAPI.cc rename to src/api/InkIOCoreAPI.cc diff --git a/src/api/Makefile.am b/src/api/Makefile.am index 4c1326b6adf..51571ad495a 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -22,21 +22,45 @@ check_PROGRAMS = test_Metrics TESTS = $(check_PROGRAMS) +noinst_LIBRARIES = libtsapicore.a + lib_LTLIBRARIES = libtsapi.la + AM_CPPFLAGS += \ + $(iocore_include_dirs) \ -I$(abs_top_srcdir)/include \ + -I$(abs_top_srcdir)/proxy \ + -I$(abs_top_srcdir)/proxy/hdrs \ + -I$(abs_top_srcdir)/proxy/http \ + -I$(abs_top_srcdir)/proxy/http2 \ + -I$(abs_top_srcdir)/proxy/http/remap \ + -I$(abs_top_srcdir)/proxy/logging \ + -I$(abs_top_srcdir)/src/traffic_server \ + -I$(abs_top_srcdir)/mgmt/rpc \ + -I$(abs_top_srcdir)/mgmt/ \ @SWOC_INCLUDES@ \ + @YAMLCPP_INCLUDES@ \ $(TS_INCLUDES) +# libtsapi.la libtsapi_la_LDFLAGS = @AM_LDFLAGS@ -version-info @TS_LIBTOOL_VERSION@ @SWOC_LDFLAGS@ libtsapi_la_LIBADD = \ @SWOC_LIBS@ - libtsapi_la_SOURCES = \ - Metrics.cc + InkAPI.cc \ + InkContInternal.cc \ + InkIOCoreAPI.cc + +# libtsapicore.a +libtsapicore_a_LIBADD = \ + @SWOC_LIBS@ + +libtsapicore_a_SOURCES = \ + Metrics.cc \ + FetchSM.cc test_Metrics_SOURCES = test_Metrics.cc diff --git a/src/traffic_crashlog/Makefile.inc b/src/traffic_crashlog/Makefile.inc index a2bc75e3d40..983004beba8 100644 --- a/src/traffic_crashlog/Makefile.inc +++ b/src/traffic_crashlog/Makefile.inc @@ -40,5 +40,5 @@ traffic_crashlog_traffic_crashlog_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/src/traffic_layout/Makefile.inc b/src/traffic_layout/Makefile.inc index d4f2637a900..c63b3127424 100644 --- a/src/traffic_layout/Makefile.inc +++ b/src/traffic_layout/Makefile.inc @@ -45,5 +45,5 @@ traffic_layout_traffic_layout_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ @YAMLCPP_LIBS@ @LIBLZMA@ @LIBPCRE@ @LIBCAP@ diff --git a/src/traffic_logcat/Makefile.inc b/src/traffic_logcat/Makefile.inc index 4acc7c1fa35..962ecc7f808 100644 --- a/src/traffic_logcat/Makefile.inc +++ b/src/traffic_logcat/Makefile.inc @@ -46,7 +46,7 @@ traffic_logcat_traffic_logcat_LDADD = \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ \ @YAMLCPP_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBCAP@ \ @LIBPROFILER@ -lm diff --git a/src/traffic_logstats/Makefile.inc b/src/traffic_logstats/Makefile.inc index 0f9014a437f..ee50cbbdb7f 100644 --- a/src/traffic_logstats/Makefile.inc +++ b/src/traffic_logstats/Makefile.inc @@ -50,7 +50,7 @@ traffic_logstats_traffic_logstats_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @OPENSSL_LIBS@ \ @SWOC_LIBS@ \ diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc index 80bda75596e..6e659c494ec 100644 --- a/src/traffic_server/Makefile.inc +++ b/src/traffic_server/Makefile.inc @@ -47,12 +47,6 @@ traffic_server_traffic_server_SOURCES = \ traffic_server/Crash.cc \ traffic_server/EventName.cc \ traffic_server/EventName.h \ - traffic_server/FetchSM.cc \ - traffic_server/FetchSM.h \ - traffic_server/HostStatus.cc \ - traffic_server/InkAPI.cc \ - traffic_server/InkContInternal.cc \ - traffic_server/InkIOCoreAPI.cc \ traffic_server/SocksProxy.cc \ traffic_server/RpcAdminPubHandlers.cc \ traffic_server/RpcAdminPubHandlers.h \ @@ -80,6 +74,7 @@ traffic_server_traffic_server_LDADD = \ $(top_builddir)/lib/fastlz/libfastlz.a \ $(top_builddir)/iocore/aio/libinkaio.a \ $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/libproxy.a \ $(top_builddir)/iocore/net/libinknet.a \ $(top_builddir)/src/records/librecords_p.a \ diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index def44b262f2..3d5e107dc34 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -135,8 +135,7 @@ static char diags_log_filename[PATH_NAME_MAX] = DEFAULT_DIAGS_LOG_FILENAME; static const long MAX_LOGIN = ink_login_name_max(); static void init_ssl_ctx_callback(void *ctx, bool server); -// This isn't static as its also called from InkAPI.cc -void load_config_file_callback(const char *parent_file, const char *remap_file); +extern void load_config_file_callback(const char *parent_file, const char *remap_file); static void load_ssl_file_callback(const char *ssl_file); static void task_threads_started_callback(); @@ -169,7 +168,7 @@ static char error_tags[1024] = ""; static char action_tags[1024] = ""; static int show_statistics = 0; static DiagsConfig *diagsConfig = nullptr; -HttpBodyFactory *body_factory = nullptr; +extern HttpBodyFactory *body_factory; static int accept_mss = 0; static int poll_timeout = -1; // No value set. @@ -2317,12 +2316,6 @@ load_ssl_file_callback(const char *ssl_file) FileManager::instance().configFileChild(ts::filename::SSL_MULTICERT, ssl_file); } -void -load_config_file_callback(const char *parent_file, const char *remap_file) -{ - FileManager::instance().configFileChild(parent_file, remap_file); -} - static void task_threads_started_callback() { diff --git a/tools/benchmark/Makefile.am b/tools/benchmark/Makefile.am index 772fe19208f..c56ba1a8c93 100644 --- a/tools/benchmark/Makefile.am +++ b/tools/benchmark/Makefile.am @@ -49,7 +49,7 @@ benchmark_LD_ADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @HWLOC_LIBS@ \ @LIBPCRE@ \ From d193d29e816646836486ec6f9a947b2b7deabb7b Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 5 Sep 2023 16:15:06 +0000 Subject: [PATCH 02/17] automake: make check pass --- iocore/aio/Makefile.am | 2 +- iocore/cache/Makefile.am | 2 +- iocore/cache/test/stub.cc | 4 +--- iocore/eventsystem/Makefile.am | 2 +- iocore/hostdb/Makefile.am | 2 +- iocore/net/Makefile.am | 4 ++-- iocore/net/libinknet_stub.cc | 2 +- mgmt/rpc/Makefile.am | 2 +- proxy/hdrs/Makefile.am | 4 ++-- proxy/http/Makefile.am | 4 ++-- proxy/http/remap/Makefile.am | 8 ++++---- proxy/http2/Makefile.am | 4 ++-- proxy/http3/Makefile.am | 2 +- src/api/Makefile.am | 2 +- src/records/Makefile.am | 4 ++-- src/traffic_quic/traffic_quic.cc | 2 +- 16 files changed, 24 insertions(+), 26 deletions(-) diff --git a/iocore/aio/Makefile.am b/iocore/aio/Makefile.am index c0babc8da23..450a212a56a 100644 --- a/iocore/aio/Makefile.am +++ b/iocore/aio/Makefile.am @@ -58,7 +58,7 @@ test_AIO_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @SWOC_LIBS@ @HWLOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/iocore/cache/Makefile.am b/iocore/cache/Makefile.am index 63daee25d48..2313b66f5ee 100644 --- a/iocore/cache/Makefile.am +++ b/iocore/cache/Makefile.am @@ -99,7 +99,7 @@ test_LDADD = \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/iocore/aio/libinkaio.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/lib/fastlz/libfastlz.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ diff --git a/iocore/cache/test/stub.cc b/iocore/cache/test/stub.cc index 1ea495ec964..702f7a19106 100644 --- a/iocore/cache/test/stub.cc +++ b/iocore/cache/test/stub.cc @@ -105,8 +105,6 @@ SslAPIHooks *ssl_hooks = nullptr; LifecycleAPIHooks *lifecycle_hooks = nullptr; ConfigUpdateCbTable *global_config_cbs = nullptr; -HttpBodyFactory *body_factory = nullptr; - void HostStatus::setHostStatus(const std::string_view name, const TSHostStatus status, const unsigned int down_time, const unsigned int reason) @@ -215,7 +213,7 @@ INKVConnInternal::INKVConnInternal() : INKContInternal() {} INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp) : INKContInternal(funcp, mutexp) {} -#include "../src/traffic_server/FetchSM.h" +#include "../src/api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/iocore/eventsystem/Makefile.am b/iocore/eventsystem/Makefile.am index 082aac58fb6..513a8b9e4fd 100644 --- a/iocore/eventsystem/Makefile.am +++ b/iocore/eventsystem/Makefile.am @@ -97,7 +97,7 @@ test_LD_ADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/iocore/hostdb/Makefile.am b/iocore/hostdb/Makefile.am index 88aaec7e6ba..3f15a0f219b 100644 --- a/iocore/hostdb/Makefile.am +++ b/iocore/hostdb/Makefile.am @@ -67,7 +67,7 @@ test_LD_ADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @SWOC_LIBS@ @HWLOC_LIBS@ @YAMLCPP_LIBS@ @OPENSSL_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am index 4ccbc1c6e31..616c3a155d7 100644 --- a/iocore/net/Makefile.am +++ b/iocore/net/Makefile.am @@ -88,7 +88,7 @@ test_UDPNet_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/ParentSelectionStrategy.o \ @HWLOC_LIBS@ @OPENSSL_LIBS@ @LIBPCRE@ @YAMLCPP_LIBS@ @SWOC_LIBS@ @LIBPCRE@ @LIBCAP@ if ENABLE_QUIC @@ -129,7 +129,7 @@ test_libinknet_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/proxy/ParentSelectionStrategy.o \ @HWLOC_LIBS@ @OPENSSL_LIBS@ @LIBPCRE@ @YAMLCPP_LIBS@ @SWOC_LIBS@ @LIBCAP@ diff --git a/iocore/net/libinknet_stub.cc b/iocore/net/libinknet_stub.cc index d08ae170151..dbf506644fc 100644 --- a/iocore/net/libinknet_stub.cc +++ b/iocore/net/libinknet_stub.cc @@ -156,7 +156,7 @@ PreWarmManager::reconfigure() PreWarmManager prewarmManager; -#include "../src/traffic_server/FetchSM.h" +#include "../src/api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/mgmt/rpc/Makefile.am b/mgmt/rpc/Makefile.am index 2286fff6ec4..d8afc528fed 100644 --- a/mgmt/rpc/Makefile.am +++ b/mgmt/rpc/Makefile.am @@ -106,7 +106,7 @@ test_jsonrpcserver_LDADD = \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/src/tscore/libtscore.a \ @YAMLCPP_LIBS@ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBPCRE@ @LIBCAP@ diff --git a/proxy/hdrs/Makefile.am b/proxy/hdrs/Makefile.am index 2aa0b66e3d9..a1343e98262 100644 --- a/proxy/hdrs/Makefile.am +++ b/proxy/hdrs/Makefile.am @@ -92,7 +92,7 @@ test_proxy_hdrs_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @YAMLCPP_LIBS@ @HWLOC_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ @LIBCAP@ test_hdr_heap_CPPFLAGS = $(AM_CPPFLAGS) \ @@ -108,7 +108,7 @@ test_hdr_heap_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ \ @LIBPCRE@ @OPENSSL_LIBS@ @LIBCAP@ diff --git a/proxy/http/Makefile.am b/proxy/http/Makefile.am index 7c96ed34371..2894e2327ca 100644 --- a/proxy/http/Makefile.am +++ b/proxy/http/Makefile.am @@ -110,7 +110,7 @@ test_proxy_http_LDADD = \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @SWOC_LIBS@ @HWLOC_LIBS@ \ @LIBCAP@ \ @@ -159,7 +159,7 @@ test_HttpTransact_LDADD = \ $(top_builddir)/iocore/net/libinknet.a \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ -lz -llzma -lcrypto -lresolv -lssl \ @LIBPCRE@ @HWLOC_LIBS@ @SWOC_LIBS@ @YAMLCPP_LIBS@ @LIBCAP@ diff --git a/proxy/http/remap/Makefile.am b/proxy/http/remap/Makefile.am index e61c0aeb4d5..e6e7f1a0393 100644 --- a/proxy/http/remap/Makefile.am +++ b/proxy/http/remap/Makefile.am @@ -68,7 +68,7 @@ libhttp_remap_a_SOURCES = \ COMMON_PLUGINDSO_LDADDS = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @@ -138,7 +138,7 @@ test_NextHopStrategyFactory_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/proxy/logging/liblogging.a \ @@ -173,7 +173,7 @@ test_NextHopRoundRobin_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/logging/liblogging.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ @@ -208,7 +208,7 @@ test_NextHopConsistentHash_LDADD = \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/logging/liblogging.a \ $(top_builddir)/iocore/utils/libinkutils.a \ $(top_builddir)/src/tscore/libtscore.a \ diff --git a/proxy/http2/Makefile.am b/proxy/http2/Makefile.am index 6b9b837280f..9db5940e6d6 100644 --- a/proxy/http2/Makefile.am +++ b/proxy/http2/Makefile.am @@ -73,7 +73,7 @@ test_libhttp2_LDADD = \ HPACK.o \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ @@ -129,7 +129,7 @@ test_HPACK_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ @YAMLCPP_LIBS@ @LIBCAP@ test_HPACK_SOURCES = \ diff --git a/proxy/http3/Makefile.am b/proxy/http3/Makefile.am index 07720502d8a..3a2dab78f00 100644 --- a/proxy/http3/Makefile.am +++ b/proxy/http3/Makefile.am @@ -73,7 +73,7 @@ test_LDADD = \ $(top_builddir)/iocore/net/TLSKeyLogger.o \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/records/librecords_p.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/proxy/hdrs/libhdrs.a \ $(top_builddir)/src/tscore/libtscore.a \ diff --git a/src/api/Makefile.am b/src/api/Makefile.am index 51571ad495a..c2dafedaa9b 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -69,7 +69,7 @@ test_Metrics_CPPFLAGS = $(AM_CPPFLAGS)\ test_Metrics_LDADD = \ $(top_builddir)/src/tscore/libtscore.a \ - libtsapi.la + libtsapicore.a clang-tidy-local: $(DIST_SOURCES) diff --git a/src/records/Makefile.am b/src/records/Makefile.am index 62325ea907d..e9363c0412c 100644 --- a/src/records/Makefile.am +++ b/src/records/Makefile.am @@ -72,7 +72,7 @@ test_librecords_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @SWOC_LIBS@ @HWLOC_LIBS@ @LIBCAP@ @YAMLCPP_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ test_librecords_on_eventsystem_CPPFLAGS = $(AM_CPPFLAGS)\ @@ -87,7 +87,7 @@ test_librecords_on_eventsystem_LDADD = \ $(top_builddir)/iocore/eventsystem/libinkevent.a \ $(top_builddir)/src/tscpp/util/libtscpputil.la \ $(top_builddir)/src/tscore/libtscore.a \ - $(top_builddir)/src/api/libtsapi.la \ + $(top_builddir)/src/api/libtsapicore.a \ @HWLOC_LIBS@ @LIBCAP@ @YAMLCPP_LIBS@ @SWOC_LIBS@ @LIBPCRE@ @OPENSSL_LIBS@ clang-tidy-local: $(sort $(DIST_SOURCES)) diff --git a/src/traffic_quic/traffic_quic.cc b/src/traffic_quic/traffic_quic.cc index 7db2863e520..6c7c2ddd540 100644 --- a/src/traffic_quic/traffic_quic.cc +++ b/src/traffic_quic/traffic_quic.cc @@ -347,7 +347,7 @@ PreWarmManager::reconfigure() PreWarmManager prewarmManager; -#include "../src/traffic_server/FetchSM.h" +#include "../src/api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() From 6c8d076f13150fa2dd932a807fdc0bf7579a0ff8 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 5 Sep 2023 16:23:42 +0000 Subject: [PATCH 03/17] Moved InkAPITest regression test to src/api --- src/{traffic_server => api}/InkAPITest.cc | 0 src/api/Makefile.am | 5 +++++ src/traffic_server/Makefile.inc | 6 ------ 3 files changed, 5 insertions(+), 6 deletions(-) rename src/{traffic_server => api}/InkAPITest.cc (100%) diff --git a/src/traffic_server/InkAPITest.cc b/src/api/InkAPITest.cc similarity index 100% rename from src/traffic_server/InkAPITest.cc rename to src/api/InkAPITest.cc diff --git a/src/api/Makefile.am b/src/api/Makefile.am index c2dafedaa9b..dd2de7a3e14 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -54,6 +54,11 @@ libtsapi_la_SOURCES = \ InkContInternal.cc \ InkIOCoreAPI.cc +if BUILD_TESTS +libtsapi_la_SOURCES += \ + InkAPITest.cc +endif + # libtsapicore.a libtsapicore_a_LIBADD = \ @SWOC_LIBS@ diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc index 6e659c494ec..7025fb5ca75 100644 --- a/src/traffic_server/Makefile.inc +++ b/src/traffic_server/Makefile.inc @@ -53,12 +53,6 @@ traffic_server_traffic_server_SOURCES = \ shared/overridable_txn_vars.cc \ traffic_server/traffic_server.cc - -if BUILD_TESTS -traffic_server_traffic_server_SOURCES += \ - traffic_server/InkAPITest.cc -endif - traffic_server_traffic_server_LDADD = \ $(top_builddir)/proxy/http/libhttp.a \ $(top_builddir)/proxy/http/remap/libhttp_remap.a \ From 2d27f86401149ccc8702fff7203ddff3d755a53c Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 5 Sep 2023 18:35:01 +0000 Subject: [PATCH 04/17] cmake built --- CMakeLists.txt | 2 +- iocore/net/CMakeLists.txt | 2 +- proxy/CMakeLists.txt | 2 ++ proxy/http3/CMakeLists.txt | 4 ++-- src/api/CMakeLists.txt | 18 +++++++++++++++--- src/records/CMakeLists.txt | 2 +- src/tests/CMakeLists.txt | 2 +- src/traffic_crashlog/CMakeLists.txt | 2 +- src/traffic_layout/CMakeLists.txt | 2 +- src/traffic_logcat/CMakeLists.txt | 2 +- src/traffic_logstats/CMakeLists.txt | 2 +- src/traffic_server/CMakeLists.txt | 16 +--------------- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a1c7ac053a..1ad10614fa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,7 +404,6 @@ configure_file(include/ts/apidefs.h.in include/ts/apidefs.h) enable_testing() -add_subdirectory(src/api) add_subdirectory(src/tscpp/util) add_subdirectory(src/tscpp/api) add_subdirectory(src/tscore) @@ -413,6 +412,7 @@ add_subdirectory(iocore) add_subdirectory(proxy) add_subdirectory(mgmt/config) add_subdirectory(mgmt/rpc) +add_subdirectory(src/api) add_subdirectory(src/traffic_crashlog) add_subdirectory(src/traffic_server) add_subdirectory(src/traffic_ctl) diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt index 2897d6b7e50..03ce7d1fb4e 100644 --- a/iocore/net/CMakeLists.txt +++ b/iocore/net/CMakeLists.txt @@ -114,7 +114,7 @@ target_include_directories(inknet PUBLIC ${CMAKE_SOURCE_DIR}/proxy/shared ${CMAKE_SOURCE_DIR}/proxy/http ${CMAKE_SOURCE_DIR}/proxy/http/remap - ${CMAKE_SOURCE_DIR}/src/traffic_server + ${CMAKE_SOURCE_DIR}/src/api ) target_link_libraries(inknet diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt index 8ea6f9f8cef..376785dfaae 100644 --- a/proxy/CMakeLists.txt +++ b/proxy/CMakeLists.txt @@ -21,6 +21,7 @@ add_library(proxy STATIC CacheControl.cc ControlBase.cc ControlMatcher.cc + HostStatus.cc IPAllow.cc ParentConsistentHash.cc ParentRoundRobin.cc @@ -55,6 +56,7 @@ set(PROXY_INCLUDE_DIRS ${PROXY_INCLUDE_DIRS} PARENT_SCOPE) target_include_directories(proxy PUBLIC ${IOCORE_INCLUDE_DIRS} ${PROXY_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/mgmt ${CMAKE_SOURCE_DIR}/lib/yamlcpp/include ) diff --git a/proxy/http3/CMakeLists.txt b/proxy/http3/CMakeLists.txt index 6d2caf71e66..d0e9120f427 100644 --- a/proxy/http3/CMakeLists.txt +++ b/proxy/http3/CMakeLists.txt @@ -59,7 +59,7 @@ target_link_libraries(test_http3 ts::quic ts::inkevent ts::records - ts::tsapi + ts::tsapicore ts::hdrs ts::tscore ) @@ -77,7 +77,7 @@ target_link_libraries(test_qpack ts::quic ts::inkevent ts::records - ts::tsapi + ts::tsapicore ts::hdrs ts::tscore ) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 57873748a2b..001929ec18f 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -15,10 +15,22 @@ # ####################### -add_library(tsapi SHARED Metrics.cc) +add_library(tsapi SHARED + InkAPI.cc + InkContInternal.cc + InkIOCoreAPI.cc +) add_library(ts::tsapi ALIAS tsapi) -target_link_libraries(tsapi PRIVATE ts::tscore) +add_library(tsapicore STATIC Metrics.cc FetchSM.cc) +add_library(ts::tsapicore ALIAS tsapicore) +target_link_libraries(tsapicore PRIVATE ts::tscore) + +include_directories( + ${IOCORE_INCLUDE_DIRS} + ${PROXY_INCLUDE_DIRS} + ${CMAKE_SOURCE_DIR}/mgmt +) install(TARGETS tsapi) @@ -30,7 +42,7 @@ add_executable(test_Metrics test_Metrics.cc ) -target_link_libraries(test_Metrics PRIVATE tsapi tscore catch2::catch2) +target_link_libraries(test_Metrics PRIVATE tsapicore tscore catch2::catch2) target_include_directories(test_Metrics PRIVATE ${CMAKE_SOURCE_DIR}/include) add_test(NAME test_Metrics COMMAND $) diff --git a/src/records/CMakeLists.txt b/src/records/CMakeLists.txt index 745296e35bc..e6332632c79 100644 --- a/src/records/CMakeLists.txt +++ b/src/records/CMakeLists.txt @@ -46,7 +46,7 @@ target_link_libraries(records ts::tscore yaml-cpp::yaml-cpp PRIVATE - ts::tsapi + ts::tsapicore ) add_executable(test_records unit_tests/unit_test_main.cc unit_tests/test_RecHttp.cc) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ad351fd85fa..3c05384faed 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -47,7 +47,7 @@ link_libraries( aio records tscore - tsapi + tsapicore tscpputil proxy inknet diff --git a/src/traffic_crashlog/CMakeLists.txt b/src/traffic_crashlog/CMakeLists.txt index 13df48df1b0..962751251db 100644 --- a/src/traffic_crashlog/CMakeLists.txt +++ b/src/traffic_crashlog/CMakeLists.txt @@ -22,7 +22,7 @@ target_link_libraries(traffic_crashlog ts::inkevent ts::records ts::tscore - ts::tsapi + ts::tsapicore ) install(TARGETS traffic_crashlog) diff --git a/src/traffic_layout/CMakeLists.txt b/src/traffic_layout/CMakeLists.txt index 7a02a6a5075..59bb9bb3881 100644 --- a/src/traffic_layout/CMakeLists.txt +++ b/src/traffic_layout/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries(traffic_layout OpenSSL::Crypto yaml-cpp::yaml-cpp ts::tscore - ts::tsapi + ts::tsapicore PCRE::PCRE ${OPENSSL_LIBRARY} ) diff --git a/src/traffic_logcat/CMakeLists.txt b/src/traffic_logcat/CMakeLists.txt index 7a0c3978fc5..e702c553e33 100644 --- a/src/traffic_logcat/CMakeLists.txt +++ b/src/traffic_logcat/CMakeLists.txt @@ -16,5 +16,5 @@ ####################### add_executable(traffic_logcat logcat.cc) -target_link_libraries(traffic_logcat PRIVATE ts::tscore ts::proxy ts::logging ts::hdrs ts::tsapi ts::diagsconfig libswoc) +target_link_libraries(traffic_logcat PRIVATE ts::tscore ts::proxy ts::logging ts::hdrs ts::tsapicore ts::diagsconfig libswoc) install(TARGETS traffic_logcat) diff --git a/src/traffic_logstats/CMakeLists.txt b/src/traffic_logstats/CMakeLists.txt index be589c1761b..f4ec1df2126 100644 --- a/src/traffic_logstats/CMakeLists.txt +++ b/src/traffic_logstats/CMakeLists.txt @@ -16,7 +16,7 @@ ####################### add_executable(traffic_logstats logstats.cc) -target_link_libraries(traffic_logstats PRIVATE ts::logging ts::hdrs ts::tscore ts::tsapi ts::records ts::diagsconfig ts::inkevent libswoc) +target_link_libraries(traffic_logstats PRIVATE ts::logging ts::hdrs ts::tscore ts::tsapicore ts::records ts::diagsconfig ts::inkevent libswoc) add_test( NAME test_logstats_json diff --git a/src/traffic_server/CMakeLists.txt b/src/traffic_server/CMakeLists.txt index c053d72b971..1c2e1c136f5 100644 --- a/src/traffic_server/CMakeLists.txt +++ b/src/traffic_server/CMakeLists.txt @@ -15,23 +15,9 @@ # ####################### -add_library(inkcont STATIC InkContInternal.cc) -add_library(ts::inkcont ALIAS inkcont) - -target_link_libraries(inkcont - PRIVATE - ts::http_remap - ts::inkevent - ts::tscore -) - add_executable(traffic_server Crash.cc EventName.cc - FetchSM.cc - HostStatus.cc - InkAPI.cc - InkIOCoreAPI.cc SocksProxy.cc traffic_server.cc RpcAdminPubHandlers.cc @@ -46,7 +32,7 @@ target_link_libraries(traffic_server PRIVATE ts::tscore ts::tsapi - ts::inkcont + ts::tsapicore ts::http ts::http_remap ts::http2 From a72c5c1813f7237fe3eb7fce4f1d5b7e6677a5a0 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 5 Sep 2023 19:06:47 +0000 Subject: [PATCH 05/17] Fix build --- src/api/Makefile.am | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/api/Makefile.am b/src/api/Makefile.am index dd2de7a3e14..6db01f42304 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -60,8 +60,6 @@ libtsapi_la_SOURCES += \ endif # libtsapicore.a -libtsapicore_a_LIBADD = \ - @SWOC_LIBS@ libtsapicore_a_SOURCES = \ Metrics.cc \ From 157450b04068a37ae92e7a73ce13adad297fe8b5 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Wed, 6 Sep 2023 03:41:25 +0000 Subject: [PATCH 06/17] built static lib with -fPIC to fix quiche cmake build --- iocore/aio/CMakeLists.txt | 1 + iocore/cache/CMakeLists.txt | 1 + iocore/eventsystem/CMakeLists.txt | 1 + iocore/net/CMakeLists.txt | 1 + iocore/net/quic/CMakeLists.txt | 1 + iocore/utils/CMakeLists.txt | 1 + proxy/CMakeLists.txt | 1 + src/api/CMakeLists.txt | 2 ++ src/records/CMakeLists.txt | 1 + 9 files changed, 10 insertions(+) diff --git a/iocore/aio/CMakeLists.txt b/iocore/aio/CMakeLists.txt index f39e4be2ba4..7677d5d42ac 100644 --- a/iocore/aio/CMakeLists.txt +++ b/iocore/aio/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(aio STATIC) add_library(ts::aio ALIAS aio) +set_target_properties(aio PROPERTIES POSITION_INDEPENDENT_CODE ON) target_sources(aio PRIVATE AIO.cc Inline.cc AIO_fault_injection.cc) diff --git a/iocore/cache/CMakeLists.txt b/iocore/cache/CMakeLists.txt index 8065146b12a..c2922bffb9c 100644 --- a/iocore/cache/CMakeLists.txt +++ b/iocore/cache/CMakeLists.txt @@ -32,6 +32,7 @@ add_library(inkcache STATIC Store.cc ) add_library(ts::inkcache ALIAS inkcache) +set_target_properties(inkcache PROPERTIES POSITION_INDEPENDENT_CODE ON) if(BUILD_REGRESSION_TESTING) target_sources(inkcache PRIVATE CacheTest.cc) diff --git a/iocore/eventsystem/CMakeLists.txt b/iocore/eventsystem/CMakeLists.txt index aa0c3fc0fe2..496e7701576 100644 --- a/iocore/eventsystem/CMakeLists.txt +++ b/iocore/eventsystem/CMakeLists.txt @@ -36,6 +36,7 @@ add_library(inkevent STATIC RecRawStatsImpl.cc RecProcess.cc) add_library(ts::inkevent ALIAS inkevent) +set_target_properties(inkevent PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkevent PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt index 03ce7d1fb4e..1367dd8ad16 100644 --- a/iocore/net/CMakeLists.txt +++ b/iocore/net/CMakeLists.txt @@ -74,6 +74,7 @@ add_library(inknet STATIC SNIActionPerformer.cc ) add_library(ts::inknet ALIAS inknet) +set_target_properties(inknet PROPERTIES POSITION_INDEPENDENT_CODE ON) if(TS_USE_QUIC) add_subdirectory(quic) diff --git a/iocore/net/quic/CMakeLists.txt b/iocore/net/quic/CMakeLists.txt index 9952d761f1d..5b4af57f84a 100644 --- a/iocore/net/quic/CMakeLists.txt +++ b/iocore/net/quic/CMakeLists.txt @@ -32,6 +32,7 @@ add_library(quic STATIC QUICStreamVCAdapter.cc ) add_library(ts::quic ALIAS quic) +set_target_properties(quic PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(quic PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/iocore/utils/CMakeLists.txt b/iocore/utils/CMakeLists.txt index 3c1a020f623..213e6d1bc9b 100644 --- a/iocore/utils/CMakeLists.txt +++ b/iocore/utils/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(inkutils STATIC Machine.cc OneWayMultiTunnel.cc OneWayTunnel.cc) add_library(ts::inkutils ALIAS inkutils) +set_target_properties(inkutils PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkutils PRIVATE diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt index 376785dfaae..c5510b8a0e5 100644 --- a/proxy/CMakeLists.txt +++ b/proxy/CMakeLists.txt @@ -37,6 +37,7 @@ add_library(proxy STATIC Transform.cc ) add_library(ts::proxy ALIAS proxy) +set_target_properties(proxy PROPERTIES POSITION_INDEPENDENT_CODE ON) if(BUILD_REGRESSION_TESTING) target_sources(proxy PRIVATE RegressionSM.cc) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 001929ec18f..d473cae3873 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -21,10 +21,12 @@ add_library(tsapi SHARED InkIOCoreAPI.cc ) add_library(ts::tsapi ALIAS tsapi) +target_link_libraries(tsapi PRIVATE ts::inknet) add_library(tsapicore STATIC Metrics.cc FetchSM.cc) add_library(ts::tsapicore ALIAS tsapicore) target_link_libraries(tsapicore PRIVATE ts::tscore) +set_target_properties(tsapicore PROPERTIES POSITION_INDEPENDENT_CODE ON) include_directories( ${IOCORE_INCLUDE_DIRS} diff --git a/src/records/CMakeLists.txt b/src/records/CMakeLists.txt index e6332632c79..e61b7a4cc6a 100644 --- a/src/records/CMakeLists.txt +++ b/src/records/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(records STATIC RecRawStats.cc ) add_library(ts::records ALIAS records) +set_target_properties(records PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(records PUBLIC From b00af5e444037d9adbd60b66a894aedcbea5a084 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Wed, 6 Sep 2023 15:34:14 +0000 Subject: [PATCH 07/17] built all static libs with -fPIC to see if it fixes things --- iocore/dns/CMakeLists.txt | 1 + iocore/hostdb/CMakeLists.txt | 1 + mgmt/config/CMakeLists.txt | 1 + mgmt/rpc/CMakeLists.txt | 3 +++ proxy/hdrs/CMakeLists.txt | 1 + proxy/http/CMakeLists.txt | 1 + proxy/http/remap/CMakeLists.txt | 1 + proxy/http2/CMakeLists.txt | 1 + proxy/logging/CMakeLists.txt | 1 + proxy/shared/CMakeLists.txt | 1 + 10 files changed, 12 insertions(+) diff --git a/iocore/dns/CMakeLists.txt b/iocore/dns/CMakeLists.txt index b509fbb088f..25ddb0efd14 100644 --- a/iocore/dns/CMakeLists.txt +++ b/iocore/dns/CMakeLists.txt @@ -24,6 +24,7 @@ add_library(inkdns STATIC SplitDNS.cc ) add_library(ts::inkdns ALIAS inkdns) +set_target_properties(inkdns PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkdns PRIVATE ${CMAKE_SOURCE_DIR}/iocore/dns diff --git a/iocore/hostdb/CMakeLists.txt b/iocore/hostdb/CMakeLists.txt index 6597637b52c..dd4a34b9dd9 100644 --- a/iocore/hostdb/CMakeLists.txt +++ b/iocore/hostdb/CMakeLists.txt @@ -24,6 +24,7 @@ add_library(inkhostdb STATIC HostDBInfo.cc ) add_library(ts::inkhostdb ALIAS inkhostdb) +set_target_properties(inkhostdb PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkhostdb PUBLIC diff --git a/mgmt/config/CMakeLists.txt b/mgmt/config/CMakeLists.txt index 035a5b6d181..11ca7ac4af3 100644 --- a/mgmt/config/CMakeLists.txt +++ b/mgmt/config/CMakeLists.txt @@ -20,6 +20,7 @@ add_library(configmanager STATIC AddConfigFilesHere.cc ) add_library(ts::configmanager ALIAS configmanager) +set_target_properties(configmanager PROPERTIES POSITION_INDEPENDENT_CODE TRUE) include_directories( ${CMAKE_SOURCE_DIR}/mgmt diff --git a/mgmt/rpc/CMakeLists.txt b/mgmt/rpc/CMakeLists.txt index 87112543fb6..294904fb61d 100644 --- a/mgmt/rpc/CMakeLists.txt +++ b/mgmt/rpc/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(jsonrpc_protocol STATIC jsonrpc/Context.cc ) add_library(ts::jsonrpc_protocol ALIAS jsonrpc_protocol) +set_target_properties(jsonrpc_protocol PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(jsonrpc_protocol PUBLIC @@ -44,6 +45,7 @@ add_library(jsonrpc_server STATIC config/JsonRPCConfig.cc ) add_library(ts::jsonrpc_server ALIAS jsonrpc_server) +set_target_properties(jsonrpc_server PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(jsonrpc_server PUBLIC @@ -58,6 +60,7 @@ add_library(rpcpublichandlers STATIC handlers/plugins/Plugins.cc ) add_library(ts::rpcpublichandlers ALIAS rpcpublichandlers) +set_target_properties(rpcpublichandlers PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(rpcpublichandlers PUBLIC diff --git a/proxy/hdrs/CMakeLists.txt b/proxy/hdrs/CMakeLists.txt index 1930f25d2d7..4026e7673df 100644 --- a/proxy/hdrs/CMakeLists.txt +++ b/proxy/hdrs/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(hdrs STATIC HeaderValidator.cc ) add_library(ts::hdrs ALIAS hdrs) +set_target_properties(hdrs PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(hdrs PUBLIC diff --git a/proxy/http/CMakeLists.txt b/proxy/http/CMakeLists.txt index cf619aca73f..371efd9abc5 100644 --- a/proxy/http/CMakeLists.txt +++ b/proxy/http/CMakeLists.txt @@ -41,6 +41,7 @@ add_library(http STATIC PreWarmConfig.cc ) add_library(ts::http ALIAS http) +set_target_properties(http PROPERTIES POSITION_INDEPENDENT_CODE TRUE) if(BUILD_REGRESSION_TESTING) target_sources(http PRIVATE RegressionHttpTransact.cc) diff --git a/proxy/http/remap/CMakeLists.txt b/proxy/http/remap/CMakeLists.txt index f0bb9ff3725..7ede32d10cb 100644 --- a/proxy/http/remap/CMakeLists.txt +++ b/proxy/http/remap/CMakeLists.txt @@ -35,6 +35,7 @@ add_library(http_remap STATIC UrlRewrite.cc ) add_library(ts::http_remap ALIAS http_remap) +set_target_properties(http_remap PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(http_remap PRIVATE ${IOCORE_INCLUDE_DIRS} diff --git a/proxy/http2/CMakeLists.txt b/proxy/http2/CMakeLists.txt index 453e15fa670..6bfe25406e7 100644 --- a/proxy/http2/CMakeLists.txt +++ b/proxy/http2/CMakeLists.txt @@ -30,6 +30,7 @@ add_library(http2 STATIC Http2ServerSession.cc ) add_library(ts::http2 ALIAS http2) +set_target_properties(http2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(http2 PRIVATE ${IOCORE_INCLUDE_DIRS} diff --git a/proxy/logging/CMakeLists.txt b/proxy/logging/CMakeLists.txt index ab5836d23af..aa3d0f9a143 100644 --- a/proxy/logging/CMakeLists.txt +++ b/proxy/logging/CMakeLists.txt @@ -33,6 +33,7 @@ add_library(logging STATIC YamlLogConfigDecoders.cc ) add_library(ts::logging ALIAS logging) +set_target_properties(logging PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(logging PRIVATE ${IOCORE_INCLUDE_DIRS} diff --git a/proxy/shared/CMakeLists.txt b/proxy/shared/CMakeLists.txt index 70b853e0d55..d3a90f90aaf 100644 --- a/proxy/shared/CMakeLists.txt +++ b/proxy/shared/CMakeLists.txt @@ -18,6 +18,7 @@ add_library(diagsconfig STATIC DiagsConfig.cc) add_library(ts::diagsconfig ALIAS diagsconfig) +set_target_properties(diagsconfig PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(diagsconfig PRIVATE ${IOCORE_INCLUDE_DIRS} From d2a99d62c98657960e338fa65ccf7968f20f1772 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Wed, 6 Sep 2023 18:55:43 +0000 Subject: [PATCH 08/17] link tsapi to tscore only --- src/api/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index d473cae3873..6254451ad94 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -21,7 +21,7 @@ add_library(tsapi SHARED InkIOCoreAPI.cc ) add_library(ts::tsapi ALIAS tsapi) -target_link_libraries(tsapi PRIVATE ts::inknet) +target_link_libraries(tsapi PRIVATE ts::tscore) add_library(tsapicore STATIC Metrics.cc FetchSM.cc) add_library(ts::tsapicore ALIAS tsapicore) From 52d1cc3c4a042d264d6249702fc7d0f1b46665f6 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Wed, 6 Sep 2023 21:16:00 +0000 Subject: [PATCH 09/17] Revert "built all static libs with -fPIC to see if it fixes things" This reverts commit 40998a685eb7ddeb90ac203338217884ded21924. --- iocore/dns/CMakeLists.txt | 1 - iocore/hostdb/CMakeLists.txt | 1 - mgmt/config/CMakeLists.txt | 1 - mgmt/rpc/CMakeLists.txt | 3 --- proxy/hdrs/CMakeLists.txt | 1 - proxy/http/CMakeLists.txt | 1 - proxy/http/remap/CMakeLists.txt | 1 - proxy/http2/CMakeLists.txt | 1 - proxy/logging/CMakeLists.txt | 1 - proxy/shared/CMakeLists.txt | 1 - 10 files changed, 12 deletions(-) diff --git a/iocore/dns/CMakeLists.txt b/iocore/dns/CMakeLists.txt index 25ddb0efd14..b509fbb088f 100644 --- a/iocore/dns/CMakeLists.txt +++ b/iocore/dns/CMakeLists.txt @@ -24,7 +24,6 @@ add_library(inkdns STATIC SplitDNS.cc ) add_library(ts::inkdns ALIAS inkdns) -set_target_properties(inkdns PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkdns PRIVATE ${CMAKE_SOURCE_DIR}/iocore/dns diff --git a/iocore/hostdb/CMakeLists.txt b/iocore/hostdb/CMakeLists.txt index dd4a34b9dd9..6597637b52c 100644 --- a/iocore/hostdb/CMakeLists.txt +++ b/iocore/hostdb/CMakeLists.txt @@ -24,7 +24,6 @@ add_library(inkhostdb STATIC HostDBInfo.cc ) add_library(ts::inkhostdb ALIAS inkhostdb) -set_target_properties(inkhostdb PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkhostdb PUBLIC diff --git a/mgmt/config/CMakeLists.txt b/mgmt/config/CMakeLists.txt index 11ca7ac4af3..035a5b6d181 100644 --- a/mgmt/config/CMakeLists.txt +++ b/mgmt/config/CMakeLists.txt @@ -20,7 +20,6 @@ add_library(configmanager STATIC AddConfigFilesHere.cc ) add_library(ts::configmanager ALIAS configmanager) -set_target_properties(configmanager PROPERTIES POSITION_INDEPENDENT_CODE TRUE) include_directories( ${CMAKE_SOURCE_DIR}/mgmt diff --git a/mgmt/rpc/CMakeLists.txt b/mgmt/rpc/CMakeLists.txt index 294904fb61d..87112543fb6 100644 --- a/mgmt/rpc/CMakeLists.txt +++ b/mgmt/rpc/CMakeLists.txt @@ -31,7 +31,6 @@ add_library(jsonrpc_protocol STATIC jsonrpc/Context.cc ) add_library(ts::jsonrpc_protocol ALIAS jsonrpc_protocol) -set_target_properties(jsonrpc_protocol PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(jsonrpc_protocol PUBLIC @@ -45,7 +44,6 @@ add_library(jsonrpc_server STATIC config/JsonRPCConfig.cc ) add_library(ts::jsonrpc_server ALIAS jsonrpc_server) -set_target_properties(jsonrpc_server PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(jsonrpc_server PUBLIC @@ -60,7 +58,6 @@ add_library(rpcpublichandlers STATIC handlers/plugins/Plugins.cc ) add_library(ts::rpcpublichandlers ALIAS rpcpublichandlers) -set_target_properties(rpcpublichandlers PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(rpcpublichandlers PUBLIC diff --git a/proxy/hdrs/CMakeLists.txt b/proxy/hdrs/CMakeLists.txt index 4026e7673df..1930f25d2d7 100644 --- a/proxy/hdrs/CMakeLists.txt +++ b/proxy/hdrs/CMakeLists.txt @@ -31,7 +31,6 @@ add_library(hdrs STATIC HeaderValidator.cc ) add_library(ts::hdrs ALIAS hdrs) -set_target_properties(hdrs PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(hdrs PUBLIC diff --git a/proxy/http/CMakeLists.txt b/proxy/http/CMakeLists.txt index 371efd9abc5..cf619aca73f 100644 --- a/proxy/http/CMakeLists.txt +++ b/proxy/http/CMakeLists.txt @@ -41,7 +41,6 @@ add_library(http STATIC PreWarmConfig.cc ) add_library(ts::http ALIAS http) -set_target_properties(http PROPERTIES POSITION_INDEPENDENT_CODE TRUE) if(BUILD_REGRESSION_TESTING) target_sources(http PRIVATE RegressionHttpTransact.cc) diff --git a/proxy/http/remap/CMakeLists.txt b/proxy/http/remap/CMakeLists.txt index 7ede32d10cb..f0bb9ff3725 100644 --- a/proxy/http/remap/CMakeLists.txt +++ b/proxy/http/remap/CMakeLists.txt @@ -35,7 +35,6 @@ add_library(http_remap STATIC UrlRewrite.cc ) add_library(ts::http_remap ALIAS http_remap) -set_target_properties(http_remap PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(http_remap PRIVATE ${IOCORE_INCLUDE_DIRS} diff --git a/proxy/http2/CMakeLists.txt b/proxy/http2/CMakeLists.txt index 6bfe25406e7..453e15fa670 100644 --- a/proxy/http2/CMakeLists.txt +++ b/proxy/http2/CMakeLists.txt @@ -30,7 +30,6 @@ add_library(http2 STATIC Http2ServerSession.cc ) add_library(ts::http2 ALIAS http2) -set_target_properties(http2 PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(http2 PRIVATE ${IOCORE_INCLUDE_DIRS} diff --git a/proxy/logging/CMakeLists.txt b/proxy/logging/CMakeLists.txt index aa3d0f9a143..ab5836d23af 100644 --- a/proxy/logging/CMakeLists.txt +++ b/proxy/logging/CMakeLists.txt @@ -33,7 +33,6 @@ add_library(logging STATIC YamlLogConfigDecoders.cc ) add_library(ts::logging ALIAS logging) -set_target_properties(logging PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(logging PRIVATE ${IOCORE_INCLUDE_DIRS} diff --git a/proxy/shared/CMakeLists.txt b/proxy/shared/CMakeLists.txt index d3a90f90aaf..70b853e0d55 100644 --- a/proxy/shared/CMakeLists.txt +++ b/proxy/shared/CMakeLists.txt @@ -18,7 +18,6 @@ add_library(diagsconfig STATIC DiagsConfig.cc) add_library(ts::diagsconfig ALIAS diagsconfig) -set_target_properties(diagsconfig PROPERTIES POSITION_INDEPENDENT_CODE TRUE) target_include_directories(diagsconfig PRIVATE ${IOCORE_INCLUDE_DIRS} From 588d86847f1c8f99ae3aec2196ccf6fe16f249c4 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Wed, 6 Sep 2023 21:17:11 +0000 Subject: [PATCH 10/17] Revert "built static lib with -fPIC to fix quiche cmake build" This reverts commit a9b7169eb23cca1e9550c5c77db7e2a8e66bbedd. --- iocore/aio/CMakeLists.txt | 1 - iocore/cache/CMakeLists.txt | 1 - iocore/eventsystem/CMakeLists.txt | 1 - iocore/net/CMakeLists.txt | 1 - iocore/net/quic/CMakeLists.txt | 1 - iocore/utils/CMakeLists.txt | 1 - proxy/CMakeLists.txt | 1 - src/api/CMakeLists.txt | 1 - src/records/CMakeLists.txt | 1 - 9 files changed, 9 deletions(-) diff --git a/iocore/aio/CMakeLists.txt b/iocore/aio/CMakeLists.txt index 7677d5d42ac..f39e4be2ba4 100644 --- a/iocore/aio/CMakeLists.txt +++ b/iocore/aio/CMakeLists.txt @@ -18,7 +18,6 @@ add_library(aio STATIC) add_library(ts::aio ALIAS aio) -set_target_properties(aio PROPERTIES POSITION_INDEPENDENT_CODE ON) target_sources(aio PRIVATE AIO.cc Inline.cc AIO_fault_injection.cc) diff --git a/iocore/cache/CMakeLists.txt b/iocore/cache/CMakeLists.txt index c2922bffb9c..8065146b12a 100644 --- a/iocore/cache/CMakeLists.txt +++ b/iocore/cache/CMakeLists.txt @@ -32,7 +32,6 @@ add_library(inkcache STATIC Store.cc ) add_library(ts::inkcache ALIAS inkcache) -set_target_properties(inkcache PROPERTIES POSITION_INDEPENDENT_CODE ON) if(BUILD_REGRESSION_TESTING) target_sources(inkcache PRIVATE CacheTest.cc) diff --git a/iocore/eventsystem/CMakeLists.txt b/iocore/eventsystem/CMakeLists.txt index 496e7701576..aa0c3fc0fe2 100644 --- a/iocore/eventsystem/CMakeLists.txt +++ b/iocore/eventsystem/CMakeLists.txt @@ -36,7 +36,6 @@ add_library(inkevent STATIC RecRawStatsImpl.cc RecProcess.cc) add_library(ts::inkevent ALIAS inkevent) -set_target_properties(inkevent PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkevent PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt index 1367dd8ad16..03ce7d1fb4e 100644 --- a/iocore/net/CMakeLists.txt +++ b/iocore/net/CMakeLists.txt @@ -74,7 +74,6 @@ add_library(inknet STATIC SNIActionPerformer.cc ) add_library(ts::inknet ALIAS inknet) -set_target_properties(inknet PROPERTIES POSITION_INDEPENDENT_CODE ON) if(TS_USE_QUIC) add_subdirectory(quic) diff --git a/iocore/net/quic/CMakeLists.txt b/iocore/net/quic/CMakeLists.txt index 5b4af57f84a..9952d761f1d 100644 --- a/iocore/net/quic/CMakeLists.txt +++ b/iocore/net/quic/CMakeLists.txt @@ -32,7 +32,6 @@ add_library(quic STATIC QUICStreamVCAdapter.cc ) add_library(ts::quic ALIAS quic) -set_target_properties(quic PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(quic PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/iocore/utils/CMakeLists.txt b/iocore/utils/CMakeLists.txt index 213e6d1bc9b..3c1a020f623 100644 --- a/iocore/utils/CMakeLists.txt +++ b/iocore/utils/CMakeLists.txt @@ -18,7 +18,6 @@ add_library(inkutils STATIC Machine.cc OneWayMultiTunnel.cc OneWayTunnel.cc) add_library(ts::inkutils ALIAS inkutils) -set_target_properties(inkutils PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(inkutils PRIVATE diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt index c5510b8a0e5..376785dfaae 100644 --- a/proxy/CMakeLists.txt +++ b/proxy/CMakeLists.txt @@ -37,7 +37,6 @@ add_library(proxy STATIC Transform.cc ) add_library(ts::proxy ALIAS proxy) -set_target_properties(proxy PROPERTIES POSITION_INDEPENDENT_CODE ON) if(BUILD_REGRESSION_TESTING) target_sources(proxy PRIVATE RegressionSM.cc) diff --git a/src/api/CMakeLists.txt b/src/api/CMakeLists.txt index 6254451ad94..2180bd272d5 100644 --- a/src/api/CMakeLists.txt +++ b/src/api/CMakeLists.txt @@ -26,7 +26,6 @@ target_link_libraries(tsapi PRIVATE ts::tscore) add_library(tsapicore STATIC Metrics.cc FetchSM.cc) add_library(ts::tsapicore ALIAS tsapicore) target_link_libraries(tsapicore PRIVATE ts::tscore) -set_target_properties(tsapicore PROPERTIES POSITION_INDEPENDENT_CODE ON) include_directories( ${IOCORE_INCLUDE_DIRS} diff --git a/src/records/CMakeLists.txt b/src/records/CMakeLists.txt index e61b7a4cc6a..e6332632c79 100644 --- a/src/records/CMakeLists.txt +++ b/src/records/CMakeLists.txt @@ -31,7 +31,6 @@ add_library(records STATIC RecRawStats.cc ) add_library(ts::records ALIAS records) -set_target_properties(records PROPERTIES POSITION_INDEPENDENT_CODE ON) target_include_directories(records PUBLIC From e25468f78b013b2f16f9264bd28fb4b996b14f1e Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Thu, 7 Sep 2023 14:56:55 +0000 Subject: [PATCH 11/17] moved header files to include/api --- {src => include}/api/FetchSM.h | 0 {proxy => include/api}/InkAPIInternal.h | 0 iocore/aio/test_AIO.cc | 2 +- iocore/cache/Cache.cc | 2 +- iocore/cache/test/stub.cc | 4 ++-- iocore/net/Makefile.am | 1 - iocore/net/OCSPStapling.cc | 2 +- iocore/net/QUICNetVConnection.cc | 2 +- iocore/net/SSLConfig.cc | 2 +- iocore/net/SSLNetVConnection.cc | 2 +- iocore/net/SSLSecret.cc | 2 +- iocore/net/SSLUtils.cc | 2 +- iocore/net/TLSSessionResumptionSupport.cc | 2 +- iocore/net/libinknet_stub.cc | 4 ++-- mgmt/config/FileManager.cc | 2 +- mgmt/rpc/handlers/plugins/Plugins.cc | 2 +- proxy/Plugin.cc | 2 +- proxy/ProxySession.h | 2 +- proxy/Transform.h | 2 +- proxy/http/Http1ClientSession.h | 2 +- proxy/http/HttpSM.h | 2 +- proxy/http/remap/unit-tests/nexthop_test_stubs.cc | 2 +- src/api/FetchSM.cc | 2 +- src/api/InkAPI.cc | 4 ++-- src/traffic_quic/traffic_quic.cc | 4 ++-- src/traffic_server/traffic_server.cc | 2 +- 26 files changed, 27 insertions(+), 28 deletions(-) rename {src => include}/api/FetchSM.h (100%) rename {proxy => include/api}/InkAPIInternal.h (100%) diff --git a/src/api/FetchSM.h b/include/api/FetchSM.h similarity index 100% rename from src/api/FetchSM.h rename to include/api/FetchSM.h diff --git a/proxy/InkAPIInternal.h b/include/api/InkAPIInternal.h similarity index 100% rename from proxy/InkAPIInternal.h rename to include/api/InkAPIInternal.h diff --git a/iocore/aio/test_AIO.cc b/iocore/aio/test_AIO.cc index 8742b5804a4..498162b2410 100644 --- a/iocore/aio/test_AIO.cc +++ b/iocore/aio/test_AIO.cc @@ -22,7 +22,7 @@ */ #include "P_AIO.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "tscore/ink_hw.h" #include "tscore/I_Layout.h" #include "tscore/TSSystemState.h" diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc index d21e4772275..9233da2b0f0 100644 --- a/iocore/cache/Cache.cc +++ b/iocore/cache/Cache.cc @@ -33,7 +33,7 @@ #include "HttpTransactCache.h" #include "HttpSM.h" #include "HttpCacheSM.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "tscore/hugepages.h" diff --git a/iocore/cache/test/stub.cc b/iocore/cache/test/stub.cc index 702f7a19106..87985aa0339 100644 --- a/iocore/cache/test/stub.cc +++ b/iocore/cache/test/stub.cc @@ -38,7 +38,7 @@ initialize_thread_for_http_sessions(EThread *, int) ink_assert(false); } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" void APIHooks::append(INKContInternal *cont) { @@ -213,7 +213,7 @@ INKVConnInternal::INKVConnInternal() : INKContInternal() {} INKVConnInternal::INKVConnInternal(TSEventFunc funcp, TSMutex mutexp) : INKContInternal(funcp, mutexp) {} -#include "../src/api/FetchSM.h" +#include "api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/iocore/net/Makefile.am b/iocore/net/Makefile.am index 616c3a155d7..e9ec2270d96 100644 --- a/iocore/net/Makefile.am +++ b/iocore/net/Makefile.am @@ -29,7 +29,6 @@ AM_CPPFLAGS += \ -I$(abs_top_srcdir)/proxy/shared \ -I$(abs_top_srcdir)/proxy/http \ -I$(abs_top_srcdir)/proxy/http/remap \ - -I$(abs_top_srcdir)/src/api \ $(TS_INCLUDES) \ @OPENSSL_INCLUDES@ \ @YAMLCPP_INCLUDES@ \ diff --git a/iocore/net/OCSPStapling.cc b/iocore/net/OCSPStapling.cc index 375716b6c2f..d117d42b168 100644 --- a/iocore/net/OCSPStapling.cc +++ b/iocore/net/OCSPStapling.cc @@ -34,7 +34,7 @@ #include "P_SSLConfig.h" #include "P_SSLUtils.h" #include "SSLStats.h" -#include "FetchSM.h" +#include "api/FetchSM.h" // Macros for ASN1 and the code in TS_OCSP_* functions were borrowed from OpenSSL 3.1.0 (a92271e03a8d0dee507b6f1e7f49512568b2c7ad), // and were modified to make them compilable with BoringSSL and C++ compiler. diff --git a/iocore/net/QUICNetVConnection.cc b/iocore/net/QUICNetVConnection.cc index 3cf67468380..e909d7f0020 100644 --- a/iocore/net/QUICNetVConnection.cc +++ b/iocore/net/QUICNetVConnection.cc @@ -30,7 +30,7 @@ #include "P_QUICNetVConnection.h" #include "P_QUICPacketHandler.h" #include "P_Net.h" -#include "InkAPIInternal.h" // Added to include the quic_hook definitions +#include "api/InkAPIInternal.h" // Added to include the quic_hook definitions #include "P_SSLNextProtocolSet.h" #include "QUICMultiCertConfigLoader.h" diff --git a/iocore/net/SSLConfig.cc b/iocore/net/SSLConfig.cc index 1353a193662..620c6d68207 100644 --- a/iocore/net/SSLConfig.cc +++ b/iocore/net/SSLConfig.cc @@ -37,7 +37,7 @@ #include "tscore/ink_config.h" #include -#include "InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions +#include "api/InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions #include "tscore/ink_platform.h" #include "tscore/I_Layout.h" diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc index b43bd91a829..3f732481ca1 100644 --- a/iocore/net/SSLNetVConnection.cc +++ b/iocore/net/SSLNetVConnection.cc @@ -26,7 +26,7 @@ #include "tscore/I_Layout.h" #include "tscore/TSSystemState.h" -#include "InkAPIInternal.h" // Added to include the ssl_hook definitions +#include "api/InkAPIInternal.h" // Added to include the ssl_hook definitions #include "HttpTunnel.h" #include "ProxyProtocol.h" #include "HttpConfig.h" diff --git a/iocore/net/SSLSecret.cc b/iocore/net/SSLSecret.cc index f90db39a91c..e0bb8e502cb 100644 --- a/iocore/net/SSLSecret.cc +++ b/iocore/net/SSLSecret.cc @@ -21,7 +21,7 @@ #include "swoc/swoc_file.h" -#include "InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions +#include "api/InkAPIInternal.h" // Added to include the ssl_hook and lifestyle_hook definitions #include "P_SSLConfig.h" #include diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc index d902c88368c..5c056e29775 100644 --- a/iocore/net/SSLUtils.cc +++ b/iocore/net/SSLUtils.cc @@ -35,7 +35,7 @@ #include "records/I_RecHttp.h" #include "P_Net.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "P_OCSPStapling.h" #include "P_SSLConfig.h" diff --git a/iocore/net/TLSSessionResumptionSupport.cc b/iocore/net/TLSSessionResumptionSupport.cc index b4900f25252..79e45611d72 100644 --- a/iocore/net/TLSSessionResumptionSupport.cc +++ b/iocore/net/TLSSessionResumptionSupport.cc @@ -33,7 +33,7 @@ #ifdef HAVE_SSL_CTX_SET_TLSEXT_TICKET_KEY_EVP_CB #include #endif -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "tscore/ink_config.h" // Remove this when drop OpenSSL 1.0.2 support diff --git a/iocore/net/libinknet_stub.cc b/iocore/net/libinknet_stub.cc index dbf506644fc..d836d7dbf91 100644 --- a/iocore/net/libinknet_stub.cc +++ b/iocore/net/libinknet_stub.cc @@ -71,7 +71,7 @@ ParentConfigParams::nextParent(HttpRequestData *, ParentResult *, unsigned int, ink_assert(false); } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" int APIHook::invoke(int, void *) const { @@ -156,7 +156,7 @@ PreWarmManager::reconfigure() PreWarmManager prewarmManager; -#include "../src/api/FetchSM.h" +#include "api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/mgmt/config/FileManager.cc b/mgmt/config/FileManager.cc index b79f689b90c..21c6cb9f8c7 100644 --- a/mgmt/config/FileManager.cc +++ b/mgmt/config/FileManager.cc @@ -25,7 +25,7 @@ #include #include -#include "InkAPIInternal.h" // TODO: this brings a lot of dependencies, double check this. +#include "api/InkAPIInternal.h" // TODO: this brings a lot of dependencies, double check this. #include "tscore/ink_platform.h" #include "tscore/ink_file.h" diff --git a/mgmt/rpc/handlers/plugins/Plugins.cc b/mgmt/rpc/handlers/plugins/Plugins.cc index 92500faf1d3..7d83570f8a9 100644 --- a/mgmt/rpc/handlers/plugins/Plugins.cc +++ b/mgmt/rpc/handlers/plugins/Plugins.cc @@ -21,7 +21,7 @@ #include "Plugins.h" #include "rpc/handlers/common/ErrorUtils.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" namespace { diff --git a/proxy/Plugin.cc b/proxy/Plugin.cc index e0a0bc3dc9e..99a7688cf7b 100644 --- a/proxy/Plugin.cc +++ b/proxy/Plugin.cc @@ -27,7 +27,7 @@ #include "tscore/ParseRules.h" #include "records/I_RecCore.h" #include "tscore/I_Layout.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "Plugin.h" #include "tscore/ink_cap.h" #include "tscore/Filenames.h" diff --git a/proxy/ProxySession.h b/proxy/ProxySession.h index f2115069d57..6bb997a0186 100644 --- a/proxy/ProxySession.h +++ b/proxy/ProxySession.h @@ -28,7 +28,7 @@ #include "tscore/TSSystemState.h" #include #include -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "http/HttpSessionAccept.h" #include "IPAllow.h" #include "private/SSLProxySession.h" diff --git a/proxy/Transform.h b/proxy/Transform.h index c07defce170..cf115e6e269 100644 --- a/proxy/Transform.h +++ b/proxy/Transform.h @@ -25,7 +25,7 @@ #include "I_EventSystem.h" #include "HTTP.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #define TRANSFORM_READ_READY (TRANSFORM_EVENTS_START + 0) diff --git a/proxy/http/Http1ClientSession.h b/proxy/http/Http1ClientSession.h index c36db307250..531b7ab802f 100644 --- a/proxy/http/Http1ClientSession.h +++ b/proxy/http/Http1ClientSession.h @@ -31,7 +31,7 @@ #pragma once -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "HTTP.h" #include "HttpConfig.h" #include "IPAllow.h" diff --git a/proxy/http/HttpSM.h b/proxy/http/HttpSM.h index 883a0ad300c..09f19f25598 100644 --- a/proxy/http/HttpSM.h +++ b/proxy/http/HttpSM.h @@ -43,7 +43,7 @@ #include "HttpVCTable.h" #include "UrlRewrite.h" #include "HttpTunnel.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "../ProxyTransaction.h" #include "HdrUtils.h" #include "tscore/History.h" diff --git a/proxy/http/remap/unit-tests/nexthop_test_stubs.cc b/proxy/http/remap/unit-tests/nexthop_test_stubs.cc index 2f080f29093..ad332574146 100644 --- a/proxy/http/remap/unit-tests/nexthop_test_stubs.cc +++ b/proxy/http/remap/unit-tests/nexthop_test_stubs.cc @@ -166,7 +166,7 @@ HttpRequestData::get_client_ip() return &src_ip.sa; } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" void ConfigUpdateCbTable::invoke(char const *p) { diff --git a/src/api/FetchSM.cc b/src/api/FetchSM.cc index 0fae526bdf5..281e93c182d 100644 --- a/src/api/FetchSM.cc +++ b/src/api/FetchSM.cc @@ -22,7 +22,7 @@ */ #include "tscore/ink_config.h" -#include "FetchSM.h" +#include "api/FetchSM.h" #include #include "HTTP.h" #include "PluginVC.h" diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc index e52b3c445df..bf8117d88fd 100644 --- a/src/api/InkAPI.cc +++ b/src/api/InkAPI.cc @@ -36,7 +36,7 @@ #include "tscore/Diags.h" #include "api/Metrics.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "Log.h" #include "URL.h" #include "MIME.h" @@ -65,7 +65,7 @@ #include "PluginVC.h" #include "HttpSessionAccept.h" #include "PluginVC.h" -#include "FetchSM.h" +#include "api/FetchSM.h" #include "HttpDebugNames.h" #include "I_AIO.h" #include "I_Tasks.h" diff --git a/src/traffic_quic/traffic_quic.cc b/src/traffic_quic/traffic_quic.cc index 6c7c2ddd540..837ff0a72fc 100644 --- a/src/traffic_quic/traffic_quic.cc +++ b/src/traffic_quic/traffic_quic.cc @@ -173,7 +173,7 @@ ParentConfigParams::nextParent(HttpRequestData *, ParentResult *, unsigned int, ink_assert(false); } -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" APIHook * APIHook::next() const @@ -347,7 +347,7 @@ PreWarmManager::reconfigure() PreWarmManager prewarmManager; -#include "../src/api/FetchSM.h" +#include "api/FetchSM.h" ClassAllocator FetchSMAllocator("unusedFetchSMAllocator"); void FetchSM::ext_launch() diff --git a/src/traffic_server/traffic_server.cc b/src/traffic_server/traffic_server.cc index 3d5e107dc34..d80af430d62 100644 --- a/src/traffic_server/traffic_server.cc +++ b/src/traffic_server/traffic_server.cc @@ -98,7 +98,7 @@ extern "C" int plock(int); #include "RemapPluginInfo.h" #include "RemapProcessor.h" #include "I_Tasks.h" -#include "InkAPIInternal.h" +#include "api/InkAPIInternal.h" #include "HTTP2.h" #include "tscore/ink_config.h" #include "P_SSLClientUtils.h" From dc8dd84697bea1f909c27f9a575773df107888f1 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Mon, 11 Sep 2023 14:40:22 +0000 Subject: [PATCH 12/17] Enforce symbol resolution in traffic_server linking stage --- src/traffic_server/CMakeLists.txt | 1 + src/traffic_server/Makefile.inc | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/traffic_server/CMakeLists.txt b/src/traffic_server/CMakeLists.txt index 1c2e1c136f5..b7ca665e0b1 100644 --- a/src/traffic_server/CMakeLists.txt +++ b/src/traffic_server/CMakeLists.txt @@ -54,6 +54,7 @@ target_link_libraries(traffic_server ts::jsonrpc_server ts::rpcpublichandlers ) +target_link_options(traffic_server PRIVATE -Wl,--no-undefined,--no-allow-shlib-undefined) if(TS_USE_QUIC) target_link_libraries(traffic_server diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc index 7025fb5ca75..5654c446552 100644 --- a/src/traffic_server/Makefile.inc +++ b/src/traffic_server/Makefile.inc @@ -41,7 +41,8 @@ traffic_server_traffic_server_CPPFLAGS = \ traffic_server_traffic_server_LDFLAGS = \ $(AM_LDFLAGS) \ @SWOC_LDFLAGS@ \ - @YAMLCPP_LDFLAGS@ + @YAMLCPP_LDFLAGS@ \ + -Wl,--no-undefined,--no-allow-shlib-undefined traffic_server_traffic_server_SOURCES = \ traffic_server/Crash.cc \ From 1f30e954f41d63a46bc4d915320dad0378131dcd Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Mon, 11 Sep 2023 14:51:11 +0000 Subject: [PATCH 13/17] additional cleanup --- src/api/InkAPI.cc | 2 -- src/api/Makefile.am | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc index bf8117d88fd..a8782ebe6b6 100644 --- a/src/api/InkAPI.cc +++ b/src/api/InkAPI.cc @@ -7741,8 +7741,6 @@ tsapi::c::TSMatcherLineValue(TSMatcherLine ml, int element) return (((matcher_line *)ml)->line)[1][element]; } -void load_config_file_callback(const char *parent, const char *remap_file); - void load_config_file_callback(const char *parent_file, const char *remap_file) { diff --git a/src/api/Makefile.am b/src/api/Makefile.am index 6db01f42304..5bedece5e68 100644 --- a/src/api/Makefile.am +++ b/src/api/Makefile.am @@ -26,7 +26,6 @@ noinst_LIBRARIES = libtsapicore.a lib_LTLIBRARIES = libtsapi.la - AM_CPPFLAGS += \ $(iocore_include_dirs) \ -I$(abs_top_srcdir)/include \ @@ -36,7 +35,6 @@ AM_CPPFLAGS += \ -I$(abs_top_srcdir)/proxy/http2 \ -I$(abs_top_srcdir)/proxy/http/remap \ -I$(abs_top_srcdir)/proxy/logging \ - -I$(abs_top_srcdir)/src/traffic_server \ -I$(abs_top_srcdir)/mgmt/rpc \ -I$(abs_top_srcdir)/mgmt/ \ @SWOC_INCLUDES@ \ From 6839f0f3d3033ab56b43c88770862da76c69df14 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Mon, 11 Sep 2023 16:44:51 +0000 Subject: [PATCH 14/17] Exclude macOS for the linker options --- configure.ac | 1 + src/traffic_server/CMakeLists.txt | 7 ++++++- src/traffic_server/Makefile.inc | 10 ++++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9b84930f59a..826151aec77 100644 --- a/configure.ac +++ b/configure.ac @@ -771,6 +771,7 @@ esac TS_ADDTO(AM_CPPFLAGS, [-D$host_os_def]) AM_CONDITIONAL([OS_LINUX], [test "x$host_os_def" = "xlinux"]) +AM_CONDITIONAL([OS_NON_MACOS], [test "x$host_os_def" != "xdarwin"]) dnl AM_PROG_AR is not always available, but it doesn't seem to be needed in older versions. ifdef([AM_PROG_AR], diff --git a/src/traffic_server/CMakeLists.txt b/src/traffic_server/CMakeLists.txt index b7ca665e0b1..b261ace2355 100644 --- a/src/traffic_server/CMakeLists.txt +++ b/src/traffic_server/CMakeLists.txt @@ -54,7 +54,12 @@ target_link_libraries(traffic_server ts::jsonrpc_server ts::rpcpublichandlers ) -target_link_options(traffic_server PRIVATE -Wl,--no-undefined,--no-allow-shlib-undefined) +if(NOT APPLE) + # Skipping apple because macOS doesn't seem to provide an equivalent option + # for disallowing undefined symbols in shared libraries the executable + # depends on. + target_link_options(traffic_server PRIVATE -Wl,--no-undefined,--no-allow-shlib-undefined) +endif() if(TS_USE_QUIC) target_link_libraries(traffic_server diff --git a/src/traffic_server/Makefile.inc b/src/traffic_server/Makefile.inc index 5654c446552..fd4bfb396de 100644 --- a/src/traffic_server/Makefile.inc +++ b/src/traffic_server/Makefile.inc @@ -41,8 +41,14 @@ traffic_server_traffic_server_CPPFLAGS = \ traffic_server_traffic_server_LDFLAGS = \ $(AM_LDFLAGS) \ @SWOC_LDFLAGS@ \ - @YAMLCPP_LDFLAGS@ \ - -Wl,--no-undefined,--no-allow-shlib-undefined + @YAMLCPP_LDFLAGS@ + +if OS_NON_MACOS + # Skipping apple because macOS doesn't seem to provide an equivalent option + # for disallowing undefined symbols in shared libraries the executable + # depends on. + traffic_server_traffic_server_LDFLAGS += -Wl,--no-undefined,--no-allow-shlib-undefined +endif traffic_server_traffic_server_SOURCES = \ traffic_server/Crash.cc \ From 0936df8e7ade7a96d4e8f97ee0823b3ba2435d9d Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 12 Sep 2023 03:46:24 +0000 Subject: [PATCH 15/17] Fixed important missing links per Chris's review. --- cmake/add_atsplugin.cmake | 2 +- tests/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/add_atsplugin.cmake b/cmake/add_atsplugin.cmake index 899d3516943..27f5d8c1de9 100644 --- a/cmake/add_atsplugin.cmake +++ b/cmake/add_atsplugin.cmake @@ -19,7 +19,7 @@ set(CMAKE_SHARED_LIBRARY_PREFIX "") function(add_atsplugin name) add_library(${name} MODULE ${ARGN}) - target_link_libraries(${name} PRIVATE traffic_server) + target_link_libraries(${name} PRIVATE ts::tsapi) set_target_properties(${name} PROPERTIES PREFIX "") set_target_properties(${name} PROPERTIES SUFFIX ".so") install(TARGETS ${name} DESTINATION libexec/trafficserver) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b6e20b090b7..2959346f501 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,7 +22,7 @@ function(ADD_AUTEST_PLUGIN _NAME _SOURCES) PREFIX "" SUFFIX ".so" ) - target_link_libraries(${_NAME} PRIVATE traffic_server) + target_link_libraries(${_NAME} PRIVATE ts::tsapi) endfunction() add_subdirectory(tools/plugins) From 69b127adba29c8a1ddcdbd849d0c218c19680b22 Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 12 Sep 2023 17:49:30 +0000 Subject: [PATCH 16/17] Updated doc for the new plugin API layout --- .../introduction/header-file-structure.en.rst | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/developer-guide/introduction/header-file-structure.en.rst b/doc/developer-guide/introduction/header-file-structure.en.rst index ae7490c2862..607c9d43abe 100644 --- a/doc/developer-guide/introduction/header-file-structure.en.rst +++ b/doc/developer-guide/introduction/header-file-structure.en.rst @@ -18,8 +18,7 @@ Header Files ************ -There are four header directories, each containing header files for different purposes. Three of these -are available to plugins. +The header files are located in the ``include/`` directory. There are several sub-directories, each containing header files for different purposes. Three of these are available to plugins. "ts" The C Plugin API. These call functions directly embedded in ``traffic_server`` and therefore have @@ -43,6 +42,24 @@ are available to plugins. data structures either directly or operationally. This is linked in to the ``traffic_server`` binary therefore has no explicit linkage when used in the core. +"api" + Plugin API internal header files. These are header files for the internal `tsapicore` library(see below). Theses can only be used inside |TS| itself. + +New Plugin API layout +===================== + +Previously, all plugin interfaces were built into the main |TS| binary. In an effort to enhance modularity and enable compile-time checks, these interfaces have been moved to ``src/api``. They are now isolated into a separate shared library ``tsapi.so``. + +In addition, a new static library ``tsapicore.a`` has been created, which contains code used by both the core and the plugins(via the plugin APIs), and is linked into the |TS| binary to keep functionalities consistent. + +Note that `tsapi.so`` depends on `tsapicore.a`` and other static libraries in +the core. `tsapi.so`` is not statically linked against these dependencies during +its creation, but relies on them being linked into |TS|. To verify these +dependencies, a compile-time sanity check links `tsapi.so` with the main Traffic +Server binary (|TS|), ensuring that all symbols required by `tsapi.so` will be +available in |TS|. The actual binding of these dependent symbols occurs +dynamically at runtime when |TS| is launched. + Historical ========== From 69d8c7ba1b5bd1b4cf969ea7fd0b4ea8f1e2048d Mon Sep 17 00:00:00 2001 From: Zhengxi Li Date: Tue, 12 Sep 2023 17:58:54 +0000 Subject: [PATCH 17/17] Reformat docs. --- .../introduction/header-file-structure.en.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/developer-guide/introduction/header-file-structure.en.rst b/doc/developer-guide/introduction/header-file-structure.en.rst index 607c9d43abe..2dd22b795cd 100644 --- a/doc/developer-guide/introduction/header-file-structure.en.rst +++ b/doc/developer-guide/introduction/header-file-structure.en.rst @@ -43,21 +43,21 @@ The header files are located in the ``include/`` directory. There are several su has no explicit linkage when used in the core. "api" - Plugin API internal header files. These are header files for the internal `tsapicore` library(see below). Theses can only be used inside |TS| itself. + Plugin API internal header files. These are header files for the internal ``tsapicore`` library (see below). Theses can only be used inside |TS| itself. New Plugin API layout ===================== Previously, all plugin interfaces were built into the main |TS| binary. In an effort to enhance modularity and enable compile-time checks, these interfaces have been moved to ``src/api``. They are now isolated into a separate shared library ``tsapi.so``. -In addition, a new static library ``tsapicore.a`` has been created, which contains code used by both the core and the plugins(via the plugin APIs), and is linked into the |TS| binary to keep functionalities consistent. +In addition, a new static library ``tsapicore.a`` has been created, which contains code used by both the core and the plugins (via the plugin APIs), and is linked into the |TS| binary to keep functionalities consistent. -Note that `tsapi.so`` depends on `tsapicore.a`` and other static libraries in -the core. `tsapi.so`` is not statically linked against these dependencies during -its creation, but relies on them being linked into |TS|. To verify these -dependencies, a compile-time sanity check links `tsapi.so` with the main Traffic -Server binary (|TS|), ensuring that all symbols required by `tsapi.so` will be -available in |TS|. The actual binding of these dependent symbols occurs +Note that ``tsapi.so`` depends on ``tsapicore.a`` and other static libraries in +the core. ``tsapi.so`` is not statically linked against these dependencies +during its creation, but relies on them being linked into |TS|. To verify these +dependencies, a compile-time sanity check links ``tsapi.so`` with the main +Traffic Server binary (|TS|), ensuring all symbols required by ``tsapi.so`` will +be available in |TS|. The actual binding of these dependent symbols occurs dynamically at runtime when |TS| is launched. Historical