# Linux Proc File Driver
This project demonstrates a **Linux kernel module** that creates a **proc file** (`/proc/Pyjama_driver`).
The module supports **read/write** operations, allowing a user-space application (`user-app.py`) to communicate with the kernel.
---
## 🚀 Features
- **Proc file interaction** (`/proc/Pyjama_driver`).
- **Read/Write support** from user space.
- **Kernel message logging** (`dmesg`).
- **Multipass VM** for testing.
- **Python user-space applications** for interacting with the kernel.
---
## 🛠 Setup & Installation
### **1️⃣ Clone the Repository**
```sh
git clone https://github.com/garry00107/linux-proc-driver.git
cd linux-proc-drivermakesudo insmod ldd.kolsmod | grep lddThis command checks if the module is successfully loaded.
dmesg | tail -10It shows recent kernel messages, including those from our module.
sudo dmesg -cThis clears kernel logs, useful for debugging new changes.
Run the basic read application:
python3 user-app.py** Read & Write to the Proc File Run the advanced read/write application:
python3 user-app-rw.py Read from the driver: The app will display messages stored in the kernel. Write to the driver: The app allows you to send messages to the kernel.
Run the advanced read/write application:
python3 user-app-rw.pysudo rmmod ldd📂 linux-proc-driver
├── 📄 ldd.c # Kernel module source code (read & write support)
├── 📄 Makefile # Compilation instructions
├── 📄 user-app.py # Basic Python user-space application (read only)
├── 📄 user-app-rw.py # Advanced Python app (read & write)
└── 📄 README.md # Project documentation
- Creates a proc file at
/proc/Pyjama_driver. - Implements read and write operations.
- Uses
proc_create()andproc_remove()for file management. - Logs messages using
printk()(visible viadmesg).
- Compiles the kernel module using system headers.
- Opens
/proc/Pyjama_driverand reads messages from the kernel.
- Writes messages to the kernel and reads responses.
- Helps test the write functionality of the proc file.
- Ensure you are using the correct kernel version:
uname -r
- Recompile the module using:
make clean && make
- Use
sudowhen runninginsmodorrmmod.
- Ensure the module is loaded:
lsmod | grep ldd - If missing, reload the module:
sudo insmod ldd.ko
- Developed as part of a Linux Device Drivers course.
- Tested using Multipass for virtualization.
<<<<<<< HEAD
---
=======
>>>>>>> 289b387 (Updated README, modified ldd.c, and added user-app-rw.py)
---