From: JINMEI Tatuya Date: Fri, 7 Jun 2013 00:15:27 +0000 (-0700) Subject: [2854] added a minimal framework for the memmgr daemon. X-Git-Tag: bind10-1.2.0beta1-release~378^2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2ca7ef10889eccf7ebe70f1662fed83c33f62c19;p=thirdparty%2Fkea.git [2854] added a minimal framework for the memmgr daemon. it's basically empty yet. --- diff --git a/configure.ac b/configure.ac index f0a5fb14c2..ac1f756e74 100644 --- a/configure.ac +++ b/configure.ac @@ -1192,6 +1192,8 @@ AC_CONFIG_FILES([Makefile src/bin/loadzone/Makefile src/bin/loadzone/tests/Makefile src/bin/loadzone/tests/correct/Makefile + src/bin/memmgr/Makefile + src/bin/memmgr/tests/Makefile src/bin/msgq/Makefile src/bin/msgq/tests/Makefile src/bin/auth/Makefile @@ -1379,6 +1381,7 @@ AC_OUTPUT([doc/version.ent src/bin/loadzone/loadzone.py src/bin/usermgr/run_b10-cmdctl-usermgr.sh src/bin/usermgr/b10-cmdctl-usermgr.py + src/bin/memmgr/memmgr.py src/bin/msgq/msgq.py src/bin/msgq/run_msgq.sh src/bin/auth/auth.spec.pre diff --git a/src/bin/memmgr/.gitignore b/src/bin/memmgr/.gitignore new file mode 100644 index 0000000000..9b12294ee7 --- /dev/null +++ b/src/bin/memmgr/.gitignore @@ -0,0 +1,3 @@ +/b10-memmgr +/memmgr.py +/b10-memmgr.8 diff --git a/src/bin/memmgr/Makefile.am b/src/bin/memmgr/Makefile.am new file mode 100644 index 0000000000..8fc1cdcf8d --- /dev/null +++ b/src/bin/memmgr/Makefile.am @@ -0,0 +1,49 @@ +SUBDIRS = . tests + +pkglibexecdir = $(libexecdir)/@PACKAGE@ + +pkglibexec_SCRIPTS = b10-memmgr + +b10_memmgrdir = $(pkgdatadir) +b10_memmgr_DATA = memmgr.spec + +nodist_pylogmessage_PYTHON = $(PYTHON_LOGMSGPKG_DIR)/work/memmgr_messages.py +pylogmessagedir = $(pyexecdir)/isc/log_messages/ + +CLEANFILES = b10-memmgr memmgr.pyc +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/memmgr_messages.py +CLEANFILES += $(PYTHON_LOGMSGPKG_DIR)/work/memmgr_messages.pyc + +EXTRA_DIST = memmgr_messages.mes memmgr.spec + +man_MANS = b10-memmgr.8 +DISTCLEANFILES = $(man_MANS) +EXTRA_DIST += $(man_MANS) b10-memmgr.xml + +if GENERATE_DOCS + +b10-memmgr.8: b10-memmgr.xml + @XSLTPROC@ --novalid --xinclude --nonet -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $(srcdir)/b10-memmgr.xml + +else + +$(man_MANS): + @echo Man generation disabled. Creating dummy $@. Configure with --enable-generate-docs to enable it. + @echo Man generation disabled. Remove this file, configure with --enable-generate-docs, and rebuild BIND 10 > $@ + +endif + +# Define rule to build logging source files from message file +$(PYTHON_LOGMSGPKG_DIR)/work/memmgr_messages.py : memmgr_messages.mes + $(top_builddir)/src/lib/log/compiler/message \ + -d $(PYTHON_LOGMSGPKG_DIR)/work -p $(srcdir)/memmgr_messages.mes + +# this is done here since configure.ac AC_OUTPUT doesn't expand exec_prefix +b10-memmgr: memmgr.py $(PYTHON_LOGMSGPKG_DIR)/work/memmgr_messages.py + $(SED) -e "s|@@PYTHONPATH@@|@pyexecdir@|" memmgr.py >$@ + chmod a+x $@ + +CLEANDIRS = __pycache__ + +clean-local: + rm -rf $(CLEANDIRS) diff --git a/src/bin/memmgr/b10-memmgr.xml b/src/bin/memmgr/b10-memmgr.xml new file mode 100644 index 0000000000..2f3ae67d22 --- /dev/null +++ b/src/bin/memmgr/b10-memmgr.xml @@ -0,0 +1,95 @@ +]> + + + + + + June 4, 2012 + + + + b10-memmgr + 8 + BIND10 + + + + b10-memmgr + BIND 10 memory manager daemon + + + + + 2013 + Internet Systems Consortium, Inc. ("ISC") + + + + + + b10-memmgr + + + + + DESCRIPTION + + + + ARGUMENTS + + The arguments are as follows: + + + + + + , + + + + + Print the command line arguments and exit. + + + + + + CONFIGURATION AND COMMANDS + + + + + SEE ALSO + + + bind108 + , + BIND 10 Guide. + + + + + HISTORY + + diff --git a/src/bin/memmgr/memmgr.py.in b/src/bin/memmgr/memmgr.py.in new file mode 100755 index 0000000000..5f21334671 --- /dev/null +++ b/src/bin/memmgr/memmgr.py.in @@ -0,0 +1,22 @@ +#!@PYTHON@ + +# Copyright (C) 2013 Internet Systems Consortium. +# +# Permission to use, copy, modify, and 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 INTERNET SYSTEMS CONSORTIUM +# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +# INTERNET SYSTEMS CONSORTIUM 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. + + +import sys; sys.path.append('@@PYTHONPATH@@') + +if '__main__' == __name__: + pass diff --git a/src/bin/memmgr/memmgr.spec b/src/bin/memmgr/memmgr.spec new file mode 100644 index 0000000000..247b012386 --- /dev/null +++ b/src/bin/memmgr/memmgr.spec @@ -0,0 +1,23 @@ +{ + "module_spec": { + "module_name": "Memmgr", + "config_data": [ + { + } + ], + "commands": [ + { + "command_name": "shutdown", + "command_description": "Shut down Memmgr", + "command_args": [ + { + "item_name": "pid", + "item_type": "integer", + "item_optional": true + } + ] + } + ] + } +} + diff --git a/src/bin/memmgr/memmgr_messages.mes b/src/bin/memmgr/memmgr_messages.mes new file mode 100644 index 0000000000..a59bcc35e2 --- /dev/null +++ b/src/bin/memmgr/memmgr_messages.mes @@ -0,0 +1,17 @@ +# 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. + +# When you add a message to this file, it is a good idea to run +# /tools/reorder_message_file.py to make sure the +# messages are in the correct order. diff --git a/src/bin/memmgr/tests/Makefile.am b/src/bin/memmgr/tests/Makefile.am new file mode 100644 index 0000000000..347ff87e76 --- /dev/null +++ b/src/bin/memmgr/tests/Makefile.am @@ -0,0 +1,30 @@ +PYCOVERAGE_RUN=@PYCOVERAGE_RUN@ +PYTESTS = memmgr_test.py +EXTRA_DIST = $(PYTESTS) + +# If necessary (rare cases), explicitly specify paths to dynamic libraries +# required by loadable python modules. +LIBRARY_PATH_PLACEHOLDER = +if SET_ENV_LIBRARY_PATH +LIBRARY_PATH_PLACEHOLDER += $(ENV_LIBRARY_PATH)=$(abs_top_builddir)/src/lib/cryptolink/.libs:$(abs_top_builddir)/src/lib/dns/.libs:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/cc/.libs:$(abs_top_builddir)/src/lib/config/.libs:$(abs_top_builddir)/src/lib/log/.libs:$(abs_top_builddir)/src/lib/util/.libs:$(abs_top_builddir)/src/lib/util/threads/.libs:$(abs_top_builddir)/src/lib/exceptions/.libs:$(abs_top_builddir)/src/lib/util/io/.libs:$(abs_top_builddir)/src/lib/datasrc/.libs:$(abs_top_builddir)/src/lib/acl/.libs:$$$(ENV_LIBRARY_PATH) +endif + +# test using command-line arguments, so use check-local target instead of TESTS +# We set B10_FROM_BUILD below, so that the test can refer to the in-source +# spec file. +check-local: +if ENABLE_PYTHON_COVERAGE + touch $(abs_top_srcdir)/.coverage + rm -f .coverage + ${LN_S} $(abs_top_srcdir)/.coverage .coverage +endif + for pytest in $(PYTESTS) ; do \ + echo Running test: $$pytest ; \ + B10_FROM_SOURCE=$(abs_top_srcdir) \ + B10_FROM_BUILD=$(abs_top_builddir) \ + $(LIBRARY_PATH_PLACEHOLDER) \ + PYTHONPATH=$(COMMON_PYTHON_PATH):$(abs_top_builddir)/src/bin/memmgr:$(abs_top_builddir)/src/lib/dns/python/.libs:$(abs_top_builddir)/src/lib/util/io/.libs \ + TESTDATASRCDIR=$(abs_srcdir)/testdata/ \ + TESTDATA_PATH=$(abs_top_srcdir)/src/lib/testutils/testdata \ + $(PYCOVERAGE_RUN) $(abs_srcdir)/$$pytest || exit ; \ + done diff --git a/src/bin/memmgr/tests/memmgr_test.py b/src/bin/memmgr/tests/memmgr_test.py new file mode 100755 index 0000000000..3699fcf26e --- /dev/null +++ b/src/bin/memmgr/tests/memmgr_test.py @@ -0,0 +1,21 @@ +# Copyright (C) 2013 Internet Systems Consortium. +# +# Permission to use, copy, modify, and 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 INTERNET SYSTEMS CONSORTIUM +# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +# INTERNET SYSTEMS CONSORTIUM 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. + +import isc.log +import unittest + +if __name__== "__main__": + isc.log.resetUnitTestRootLogger() + unittest.main()