FreeBSD Developers' Handbook

The FreeBSD Documentation Project

Welcome to the Developers' Handbook. This manual is a work in progress and is the work of many individuals. Many sections do not yet exist and some of those that do exist need to be updated. If you are interested in helping with this project, send email to the FreeBSD documentation project mailing list.

The latest version of this document is always available from the FreeBSD World Wide Web server. It may also be downloaded in a variety of formats and compression options from the FreeBSD FTP server or one of the numerous mirror sites.

Table of Contents
I. Basics
1 Introduction
1.1 Developing on FreeBSD
1.2 The BSD Vision
1.3 Architectural Guidelines
1.4 The Layout of /usr/src
2 Programming Tools
2.1 Synopsis
2.2 Introduction
2.3 Introduction to Programming
2.4 Compiling with cc
2.5 Make
2.6 Debugging
2.7 Using Emacs as a Development Environment
2.8 Further Reading
3 Secure Programming
3.1 Synopsis
3.2 Secure Design Methodology
3.3 Buffer Overflows
3.4 SetUID issues
3.5 Limiting your program's environment
3.6 Trust
3.7 Race Conditions
4 Localization and Internationalization - L10N and I18N
4.1 Programming I18N Compliant Applications
5 Source Tree Guidelines and Policies
5.1 MAINTAINER on Makefiles
5.2 Contributed Software
5.3 Encumbered Files
5.4 Shared Libraries
6 Regression and Performance Testing
6.1. Micro Benchmark Checklist
II. Interprocess Communication
7 Sockets
7.1 Synopsis
7.2 Networking and Diversity
7.3 Protocols
7.4 The Sockets Model
7.5 Essential Socket Functions
7.6 Helper Functions
7.7 Concurrent Servers
8 IPv6 Internals
8.1 IPv6/IPsec Implementation
III. Kernel
9.1 DMA: What it is and How it Works
10 Bulding and Installing a FreeBSD Kernel
10.1 Building a Kernel the “Traditional” Way
10.2 Building a Kernel the “New” Way
11 Kernel Debugging
11.1 Obtaining a Kernel Crash Dump
11.2 Debugging a Kernel Crash Dump with kgdb
11.3 Debugging a Crash Dump with DDD
11.4 Post-Mortem Analysis of a Dump
11.5 On-Line Kernel Debugging Using DDB
11.6 On-Line Kernel Debugging Using Remote GDB
11.7 Debugging Loadable Modules Using GDB
11.8 Debugging a Console Driver
11.9 Debugging Deadlocks
11.10 Glossary of Kernel Options for Debugging
IV. Architectures
12 x86 Assembly Language Programming
12.1 Synopsis
12.2 The Tools
12.3 System Calls
12.4 Return Values
12.5 Creating Portable Code
12.6 Our First Program
12.7 Writing UNIX® Filters
12.8 Buffered Input and Output
12.9 Command Line Arguments
12.10 UNIX® Environment
12.11 Working with Files
12.12 One-Pointed Mind
12.13 Using the FPU
12.14 Caveats
12.15 Acknowledgements
V. Appendices
List of Examples
2-1. A sample .emacs file

This, and other documents, can be downloaded from

For questions about FreeBSD, read the documentation before contacting <>.
For questions about this documentation, e-mail <>.