(function(a,e,f,g,b,c,d){a.GoogleAnalyticsObject=b;a[b]=a[b]||function(){(a[b].q=a[b].q||[]).push(arguments)};a[b].l=1*new Date;c=e.createElement(f);d=e.getElementsByTagName(f)[0];c.async=1;c.src=g;d.parentNode.insertBefore(c,d)})(window,document,"script","https://www.google-analytics.com/analytics.js","ga");ga("create","UA-732153-7","auto",{allowLinker:!0,siteSpeedSampleRate:10});ga("set","transport","beacon");ga("set","anonymizeIp",!0);ga("require","linker"); ga("linker:autoLink","askapache.com askapache.net htaccess.io htaccesselite.com askapache.info htaccess.guru".split(" "),!0);ga("send","pageview"); CLASS="BOOK" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" >

The Linux Kernel Module Programming Guide

Peter Jay Salzman
Ori Pomerantz

2003-04-04 ver 2.4.0


Table of Contents
Foreword
1. Acknowledgements
2. Authorship And Copyright
3. Nota Bene
1. Introduction
1.1. What Is A Kernel Module?
1.2. How Do Modules Get Into The Kernel?
2. Hello World
2.1. Hello, World (part 1): The Simplest Module
2.2. Compiling Kernel Modules
2.3. Hello World (part 2)
2.4. Hello World (part 3): The __init and __exit Macros
2.5. Hello World (part 4): Licensing and Module Documentation
2.6. Passing Command Line Arguments to a Module
2.7. Modules Spanning Multiple Files
3. Preliminaries
3.1. Modules vs Programs
4. Character Device Files
4.1. Character Device Drivers
5. The /proc File System
5.1. The /proc File System
6. Using /proc For Input
6.1. Using /proc For Input
7. Talking To Device Files
7.1. Talking to Device Files (writes and IOCTLs)}
8. System Calls
8.1. System Calls
9. Blocking Processes
9.1. Blocking Processes
10. Replacing Printks
10.1. Replacing printk
11. Scheduling Tasks
11.1. Scheduling Tasks
12. Interrupt Handlers
12.1. Interrupt Handlers
13. Symmetric Multi Processing
13.1. Symmetrical Multi-Processing
14. Common Pitfalls
14.1. Common Pitfalls
A. Changes: 2.0 To 2.2
A.1. Changes between 2.0 and 2.2
B. Where To Go From Here
B.1. Where From Here?
Index
List of Examples
2-1. hello-1.c
2-2. Makefile for a basic kernel module
2-3. hello-2.c
2-4. Makefile for both our modules
2-5. hello-3.c
2-6. hello-4.c
2-7. hello-5.c
2-8. start.c
2-9. stop.c
2-10. Makefile for a multi-filed module
4-1. chardev.c
4-2. some title
5-1. procfs.c
6-1. procfs.c
7-1. chardev.c
7-2. chardev.h
7-3. ioctl.c
8-1. syscall.c
9-1. sleep.c
10-1. print_string.c
11-1. sched.c
12-1. intrpt.c