summaryrefslogtreecommitdiff
path: root/test/dopanic_drv.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-06 18:04:32 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-06 18:04:32 +0200
commita7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 (patch)
tree41c4deec1fdfbafd7821b4ca7a9772ac0abd92f5 /test/dopanic_drv.c
Imported Upstream version 2.9.3upstream/2.9.3
Diffstat (limited to 'test/dopanic_drv.c')
-rw-r--r--test/dopanic_drv.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/dopanic_drv.c b/test/dopanic_drv.c
new file mode 100644
index 0000000..a8540ff
--- /dev/null
+++ b/test/dopanic_drv.c
@@ -0,0 +1,51 @@
+/* dopanic.c
+ *
+ * Cause a panic in a loadable driver.
+ */
+#include <linux/kernel.h> /* We're doing kernel work */
+#include <linux/module.h> /* Specifically, a module */
+
+static int device_open(void *inode,
+ void *file)
+{
+ printk (KERN_DEBUG "device_open(%p,%p)\n", inode, file);
+ return 0;
+}
+
+static int device_release(void *inode,
+ void *file)
+{
+ printk ("device_release(%p,%p)\n", inode, file);
+ return 0;
+}
+
+
+static int device_read(void *file,
+ char *buffer, /* The buffer to fill with data */
+ int length, /* The length of the buffer */
+ int *offset) /* Our offset in the file */
+{
+ return 0;
+}
+
+static int device_write(void *file,
+ const char *buffer, /* The buffer */
+ int length, /* The length of the buffer */
+ int *offset) /* Our offset in the file */
+{
+ return -1;
+}
+
+/* Initialize the module */
+int init_module()
+{
+ panic("dopanic: init_module calls panic");
+ return 0;
+}
+
+
+/* Cleanup - unregister the appropriate file from /proc */
+void cleanup_module()
+{
+}
+