Unreliable Guide To Hacking The Linux Kernel

Paul Rusty Russell

      
     

This is the first release of this document as part of the kernel tarball.

Table of Contents
Introduction
The Players
User Context
Hardware Interrupts (Hard IRQs)
Software Interrupt Context: Bottom Halves, Tasklets, softirqs
Some Basic Rules
ioctls: Not writing a new system call
Recipes for Deadlock
Common Routines
printk() include/linux/kernel.h
copy_[to/from]_user() / get_user() / put_user() include/asm/uaccess.h
kmalloc()/kfree() include/linux/slab.h
current include/asm/current.h
udelay()/mdelay() include/asm/delay.h include/linux/delay.h
cpu_to_be32()/be32_to_cpu()/cpu_to_le32()/le32_to_cpu() include/asm/byteorder.h
local_irq_save()/local_irq_restore() include/asm/system.h
local_bh_disable()/local_bh_enable() include/asm/softirq.h
smp_processor_id()/cpu_[number/logical]_map() include/asm/smp.h
__init/__exit/__initdata include/linux/init.h
__initcall()/module_init() include/linux/init.h
module_exit() include/linux/init.h
MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT include/linux/module.h
Wait Queues include/linux/wait.h
Declaring
Queuing
Waking Up Queued Tasks
Atomic Operations
Symbols
EXPORT_SYMBOL() include/linux/module.h
EXPORT_NO_SYMBOLS include/linux/module.h
EXPORT_SYMBOL_GPL() include/linux/module.h
Routines and Conventions
Double-linked lists include/linux/list.h
Return Conventions
Breaking Compilation
Initializing structure members
GNU Extensions
C++
#if
Putting Your Stuff in the Kernel
Kernel Cantrips
Thanks