How is this code being ran? When i try to test this code i get the following errors: make -C /lib/modules/5.11.0-1027-raspi/build M=/home/admin/csc440/project1/jiffies modules make[1]: Entering directory '/usr/src/linux-headers-5.11.0-1027-raspi' CC [M] /home/admin/csc440/project1/jiffies/jiffies.o /home/admin/csc440/project1/jiffies/jiffies.c: In function ‘myInit’: /home/admin/csc440/project1/jiffies/jiffies.c:91:46: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 91 | my_proc = proc_create("jiffies", 0666, NULL, &fops); | ^~~~~ | | | struct file_operations * In file included from /home/admin/csc440/project1/jiffies/jiffies.c:15: ./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops *’ but argument is of type ‘struct file_operations *’ 109 | struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ cc1: some warnings being treated as errors make[2]: *** [scripts/Makefile.build:288: /home/admin/csc440/project1/jiffies/jiffies.o] Error 1 make[1]: *** [Makefile:1852: /home/admin/csc440/project1/jiffies] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-1027-raspi' make: *** [Makefile:4: all] Error 2
How is this code being ran? When i try to test this code i get the following errors:
make -C /lib/modules/5.11.0-1027-raspi/build M=/home/admin/csc440/project1/jiffies modules
make[1]: Entering directory '/usr/src/linux-headers-5.11.0-1027-raspi'
CC [M] /home/admin/csc440/project1/jiffies/jiffies.o
/home/admin/csc440/project1/jiffies/jiffies.c: In function ‘myInit’:
/home/admin/csc440/project1/jiffies/jiffies.c:91:46: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
91 | my_proc = proc_create("jiffies", 0666, NULL, &fops);
| ^~~~~
| |
| struct file_operations *
In file included from /home/admin/csc440/project1/jiffies/jiffies.c:15:
./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops *’ but argument is of type ‘struct file_operations *’
109 | struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:288: /home/admin/csc440/project1/jiffies/jiffies.o] Error 1
make[1]: *** [Makefile:1852: /home/admin/csc440/project1/jiffies] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.11.0-1027-raspi'
make: *** [Makefile:4: all] Error 2
~~---
What version of linux and kernal should i be using? currently i am using Ubuntu 21.04 and Kernal version: 5.11.0-1027-raspi.
According to errors:
/home/admin/csc440/project1/jiffies/jiffies.c:91:46: error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
./include/linux/proc_fs.h:109:122: note: expected ‘const struct proc_ops *’ but argument is of type ‘struct file_operations *’
There is no issue in running the script but the code you have written has some compilation error, and the reason is it expects const struct proc_ops * but it was given a truct file_operations * which is not valid.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps