From 55f6c351193ff5aa17a2729bd58d6e74fcd17933 Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Wed, 8 May 2013 17:16:42 -0700 Subject: [PATCH 1/5] [2899] move interprocess-lock related things under lib/log/interprocess also - a utility for tests using multi processes was moved under lib/util/unittests - other Makefile adjustments --- configure.ac | 2 + src/lib/log/Makefile.am | 4 +- src/lib/log/interprocess/Makefile.am | 19 ++++++++++ .../interprocess}/interprocess_sync.h | 6 ++- .../interprocess}/interprocess_sync_file.cc | 8 ++-- .../interprocess}/interprocess_sync_file.h | 8 ++-- .../interprocess}/interprocess_sync_null.cc | 8 ++-- .../interprocess}/interprocess_sync_null.h | 8 ++-- src/lib/log/interprocess/tests/Makefile.am | 37 +++++++++++++++++++ .../tests/interprocess_sync_file_unittest.cc | 14 +++---- .../tests/interprocess_sync_null_unittest.cc | 9 ++--- .../log/interprocess/tests/run_unittests.cc | 25 +++++++++++++ src/lib/log/logger.cc | 2 +- src/lib/log/logger.h | 5 +-- src/lib/log/logger_impl.cc | 9 ++--- src/lib/log/logger_impl.h | 7 ++-- src/lib/log/logger_manager.cc | 5 ++- src/lib/log/tests/Makefile.am | 5 --- src/lib/log/tests/buffer_logger_test.cc | 5 ++- src/lib/log/tests/logger_example.cc | 10 ++--- src/lib/log/tests/logger_lock_test.cc | 4 +- src/lib/log/tests/logger_unittest.cc | 5 +-- src/lib/util/Makefile.am | 4 -- src/lib/util/tests/Makefile.am | 3 -- .../tests/memory_segment_mapped_unittest.cc | 4 +- src/lib/util/tests/run_unittests.cc | 1 - src/lib/util/unittests/Makefile.am | 1 + .../{tests => unittests}/interprocess_util.cc | 2 +- .../{tests => unittests}/interprocess_util.h | 2 +- 29 files changed, 148 insertions(+), 74 deletions(-) create mode 100644 src/lib/log/interprocess/Makefile.am rename src/lib/{util => log/interprocess}/interprocess_sync.h (98%) rename src/lib/{util => log/interprocess}/interprocess_sync_file.cc (96%) rename src/lib/{util => log/interprocess}/interprocess_sync_file.h (95%) rename src/lib/{util => log/interprocess}/interprocess_sync_null.cc (89%) rename src/lib/{util => log/interprocess}/interprocess_sync_null.h (93%) create mode 100644 src/lib/log/interprocess/tests/Makefile.am rename src/lib/{util => log/interprocess}/tests/interprocess_sync_file_unittest.cc (95%) rename src/lib/{util => log/interprocess}/tests/interprocess_sync_null_unittest.cc (95%) create mode 100644 src/lib/log/interprocess/tests/run_unittests.cc rename src/lib/util/{tests => unittests}/interprocess_util.cc (98%) rename src/lib/util/{tests => unittests}/interprocess_util.h (98%) diff --git a/configure.ac b/configure.ac index af6395818c..df7b08a4dc 100644 --- a/configure.ac +++ b/configure.ac @@ -1294,6 +1294,8 @@ AC_CONFIG_FILES([Makefile src/lib/xfr/Makefile src/lib/xfr/tests/Makefile src/lib/log/Makefile + src/lib/log/interprocess/Makefile + src/lib/log/interprocess/tests/Makefile src/lib/log/compiler/Makefile src/lib/log/tests/Makefile src/lib/resolve/Makefile diff --git a/src/lib/log/Makefile.am b/src/lib/log/Makefile.am index 18d5f909ae..cc00bebc24 100644 --- a/src/lib/log/Makefile.am +++ b/src/lib/log/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = . compiler tests +SUBDIRS = interprocess . compiler tests AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib AM_CPPFLAGS += $(BOOST_INCLUDES) @@ -49,6 +49,6 @@ libb10_log_la_CXXFLAGS += -Wno-error endif libb10_log_la_CPPFLAGS = $(AM_CPPFLAGS) $(LOG4CPLUS_INCLUDES) libb10_log_la_LIBADD = $(top_builddir)/src/lib/util/libb10-util.la -libb10_log_la_LIBADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la +libb10_log_la_LIBADD += interprocess/libb10-log_interprocess.la libb10_log_la_LIBADD += $(LOG4CPLUS_LIBS) libb10_log_la_LDFLAGS = -no-undefined -version-info 1:0:0 diff --git a/src/lib/log/interprocess/Makefile.am b/src/lib/log/interprocess/Makefile.am new file mode 100644 index 0000000000..ad7ad86247 --- /dev/null +++ b/src/lib/log/interprocess/Makefile.am @@ -0,0 +1,19 @@ +SUBDIRS = . tests + +AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib +AM_CPPFLAGS += -DLOCKFILE_DIR=\"${localstatedir}/${PACKAGE_NAME}\" +AM_CPPFLAGS += $(BOOST_INCLUDES) + +AM_CXXFLAGS = $(B10_CXXFLAGS) + +CLEANFILES = *.gcno *.gcda + +noinst_LTLIBRARIES = libb10-log_interprocess.la + +libb10_log_interprocess_la_SOURCES = interprocess_sync.h +libb10_log_interprocess_la_SOURCES += interprocess_sync_file.h +libb10_log_interprocess_la_SOURCES += interprocess_sync_file.cc +libb10_log_interprocess_la_SOURCES += interprocess_sync_null.h +libb10_log_interprocess_la_SOURCES += interprocess_sync_null.cc + +libb10_log_interprocess_la_LIBADD = $(top_builddir)/src/lib/util/threads/libb10-threads.la diff --git a/src/lib/util/interprocess_sync.h b/src/lib/log/interprocess/interprocess_sync.h similarity index 98% rename from src/lib/util/interprocess_sync.h rename to src/lib/log/interprocess/interprocess_sync.h index f55f0ac5ca..6f31a016b5 100644 --- a/src/lib/util/interprocess_sync.h +++ b/src/lib/log/interprocess/interprocess_sync.h @@ -18,7 +18,8 @@ #include namespace isc { -namespace util { +namespace log { +namespace internal { class InterprocessSyncLocker; // forward declaration @@ -143,7 +144,8 @@ protected: InterprocessSync& sync_; ///< Ref to underlying sync object }; -} // namespace util +} // namespace internal +} // namespace log } // namespace isc #endif // INTERPROCESS_SYNC_H diff --git a/src/lib/util/interprocess_sync_file.cc b/src/lib/log/interprocess/interprocess_sync_file.cc similarity index 96% rename from src/lib/util/interprocess_sync_file.cc rename to src/lib/log/interprocess/interprocess_sync_file.cc index 25af55cb37..64b1c42e77 100644 --- a/src/lib/util/interprocess_sync_file.cc +++ b/src/lib/log/interprocess/interprocess_sync_file.cc @@ -12,7 +12,7 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include "interprocess_sync_file.h" +#include #include #include @@ -26,7 +26,8 @@ #include namespace isc { -namespace util { +namespace log { +namespace internal { InterprocessSyncFile::~InterprocessSyncFile() { if (fd_ != -1) { @@ -128,5 +129,6 @@ InterprocessSyncFile::unlock() { return (false); } -} // namespace util +} // namespace internal +} // namespace log } // namespace isc diff --git a/src/lib/util/interprocess_sync_file.h b/src/lib/log/interprocess/interprocess_sync_file.h similarity index 95% rename from src/lib/util/interprocess_sync_file.h rename to src/lib/log/interprocess/interprocess_sync_file.h index 153b39164f..1f9fdb1a3d 100644 --- a/src/lib/util/interprocess_sync_file.h +++ b/src/lib/log/interprocess/interprocess_sync_file.h @@ -15,11 +15,12 @@ #ifndef INTERPROCESS_SYNC_FILE_H #define INTERPROCESS_SYNC_FILE_H -#include +#include #include namespace isc { -namespace util { +namespace log { +namespace internal { /// \brief InterprocessSyncFileError /// @@ -85,7 +86,8 @@ private: int fd_; ///< The descriptor for the open file }; -} // namespace util +} // namespace internal +} // namespace log } // namespace isc #endif // INTERPROCESS_SYNC_FILE_H diff --git a/src/lib/util/interprocess_sync_null.cc b/src/lib/log/interprocess/interprocess_sync_null.cc similarity index 89% rename from src/lib/util/interprocess_sync_null.cc rename to src/lib/log/interprocess/interprocess_sync_null.cc index 5355d5727e..bb32ea93f3 100644 --- a/src/lib/util/interprocess_sync_null.cc +++ b/src/lib/log/interprocess/interprocess_sync_null.cc @@ -12,10 +12,11 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include "interprocess_sync_null.h" +#include namespace isc { -namespace util { +namespace log { +namespace internal { InterprocessSyncNull::~InterprocessSyncNull() { } @@ -38,5 +39,6 @@ InterprocessSyncNull::unlock() { return (true); } -} // namespace util +} // namespace internal +} // namespace log } // namespace isc diff --git a/src/lib/util/interprocess_sync_null.h b/src/lib/log/interprocess/interprocess_sync_null.h similarity index 93% rename from src/lib/util/interprocess_sync_null.h rename to src/lib/log/interprocess/interprocess_sync_null.h index be775148e0..5c74bbd436 100644 --- a/src/lib/util/interprocess_sync_null.h +++ b/src/lib/log/interprocess/interprocess_sync_null.h @@ -15,10 +15,11 @@ #ifndef INTERPROCESS_SYNC_NULL_H #define INTERPROCESS_SYNC_NULL_H -#include +#include namespace isc { -namespace util { +namespace log { +namespace internal { /// \brief Null Interprocess Sync Class /// @@ -58,7 +59,8 @@ protected: bool unlock(); }; -} // namespace util +} // namespace internal +} // namespace log } // namespace isc #endif // INTERPROCESS_SYNC_NULL_H diff --git a/src/lib/log/interprocess/tests/Makefile.am b/src/lib/log/interprocess/tests/Makefile.am new file mode 100644 index 0000000000..3013f99765 --- /dev/null +++ b/src/lib/log/interprocess/tests/Makefile.am @@ -0,0 +1,37 @@ +SUBDIRS = . + +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += $(BOOST_INCLUDES) +# XXX: we'll pollute the top builddir for creating a temporary test file +# used to bind a UNIX domain socket so we can minimize the risk of exceeding +# the limit of file name path size. +AM_CPPFLAGS += -DTEST_DATA_TOPBUILDDIR=\"$(abs_top_builddir)\" +AM_CXXFLAGS = $(B10_CXXFLAGS) + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +CLEANFILES = *.gcno *.gcda + +TESTS_ENVIRONMENT = \ + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + +TESTS = +if HAVE_GTEST +TESTS += run_unittests +run_unittests_SOURCES = run_unittests.cc +run_unittests_SOURCES += interprocess_sync_file_unittest.cc +run_unittests_SOURCES += interprocess_sync_null_unittest.cc + +run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) +run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) + +run_unittests_LDADD = ../libb10-log_interprocess.la +run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la +run_unittests_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la +run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la +run_unittests_LDADD += $(GTEST_LDADD) +endif + +noinst_PROGRAMS = $(TESTS) diff --git a/src/lib/util/tests/interprocess_sync_file_unittest.cc b/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc similarity index 95% rename from src/lib/util/tests/interprocess_sync_file_unittest.cc rename to src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc index 38d9026f37..ea8f9ace0a 100644 --- a/src/lib/util/tests/interprocess_sync_file_unittest.cc +++ b/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc @@ -12,18 +12,16 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include +#include #include -#include +#include #include #include using namespace std; -using isc::util::test::parentReadState; - -namespace isc { -namespace util { +using namespace isc::log::internal; +using isc::util::unittests::parentReadState; namespace { TEST(InterprocessSyncFileTest, TestLock) { @@ -150,6 +148,4 @@ TEST(InterprocessSyncFileTest, TestMultipleFilesForked) { EXPECT_EQ (0, unlink(TEST_DATA_TOPBUILDDIR "/test1_lockfile")); } -} // anonymous namespace -} // namespace util -} // namespace isc +} // unnamed namespace diff --git a/src/lib/util/tests/interprocess_sync_null_unittest.cc b/src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc similarity index 95% rename from src/lib/util/tests/interprocess_sync_null_unittest.cc rename to src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc index 70e2b07f0e..2552a84086 100644 --- a/src/lib/util/tests/interprocess_sync_null_unittest.cc +++ b/src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc @@ -12,13 +12,13 @@ // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR // PERFORMANCE OF THIS SOFTWARE. -#include "util/interprocess_sync_null.h" +#include #include using namespace std; +using namespace isc::log::internal; -namespace isc { -namespace util { +namespace { TEST(InterprocessSyncNullTest, TestNull) { InterprocessSyncNull sync("test1"); @@ -72,5 +72,4 @@ TEST(InterprocessSyncNullTest, TestNull) { EXPECT_TRUE(locker.unlock()); } -} // namespace util -} // namespace isc +} diff --git a/src/lib/log/interprocess/tests/run_unittests.cc b/src/lib/log/interprocess/tests/run_unittests.cc new file mode 100644 index 0000000000..03fb3220d1 --- /dev/null +++ b/src/lib/log/interprocess/tests/run_unittests.cc @@ -0,0 +1,25 @@ +// Copyright (C) 2013 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include + +int +main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + + setenv("B10_LOCKFILE_DIR_FROM_BUILD", TEST_DATA_TOPBUILDDIR, 1); + return (isc::util::unittests::run_all()); +} diff --git a/src/lib/log/logger.cc b/src/lib/log/logger.cc index fef5627c8a..1c65b382ab 100644 --- a/src/lib/log/logger.cc +++ b/src/lib/log/logger.cc @@ -182,7 +182,7 @@ Logger::fatal(const isc::log::MessageID& ident) { // Replace the interprocess synchronization object void -Logger::setInterprocessSync(isc::util::InterprocessSync* sync) { +Logger::setInterprocessSync(isc::log::internal::InterprocessSync* sync) { getLoggerPtr()->setInterprocessSync(sync); } diff --git a/src/lib/log/logger.h b/src/lib/log/logger.h index e3ba163995..7cb755b246 100644 --- a/src/lib/log/logger.h +++ b/src/lib/log/logger.h @@ -24,8 +24,7 @@ #include #include #include - -#include +#include namespace isc { namespace log { @@ -258,7 +257,7 @@ public: /// synchronizing output of log messages. It should be deletable and /// the ownership is transferred to the logger. If NULL is passed, /// a BadInterprocessSync exception is thrown. - void setInterprocessSync(isc::util::InterprocessSync* sync); + void setInterprocessSync(isc::log::internal::InterprocessSync* sync); /// \brief Equality /// diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc index 936373809d..06a91b04c8 100644 --- a/src/lib/log/logger_impl.cc +++ b/src/lib/log/logger_impl.cc @@ -32,16 +32,15 @@ #include #include #include +#include #include -#include // Note: as log4cplus and the BIND 10 logger have many concepts in common, and // thus many similar names, to disambiguate types we don't "use" the log4cplus // namespace: instead, all log4cplus types are explicitly qualified. using namespace std; -using namespace isc::util; namespace isc { namespace log { @@ -54,7 +53,7 @@ namespace log { LoggerImpl::LoggerImpl(const string& name) : name_(expandLoggerName(name)), logger_(log4cplus::Logger::getInstance(name_)), - sync_(new InterprocessSyncFile("logger")) + sync_(new internal::InterprocessSyncFile("logger")) { } @@ -112,7 +111,7 @@ LoggerImpl::lookupMessage(const MessageID& ident) { // Replace the interprocess synchronization object void -LoggerImpl::setInterprocessSync(isc::util::InterprocessSync* sync) { +LoggerImpl::setInterprocessSync(isc::log::internal::InterprocessSync* sync) { if (sync == NULL) { isc_throw(BadInterprocessSync, "NULL was passed to setInterprocessSync()"); @@ -130,7 +129,7 @@ LoggerImpl::outputRaw(const Severity& severity, const string& message) { // Use an interprocess sync locker for mutual exclusion from other // processes to avoid log messages getting interspersed. - InterprocessSyncLocker locker(*sync_); + internal::InterprocessSyncLocker locker(*sync_); if (!locker.lock()) { LOG4CPLUS_ERROR(logger_, "Unable to lock logger lockfile"); diff --git a/src/lib/log/logger_impl.h b/src/lib/log/logger_impl.h index 7280d5ce8f..07b681520a 100644 --- a/src/lib/log/logger_impl.h +++ b/src/lib/log/logger_impl.h @@ -31,8 +31,7 @@ // BIND-10 logger files #include #include - -#include +#include namespace isc { namespace log { @@ -178,7 +177,7 @@ public: /// synchronizing output of log messages. It should be deletable and /// the ownership is transferred to the logger implementation. /// If NULL is passed, a BadInterprocessSync exception is thrown. - void setInterprocessSync(isc::util::InterprocessSync* sync); + void setInterprocessSync(isc::log::internal::InterprocessSync* sync); /// \brief Equality /// @@ -193,7 +192,7 @@ public: private: std::string name_; ///< Full name of this logger log4cplus::Logger logger_; ///< Underlying log4cplus logger - isc::util::InterprocessSync* sync_; + isc::log::internal::InterprocessSync* sync_; }; } // namespace log diff --git a/src/lib/log/logger_manager.cc b/src/lib/log/logger_manager.cc index 085744163c..3f56d59fa1 100644 --- a/src/lib/log/logger_manager.cc +++ b/src/lib/log/logger_manager.cc @@ -28,7 +28,7 @@ #include #include #include -#include "util/interprocess_sync_null.h" +#include using namespace std; @@ -157,7 +157,8 @@ LoggerManager::readLocalMessageFile(const char* file) { // be used by standalone programs which may not have write access to // the local state directory (to create lock files). So we switch to // using a null interprocess sync object here. - logger.setInterprocessSync(new isc::util::InterprocessSyncNull("logger")); + logger.setInterprocessSync( + new isc::log::internal::InterprocessSyncNull("logger")); try { diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am index 306d5f91e4..fbb2217747 100644 --- a/src/lib/log/tests/Makefile.am +++ b/src/lib/log/tests/Makefile.am @@ -25,7 +25,6 @@ logger_example_CPPFLAGS = $(AM_CPPFLAGS) logger_example_LDFLAGS = $(AM_LDFLAGS) logger_example_LDADD = $(top_builddir)/src/lib/log/libb10-log.la logger_example_LDADD += $(top_builddir)/src/lib/util/libb10-util.la -logger_example_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la logger_example_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la logger_example_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS) @@ -35,7 +34,6 @@ init_logger_test_CPPFLAGS = $(AM_CPPFLAGS) init_logger_test_LDFLAGS = $(AM_LDFLAGS) init_logger_test_LDADD = $(top_builddir)/src/lib/log/libb10-log.la init_logger_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la -init_logger_test_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la init_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la init_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS) @@ -45,7 +43,6 @@ buffer_logger_test_CPPFLAGS = $(AM_CPPFLAGS) buffer_logger_test_LDFLAGS = $(AM_LDFLAGS) buffer_logger_test_LDADD = $(top_builddir)/src/lib/log/libb10-log.la buffer_logger_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la -buffer_logger_test_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la buffer_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la buffer_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS) @@ -56,7 +53,6 @@ logger_lock_test_CPPFLAGS = $(AM_CPPFLAGS) logger_lock_test_LDFLAGS = $(AM_LDFLAGS) logger_lock_test_LDADD = $(top_builddir)/src/lib/log/libb10-log.la logger_lock_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la -logger_lock_test_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la logger_lock_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la logger_lock_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS) @@ -75,7 +71,6 @@ AM_CPPFLAGS += $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) AM_LDFLAGS += $(GTEST_LDFLAGS) AM_LDADD += $(top_builddir)/src/lib/util/libb10-util.la -AM_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la AM_LDADD += $(top_builddir)/src/lib/log/libb10-log.la AM_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la AM_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la diff --git a/src/lib/log/tests/buffer_logger_test.cc b/src/lib/log/tests/buffer_logger_test.cc index 8d1b3cf519..9e43bc3d8c 100644 --- a/src/lib/log/tests/buffer_logger_test.cc +++ b/src/lib/log/tests/buffer_logger_test.cc @@ -16,7 +16,7 @@ #include #include #include -#include +#include using namespace isc::log; @@ -58,7 +58,8 @@ main(int argc, char** argv) { initLogger("buffertest", isc::log::INFO, 0, NULL, true); Logger logger("log"); // No need for file interprocess locking in this test - logger.setInterprocessSync(new isc::util::InterprocessSyncNull("logger")); + logger.setInterprocessSync( + new isc::log::internal::InterprocessSyncNull("logger")); LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); LOG_DEBUG(logger, 50, LOG_BAD_DESTINATION).arg("debug-50"); LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); diff --git a/src/lib/log/tests/logger_example.cc b/src/lib/log/tests/logger_example.cc index 4b2042951c..81007124e0 100644 --- a/src/lib/log/tests/logger_example.cc +++ b/src/lib/log/tests/logger_example.cc @@ -41,11 +41,11 @@ // Include a set of message definitions. #include -#include "util/interprocess_sync_null.h" +#include using namespace isc::log; using namespace std; - +using isc::log::internal::InterprocessSyncNull; // Print usage information @@ -286,11 +286,11 @@ int main(int argc, char** argv) { // have write access to a local state directory to create // lockfiles). isc::log::Logger logger_ex(ROOT_NAME); - logger_ex.setInterprocessSync(new isc::util::InterprocessSyncNull("logger")); + logger_ex.setInterprocessSync(new InterprocessSyncNull("logger")); isc::log::Logger logger_alpha("alpha"); - logger_alpha.setInterprocessSync(new isc::util::InterprocessSyncNull("logger")); + logger_alpha.setInterprocessSync(new InterprocessSyncNull("logger")); isc::log::Logger logger_beta("beta"); - logger_beta.setInterprocessSync(new isc::util::InterprocessSyncNull("logger")); + logger_beta.setInterprocessSync(new InterprocessSyncNull("logger")); LOG_FATAL(logger_ex, LOG_WRITE_ERROR).arg("test1").arg("42"); LOG_ERROR(logger_ex, LOG_READING_LOCAL_FILE).arg("dummy/file"); diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc index 7fed5c7921..2e4001586f 100644 --- a/src/lib/log/tests/logger_lock_test.cc +++ b/src/lib/log/tests/logger_lock_test.cc @@ -16,7 +16,7 @@ #include #include #include -#include "util/interprocess_sync.h" +#include #include "log_test_messages.h" #include @@ -24,7 +24,7 @@ using namespace std; using namespace isc::log; using isc::util::thread::Mutex; -class MockLoggingSync : public isc::util::InterprocessSync { +class MockLoggingSync : public isc::log::internal::InterprocessSync { public: /// \brief Constructor MockLoggingSync(const std::string& component_name) : diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc index 7b62d7923a..eef22a0e5a 100644 --- a/src/lib/log/tests/logger_unittest.cc +++ b/src/lib/log/tests/logger_unittest.cc @@ -20,10 +20,9 @@ #include #include #include +#include #include "log/tests/log_test_messages.h" -#include - #include #include @@ -391,7 +390,7 @@ TEST_F(LoggerTest, setInterprocessSync) { EXPECT_THROW(logger.setInterprocessSync(NULL), BadInterprocessSync); } -class MockSync : public isc::util::InterprocessSync { +class MockSync : public isc::log::internal::InterprocessSync { public: /// \brief Constructor MockSync(const std::string& component_name) : diff --git a/src/lib/util/Makefile.am b/src/lib/util/Makefile.am index 32a93415ff..ff5ef40bc8 100644 --- a/src/lib/util/Makefile.am +++ b/src/lib/util/Makefile.am @@ -4,7 +4,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_srcdir)/src/lib/util -I$(top_builddir)/src/lib/util AM_CPPFLAGS += -I$(top_srcdir)/src/lib/exceptions -I$(top_builddir)/src/lib/exceptions AM_CPPFLAGS += $(BOOST_INCLUDES) -AM_CPPFLAGS += -DLOCKFILE_DIR=\"${localstatedir}/${PACKAGE_NAME}\" AM_CXXFLAGS = $(B10_CXXFLAGS) # If we use the shared-memory support, corresponding Boost library may # cause build failures especially if it's strict about warnings. We've @@ -25,9 +24,6 @@ libb10_util_la_SOURCES += locks.h lru_list.h libb10_util_la_SOURCES += strutil.h strutil.cc libb10_util_la_SOURCES += buffer.h io_utilities.h libb10_util_la_SOURCES += time_utilities.h time_utilities.cc -libb10_util_la_SOURCES += interprocess_sync.h -libb10_util_la_SOURCES += interprocess_sync_file.h interprocess_sync_file.cc -libb10_util_la_SOURCES += interprocess_sync_null.h interprocess_sync_null.cc libb10_util_la_SOURCES += memory_segment.h libb10_util_la_SOURCES += memory_segment_local.h memory_segment_local.cc if USE_SHARED_MEMORY diff --git a/src/lib/util/tests/Makefile.am b/src/lib/util/tests/Makefile.am index 3ee16f9280..ab85fa2021 100644 --- a/src/lib/util/tests/Makefile.am +++ b/src/lib/util/tests/Makefile.am @@ -31,8 +31,6 @@ run_unittests_SOURCES += filename_unittest.cc run_unittests_SOURCES += hex_unittest.cc run_unittests_SOURCES += io_utilities_unittest.cc run_unittests_SOURCES += lru_list_unittest.cc -run_unittests_SOURCES += interprocess_sync_file_unittest.cc -run_unittests_SOURCES += interprocess_sync_null_unittest.cc run_unittests_SOURCES += memory_segment_local_unittest.cc if USE_SHARED_MEMORY run_unittests_SOURCES += memory_segment_mapped_unittest.cc @@ -46,7 +44,6 @@ run_unittests_SOURCES += socketsession_unittest.cc run_unittests_SOURCES += strutil_unittest.cc run_unittests_SOURCES += time_utilities_unittest.cc run_unittests_SOURCES += range_utilities_unittest.cc -run_unittests_SOURCES += interprocess_util.h interprocess_util.cc run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) diff --git a/src/lib/util/tests/memory_segment_mapped_unittest.cc b/src/lib/util/tests/memory_segment_mapped_unittest.cc index 1d9979de9e..2670f859be 100644 --- a/src/lib/util/tests/memory_segment_mapped_unittest.cc +++ b/src/lib/util/tests/memory_segment_mapped_unittest.cc @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ using namespace isc::util; using boost::scoped_ptr; -using isc::util::test::parentReadState; +using isc::util::unittests::parentReadState; namespace { // Shortcut to keep code shorter diff --git a/src/lib/util/tests/run_unittests.cc b/src/lib/util/tests/run_unittests.cc index 8789a9c116..41761ca272 100644 --- a/src/lib/util/tests/run_unittests.cc +++ b/src/lib/util/tests/run_unittests.cc @@ -20,6 +20,5 @@ int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); - setenv("B10_LOCKFILE_DIR_FROM_BUILD", TEST_DATA_TOPBUILDDIR, 1); return (isc::util::unittests::run_all()); } diff --git a/src/lib/util/unittests/Makefile.am b/src/lib/util/unittests/Makefile.am index 55e0372977..657c2aabb3 100644 --- a/src/lib/util/unittests/Makefile.am +++ b/src/lib/util/unittests/Makefile.am @@ -11,6 +11,7 @@ libutil_unittests_la_SOURCES += check_valgrind.h check_valgrind.cc libutil_unittests_la_SOURCES += run_all.h run_all.cc libutil_unittests_la_SOURCES += textdata.h libutil_unittests_la_SOURCES += wiredata.h wiredata.cc +libutil_unittests_la_SOURCES += interprocess_util.h interprocess_util.cc endif # For now, this isn't needed for libutil_unittests diff --git a/src/lib/util/tests/interprocess_util.cc b/src/lib/util/unittests/interprocess_util.cc similarity index 98% rename from src/lib/util/tests/interprocess_util.cc rename to src/lib/util/unittests/interprocess_util.cc index dfb04b7146..ce858d4971 100644 --- a/src/lib/util/tests/interprocess_util.cc +++ b/src/lib/util/unittests/interprocess_util.cc @@ -19,7 +19,7 @@ namespace isc { namespace util { -namespace test { +namespace unittests { unsigned char parentReadState(int fd) { diff --git a/src/lib/util/tests/interprocess_util.h b/src/lib/util/unittests/interprocess_util.h similarity index 98% rename from src/lib/util/tests/interprocess_util.h rename to src/lib/util/unittests/interprocess_util.h index 286f9cf8ef..f25ad3e820 100644 --- a/src/lib/util/tests/interprocess_util.h +++ b/src/lib/util/unittests/interprocess_util.h @@ -14,7 +14,7 @@ namespace isc { namespace util { -namespace test { +namespace unittests { /// \brief A helper utility for a simple synchronization with another process. /// /// It waits for incoming data on a given file descriptor up to 5 seconds From 00cd04ff09dd403968633193ad51ce81bbd1c5d1 Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Wed, 8 May 2013 20:15:10 -0700 Subject: [PATCH 2/5] [2899] hide the interprocess stuff from public log API more. - not include the header file, but use a forward declaration - added a note that setInterprocessSync shouldn't be used by normal apps --- src/lib/log/logger.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib/log/logger.h b/src/lib/log/logger.h index 7cb755b246..e4879cfb64 100644 --- a/src/lib/log/logger.h +++ b/src/lib/log/logger.h @@ -24,10 +24,14 @@ #include #include #include -#include namespace isc { namespace log { +namespace internal { +// Forward declaration to hide implementation details from normal +// applications. +class InterprocessSync; +} /// \page LoggingApi Logging API /// \section LoggingApiOverview Overview @@ -253,6 +257,11 @@ public: /// If this method is called with NULL as the argument, it throws a /// BadInterprocessSync exception. /// + /// \note This method is intended to be used only within this log library + /// and its tests. Normal application shouldn't use it (in fact, + /// normal application shouldn't even be able to instantiate + /// InterprocessSync objects). + /// /// \param sync The logger uses this synchronization object for /// synchronizing output of log messages. It should be deletable and /// the ownership is transferred to the logger. If NULL is passed, From 6ed2d962ac93a626c7fe4494a0a060858c4125d0 Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Wed, 8 May 2013 20:21:58 -0700 Subject: [PATCH 3/5] [2899] added a README file explaining the intent of the interproc stuff --- src/lib/log/interprocess/Makefile.am | 2 ++ src/lib/log/interprocess/README | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/lib/log/interprocess/README diff --git a/src/lib/log/interprocess/Makefile.am b/src/lib/log/interprocess/Makefile.am index ad7ad86247..567ff091ed 100644 --- a/src/lib/log/interprocess/Makefile.am +++ b/src/lib/log/interprocess/Makefile.am @@ -17,3 +17,5 @@ libb10_log_interprocess_la_SOURCES += interprocess_sync_null.h libb10_log_interprocess_la_SOURCES += interprocess_sync_null.cc libb10_log_interprocess_la_LIBADD = $(top_builddir)/src/lib/util/threads/libb10-threads.la + +EXTRA_DIST = README diff --git a/src/lib/log/interprocess/README b/src/lib/log/interprocess/README new file mode 100644 index 0000000000..e910a3a922 --- /dev/null +++ b/src/lib/log/interprocess/README @@ -0,0 +1,13 @@ +The files in this directory implement a helper sub-library of the +inter process locking for the log library. We use our own locks +because such locks are only available in relatively recent versions of +log4cplus. Also (against our usual practice) we somehow re-invented +an in-house version of such a general purose library rather than +existing proven tools such as boost::interprocess. While we decided +to go with the in-house version for the log library at least until we +completely swith to log4cplus's native lock support, no other BIND 10 +module should use this; they should use existing external +tools/libraries. + +This sub-library is therefore "hidden" here. As such, none of these +files should be installed. From eacf6593309211e0cdc1867d69d4eeae86bc450c Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Thu, 9 May 2013 20:21:05 +0000 Subject: [PATCH 4/5] [2899] explicitly LDADD libb10-threads from log lock test seems to be necessary for some OS. also explicitly include the relevant header file. --- src/lib/log/tests/Makefile.am | 3 +++ src/lib/log/tests/logger_lock_test.cc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am index fbb2217747..36582e6d23 100644 --- a/src/lib/log/tests/Makefile.am +++ b/src/lib/log/tests/Makefile.am @@ -46,6 +46,8 @@ buffer_logger_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la buffer_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la buffer_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS) +# This test directly uses libb10-threads, and on some systems it seems to +# require explicit LDADD (even if libb10-log has indirect dependencies) noinst_PROGRAMS += logger_lock_test logger_lock_test_SOURCES = logger_lock_test.cc nodist_logger_lock_test_SOURCES = log_test_messages.cc log_test_messages.h @@ -53,6 +55,7 @@ logger_lock_test_CPPFLAGS = $(AM_CPPFLAGS) logger_lock_test_LDFLAGS = $(AM_LDFLAGS) logger_lock_test_LDADD = $(top_builddir)/src/lib/log/libb10-log.la logger_lock_test_LDADD += $(top_builddir)/src/lib/util/libb10-util.la +logger_lock_test_LDADD += $(top_builddir)/src/lib/util/threads/libb10-threads.la logger_lock_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la logger_lock_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS) diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc index 2e4001586f..605c2070df 100644 --- a/src/lib/log/tests/logger_lock_test.cc +++ b/src/lib/log/tests/logger_lock_test.cc @@ -18,6 +18,8 @@ #include #include #include "log_test_messages.h" + +#include #include using namespace std; From 3471a0a39ec45a25c96905ce634e142fd4a06902 Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Thu, 9 May 2013 15:32:31 -0700 Subject: [PATCH 5/5] [2899] renamed namespace for InterprocessSync "interprocess" for consistency. --- src/lib/log/interprocess/interprocess_sync.h | 4 ++-- src/lib/log/interprocess/interprocess_sync_file.cc | 4 ++-- src/lib/log/interprocess/interprocess_sync_file.h | 4 ++-- src/lib/log/interprocess/interprocess_sync_null.cc | 4 ++-- src/lib/log/interprocess/interprocess_sync_null.h | 4 ++-- .../interprocess/tests/interprocess_sync_file_unittest.cc | 2 +- .../interprocess/tests/interprocess_sync_null_unittest.cc | 2 +- src/lib/log/logger.cc | 2 +- src/lib/log/logger.h | 4 ++-- src/lib/log/logger_impl.cc | 7 ++++--- src/lib/log/logger_impl.h | 4 ++-- src/lib/log/logger_manager.cc | 2 +- src/lib/log/tests/buffer_logger_test.cc | 2 +- src/lib/log/tests/logger_example.cc | 2 +- src/lib/log/tests/logger_lock_test.cc | 2 +- src/lib/log/tests/logger_unittest.cc | 2 +- 16 files changed, 26 insertions(+), 25 deletions(-) diff --git a/src/lib/log/interprocess/interprocess_sync.h b/src/lib/log/interprocess/interprocess_sync.h index 6f31a016b5..10453cce6e 100644 --- a/src/lib/log/interprocess/interprocess_sync.h +++ b/src/lib/log/interprocess/interprocess_sync.h @@ -19,7 +19,7 @@ namespace isc { namespace log { -namespace internal { +namespace interprocess { class InterprocessSyncLocker; // forward declaration @@ -144,7 +144,7 @@ protected: InterprocessSync& sync_; ///< Ref to underlying sync object }; -} // namespace internal +} // namespace interprocess } // namespace log } // namespace isc diff --git a/src/lib/log/interprocess/interprocess_sync_file.cc b/src/lib/log/interprocess/interprocess_sync_file.cc index 64b1c42e77..7f8fcb4fea 100644 --- a/src/lib/log/interprocess/interprocess_sync_file.cc +++ b/src/lib/log/interprocess/interprocess_sync_file.cc @@ -27,7 +27,7 @@ namespace isc { namespace log { -namespace internal { +namespace interprocess { InterprocessSyncFile::~InterprocessSyncFile() { if (fd_ != -1) { @@ -129,6 +129,6 @@ InterprocessSyncFile::unlock() { return (false); } -} // namespace internal +} // namespace interprocess } // namespace log } // namespace isc diff --git a/src/lib/log/interprocess/interprocess_sync_file.h b/src/lib/log/interprocess/interprocess_sync_file.h index 1f9fdb1a3d..cb070038c4 100644 --- a/src/lib/log/interprocess/interprocess_sync_file.h +++ b/src/lib/log/interprocess/interprocess_sync_file.h @@ -20,7 +20,7 @@ namespace isc { namespace log { -namespace internal { +namespace interprocess { /// \brief InterprocessSyncFileError /// @@ -86,7 +86,7 @@ private: int fd_; ///< The descriptor for the open file }; -} // namespace internal +} // namespace interprocess } // namespace log } // namespace isc diff --git a/src/lib/log/interprocess/interprocess_sync_null.cc b/src/lib/log/interprocess/interprocess_sync_null.cc index bb32ea93f3..226f7226ae 100644 --- a/src/lib/log/interprocess/interprocess_sync_null.cc +++ b/src/lib/log/interprocess/interprocess_sync_null.cc @@ -16,7 +16,7 @@ namespace isc { namespace log { -namespace internal { +namespace interprocess { InterprocessSyncNull::~InterprocessSyncNull() { } @@ -39,6 +39,6 @@ InterprocessSyncNull::unlock() { return (true); } -} // namespace internal +} // namespace interprocess } // namespace log } // namespace isc diff --git a/src/lib/log/interprocess/interprocess_sync_null.h b/src/lib/log/interprocess/interprocess_sync_null.h index 5c74bbd436..41dab50143 100644 --- a/src/lib/log/interprocess/interprocess_sync_null.h +++ b/src/lib/log/interprocess/interprocess_sync_null.h @@ -19,7 +19,7 @@ namespace isc { namespace log { -namespace internal { +namespace interprocess { /// \brief Null Interprocess Sync Class /// @@ -59,7 +59,7 @@ protected: bool unlock(); }; -} // namespace internal +} // namespace interprocess } // namespace log } // namespace isc diff --git a/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc b/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc index ea8f9ace0a..4df365e29d 100644 --- a/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc +++ b/src/lib/log/interprocess/tests/interprocess_sync_file_unittest.cc @@ -20,7 +20,7 @@ #include using namespace std; -using namespace isc::log::internal; +using namespace isc::log::interprocess; using isc::util::unittests::parentReadState; namespace { diff --git a/src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc b/src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc index 2552a84086..cc9795c0dc 100644 --- a/src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc +++ b/src/lib/log/interprocess/tests/interprocess_sync_null_unittest.cc @@ -16,7 +16,7 @@ #include using namespace std; -using namespace isc::log::internal; +using namespace isc::log::interprocess; namespace { diff --git a/src/lib/log/logger.cc b/src/lib/log/logger.cc index 1c65b382ab..a04267cfd4 100644 --- a/src/lib/log/logger.cc +++ b/src/lib/log/logger.cc @@ -182,7 +182,7 @@ Logger::fatal(const isc::log::MessageID& ident) { // Replace the interprocess synchronization object void -Logger::setInterprocessSync(isc::log::internal::InterprocessSync* sync) { +Logger::setInterprocessSync(isc::log::interprocess::InterprocessSync* sync) { getLoggerPtr()->setInterprocessSync(sync); } diff --git a/src/lib/log/logger.h b/src/lib/log/logger.h index e4879cfb64..de2b30438d 100644 --- a/src/lib/log/logger.h +++ b/src/lib/log/logger.h @@ -27,7 +27,7 @@ namespace isc { namespace log { -namespace internal { +namespace interprocess { // Forward declaration to hide implementation details from normal // applications. class InterprocessSync; @@ -266,7 +266,7 @@ public: /// synchronizing output of log messages. It should be deletable and /// the ownership is transferred to the logger. If NULL is passed, /// a BadInterprocessSync exception is thrown. - void setInterprocessSync(isc::log::internal::InterprocessSync* sync); + void setInterprocessSync(isc::log::interprocess::InterprocessSync* sync); /// \brief Equality /// diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc index 06a91b04c8..96f021df66 100644 --- a/src/lib/log/logger_impl.cc +++ b/src/lib/log/logger_impl.cc @@ -53,7 +53,7 @@ namespace log { LoggerImpl::LoggerImpl(const string& name) : name_(expandLoggerName(name)), logger_(log4cplus::Logger::getInstance(name_)), - sync_(new internal::InterprocessSyncFile("logger")) + sync_(new interprocess::InterprocessSyncFile("logger")) { } @@ -111,7 +111,8 @@ LoggerImpl::lookupMessage(const MessageID& ident) { // Replace the interprocess synchronization object void -LoggerImpl::setInterprocessSync(isc::log::internal::InterprocessSync* sync) { +LoggerImpl::setInterprocessSync(isc::log::interprocess::InterprocessSync* sync) +{ if (sync == NULL) { isc_throw(BadInterprocessSync, "NULL was passed to setInterprocessSync()"); @@ -129,7 +130,7 @@ LoggerImpl::outputRaw(const Severity& severity, const string& message) { // Use an interprocess sync locker for mutual exclusion from other // processes to avoid log messages getting interspersed. - internal::InterprocessSyncLocker locker(*sync_); + interprocess::InterprocessSyncLocker locker(*sync_); if (!locker.lock()) { LOG4CPLUS_ERROR(logger_, "Unable to lock logger lockfile"); diff --git a/src/lib/log/logger_impl.h b/src/lib/log/logger_impl.h index 07b681520a..d8dea26a82 100644 --- a/src/lib/log/logger_impl.h +++ b/src/lib/log/logger_impl.h @@ -177,7 +177,7 @@ public: /// synchronizing output of log messages. It should be deletable and /// the ownership is transferred to the logger implementation. /// If NULL is passed, a BadInterprocessSync exception is thrown. - void setInterprocessSync(isc::log::internal::InterprocessSync* sync); + void setInterprocessSync(isc::log::interprocess::InterprocessSync* sync); /// \brief Equality /// @@ -192,7 +192,7 @@ public: private: std::string name_; ///< Full name of this logger log4cplus::Logger logger_; ///< Underlying log4cplus logger - isc::log::internal::InterprocessSync* sync_; + isc::log::interprocess::InterprocessSync* sync_; }; } // namespace log diff --git a/src/lib/log/logger_manager.cc b/src/lib/log/logger_manager.cc index 3f56d59fa1..047c7dcfff 100644 --- a/src/lib/log/logger_manager.cc +++ b/src/lib/log/logger_manager.cc @@ -158,7 +158,7 @@ LoggerManager::readLocalMessageFile(const char* file) { // the local state directory (to create lock files). So we switch to // using a null interprocess sync object here. logger.setInterprocessSync( - new isc::log::internal::InterprocessSyncNull("logger")); + new isc::log::interprocess::InterprocessSyncNull("logger")); try { diff --git a/src/lib/log/tests/buffer_logger_test.cc b/src/lib/log/tests/buffer_logger_test.cc index 9e43bc3d8c..d703e04dae 100644 --- a/src/lib/log/tests/buffer_logger_test.cc +++ b/src/lib/log/tests/buffer_logger_test.cc @@ -59,7 +59,7 @@ main(int argc, char** argv) { Logger logger("log"); // No need for file interprocess locking in this test logger.setInterprocessSync( - new isc::log::internal::InterprocessSyncNull("logger")); + new isc::log::interprocess::InterprocessSyncNull("logger")); LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); LOG_DEBUG(logger, 50, LOG_BAD_DESTINATION).arg("debug-50"); LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); diff --git a/src/lib/log/tests/logger_example.cc b/src/lib/log/tests/logger_example.cc index 81007124e0..daadb7c4ff 100644 --- a/src/lib/log/tests/logger_example.cc +++ b/src/lib/log/tests/logger_example.cc @@ -45,7 +45,7 @@ using namespace isc::log; using namespace std; -using isc::log::internal::InterprocessSyncNull; +using isc::log::interprocess::InterprocessSyncNull; // Print usage information diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc index 605c2070df..9b9ee17993 100644 --- a/src/lib/log/tests/logger_lock_test.cc +++ b/src/lib/log/tests/logger_lock_test.cc @@ -26,7 +26,7 @@ using namespace std; using namespace isc::log; using isc::util::thread::Mutex; -class MockLoggingSync : public isc::log::internal::InterprocessSync { +class MockLoggingSync : public isc::log::interprocess::InterprocessSync { public: /// \brief Constructor MockLoggingSync(const std::string& component_name) : diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc index eef22a0e5a..77a9d2a3d1 100644 --- a/src/lib/log/tests/logger_unittest.cc +++ b/src/lib/log/tests/logger_unittest.cc @@ -390,7 +390,7 @@ TEST_F(LoggerTest, setInterprocessSync) { EXPECT_THROW(logger.setInterprocessSync(NULL), BadInterprocessSync); } -class MockSync : public isc::log::internal::InterprocessSync { +class MockSync : public isc::log::interprocess::InterprocessSync { public: /// \brief Constructor MockSync(const std::string& component_name) :