1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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()
{
}
|