here is simple example to demonstrate adding /proc file system entry for the module, as follows shiv@ubuntu:~/ds/linx$ cat heloproc.c /* * Kernel program demo to illustrate how to create/add entry to * /proc file system */ #include <linux/init.h> #include <linux/module.h> #include <linux/proc_fs.h> /* Module license */ MODULE_LICENSE("Dual BSD/GPL"); /* * This is the service routine for added /proc entry * when user try to look into /proc/<entry added> this routine will be executed * * char *buf - below is page allocated by kernel and passed to service routine * eof and start would be used only when using /proc for * getting more than one page (usually page is 4KB) * for complete info you could refer linux docs */ int demo_read_fs(char *buf, char **start, off_t offset, int count, int *eof, void *data) { int len=0; len = sprintf(buf, "This is Demo proc fs cre...
C and Linux with Examples!!!