Commit 6c18e5ad authored by Marcin Siodelski's avatar Marcin Siodelski
Browse files

[3405] Moved SignalSet class to util from util:io.

parent 47caf962
......@@ -1562,7 +1562,6 @@ AC_CONFIG_FILES([compatcheck/Makefile
src/lib/testutils/Makefile
src/lib/testutils/testdata/Makefile
src/lib/util/io/Makefile
src/lib/util/io/tests/Makefile
src/lib/util/Makefile
src/lib/util/python/doxygen2pydoc.py
src/lib/util/python/gen_wiredata.py
......
......@@ -76,7 +76,6 @@ b10_dhcp4_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
b10_dhcp4_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
b10_dhcp4dir = $(pkgdatadir)
b10_dhcp4_DATA = dhcp4.spec
......@@ -248,7 +248,7 @@ If the reconfiguration fails, the server will continue to run and use the last g
configuration.
The signal handler for SIGHUP (also for SIGTERM and SIGINT) are installed in the
kea_controller.cc using the @c isc::util::io::SignalSet class. The
kea_controller.cc using the @c isc::util::SignalSet class. The
@c isc::dhcp::Dhcp6Srv calls @c isc::dhcp::Daemon::handleSignal on each pass
through the main loop. This method fetches the last received signal and calls
a handler function defined in the kea_controller.cc. The handler function
......
......@@ -157,7 +157,7 @@ ControlledDhcpv4Srv::init(const std::string& file_name) {
// Set signal handlers. When the SIGHUP is received by the process
// the server reconfiguration will be triggered. When SIGTERM or
// SIGINT will be received, the server will start shutting down.
signal_set_.reset(new isc::util::io::SignalSet(SIGINT, SIGHUP, SIGTERM));
signal_set_.reset(new isc::util::SignalSet(SIGINT, SIGHUP, SIGTERM));
// Set the pointer to the handler function.
signal_handler_ = signalHandler;
......
......@@ -77,7 +77,6 @@ b10_dhcp6_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
b10_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
b10_dhcp6dir = $(pkgdatadir)
......
......@@ -280,7 +280,7 @@ If the reconfiguration fails, the server will continue to run and use the last g
configuration.
The signal handler for SIGHUP (also for SIGTERM and SIGINT) are installed in the
kea_controller.cc using the @c isc::util::io::SignalSet class. The
kea_controller.cc using the @c isc::util::SignalSet class. The
@c isc::dhcp::Dhcp6Srv calls @c isc::dhcp::Daemon::handleSignal on each pass
through the main loop. This method fetches the last received signal and calls
a handler function defined in the kea_controller.cc. The handler function
......
......@@ -160,7 +160,7 @@ ControlledDhcpv6Srv::init(const std::string& file_name) {
// Set signal handlers. When the SIGHUP is received by the process
// the server reconfiguration will be triggered. When SIGTERM or
// SIGINT will be received, the server will start shutting down.
signal_set_.reset(new isc::util::io::SignalSet(SIGINT, SIGHUP, SIGTERM));
signal_set_.reset(new isc::util::SignalSet(SIGINT, SIGHUP, SIGTERM));
// Set the pointer to the handler function.
signal_handler_ = signalHandler;
}
......
......@@ -83,7 +83,6 @@ libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libkea_dhcpsrv_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
......
......@@ -13,7 +13,7 @@
// PERFORMANCE OF THIS SOFTWARE.
#include <config.h>
#include <util/io/signal_set.h>
#include <util/signal_set.h>
#include <boost/noncopyable.hpp>
#include <string>
......@@ -46,7 +46,7 @@ namespace dhcp {
/// is assigned to the static object in @c Daemon::init function.
///
/// Classes derived from @c Daemon may install custom signal handlers using
/// @c isc::util::io::SignalSet class. This base class provides a declaration
/// @c isc::util::SignalSet class. This base class provides a declaration
/// of the @c SignalSet object that should be initialized in the derived
/// classes to install the custom exception handlers.
///
......@@ -120,7 +120,7 @@ protected:
///
/// This function provides a default implementation for the function
/// handling next signal received by the process. It checks if a pointer
/// to @c isc::util::io::SignalSet object and the signal handler function
/// to @c isc::util::SignalSet object and the signal handler function
/// have been set. If they have been set, the signal handler is invoked for
/// the the next signal registered in the @c SignalSet object.
///
......@@ -132,7 +132,7 @@ protected:
/// This pointer needs to be initialized to point to the @c SignalSet
/// object in the derived classes which need to handle signals received
/// by the process.
isc::util::io::SignalSetPtr signal_set_;
isc::util::SignalSetPtr signal_set_;
/// @brief Pointer to the common signal handler invoked by the handleSignal
/// function.
......@@ -140,7 +140,7 @@ protected:
/// This pointer needs to be initialized to point to the signal handler
/// function for signals being handled by the process. If signal handler
/// it not initialized, the signals will not be handled.
isc::util::io::SignalHandler signal_handler_;
isc::util::SignalHandler signal_handler_;
private:
......
......@@ -31,6 +31,7 @@ if USE_SHARED_MEMORY
libkea_util_la_SOURCES += memory_segment_mapped.h memory_segment_mapped.cc
endif
libkea_util_la_SOURCES += range_utilities.h
libkea_util_la_SOURCES += signal_set.cc signal_set.h
libkea_util_la_SOURCES += hash/sha1.h hash/sha1.cc
libkea_util_la_SOURCES += encode/base16_from_binary.h
libkea_util_la_SOURCES += encode/base32hex.h encode/base64.h
......
SUBDIRS = . tests
SUBDIRS = .
AM_CXXFLAGS = $(B10_CXXFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
......@@ -7,7 +7,6 @@ AM_CPPFLAGS += $(BOOST_INCLUDES)
lib_LTLIBRARIES = libkea-util-io.la
libkea_util_io_la_SOURCES = fd.h fd.cc fd_share.h fd_share.cc
libkea_util_io_la_SOURCES += socketsession.h socketsession.cc sockaddr_util.h
libkea_util_io_la_SOURCES += signal_set.cc signal_set.h
libkea_util_io_la_SOURCES += pktinfo_utilities.h
libkea_util_io_la_LIBADD = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
......
SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
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 += signal_set_unittest.cc
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
run_unittests_LDADD = $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
run_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la
run_unittests_LDADD += $(GTEST_LDADD)
endif
noinst_PROGRAMS = $(TESTS)
// Copyright (C) 2014 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 <log/logger_support.h>
#include <gtest/gtest.h>
int
main(int argc, char* argv[]) {
::testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
return (result);
}
......@@ -12,13 +12,13 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <util/io/signal_set.h>
#include <util/signal_set.h>
#include <cerrno>
#include <list>
using namespace isc;
using namespace isc::util::io;
using namespace isc::util;
namespace {
......@@ -70,7 +70,6 @@ void internalHandler(int sig) {
namespace isc {
namespace util {
namespace io {
SignalSet::SignalSet(const int sig0) {
add(sig0);
......@@ -222,6 +221,5 @@ SignalSet::remove(const int sig) {
}
}
} // end of isc::util::io
} // end of isc::util
} // end of isc
......@@ -24,7 +24,6 @@
namespace isc {
namespace util {
namespace io {
/// @brief Exception thrown when the @c isc::util::io::SignalSet class
/// experiences an error.
......@@ -181,7 +180,6 @@ private:
std::set<int> local_signals_;
};
}
}
}
......
......@@ -47,6 +47,7 @@ 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 += signal_set_unittest.cc
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
......
......@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <util/io/signal_set.h>
#include <util/signal_set.h>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <gtest/gtest.h>
......@@ -21,9 +21,9 @@
namespace {
using namespace isc;
using namespace isc::util::io;
using namespace isc::util;
/// @brief Test fixture class for @c isc::util::io::SignalSet class.
/// @brief Test fixture class for @c isc::util::SignalSet class.
///
/// This class contains a handler function which records the signal
/// being handled. It allows for checking whether the signal set
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment