summaryrefslogtreecommitdiffstats
path: root/oops_test.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2004-11-08 13:52:36 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2004-11-08 13:52:36 +0000
commit05f2f1839c2712ca77e86aa679dc909d051fc23b (patch)
treeff48843fbfd9c4a7cdf3c16609247f9ef3166f40 /oops_test.c
downloadrsyslog-05f2f1839c2712ca77e86aa679dc909d051fc23b.tar.gz
rsyslog-05f2f1839c2712ca77e86aa679dc909d051fc23b.tar.xz
rsyslog-05f2f1839c2712ca77e86aa679dc909d051fc23b.zip
Initial revision
Diffstat (limited to 'oops_test.c')
-rw-r--r--oops_test.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/oops_test.c b/oops_test.c
new file mode 100644
index 00000000..f710d4cd
--- /dev/null
+++ b/oops_test.c
@@ -0,0 +1,52 @@
+/*
+ * This is a small test program for generating a kernel protection fault
+ * using the oops loadable module.
+ *
+ * Fri Apr 26 12:52:43 CDT 1996: Dr. Wettstein
+ * Initial version.
+ */
+
+
+/* Includes. */
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+
+/* Function prototypes. */
+extern int main(int, char **);
+
+
+extern int main(argc, argv)
+
+ int argc;
+
+ char *argv[];
+
+{
+ auto int fd;
+
+ if ( argc != 2 )
+ {
+ fprintf(stderr, "No oops device specified.\n");
+ return(1);
+ }
+
+ if ( (fd = open(argv[1], O_RDONLY)) < 0 )
+ {
+ fprintf(stderr, "Cannot open device: %s.\n", argv[1]);
+ return(1);
+ }
+
+ if ( ioctl(fd, 1, 0) < 0 )
+ {
+ fprintf(stderr, "Failed on oops.\n");
+ return(1);
+ }
+
+ printf("OOoops\n");
+
+ close(fd);
+ return(0);
+}