summaryrefslogtreecommitdiffstats
path: root/src/input/magicSysRqHandler.cpp
diff options
context:
space:
mode:
authorSebastien Braun2010-10-06 18:00:08 +0200
committerSebastien Braun2010-10-07 09:30:25 +0200
commit32672a51fe8b8ccf63e1cfeb89ac5e020fde787a (patch)
tree98b0524e96cc370ca0f61632bb02d1787304901e /src/input/magicSysRqHandler.cpp
parentSanitize security model yet again (diff)
downloadpvs-32672a51fe8b8ccf63e1cfeb89ac5e020fde787a.tar.gz
pvs-32672a51fe8b8ccf63e1cfeb89ac5e020fde787a.tar.xz
pvs-32672a51fe8b8ccf63e1cfeb89ac5e020fde787a.zip
Implement magic SysRq handler.
Diffstat (limited to 'src/input/magicSysRqHandler.cpp')
-rw-r--r--src/input/magicSysRqHandler.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/input/magicSysRqHandler.cpp b/src/input/magicSysRqHandler.cpp
new file mode 100644
index 0000000..108bfca
--- /dev/null
+++ b/src/input/magicSysRqHandler.cpp
@@ -0,0 +1,28 @@
+/*
+ # Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg
+ #
+ # This program is free software distributed under the GPL version 2.
+ # See http://openslx.org/COPYING
+ #
+ # If you have any feedback please consult http://openslx.org/feedback and
+ # send your suggestions, praise, or complaints to feedback@openslx.org
+ #
+ # General information about OpenSLX can be found at http://openslx.org/
+ # --------------------------------------------------------------------------
+ # inputEventHandler.h:
+ # - Common definitions for input event handlers
+ # --------------------------------------------------------------------------
+ */
+
+#include <QFile>
+#include "magicSysRqHandler.h"
+
+void MagicSysRqHandler::handle(InputEvent const& evt, InputEventContext const*)
+{
+ QFile trigger("/proc/sysrq-trigger");
+ trigger.open(QIODevice::WriteOnly);
+ char c = (char)(evt.value() & 0xff);
+ trigger.write(&c, 1);
+ trigger.flush();
+ trigger.close();
+}