• Linux Kernel Programming

    Linux kernel module to add a proc file entry

    by  • April 13, 2010 • Linux, Linux Kernel Programming • 3 Comments

    A look at the proc_dir_entry structure struct proc_dir_entry { unsigned int low_ino; unsigned short namelen; const char *name; // name of our module mode_t mode; // permissions ,who can read and write to it nlink_t nlink; uid_t uid; gid_t gid; loff_t size; const struct inode_operations *proc_iops; const struct file_operations *proc_fops; struct proc_dir_entry *next, *parent,...

    Read more →

    How to add a new Linux Kernel Module (LKM)

    by  • January 22, 2010 • Linux, Linux Kernel Programming • 2 Comments

    To demonstrate, let us goto a simple “Hello World” as a module and inserted in to the kernelStep 1Open any editor like vi or gedit in a shell prompt and the type the following/* Name of the file is hello.c */#include #include int init_module(void){printk(KERN_INFO “Hello world.n”);return 0;}void cleanup_module(void){printk(KERN_INFO “Goodbye worldn”);}The above is a simple...

    Read more →

    Introduction to Proc File System

    by  • October 4, 2009 • Linux Kernel Programming • 1 Comment

    The proc file system provides information on the current status of the Linux kernel and running process. It also allows modifications of kernel parameters in simple ways during runtime Each process in the system that is currently running is assigned a directory /proc/pid, where pid is the process identification number of the relevant process...

    Read more →