Question: *NEED HELP.!! please correct source code jiffies.c I attached and show the corrected jiffies.c after it's fixed . I have these errors when I am

*NEED HELP.!! please correct source code jiffies.c I attached and show the corrected jiffies.c after it's fixed.

I have these errors when I am working on assignment that Design a kernel module that creates a /proc file named /proc/jiffies that reports the value of jiffies when the /proc/jiffies file is read, such as with the command cat /proc/jiffies.

*NEED HELP.!! please correct source code jiffies.c I attached and show themy jiffies.c source

#include

#include

// does not compile too well ...

#if 0

#include

#else

#include

#endif

#include

#include

#include

#include

#include

#include

#include

 #define PROC_NAME "jiffies" #define BUFFER_SIZE 128 MODULE_LICENSE("GPL 2"); static int myInit(void); static void myExit(void); struct proc_dir_entry *my_proc; /* Read operation on proc */ ssize_t read_data(struct file *fp, char *buf, size_t len, loff_t * off) { static int completed=0; if(completed) { completed=0; return 0; } completed=1; /* find out current value of jiffies */ sprintf(buf, "Value of jiffies %lu ", jiffies); return strlen(buf); } /* File operation on proc */ static struct file_operations fops = { .owner=THIS_MODULE, .read=read_data, }; /* Init of kernel module */ static int __init myInit(void) { /* Create proc file with name of jiffies */ my_proc = proc_create(PROC_NAME, 0666, NULL, &fops); if(my_proc == NULL){ printk(KERN_INFO "Error to create proc File "); return -1; } return 0; } /* exit of kernel module */ static void myExit(void) { remove_proc_entry(PROC_NAME,NULL); return; } module_init(myInit); module_exit(myExit);

____________________

Makefile

obj-m += jiffies.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

student@ubuntu:"/assign2 $ make make -C /lib/modules/2.6.11/build M=/home/student/assign2 modules make[1]: Entering directory /home/student/linux-2.6.11' CC [M] /home/student/assign2/jiff.o home/student/assign2/jiff.c:39: warning: initialization from incompatible point er type home/student/assign2/jiff.c: In function 'my Init': home/student/assign2/jiff.c:44: warning: implicit declaration of function proc create' home/student/assign2/jiff.c:44: warning: assignment makes pointer from integer without a cast Building modules, stage 2. MODPOST *** Warning: "proc_create" [/home/student/assign2/jiff.kol undef ined ! LD [M] /home/student/assign2/jiff.ko make[1]: Leaving directory home/student/linux-2.6.11' studentCubuntu :"/assign2 $

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!