Online Documentation Server
Net technology
Web technology
Data bases
Other docs



Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.

The HyperNews Linux KHG Discussion Pages

Linux Kernel Hackers' Guide

This is a site for Linux Kernel Hackers (that is, dedicated programmers), not for ``crackers'' who break into computers. If you want to learn how to break into other people's computers, GO AWAY! We don't need scum like you here.

Sorry for the interruption. We now return you to your regularly scheduled KHG.

Go get the real thing!

Alessandro Rubini wrote Linux Device Drivers, which is what the KHG could have been (maybe) but isn't. If you have a question and can't find the answer here, go get a copy of Linux Device Drivers and read it--chances are that when you are done, you will not need to ask a question here.

Run, don't walk to get a copy of this book.

Table of Contents

Tour of the Linux Kernel
This is a somewhat incomplete tour of the Linux Kernel, based on Linux 1.0.9 and the 1.1.x development series. Most of it is still relevant.
Device Drivers
The most common Linux kernel programming task is writing a new device driver. The great majority of the code in the kernel is new device drivers; between 1.2.13 and 2.0 the size of the source code more than doubled, and most of that was from adding device drivers.
Adding a filesystem to Linux doesn't have to involve magic...
Linux Memory Management
A few outdated documents, and one completely new one by David Miller on the Linux cache flush architecture.
How System Calls Work on Linux/i86
Although this was written while Linux 0.99.2 was current, it still applies. A few filenames may need updating. find is your friend--just respond with the changes and they will be added.
Other Sources of Information
The KHG is just one collection of information about the Linux kernel. There are others!

Membership and Subscription

At the bottom of the page, you will notice two hyperlinks (among several others): Subscribe and Members. Using the KHG to its fullest involves these two hyperlinks, even though you are not required to be a member to read these pages and post responses.


HyperNews membership is site-wide. That is, you only need to sign up and become a member once for the entire KHG. It doesn't take much to be a member. Each member is identified by a unique name, which can either be a nickname or an email address. We suggest using your email address; that way it will be unique and easy to remember. On the other hand, you may want to choose a nickname if you expect to be changing your email address at any time.

We also want your real name, email address, and home page (if you have one). You can give us your phone and address if you want. You will be asked to choose a password. You can change any of these items at any time by clicking on the Membership hyperlink again.


Subscribing to a page puts you on a mailing list to be sent notification of any new responses to the page to which you are subscribed. You subscribe separately to each page in which you are interested by clicking the Subscription link on the page to which you want to subscribe. You are also subscribed, by default, to pages that you write.

When you subscribe to a page, you subscribe to that page and all of its responses.


Please respond to these pages if you have something to add. Think of posting a response rather like posting to an email list, except that an editor might occasionally come along to clean things up and/or put them in the main documents' bodies. So if you would post it to an email list in a similar discussion, it is probably appropriate to post here.

In order to make reading these pages a pleasure for everyone, any incomprehensible, unrelated, outdated, abusive, or other completely unnecessary post may be removed by an administrator. So if you have a message that would be inappropriate on a mailing list, it's probably also inappropriate here.

The administrators have the final say on what's appropriate. We don't expect this to become an issue...

About the new KHG

The Linux Kernel Hackers' Guide has changed quite a bit since its original conception four years ago. I struggled along with the help of many other hackers to produce a document that lived primarily on paper, and was intended to document the kernel in much the same way that a program's user guide is intended to document the program for users.

It was less successful than most user guides, for a number of reasons:

  • I was working on it part time, and was otherwise busy.
  • The Linux kernel is a moving target.
  • I am not personally capable of documenting the entire Linux kernel.
  • I became far too concerned with making the typesetting pretty, getting bogged down in details and making the document typographically noisy at the same time.
I floundered around, trying to be helpful, and made at least one right decision: most of the people who needed to read the old KHG needed to write device drivers, and the most fully-developed part of the KHG was the device driver section.

There is a clear need for further development of the KHG, and it's clear that my making it a monolithic document stood in the way of progress. The KHG is now a series of more or less independent web pages, with places for readers to leave comments and corrections that can be incorporated in the document at the maintainer's leisure--and are available to readers before they are incorporated.

The KHG is now completely web-based. There will be no official paper version. You need kernel source code nearby to read the KHG anyway, and I want to shift the emphasis from officially documenting the Linux kernel to being a learning resource about the Linux kernel--one that may well be useful to other people who want to document one part or another of the Linux kernel more fully, as well as to people who just want to hack the kernel.

An FTP-able version of the KHG is available from You will still need a net connection to post to the KHG, but not to read it. Please keep yourself up-to-date so that you are not posting questions that others have already answered. Thanks!


Copyright (C) 1996,1997 Michael K. Johnson,

Messages Inline: 0 1 All Outline: 1 -1 +1

256. Question: multitasking by Dennis J Perkins newer
247. Question: linux on sparc by darrin hodges new
241. Question: How to call a function in user space from inside the kernel ? by Ronald Tonn
1. Idea: How to call a user routine from kernel mode by David Welch new
240. Question: Can I map kernel (device driver) memory into user space ? by Ronald Tonn
237. None: driver x_open,x_release work, x_ioctl,x_write don't by Carl Schwartz
1. Question: Depmod Unresolved symbols? by Carl Schwartz
235. Question: How to sleep for x jiffies? by Trent Piepho
234. Question: Adding code to the Linux Kernel by Patrick
1. Idea: /dev/random by Simon Green
231. Question: MSG_WAITALL flag by Leonard Mosescu
230. Question: possible bug in ipc/msg.c by Michael Adda
225. Question: scheduler Question by Arne Spetzler
1. None: Untitled by Ovsov
221. Question: File Descriptor Passing? by The Llamatron
220. Question: Linux SMP Scheduling by Angela
2. More: Finding definitions in the source by Felix Rauch
1. Idea: Re: Linux SMP Scheduling by Franky
217. Question: Difference between ELF and kernel file by Thomas Prokosch
216. Question: How kernel communicates with outside when it's started? by Xuan Cao
1. Idea: Printing to the kernel log by Thomas Prokosch
213. Question: The way from a kernel hackers' idea to an "official" kernel? by Roger Schreiter
1. Feedback: by Michael K. Johnson
212. Question: Curious about sleep_on_interruptible() in ancient kernels. by Colin Howell
208. Question: Server crashes using 2.0.32 and SMP by Steve Resnick
1. None: Debugging server crash by Balaji Srinivasan
-> Question: More Information by Steve Resnick
-> None: it should not have happenned... by Balaji Srinivasan
207. Question: Signals ID definitions by Franky
206. Question: the segment D000 is not visible by
205. Question: ICMP - Supressing Messages in 2.1.82 Kernel by Brent Johnson
1. None: Change /etc/syslog.conf by Balaji Srinivasan
203. Question: Modem bits by Franky
1. None: Untitled by Kostya
200. Question: I need some way to measure the time a process spend in READY QUEUE
by Leandro Gelasi
197. Question: How to make sockets work whilst my process is in kernel mode? by Mikhail Kourinny
193. Question: Realtime Problem by Uwe Gaethke
1. Feedback: SCHED_FIFO scheduling by Balaji Srinivasan
190. Question: inodes by Ovsov
186. Question: Difference between SOCK_RAW SOCK_PACKET by Chris Leung
185. Question: Need additional termcap entries for TERM=linux by Karl Bullock
184. Question: Question on Umount or sys_umount by teddy
183. Question: Passing file descriptors to the kernel by Pradeep Gore
1. Note: A way to "transform" a file descriptor into a struct file* in a user process
by Lorenzo Cavallaro
181. Question: Dead Man Timer by Jody Winston
179. Question: raw sockets by lightman
178. Question: a kernel-hacking newbie by Bradley Lawrence
2. Feedback: A place to start.
1. None: Modems in general by Ian Carr-de Avelon
176. Question: How to write CD-ROM Driver ? Any Source Code ? by Madhura Upadhya
174. Question: Measuring the scheduler overhead by Jasleen Kaur
173. Question: Where can I find the tcpdump or snoop in linux? by wangc@taurus
172. Question: Timers don't work?? by Joshua Liew
1. None: Timers Work... by Balaji Srinivasan
171. Question: problem of Linux's bridge code by wangc@taurus
170. Note: Documention on writing kernel modules by Erik Nygren
168. Question: How to display a clock on my console? by keco
167. Question: Difference between SCO and Linux drivers. by M COTE
165. None: Changing the scheduler from round robin to shortest job first for kernel 2.0 and up
2. Question: Improving the Scheduer by Lee Ingram
1. Idea: Improving the Scheduler : use QNX-like by Leandro Gelasi
1. Warning: Re: Changing the sched. from round robin to shortest job first for kernel 2.0 and up.
by Pirasenna V.T.
164. Question: meanings of file->private_data by
162. Question: /dev/signalprocess by flatmax
161. Question: how to track VM page access sequence? by shawn
160. Question: Whats the difference between dev_tint(dev) and mark_bh(NET_BH)? by Jaspreet Singh
159. Question: PCI by
1. Feedback: RE: PCI by Armin A. Arbinger
158. Question: Can I make syscall from inside a kernel module? by Shawn Chang
3. Feedback: Re: Can I make syscall from inside a kernel module? by Massoud Asgharifard
1. Ok: Make a syscall despite of wrong fs!! by Mikhail Kourinny
2. Note: code snip to make a sys_* call from a module by Pradeep Gore
1. More: Dont use system calls within kernel...(esp sys_mlock) by Balaji Srinivasan
157. Question: Untitled by Steve Durst
154. Question: RAW Sockets (Art)
153. Question: use phy mem by WYB
151. Question: HyperNews for RH Linux ? by Eigil Krogh Sorensen
1. Note: Not really needed by Cameron
150. Question: about raw ethernet frame: how to do it ? by
149. Question: process table by Blaz Novak
148. Question: Stream drivers by Nick Egorov
3. None: Streams drivers
1. Feedback: Stream in Solaris by
146. Question: How can i link QNX2 tcp/ip to my Linux Server ? by
143. Question: Xircom External Ethernet driver anywhere? by mike head
140. Question: interruptible_sleep_on() too slow! by Bill Blackwell
1. Idea: wrong functions by Michael K. Johnson
139. Question: creating a kernel relocatable module by Simon Kittle
138. Question: Up to date serial console patches by Simon Green
136. Question: Kernel-Level Support for Checkpointing on Linux? by Argenis R. Fernandez
1. More: Working on it. by Jan Rychter
135. Question: Problem creating a new system call by sauru
3. Question: How did the file /arch/i386/kernel/entry.S do its job by Wang Ju
2. Question: system call returns "Bad Address". Why? by sauru
1. Question: Re:return values by C.H.Gopinath
2. None: Re:return values by Sameer Shah
1. Feedback: possible reason for segmentation fault
1. Idea: Creating a new sytem call: solution by C.H.Gopinath
2. Idea: problem with system call slot 167 by Todd Medlock
1. Feedback: Kernel Debuggers for Linux by sauru
133. Question: Resetting interface counters by Keith Dart
130. Question: writing/accessing modules by Jones MB
1. Feedback: Use a device driver and read()/write()/ioctl() by Michael K. Johnson
-> Question: getting to the kernel's memory by Jones MB
-> Idea: use buffers! by Rubens
124. Question: Help with CPU scheduler! by Lerris
1. Feedback: Response to "Help with CPU scheduler!" by Jeremy Impson
117. Question: calling interupts from linux by John J. Binder
1. Sad: You can't by Michael K. Johnson
-> Question: Calling BIOS interrupts from Linux kernel by Ian Collier
-> None: Possible, but takes work by Michael K. Johnson
-> More: VBE video driver by Ian Collier
-> Agree: VM86 mode at which abstraction level? by Michael K. Johnson
116. Question: DVD-ROM and Linux? (sorry if it's off topic...) by Joel Hardy
2. Feedback: Response to DVD and Mpeg in Linux by Mike Corrieri new
115. Question: Kernel Makefile Configuration: how? by Simon Green
2. Question: How to add a driver to the kernel ? by jacek Radajewski
1. None: See include/linux/autoconf.h by Balaji Srinivasan
113. Question: Multiprocessor Linux by Davis Terrell
1. More: Building an SMP kernel by Michael K. Johnson
-> Question: SMP and module versions by
111. Question: Improving event timers? by
109. Question: measuring time to load a virtual mem page from disk by kandr
94. Note: using cli/sti() and save_flags/restore_flags() by george
93. Question: Protected Mode by ac
2. Feedback: 'Developers manual' from Intel(download)... by Mats Odman
1. News: Advanced 80386 Programming Techniques by Michael K. Johnson
92. Question: DMA buffer sizes by
2. Sad: DMA limits by Albert Cahalan <acahalan at>
1. Feedback: Not page size, page order by Michael K. Johnson
91. Question: Problem Getting the Kernel small enough by
2. Feedback: Check it's the right file, zImage not vmlinux by Cameron
1. Question: Usually easy, but.... by Ian Carr-de Avelon
89. Question: How to create /proc/sys variables? by Orlando Cantieni
88. Question: Linux for NeXT black? by Dale Amon
87. Question: vremap() in kernel modules? by Liam Wickins
86. Idea: giveing compatiblity to win95 for ext2 partitions (for programmers forced
to deal with both)
by pharos
1. Feedback: Working on it! by ibaird
-> Question: revision by ibarid
-> News: Untitled by Olaf
84. Question: setsockopt() error when triying to use ipfwadm for masquerading by
1. Idea: Re: masquerading by Charles Barrasso
83. Question: reset the irq 0 timer after APM suspend by Dong Chen
1. Feedback: Re: fixed, patch for kernel 2.0.30 by Dong Chen
77. Question: Source Code in C for make Linux partitions. by Limbert Sanabria
1. None: Untitled by lolley
76. None: How can I "cheat" and change the IP address (src,dest) in the sent socket? by Rami
4. None: Untitled by
3. None: Untitled by
1. Note: You have to know a bit of C (if u wanna learn) ;) by Lorenzo Cavallaro
2. None: Untitled
1. Feedback: Do it in the kernel by Michael K. Johnson
74. Question: Where is the source file for accept() by
1. None: Here, in /usr/src/linux/net/socket.c by
72. None: How can I use RAW SOCKETS in UNIX? by Rami
1. Feedback: Re: Raw sockets by
69. None: the KHG in spanish? by Jorge Alvarado Revatta
2. Feedback: Si tenga preguntas, quisa yo pueda ayudarte. by KernelJock
2. Question: Espaсol by LL2
1. Feedback: No esta aqui! Pero... by Michael K. Johnson
67. Question: How to get a Memory snapshot ? by Manuel Porras Brand
1. Disagree: Why not to get a memory snapshot? by Jukka Santala
66. Question: resources hard limits by
1. None: Setting resource limits by Jukka Santala
65. Question: How to invalidate a chache page by Gerhard Uttenthaler
1. More: Read the rest of the KHG! by Michael K. Johnson
64. Question: Where are the tunable parameters of the kernel? by
1. Note: Kernel tunable parameters by Jukka Santala
62. Question: How can my device driver access data structures in user space? by Stephan Theil
61. Question: Problem in doing RAW SOCKET Programming by anjali sharma
59. Question: Tunable Kernel Parameters? by
2. None: Increasing number of files in system by Simon Cooper
1. None: Increasing number of open files parameter by Simon Cooper
1. Feedback: sysctl in Linux by Jukka Santala
58. Question: ELF matters by Carlos Munoz
1. Feedback: Information about ELF Internals by Pat Ekman
57. Question: Droping Packets by Charles Barrasso
1. Feedback: [Selectively] Droping Packets by Jose R. cordones
56. Question: The /proc/profile by Charles Barrasso
1. Note: readprofile systool by Jukka Santala
55. Question: Can you block or ignore ICMP packets? by
4. Feedback: ICMP send rate limit / ignoring by Jukka Santala
1. More: Omission in earlier rate-limit... by Jukka Santala
-> News: Patch worked... by Jukka Santala
3. More: Using ipfwadm by Charles Barrasso
1. None: Icmp.c and kernal ping replies by Don Thomas
52. Question: encaps documentation by Kuang-chun Cheng
51. Question: Mounting Caldrea OpenDOS formatted fs's by Trey Childs
49. Question: finding the address that caused a SIGSEGV. by Ben Shelef
47. Sad: sti() called too late. by Erik Thiele
1. None: sti() called too late. by Gadi Oxman
38. Question: Module Development Info? by Mark S. Mathews
1. None: Needed here too by ajay
2. None: Help needed here too! by ajay
35. Question: Need quicker timer than 100 ms in kernel-module by Erik Thiele
1. News: 10 ms timer patch by Reinhold J. Gerharz
2. None: please send me 10 ms timer patch by Tolga Ayav
1. None: Please send me the patch by Jin Hwang
1. Feedback: UTIME: Microsecond Resolution Timers by BalajiSrinivasan
34. None: Need help with finding the linked list of unacked sk_buffs in TCP by Vijay Gupta
31. Question: Partition Type by Suman Ball
30. News: New document on exception handling by Michael K. Johnson
29. Question: How to make paralelism in to the kernel? by Delian Dlechev
27. Question: readv/writev & other sock funcs by Dave Wreski
25. None: I'd like to see the scheduler chapter by Tim Bird
1. None: Untitled by Vijay Gupta
3. Agree: Go ahead! by Michael K. Johnson
21. Question: Unable to access KHG, port 8080 giving problem. by Srihari Nelakuditi
1. None: Get a proxy by Michael K. Johnson
20. Question: proc fs docs? by David Woodruff
1. Note: Examples code as documentation by Jeremy Impson
18. Question: What is SOCK_RAW and how do I use it? by arkane
1. Feedback: What raw sockets are for. by Cameron MacKinnon
15. Idea: Linux kernel debugging by
2. News: GDB for Linux by David Grothe
2. News: Another kernel debugging tool by David Hinds
2. News: Kernel debugging with breakpoints by Keith Owens
-> None: Need help for debugging by C.H.Gopinath
1. News: gdb debugging of kernel now available by David Grothe
1. Question: Device debugging by alombard©
9. Question: Realtime mods anyone? by bill duncan
7. News: Summary of Linux Real-Time Status by Markus Kuhn
6. News: Hard real-time now available by Michael K. Johnson
2. Feedback: Shortcomings of RT-Linux by Balaji Srinivasan
1. Feedback: Firm Realtime available by Balaji Srinivasan
5. Idea: found some hacks ?!? by Mayk Langer
4. Feedback: POSIX.4 scheduler by Peter Monta
1. Feedback: cli()/sti() latency, hard numbers by Ingo Molnar
2. None: Realtime is already done(!) by Kai Harrekilde-Petersen
1. None: 100 ms real time should be easy by jeff millar
1. Feedback: Real-Time Applications with Linux POSIX.4 Scheduling by P. Woolley
7. Feedback: Why can't we incorporate new changes in linux kernel in KHG ? by Praveen Kumar Dwivedi
1. Agree: You can! by Michael K. Johnson
3. Idea: Kernel source code by Gabor J.Toth
1. Question: The sounds of silence... by Gabor J.Toth
1. Agree: Breaking the silence :) by Kyle Ferrio
1. More: Scribbling in the margins by Michael K. Johnson
2. Idea: It requires thought... by Michael K. Johnson
2. Note: Kernel source is already browsable online by Axel Boldt
2. None: Need easy way to download whole KHG
5. News: KHG being mirrored nightly for download! by Michael K. Johnson
2. Idea: postscript version of these documents? by Michael Stiller
1. Ok: Sure! by Michael K. Johnson
-> None: Not so Sure! by jeff millar
-> Disagree: Enough already! by Michael K. Johnson
1. Note: Mirror packages are available, but that's not really enough by Michael K. Johnson
4. None: Mirror whole KHG package, off line reading and Post to this site by Kim In-Sung
2. Note: Untitled by Jim Van Zandt
1. Note: That works. (using it now). Two tips: by Richard Braakman
2. Question: Appears to be a bug in getwww, though... by Michael K. Johnson
-> Feedback: Sucking up to the wrong site... ;) by Jukka Santala
1. Note: Help make the new KHG a success by Michael K. Johnson

to: "The Linux Kernel Hackers' Guide"

Subscribe Membership Admin Mode Show Frames Help for HyperNews 1.9.4

With any suggestions or questions please feel free to contact us