# HG changeset patch # User Erik Grinaker # Date 1139580747 0 # Node ID 29289dada9c3005682307adb78ae3e2b987505bf # Parent 123e88385b6ea04641709435b78d5dc4fb79f04d added mman module, and call mlockall() to ensure memory is never swapped to disk diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf ChangeLog --- a/ChangeLog Wed Feb 08 17:06:26 2006 +0000 +++ b/ChangeLog Fri Feb 10 14:12:27 2006 +0000 @@ -2,6 +2,12 @@ ---------------[ xxxx-xx-xx : 0.5.0 ]--------------- +2006-02-10 Erik Grinaker + + * added mman module + + * call mlockall() to ensure memory is never swapped to disk + 2006-02-08 Erik Grinaker * cleaned up preferences dialog diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf NEWS --- a/NEWS Wed Feb 08 17:06:26 2006 +0000 +++ b/NEWS Fri Feb 10 14:12:27 2006 +0000 @@ -7,11 +7,13 @@ - cleaned up preferences dialog Bugfixes: +- ensure memory is never swapped out to disk - removed the Help > Homepage menu item - password generator now always avoids ambiguous characters Code changes: - depend on pygtk 2.8 and gnome-python 2.10 +- added mman module - removed gnomemisc module - don't use deprecated gnome-python modules - moved preference dialog from dialog module to main script diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf acinclude.m4 --- a/acinclude.m4 Wed Feb 08 17:06:26 2006 +0000 +++ b/acinclude.m4 Fri Feb 10 14:12:27 2006 +0000 @@ -67,6 +67,10 @@ AM_GCONF_SOURCE_2 ]) +AC_DEFUN([RVL_MMAN], [ + AC_CHECK_FUNCS(mlockall munlockall) +]) + AC_DEFUN([RVL_PYGTK], [ PKG_CHECK_MODULES(PYGTK, [pygtk-2.0 >= 2.8.0]) PKG_CHECK_MODULES(GNOME_PYTHON, [gnome-python-2.0 >= 2.10.0]) diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf configure.ac --- a/configure.ac Wed Feb 08 17:06:26 2006 +0000 +++ b/configure.ac Fri Feb 10 14:12:27 2006 +0000 @@ -16,6 +16,7 @@ RVL_PYTHON_PATH(2.3) RVL_PYGTK() RVL_CRACKLIB() +RVL_MMAN() RVL_GCONF() RVL_FDO_MIME() @@ -50,5 +51,6 @@ src/lib/datahandler/Makefile src/wrap/Makefile src/wrap/crack/Makefile + src/wrap/mman/Makefile ]) diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf src/revelation-applet.in --- a/src/revelation-applet.in Wed Feb 08 17:06:26 2006 +0000 +++ b/src/revelation-applet.in Fri Feb 10 14:12:27 2006 +0000 @@ -30,7 +30,7 @@ if "@pyexecdir@" not in sys.path: sys.path.insert(0, "@pyexecdir@") -from revelation import config, data, datahandler, dialog, entry, io, ui, util +from revelation import config, data, datahandler, dialog, entry, io, mman, ui, util @@ -43,6 +43,8 @@ sys.excepthook = self.__cb_exception + mman.mlockall(mman.MCL_CURRENT | mman.MCL_FUTURE) + try: self.__init_config() self.__init_facilities() diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf src/revelation.in --- a/src/revelation.in Wed Feb 08 17:06:26 2006 +0000 +++ b/src/revelation.in Fri Feb 10 14:12:27 2006 +0000 @@ -27,7 +27,7 @@ if "@pyexecdir@" not in sys.path: sys.path.insert(0, "@pyexecdir@") -from revelation import config, data, datahandler, dialog, entry, io, ui, util +from revelation import config, data, datahandler, dialog, entry, io, mman, ui, util class Revelation(ui.App): @@ -36,6 +36,7 @@ def __init__(self): sys.excepthook = self.__cb_exception os.umask(0077) + mman.mlockall(mman.MCL_CURRENT | mman.MCL_FUTURE) self.program = gnome.init( config.APPNAME, config.APPNAME, diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf src/wrap/Makefile.am --- a/src/wrap/Makefile.am Wed Feb 08 17:06:26 2006 +0000 +++ b/src/wrap/Makefile.am Fri Feb 10 14:12:27 2006 +0000 @@ -5,5 +5,5 @@ # $Id$ # -SUBDIRS = crack +SUBDIRS = crack mman diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf src/wrap/mman/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/wrap/mman/Makefile.am Fri Feb 10 14:12:27 2006 +0000 @@ -0,0 +1,16 @@ +## Process this file with automake to produce Makefile.in +# +# src/wrap/mman/Makefile.am +# +# $Id$ +# + +module_PROGRAMS = mman.so +moduledir = $(pyexecdir)/revelation + +mman.o: mman.c + $(CC) -pthread -fno-strict-aliasing -fPIC -I${PYTHON_INCLUDE} -c mman.c -o mman.o + +mman.so: mman.o + $(CC) -Wl --export-dynamic -pthread -shared mman.o -o mman.so + diff -r 123e88385b6ea04641709435b78d5dc4fb79f04d -r 29289dada9c3005682307adb78ae3e2b987505bf src/wrap/mman/mman.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/wrap/mman/mman.c Fri Feb 10 14:12:27 2006 +0000 @@ -0,0 +1,96 @@ +/* + * + * $Id$ + * Copyright (C) 2001, Xavier Defrang + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the FSF: + * + * Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, + * MA 02111-1307, USA. + * + */ + + +#include + +#include + + +/* Module Information */ + +static char __author__[] = "Xavier Defrang "; +static char __version__[] = "$Revision$"; + + +static char mlockall_docstring[] = "Locks in memory all pages mapped by an address space. See mlockall(2) for details."; + +static PyObject *mman_mlockall(PyObject *self, PyObject *args) +{ + int flags, result; + + if (!PyArg_ParseTuple(args, "i", &flags)) + return NULL; + + result = mlockall(flags); + + return Py_BuildValue("i", (int)result); +} + + +static char munlockall_docstring[] = "Removes address space locks and locks on mappings in the address space. See mlockall(2) for details."; + +static PyObject *mman_unmlockall(PyObject *self, PyObject *args) +{ + int result; + + result = munlockall(); + + return Py_BuildValue("i", (int)result); +} + +/* Module documentation */ +static char mman_docstring[] = "Memory locking functions."; + + +/* Methods */ +static PyMethodDef mman_methods[] = { + { "mlockall", mman_mlockall, METH_VARARGS, mlockall_docstring }, + { "munlockall", mman_unmlockall, 0, munlockall_docstring }, + { NULL, NULL } +}; + + + +/* Module intialization */ +void initmman(void) +{ + PyObject *m; + PyObject *d; + + /* Intialize module */ + m = Py_InitModule3("mman", mman_methods, mman_docstring); + + /* Get module namespace */ + d = PyModule_GetDict(m); + + /* Declare flags bitmasks */ + PyDict_SetItemString(d, "MCL_CURRENT", PyInt_FromLong(MCL_CURRENT)); + PyDict_SetItemString(d, "MCL_FUTURE", PyInt_FromLong(MCL_FUTURE)); + + /* Set module information */ + PyDict_SetItemString(d, "__author__", PyString_FromString(__author__)); + PyDict_SetItemString(d, "__version__", PyString_FromString(__version__)); +} +